[gparted] Time and check commands setting fat16/32 labels and UUIDs (#754684)



commit a202b4569a11455adf3ed15dc47f1ee13fd67cb4
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat Sep 5 13:29:10 2015 +0100

    Time and check commands setting fat16/32 labels and UUIDs (#754684)
    
    Replace open coding of the creation of the operation details for the
    mlabel command used to set the label and UUID with calls to
    FileSystem::execute_command() which will do it all.  This also results
    in the commands getting a time and check mark displayed in the operation
    details.
    
    Bug 754684 - Updates to FileSystem:: and Utils::execute_command()
                 functions

 src/fat16.cc |   24 ++----------------------
 1 files changed, 2 insertions(+), 22 deletions(-)
---
diff --git a/src/fat16.cc b/src/fat16.cc
index 033b325..1782e71 100644
--- a/src/fat16.cc
+++ b/src/fat16.cc
@@ -195,17 +195,7 @@ bool fat16::write_label( const Partition & partition, OperationDetail & operatio
        else
                cmd = "mlabel ::\"" + pad_label( partition.get_filesystem_label() ) + "\" -i " + 
partition.get_path();
 
-       operationdetail .add_child( OperationDetail( cmd, STATUS_NONE, FONT_BOLD_ITALIC ) ) ;
-
-       int exit_status = Utils::execute_command( cmd, output, error ) ;
-
-       if ( ! output .empty() )
-               operationdetail .get_last_child() .add_child( OperationDetail( output, STATUS_NONE, 
FONT_ITALIC ) ) ;
-
-       if ( ! error .empty() )
-               operationdetail .get_last_child() .add_child( OperationDetail( error, STATUS_NONE, 
FONT_ITALIC ) ) ;
-
-       return ( exit_status == 0 );
+       return ! execute_command( cmd, operationdetail, EXEC_CHECK_STATUS );
 }
 
 void fat16::read_uuid( Partition & partition )
@@ -232,17 +222,7 @@ bool fat16::write_uuid( const Partition & partition, OperationDetail & operation
 {
        Glib::ustring cmd = "mlabel -s -n :: -i " + partition.get_path();
 
-       operationdetail .add_child( OperationDetail( cmd, STATUS_NONE, FONT_BOLD_ITALIC ) ) ;
-
-       int exit_status = Utils::execute_command( cmd, output, error ) ;
-
-       if ( ! output .empty() )
-               operationdetail .get_last_child() .add_child( OperationDetail( output, STATUS_NONE, 
FONT_ITALIC ) ) ;
-
-       if ( ! error .empty() )
-               operationdetail .get_last_child() .add_child( OperationDetail( error, STATUS_NONE, 
FONT_ITALIC ) ) ;
-
-       return ( exit_status == 0 );
+       return ! execute_command( cmd, operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool fat16::create( const Partition & new_partition, OperationDetail & operationdetail )


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