[nemiver: 5/6] Ellipsize filename in tab (Closes: #565645)



commit 8534b728e683f2cac6967b6cc46ba8073de3ba49
Author: Jonathon Jongsma <jonathon jongsma collabora co uk>
Date:   Sun Mar 8 14:57:37 2009 -0500

    Ellipsize filename in tab (Closes: #565645)
    
    	* src/persp/dbgperspective/nmv-dbg-perspective.cc: set the source view's
    	  tab label to ellipsize the middle of the filename if the name is longer
    	  than 25 characters.  Making this changed caused the close button to expand
    	  strangely when the nemiver window was resized, so I packed the label and
    	  close button into a hbox instead of a Table, and packed the button with
    	  Gtk::PACK_SHRINK so it should never expand.
---
 src/persp/dbgperspective/nmv-dbg-perspective.cc |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index bf0dd1a..01bb9e2 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -3440,6 +3440,9 @@ DBGPerspective::append_source_editor (SourceEditor &a_sv,
 
     SafePtr<Gtk::Label> label (Gtk::manage
                             (new Gtk::Label (basename)));
+    label->set_ellipsize (Pango::ELLIPSIZE_MIDDLE);
+    label->set_max_width_chars (25);
+    label->set_justify (Gtk::JUSTIFY_LEFT);
     SafePtr<Gtk::Image> cicon (manage
                 (new Gtk::Image (Gtk::StockID (Gtk::Stock::CLOSE),
                                                Gtk::ICON_SIZE_MENU)));
@@ -3463,19 +3466,19 @@ DBGPerspective::append_source_editor (SourceEditor &a_sv,
     message.printf (_("Close %s"), a_path.c_str ());
     close_button->set_tooltip_text (message);
 
-    SafePtr<Gtk::Table> table (Gtk::manage (new Gtk::Table (1, 2)));
+    SafePtr<Gtk::HBox> hbox (Gtk::manage (new Gtk::HBox ()));
     // add a bit of space between the label and the close button
-    table->set_col_spacings (4);
+    hbox->set_spacing (4);
 
     Gtk::EventBox *event_box = Gtk::manage (new Gtk::EventBox);
     event_box->set_visible_window (false);
     event_box->add (*label);
-    table->attach (*event_box, 0, 1, 0, 1);
-    table->attach (*close_button, 1, 2, 0, 1);
+    hbox->pack_start (*event_box);
+    hbox->pack_start (*close_button, Gtk::PACK_SHRINK);
     event_box->set_tooltip_text (a_path);
-    table->show_all ();
+    hbox->show_all ();
     int page_num = m_priv->sourceviews_notebook->insert_page (a_sv,
-                                                              *table,
+                                                              *hbox,
                                                               -1);
 #if GTK_CHECK_VERSION (2, 10, 0)
     m_priv->sourceviews_notebook->set_tab_reorderable (a_sv);
@@ -3493,7 +3496,7 @@ DBGPerspective::append_source_editor (SourceEditor &a_sv,
         LOG_ERROR ("Failed to start monitoring file: " << a_path);
     }
 
-    table.release ();
+    hbox.release ();
     close_button.release ();
     label.release ();
     cicon.release ();



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]