summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex R.M. Turner <armtuk@gmail.com>2007-11-11 22:17:51 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2007-11-11 22:17:51 +0000
commitbcc3f56193127e2b9e98bfbe4d8f7813c132928d (patch)
tree936c95ae39e56674cca7f48de0b98cc42f8f3ee7
parent6bec74017fbed9672534d01ecad89a6df86a2ac2 (diff)
downloadmetacity-bcc3f56193127e2b9e98bfbe4d8f7813c132928d.tar.gz
Instruct the GtkLabel in the tabpopup to ellipsize text that is too big.
2007-11-11 Alex R.M. Turner <armtuk@gmail.com> * 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
-rw-r--r--ChangeLog7
-rw-r--r--src/tabpopup.c15
2 files changed, 16 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 8cb9fc0d..4f01f6a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-11-11 Alex R.M. Turner <armtuk@gmail.com>
+
+ * 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 <newren gmail com>
* src/window.c (meta_window_new_with_attrs): If a window is
diff --git a/src/tabpopup.c b/src/tabpopup.c
index e17c2a63..5a04e449 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 */