[gparted] Display the label of encrypted file systems (#760080)



commit 38a790d7451241470989e18b66dd365eb3cf7754
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sun Dec 27 15:01:15 2015 +0000

    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

 include/Partition.h     |    2 +-
 include/PartitionLUKS.h |    2 ++
 src/PartitionLUKS.cc    |    8 ++++++++
 3 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/include/Partition.h b/include/Partition.h
index e8cd75f..b571719 100644
--- a/include/Partition.h
+++ b/include/Partition.h
@@ -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 ;
diff --git a/include/PartitionLUKS.h b/include/PartitionLUKS.h
index 823622b..46c83bb 100644
--- a/include/PartitionLUKS.h
+++ b/include/PartitionLUKS.h
@@ -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;
 };
diff --git a/src/PartitionLUKS.cc b/src/PartitionLUKS.cc
index b6d070c..878f119 100644
--- a/src/PartitionLUKS.cc
+++ b/src/PartitionLUKS.cc
@@ -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


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