Display the label of encrypted file systems (#760080)

LUKS headers don't provide any concept of label.  Also there is already
the method Partition::get_filesystem_label() for getting the *file
system* label, so virtualise it and provide an appropriate
implementation to get the label of an encrypted file system represented
within a derived PartitionLUKS object.  This causes the label to be
displayed correctly in the main window.

It also happens to display the encrypted file system label in the
Information dialog for a LUKS formatted partition.  However the whole
Information dialog will be addressed differently in a following commit.

Bug 760080 - Implement read-only LUKS support
This commit is contained in:
Mike Fleetwood 2015-12-27 15:01:15 +00:00 committed by Curtis Gedak
parent b45af51a92
commit 38a790d745
3 changed files with 11 additions and 1 deletions

View file

@ -113,7 +113,7 @@ public:
Sector get_sector() const ;
bool test_overlap( const Partition & partition ) const ;
bool filesystem_label_known() const;
Glib::ustring get_filesystem_label() const;
virtual Glib::ustring get_filesystem_label() const;
void set_filesystem_label( const Glib::ustring & filesystem_label );
bool operator==( const Partition & partition ) const ;

View file

@ -34,6 +34,8 @@ public:
Partition & get_encrypted() { return encrypted; };
const Partition & get_encrypted() const { return encrypted; };
virtual Glib::ustring get_filesystem_label() const;
private:
Partition encrypted;
};

View file

@ -37,4 +37,12 @@ PartitionLUKS * PartitionLUKS::clone() const
return new PartitionLUKS( *this );
}
// Return the label of the encrypted file system within, or "" if no open mapping.
Glib::ustring PartitionLUKS::get_filesystem_label() const
{
if ( busy )
return encrypted.get_filesystem_label();
return "";
}
} //GParted