diff options
-rw-r--r-- | src/tab-page.c | 15 |
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, |