[gtk+/wip/matthiasc/tab-strip] tabs: Improve ellipsization behavior



commit b21d150144112eb61ee791e1697be895401bd16d
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue May 31 08:05:09 2016 -0400

    tabs: Improve ellipsization behavior
    
    This gets us a bit closer to the desired user experience.

 gtk/gtkclosabletab.c |    6 +++++-
 gtk/gtksimpletab.c   |    4 ++++
 2 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkclosabletab.c b/gtk/gtkclosabletab.c
index 810a870..2dac42f 100644
--- a/gtk/gtkclosabletab.c
+++ b/gtk/gtkclosabletab.c
@@ -63,8 +63,12 @@ gtk_closable_tab_init (GtkClosableTab *self)
   gtk_tab_set_child (GTK_TAB (self), self->box);
 
   self->label = gtk_label_new ("");
+  gtk_widget_set_halign (self->label, GTK_ALIGN_START);
+  gtk_label_set_width_chars (GTK_LABEL (self->label), 10);
+  gtk_label_set_max_width_chars (GTK_LABEL (self->label), 25);
+  gtk_label_set_ellipsize (GTK_LABEL (self->label), PANGO_ELLIPSIZE_END);
   gtk_widget_show (self->label);
-  gtk_box_set_center_widget (GTK_BOX (self->box), self->label);
+  gtk_box_pack_start (GTK_BOX (self->box), self->label, TRUE, TRUE, 0);
   g_object_bind_property (self, "title", self->label, "label", G_BINDING_DEFAULT);
 
   self->button = gtk_button_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);
diff --git a/gtk/gtksimpletab.c b/gtk/gtksimpletab.c
index 0937435..2b77e46 100644
--- a/gtk/gtksimpletab.c
+++ b/gtk/gtksimpletab.c
@@ -49,6 +49,10 @@ static void
 gtk_simple_tab_init (GtkSimpleTab *self)
 {
   self->label = gtk_label_new ("");
+  gtk_widget_set_halign (self->label, GTK_ALIGN_START);
+  gtk_label_set_width_chars (GTK_LABEL (self->label), 10);
+  gtk_label_set_max_width_chars (GTK_LABEL (self->label), 25);
+  gtk_label_set_ellipsize (GTK_LABEL (self->label), PANGO_ELLIPSIZE_END);
   gtk_widget_show (self->label);
   gtk_widget_set_halign (self->label, GTK_ALIGN_CENTER);
 


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