Added a menu 'Edit' which contains 'Undo' and 'Apply'. (#322550)

* include/Win_GParted.h,
  src/Win_GParted.cc: Added a menu 'Edit' which contains 'Undo' and
  'Apply'. (#322550)
This commit is contained in:
Bart Hakvoort 2005-11-27 19:48:00 +00:00
parent f3f13d2082
commit 1bbcf787b1
3 changed files with 55 additions and 16 deletions

View File

@ -1,3 +1,8 @@
2005-11-27 Bart Hakvoort <hakvoort@cvs.gnome.org>
* include/Win_GParted.h,
src/Win_GParted.cc: Added a menu 'Edit' which contains 'Undo' and
'Apply'. (#322550)
2005-11-27 Bart Hakvoort <hakvoort@cvs.gnome.org>
* configure.in: raised dependencies to >=gtkmm-2.6 and >=parted-1.6.25

View File

@ -77,18 +77,46 @@ private:
void Set_Valid_Convert_Filesystems( ) ; //determines to which filesystems a partition can be converted
//convenience functions
void allow_new( bool b ) { menu_partition .items( )[ 0 ] .set_sensitive( b ); toolbar_main .get_nth_item( 0 ) ->set_sensitive( b ); }
void allow_delete( bool b ) { menu_partition .items( )[ 1 ] .set_sensitive( b ); toolbar_main .get_nth_item( 1 ) ->set_sensitive( b ); }
void allow_resize( bool b ) { menu_partition .items( )[ 3 ] .set_sensitive( b ); toolbar_main .get_nth_item( 3 ) ->set_sensitive( b ); }
void allow_copy( bool b ) { menu_partition .items( )[ 5 ] .set_sensitive( b ); toolbar_main .get_nth_item( 5 ) ->set_sensitive( b ); }
void allow_paste( bool b ) { menu_partition .items( )[ 6 ] .set_sensitive( b ); toolbar_main .get_nth_item( 6 ) ->set_sensitive( b ); }
void allow_convert( bool b ) { menu_partition .items( )[ 8 ] .set_sensitive( b ); }
void allow_unmount( bool b ) { menu_partition .items( )[ 10 ] .set_sensitive( b ); }
void allow_info( bool b ) { menu_partition .items( )[ 12 ] .set_sensitive( b ); }
void allow_undo( bool b ) { toolbar_main .get_nth_item( 8 ) ->set_sensitive( b ); }
void allow_apply( bool b ) { toolbar_main .get_nth_item( 9 ) ->set_sensitive( b ); }
void allow_new( bool b ) {
menu_partition .items( )[ 0 ] .set_sensitive( b );
toolbar_main .get_nth_item( 0 ) ->set_sensitive( b ); }
void find_devices_thread( ) { gparted_core .get_devices( devices ) ; pulse = false ; }
void allow_delete( bool b ) {
menu_partition .items( )[ 1 ] .set_sensitive( b );
toolbar_main .get_nth_item( 1 ) ->set_sensitive( b ); }
void allow_resize( bool b ) {
menu_partition .items( )[ 3 ] .set_sensitive( b );
toolbar_main .get_nth_item( 3 ) ->set_sensitive( b ); }
void allow_copy( bool b ) {
menu_partition .items( )[ 5 ] .set_sensitive( b );
toolbar_main .get_nth_item( 5 ) ->set_sensitive( b ); }
void allow_paste( bool b ) {
menu_partition .items( )[ 6 ] .set_sensitive( b );
toolbar_main .get_nth_item( 6 ) ->set_sensitive( b ); }
void allow_convert( bool b ) {
menu_partition .items( )[ 8 ] .set_sensitive( b ); }
void allow_unmount( bool b ) {
menu_partition .items( )[ 10 ] .set_sensitive( b ); }
void allow_info( bool b ) {
menu_partition .items( )[ 12 ] .set_sensitive( b ); }
void allow_undo( bool b ) {
toolbar_main .get_nth_item( 8 ) ->set_sensitive( b );
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( ) ->items( ) [ 0 ] ) ->set_sensitive( b ) ; }
void allow_apply( bool b ) {
toolbar_main .get_nth_item( 9 ) ->set_sensitive( b );
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( ) ->items( ) [ 1 ] ) ->set_sensitive( b ) ; }
void find_devices_thread( ) {
gparted_core .get_devices( devices ) ;
pulse = false ; }
//signal handlers
void open_operationslist( ) ;

View File

@ -96,6 +96,12 @@ void Win_GParted::init_menubar( )
menu ->items( ) .push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::QUIT, sigc::mem_fun(*this, &Win_GParted::menu_gparted_quit) ) );
menubar_main .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( _("_GParted"), *menu ) );
//edit
menu = manage( new Gtk::Menu( ) ) ;
menu ->items( ) .push_back( Gtk::Menu_Helpers::StockMenuElem( Gtk::Stock::UNDO, Gtk::AccelKey("<control>z"), sigc::mem_fun(*this, &Win_GParted::activate_undo) ) );
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 ) );
//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) ) );
@ -653,8 +659,8 @@ void Win_GParted::open_operationslist( )
while ( Gtk::Main::events_pending( ) )
Gtk::Main::iteration( );
}
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( ) ->items( ) [ 1 ] ) ->set_active( true ) ;
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 2 ] .get_submenu( ) ->items( ) [ 1 ] ) ->set_active( true ) ;
}
void Win_GParted::close_operationslist( )
@ -669,7 +675,7 @@ void Win_GParted::close_operationslist( )
}
hbox_operations .hide( ) ;
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( ) ->items() [ 1 ] ) ->set_active( false ) ;
( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 2 ] .get_submenu( ) ->items() [ 1 ] ) ->set_active( false ) ;
}
void Win_GParted::clear_operationslist( )
@ -796,7 +802,7 @@ void Win_GParted::menu_gparted_quit( )
void Win_GParted::menu_view_harddisk_info( )
{
if ( ( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( ) ->items( ) [ 0 ] ) ->get_active( ) )
if ( ( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 2 ] .get_submenu( ) ->items( ) [ 0 ] ) ->get_active( ) )
{ //open harddisk information
hpaned_main .get_child1( ) ->show( ) ;
for ( int t = hpaned_main .get_position( ) ; t < 250 ; t +=15 )
@ -820,7 +826,7 @@ 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( ) )
if ( ( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 2 ] .get_submenu( ) ->items( ) [ 1 ] ) ->get_active( ) )
open_operationslist( ) ;
else
close_operationslist( ) ;