From 58be0c6ae8a402b85a9f227e52d57fc64779d0c6 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Wed, 03 Oct 2018 19:24:18 -0400 Subject: mq_tab_page_set_title(): Restore "New Tab" only if Web view has no title Otherwise, if the user renamed the tab, navigated somewhere (setting a title in the Web view), and restored the normal tab title, the window title would be reset to "New Tab" instead of the Web view's title. This is because the WebKitWebView notify::title signal handler was blocked and no title change was detected. --- (limited to 'src') diff --git a/src/tab-page.c b/src/tab-page.c index 4a120d9..1ea02cc 100644 --- a/src/tab-page.c +++ b/src/tab-page.c @@ -299,12 +299,18 @@ mq_tab_page_set_title(MqTabPage *tab_page, const gchar *title) tab_page->title = title; g_signal_handler_block(tab_page->web_view, tab_page->title_handler_id); - } else if (!tab_page->title_init) { - tab_page->title = _("New Tab"); } 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); + if (tab_page->title_init) { + g_signal_handler_unblock(tab_page->web_view, + tab_page->title_handler_id); + } else { + if (tab_page->title) { + tab_page->title_init = TRUE; + } else { + tab_page->title = _("New Tab"); + } + } } mq_notebook_update_tab_title( MQ_NOTEBOOK(gtk_widget_get_parent(GTK_WIDGET(tab_page))), -- cgit v0.9.1