commit: f74132929d008a5b07f7143e876c68e27cf33cf2
parent: ebf0355bf2cd55b966a45171b140bb4b0a43a691
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 16 May 2020 06:49:56 +0200
badwolf: disable back/forward when useless
Diffstat:
2 files changed, 43 insertions(+), 31 deletions(-)
diff --git a/badwolf.c b/badwolf.c
@@ -48,6 +48,8 @@ static gboolean WebViewCb_decide_policy(WebKitWebView *web_view,
WebKitPolicyDecision *decision,
WebKitPolicyDecisionType decision_type,
gpointer user_data);
+static void
+WebViewCb_load_changed(WebKitWebView *webView, WebKitLoadEvent load_event, gpointer user_data);
static void web_contextCb_download_started(WebKitWebContext *web_context,
WebKitDownload *download,
gpointer user_data);
@@ -332,6 +334,15 @@ WebViewCb_decide_policy(WebKitWebView *web_view,
return TRUE;
}
+static void
+WebViewCb_load_changed(WebKitWebView *webView, WebKitLoadEvent load_event, gpointer user_data)
+{
+ struct Client *browser = (struct Client *)user_data;
+
+ gtk_widget_set_sensitive(browser->back, webkit_web_view_can_go_back(browser->webView));
+ gtk_widget_set_sensitive(browser->forward, webkit_web_view_can_go_forward(browser->webView));
+}
+
static char *
detail_tls_certificate_flags(GTlsCertificateFlags tls_errors)
{
@@ -753,6 +764,7 @@ new_browser(struct Window *window, const gchar *target_url, WebKitWebView *relat
"load-failed-with-tls-errors",
G_CALLBACK(WebViewCb_load_failed_with_tls_errors),
browser);
+ g_signal_connect(browser->webView, "load-changed", G_CALLBACK(WebViewCb_load_changed), browser);
/* signals for WebView's WebContext */
g_signal_connect(G_OBJECT(web_context),
diff --git a/po/messages.pot b/po/messages.pot
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: Badwolf 0.5.1+g10008e9.develop\n"
+"Project-Id-Version: Badwolf 0.5.1+gb30f00ef.develop\n"
"Report-Msgid-Bugs-To: contact+badwolf-msgid@hacktivis.me\n"
-"POT-Creation-Date: 2020-05-15 06:00+0200\n"
+"POT-Creation-Date: 2020-05-16 06:59+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -41,23 +41,23 @@ msgstr ""
msgid "Badwolf Downloads"
msgstr ""
-#: badwolf.c:861
+#: badwolf.c:873
#, c-format
msgid "Buildtime WebKit version: %d.%d.%d\n"
msgstr ""
-#: badwolf.c:391
+#: badwolf.c:402
msgid "Continue"
msgstr ""
-#: badwolf.c:341
+#: badwolf.c:352
msgid ""
"Couldn't verify the TLS certificate to ensure a better security of the "
"connection. You might want to verify your machine and network.\n"
"\n"
msgstr ""
-#: badwolf.c:98
+#: badwolf.c:100
msgid "Crashed"
msgstr ""
@@ -65,31 +65,31 @@ msgstr ""
msgid "Download starting…"
msgstr ""
-#: badwolf.c:364
+#: badwolf.c:375
msgid "Error: Some unknown error occurred validating the certificate.\n"
msgstr ""
-#: badwolf.c:345
+#: badwolf.c:356
msgid "Error: The X509 Certificate Authority is unknown.\n"
msgstr ""
-#: badwolf.c:358
+#: badwolf.c:369
msgid "Error: The certificate has been revoked.\n"
msgstr ""
-#: badwolf.c:355
+#: badwolf.c:366
msgid "Error: The certificate has expired. Check your system's clock.\n"
msgstr ""
-#: badwolf.c:361
+#: badwolf.c:372
msgid "Error: The certificate is considered to be insecure.\n"
msgstr ""
-#: badwolf.c:352
+#: badwolf.c:363
msgid "Error: The certificate isn't valid yet. Check your system's clock.\n"
msgstr ""
-#: badwolf.c:348
+#: badwolf.c:359
msgid "Error: The given identity doesn't match the expected one.\n"
msgstr ""
@@ -100,79 +100,79 @@ msgid ""
"Runtime WebKit version: %d.%d.%d"
msgstr ""
-#: badwolf.c:790
+#: badwolf.c:802
msgid "New tab"
msgstr ""
-#: badwolf.c:910
+#: badwolf.c:922
msgid "Open new tab"
msgstr ""
-#: badwolf.c:102
+#: badwolf.c:104
msgid "Out of Memory"
msgstr ""
-#: badwolf.c:859
+#: badwolf.c:871
#, c-format
msgid "Running Badwolf version: %s\n"
msgstr ""
-#: badwolf.c:866
+#: badwolf.c:878
#, c-format
msgid "Runtime WebKit version: %d.%d.%d\n"
msgstr ""
-#: badwolf.c:388
+#: badwolf.c:399
#, c-format
msgid "TLS Error for %s."
msgstr ""
-#: badwolf.c:391
+#: badwolf.c:402
msgid "Temporarily Add Exception"
msgstr ""
-#: badwolf.c:588
+#: badwolf.c:599
msgid "Toggle javascript"
msgstr ""
-#: badwolf.c:593
+#: badwolf.c:604
msgid "Toggle loading images automatically"
msgstr ""
-#: badwolf.c:106
+#: badwolf.c:108
msgid "Unknown Crash"
msgstr ""
-#: badwolf.c:591
+#: badwolf.c:602
msgid "_IMG"
msgstr ""
-#: badwolf.c:586
+#: badwolf.c:597
msgid "_JS"
msgstr ""
-#: badwolf.c:706
+#: badwolf.c:717
msgid "search in current page"
msgstr ""
-#: badwolf.c:97
+#: badwolf.c:99
msgid "the web process crashed.\n"
msgstr ""
-#: badwolf.c:101
+#: badwolf.c:103
msgid "the web process exceeded the memory limit.\n"
msgstr ""
-#: badwolf.c:105
+#: badwolf.c:107
msgid "the web process terminated for an unknown reason.\n"
msgstr ""
-#: badwolf.c:873
+#: badwolf.c:885
#, c-format
msgid "webkit-web-extension directory set to: %s\n"
msgstr ""
#. TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext.
-#: badwolf.c:944
+#: badwolf.c:956
msgid "ø"
msgstr ""