From fc8014115eb33b53a3d44247c67f5d6b114c434c Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Sat, 16 Sep 2006 11:27:05 +0000 Subject: [PATCH] some small changes to make the GUI more consistent (#353140) * include/Win_GParted.h, src/Win_GParted.cc: some small changes to make the GUI more consistent (#353140) --- ChangeLog | 6 ++++++ include/Win_GParted.h | 21 ++++++++++++--------- src/Win_GParted.cc | 43 ++++++++++--------------------------------- 3 files changed, 28 insertions(+), 42 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58105fd9..b8ed2a18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-09-16 Bart Hakvoort + + * include/Win_GParted.h, + src/Win_GParted.cc: some small changes to make the GUI more + consistent (#353140) + 2006-09-14 Bart Hakvoort * configure.in: changed libpartedcheck a bit. from now on we declare diff --git a/include/Win_GParted.h b/include/Win_GParted.h index db5098ce..7a950430 100644 --- a/include/Win_GParted.h +++ b/include/Win_GParted.h @@ -104,16 +104,20 @@ private: void allow_info( bool state ) { toggle_item( state, MENU_INFO ) ; } - - void allow_undo( bool state ) { + + void allow_undo_clear_apply( bool state ) + { toggle_item( state, -1, TOOLBAR_UNDO ) ; static_cast( & menubar_main .items()[ 1 ] .get_submenu() ->items()[ 0 ] ) - ->set_sensitive( state ) ; } - - void allow_apply( bool state ) { - toggle_item( state, -1, TOOLBAR_APPLY ) ; + ->set_sensitive( state ) ; + static_cast( & menubar_main .items()[ 1 ] .get_submenu() ->items()[ 1 ] ) - ->set_sensitive( state ) ; } + ->set_sensitive( state ) ; + + toggle_item( state, -1, TOOLBAR_APPLY ) ; + static_cast( & menubar_main .items()[ 1 ] .get_submenu() ->items()[ 2 ] ) + ->set_sensitive( state ) ; + } //threads.. void thread_refresh_devices() ; @@ -169,7 +173,7 @@ private: //gui stuff Gtk::HPaned hpaned_main; Gtk::VPaned vpaned_main; - Gtk::VBox vbox_main,vbox_info, *vbox; + Gtk::VBox vbox_main,vbox_info ; Gtk::HBox hbox_toolbar, hbox_operations, *hbox; Gtk::Toolbar toolbar_main; Gtk::MenuBar menubar_main; @@ -181,7 +185,6 @@ private: Gtk::ScrolledWindow *scrollwindow; Gtk::Label label_device_info1, label_device_info2, *label; Gtk::Tooltips tooltips ; - Gtk::Button *button; Gtk::Table *table ; Gtk::MenuItem *menu_item; Gtk::ProgressBar pulsebar ; diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index 9b65bd84..df8ea9ab 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -138,7 +138,10 @@ void Win_GParted::init_menubar() //edit menu = manage( new Gtk::Menu() ) ; - menu ->items() .push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::UNDO, Gtk::AccelKey("z"), sigc::mem_fun(*this, &Win_GParted::activate_undo) ) ); + menu ->items() .push_back( Gtk::Menu_Helpers::StockMenuElem( + Gtk::Stock::UNDO, Gtk::AccelKey("z"), sigc::mem_fun(*this, &Win_GParted::activate_undo) ) ); + menu ->items() .push_back( Gtk::Menu_Helpers::StockMenuElem( + Gtk::Stock::CLEAR, sigc::mem_fun(*this, &Win_GParted::clear_operationslist) ) ); menu ->items() .push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::APPLY, sigc::mem_fun(*this, &Win_GParted::activate_apply) ) ); menubar_main .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("_Edit"), *menu ) ); @@ -454,39 +457,17 @@ void Win_GParted::init_operationslist() treeview_operations .append_column( "", treeview_operations_columns .operation_icon ); treeview_operations .append_column( "", treeview_operations_columns .operation_description ); treeview_operations .get_selection() ->set_mode( Gtk::SELECTION_NONE ); - + //init scrollwindow_operations scrollwindow = manage( new Gtk::ScrolledWindow( ) ) ; scrollwindow ->set_shadow_type( Gtk::SHADOW_ETCHED_IN ); scrollwindow ->set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC ); scrollwindow ->add ( treeview_operations ) ; - //set up the close and clear buttons and pack them in a vbox - vbox = manage( new Gtk::VBox( ) ) ; - //CLOSE - button = manage( new Gtk::Button( ) ); - image = manage( new Gtk::Image( Gtk::Stock::CLOSE, Gtk::ICON_SIZE_MENU ) ); - button ->add( *image ) ; - button ->set_relief( Gtk::RELIEF_NONE ); - tooltips .set_tip( *button, _("Hide operationslist") ); - button ->signal_clicked( ) .connect( sigc::mem_fun( *this, &Win_GParted::close_operationslist ) ); - vbox ->pack_start( *button, Gtk::PACK_SHRINK ); - - //CLEAR - button = manage( new Gtk::Button( ) ); - image = manage( new Gtk::Image( Gtk::Stock::CLEAR, Gtk::ICON_SIZE_MENU ) ); - button ->add( *image ) ; - button ->set_relief( Gtk::RELIEF_NONE ); - tooltips .set_tip( *button, _("Clear operationslist") ); - button ->signal_clicked( ) .connect( sigc::mem_fun( *this, &Win_GParted::clear_operationslist ) ); - vbox ->pack_start( *button, Gtk::PACK_SHRINK ); - - //add vbox and scrollwindow_operations to hbox_operations - hbox_operations .pack_start( *vbox, Gtk::PACK_SHRINK ); hbox_operations .pack_start( *scrollwindow, Gtk::PACK_EXPAND_WIDGET ); } -void Win_GParted::init_hpaned_main( ) +void Win_GParted::init_hpaned_main() { //left scrollwindow (holds device info) scrollwindow = manage( new Gtk::ScrolledWindow( ) ) ; @@ -632,9 +613,7 @@ void Win_GParted::Add_Operation( Operation * operation, int index ) else operations .push_back( operation ); - allow_undo( true ) ; - allow_apply( true ) ; - + allow_undo_clear_apply( true ) ; Refresh_Visual(); if ( operations .size() == 1 ) //first operation, open operationslist @@ -684,10 +663,7 @@ void Win_GParted::Refresh_Visual() statusbar .push( _( "1 operation pending" ) ); if ( ! operations .size() ) - { - allow_undo( false ); - allow_apply( false ); - } + allow_undo_clear_apply( false ) ; //count primary's and check for extended index_extended = -1 ; @@ -927,6 +903,7 @@ void Win_GParted::close_operationslist() void Win_GParted::clear_operationslist() { remove_operation( -1, true ) ; + close_operationslist() ; Refresh_Visual() ; } @@ -969,7 +946,7 @@ void Win_GParted::on_show() menu_gparted_refresh_devices() ; } - + void Win_GParted::thread_refresh_devices() { gparted_core .set_devices( devices ) ;