summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-12-20 23:10:41 (EST)
committer Patrick McDermott <pj@pehjota.net>2017-12-20 23:10:41 (EST)
commit443f4908cb5ebd9ea9d79a7ea1e577a7b116b845 (patch)
tree3e6d1b2040ce1bc134cc9b512f9261e629d532b6
parentf9b860af3d1ccb2787431be33c278d7344f61a58 (diff)
downloadmarquee-443f4908cb5ebd9ea9d79a7ea1e577a7b116b845.zip
marquee-443f4908cb5ebd9ea9d79a7ea1e577a7b116b845.tar.gz
marquee-443f4908cb5ebd9ea9d79a7ea1e577a7b116b845.tar.bz2
mq_tab_page_set_title(): Block and unblock title handler
-rw-r--r--src/tab-page.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/tab-page.c b/src/tab-page.c
index c695e1b..5d0a998 100644
--- a/src/tab-page.c
+++ b/src/tab-page.c
@@ -47,6 +47,7 @@ struct _MqTabPage {
GtkWidget *label;
const gchar *title;
WebKitWebView *web_view;
+ gulong title_handler_id;
GtkWidget *navigation_toolbar;
};
@@ -87,8 +88,8 @@ init_non_root(MqTabPage *tab_page)
tab_page->web_view = WEBKIT_WEB_VIEW(mq_web_view_new(tab_page,
tab_page->uri));
- g_signal_connect(tab_page->web_view, "notify::title",
- G_CALLBACK(title_cb), tab_page);
+ tab_page->title_handler_id = g_signal_connect(tab_page->web_view,
+ "notify::title", G_CALLBACK(title_cb), tab_page);
tab_page->label = mq_tab_label_new(tab_page,
MQ_WEB_VIEW(tab_page->web_view));
@@ -292,7 +293,15 @@ mq_tab_page_get_title(MqTabPage *tab_page)
void
mq_tab_page_set_title(MqTabPage *tab_page, const gchar *title)
{
- tab_page->title = title;
+ if (title) {
+ tab_page->title = title;
+ g_signal_handler_block(tab_page->web_view,
+ tab_page->title_handler_id);
+ } else {
+ tab_page->title = webkit_web_view_get_title(tab_page->web_view);
+ g_signal_handler_unblock(tab_page->web_view,
+ tab_page->title_handler_id);
+ }
mq_notebook_update_tab_title(
MQ_NOTEBOOK(gtk_widget_get_parent(GTK_WIDGET(tab_page))),
tab_page,