diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-12-21 11:56:09 (EST) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-12-21 11:56:09 (EST) |
commit | 42e62a57382ff6fa901a9cb1773cb6b58a7312d4 (patch) | |
tree | 9de0620f01fdff2928cef6677586bfcc46570b57 | |
parent | 3c1a6fb3a62dc31f26bfd7439c9d80f034505cc0 (diff) | |
download | marquee-42e62a57382ff6fa901a9cb1773cb6b58a7312d4.zip marquee-42e62a57382ff6fa901a9cb1773cb6b58a7312d4.tar.gz marquee-42e62a57382ff6fa901a9cb1773cb6b58a7312d4.tar.bz2 |
MqTabLabel: Factor out title setting into new static function
-rw-r--r-- | src/tab-label.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/tab-label.c b/src/tab-label.c index 72443b9..82f5fa1 100644 --- a/src/tab-label.c +++ b/src/tab-label.c @@ -189,6 +189,17 @@ update_label(MqTabLabel *tab_label) } static void +set_title(MqTabLabel *tab_label, const gchar *title) +{ + g_free(tab_label->title); + tab_label->title = g_strdup(title); + if (tab_label->scrolling) { + tab_label->scrolled_title = g_strdup_printf("%s ", title); + } + update_label(tab_label); +} + +static void favicon_cb(WebKitWebView G_GNUC_UNUSED *web_view, GParamSpec G_GNUC_UNUSED *param_spec, MqTabLabel *tab_label) { @@ -216,12 +227,7 @@ static void title_cb(WebKitWebView G_GNUC_UNUSED *web_view, GParamSpec G_GNUC_UNUSED *param_spec, MqTabLabel *tab_label) { - tab_label->title = webkit_web_view_get_title(tab_label->web_view); - if (tab_label->scrolling) { - tab_label->scrolled_title = g_strdup_printf("%s ", - tab_label->title); - } - update_label(tab_label); + set_title(tab_label, webkit_web_view_get_title(tab_label->web_view)); } static void |