logo

badwolf

Minimalist and privacy-oriented WebKitGTK+ browser
commit: cb774b19a095701674688a907698882490d6f21e
parent: 5da95c27a526d62de2d600d949ac4bf1f6179a9d
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon, 11 May 2020 01:38:57 +0200

Allow toggling auto_load_images

Diffstat:

Mbadwolf.c32++++++++++++++++++++++++++++++++
Mbadwolf.h1+
Mpo/messages.pot60++++++++++++++++++++++++++++++++----------------------------
3 files changed, 65 insertions(+), 28 deletions(-)

diff --git a/badwolf.c b/badwolf.c @@ -53,6 +53,7 @@ static void web_contextCb_download_started(WebKitWebContext *web_context, gpointer user_data); static gboolean locationCb_activate(GtkEntry *location, gpointer user_data); static gboolean javascriptCb_toggled(GtkButton *javascript, gpointer user_data); +static gboolean auto_load_imagesCb_toggled(GtkButton *auto_load_images, gpointer user_data); static gboolean SearchEntryCb_next__match(GtkSearchEntry *search, gpointer user_data); static gboolean SearchEntryCb_previous__match(GtkSearchEntry *search, gpointer user_data); static gboolean SearchEntryCb_search__changed(GtkSearchEntry *search, gpointer user_data); @@ -463,6 +464,21 @@ javascriptCb_toggled(GtkButton *javascript, gpointer user_data) } static gboolean +auto_load_imagesCb_toggled(GtkButton *auto_load_images, gpointer user_data) +{ + struct Client *browser = (struct Client *)user_data; + + WebKitSettings *settings = webkit_web_view_get_settings(browser->webView); + + webkit_settings_set_auto_load_images( + settings, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(auto_load_images))); + + webkit_web_view_set_settings(browser->webView, settings); + + return TRUE; +} + +static gboolean SearchEntryCb_next__match(GtkSearchEntry *search, gpointer user_data) { (void)search; @@ -530,6 +546,10 @@ new_browser(struct Window *window, const gchar *target_url, WebKitWebView *relat gtk_widget_set_name(browser->javascript, "browser__javascript"); gtk_container_add(GTK_CONTAINER(browser->javascript), gtk_image_new_from_icon_name("text-x-script", GTK_ICON_SIZE_LARGE_TOOLBAR)); + browser->auto_load_images = gtk_toggle_button_new(); + gtk_widget_set_name(browser->auto_load_images, "browser__load_images"); + gtk_container_add(GTK_CONTAINER(browser->auto_load_images), + gtk_image_new_from_icon_name("image-x-generic", GTK_ICON_SIZE_LARGE_TOOLBAR)); browser->statusbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_name(browser->statusbar, "browser__statusbar"); @@ -562,6 +582,8 @@ new_browser(struct Window *window, const gchar *target_url, WebKitWebView *relat gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(browser->javascript), webkit_settings_get_enable_javascript_markup(settings)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(browser->auto_load_images), + webkit_settings_get_auto_load_images(settings)); browser->webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW, "web-context", @@ -574,6 +596,7 @@ new_browser(struct Window *window, const gchar *target_url, WebKitWebView *relat gtk_widget_set_name(GTK_WIDGET(browser->webView), "browser__webView"); gtk_widget_set_tooltip_text(browser->javascript, _("Toggle javascript")); + gtk_widget_set_tooltip_text(browser->auto_load_images, _("Toggle loading images automatically")); gtk_box_pack_start(GTK_BOX(browser->toolbar), GTK_WIDGET(browser->location), @@ -585,6 +608,11 @@ new_browser(struct Window *window, const gchar *target_url, WebKitWebView *relat FALSE, FALSE, BADWOLF_TOOLBAR_PADDING); + gtk_box_pack_start(GTK_BOX(browser->toolbar), + GTK_WIDGET(browser->auto_load_images), + FALSE, + FALSE, + BADWOLF_TOOLBAR_PADDING); gtk_box_pack_start( GTK_BOX(browser->box), GTK_WIDGET(browser->toolbar), FALSE, FALSE, BADWOLF_BOX_PADDING); @@ -621,6 +649,10 @@ new_browser(struct Window *window, const gchar *target_url, WebKitWebView *relat /* signals for javacript toggle widget */ g_signal_connect(browser->javascript, "toggled", G_CALLBACK(javascriptCb_toggled), browser); + /* signals for auto_load_images toggle widget */ + g_signal_connect( + browser->auto_load_images, "toggled", G_CALLBACK(auto_load_imagesCb_toggled), browser); + /* signals for WebView widget */ g_signal_connect(browser->webView, "web-process-terminated", diff --git a/badwolf.h b/badwolf.h @@ -22,6 +22,7 @@ struct Client GtkWidget *toolbar; GtkWidget *location; GtkWidget *javascript; + GtkWidget *auto_load_images; WebKitWebView *webView; struct Window *window; diff --git a/po/messages.pot b/po/messages.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Badwolf 0.5.1+g226ed40.develop\n" +"Project-Id-Version: Badwolf 0.5.1+g5da95c2.develop\n" "Report-Msgid-Bugs-To: contact+badwolf-msgid@hacktivis.me\n" -"POT-Creation-Date: 2020-05-11 00:19+0200\n" +"POT-Creation-Date: 2020-05-11 01:36+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:760 +#: badwolf.c:792 #, c-format msgid "Buildtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:387 +#: badwolf.c:388 msgid "Continue" msgstr "" -#: badwolf.c:337 +#: badwolf.c:338 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:94 +#: badwolf.c:95 msgid "Crashed" msgstr "" @@ -65,31 +65,31 @@ msgstr "" msgid "Download starting…" msgstr "" -#: badwolf.c:360 +#: badwolf.c:361 msgid "Error: Some unknown error occurred validating the certificate.\n" msgstr "" -#: badwolf.c:341 +#: badwolf.c:342 msgid "Error: The X509 Certificate Authority is unknown.\n" msgstr "" -#: badwolf.c:354 +#: badwolf.c:355 msgid "Error: The certificate has been revoked.\n" msgstr "" -#: badwolf.c:351 +#: badwolf.c:352 msgid "Error: The certificate has expired. Check your system's clock.\n" msgstr "" -#: badwolf.c:357 +#: badwolf.c:358 msgid "Error: The certificate is considered to be insecure.\n" msgstr "" -#: badwolf.c:348 +#: badwolf.c:349 msgid "Error: The certificate isn't valid yet. Check your system's clock.\n" msgstr "" -#: badwolf.c:344 +#: badwolf.c:345 msgid "Error: The given identity doesn't match the expected one.\n" msgstr "" @@ -100,67 +100,71 @@ msgid "" "Runtime WebKit version: %d.%d.%d" msgstr "" -#: badwolf.c:689 +#: badwolf.c:721 msgid "New tab" msgstr "" -#: badwolf.c:809 +#: badwolf.c:841 msgid "Open new tab" msgstr "" -#: badwolf.c:98 +#: badwolf.c:99 msgid "Out of Memory" msgstr "" -#: badwolf.c:758 +#: badwolf.c:790 #, c-format msgid "Running Badwolf version: %s\n" msgstr "" -#: badwolf.c:765 +#: badwolf.c:797 #, c-format msgid "Runtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:384 +#: badwolf.c:385 #, c-format msgid "TLS Error for %s." msgstr "" -#: badwolf.c:387 +#: badwolf.c:388 msgid "Temporarly Add Exception" msgstr "" -#: badwolf.c:574 +#: badwolf.c:598 msgid "Toggle javascript" msgstr "" -#: badwolf.c:102 +#: badwolf.c:599 +msgid "Toggle loading images automatically" +msgstr "" + +#: badwolf.c:103 msgid "Unknown Crash" msgstr "" -#: badwolf.c:615 +#: badwolf.c:644 msgid "search in current page" msgstr "" -#: badwolf.c:93 +#: badwolf.c:94 msgid "the web process crashed.\n" msgstr "" -#: badwolf.c:97 +#: badwolf.c:98 msgid "the web process exceeded the memory limit.\n" msgstr "" -#: badwolf.c:101 +#: badwolf.c:102 msgid "the web process terminated for an unknown reason.\n" msgstr "" -#: badwolf.c:772 +#: badwolf.c:804 #, c-format msgid "webkit-web-extension directory set to: %s\n" msgstr "" #. TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. -#: badwolf.c:843 +#: badwolf.c:875 msgid "ø" msgstr ""