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
This commit is contained in:
Alex R.M. Turner 2007-11-11 22:17:51 +00:00 committed by Thomas James Alexander Thurman
parent 6bec74017f
commit bcc3f56193
2 changed files with 16 additions and 6 deletions

View File

@ -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

View File

@ -146,11 +146,6 @@ tab_entry_new (const MetaTabEntry *entry,
{
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;
te->title = NULL;
@ -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 */