Migrated Round to cylinders checkbutton from dialog partition new to dialog base partition so that it can be used by all dialogs that inherit from dialog base partion (e.g., New, Copy, and Resize/Move)

svn path=/trunk/; revision=856
This commit is contained in:
Curtis Gedak 2008-06-15 17:18:26 +00:00
parent 21e965143e
commit b10f2325d7
5 changed files with 28 additions and 17 deletions

View File

@ -1,3 +1,13 @@
2008-06-15 Curtis Gedak <gedakc@gmail.com>
* include/Dialog_Base_Partition.h,
src/Dialog_Base_Partition.cc,
include/Dialog_Partition_New.h,
src/Dialog_Partition_New.cc: Migrated checkbutton.
- Moved "Round to cylinders" checkbutton from partition New
dialog to partition base dialog so that it may be used
by all inheritors (e.g., New, Copy, and Resize/Move).
2008-06-12 Curtis Gedak <gedakc@gmail.com> 2008-06-12 Curtis Gedak <gedakc@gmail.com>
* src/GParted_Core.cc: Changed 3 grammatical errors to dashes. * src/GParted_Core.cc: Changed 3 grammatical errors to dashes.

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart /* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -68,6 +68,7 @@ protected:
Gtk::HBox hbox_main ; Gtk::HBox hbox_main ;
Gtk::SpinButton spinbutton_before, spinbutton_size, spinbutton_after; Gtk::SpinButton spinbutton_before, spinbutton_size, spinbutton_after;
Gtk::CheckButton checkbutton_round_to_cylinders ;
//used to enable/disable OKbutton... //used to enable/disable OKbutton...
int ORIG_BEFORE, ORIG_SIZE, ORIG_AFTER ; int ORIG_BEFORE, ORIG_SIZE, ORIG_AFTER ;

View File

@ -43,7 +43,6 @@ private:
Gtk::Table table_create; Gtk::Table table_create;
Gtk::OptionMenu optionmenu_type, optionmenu_filesystem; Gtk::OptionMenu optionmenu_type, optionmenu_filesystem;
Gtk::CheckButton checkbutton_round_to_cylinders ;
Gtk::Menu menu_type, menu_filesystem; Gtk::Menu menu_type, menu_filesystem;
Gtk::Entry entry; Gtk::Entry entry;

View File

@ -78,6 +78,11 @@ Dialog_Base_Partition::Dialog_Base_Partition()
if ( ! fixed_start ) if ( ! fixed_start )
before_value = spinbutton_before .get_value() ; before_value = spinbutton_before .get_value() ;
//add checkbutton
checkbutton_round_to_cylinders .set_label( _("Round to cylinders") ) ;
checkbutton_round_to_cylinders .set_active( true ) ;
table_resize.attach( checkbutton_round_to_cylinders, 0, 1, 3, 4 ) ;
//connect signalhandlers of the spinbuttons //connect signalhandlers of the spinbuttons
if ( ! fixed_start ) if ( ! fixed_start )
spinbutton_before .signal_value_changed() .connect( spinbutton_before .signal_value_changed() .connect(
@ -118,7 +123,7 @@ void Dialog_Base_Partition::Set_Resizer( bool extended )
Partition Dialog_Base_Partition::Get_New_Partition() Partition Dialog_Base_Partition::Get_New_Partition()
{ {
//FIXME: Partition size is limited is just less than 1024 TeraBytes due //FIXME: Partition size is limited to just less than 1024 TeraBytes due
// to the maximum value of signed 4 byte integer. // to the maximum value of signed 4 byte integer.
if ( ORIG_BEFORE != spinbutton_before .get_value_as_int() ) if ( ORIG_BEFORE != spinbutton_before .get_value_as_int() )
selected_partition .sector_start = START + Sector(spinbutton_before .get_value_as_int()) * MEBIBYTE ; selected_partition .sector_start = START + Sector(spinbutton_before .get_value_as_int()) * MEBIBYTE ;
@ -144,6 +149,9 @@ Partition Dialog_Base_Partition::Get_New_Partition()
if ( selected_partition .sectors_used != -1 ) if ( selected_partition .sectors_used != -1 )
selected_partition .sectors_unused = selected_partition .get_length() - selected_partition .sectors_used ; selected_partition .sectors_unused = selected_partition .get_length() - selected_partition .sectors_used ;
//set indicator of whether to use strict sector values, or to round to cylinders
selected_partition .strict = ! checkbutton_round_to_cylinders .get_active() ;
return selected_partition ; return selected_partition ;
} }

View File

@ -29,14 +29,6 @@ Dialog_Partition_New::Dialog_Partition_New()
//set used (in pixels)... //set used (in pixels)...
frame_resizer_base ->set_used( 0 ) ; frame_resizer_base ->set_used( 0 ) ;
//checkbutton..
checkbutton_round_to_cylinders .set_label( _("Round to cylinders") ) ;
checkbutton_round_to_cylinders .set_active( true ) ;
checkbutton_round_to_cylinders .signal_clicked() .connect(
sigc::bind<bool>( sigc::mem_fun(*this, &Dialog_Partition_New::optionmenu_changed), false ) ) ;
this ->get_vbox() ->pack_start( checkbutton_round_to_cylinders, Gtk::PACK_SHRINK ) ;
} }
void Dialog_Partition_New::Set_Data( const Partition & partition, void Dialog_Partition_New::Set_Data( const Partition & partition,
@ -157,7 +149,7 @@ Partition Dialog_Partition_New::Get_New_Partition()
default : part_type = GParted::TYPE_UNALLOCATED ; default : part_type = GParted::TYPE_UNALLOCATED ;
} }
//FIXME: Partition size is limited is just less than 1024 TeraBytes due //FIXME: Partition size is limited to just less than 1024 TeraBytes due
// to the maximum value of signed 4 byte integer. // to the maximum value of signed 4 byte integer.
new_start = START + (Sector(spinbutton_before .get_value_as_int()) * MEBIBYTE) ; new_start = START + (Sector(spinbutton_before .get_value_as_int()) * MEBIBYTE) ;
new_end = new_start + (Sector(spinbutton_size .get_value_as_int()) * MEBIBYTE) ; new_end = new_start + (Sector(spinbutton_size .get_value_as_int()) * MEBIBYTE) ;
@ -197,6 +189,7 @@ Partition Dialog_Partition_New::Get_New_Partition()
part_temp .logicals .push_back( UNALLOCATED ) ; part_temp .logicals .push_back( UNALLOCATED ) ;
} }
//set indicator of whether to use strict sector values, or to round to cylinders
part_temp .strict = ! checkbutton_round_to_cylinders .get_active() ; part_temp .strict = ! checkbutton_round_to_cylinders .get_active() ;
return part_temp; return part_temp;