[gparted] Extend functions generating encrypted file system string (#774818)



commit 88136c96d7dd8576963c2e62eb2e9c85f5bff026
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Fri Sep 16 12:53:20 2016 +0100

    Extend functions generating encrypted file system string (#774818)
    
    Already have:
        Utils::get_filesystem_string(FS_EXT2)          -> "ext2"
        virtual Partition::get_filesystem_string()     -> "ext2"
        virtual PartitionLUKS::get_filesystem_string() -> "[Encrypted] ext2"
    Add these:
        Utils::get_encrypted_string()                  -> "[Encrypted]"
        Utils::get_filesystem_string(false, FS_EXT2)   -> "ext2"
        Utils::get_filesystem_string(true, FS_EXT2)    -> "[Encrypted] ext2"
    
    This is ready for use of Utils::get_filesystem_string(true, FS_EXT2)
    when composing the preview of a format of an encrypted file system by
    Win_GParted::activate_format().
    
    Bug 774818 - Implement LUKS read-write actions NOT requiring a
                 passphrase

 include/Utils.h      |    2 ++
 src/PartitionLUKS.cc |    6 ++----
 src/Utils.cc         |   11 +++++++++++
 3 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/include/Utils.h b/include/Utils.h
index 02271ef..bda3f19 100644
--- a/include/Utils.h
+++ b/include/Utils.h
@@ -181,6 +181,8 @@ public:
        static int get_max_partition_name_length( Glib::ustring & tabletype );
        static int get_filesystem_label_maxlength( FILESYSTEM filesystem ) ;
        static Glib::ustring get_filesystem_string( FILESYSTEM filesystem ) ;
+       static const Glib::ustring get_encrypted_string();
+       static const Glib::ustring get_filesystem_string( bool encrypted, FILESYSTEM fstype );
        static const Glib::ustring get_filesystem_kernel_name( FILESYSTEM fstype );
        static Glib::ustring get_filesystem_software( FILESYSTEM filesystem ) ;
        static bool kernel_supports_fs( const Glib::ustring & fs ) ;
diff --git a/src/PartitionLUKS.cc b/src/PartitionLUKS.cc
index 6a15ce2..9157dcc 100644
--- a/src/PartitionLUKS.cc
+++ b/src/PartitionLUKS.cc
@@ -209,11 +209,9 @@ Partition & PartitionLUKS::get_filesystem_partition()
 
 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;
+               return Utils::get_filesystem_string( true, encrypted.filesystem );
+       return Utils::get_encrypted_string();
 }
 
 } //GParted
diff --git a/src/Utils.cc b/src/Utils.cc
index b31ecdf..6b6c168 100644
--- a/src/Utils.cc
+++ b/src/Utils.cc
@@ -305,6 +305,17 @@ Glib::ustring Utils::get_filesystem_string( FILESYSTEM filesystem )
        }
 }
 
+const Glib::ustring Utils::get_encrypted_string()
+{
+       /* TO TRANSLATORS: means that this is an encrypted file system */
+       return "[" + Glib::ustring( _("Encrypted") ) + "]";
+}
+
+const Glib::ustring Utils::get_filesystem_string( bool encrypted, FILESYSTEM fstype )
+{
+       return get_encrypted_string() + " " + get_filesystem_string( fstype );
+}
+
 // Return Linux kernel name only for mountable file systems.
 // (Identical to a subset of the libparted names except that it's hfsplus instead of hfs+).
 const Glib::ustring Utils::get_filesystem_kernel_name( FILESYSTEM fstype )


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