Provide virtual Partition::get_filesystem_string() method (#774818)
Provide and use a single interface for getting the file system string for display, regardless of whether the partition is encrypted or the encryption mapping is active or not. Example return values for get_filesystem_string() for different types and states of Partition objects: 1) Plain ext4 file system: -> "ext4" 2) Closed encrypted: -> "[Encrypted]" 3) Open encrypted ext4 file system: -> "[Encrypted] ext4" This simplifies the code in TreeView_Detail::create_row() which sets the file system type displayed in the main window. The same method will then also be used when setting the operation description as each operation is updated to handle encrypted file systems. Bug 774818 - Implement LUKS read-write actions NOT requiring a passphrase
This commit is contained in:
parent
aa49b763e4
commit
bd6fc67afb
|
@ -135,6 +135,9 @@ public:
|
|||
// file system. Will be overridden in derived PartitionLUKS.
|
||||
virtual const Partition & get_filesystem_partition() const { return *this; };
|
||||
|
||||
virtual const Glib::ustring get_filesystem_string() const
|
||||
{ return Utils::get_filesystem_string( filesystem ); };
|
||||
|
||||
bool operator==( const Partition & partition ) const ;
|
||||
bool operator!=( const Partition & partition ) const ;
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ public:
|
|||
|
||||
virtual const Partition & get_filesystem_partition() const;
|
||||
|
||||
virtual const Glib::ustring get_filesystem_string() const;
|
||||
|
||||
private:
|
||||
Partition encrypted;
|
||||
Sector header_size; // Size of the LUKS header (everything up to the start of the mapping)
|
||||
|
|
|
@ -200,4 +200,13 @@ const Partition & PartitionLUKS::get_filesystem_partition() const
|
|||
return *this;
|
||||
}
|
||||
|
||||
const Glib::ustring PartitionLUKS::get_filesystem_string() const
|
||||
{
|
||||
/* TO TRANSLATORS: means that this is an encrypted file system */
|
||||
Glib::ustring fs_str = "[" + Glib::ustring( _("Encrypted") ) + "]";
|
||||
if ( busy )
|
||||
fs_str += " " + Utils::get_filesystem_string( encrypted.filesystem );
|
||||
return fs_str;
|
||||
}
|
||||
|
||||
} //GParted
|
||||
|
|
|
@ -184,21 +184,7 @@ void TreeView_Detail::create_row( const Gtk::TreeRow & treerow,
|
|||
|
||||
// file system
|
||||
treerow[treeview_detail_columns.color] = Utils::get_color_as_pixbuf( filesystem_ptn.filesystem, 16, 16 );
|
||||
if ( partition.filesystem == FS_LUKS && partition.busy )
|
||||
{
|
||||
const Partition & encrypted = dynamic_cast<const PartitionLUKS *>( &partition )->get_encrypted();
|
||||
/* TO TRANSLATORS: means that this is an encrypted file system */
|
||||
treerow[treeview_detail_columns.filesystem] = "[" + Glib::ustring( _("Encrypted") ) + "] " +
|
||||
Utils::get_filesystem_string( encrypted.filesystem );
|
||||
}
|
||||
else if ( partition.filesystem == FS_LUKS && ! partition.busy )
|
||||
{
|
||||
treerow[treeview_detail_columns.filesystem] = "[" + Glib::ustring( _("Encrypted") ) + "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
treerow[treeview_detail_columns.filesystem] = Utils::get_filesystem_string( partition.filesystem );
|
||||
}
|
||||
treerow[treeview_detail_columns.filesystem] = partition.get_filesystem_string();
|
||||
|
||||
// mount point
|
||||
std::vector<Glib::ustring> temp_mountpoints = filesystem_ptn.get_mountpoints();
|
||||
|
|
Loading…
Reference in New Issue