summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tab-chrome.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/src/tab-chrome.c b/src/tab-chrome.c
index 548cd78..e368694 100644
--- a/src/tab-chrome.c
+++ b/src/tab-chrome.c
@@ -563,11 +563,6 @@ load_changed_cb(WebKitWebView *web_view, WebKitLoadEvent load_event,
GTK_ENTRY(chrome->uri_entry), 0.0);
break;
}
-
- gtk_widget_set_sensitive(GTK_WIDGET(chrome->back_button),
- webkit_web_view_can_go_back(web_view));
- gtk_widget_set_sensitive(GTK_WIDGET(chrome->forward_button),
- webkit_web_view_can_go_forward(web_view));
}
static gboolean
@@ -671,11 +666,6 @@ uri_cb(WebKitWebView *web_view, GParamSpec __attribute__((unused)) *paramspec,
gtk_entry_set_text(GTK_ENTRY(chrome->uri_entry), uri);
g_free(uri);
gtk_entry_set_attributes(GTK_ENTRY(chrome->uri_entry), NULL);
-
- gtk_widget_set_sensitive(GTK_WIDGET(chrome->back_button),
- webkit_web_view_can_go_back(web_view));
- gtk_widget_set_sensitive(GTK_WIDGET(chrome->forward_button),
- webkit_web_view_can_go_forward(web_view));
}
static void
@@ -705,6 +695,18 @@ loading_cb(WebKitWebView *web_view,
}
static void
+back_forward_list_changed_cb(
+ WebKitBackForwardList __attribute__((unused)) *back_forward_list,
+ WebKitBackForwardListItem __attribute__((unused)) *item_added,
+ gpointer __attribute__((unused)) items_removed, MqTabChrome *chrome)
+{
+ gtk_widget_set_sensitive(GTK_WIDGET(chrome->back_button),
+ webkit_web_view_can_go_back(chrome->web_view));
+ gtk_widget_set_sensitive(GTK_WIDGET(chrome->forward_button),
+ webkit_web_view_can_go_forward(chrome->web_view));
+}
+
+static void
connect_web_view(MqTabChrome *chrome)
{
chrome->hovered_link_uri = NULL;
@@ -721,6 +723,9 @@ connect_web_view(MqTabChrome *chrome)
G_CALLBACK(uri_cb), chrome);
g_signal_connect(chrome->web_view, "notify::is-loading",
G_CALLBACK(loading_cb), chrome);
+ g_signal_connect(
+ webkit_web_view_get_back_forward_list(chrome->web_view),
+ "changed", G_CALLBACK(back_forward_list_changed_cb), chrome);
}
void