From 1582dc3c6434e7fb7f6f93099473c7e86d4154d5 Mon Sep 17 00:00:00 2001 From: Curtis Gedak Date: Wed, 19 Nov 2008 20:17:32 +0000 Subject: [PATCH] Added language length conditional Undo display. If translated language is relatively long, then split the "Resize/Move" toolbar button text into two lines, and do not display the "Undo" button. svn path=/trunk/; revision=971 --- ChangeLog | 9 +++++++++ src/Win_GParted.cc | 26 +++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index eaafe480..3ee6b845 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-11-19 Curtis Gedak + + * src/Win_GParted.cc: Added language length conditional Undo display. + - If translated language is relatively long, then + split the "Resize/Move" toolbar button text into two lines, and + do not display the "Undo" button. + - Permits all languages to see a full toolbar at default window size. + - Closes GParted bug #561068 + 2008-11-18 Curtis Gedak * include/Partition.h, diff --git a/src/Win_GParted.cc b/src/Win_GParted.cc index 9be3f62f..a1cd8873 100644 --- a/src/Win_GParted.cc +++ b/src/Win_GParted.cc @@ -223,7 +223,16 @@ void Win_GParted::init_toolbar() //RESIZE/MOVE image = manage( new Gtk::Image( Gtk::Stock::GOTO_LAST, Gtk::ICON_SIZE_BUTTON ) ); - toolbutton = Gtk::manage(new Gtk::ToolButton( *image, _("Resize/Move") )); + Glib::ustring str_temp = _("Resize/Move") ; + //Condition string split and Undo button. + // for longer translated string, split string in two and skip the Undo button to permit full toolbar to display + // FIXME: Is there a better way to do this, perhaps without the conditional? At the moment this seems to be the best compromise. + bool display_undo = true ; + if( str_temp .length() > 14 ) { + str_temp .replace( str_temp .find( "/" ), 1, "\n/" ) ; + display_undo = false ; + } + toolbutton = Gtk::manage(new Gtk::ToolButton( *image, str_temp )); toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_resize) ); toolbar_main.append(*toolbutton); TOOLBAR_RESIZE_MOVE = index++ ; @@ -246,12 +255,15 @@ void Win_GParted::init_toolbar() index++ ; //UNDO and APPLY - toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::UNDO)); - toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_undo) ); - toolbar_main.append(*toolbutton); - TOOLBAR_UNDO = index++ ; - toolbutton ->set_sensitive( false ); - toolbutton ->set_tooltip(tooltips, _("Undo Last Operation") ); + if ( display_undo ) { + //Undo button is displayed only if translated language "Resize/Move" is not too long. See above setting of this condition. + toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::UNDO)); + toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_undo) ); + toolbar_main.append(*toolbutton); + TOOLBAR_UNDO = index++ ; + toolbutton ->set_sensitive( false ); + toolbutton ->set_tooltip(tooltips, _("Undo Last Operation") ); + } toolbutton = Gtk::manage(new Gtk::ToolButton(Gtk::Stock::APPLY)); toolbutton ->signal_clicked().connect( sigc::mem_fun(*this, &Win_GParted::activate_apply) );