From 42e62a57382ff6fa901a9cb1773cb6b58a7312d4 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 21 Dec 2017 11:56:09 -0500 Subject: MqTabLabel: Factor out title setting into new static function --- (limited to 'src') 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 -- cgit v0.9.1