Simplify from Gtk::Table to HBox in Partition Name dialog
Same case as for FileSystem Label dialog before; the Partition Name dialog only has a single line of just 2 widgets. Therefore switch to a simpler horizontal box widget to lay them out.
This commit is contained in:
parent
f760c16ba6
commit
eab54260a4
|
@ -20,9 +20,8 @@
|
||||||
#include "Partition.h"
|
#include "Partition.h"
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
|
|
||||||
|
#include <glibmm/ustring.h>
|
||||||
#include <gtkmm/dialog.h>
|
#include <gtkmm/dialog.h>
|
||||||
#include <gtkmm/stock.h>
|
|
||||||
#include <gtkmm/table.h>
|
|
||||||
#include <gtkmm/entry.h>
|
#include <gtkmm/entry.h>
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
|
|
|
@ -17,6 +17,11 @@
|
||||||
#include "Dialog_Partition_Name.h"
|
#include "Dialog_Partition_Name.h"
|
||||||
#include "Partition.h"
|
#include "Partition.h"
|
||||||
|
|
||||||
|
#include <glibmm/ustring.h>
|
||||||
|
#include <gtkmm/box.h>
|
||||||
|
#include <gtkmm/stock.h>
|
||||||
|
#include <gtkmm/entry.h>
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -29,38 +34,28 @@ Dialog_Partition_Name::Dialog_Partition_Name( const Partition & partition, int m
|
||||||
/* TO TRANSLATORS: dialog title, looks like Set partition name on /dev/hda3 */
|
/* TO TRANSLATORS: dialog title, looks like Set partition name on /dev/hda3 */
|
||||||
this->set_title( String::ucompose( _("Set partition name on %1"), partition.get_path() ) );
|
this->set_title( String::ucompose( _("Set partition name on %1"), partition.get_path() ) );
|
||||||
|
|
||||||
{
|
// HBox to hole the label and entry box line
|
||||||
int top = 0, bottom = 1;
|
Gtk::HBox *hbox( manage( new Gtk::HBox() ) );
|
||||||
|
hbox->set_border_width( 5 );
|
||||||
|
hbox->set_spacing( 10 );
|
||||||
|
get_vbox()->pack_start( *hbox, Gtk::PACK_SHRINK );
|
||||||
|
|
||||||
// Create table to hold name and entry box
|
// Only line: "Name: [EXISTINGNAME ]"
|
||||||
Gtk::Table *table( manage( new Gtk::Table() ) );
|
hbox->pack_start( *Utils::mk_label( "<b>" + Glib::ustring(_("Name:")) + "</b>" ),
|
||||||
|
Gtk::PACK_SHRINK );
|
||||||
|
|
||||||
table->set_border_width( 5 );
|
entry = manage( new Gtk::Entry() );
|
||||||
table->set_col_spacings( 10 );
|
// NOTE: This limits the Gtk::Entry size in UTF-8 characters but partition names
|
||||||
get_vbox()->pack_start( *table, Gtk::PACK_SHRINK );
|
// are defined in terms of ASCII characters, or for GPT, UTF-16LE code points.
|
||||||
table->attach( *Utils::mk_label( "<b>" + Glib::ustring(_("Name:")) + "</b>" ),
|
// See Utils::get_max_partition_name_length(). So for certain extended characters
|
||||||
0, 1,
|
// this limit will be too generous.
|
||||||
top, bottom,
|
entry->set_max_length( max_length );
|
||||||
Gtk::FILL );
|
|
||||||
// Create text entry box
|
|
||||||
entry = manage( new Gtk::Entry() );
|
|
||||||
|
|
||||||
// NOTE: This limits the Gtk::Entry size in UTF-8 characters but partition
|
entry->set_width_chars( 30 );
|
||||||
// names are defined in terms of ASCII characters, or for GPT, UTF-16LE
|
entry->set_activates_default( true );
|
||||||
// code points. See Utils::get_max_partition_name_length(). So for
|
entry->set_text( partition.name );
|
||||||
// certain extended characters this limit will be too generous.
|
entry->select_region( 0, entry->get_text_length() );
|
||||||
entry->set_max_length( max_length );
|
hbox->pack_start( *entry, Gtk::PACK_SHRINK );
|
||||||
|
|
||||||
entry->set_width_chars( 30 );
|
|
||||||
entry->set_activates_default( true );
|
|
||||||
entry->set_text( partition.name );
|
|
||||||
entry->select_region( 0, entry->get_text_length() );
|
|
||||||
// Add entry box to table
|
|
||||||
table->attach( *entry,
|
|
||||||
1, 2,
|
|
||||||
top++, bottom++,
|
|
||||||
Gtk::FILL );
|
|
||||||
}
|
|
||||||
|
|
||||||
this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
|
this->add_button( Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL );
|
||||||
this->add_button( Gtk::Stock::OK, Gtk::RESPONSE_OK );
|
this->add_button( Gtk::Stock::OK, Gtk::RESPONSE_OK );
|
||||||
|
|
Loading…
Reference in New Issue