Simplify from Gtk::Table to HBox in FileSystem Label dialog
The FileSystem Label dialog only has a single line of just 2 widgets; a text label and entry box widget. There is no need to use a multi-line capable table to hold this. Switch to a simpler horizontal box widget. Note that this change is not related to porting to Gtk 3 and stopping using deprecated APIs because both HBox [1] and Table [2] are deprecated in Gtk 3.2 and Gtk 3.4 and replaced by Box with horizontal orientation and Grid respectively. [1] NEWS file from gtkmm 3.2, actually first released in gtkmm 3.1.6 (unstable): https://git.gnome.org/browse/gtkmm/tree/NEWS?h=3.2.0#n91 "Gtk: * All H* or V* specialized classes have been deprecated, to match the deprecations in the GTK+ C API. You should now set the orientation instead. This includes HBox, VBox, HButtonBox, VButtonBox, HPaned, VPaned, HScale, VScale, HSeparator, VSeparator, HScrollbar and VScrollbar." [2] NEWS file from gtkmm 3.4, actually first released in gtkmm 3.3.2 (unstable): https://git.gnome.org/browse/gtkmm/tree/NEWS?h=3.4.0#n162 "* Deprecate Gtk::Table in favour of Gtk::Grid."
This commit is contained in:
parent
d948cbcb91
commit
f760c16ba6
|
@ -20,14 +20,10 @@
|
||||||
#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/frame.h>
|
|
||||||
#include <gtkmm/table.h>
|
|
||||||
#include <gtkmm/entry.h>
|
#include <gtkmm/entry.h>
|
||||||
|
|
||||||
#define BORDER 8
|
|
||||||
|
|
||||||
namespace GParted
|
namespace GParted
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,11 @@
|
||||||
#include "Dialog_FileSystem_Label.h"
|
#include "Dialog_FileSystem_Label.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,32 +34,22 @@ Dialog_FileSystem_Label::Dialog_FileSystem_Label( const Partition & partition )
|
||||||
/* TO TRANSLATORS: dialog title, looks like Set file system label on /dev/hda3 */
|
/* TO TRANSLATORS: dialog title, looks like Set file system label on /dev/hda3 */
|
||||||
this->set_title( String::ucompose( _("Set file system label on %1"), partition.get_path() ) );
|
this->set_title( String::ucompose( _("Set file system label on %1"), partition.get_path() ) );
|
||||||
|
|
||||||
{
|
// HBox to hold 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 Label and entry box
|
// Only line: "Label: [EXISTINGLABEL ]"
|
||||||
Gtk::Table* table(manage(new Gtk::Table()));
|
hbox->pack_start( *Utils::mk_label("<b>" + Glib::ustring( _("Label:") ) + "</b>"),
|
||||||
|
Gtk::PACK_SHRINK );
|
||||||
table->set_border_width(5);
|
entry = manage( new Gtk::Entry() );
|
||||||
table->set_col_spacings(10);
|
entry->set_max_length( Utils::get_filesystem_label_maxlength( partition.filesystem ) );
|
||||||
get_vbox()->pack_start(*table, Gtk::PACK_SHRINK);
|
entry->set_width_chars( 30 );
|
||||||
table->attach(*Utils::mk_label("<b>" + Glib::ustring(_("Label:")) + "</b>"),
|
entry->set_activates_default( true );
|
||||||
0, 1,
|
entry->set_text( partition.get_filesystem_label() );
|
||||||
top, bottom,
|
entry->select_region( 0, entry->get_text_length() );
|
||||||
Gtk::FILL);
|
hbox->pack_start( *entry, Gtk::PACK_SHRINK );
|
||||||
//Create Text entry box
|
|
||||||
entry = manage(new Gtk::Entry());
|
|
||||||
entry->set_max_length( Utils::get_filesystem_label_maxlength( partition.filesystem ) ) ;
|
|
||||||
entry->set_width_chars( 30 );
|
|
||||||
entry->set_activates_default(true);
|
|
||||||
entry->set_text(partition.get_filesystem_label());
|
|
||||||
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