From fa5698e115328a93dd4862bca2b8b060f9c84c08 Mon Sep 17 00:00:00 2001 From: Bart Hakvoort Date: Mon, 11 Oct 2004 14:19:56 +0000 Subject: [PATCH] logic unallocated space wasn't read correctly, fixed. added * src/Device.cc (Read_Disk_Layout): logic unallocated space wasn't read correctly, fixed. * include/Win_GParted.h: added open_operationslist() and menu_view_operations() . * src/Win_GParted.cc: tweaked operationlist behaviour a bit. Also added 'Operations" toggle-item to View menu. --- ChangeLog | 6 +++++ include/Win_GParted.h | 2 ++ src/Device.cc | 6 ++--- src/Win_GParted.cc | 59 ++++++++++++++++++++++++++----------------- 4 files changed, 47 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07802752..db166596 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-10-11 Bart Hakvoort + + * src/Device.cc (Read_Disk_Layout): logic unallocated space wasn't read correctly, fixed. + * include/Win_GParted.h: added open_operationslist() and menu_view_operations() . + * src/Win_GParted.cc: tweaked operationlist behaviour a bit. Also added 'Operations" toggle-item to View menu. + 2004-10-11 Bart Hakvoort * src/Device.cc (Read_Disk_Layout): Again =) Decided to use switch ( blahblah ) instead of if else statements. diff --git a/include/Win_GParted.h b/include/Win_GParted.h index c55a4087..06d6dc71 100644 --- a/include/Win_GParted.h +++ b/include/Win_GParted.h @@ -91,6 +91,7 @@ private: void find_devices_thread( ) { Find_Devices( ) ; pulse = false ; } //signal handlers + void open_operationslist() ; void close_operationslist() ; void clear_operationslist() ; void optionmenu_devices_changed( ); @@ -99,6 +100,7 @@ private: void menu_gparted_refresh_devices(); void menu_gparted_quit(); void menu_view_harddisk_info(); + void menu_view_operations(); void menu_help_contents(); void menu_help_about(); diff --git a/src/Device.cc b/src/Device.cc index bd88410a..68b0c272 100644 --- a/src/Device.cc +++ b/src/Device.cc @@ -193,12 +193,12 @@ void Device::Read_Disk_Layout( bool deep_scan ) case PED_PARTITION_FREESPACE: + case 5: //freespace inside extended (there's no enumvalue for that..) partition_temp.Set_Unallocated( c_partition ->geom .start, c_partition ->geom .end, c_partition ->type == 4 ? false : true ); break ; - - case PED_PARTITION_METADATA: - break; + + default: break; } if ( partition_temp .sector_start != -1 ) //paranoia check for unallocted space < 1 MB.. diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index a3503c0c..e2e883b2 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -58,21 +58,20 @@ Win_GParted::Win_GParted( ) vpaned_main .pack1( hpaned_main, true, true ) ; //vpaned_main.... - close_operationslist() ; vbox_main.pack_start( vpaned_main ); //device info... init_device_info() ; //operationslist... - init_operationslist() ; + init_operationslist( ) ; vpaned_main .pack2( hbox_operations, true, true ) ; //statusbar... pulsebar = manage( new Gtk::ProgressBar() ); pulsebar ->set_pulse_step( 0.01 ); statusbar .add( *pulsebar ); - vbox_main.pack_start( statusbar, Gtk::PACK_SHRINK ); + vbox_main .pack_start( statusbar, Gtk::PACK_SHRINK ); //popupmenu... init_popupmenu() ; @@ -82,8 +81,9 @@ Win_GParted::Win_GParted( ) this ->show_all_children(); - //make sure harddisk information is closed.. - hpaned_main .get_child1() ->hide() ; + //make sure harddisk information and operationlist are closed.. + hpaned_main .get_child1( ) ->hide( ) ; + close_operationslist( ) ; } void Win_GParted::init_menubar() @@ -100,6 +100,7 @@ void Win_GParted::init_menubar() //view menu = manage( new Gtk::Menu() ) ; menu ->items() .push_back( Gtk::Menu_Helpers::CheckMenuElem( _("Harddisk Information"), sigc::mem_fun(*this, &Win_GParted::menu_view_harddisk_info) ) ); + menu ->items() .push_back( Gtk::Menu_Helpers::CheckMenuElem( _("Operations"), sigc::mem_fun(*this, &Win_GParted::menu_view_operations) ) ); menubar_main.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_View"), *menu ) ); //help @@ -483,17 +484,8 @@ void Win_GParted::Add_Operation( OperationType operationtype, const Partition & Refresh_Visual( ); if ( operations.size() == 1 ) //first operation, open operationslist - { - int x,y; this ->get_size( x, y ); - y -= 300; - - for ( int t=vpaned_main.get_position() ; t > y ; t-=3 ) - { - vpaned_main.set_position( t ); - while (Gtk::Main::events_pending()) Gtk::Main::iteration(); - } - } - + open_operationslist( ) ; + //make scrollwindow focus on the last operation in the list Gtk::TreeIter iter = liststore_operations->children().end() ; iter-- ; @@ -678,6 +670,21 @@ void Win_GParted::Set_Valid_Convert_Filesystems() } } +void Win_GParted::open_operationslist() +{ + hbox_operations .show( ) ; + int x,y; this ->get_size( x, y ); + y -= 300; + + for ( int t=vpaned_main.get_position() ; t > y ; t-=3 ) + { + vpaned_main.set_position( t ); + while (Gtk::Main::events_pending()) Gtk::Main::iteration(); + } + + ( (Gtk::CheckMenuItem *) & menubar_main .items() [ 1 ] .get_submenu() ->items() [ 1 ] ) ->set_active( true ) ; +} + void Win_GParted::close_operationslist() { treeview_detail .columns_autosize() ; //seemed a nice place for it.. @@ -689,17 +696,15 @@ void Win_GParted::close_operationslist() vpaned_main.set_position( t ); while (Gtk::Main::events_pending()) Gtk::Main::iteration(); } - + + hbox_operations .hide( ) ; + ( (Gtk::CheckMenuItem *) & menubar_main .items() [ 1 ] .get_submenu() ->items() [ 1 ] ) ->set_active( false ) ; } void Win_GParted::clear_operationslist() { - if ( operations.size() ) - { - operations .clear() ; - Refresh_Visual() ; - close_operationslist() ; - } + operations .clear() ; + Refresh_Visual() ; } void Win_GParted::optionmenu_devices_changed( ) @@ -769,6 +774,14 @@ void Win_GParted::menu_view_harddisk_info() } } +void Win_GParted::menu_view_operations() +{ + if ( ( (Gtk::CheckMenuItem *) & menubar_main .items() [ 1 ] .get_submenu() ->items() [ 1 ] ) ->get_active() ) + open_operationslist( ) ; + else + close_operationslist( ) ; +} + void Win_GParted::menu_help_contents() { str_temp = _("Sorry, not yet implemented.") ;