From bcc3f56193127e2b9e98bfbe4d8f7813c132928d Mon Sep 17 00:00:00 2001 From: "Alex R.M. Turner" Date: Sun, 11 Nov 2007 22:17:51 +0000 Subject: [PATCH] Instruct the GtkLabel in the tabpopup to ellipsize text that is too big. 2007-11-11 Alex R.M. Turner * src/tabpopup.c (tab_entry_new, meta_ui_tab_popup_new): Instruct the GtkLabel in the tabpopup to ellipsize text that is too big. Set the maximum window width of the tabpopup to screen_width/4, which seems a sensible size for the popup. svn path=/trunk/; revision=3385 --- ChangeLog | 7 +++++++ src/tabpopup.c | 15 +++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8cb9fc0da..4f01f6a2f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-11-11 Alex R.M. Turner + + * src/tabpopup.c (tab_entry_new, meta_ui_tab_popup_new): Instruct the + GtkLabel in the tabpopup to ellipsize text that is too big. Set the + maximum window width of the tabpopup to screen_width/4, which seems a + sensible size for the popup. + 2007-11-09 Elijah Newren * src/window.c (meta_window_new_with_attrs): If a window is diff --git a/src/tabpopup.c b/src/tabpopup.c index e17c2a63c..5a04e4499 100644 --- a/src/tabpopup.c +++ b/src/tabpopup.c @@ -145,11 +145,6 @@ tab_entry_new (const MetaTabEntry *entry, gboolean outline) { TabEntry *te; - - /* FIXME: make max title size some random relationship to the - * screen, avg char width of our font would be a better number. - */ - int max_chars_per_title = screen_width / 15; te = g_new (TabEntry, 1); te->key = entry->key; @@ -160,7 +155,7 @@ tab_entry_new (const MetaTabEntry *entry, gchar *tmp; gchar *formatter = "%s"; - str = meta_g_utf8_strndup (entry->title, max_chars_per_title); + str = meta_g_utf8_strndup (entry->title, 4096); if (entry->hidden) { @@ -377,6 +372,14 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries, /* remove all the temporary text */ gtk_label_set_text (GTK_LABEL (popup->label), ""); + /* Make it so that we ellipsize if the text is too long */ + gtk_label_set_ellipsize (GTK_LABEL (popup->label), PANGO_ELLIPSIZE_END); + + /* Limit the window size to no bigger than screen_width/4 */ + if (max_label_width>(screen_width/4)) + { + max_label_width = screen_width/4; + } max_label_width += 20; /* add random padding */