Make Partition Information dialog warnings selectable (#705596)

Allow all partition warning messages to be selectable and copied.  Merge
all the messages into a single Gtk::Label widget so that they can be
selected together.

Use a blank line between individual messages so that each message can be
distinguished. Therefore each message should be formatted as one or more
non-blank lines, with an optional trailing new line.  This is true of
GParted internal messages and probably all external messages and errors
from libparted and executed commands too.

Bug #705596 - Partition Information Dialog - let user copy warnings
This commit is contained in:
Mike Fleetwood 2013-10-10 09:31:32 +01:00 committed by Curtis Gedak
parent 80523a7079
commit 98cd693818
3 changed files with 22 additions and 11 deletions

View File

@ -58,17 +58,30 @@ Dialog_Partition_Info::Dialog_Partition_Info( const Partition & partition )
frame ->set_label_widget( *hbox ) ;
//FIXME: for more clarity we should add a listview here with alternating rowcolors..
//that way it's easier to tell messages apart..
//Merge all messages for display so that they can be selected together.
// Use a blank line between individual messages so that each message can be
// distinguished. Therefore each message should have been formatted as one
// or more non-blank lines, with an optional trailing new line. This is
// true of GParted internal messages and probably all external messages and
// errors from libparted and executed commands too.
Glib::ustring all_messages ;
for ( unsigned int t = 0; t < partition .messages .size(); t ++ )
{
Gtk::VBox* vbox(manage(new Gtk::VBox(false,4)));
vbox->set_border_width(5);
if ( all_messages .size() > 0 )
all_messages += "\n\n" ;
for (unsigned int t = 0; t < partition.messages.size(); ++t)
vbox->pack_start(*Utils::mk_label("<i>" + partition .messages[t] + "</i>", true, true),
Gtk::PACK_SHRINK);
frame->add(*vbox);
Glib::ustring::size_type take = partition .messages[ t ] .size() ;
if ( take > 0 )
{
if ( partition .messages[ t ][ take-1 ] == '\n' )
take -- ; //Skip optional trailing new line
all_messages += "<i>" + partition .messages[ t ] .substr( 0, take ) + "</i>" ;
}
}
Gtk::VBox *vbox( manage( new Gtk::VBox() ) ) ;
vbox ->set_border_width( 5 ) ;
vbox ->pack_start( *Utils::mk_label( all_messages, true, true, true ), Gtk::PACK_SHRINK ) ;
frame ->add( *vbox ) ;
this ->get_vbox() ->pack_start( *frame, Gtk::PACK_SHRINK ) ;
}

View File

@ -1194,7 +1194,6 @@ GParted::FILESYSTEM GParted_Core::get_filesystem( PedDevice* lp_device, PedParti
{
Glib::ustring temp ;
temp = _( "Linux Unified Key Setup encryption is not yet supported." ) ;
temp += "\n" ;
messages .push_back( temp ) ;
return GParted::FS_LUKS ;
}
@ -1604,7 +1603,7 @@ void GParted_Core::set_used_sectors( std::vector<Partition> & partitions, PedDis
temp += _("Because of this some operations may be unavailable.") ;
if ( ! Utils::get_filesystem_software( partitions[ t ] .filesystem ) .empty() )
{
temp += "\n\n" ;
temp += "\n" ;
temp += _( "The cause might be a missing software package.") ;
temp += "\n" ;
/*TO TRANSLATORS: looks like The following list of software packages is required for NTFS file system support: ntfsprogs. */

View File

@ -192,7 +192,6 @@ std::vector<Glib::ustring> LVM2_PV_Info::get_error_messages( const Glib::ustring
if ( bit_set( get_vg_attr_by_name( vgname, VGATTR_VG_BITS ), VGBIT_PARTIAL ) )
{
temp = _("One or more Physical Volumes belonging to the Volume Group is missing.") ;
temp += "\n" ;
partition_specific_messages .push_back ( temp ) ;
}