diff options
author | P. J. McDermott <pj@pehjota.net> | 2018-10-03 18:36:25 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2018-10-03 18:36:25 (EDT) |
commit | 36a39c4b1caaa36bbbbd5286279914231e96d280 (patch) | |
tree | 7a9c84720c54edf5f38d6903a78f5d77937b4c45 /src | |
parent | 238d867b08eee241292924fe60d3695ea712faac (diff) | |
download | marquee-36a39c4b1caaa36bbbbd5286279914231e96d280.zip marquee-36a39c4b1caaa36bbbbd5286279914231e96d280.tar.gz marquee-36a39c4b1caaa36bbbbd5286279914231e96d280.tar.bz2 |
mq_tab_label_begin_scrolling(): Allow reuse while already scrolling
And reuse it in title setting function.
Diffstat (limited to 'src')
-rw-r--r-- | src/tab-label.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/tab-label.c b/src/tab-label.c index 4b28923..35f1c91 100644 --- a/src/tab-label.c +++ b/src/tab-label.c @@ -192,12 +192,7 @@ set_title(MqTabLabel *tab_label, const gchar *title) g_free(tab_label->title); tab_label->title = g_strdup(title); if (tab_label->scrolling) { - g_free(tab_label->scrolled_title); - g_free(tab_label->scrolled_markup); - tab_label->scrolled_title = g_strdup_printf("%s ", title); - tab_label->scrolled_markup = - g_markup_printf_escaped(SCROLLED_TITLE_FMT, - tab_label->scrolled_title); + mq_tab_label_begin_scrolling(tab_label); } update_label(tab_label); gtk_widget_set_tooltip_text(GTK_WIDGET(tab_label), tab_label->title); @@ -513,13 +508,9 @@ mq_tab_label_set_position(MqTabLabel *tab_label, guint position) void mq_tab_label_begin_scrolling(MqTabLabel *tab_label) { - if (tab_label->scrolling) { - /* Avoid leaking tab_label->scrolled_title and - * tab_label->scrolled_markup. */ - return; - } - tab_label->scrolling = TRUE; + g_free(tab_label->scrolled_title); + g_free(tab_label->scrolled_markup); tab_label->scrolled_title = g_strdup_printf("%s ", tab_label->title); tab_label->scrolled_markup = g_markup_printf_escaped(SCROLLED_TITLE_FMT, tab_label->scrolled_title); |