[gparted] Implement label operation on encrypted file systems (#774818)



commit ff4ac89ba21a0bcdf3eb937df5360707a83d7380
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Thu Sep 8 14:13:31 2016 +0100

    Implement label operation on encrypted file systems (#774818)
    
    Again, just need to change the code when composing, describing and
    implementing the operation to query and set the Partition object
    directly containing the file system, instead of the enclosing encryption
    mapping to make it work.
    
    Bug 774818 - Implement LUKS read-write actions NOT requiring a
                 passphrase

 src/GParted_Core.cc             |    3 ++-
 src/OperationLabelFileSystem.cc |    4 ++--
 src/Win_GParted.cc              |    9 +++++----
 3 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index d163210..7f5af03 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -660,7 +660,8 @@ bool GParted_Core::apply_operation_to_disk( Operation * operation )
 
                case OPERATION_LABEL_FILESYSTEM:
                        success =    calibrate_partition( operation->get_partition_new(), 
operation->operation_detail )
-                                 && label_filesystem( operation->get_partition_new(), 
operation->operation_detail );
+                                 && label_filesystem( 
operation->get_partition_new().get_filesystem_partition(),
+                                                      operation->operation_detail );
                        break;
 
                case OPERATION_NAME_PARTITION:
diff --git a/src/OperationLabelFileSystem.cc b/src/OperationLabelFileSystem.cc
index c0b2cfe..8565317 100644
--- a/src/OperationLabelFileSystem.cc
+++ b/src/OperationLabelFileSystem.cc
@@ -49,7 +49,7 @@ void OperationLabelFileSystem::create_description()
 {
        g_assert( partition_new != NULL );  // Bug: Not initialised by constructor or reset later
 
-       if( partition_new->get_filesystem_label().empty() )
+       if( partition_new->get_filesystem_partition().get_filesystem_label().empty() )
        {
                /* TO TRANSLATORS: looks like   Clear file system Label on /dev/hda3 */
                description = String::ucompose( _("Clear file system label on %1"),
@@ -59,7 +59,7 @@ void OperationLabelFileSystem::create_description()
        {
                /* TO TRANSLATORS: looks like   Set file system label "My Label" on /dev/hda3 */
                description = String::ucompose( _("Set file system label \"%1\" on %2"),
-                                               partition_new->get_filesystem_label(),
+                                               
partition_new->get_filesystem_partition().get_filesystem_label(),
                                                partition_new->get_path() );
        }
 }
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index e89587e..3f0ba22 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -1238,7 +1238,7 @@ void Win_GParted::set_valid_operations()
                        allow_copy( true ) ;
                
                //only allow labelling of real partitions that support labelling
-               if ( selected_partition_ptr->status == STAT_REAL && fs.write_label )
+               if ( selected_partition_ptr->status == STAT_REAL && fs_cap.write_label )
                        allow_label_filesystem( true );
 
                //only allow changing UUID of real partitions that support it
@@ -2675,17 +2675,18 @@ void Win_GParted::activate_label_filesystem()
        g_assert( selected_partition_ptr != NULL );  // Bug: Partition callback without a selected partition
        g_assert( valid_display_partition_ptr( selected_partition_ptr ) );  // Bug: Not pointing at a valid 
display partition object
 
-       Dialog_FileSystem_Label dialog( *selected_partition_ptr );
+       const Partition & filesystem_ptn = selected_partition_ptr->get_filesystem_partition();
+       Dialog_FileSystem_Label dialog( filesystem_ptn );
        dialog .set_transient_for( *this );
 
        if (    dialog .run() == Gtk::RESPONSE_OK
-            && dialog.get_new_label() != selected_partition_ptr->get_filesystem_label() )
+            && dialog.get_new_label() != filesystem_ptn.get_filesystem_label() )
        {
                dialog .hide() ;
                // Make a duplicate of the selected partition (used in UNDO)
                Partition * part_temp = selected_partition_ptr->clone();
 
-               part_temp->set_filesystem_label( dialog.get_new_label() );
+               part_temp->get_filesystem_partition().set_filesystem_label( dialog.get_new_label() );
 
                Operation * operation = new OperationLabelFileSystem( devices[current_device],
                                                                      *selected_partition_ptr, *part_temp );


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