[gparted] Add partition name to Create New Partition dialog (#746214)



commit 5fd7c926710ef831cdd8ea51990a64cc50af85ab
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat Mar 14 15:38:00 2015 +0000

    Add partition name to Create New Partition dialog (#746214)
    
    Add a partition name entry box to the Create New Partition dialog.  The
    entry box is greyed out (not sensitive) for partition table types which
    don't support partition naming.  Currently only supported for GPTs.  See
    Utils::get_max_partition_name_length() for details.
    
    There was a slightly wider gap between the file system combobox row and
    the label entry row when there were only three widgets on the right hand
    side of the dialog.  This has been removed now that there are four
    widgets so that they are all evenly spaced and they line up with the
    four widgets on the left hand side.
    
    So far the partition name can be entered and previewed, but isn't yet
    applied to the disk.
    
    Bug 746214 - Partition naming enhancements

 include/Dialog_Partition_New.h |    1 +
 src/Dialog_Partition_New.cc    |   22 +++++++++++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/include/Dialog_Partition_New.h b/include/Dialog_Partition_New.h
index a080dbb..93046dc 100644
--- a/include/Dialog_Partition_New.h
+++ b/include/Dialog_Partition_New.h
@@ -43,6 +43,7 @@ private:
        Gtk::Table table_create;
        Gtk::OptionMenu optionmenu_type, optionmenu_filesystem;
        Gtk::Menu menu_type, menu_filesystem;
+       Gtk::Entry partition_name_entry;
        Gtk::Entry filesystem_label_entry;
 
        std::vector<FS> FILESYSTEMS ;
diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc
index ae9a227..a1ecee1 100644
--- a/src/Dialog_Partition_New.cc
+++ b/src/Dialog_Partition_New.cc
@@ -114,21 +114,30 @@ void Dialog_Partition_New::Set_Data( const Device & device,
                sigc::bind<bool>( sigc::mem_fun( *this, &Dialog_Partition_New::optionmenu_changed ), true ) );
        table_create .attach( optionmenu_type, 1, 2, 0, 1, Gtk::FILL );
        
+       // Partition name
+       table_create.attach( *Utils::mk_label( static_cast<Glib::ustring>( _("Partition name:") ) + "\t" ),
+                            0, 1, 1, 2, Gtk::FILL );
+       // Initialise text entry box
+       partition_name_entry.set_width_chars( 20 );
+       partition_name_entry.set_sensitive( device.partition_naming_supported() );
+       partition_name_entry.set_max_length( device.get_max_partition_name_length() );
+       // Add entry box to table
+       table_create .attach( partition_name_entry, 1, 2, 1, 2, Gtk::FILL );
+
        //file systems to choose from 
        table_create .attach( * Utils::mk_label( static_cast<Glib::ustring>( _("File system:") ) + "\t" ),
-                            0, 1, 1, 2,
-                            Gtk::FILL );
-       
+                             0, 1, 2, 3, Gtk::FILL );
+
        Build_Filesystems_Menu( device.readonly );
         
        optionmenu_filesystem .set_menu( menu_filesystem );
        optionmenu_filesystem .signal_changed() .connect( 
                sigc::bind<bool>( sigc::mem_fun( *this, &Dialog_Partition_New::optionmenu_changed ), false ) 
);
-       table_create .attach( optionmenu_filesystem, 1, 2, 1, 2, Gtk::FILL );
+       table_create .attach( optionmenu_filesystem, 1, 2, 2, 3, Gtk::FILL );
 
        //Label
        table_create .attach( * Utils::mk_label( Glib::ustring( _("Label:") ) ),
-                       0, 1, 3, 4,     Gtk::FILL ) ;
+                             0, 1, 3, 4, Gtk::FILL );
        //Create Text entry box
        filesystem_label_entry.set_width_chars( 20 );
        //Add entry box to table
@@ -197,6 +206,9 @@ Partition Dialog_Partition_New::Get_New_Partition( Byte_Value sector_size )
                       sector_size,
                       selected_partition.inside_extended, false );
 
+       // Retrieve partition name
+       part_temp.name = Utils::trim( partition_name_entry.get_text() );
+
        //Retrieve Label info
        part_temp.set_filesystem_label( Utils::trim( filesystem_label_entry.get_text() ) );
        


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