summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2018-10-03 19:24:18 (EDT)
committer P. J. McDermott <pj@pehjota.net>2018-10-03 19:24:18 (EDT)
commit58be0c6ae8a402b85a9f227e52d57fc64779d0c6 (patch)
tree89e1c1811388e5b0b0a3df02bd49ae2c4c916988
parentf446747cb92c3196be534e4dee1fdc13a9aba26e (diff)
downloadmarquee-58be0c6ae8a402b85a9f227e52d57fc64779d0c6.zip
marquee-58be0c6ae8a402b85a9f227e52d57fc64779d0c6.tar.gz
marquee-58be0c6ae8a402b85a9f227e52d57fc64779d0c6.tar.bz2
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.
-rw-r--r--src/tab-page.c14
1 files changed, 10 insertions, 4 deletions
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))),