Fixed some errors with 'unknown' filesystem. + some cosmetics

* src/Dialog_Partition_New.cc,
  src/Win_GParted.cc: Fixed some errors with 'unknown' filesystem. + some cosmetics
This commit is contained in:
Bart Hakvoort 2004-11-23 19:03:39 +00:00
parent 88a637f13d
commit b381c72fc2
3 changed files with 64 additions and 54 deletions

View File

@ -1,3 +1,8 @@
2004-11-23 Bart Hakvoort <gparted@users.sf.net>
* src/Dialog_Partition_New.cc,
src/Win_GParted.cc: Fixed some errors with 'unknown' filesystem. + some cosmetics
2004-11-23 Bart Hakvoort <gparted@users.sf.net> 2004-11-23 Bart Hakvoort <gparted@users.sf.net>
* include/GParted_Core.h, * include/GParted_Core.h,

View File

@ -167,17 +167,17 @@ void Dialog_Partition_New::optionmenu_changed( bool type )
//optionmenu_type //optionmenu_type
if ( type ) if ( type )
{ {
if (optionmenu_type.get_history() == GParted::EXTENDED ) if ( optionmenu_type .get_history( ) == GParted::EXTENDED )
{ {
menu_filesystem.items().push_back(Gtk::Menu_Helpers::MenuElem( "extended") ) ; menu_filesystem .items( ) .push_back( Gtk::Menu_Helpers::MenuElem( "extended" ) ) ;
optionmenu_filesystem.set_history( 6 ) ; optionmenu_filesystem .set_history( menu_filesystem .items( ) .size( ) -1 ) ;
optionmenu_filesystem.set_sensitive( false ); optionmenu_filesystem .set_sensitive( false ) ;
} }
else if ( menu_filesystem.items() .size() > 6 ) else if ( menu_filesystem .items( ) .size( ) == FILESYSTEMS .size( ) )
{ {
menu_filesystem.items() .remove( menu_filesystem.items() .back() ); menu_filesystem .items( ) .remove( menu_filesystem .items( ) .back( ) ) ;
optionmenu_filesystem.set_sensitive( true ); optionmenu_filesystem .set_sensitive( true ) ;
optionmenu_filesystem.set_history( 0 ) ; optionmenu_filesystem .set_history( 0 ) ;
} }
} }

View File

@ -184,24 +184,24 @@ void Win_GParted::init_popupmenu()
void Win_GParted::init_convert_menu() void Win_GParted::init_convert_menu()
{ {
for ( unsigned int t=0; t < gparted_core .get_fs( ) .size() ; t++ ) for ( unsigned int t=0; t < gparted_core .get_fs( ) .size( ) -1 ; t++ )
{ {
color .set( Get_Color( gparted_core .get_fs( )[ t ] .filesystem ) ); color .set( Get_Color( gparted_core .get_fs( )[ t ] .filesystem ) );
hbox = manage( new Gtk::HBox() ); hbox = manage( new Gtk::HBox( ) );
//the colored square //the colored square
entry = manage ( new Gtk::Entry() ); entry = manage ( new Gtk::Entry( ) );
entry ->set_sensitive( false ); entry ->set_sensitive( false );
entry ->set_size_request( 12, 12 ); entry ->set_size_request( 12, 12 );
entry ->modify_base( entry->get_state(), color ); entry ->modify_base( entry ->get_state( ), color );
hbox ->pack_start( *entry, Gtk::PACK_SHRINK ); hbox ->pack_start( *entry, Gtk::PACK_SHRINK );
//the label... //the label...
hbox ->pack_start( * mk_label( " " + gparted_core .get_fs( )[ t ] .filesystem ), Gtk::PACK_SHRINK ); hbox ->pack_start( * mk_label( " " + gparted_core .get_fs( )[ t ] .filesystem ), Gtk::PACK_SHRINK );
menu_item = manage( new Gtk::MenuItem( *hbox ) ) ; menu_item = manage( new Gtk::MenuItem( *hbox ) ) ;
menu_convert.items().push_back( *menu_item); menu_convert.items( ) .push_back( *menu_item );
menu_convert.items() .back() .signal_activate() .connect( sigc::bind<Glib::ustring>(sigc::mem_fun(*this, &Win_GParted::activate_convert), gparted_core .get_fs( )[ t ] .filesystem ) ) ; menu_convert.items( ) .back( ) .signal_activate( ) .connect( sigc::bind<Glib::ustring>(sigc::mem_fun(*this, &Win_GParted::activate_convert), gparted_core .get_fs( )[ t ] .filesystem ) ) ;
} }
menu_convert.show_all_children() ; menu_convert.show_all_children() ;
@ -546,12 +546,12 @@ void Win_GParted::Refresh_Visual( )
bool Win_GParted::Quit_Check_Operations() bool Win_GParted::Quit_Check_Operations()
{ {
if ( operations.size() ) if ( operations .size( ) )
{ {
str_temp = "<span weight=\"bold\" size=\"larger\">" + (Glib::ustring) _( "Quit GParted?" ) + "</span>\n\n" ; str_temp = "<span weight=\"bold\" size=\"larger\">" + (Glib::ustring) _( "Quit GParted?" ) + "</span>\n\n" ;
if ( operations .size() != 1 ) if ( operations .size( ) != 1 )
str_temp += String::ucompose( _("%1 operations are currently pending."), operations .size() ) ; str_temp += String::ucompose( _("%1 operations are currently pending."), operations .size( ) ) ;
else else
str_temp += _("1 operation is currently pending."); str_temp += _("1 operation is currently pending.");
@ -559,7 +559,8 @@ bool Win_GParted::Quit_Check_Operations()
dialog .add_button( Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE ); dialog .add_button( Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE );
dialog .add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL ); dialog .add_button( Gtk::Stock::CANCEL,Gtk::RESPONSE_CANCEL );
if ( dialog.run() == Gtk::RESPONSE_CANCEL ) return false;//don't close GParted if ( dialog .run( ) == Gtk::RESPONSE_CANCEL )
return false;//don't close GParted
} }
return true; //close GParted return true; //close GParted
@ -635,12 +636,12 @@ void Win_GParted::Set_Valid_Operations()
void Win_GParted::Set_Valid_Convert_Filesystems() void Win_GParted::Set_Valid_Convert_Filesystems()
{ {
//disable conversion to the same filesystem //disable conversion to the same filesystem
for ( unsigned int t = 0 ; t < gparted_core .get_fs( ) .size( ) ; t++ ) for ( unsigned int t = 0 ; t < gparted_core .get_fs( ) .size( ) -1 ; t++ )
{ {
if ( gparted_core .get_fs( )[ t ] .filesystem == selected_partition .filesystem || ! gparted_core .get_fs( )[ t ] .create ) if ( gparted_core .get_fs( )[ t ] .filesystem == selected_partition .filesystem || ! gparted_core .get_fs( )[ t ] .create )
menu_convert .items()[ t ] .set_sensitive( false ) ; menu_convert .items( )[ t ] .set_sensitive( false ) ;
else else
menu_convert .items()[ t ] .set_sensitive( true ) ; menu_convert .items( )[ t ] .set_sensitive( true ) ;
} }
} }
@ -650,13 +651,14 @@ void Win_GParted::open_operationslist()
int x,y; this ->get_size( x, y ); int x,y; this ->get_size( x, y );
y -= 300; y -= 300;
for ( int t=vpaned_main.get_position() ; t > y ; t-=5 ) for ( int t = vpaned_main .get_position( ) ; t > y ; t-=5 )
{ {
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( );
} }
( (Gtk::CheckMenuItem *) & menubar_main .items() [ 1 ] .get_submenu() ->items() [ 1 ] ) ->set_active( true ) ; ( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( ) ->items( ) [ 1 ] ) ->set_active( true ) ;
} }
void Win_GParted::close_operationslist() void Win_GParted::close_operationslist()
@ -665,26 +667,27 @@ void Win_GParted::close_operationslist()
int x,y; this ->get_size( x, y ); int x,y; this ->get_size( x, y );
y -= 210 ; //height of whole app - menubar - visualdisk - statusbar .... y -= 210 ; //height of whole app - menubar - visualdisk - statusbar ....
for ( int t=vpaned_main.get_position() ; t < y ; t+=5 ) for ( int t = vpaned_main .get_position( ) ; t < y ; t+=5 )
{ {
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( ) ; hbox_operations .hide( ) ;
( (Gtk::CheckMenuItem *) & menubar_main .items() [ 1 ] .get_submenu() ->items() [ 1 ] ) ->set_active( false ) ; ( (Gtk::CheckMenuItem *) & menubar_main .items( ) [ 1 ] .get_submenu( ) ->items() [ 1 ] ) ->set_active( false ) ;
} }
void Win_GParted::clear_operationslist() void Win_GParted::clear_operationslist()
{ {
operations .clear() ; operations .clear( ) ;
Refresh_Visual() ; Refresh_Visual( ) ;
} }
void Win_GParted::optionmenu_devices_changed( ) void Win_GParted::optionmenu_devices_changed( )
{ {
//set new current device //set new current device
current_device = optionmenu_devices.get_history() ; current_device = optionmenu_devices .get_history( ) ;
//refresh label_device_info //refresh label_device_info
Fill_Label_Device_Info( ); Fill_Label_Device_Info( );
@ -712,35 +715,37 @@ void Win_GParted::menu_gparted_refresh_devices()
void Win_GParted::menu_gparted_quit() void Win_GParted::menu_gparted_quit()
{ {
if ( Quit_Check_Operations() ) if ( Quit_Check_Operations( ) )
this->hide(); this ->hide( );
} }
void Win_GParted::menu_view_harddisk_info() 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( ) [ 1 ] .get_submenu( ) ->items( ) [ 0 ] ) ->get_active( ) )
{ //open harddisk information { //open harddisk information
hpaned_main .get_child1() ->show() ; hpaned_main .get_child1( ) ->show( ) ;
for ( int t=hpaned_main .get_position() ; t < 250 ; t +=15 ) for ( int t = hpaned_main .get_position( ) ; t < 250 ; t +=15 )
{ {
hpaned_main.set_position( t ); hpaned_main .set_position( t );
while (Gtk::Main::events_pending()) Gtk::Main::iteration(); while ( Gtk::Main::events_pending( ) )
Gtk::Main::iteration( );
} }
} }
else else
{ //close harddisk information { //close harddisk information
for ( int t=hpaned_main .get_position() ; t > 0 ; t -=15 ) for ( int t=hpaned_main .get_position( ) ; t > 0 ; t -=15 )
{ {
hpaned_main.set_position( t ); hpaned_main .set_position( t );
while (Gtk::Main::events_pending()) Gtk::Main::iteration(); while ( Gtk::Main::events_pending( ) )
Gtk::Main::iteration( );
} }
hpaned_main .get_child1() ->hide() ; hpaned_main .get_child1( ) ->hide( ) ;
} }
} }
void Win_GParted::menu_view_operations() 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( ) [ 1 ] .get_submenu( ) ->items( ) [ 1 ] ) ->get_active( ) )
open_operationslist( ) ; open_operationslist( ) ;
else else
close_operationslist( ) ; close_operationslist( ) ;
@ -751,8 +756,8 @@ void Win_GParted::menu_help_contents()
str_temp = _("Sorry, not yet implemented.") ; str_temp = _("Sorry, not yet implemented.") ;
str_temp += "\n" ; str_temp += "\n" ;
str_temp += _( "Please visit http://gparted.sf.net for more information and support.") ; str_temp += _( "Please visit http://gparted.sf.net for more information and support.") ;
Gtk::MessageDialog dialog( *this, str_temp, false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true); Gtk::MessageDialog dialog( *this, str_temp, false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true );
dialog.run(); dialog .run( );
} }
@ -761,28 +766,28 @@ void Win_GParted::menu_help_about()
Dialog_About dialog ; Dialog_About dialog ;
dialog .set_transient_for( *this ) ; dialog .set_transient_for( *this ) ;
dialog.run(); dialog .run( );
} }
void Win_GParted::mouse_click( GdkEventButton *event, const Partition & partition ) void Win_GParted::mouse_click( GdkEventButton *event, const Partition & partition )
{ {
selected_partition = partition; selected_partition = partition;
Set_Valid_Operations() ; Set_Valid_Operations () ;
treeview_detail .Set_Selected( partition ); treeview_detail .Set_Selected( partition );
vbox_visual_disk ->Set_Selected( partition ); vbox_visual_disk ->Set_Selected( partition );
if ( event->type == GDK_2BUTTON_PRESS && ! pulse ) if ( event ->type == GDK_2BUTTON_PRESS && ! pulse )
activate_info() ; activate_info( ) ;
else if ( event->button == 3 ) //right-click else if ( event ->button == 3 ) //right-click
{ {
//prepare convert menu //prepare convert menu
if ( selected_partition.type != GParted::UNALLOCATED ) if ( selected_partition .type != GParted::UNALLOCATED )
Set_Valid_Convert_Filesystems() ; Set_Valid_Convert_Filesystems( ) ;
menu_popup.popup( event->button, event->time ); menu_popup .popup( event ->button, event ->time );
} }
} }