From b10f2325d7cf0ed55edfc81e41d0f1bad9edab3f Mon Sep 17 00:00:00 2001 From: Curtis Gedak Date: Sun, 15 Jun 2008 17:18:26 +0000 Subject: [PATCH] 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 --- ChangeLog | 10 ++++++++++ include/Dialog_Base_Partition.h | 5 +++-- include/Dialog_Partition_New.h | 1 - src/Dialog_Base_Partition.cc | 18 +++++++++++++----- src/Dialog_Partition_New.cc | 11 ++--------- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 33c0568a..619d4b64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-06-15 Curtis Gedak + + * 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 * src/GParted_Core.cc: Changed 3 grammatical errors to dashes. diff --git a/include/Dialog_Base_Partition.h b/include/Dialog_Base_Partition.h index 2b0eec8a..303d464d 100644 --- a/include/Dialog_Base_Partition.h +++ b/include/Dialog_Base_Partition.h @@ -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 * it under the terms of the GNU General Public License as published by @@ -68,7 +68,8 @@ protected: Gtk::HBox hbox_main ; Gtk::SpinButton spinbutton_before, spinbutton_size, spinbutton_after; - + Gtk::CheckButton checkbutton_round_to_cylinders ; + //used to enable/disable OKbutton... int ORIG_BEFORE, ORIG_SIZE, ORIG_AFTER ; diff --git a/include/Dialog_Partition_New.h b/include/Dialog_Partition_New.h index 115e85d6..2f4a6339 100644 --- a/include/Dialog_Partition_New.h +++ b/include/Dialog_Partition_New.h @@ -43,7 +43,6 @@ private: Gtk::Table table_create; Gtk::OptionMenu optionmenu_type, optionmenu_filesystem; - Gtk::CheckButton checkbutton_round_to_cylinders ; Gtk::Menu menu_type, menu_filesystem; Gtk::Entry entry; diff --git a/src/Dialog_Base_Partition.cc b/src/Dialog_Base_Partition.cc index da21a6a4..06c25936 100644 --- a/src/Dialog_Base_Partition.cc +++ b/src/Dialog_Base_Partition.cc @@ -39,7 +39,7 @@ Dialog_Base_Partition::Dialog_Base_Partition() //pack hbox_main this ->get_vbox() ->pack_start( hbox_main, Gtk::PACK_SHRINK ); - + //put the vbox with resizer stuff (cool widget and spinbuttons) in the hbox_main hbox_main .pack_start( vbox_resize_move, Gtk::PACK_EXPAND_PADDING ); @@ -77,7 +77,12 @@ Dialog_Base_Partition::Dialog_Base_Partition() if ( ! fixed_start ) 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 if ( ! fixed_start ) spinbutton_before .signal_value_changed() .connect( @@ -118,11 +123,11 @@ void Dialog_Base_Partition::Set_Resizer( bool extended ) 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. if ( ORIG_BEFORE != spinbutton_before .get_value_as_int() ) selected_partition .sector_start = START + Sector(spinbutton_before .get_value_as_int()) * MEBIBYTE ; - + if ( ORIG_AFTER != spinbutton_after .get_value_as_int() ) selected_partition .sector_end = selected_partition .sector_start + Sector(spinbutton_size .get_value_as_int()) * MEBIBYTE ; @@ -143,7 +148,10 @@ Partition Dialog_Base_Partition::Get_New_Partition() //set new value of unused.. if ( selected_partition .sectors_used != -1 ) 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 ; } diff --git a/src/Dialog_Partition_New.cc b/src/Dialog_Partition_New.cc index 448075b7..4fcb2456 100644 --- a/src/Dialog_Partition_New.cc +++ b/src/Dialog_Partition_New.cc @@ -29,14 +29,6 @@ Dialog_Partition_New::Dialog_Partition_New() //set used (in pixels)... 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( 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, @@ -157,7 +149,7 @@ Partition Dialog_Partition_New::Get_New_Partition() 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. new_start = START + (Sector(spinbutton_before .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 ) ; } + //set indicator of whether to use strict sector values, or to round to cylinders part_temp .strict = ! checkbutton_round_to_cylinders .get_active() ; return part_temp;