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
This commit is contained in:
Mike Fleetwood 2015-12-27 13:59:49 +00:00 committed by Curtis Gedak
parent 6e294dda05
commit cb3cc505ce
2 changed files with 24 additions and 5 deletions

View File

@ -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;

View File

@ -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() ) ;