[gparted] Display "[Encrypted] FSTYPE" in the File System column (#760080)



commit cb3cc505ce89d6f6fbb488defa826a389ae86cdc
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sun Dec 27 13:59:49 2015 +0000

    Display "[Encrypted] FSTYPE" in the File System column (#760080)
    
    In the File System column in the GUI, when there is an open dm-crypt
    mapping, display the colour square for the encrypted file system within
    and the text as "[Encrypted] FSTYPE".  For closed mappings nothing can
    be known about the encrypted file system within so continue to display a
    purple square and the text "[Encrypted]".
    
    Looks like:
    
        Partition        | File System
          ...
          /dev/sdb3        # ext4
        v /dev/sdb4    *   # extended
            /dev/sdb5      # [Encrypted]
            /dev/sdb6  *   # [Encrypted] unknown
            /dev/sdb7  *   # [Encrypted] ext4
    
    Bug 760080 - Implement read-only LUKS support

 include/PartitionLUKS.h |    3 ++-
 src/TreeView_Detail.cc  |   26 ++++++++++++++++++++++----
 2 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/include/PartitionLUKS.h b/include/PartitionLUKS.h
index beac772..823622b 100644
--- a/include/PartitionLUKS.h
+++ b/include/PartitionLUKS.h
@@ -31,7 +31,8 @@ public:
        virtual ~PartitionLUKS();
        virtual PartitionLUKS * clone() const;
 
-       Partition & get_encrypted()  { return encrypted; };
+       Partition & get_encrypted()              { return encrypted; };
+       const Partition & get_encrypted() const  { return encrypted; };
 
 private:
        Partition encrypted;
diff --git a/src/TreeView_Detail.cc b/src/TreeView_Detail.cc
index 66b2529..e619d63 100644
--- a/src/TreeView_Detail.cc
+++ b/src/TreeView_Detail.cc
@@ -17,6 +17,7 @@
  
 #include "../include/TreeView_Detail.h"
 #include "../include/Partition.h"
+#include "../include/PartitionLUKS.h"
 #include "../include/PartitionVector.h"
 
 namespace GParted
@@ -186,11 +187,28 @@ void TreeView_Detail::create_row( const Gtk::TreeRow & treerow, const Partition
        // name
        treerow[treeview_detail_columns.name] = partition.name;
 
-       treerow[ treeview_detail_columns .color ] = Utils::get_color_as_pixbuf( partition .filesystem, 16, 16 
) ; 
+       if ( partition.filesystem == FS_LUKS && partition.busy )
+       {
+               FILESYSTEM display_fstype = dynamic_cast< const PartitionLUKS *>( &partition 
)->get_encrypted().filesystem;
+               // file system
+               treerow[treeview_detail_columns.color] = Utils::get_color_as_pixbuf( display_fstype, 16, 16 );
+               /* TO TRANSLATORS: means that this is an encrypted file system */
+               treerow[treeview_detail_columns.filesystem] = "[" + Glib::ustring( _("Encrypted") ) + "] " +
+                                                             Utils::get_filesystem_string( display_fstype );
+       }
+       else if ( partition.filesystem == FS_LUKS && ! partition.busy )
+       {
+               // file system
+               treerow[treeview_detail_columns.color] = Utils::get_color_as_pixbuf( partition.filesystem, 
16, 16 );
+               treerow[treeview_detail_columns.filesystem] = "[" + Glib::ustring( _("Encrypted") ) + "]";
+       }
+       else
+       {
+               // file system
+               treerow[treeview_detail_columns.color] = Utils::get_color_as_pixbuf( partition.filesystem, 
16, 16 );
+               treerow[treeview_detail_columns.filesystem] = Utils::get_filesystem_string( 
partition.filesystem );
+       }
 
-       treerow[ treeview_detail_columns .filesystem ] = 
-               Utils::get_filesystem_string( partition .filesystem ) ;
-       
        //mount point
        treerow[ treeview_detail_columns .mountpoint ] = Glib::build_path( ", ", partition .get_mountpoints() 
) ;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]