logo

badwolf

Minimalist and privacy-oriented WebKitGTK+ browser
commit: 31e176f6f7c2ac8cf7d1c147a2f20c4e74b21932
parent: cb232d9e919d67c71a96d7ab1fc85cf5aa968b81
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 16 Jun 2020 06:21:16 +0200

fix context_id incrementation

Diffstat:

Mbadwolf.c23++++++++++++++---------
Mbadwolf.h2+-
Mpo/messages.pot50+++++++++++++++++++++++++-------------------------
3 files changed, 40 insertions(+), 35 deletions(-)

diff --git a/badwolf.c b/badwolf.c @@ -293,10 +293,15 @@ WebViewCb_create(WebKitWebView *related_web_view, gpointer user_data) { (void)navigation_action; - struct Window *window = (struct Window *)user_data; - struct Client *browser = new_browser(window, NULL, related_web_view); + struct Client *old_browser = (struct Client *)user_data; + struct Client *browser = NULL; + + // shouldn't be needed but better be safe + old_browser->webView = related_web_view; + + browser = new_browser(old_browser->window, NULL, old_browser); - if(badwolf_new_tab(GTK_NOTEBOOK(window->notebook), browser) < 0) + if(badwolf_new_tab(GTK_NOTEBOOK(old_browser->window->notebook), browser) < 0) return NULL; else return browser->webView; @@ -590,16 +595,16 @@ widgetCb_drop_button3_event(GtkWidget *widget, GdkEvent *event, gpointer user_da } struct Client * -new_browser(struct Window *window, const gchar *target_url, WebKitWebView *related_web_view) +new_browser(struct Window *window, const gchar *target_url, struct Client *old_browser) { struct Client *browser = malloc(sizeof(struct Client)); - target_url = badwolf_ensure_uri_scheme(target_url, (related_web_view == NULL)); + target_url = badwolf_ensure_uri_scheme(target_url, (old_browser == NULL)); char *badwolf_l10n = NULL; if(browser == NULL) return NULL; browser->window = window; - browser->context_id = context_id_counter++; + browser->context_id = old_browser == NULL ? context_id_counter++ : old_browser->context_id; browser->box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_widget_set_name(browser->box, "browser__box"); @@ -670,7 +675,7 @@ new_browser(struct Window *window, const gchar *target_url, WebKitWebView *relat "web-context", web_context, "related-view", - related_web_view, + old_browser == NULL ? NULL : old_browser->webView, "settings", settings, NULL)); @@ -799,7 +804,7 @@ new_browser(struct Window *window, const gchar *target_url, WebKitWebView *relat "notify::estimated-load-progress", G_CALLBACK(WebViewCb_notify__estimated_load_progress), browser); - g_signal_connect(browser->webView, "create", G_CALLBACK(WebViewCb_create), window); + g_signal_connect(browser->webView, "create", G_CALLBACK(WebViewCb_create), browser); g_signal_connect(browser->webView, "close", G_CALLBACK(WebViewCb_close), browser); g_signal_connect( browser->webView, "key-press-event", G_CALLBACK(WebViewCb_key_press_event), browser); @@ -830,7 +835,7 @@ new_browser(struct Window *window, const gchar *target_url, WebKitWebView *relat /* signals for box container */ g_signal_connect(browser->box, "key-press-event", G_CALLBACK(boxCb_key_press_event), browser); - if(related_web_view == NULL) webkit_web_view_load_uri(browser->webView, target_url); + if(old_browser == NULL) webkit_web_view_load_uri(browser->webView, target_url); return browser; } diff --git a/badwolf.h b/badwolf.h @@ -38,7 +38,7 @@ struct Client GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser); void webView_tab_label_change(struct Client *browser, const gchar *title); struct Client * -new_browser(struct Window *window, const gchar *target_url, WebKitWebView *related_web_view); +new_browser(struct Window *window, const gchar *target_url, struct Client *old_browser); int badwolf_new_tab(GtkNotebook *notebook, struct Client *browser); gint badwolf_get_tab_position(GtkContainer *notebook, GtkWidget *child); #endif /* BADWOLF_H_INCLUDED */ diff --git a/po/messages.pot b/po/messages.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Badwolf 1.0.0+g4b85e08.context-id\n" +"Project-Id-Version: Badwolf 1.0.0+g5c8cf6d.develop\n" "Report-Msgid-Bugs-To: contact+badwolf-msgid@hacktivis.me\n" -"POT-Creation-Date: 2020-06-16 01:41+0200\n" +"POT-Creation-Date: 2020-06-16 06:32+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,16 +41,16 @@ msgstr "" msgid "Badwolf Downloads" msgstr "" -#: badwolf.c:920 +#: badwolf.c:925 #, c-format msgid "Buildtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:412 +#: badwolf.c:417 msgid "Continue" msgstr "" -#: badwolf.c:362 +#: badwolf.c:367 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" @@ -65,31 +65,31 @@ msgstr "" msgid "Download starting…" msgstr "" -#: badwolf.c:385 +#: badwolf.c:390 msgid "Error: Some unknown error occurred validating the certificate.\n" msgstr "" -#: badwolf.c:366 +#: badwolf.c:371 msgid "Error: The X509 Certificate Authority is unknown.\n" msgstr "" -#: badwolf.c:379 +#: badwolf.c:384 msgid "Error: The certificate has been revoked.\n" msgstr "" -#: badwolf.c:376 +#: badwolf.c:381 msgid "Error: The certificate has expired. Check your system's clock.\n" msgstr "" -#: badwolf.c:382 +#: badwolf.c:387 msgid "Error: The certificate is considered to be insecure.\n" msgstr "" -#: badwolf.c:373 +#: badwolf.c:378 msgid "Error: The certificate isn't valid yet. Check your system's clock.\n" msgstr "" -#: badwolf.c:369 +#: badwolf.c:374 msgid "Error: The given identity doesn't match the expected one.\n" msgstr "" @@ -100,11 +100,11 @@ msgid "" "Runtime WebKit version: %d.%d.%d" msgstr "" -#: badwolf.c:849 +#: badwolf.c:854 msgid "New tab" msgstr "" -#: badwolf.c:969 +#: badwolf.c:974 msgid "Open new tab" msgstr "" @@ -112,30 +112,30 @@ msgstr "" msgid "Out of Memory" msgstr "" -#: badwolf.c:918 +#: badwolf.c:923 #, c-format msgid "Running Badwolf version: %s\n" msgstr "" -#: badwolf.c:925 +#: badwolf.c:930 #, c-format msgid "Runtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:409 +#: badwolf.c:414 #, c-format msgid "TLS Error for %s." msgstr "" -#: badwolf.c:412 +#: badwolf.c:417 msgid "Temporarily Add Exception" msgstr "" -#: badwolf.c:620 +#: badwolf.c:625 msgid "Toggle javascript" msgstr "" -#: badwolf.c:625 +#: badwolf.c:630 msgid "Toggle loading images automatically" msgstr "" @@ -143,15 +143,15 @@ msgstr "" msgid "Unknown Crash" msgstr "" -#: badwolf.c:623 +#: badwolf.c:628 msgid "_IMG" msgstr "" -#: badwolf.c:618 +#: badwolf.c:623 msgid "_JS" msgstr "" -#: badwolf.c:738 +#: badwolf.c:743 msgid "search in current page" msgstr "" @@ -167,12 +167,12 @@ msgstr "" msgid "the web process terminated for an unknown reason.\n" msgstr "" -#: badwolf.c:932 +#: badwolf.c:937 #, c-format msgid "webkit-web-extension directory set to: %s\n" msgstr "" #. TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. -#: badwolf.c:1003 +#: badwolf.c:1008 msgid "ø" msgstr ""