Changed device menu Set Disklabel to Create Partition Table. Enhanced warning regarding all data will be erased from disk. Removed double confirmation of create partition table action.

svn path=/trunk/; revision=822
This commit is contained in:
Curtis Gedak 2008-04-18 15:28:30 +00:00
parent 8c59136299
commit 698b34258f
3 changed files with 49 additions and 44 deletions

View File

@ -1,3 +1,15 @@
2008-04-18 Curtis Gedak <gedakc@gmail.com>
* src/Dialog_Disklabel.cc,
src/Win_GParted.cc: Changed device menu item and description
- Menu text changed from "set disklabel..."
to "Create Partition Table..."
- Significant change in the wording to increase awareness that
setting a disk label (creating a partition table) will
ERASE ALL DATA on the disk.
- Removed double confirmation of partition table creation
- Closes GParted bug #422070
2008-04-14 Curtis Gedak <gedakc@gmail.com> 2008-04-14 Curtis Gedak <gedakc@gmail.com>
* Makefile.am, * Makefile.am,

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2004 Bart /* Copyright (C) 2004, 2005, 2006, 2007, 2008 Bart Hakvoort
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -22,54 +22,52 @@ namespace GParted
Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std::vector<Glib::ustring> & disklabeltypes ) Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std::vector<Glib::ustring> & disklabeltypes )
{ {
this ->set_title( String::ucompose( _("Set Disklabel on %1"), device_path ) ); /*TO TRANSLATORS: dialogtitle, looks like Create partition table on /dev/hda */
this ->set_title( String::ucompose( _("Create partition table on %1"), device_path ) );
this ->set_has_separator( false ) ; this ->set_has_separator( false ) ;
this ->set_resizable( false ); this ->set_resizable( false );
hbox = manage( new Gtk::HBox() ) ; hbox = manage( new Gtk::HBox() ) ;
this ->get_vbox() ->pack_start( *hbox, Gtk::PACK_SHRINK ); this ->get_vbox() ->pack_start( *hbox, Gtk::PACK_SHRINK );
vbox = manage( new Gtk::VBox() ) ; vbox = manage( new Gtk::VBox() ) ;
vbox ->set_border_width( 10 ) ; vbox ->set_border_width( 10 ) ;
hbox ->pack_start( *vbox, Gtk::PACK_SHRINK ); hbox ->pack_start( *vbox, Gtk::PACK_SHRINK );
image .set( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG ) ; image .set( Gtk::Stock::DIALOG_WARNING, Gtk::ICON_SIZE_DIALOG ) ;
vbox ->pack_start( image, Gtk::PACK_SHRINK ); vbox ->pack_start( image, Gtk::PACK_SHRINK );
vbox = manage( new Gtk::VBox() ) ; vbox = manage( new Gtk::VBox() ) ;
vbox ->set_border_width( 10 ) ; vbox ->set_border_width( 10 ) ;
hbox ->pack_start( *vbox, Gtk::PACK_SHRINK ); hbox ->pack_start( *vbox, Gtk::PACK_SHRINK );
str_temp = "<span weight=\"bold\" size=\"larger\">" ; str_temp = "<span weight=\"bold\" size=\"larger\">" ;
str_temp += String::ucompose( _("Set Disklabel on %1"), device_path ) ; /*TO TRANSLATORS: looks like WARNING: This will ERASE ALL DATA on the ENTIRE DISK /dev/hda */
str_temp += String::ucompose( _("WARNING: This will ERASE ALL DATA on the ENTIRE DISK %1"), device_path ) ;
str_temp += "</span>\n" ; str_temp += "</span>\n" ;
vbox ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK ); vbox ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK );
str_temp = _("A disklabel is a piece of data stored at a well known place on the disk, that indicates where each partition begins and how many sectors it occupies.") ; str_temp = _("Default is to create an msdos partition table.") ;
str_temp += "\n" ;
str_temp += _("You need a disklabel if you want to create partitions on this disk.") ;
str_temp += "\n\n" ;
str_temp += _("By default GParted creates an msdos disklabel.") ;
str_temp += "\n" ; str_temp += "\n" ;
vbox ->pack_start( * Utils::mk_label( str_temp, true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true ), vbox ->pack_start( * Utils::mk_label( str_temp, true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true ),
Gtk::PACK_SHRINK ); Gtk::PACK_SHRINK );
//advanced //advanced
str_temp = "<b>" ; str_temp = "<b>" ;
str_temp += _("Advanced") ; str_temp += _("Advanced") ;
expander_advanced .set_label( str_temp + "</b>" ) ; expander_advanced .set_label( str_temp + "</b>" ) ;
expander_advanced .set_use_markup( true ) ; expander_advanced .set_use_markup( true ) ;
vbox ->pack_start( expander_advanced, Gtk::PACK_SHRINK ) ;
vbox ->pack_start( expander_advanced, Gtk::PACK_SHRINK ) ;
hbox = manage( new Gtk::HBox( false, 5 ) ) ; hbox = manage( new Gtk::HBox( false, 5 ) ) ;
hbox ->set_border_width( 5 ) ; hbox ->set_border_width( 5 ) ;
str_temp = _("Select new labeltype:") ; str_temp = _("Select new partition table type:") ;
str_temp += "\t" ; str_temp += "\t" ;
hbox ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK ); hbox ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK );
expander_advanced .add( *hbox ) ; expander_advanced .add( *hbox ) ;
//create and add combo with labeltypes //create and add combo with partition table types (label types)
this ->labeltypes = disklabeltypes ; this ->labeltypes = disklabeltypes ;
for ( unsigned int t = 0 ; t < labeltypes .size() ; t++ ) for ( unsigned int t = 0 ; t < labeltypes .size() ; t++ )
@ -77,14 +75,25 @@ Dialog_Disklabel::Dialog_Disklabel( const Glib::ustring & device_path, const std
combo_labeltypes .set_active( 0 ) ; combo_labeltypes .set_active( 0 ) ;
hbox ->pack_start( combo_labeltypes, Gtk::PACK_SHRINK ) ; hbox ->pack_start( combo_labeltypes, Gtk::PACK_SHRINK ) ;
//standard warning //standard warning
str_temp = "\n <i>" ; str_temp = "\n<i>" ;
str_temp += String::ucompose( _("WARNING: Creating a new disklabel will erase all data on %1!"), device_path ) ; str_temp += _("Choosing ") ;
str_temp += "<b>" ;
/*TO TRANSLATORS: This is the name of the button Gtk::RESPONSE_OK below. */
str_temp += _("Create") ;
str_temp += "</b>" ;
str_temp += _(" will") ;
str_temp += ":\n - " ;
/*TO TRANSLATORS: looks like IMMEDIATELY ERASE ALL DATA on disk /dev/hda */
str_temp += String::ucompose( _("IMMEDIATELY ERASE ALL DATA on disk %1"), device_path ) ;
str_temp += "\n - " ;
/*TO TRANSLATORS: looks like Create a new partition table on disk /dev/hda */
str_temp += String::ucompose( _("Create a new partition table on disk %1"), device_path ) ;
str_temp += "\n</i>"; str_temp += "\n</i>";
vbox ->pack_start( * Utils::mk_label( str_temp, true, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER, true ),
this ->get_vbox() ->pack_start( * Utils::mk_label( str_temp ), Gtk::PACK_SHRINK ); Gtk::PACK_SHRINK );
this ->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL ); this ->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
this ->add_button( _("Create"), Gtk::RESPONSE_OK ); this ->add_button( _("Create"), Gtk::RESPONSE_OK );

View File

@ -178,7 +178,7 @@ void Win_GParted::init_menubar()
//device //device
menu = manage( new Gtk::Menu() ) ; menu = manage( new Gtk::Menu() ) ;
menu ->items() .push_back( Gtk::Menu_Helpers::MenuElem( Glib::ustring( _("_Set Disklabel") ) + " ...", menu ->items() .push_back( Gtk::Menu_Helpers::MenuElem( Glib::ustring( _("_Create Partition Table") ) + " ...",
sigc::mem_fun(*this, &Win_GParted::activate_disklabel) ) ); sigc::mem_fun(*this, &Win_GParted::activate_disklabel) ) );
menubar_main .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("_Device"), *menu ) ); menubar_main .items() .push_back( Gtk::Menu_Helpers::MenuElem( _("_Device"), *menu ) );
@ -1734,25 +1734,10 @@ void Win_GParted::activate_disklabel()
if ( dialog .run() == Gtk::RESPONSE_OK ) if ( dialog .run() == Gtk::RESPONSE_OK )
{ {
Gtk::MessageDialog m_dialog( *this, if ( ! gparted_core .set_disklabel( devices[ current_device ] .get_path(), dialog .Get_Disklabel() ) )
String::ucompose( _("Are you sure you want to create a %1 disklabel on %2?"),
dialog .Get_Disklabel(),
devices[ current_device ] .get_path() ),
false,
Gtk::MESSAGE_QUESTION,
Gtk::BUTTONS_CANCEL,
true ) ;
m_dialog .set_secondary_text( String::ucompose( _("This operation will destroy all data on %1!"),
devices[ current_device ] .get_path() ) ) ;
m_dialog .add_button( _("Create"), Gtk::RESPONSE_OK ) ;
if ( m_dialog .run() == Gtk::RESPONSE_OK &&
! gparted_core .set_disklabel( devices[ current_device ] .get_path(), dialog .Get_Disklabel() ) )
{ {
Gtk::MessageDialog dialog( *this, Gtk::MessageDialog dialog( *this,
_("Error while setting new disklabel"), _("Error while creating partition table."),
true, true,
Gtk::MESSAGE_ERROR, Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_OK, Gtk::BUTTONS_OK,
@ -1760,7 +1745,6 @@ void Win_GParted::activate_disklabel()
dialog .run() ; dialog .run() ;
} }
m_dialog .hide() ;
dialog .hide() ; dialog .hide() ;
menu_gparted_refresh_devices() ; menu_gparted_refresh_devices() ;