logo

badwolf

Minimalist and privacy-oriented WebKitGTK+ browser
commit: 372a6d6508e640121a58f6e83d81f1e8fae2ffde
parent: 1e28a08d0d719fae0797a184372937400f7926ee
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon, 11 May 2020 04:35:04 +0200

Add back/forward buttons

Diffstat:

Mbadwolf.c65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
Mbadwolf.h2++
Mconfig.h3+++
Mpo/messages.pot62+++++++++++++++++++++++++++++++-------------------------------
4 files changed, 95 insertions(+), 37 deletions(-)

diff --git a/badwolf.c b/badwolf.c @@ -54,6 +54,8 @@ static void web_contextCb_download_started(WebKitWebContext *web_context, 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 void backCb_clicked(GtkButton *back, gpointer user_data); +static void forwardCb_clicked(GtkButton *forward, 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); @@ -478,6 +480,24 @@ auto_load_imagesCb_toggled(GtkButton *auto_load_images, gpointer user_data) return TRUE; } +static void +backCb_clicked(GtkButton *back, gpointer user_data) +{ + (void)back; + struct Client *browser = (struct Client *)user_data; + + webkit_web_view_go_back(browser->webView); +} + +static void +forwardCb_clicked(GtkButton *forward, gpointer user_data) +{ + (void)forward; + struct Client *browser = (struct Client *)user_data; + + webkit_web_view_go_forward(browser->webView); +} + static gboolean SearchEntryCb_next__match(GtkSearchEntry *search, gpointer user_data) { @@ -538,23 +558,39 @@ new_browser(struct Window *window, const gchar *target_url, WebKitWebView *relat browser->window = window; browser->box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_name(browser->box, "browser__box"); + + browser->toolbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_name(browser->toolbar, "browser__toolbar"); - browser->location = gtk_entry_new(); - gtk_widget_set_name(browser->location, "browser__location"); + + browser->back = gtk_button_new_from_icon_name("go-previous-symbolic", GTK_ICON_SIZE_LARGE_TOOLBAR); + gtk_widget_set_name(browser->back, "browser__back"); + + browser->forward = gtk_button_new_from_icon_name("go-next-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR); + gtk_widget_set_name(browser->forward, "browser__forward"); + + GtkWidget *toolbar_separator = gtk_separator_new(GTK_ORIENTATION_VERTICAL); + browser->javascript = gtk_toggle_button_new_with_label(_("JS")); gtk_widget_set_name(browser->javascript, "browser__javascript"); + gtk_widget_set_tooltip_text(browser->javascript, _("Toggle javascript")); gtk_button_set_relief(GTK_BUTTON(browser->javascript), GTK_RELIEF_NONE); + browser->auto_load_images = gtk_toggle_button_new_with_label(_("IMG")); gtk_widget_set_name(browser->auto_load_images, "browser__load_images"); + gtk_widget_set_tooltip_text(browser->auto_load_images, _("Toggle loading images automatically")); gtk_button_set_relief(GTK_BUTTON(browser->auto_load_images), GTK_RELIEF_NONE); + browser->location = gtk_entry_new(); + gtk_widget_set_name(browser->location, "browser__location"); + + browser->statusbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_name(browser->statusbar, "browser__statusbar"); - browser->statuslabel = gtk_label_new(NULL); - gtk_widget_set_name(browser->statuslabel, "browser__statuslabel"); browser->search = gtk_search_entry_new(); gtk_widget_set_name(browser->search, "browser__search"); + browser->statuslabel = gtk_label_new(NULL); + gtk_widget_set_name(browser->statuslabel, "browser__statuslabel"); setenv("GTK_THEME", ":light", 0); @@ -593,10 +629,23 @@ new_browser(struct Window *window, const gchar *target_url, WebKitWebView *relat NULL)); 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->back), + FALSE, + FALSE, + BADWOLF_TOOLBAR_PADDING); + gtk_box_pack_start(GTK_BOX(browser->toolbar), + GTK_WIDGET(browser->forward), + FALSE, + FALSE, + BADWOLF_TOOLBAR_PADDING); + gtk_box_pack_start(GTK_BOX(browser->toolbar), + toolbar_separator, + FALSE, + FALSE, + BADWOLF_TOOLBAR_SEPARATOR_PADDING); + gtk_box_pack_start(GTK_BOX(browser->toolbar), GTK_WIDGET(browser->javascript), FALSE, FALSE, @@ -644,6 +693,10 @@ new_browser(struct Window *window, const gchar *target_url, WebKitWebView *relat gtk_entry_set_placeholder_text(GTK_ENTRY(browser->search), _("search in current page")); + /* signals for back/forward buttons */ + g_signal_connect(browser->back, "clicked", G_CALLBACK(backCb_clicked), browser); + g_signal_connect(browser->forward, "clicked", G_CALLBACK(forwardCb_clicked), browser); + /* signals for location entry widget */ g_signal_connect(browser->location, "activate", G_CALLBACK(locationCb_activate), browser); diff --git a/badwolf.h b/badwolf.h @@ -20,6 +20,8 @@ struct Client GtkWidget *box; GtkWidget *toolbar; + GtkWidget *back; + GtkWidget *forward; GtkWidget *javascript; GtkWidget *auto_load_images; GtkWidget *location; diff --git a/config.h b/config.h @@ -39,6 +39,9 @@ // BADWOLF_TOOLBAR_PADDING: Amount of padding between toolbar elements #define BADWOLF_TOOLBAR_PADDING 0 +// BADWOLF_TOOLBAR_PADDING: Amount of padding between toolbar elements +#define BADWOLF_TOOLBAR_SEPARATOR_PADDING 4 + // BADWOLF_STATUSBAR_PADDING: Amount of padding between statusbar elements #define BADWOLF_STATUSBAR_PADDING 0 diff --git a/po/messages.pot b/po/messages.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Badwolf 0.5.1+g1e5642a.develop\n" +"Project-Id-Version: Badwolf 0.5.1+g1e28a08.develop\n" "Report-Msgid-Bugs-To: contact+badwolf-msgid@hacktivis.me\n" -"POT-Creation-Date: 2020-05-11 03:28+0200\n" +"POT-Creation-Date: 2020-05-11 04:18+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:793 +#: badwolf.c:846 #, c-format msgid "Buildtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:388 +#: badwolf.c:390 msgid "Continue" msgstr "" -#: badwolf.c:338 +#: badwolf.c:340 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:95 +#: badwolf.c:97 msgid "Crashed" msgstr "" @@ -65,39 +65,39 @@ msgstr "" msgid "Download starting…" msgstr "" -#: badwolf.c:361 +#: badwolf.c:363 msgid "Error: Some unknown error occurred validating the certificate.\n" msgstr "" -#: badwolf.c:342 +#: badwolf.c:344 msgid "Error: The X509 Certificate Authority is unknown.\n" msgstr "" -#: badwolf.c:355 +#: badwolf.c:357 msgid "Error: The certificate has been revoked.\n" msgstr "" -#: badwolf.c:352 +#: badwolf.c:354 msgid "Error: The certificate has expired. Check your system's clock.\n" msgstr "" -#: badwolf.c:358 +#: badwolf.c:360 msgid "Error: The certificate is considered to be insecure.\n" msgstr "" -#: badwolf.c:349 +#: badwolf.c:351 msgid "Error: The certificate isn't valid yet. Check your system's clock.\n" msgstr "" -#: badwolf.c:345 +#: badwolf.c:347 msgid "Error: The given identity doesn't match the expected one.\n" msgstr "" -#: badwolf.c:548 +#: badwolf.c:579 msgid "IMG" msgstr "" -#: badwolf.c:545 +#: badwolf.c:574 msgid "JS" msgstr "" @@ -108,71 +108,71 @@ msgid "" "Runtime WebKit version: %d.%d.%d" msgstr "" -#: badwolf.c:722 +#: badwolf.c:775 msgid "New tab" msgstr "" -#: badwolf.c:842 +#: badwolf.c:895 msgid "Open new tab" msgstr "" -#: badwolf.c:99 +#: badwolf.c:101 msgid "Out of Memory" msgstr "" -#: badwolf.c:791 +#: badwolf.c:844 #, c-format msgid "Running Badwolf version: %s\n" msgstr "" -#: badwolf.c:798 +#: badwolf.c:851 #, c-format msgid "Runtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:385 +#: badwolf.c:387 #, c-format msgid "TLS Error for %s." msgstr "" -#: badwolf.c:388 +#: badwolf.c:390 msgid "Temporarly Add Exception" msgstr "" -#: badwolf.c:596 +#: badwolf.c:576 msgid "Toggle javascript" msgstr "" -#: badwolf.c:597 +#: badwolf.c:581 msgid "Toggle loading images automatically" msgstr "" -#: badwolf.c:103 +#: badwolf.c:105 msgid "Unknown Crash" msgstr "" -#: badwolf.c:645 +#: badwolf.c:694 msgid "search in current page" msgstr "" -#: badwolf.c:94 +#: badwolf.c:96 msgid "the web process crashed.\n" msgstr "" -#: badwolf.c:98 +#: badwolf.c:100 msgid "the web process exceeded the memory limit.\n" msgstr "" -#: badwolf.c:102 +#: badwolf.c:104 msgid "the web process terminated for an unknown reason.\n" msgstr "" -#: badwolf.c:805 +#: badwolf.c:858 #, c-format msgid "webkit-web-extension directory set to: %s\n" msgstr "" #. TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. -#: badwolf.c:876 +#: badwolf.c:929 msgid "ø" msgstr ""