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
This commit is contained in:
Mike Fleetwood 2015-03-17 21:14:31 +00:00 committed by Curtis Gedak
parent 650f4c7f20
commit 6a9a06af0e
3 changed files with 19 additions and 21 deletions

View File

@ -19,6 +19,7 @@
#define GPARTED_DIALOG_PARTITION_NEW_H #define GPARTED_DIALOG_PARTITION_NEW_H
#include "../include/Dialog_Base_Partition.h" #include "../include/Dialog_Base_Partition.h"
#include "../include/Device.h"
#include <gtkmm/optionmenu.h> #include <gtkmm/optionmenu.h>
@ -29,12 +30,11 @@ class Dialog_Partition_New : public Dialog_Base_Partition
{ {
public: public:
Dialog_Partition_New() ; Dialog_Partition_New() ;
void Set_Data( const Partition & partition, void Set_Data( const Device & device,
bool any_extended, const Partition & partition,
unsigned short new_count, bool any_extended,
const std::vector<FS> & FILESYSTEMS, unsigned short new_count,
bool only_unformatted, const std::vector<FS> & FILESYSTEMS );
Glib::ustring disktype );
Partition Get_New_Partition( Byte_Value sector_size ) ;//overridden function Partition Get_New_Partition( Byte_Value sector_size ) ;//overridden function
private: private:

View File

@ -32,12 +32,11 @@ Dialog_Partition_New::Dialog_Partition_New()
frame_resizer_base ->set_used( 0 ) ; frame_resizer_base ->set_used( 0 ) ;
} }
void Dialog_Partition_New::Set_Data( const Partition & partition, void Dialog_Partition_New::Set_Data( const Device & device,
bool any_extended, const Partition & partition,
unsigned short new_count, bool any_extended,
const std::vector<FS> & FILESYSTEMS, unsigned short new_count,
bool only_unformatted, const std::vector<FS> & FILESYSTEMS )
Glib::ustring disktype )
{ {
this ->new_count = new_count; this ->new_count = new_count;
this ->selected_partition = partition; 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") ) ) ; menu_type .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("Extended Partition") ) ) ;
//determine which PartitionType is allowed //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()[ 1 ] .set_sensitive( false );
menu_type .items()[ 2 ] .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, 0, 1, 1, 2,
Gtk::FILL ); Gtk::FILL );
Build_Filesystems_Menu( only_unformatted ) ; Build_Filesystems_Menu( device.readonly );
optionmenu_filesystem .set_menu( menu_filesystem ); optionmenu_filesystem .set_menu( menu_filesystem );
optionmenu_filesystem .signal_changed() .connect( optionmenu_filesystem .signal_changed() .connect(

View File

@ -1833,12 +1833,11 @@ void Win_GParted::activate_new()
{ {
Dialog_Partition_New dialog; Dialog_Partition_New dialog;
dialog .Set_Data( selected_partition, dialog .Set_Data( devices[current_device],
index_extended > -1, selected_partition,
new_count, index_extended > -1,
gparted_core .get_filesystems(), new_count,
devices[ current_device ] .readonly, gparted_core.get_filesystems() );
devices[ current_device ] .disktype ) ;
dialog .set_transient_for( *this ); dialog .set_transient_for( *this );