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
#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:

View File

@ -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(

View File

@ -1833,12 +1833,11 @@ 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 );