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.
This commit is contained in:
Bart Hakvoort 2004-10-11 14:19:56 +00:00
parent 3dbaa30dba
commit fa5698e115
4 changed files with 47 additions and 26 deletions

View File

@ -1,3 +1,9 @@
2004-10-11 Bart Hakvoort <gparted@users.sf.net>
* 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 <gparted@users.sf.net> 2004-10-11 Bart Hakvoort <gparted@users.sf.net>
* src/Device.cc (Read_Disk_Layout): Again =) Decided to use switch ( blahblah ) instead of if else statements. * src/Device.cc (Read_Disk_Layout): Again =) Decided to use switch ( blahblah ) instead of if else statements.

View File

@ -91,6 +91,7 @@ private:
void find_devices_thread( ) { Find_Devices( ) ; pulse = false ; } void find_devices_thread( ) { Find_Devices( ) ; pulse = false ; }
//signal handlers //signal handlers
void open_operationslist() ;
void close_operationslist() ; void close_operationslist() ;
void clear_operationslist() ; void clear_operationslist() ;
void optionmenu_devices_changed( ); void optionmenu_devices_changed( );
@ -99,6 +100,7 @@ private:
void menu_gparted_refresh_devices(); void menu_gparted_refresh_devices();
void menu_gparted_quit(); void menu_gparted_quit();
void menu_view_harddisk_info(); void menu_view_harddisk_info();
void menu_view_operations();
void menu_help_contents(); void menu_help_contents();
void menu_help_about(); void menu_help_about();

View File

@ -193,12 +193,12 @@ void Device::Read_Disk_Layout( bool deep_scan )
case PED_PARTITION_FREESPACE: 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 ); partition_temp.Set_Unallocated( c_partition ->geom .start, c_partition ->geom .end, c_partition ->type == 4 ? false : true );
break ; break ;
case PED_PARTITION_METADATA: default: break;
break;
} }
if ( partition_temp .sector_start != -1 ) //paranoia check for unallocted space < 1 MB.. if ( partition_temp .sector_start != -1 ) //paranoia check for unallocted space < 1 MB..

View File

@ -58,21 +58,20 @@ Win_GParted::Win_GParted( )
vpaned_main .pack1( hpaned_main, true, true ) ; vpaned_main .pack1( hpaned_main, true, true ) ;
//vpaned_main.... //vpaned_main....
close_operationslist() ;
vbox_main.pack_start( vpaned_main ); vbox_main.pack_start( vpaned_main );
//device info... //device info...
init_device_info() ; init_device_info() ;
//operationslist... //operationslist...
init_operationslist() ; init_operationslist( ) ;
vpaned_main .pack2( hbox_operations, true, true ) ; vpaned_main .pack2( hbox_operations, true, true ) ;
//statusbar... //statusbar...
pulsebar = manage( new Gtk::ProgressBar() ); pulsebar = manage( new Gtk::ProgressBar() );
pulsebar ->set_pulse_step( 0.01 ); pulsebar ->set_pulse_step( 0.01 );
statusbar .add( *pulsebar ); statusbar .add( *pulsebar );
vbox_main.pack_start( statusbar, Gtk::PACK_SHRINK ); vbox_main .pack_start( statusbar, Gtk::PACK_SHRINK );
//popupmenu... //popupmenu...
init_popupmenu() ; init_popupmenu() ;
@ -82,8 +81,9 @@ Win_GParted::Win_GParted( )
this ->show_all_children(); this ->show_all_children();
//make sure harddisk information is closed.. //make sure harddisk information and operationlist are closed..
hpaned_main .get_child1() ->hide() ; hpaned_main .get_child1( ) ->hide( ) ;
close_operationslist( ) ;
} }
void Win_GParted::init_menubar() void Win_GParted::init_menubar()
@ -100,6 +100,7 @@ void Win_GParted::init_menubar()
//view //view
menu = manage( new Gtk::Menu() ) ; 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( _("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 ) ); menubar_main.items().push_back( Gtk::Menu_Helpers::MenuElem(_("_View"), *menu ) );
//help //help
@ -483,17 +484,8 @@ void Win_GParted::Add_Operation( OperationType operationtype, const Partition &
Refresh_Visual( ); Refresh_Visual( );
if ( operations.size() == 1 ) //first operation, open operationslist if ( operations.size() == 1 ) //first operation, open operationslist
{ 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();
}
}
//make scrollwindow focus on the last operation in the list //make scrollwindow focus on the last operation in the list
Gtk::TreeIter iter = liststore_operations->children().end() ; Gtk::TreeIter iter = liststore_operations->children().end() ;
iter-- ; 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() void Win_GParted::close_operationslist()
{ {
treeview_detail .columns_autosize() ; //seemed a nice place for it.. treeview_detail .columns_autosize() ; //seemed a nice place for it..
@ -689,17 +696,15 @@ void Win_GParted::close_operationslist()
vpaned_main.set_position( t ); vpaned_main.set_position( t );
while (Gtk::Main::events_pending()) Gtk::Main::iteration(); 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() void Win_GParted::clear_operationslist()
{ {
if ( operations.size() ) operations .clear() ;
{ Refresh_Visual() ;
operations .clear() ;
Refresh_Visual() ;
close_operationslist() ;
}
} }
void Win_GParted::optionmenu_devices_changed( ) 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() void Win_GParted::menu_help_contents()
{ {
str_temp = _("Sorry, not yet implemented.") ; str_temp = _("Sorry, not yet implemented.") ;