[gparted] Pass Device object when setting up Dialog_Partition_New (#746214)



commit 6a9a06af0ead394d05657b4b57c5b35852282e61
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Tue Mar 17 21:14:31 2015 +0000

    Pass Device object when setting up Dialog_Partition_New (#746214)
    
    Adding a partition name entry to the Create New Partition dialog will
    need access to these two Device methods: partition_naming_supported()
    and get_max_partition_length().  The Set_Data() function already takes
    two parameters, only_unformatted and disktype, taken from Device member
    variables.
    
    Rather than add two more parameters to the Set_Data() function pass the
    Device object instead, replacing the current only_unformatted and
    disktype parameters.
    
    Bug 746214 - Partition name enhancements

 include/Dialog_Partition_New.h |   12 ++++++------
 src/Dialog_Partition_New.cc    |   15 +++++++--------
 src/Win_GParted.cc             |   13 ++++++-------
 3 files changed, 19 insertions(+), 21 deletions(-)
---
diff --git a/include/Dialog_Partition_New.h b/include/Dialog_Partition_New.h
index f12402e..a080dbb 100644
--- a/include/Dialog_Partition_New.h
+++ b/include/Dialog_Partition_New.h
@@ -19,6 +19,7 @@
 #define GPARTED_DIALOG_PARTITION_NEW_H
 
 #include "../include/Dialog_Base_Partition.h"
+#include "../include/Device.h"
 
 #include <gtkmm/optionmenu.h>
 
@@ -29,12 +30,11 @@ class Dialog_Partition_New : public Dialog_Base_Partition
 {
 public:
        Dialog_Partition_New() ;
-       void Set_Data( const Partition & partition,
-                      bool any_extended,
-                      unsigned short new_count,
-                      const std::vector<FS> & FILESYSTEMS,
-                      bool only_unformatted,
-                      Glib::ustring disktype );
+       void Set_Data( const Device & device,
+                      const Partition & partition,
+                      bool any_extended,
+                      unsigned short new_count,
+                      const std::vector<FS> & FILESYSTEMS );
        Partition Get_New_Partition( Byte_Value sector_size ) ;//overridden function
 
 private:
diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc
index b9f4c2a..ae9a227 100644
--- a/src/Dialog_Partition_New.cc
+++ b/src/Dialog_Partition_New.cc
@@ -32,12 +32,11 @@ Dialog_Partition_New::Dialog_Partition_New()
        frame_resizer_base ->set_used( 0 ) ;
 }
 
-void Dialog_Partition_New::Set_Data( const Partition & partition,
-                                    bool any_extended,
-                                    unsigned short new_count, 
-                                    const std::vector<FS> & FILESYSTEMS,
-                                    bool only_unformatted,
-                                    Glib::ustring disktype )
+void Dialog_Partition_New::Set_Data( const Device & device,
+                                     const Partition & partition,
+                                     bool any_extended,
+                                     unsigned short new_count,
+                                     const std::vector<FS> & FILESYSTEMS )
 {
        this ->new_count = new_count;
        this ->selected_partition = partition;
@@ -86,7 +85,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition,
        menu_type .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("Extended Partition") ) ) ;
        
        //determine which PartitionType is allowed
-       if ( disktype != "msdos" && disktype != "dvh" )
+       if ( device.disktype != "msdos" && device.disktype != "dvh" )
        {
                menu_type .items()[ 1 ] .set_sensitive( false ); 
                menu_type .items()[ 2 ] .set_sensitive( false );
@@ -120,7 +119,7 @@ void Dialog_Partition_New::Set_Data( const Partition & partition,
                             0, 1, 1, 2,
                             Gtk::FILL );
        
-       Build_Filesystems_Menu( only_unformatted ) ;
+       Build_Filesystems_Menu( device.readonly );
         
        optionmenu_filesystem .set_menu( menu_filesystem );
        optionmenu_filesystem .signal_changed() .connect( 
diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc
index da1a5c5..15b71a9 100644
--- a/src/Win_GParted.cc
+++ b/src/Win_GParted.cc
@@ -1833,13 +1833,12 @@ void Win_GParted::activate_new()
        {       
                Dialog_Partition_New dialog;
                
-               dialog .Set_Data( selected_partition, 
-                                 index_extended > -1,
-                                 new_count,
-                                 gparted_core .get_filesystems(),
-                                 devices[ current_device ] .readonly,
-                                 devices[ current_device ] .disktype ) ;
-               
+               dialog .Set_Data( devices[current_device],
+                                 selected_partition,
+                                 index_extended > -1,
+                                 new_count,
+                                 gparted_core.get_filesystems() );
+
                dialog .set_transient_for( *this );
                
                if ( dialog .run() == Gtk::RESPONSE_OK )


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