summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex R.M. Turner <armtuk@gmail.com>2007-10-28 15:51:14 +0000
committerThomas James Alexander Thurman <tthurman@src.gnome.org>2007-10-28 15:51:14 +0000
commit1bf37776c3ef6d0b11109123d2a0916309a386c4 (patch)
tree40342e8aff780bd8eaae3a88b788c862fa0845c0
parent908715bd84c9b87f92595989783be384a1869eae (diff)
downloadmetacity-1bf37776c3ef6d0b11109123d2a0916309a386c4.tar.gz
Truncate the string to max_char_per_title before adding bold tags and fix
2007-10-27 Alex R.M. Turner <armtuk@gmail.com> * src/tabpopup.c (tab_entry_new): Truncate the string to max_char_per_title before adding bold tags and fix general flow of function. svn path=/trunk/; revision=3363
-rw-r--r--ChangeLog6
-rw-r--r--src/tabpopup.c31
2 files changed, 23 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 9b4b1c9f..fd753871 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-10-27 Alex R.M. Turner <armtuk@gmail.com>
+
+ * src/tabpopup.c (tab_entry_new): Truncate the string to
+ max_char_per_title before adding bold tags and fix general flow of
+ function.
+
2007-10-16 Thomas Thurman <thomas@thurman.org.uk>
* src/window.c (window_would_be_covered): new function.
diff --git a/src/tabpopup.c b/src/tabpopup.c
index af24764a..e17c2a63 100644
--- a/src/tabpopup.c
+++ b/src/tabpopup.c
@@ -156,31 +156,34 @@ tab_entry_new (const MetaTabEntry *entry,
te->title = NULL;
if (entry->title)
{
+ gchar *str;
gchar *tmp;
+ gchar *formatter = "%s";
+
+ str = meta_g_utf8_strndup (entry->title, max_chars_per_title);
+
if (entry->hidden)
{
- tmp = g_markup_printf_escaped ("[%s]", entry->title);
- }
- else
- {
- tmp = g_markup_printf_escaped ("%s", entry->title);
+ formatter = "[%s]";
}
-
+
+ tmp = g_markup_printf_escaped (formatter, str);
+ g_free (str);
+ str = tmp;
+
if (entry->demands_attention)
{
/* Escape the whole line of text then markup the text and
* copy it back into the original buffer.
*/
- gchar *markup, *escaped;
- escaped = g_markup_escape_text (tmp, -1);
- markup = g_strdup_printf ("<b>%s</b>", escaped);
- g_free (escaped);
- g_free (tmp);
- tmp = markup;
+ tmp = g_strdup_printf ("<b>%s</b>", str);
+ g_free (str);
+ str = tmp;
}
- te->title = meta_g_utf8_strndup (tmp, max_chars_per_title);
- g_free (tmp);
+ te->title=g_strdup(str);
+
+ g_free (str);
}
te->widget = NULL;
te->icon = entry->icon;