From cb232d9e919d67c71a96d7ab1fc85cf5aa968b81 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Tue, 16 Jun 2020 01:45:13 +0200 Subject: Add webcontext hex id to tab label --- badwolf.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 54dcf53..b0e2beb 100644 --- a/badwolf.c +++ b/badwolf.c @@ -12,13 +12,14 @@ #include /* _() and other internationalization/localization helpers */ #include /* soup* */ #include /* LC_* */ -#include /* perror(), fprintf() */ +#include /* perror(), fprintf(), snprintf() */ #include /* malloc() */ #include /* access() */ gchar *web_extensions_directory; -const gchar *homepage = "https://hacktivis.me/projects/badwolf"; -const gchar *version = VERSION; +const gchar *homepage = "https://hacktivis.me/projects/badwolf"; +const gchar *version = VERSION; +int context_id_counter = 0; static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data); static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView, @@ -134,6 +135,10 @@ GtkWidget * badwolf_new_tab_box(const gchar *title, struct Client *browser) { (void)browser; + char context_id_str[7]; + + snprintf(context_id_str, 7, "%4X: ", browser->context_id); + GtkWidget *tab_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_name(tab_box, "browser__tabbox"); GtkWidget *close = @@ -141,6 +146,8 @@ badwolf_new_tab_box(const gchar *title, struct Client *browser) gtk_widget_set_name(close, "browser__tabbox__close"); GtkWidget *label = gtk_label_new(title); gtk_widget_set_name(label, "browser__tabbox__label"); + GtkWidget *context_label = gtk_label_new(context_id_str); + gtk_widget_set_name(label, "browser__tabbox__context_label"); GtkWidget *playing = gtk_image_new_from_icon_name("audio-volume-high-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_set_name(playing, "browser__tabbox__playing"); @@ -155,8 +162,10 @@ badwolf_new_tab_box(const gchar *title, struct Client *browser) gtk_label_set_ellipsize(GTK_LABEL(label), BADWOLF_TAB_LABEL_ELLIPSIZE); gtk_label_set_single_line_mode(GTK_LABEL(label), TRUE); + gtk_label_set_single_line_mode(GTK_LABEL(context_label), TRUE); gtk_box_pack_start(GTK_BOX(tab_box), playing, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(tab_box), context_label, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tab_box), label, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tab_box), close, FALSE, FALSE, 0); @@ -589,8 +598,9 @@ new_browser(struct Window *window, const gchar *target_url, WebKitWebView *relat if(browser == NULL) return NULL; - browser->window = window; - browser->box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + browser->window = window; + browser->context_id = context_id_counter++; + 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); -- cgit v1.3.1-23-gd82d From 31e176f6f7c2ac8cf7d1c147a2f20c4e74b21932 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Tue, 16 Jun 2020 06:21:16 +0200 Subject: fix context_id incrementation --- badwolf.c | 23 ++++++++++++++--------- badwolf.h | 2 +- po/messages.pot | 50 +++++++++++++++++++++++++------------------------- 3 files changed, 40 insertions(+), 35 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index b0e2beb..a8b8802 100644 --- 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 index 99d7b78..530f9c8 100644 --- 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 index c150e4e..e669e74 100644 --- 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 \n" "Language-Team: LANGUAGE \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 "" -- cgit v1.3.1-23-gd82d From e94212d51be4e15e12a67e633baa32f0a0d6273b Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 4 Jul 2020 06:52:00 +0200 Subject: badwolf: badwolf_get_tab_position → gtk_notebook_page_num MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- badwolf.c | 16 ++------------- po/messages.pot | 62 ++++++++++++++++++++++++++++----------------------------- 2 files changed, 33 insertions(+), 45 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index a8b8802..6bb0470 100644 --- a/badwolf.c +++ b/badwolf.c @@ -75,8 +75,7 @@ WebViewCb_close(WebKitWebView *webView, gpointer user_data) struct Client *browser = (struct Client *)user_data; GtkNotebook *notebook = GTK_NOTEBOOK(browser->window->notebook); - gtk_notebook_remove_page(notebook, - badwolf_get_tab_position(GTK_CONTAINER(notebook), browser->box)); + gtk_notebook_remove_page(notebook, gtk_notebook_page_num(GTK_NOTEBOOK(notebook), browser->box)); gtk_widget_destroy(browser->box); @@ -221,7 +220,7 @@ webView_tab_label_change(struct Client *browser, const gchar *title) gtk_notebook_set_menu_label_text(GTK_NOTEBOOK(notebook), browser->box, title); // Set the window title if the title change was on the current tab - if(badwolf_get_tab_position(GTK_CONTAINER(notebook), browser->box) == + if(gtk_notebook_page_num(GTK_NOTEBOOK(notebook), browser->box) == gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook))) gtk_window_set_title(GTK_WINDOW(browser->window->main_window), title); } @@ -898,17 +897,6 @@ notebookCb_switch__page(GtkNotebook *notebook, GtkWidget *page, guint page_num, gtk_window_set_title(GTK_WINDOW(window->main_window), gtk_widget_get_tooltip_text(label)); } -gint -badwolf_get_tab_position(GtkContainer *notebook, GtkWidget *child) -{ - GValue position = G_VALUE_INIT; - g_value_init(&position, G_TYPE_INT); - - gtk_container_child_get_property(notebook, child, "position", &position); - - return g_value_get_int(&position); -} - int main(int argc, char *argv[]) { diff --git a/po/messages.pot b/po/messages.pot index e669e74..b2ca404 100644 --- a/po/messages.pot +++ b/po/messages.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Badwolf 1.0.0+g5c8cf6d.develop\n" +"Project-Id-Version: Badwolf 1.0.0+g498bce5.develop\n" "Report-Msgid-Bugs-To: contact+badwolf-msgid@hacktivis.me\n" -"POT-Creation-Date: 2020-06-16 06:32+0200\n" +"POT-Creation-Date: 2020-07-04 06:53+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -41,23 +41,23 @@ msgstr "" msgid "Badwolf Downloads" msgstr "" -#: badwolf.c:925 +#: badwolf.c:913 #, c-format msgid "Buildtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:417 +#: badwolf.c:416 msgid "Continue" msgstr "" -#: badwolf.c:367 +#: badwolf.c:366 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:100 +#: badwolf.c:99 msgid "Crashed" msgstr "" @@ -65,31 +65,31 @@ msgstr "" msgid "Download starting…" msgstr "" -#: badwolf.c:390 +#: badwolf.c:389 msgid "Error: Some unknown error occurred validating the certificate.\n" msgstr "" -#: badwolf.c:371 +#: badwolf.c:370 msgid "Error: The X509 Certificate Authority is unknown.\n" msgstr "" -#: badwolf.c:384 +#: badwolf.c:383 msgid "Error: The certificate has been revoked.\n" msgstr "" -#: badwolf.c:381 +#: badwolf.c:380 msgid "Error: The certificate has expired. Check your system's clock.\n" msgstr "" -#: badwolf.c:387 +#: badwolf.c:386 msgid "Error: The certificate is considered to be insecure.\n" msgstr "" -#: badwolf.c:378 +#: badwolf.c:377 msgid "Error: The certificate isn't valid yet. Check your system's clock.\n" msgstr "" -#: badwolf.c:374 +#: badwolf.c:373 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:854 +#: badwolf.c:853 msgid "New tab" msgstr "" -#: badwolf.c:974 +#: badwolf.c:962 msgid "Open new tab" msgstr "" -#: badwolf.c:104 +#: badwolf.c:103 msgid "Out of Memory" msgstr "" -#: badwolf.c:923 +#: badwolf.c:911 #, c-format msgid "Running Badwolf version: %s\n" msgstr "" -#: badwolf.c:930 +#: badwolf.c:918 #, c-format msgid "Runtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:414 +#: badwolf.c:413 #, c-format msgid "TLS Error for %s." msgstr "" -#: badwolf.c:417 +#: badwolf.c:416 msgid "Temporarily Add Exception" msgstr "" -#: badwolf.c:625 +#: badwolf.c:624 msgid "Toggle javascript" msgstr "" -#: badwolf.c:630 +#: badwolf.c:629 msgid "Toggle loading images automatically" msgstr "" -#: badwolf.c:108 +#: badwolf.c:107 msgid "Unknown Crash" msgstr "" -#: badwolf.c:628 +#: badwolf.c:627 msgid "_IMG" msgstr "" -#: badwolf.c:623 +#: badwolf.c:622 msgid "_JS" msgstr "" -#: badwolf.c:743 +#: badwolf.c:742 msgid "search in current page" msgstr "" -#: badwolf.c:99 +#: badwolf.c:98 msgid "the web process crashed.\n" msgstr "" -#: badwolf.c:103 +#: badwolf.c:102 msgid "the web process exceeded the memory limit.\n" msgstr "" -#: badwolf.c:107 +#: badwolf.c:106 msgid "the web process terminated for an unknown reason.\n" msgstr "" -#: badwolf.c:937 +#: badwolf.c:925 #, c-format msgid "webkit-web-extension directory set to: %s\n" msgstr "" #. TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. -#: badwolf.c:1008 +#: badwolf.c:996 msgid "ø" msgstr "" -- cgit v1.3.1-23-gd82d From eaf289e8ebb017f7de4081a1564737da044dd341 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 4 Jul 2020 07:15:29 +0200 Subject: Switch automatically to a tab when user-requested This changes behavior but doesn't breaks meaning nor documentation and significantly improves usability. So meant to be applied directly into 1.0.x release branch. Closes: https://gitlab.com/lanodan/badWolf/-/issues/8 --- badwolf.c | 18 ++++++++++++------ badwolf.h | 2 +- keybindings.c | 6 ++++-- po/messages.pot | 18 +++++++++--------- 4 files changed, 26 insertions(+), 18 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 6bb0470..d3dcde9 100644 --- a/badwolf.c +++ b/badwolf.c @@ -300,7 +300,7 @@ WebViewCb_create(WebKitWebView *related_web_view, browser = new_browser(old_browser->window, NULL, old_browser); - if(badwolf_new_tab(GTK_NOTEBOOK(old_browser->window->notebook), browser) < 0) + if(badwolf_new_tab(GTK_NOTEBOOK(old_browser->window->notebook), browser, FALSE) < 0) return NULL; else return browser->webView; @@ -839,7 +839,8 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b return browser; } -/* badwolf_new_tab: Inserts struct Client *browser in GtkNotebook *notebook +/* badwolf_new_tab: Inserts struct Client *browser in GtkNotebook *notebook + * and optionally switches selected tab to it. * * returns: * 0 : Ran successfully @@ -847,7 +848,7 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b * -2 : browser is NULL */ int -badwolf_new_tab(GtkNotebook *notebook, struct Client *browser) +badwolf_new_tab(GtkNotebook *notebook, struct Client *browser, bool auto_switch) { gint current_page = gtk_notebook_get_current_page(notebook); gchar *title = _("New tab"); @@ -864,6 +865,11 @@ badwolf_new_tab(GtkNotebook *notebook, struct Client *browser) gtk_widget_queue_draw(GTK_WIDGET(notebook)); + if(auto_switch) + { + gtk_notebook_set_current_page(notebook, gtk_notebook_page_num(notebook, browser->box)); + } + return 0; } @@ -874,7 +880,7 @@ new_tabCb_clicked(GtkButton *new_tab, gpointer user_data) struct Window *window = (struct Window *)user_data; struct Client *browser = new_browser(window, NULL, NULL); - badwolf_new_tab(GTK_NOTEBOOK(window->notebook), browser); + badwolf_new_tab(GTK_NOTEBOOK(window->notebook), browser, TRUE); } static void @@ -982,10 +988,10 @@ main(int argc, char *argv[]) gtk_widget_show_all(window->main_window); if(argc == 1) - badwolf_new_tab(GTK_NOTEBOOK(window->notebook), new_browser(window, NULL, NULL)); + badwolf_new_tab(GTK_NOTEBOOK(window->notebook), new_browser(window, NULL, NULL), FALSE); else for(int i = 1; i < argc; ++i) - badwolf_new_tab(GTK_NOTEBOOK(window->notebook), new_browser(window, argv[i], NULL)); + badwolf_new_tab(GTK_NOTEBOOK(window->notebook), new_browser(window, argv[i], NULL), FALSE); gtk_notebook_set_current_page(GTK_NOTEBOOK(window->notebook), 1); diff --git a/badwolf.h b/badwolf.h index 530f9c8..a375be6 100644 --- a/badwolf.h +++ b/badwolf.h @@ -39,6 +39,6 @@ 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, struct Client *old_browser); -int badwolf_new_tab(GtkNotebook *notebook, struct Client *browser); +int badwolf_new_tab(GtkNotebook *notebook, struct Client *browser, bool auto_switch); gint badwolf_get_tab_position(GtkContainer *notebook, GtkWidget *child); #endif /* BADWOLF_H_INCLUDED */ diff --git a/keybindings.c b/keybindings.c index 75860ed..95e3fd5 100644 --- a/keybindings.c +++ b/keybindings.c @@ -14,7 +14,7 @@ about_dialogCb_activate_link(GtkAboutDialog *about_dialog, gchar *uri, gpointer (void)about_dialog; struct Window *window = (struct Window *)user_data; - badwolf_new_tab(GTK_NOTEBOOK(window->notebook), new_browser(window, uri, NULL)); + badwolf_new_tab(GTK_NOTEBOOK(window->notebook), new_browser(window, uri, NULL), FALSE); gtk_widget_destroy(GTK_WIDGET(about_dialog)); @@ -112,7 +112,9 @@ commonCb_key_press_event(struct Window *window, GdkEvent *event, struct Client * { case GDK_KEY_Page_Down: gtk_notebook_next_page(notebook); return TRUE; case GDK_KEY_Page_Up: gtk_notebook_prev_page(notebook); return TRUE; - case GDK_KEY_t: badwolf_new_tab(notebook, new_browser(window, NULL, NULL)); return TRUE; + case GDK_KEY_t: + badwolf_new_tab(notebook, new_browser(window, NULL, NULL), TRUE); + return TRUE; } } } diff --git a/po/messages.pot b/po/messages.pot index b2ca404..fd9ca35 100644 --- a/po/messages.pot +++ b/po/messages.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Badwolf 1.0.0+g498bce5.develop\n" +"Project-Id-Version: Badwolf 1.0.0+ge94212d.develop\n" "Report-Msgid-Bugs-To: contact+badwolf-msgid@hacktivis.me\n" -"POT-Creation-Date: 2020-07-04 06:53+0200\n" +"POT-Creation-Date: 2020-07-04 07:13+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -41,7 +41,7 @@ msgstr "" msgid "Badwolf Downloads" msgstr "" -#: badwolf.c:913 +#: badwolf.c:919 #, c-format msgid "Buildtime WebKit version: %d.%d.%d\n" msgstr "" @@ -100,11 +100,11 @@ msgid "" "Runtime WebKit version: %d.%d.%d" msgstr "" -#: badwolf.c:853 +#: badwolf.c:854 msgid "New tab" msgstr "" -#: badwolf.c:962 +#: badwolf.c:968 msgid "Open new tab" msgstr "" @@ -112,12 +112,12 @@ msgstr "" msgid "Out of Memory" msgstr "" -#: badwolf.c:911 +#: badwolf.c:917 #, c-format msgid "Running Badwolf version: %s\n" msgstr "" -#: badwolf.c:918 +#: badwolf.c:924 #, c-format msgid "Runtime WebKit version: %d.%d.%d\n" msgstr "" @@ -167,12 +167,12 @@ msgstr "" msgid "the web process terminated for an unknown reason.\n" msgstr "" -#: badwolf.c:925 +#: badwolf.c:931 #, c-format msgid "webkit-web-extension directory set to: %s\n" msgstr "" #. TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. -#: badwolf.c:996 +#: badwolf.c:1002 msgid "ø" msgstr "" -- cgit v1.3.1-23-gd82d From 2893b270d50bf4fa036439695febd51fdc6fcb08 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Tue, 11 Aug 2020 20:40:44 +0200 Subject: badwolf: declare private global as static --- badwolf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index d3dcde9..9d4d3eb 100644 --- a/badwolf.c +++ b/badwolf.c @@ -16,10 +16,11 @@ #include /* malloc() */ #include /* access() */ -gchar *web_extensions_directory; -const gchar *homepage = "https://hacktivis.me/projects/badwolf"; -const gchar *version = VERSION; -int context_id_counter = 0; +const gchar *homepage = "https://hacktivis.me/projects/badwolf"; +const gchar *version = VERSION; + +static gchar *web_extensions_directory; +static int context_id_counter = 0; static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data); static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView, -- cgit v1.3.1-23-gd82d From 7e427d599e74d8b1b89afafdaa7628a3e8483afb Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 22 Aug 2020 08:15:32 +0200 Subject: badwolf.c: unref web_context and settings, let widget_destroy remove the page --- badwolf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 9d4d3eb..36950b7 100644 --- a/badwolf.c +++ b/badwolf.c @@ -74,9 +74,6 @@ WebViewCb_close(WebKitWebView *webView, gpointer user_data) { (void)webView; struct Client *browser = (struct Client *)user_data; - GtkNotebook *notebook = GTK_NOTEBOOK(browser->window->notebook); - - gtk_notebook_remove_page(notebook, gtk_notebook_page_num(GTK_NOTEBOOK(notebook), browser->box)); gtk_widget_destroy(browser->box); @@ -680,6 +677,8 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b settings, NULL)); gtk_widget_set_name(GTK_WIDGET(browser->webView), "browser__webView"); + g_object_unref(web_context); + g_object_unref(settings); gtk_box_pack_start( GTK_BOX(browser->toolbar), GTK_WIDGET(browser->back), FALSE, FALSE, BADWOLF_TOOLBAR_PADDING); -- cgit v1.3.1-23-gd82d From b6e995810f9cba4dac83d57643a5f9698699cbad Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 22 Aug 2020 08:35:48 +0200 Subject: badwolf.c: Only create CSS Providers when needed --- badwolf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 36950b7..d0b337a 100644 --- a/badwolf.c +++ b/badwolf.c @@ -940,10 +940,10 @@ main(int argc, char *argv[]) gtk_window_set_role(GTK_WINDOW(window->main_window), "browser"); gtk_window_set_icon_name(GTK_WINDOW(window->main_window), "badwolf"); - GtkCssProvider *css_provider_app = gtk_css_provider_new(); - gchar *provider_path_app = g_build_filename(DATADIR, "interface.css", NULL); + gchar *provider_path_app = g_build_filename(DATADIR, "interface.css", NULL); if(access(provider_path_app, R_OK) == 0) { + GtkCssProvider *css_provider_app = gtk_css_provider_new(); gtk_css_provider_load_from_path(css_provider_app, provider_path_app, NULL); gtk_style_context_add_provider_for_screen( gtk_widget_get_screen(GTK_WIDGET(window->main_window)), @@ -952,11 +952,11 @@ main(int argc, char *argv[]) } g_free(provider_path_app); - GtkCssProvider *css_provider_user = gtk_css_provider_new(); gchar *provider_path_user = g_build_filename(g_get_user_data_dir(), "badwolf", "interface.css", NULL); if(access(provider_path_user, R_OK) == 0) { + GtkCssProvider *css_provider_user = gtk_css_provider_new(); gtk_css_provider_load_from_path(css_provider_user, provider_path_user, NULL); gtk_style_context_add_provider_for_screen( gtk_widget_get_screen(GTK_WIDGET(window->main_window)), -- cgit v1.3.1-23-gd82d From abb47b4c0faf2eadcdce62c285fea8af7edd8894 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 2 Nov 2019 22:01:00 +0100 Subject: Add completion --- Makefile | 4 ++-- badwolf.1 | 2 ++ badwolf.c | 4 ++++ bookmarks.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ bookmarks.h | 3 +++ 5 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 bookmarks.c create mode 100644 bookmarks.h (limited to 'badwolf.c') diff --git a/Makefile b/Makefile index a136a28..8ba3003 100644 --- a/Makefile +++ b/Makefile @@ -25,8 +25,8 @@ INKSCAPE ?= inkscape ICON_SIZES = icons/hicolor/24x24/apps/badwolf.png icons/hicolor/32x32/apps/badwolf.png icons/hicolor/48x48/apps/badwolf.png icons/hicolor/64x64/apps/badwolf.png icons/hicolor/128x128/apps/badwolf.png icons/hicolor/256x256/apps/badwolf.png DEPS = gtk+-3.0 webkit2gtk-4.0 libsoup-2.4 -SRCS = uri.c uri_test.c keybindings.c downloads.c badwolf.c -OBJS = uri.o keybindings.o downloads.o badwolf.o +SRCS = bookmarks.c uri.c uri_test.c keybindings.c downloads.c badwolf.c +OBJS = bookmarks.o uri.o keybindings.o downloads.o badwolf.o OBJS_test = uri_test.o EXE = badwolf EXE_test = uri_test diff --git a/badwolf.1 b/badwolf.1 index d1bda3e..96a20d3 100644 --- a/badwolf.1 +++ b/badwolf.1 @@ -75,6 +75,8 @@ A more generic variable name is also intended to be used in the future. .El .Sh FILES .Bl -tag -width Ds -compact +.It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/URLs.txt +File containing a URL on each line. [UNSTABLE] .It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/webkit-web-extensions/ Directory containing the .Lk https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebExtension.html WebKitWebExtensions diff --git a/badwolf.c b/badwolf.c index d0b337a..bf4916b 100644 --- a/badwolf.c +++ b/badwolf.c @@ -6,6 +6,7 @@ #include "config.h" #include "downloads.h" +#include "bookmarks.h" #include "keybindings.h" #include "uri.h" @@ -738,6 +739,7 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b gtk_entry_set_text(GTK_ENTRY(browser->location), target_url); gtk_entry_set_input_purpose(GTK_ENTRY(browser->location), GTK_INPUT_PURPOSE_URL); + gtk_entry_set_completion(GTK_ENTRY(browser->location), location_completion); gtk_entry_set_placeholder_text(GTK_ENTRY(browser->search), _("search in current page")); @@ -930,6 +932,8 @@ main(int argc, char *argv[]) g_build_filename(g_get_user_data_dir(), "badwolf", "webkit-web-extension", NULL); fprintf(stderr, _("webkit-web-extension directory set to: %s\n"), web_extensions_directory); + location_completion_init(); + window->main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); window->notebook = gtk_notebook_new(); window->new_tab = gtk_button_new_from_icon_name("tab-new-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR); diff --git a/bookmarks.c b/bookmarks.c new file mode 100644 index 0000000..f43ed46 --- /dev/null +++ b/bookmarks.c @@ -0,0 +1,45 @@ +#include "badwolf.h" +#include "bookmarks.h" + +#include +#include /* g_fprintf() */ + +void +location_completion_init() +{ + GtkTreeIter iter; + GtkListStore *list_store; + GIOChannel *file_channel; + GError *file_err = NULL; + gchar *file_line; + + location_completion = gtk_entry_completion_new(); + + list_store = gtk_list_store_new(1, G_TYPE_STRING); + + gchar *filename = g_build_filename(g_get_user_data_dir(), "badwolf", "URLs.txt", NULL); + g_fprintf(stderr, "URL Completion: loading at %s\n", filename); + file_channel = g_io_channel_new_file(filename, "r", &file_err); + + if(file_channel != NULL) + { + while(G_IO_STATUS_NORMAL == + g_io_channel_read_line(file_channel, &file_line, NULL, NULL, &file_err)) + { + gtk_list_store_append(list_store, &iter); + gtk_list_store_set(list_store, &iter, 0, g_strchomp(file_line), -1); + } + g_free(file_line); + g_io_channel_unref(file_channel); + //g_io_channel_shutdown(file_channel, FALSE, &file_err); + g_fprintf(stderr, "URL Completion: Done.\n"); + } + else + g_fprintf(stderr, "URL Completion: Failed to load file.\n"); + + gtk_list_store_append(list_store, &iter); + gtk_list_store_set(list_store, &iter, 0, homepage, -1); + + gtk_entry_completion_set_model(location_completion, GTK_TREE_MODEL(list_store)); + gtk_entry_completion_set_text_column(location_completion, 0); +} diff --git a/bookmarks.h b/bookmarks.h new file mode 100644 index 0000000..2e44eb3 --- /dev/null +++ b/bookmarks.h @@ -0,0 +1,3 @@ +#include +GtkEntryCompletion *location_completion; +void location_completion_init(); -- cgit v1.3.1-23-gd82d From a7ba36264f3a62013d393075bd992ac252d3e51a Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sun, 3 Nov 2019 21:34:46 +0100 Subject: Add support for XBEL Bookmarks --- KnowledgeBase.md | 17 ++++++++++ Makefile | 2 +- README.md | 1 + badwolf.1 | 10 ++++-- badwolf.c | 1 + bookmarks.c | 99 ++++++++++++++++++++++++++++++++++++++++---------------- 6 files changed, 100 insertions(+), 30 deletions(-) (limited to 'badwolf.c') diff --git a/KnowledgeBase.md b/KnowledgeBase.md index f5f9f9a..af59415 100644 --- a/KnowledgeBase.md +++ b/KnowledgeBase.md @@ -2,3 +2,20 @@ - WebKit2 Extensions Tutorial: https://blogs.igalia.com/carlosgc/2013/09/10/webkit2gtk-web-process-extensions/ - https://trac.torproject.org/projects/tor/wiki/doc/ImportantGoogleChromeBugs / https://trac.torproject.org/projects/tor/ticket/1925 - https://webkit.org/blog/3476/content-blockers-first-look/ + +# Bookmark formats +The different plain-text formats used by web browsers found in the wild, done +in Augmented Backus–Naur Form (ABNF). + +url = *CHAR +title = *CHAR + +## uzbl +bookmark = URL TAB title [TAB tags] +tags = *(*CHAR SP) + +Documenter comment: How does it manages when the separator (TAB here) is +present in the title? + +## qutebrowser +bookmark = URL SP title diff --git a/Makefile b/Makefile index 8ba3003..8ba9b7e 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ INKSCAPE ?= inkscape # for i in 24 32 48 64 128 256; do echo icons/hicolor/${i}x${i}/apps/badwolf.png; done | tr '\n' ' ' ICON_SIZES = icons/hicolor/24x24/apps/badwolf.png icons/hicolor/32x32/apps/badwolf.png icons/hicolor/48x48/apps/badwolf.png icons/hicolor/64x64/apps/badwolf.png icons/hicolor/128x128/apps/badwolf.png icons/hicolor/256x256/apps/badwolf.png -DEPS = gtk+-3.0 webkit2gtk-4.0 libsoup-2.4 +DEPS = gtk+-3.0 webkit2gtk-4.0 libsoup-2.4 libxml-2.0 SRCS = bookmarks.c uri.c uri_test.c keybindings.c downloads.c badwolf.c OBJS = bookmarks.o uri.o keybindings.o downloads.o badwolf.o OBJS_test = uri_test.o diff --git a/README.md b/README.md index 6804aea..b83d134 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ Dependencies are: - C11 Compiler (such as clang or gcc) - [WebKitGTK](https://webkitgtk.org/), only the latest stable is supported +- [libxml-2.0](http://www.xmlsoft.org/), no known version limitation - POSIX make with extension for shell in variables (works with GNU, {Net,Free,Open}BSD) - A pkg-config implementation (pkgconf is recommended) - (optionnal) gettext implementation (such as GNU Gettext) diff --git a/badwolf.1 b/badwolf.1 index 96a20d3..6bbe2b2 100644 --- a/badwolf.1 +++ b/badwolf.1 @@ -75,8 +75,14 @@ A more generic variable name is also intended to be used in the future. .El .Sh FILES .Bl -tag -width Ds -compact -.It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/URLs.txt -File containing a URL on each line. [UNSTABLE] +.It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/bookmarks.xbel +XBEL (XML Bookmark Exchange Language) file, known to be currently supported by: +.Xr elinks 1 , +.Xr konqueror 1 , +.Xr kbookmarkeditor 1 . Doing a symbolic link from their path works fine. +.Pp +For more information about this format see: +.Lk http://pyxml.sourceforge.net/topics/xbel/ .It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/webkit-web-extensions/ Directory containing the .Lk https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebExtension.html WebKitWebExtensions diff --git a/badwolf.c b/badwolf.c index bf4916b..f284378 100644 --- a/badwolf.c +++ b/badwolf.c @@ -7,6 +7,7 @@ #include "config.h" #include "downloads.h" #include "bookmarks.h" +#include "config.h" #include "keybindings.h" #include "uri.h" diff --git a/bookmarks.c b/bookmarks.c index f43ed46..23cb558 100644 --- a/bookmarks.c +++ b/bookmarks.c @@ -1,45 +1,90 @@ -#include "badwolf.h" #include "bookmarks.h" -#include +#include "badwolf.h" + #include /* g_fprintf() */ +#include +#include void -location_completion_init() +location_completion_setup(GtkListStore *list_store) { - GtkTreeIter iter; - GtkListStore *list_store; - GIOChannel *file_channel; - GError *file_err = NULL; - gchar *file_line; + gtk_entry_completion_set_model(location_completion, GTK_TREE_MODEL(list_store)); + gtk_entry_completion_set_text_column(location_completion, 0); +} - location_completion = gtk_entry_completion_new(); +void +location_completion_cleanup(xmlXPathObjectPtr xpathObj, xmlXPathContextPtr xpathCtx, xmlDocPtr doc) +{ + if(xpathObj != NULL) xmlXPathFreeObject(xpathObj); + if(xpathCtx != NULL) xmlXPathFreeContext(xpathCtx); + if(doc != NULL) xmlFreeDoc(doc); +} - list_store = gtk_list_store_new(1, G_TYPE_STRING); +GtkTreeIter +load_xpath_results(GtkListStore *list_store, xmlNodeSetPtr nodes) +{ + GtkTreeIter iter; + int size; - gchar *filename = g_build_filename(g_get_user_data_dir(), "badwolf", "URLs.txt", NULL); - g_fprintf(stderr, "URL Completion: loading at %s\n", filename); - file_channel = g_io_channel_new_file(filename, "r", &file_err); + size = (nodes) ? nodes->nodeNr : 0; - if(file_channel != NULL) - { - while(G_IO_STATUS_NORMAL == - g_io_channel_read_line(file_channel, &file_line, NULL, NULL, &file_err)) + g_fprintf(stderr, "Bookmarks: Found %d bookmarks.\n", size); + for(int i = 0; i < size; i++) + if(nodes->nodeTab[i]) { gtk_list_store_append(list_store, &iter); - gtk_list_store_set(list_store, &iter, 0, g_strchomp(file_line), -1); + gtk_list_store_set( + list_store, &iter, 0, (char *)xmlXPathCastNodeToString(nodes->nodeTab[i]), -1); } - g_free(file_line); - g_io_channel_unref(file_channel); - //g_io_channel_shutdown(file_channel, FALSE, &file_err); - g_fprintf(stderr, "URL Completion: Done.\n"); - } - else - g_fprintf(stderr, "URL Completion: Failed to load file.\n"); + return iter; +} + +void +location_completion_init() +{ + const xmlChar *xpathExpr = "//bookmark/@href"; + char *filename = g_build_filename(g_get_user_data_dir(), "badwolf", "bookmarks.xbel", NULL); + xmlDocPtr doc = NULL; + xmlXPathContextPtr xpathCtx = NULL; + xmlXPathObjectPtr xpathObj = NULL; + GtkTreeIter iter; + GtkListStore *list_store = gtk_list_store_new(1, G_TYPE_STRING); + + location_completion = gtk_entry_completion_new(); gtk_list_store_append(list_store, &iter); gtk_list_store_set(list_store, &iter, 0, homepage, -1); - gtk_entry_completion_set_model(location_completion, GTK_TREE_MODEL(list_store)); - gtk_entry_completion_set_text_column(location_completion, 0); + g_fprintf(stderr, "Bookmarks: loading at %s\n", filename); + doc = xmlParseFile(filename); + if(doc == NULL) + { + g_fprintf(stderr, "Bookmarks: unable to parse file \"%s\"\n", filename); + location_completion_cleanup(xpathObj, xpathCtx, doc); + return; + } + + xpathCtx = xmlXPathNewContext(doc); + if(xpathCtx == NULL) + { + g_fprintf(stderr, "Bookmarks: unable to create new XPath context\n"); + location_completion_cleanup(xpathObj, xpathCtx, doc); + return; + } + + xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx); + if(xpathObj == NULL) + { + g_fprintf(stderr, "Bookmarks: unable to evaluate xpath expression \"%s\"\n", xpathExpr); + location_completion_cleanup(xpathObj, xpathCtx, doc); + return; + } + + iter = load_xpath_results(list_store, xpathObj->nodesetval); + + location_completion_cleanup(xpathObj, xpathCtx, doc); + location_completion_setup(list_store); + + g_fprintf(stderr, "Bookmarks: Done.\n"); } -- cgit v1.3.1-23-gd82d From 720eb415a73893bf4c3894c10e27c66996f7e67e Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 16 Dec 2019 14:35:37 +0100 Subject: Fix setting up completion --- badwolf.c | 16 ++++++++++++++-- bookmarks.c | 24 ++++++++++++------------ bookmarks.h | 4 ++-- 3 files changed, 28 insertions(+), 16 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index f284378..ca1f5d7 100644 --- a/badwolf.c +++ b/badwolf.c @@ -23,6 +23,7 @@ const gchar *version = VERSION; static gchar *web_extensions_directory; static int context_id_counter = 0; +GtkTreeModel *bookmarks_completion_model; static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data); static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView, @@ -738,9 +739,17 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b gtk_label_set_single_line_mode(GTK_LABEL(browser->statuslabel), TRUE); gtk_label_set_ellipsize(GTK_LABEL(browser->statuslabel), BADWOLF_STATUSLABEL_ELLIPSIZE); + if(bookmarks_completion_model != NULL) + { + GtkEntryCompletion *location_completion = gtk_entry_completion_new(); + GtkTreeModel *location_completion_model = bookmarks_completion_model; + + bookmarks_completion_setup(location_completion, location_completion_model); + gtk_entry_set_completion(GTK_ENTRY(browser->location), location_completion); + } + gtk_entry_set_text(GTK_ENTRY(browser->location), target_url); gtk_entry_set_input_purpose(GTK_ENTRY(browser->location), GTK_INPUT_PURPOSE_URL); - gtk_entry_set_completion(GTK_ENTRY(browser->location), location_completion); gtk_entry_set_placeholder_text(GTK_ENTRY(browser->search), _("search in current page")); @@ -933,7 +942,8 @@ main(int argc, char *argv[]) g_build_filename(g_get_user_data_dir(), "badwolf", "webkit-web-extension", NULL); fprintf(stderr, _("webkit-web-extension directory set to: %s\n"), web_extensions_directory); - location_completion_init(); + bookmarks_completion_model = bookmarks_completion_init(); + g_object_ref(bookmarks_completion_model); window->main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); window->notebook = gtk_notebook_new(); @@ -1002,6 +1012,8 @@ main(int argc, char *argv[]) gtk_main(); + g_object_unref(bookmarks_completion_model); + #if 0 /* TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. */ _("ø"); diff --git a/bookmarks.c b/bookmarks.c index 8a69814..59faf95 100644 --- a/bookmarks.c +++ b/bookmarks.c @@ -7,7 +7,7 @@ #include #include -gboolean +static gboolean location_completion_matches(GtkEntryCompletion *completion, const gchar *key, GtkTreeIter *iter, @@ -29,15 +29,15 @@ location_completion_matches(GtkEntryCompletion *completion, } void -location_completion_setup(GtkListStore *list_store) +bookmarks_completion_setup(GtkEntryCompletion *location_completion, GtkTreeModel *tree_model) { - gtk_entry_completion_set_model(location_completion, GTK_TREE_MODEL(list_store)); + gtk_entry_completion_set_model(location_completion, tree_model); gtk_entry_completion_set_text_column(location_completion, 0); gtk_entry_completion_set_match_func(location_completion, location_completion_matches, NULL, NULL); gtk_entry_completion_set_inline_selection(location_completion, BADWOLF_LOCATION_INLINE_SELECTION); } -void +static void location_completion_cleanup(xmlXPathObjectPtr xpathObj, xmlXPathContextPtr xpathCtx, xmlDocPtr doc) { if(xpathObj != NULL) xmlXPathFreeObject(xpathObj); @@ -45,7 +45,7 @@ location_completion_cleanup(xmlXPathObjectPtr xpathObj, xmlXPathContextPtr xpath if(doc != NULL) xmlFreeDoc(doc); } -GtkTreeIter +static GtkTreeIter load_xpath_results(GtkListStore *list_store, xmlNodeSetPtr nodes) { GtkTreeIter iter; @@ -65,8 +65,8 @@ load_xpath_results(GtkListStore *list_store, xmlNodeSetPtr nodes) return iter; } -void -location_completion_init() +GtkTreeModel * +bookmarks_completion_init() { const xmlChar *xpathExpr = "//bookmark/@href"; char *filename = g_build_filename(g_get_user_data_dir(), "badwolf", "bookmarks.xbel", NULL); @@ -76,7 +76,6 @@ location_completion_init() GtkTreeIter iter; GtkListStore *list_store = gtk_list_store_new(1, G_TYPE_STRING); - location_completion = gtk_entry_completion_new(); gtk_list_store_append(list_store, &iter); gtk_list_store_set(list_store, &iter, 0, homepage, -1); @@ -86,7 +85,7 @@ location_completion_init() { g_fprintf(stderr, "Bookmarks: unable to parse file \"%s\"\n", filename); location_completion_cleanup(xpathObj, xpathCtx, doc); - return; + return NULL; } xpathCtx = xmlXPathNewContext(doc); @@ -94,7 +93,7 @@ location_completion_init() { g_fprintf(stderr, "Bookmarks: unable to create new XPath context\n"); location_completion_cleanup(xpathObj, xpathCtx, doc); - return; + return NULL; } xpathObj = xmlXPathEvalExpression(xpathExpr, xpathCtx); @@ -102,13 +101,14 @@ location_completion_init() { g_fprintf(stderr, "Bookmarks: unable to evaluate xpath expression \"%s\"\n", xpathExpr); location_completion_cleanup(xpathObj, xpathCtx, doc); - return; + return NULL; } iter = load_xpath_results(list_store, xpathObj->nodesetval); location_completion_cleanup(xpathObj, xpathCtx, doc); - location_completion_setup(list_store); g_fprintf(stderr, "Bookmarks: Done.\n"); + + return GTK_TREE_MODEL(list_store); } diff --git a/bookmarks.h b/bookmarks.h index 2e44eb3..29bd553 100644 --- a/bookmarks.h +++ b/bookmarks.h @@ -1,3 +1,3 @@ #include -GtkEntryCompletion *location_completion; -void location_completion_init(); +GtkTreeModel *bookmarks_completion_init(); +void bookmarks_completion_setup(GtkEntryCompletion *location_completion, GtkTreeModel *tree_model); -- cgit v1.3.1-23-gd82d From 140404d3c9ba28d75c5bccd31b405af614afe352 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sun, 11 Oct 2020 08:26:55 +0200 Subject: badwolf: Remove GTK_THEME hack WebKitGTK 2.30.0 removed usage of the system's GTK Theme for the WebView --- badwolf.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index ca1f5d7..ba26f88 100644 --- a/badwolf.c +++ b/badwolf.c @@ -644,8 +644,6 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b browser->statuslabel = gtk_label_new(NULL); gtk_widget_set_name(browser->statuslabel, "browser__statuslabel"); - setenv("GTK_THEME", ":light", 0); - WebKitWebContext *web_context = webkit_web_context_new_ephemeral(); webkit_web_context_set_sandbox_enabled(web_context, TRUE); webkit_web_context_set_process_model(web_context, -- cgit v1.3.1-23-gd82d From a702a8c2a7c173174804165e05f314549753e289 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sun, 11 Oct 2020 09:17:54 +0200 Subject: Enable Intelligent Tracking Protection (ITP) Note: Permission requests are still stuck to deny by default, so third-party domains are always denied access --- badwolf.c | 10 ++++++---- bookmarks.c | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index ba26f88..065aeb8 100644 --- a/badwolf.c +++ b/badwolf.c @@ -4,10 +4,9 @@ #include "badwolf.h" -#include "config.h" -#include "downloads.h" #include "bookmarks.h" #include "config.h" +#include "downloads.h" #include "keybindings.h" #include "uri.h" @@ -644,11 +643,14 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b browser->statuslabel = gtk_label_new(NULL); gtk_widget_set_name(browser->statuslabel, "browser__statuslabel"); - WebKitWebContext *web_context = webkit_web_context_new_ephemeral(); + WebKitWebsiteDataManager *website_data_manager = webkit_website_data_manager_new_ephemeral(); + webkit_website_data_manager_set_itp_enabled(website_data_manager, TRUE); + + WebKitWebContext *web_context = + webkit_web_context_new_with_website_data_manager(website_data_manager); webkit_web_context_set_sandbox_enabled(web_context, TRUE); webkit_web_context_set_process_model(web_context, WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES); - webkit_web_context_set_web_extensions_directory(web_context, web_extensions_directory); badwolf_l10n = getenv("BADWOLF_L10N"); diff --git a/bookmarks.c b/bookmarks.c index dcf579d..c6e2ece 100644 --- a/bookmarks.c +++ b/bookmarks.c @@ -6,7 +6,7 @@ #include /* g_fprintf() */ #include #include -#include /* access() */ +#include /* access() */ static gboolean location_completion_matches(GtkEntryCompletion *completion, @@ -77,7 +77,8 @@ bookmarks_completion_init() GtkTreeIter iter; GtkListStore *list_store = gtk_list_store_new(1, G_TYPE_STRING); - if(access(filename, R_OK) != 0) { + if(access(filename, R_OK) != 0) + { g_fprintf(stderr, "Bookmarks: No loadable file found at %s\n", filename); return NULL; } -- cgit v1.3.1-23-gd82d From e5b4b5db6fcf7db93491d9a30ba6fb16b4146bb4 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 23 Oct 2020 02:25:07 +0200 Subject: badwolf: Fix setting "browser__tabbox__context_label" --- badwolf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 065aeb8..665f144 100644 --- a/badwolf.c +++ b/badwolf.c @@ -146,7 +146,7 @@ badwolf_new_tab_box(const gchar *title, struct Client *browser) GtkWidget *label = gtk_label_new(title); gtk_widget_set_name(label, "browser__tabbox__label"); GtkWidget *context_label = gtk_label_new(context_id_str); - gtk_widget_set_name(label, "browser__tabbox__context_label"); + gtk_widget_set_name(context_label, "browser__tabbox__context_label"); GtkWidget *playing = gtk_image_new_from_icon_name("audio-volume-high-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR); gtk_widget_set_name(playing, "browser__tabbox__playing"); -- cgit v1.3.1-23-gd82d From c2b4c8fb07b50c064d8ffe5ce02e84e21b6cffaa Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 26 Oct 2020 07:28:06 +0100 Subject: Use [A..Z] instead of [0..F] for representing the context_id --- badwolf.c | 29 ++++++++++++++++++++++++++--- badwolf.h | 2 +- interface.txt | 2 +- 3 files changed, 28 insertions(+), 5 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 665f144..0d391e1 100644 --- a/badwolf.c +++ b/badwolf.c @@ -21,7 +21,7 @@ const gchar *homepage = "https://hacktivis.me/projects/badwolf"; const gchar *version = VERSION; static gchar *web_extensions_directory; -static int context_id_counter = 0; +static uint64_t context_id_counter = 0; GtkTreeModel *bookmarks_completion_model; static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data); @@ -130,13 +130,36 @@ WebViewCb_notify__uri(WebKitWebView *webView, GParamSpec *pspec, gpointer user_d return TRUE; } +static char * +fmt_context_id(uint64_t num, char *out) +{ + const char alpha_digits[27] = {" ABCDEFGHIJKLMNOPQRSTUVWXYZ"}; + char buf[66] = {'\0'}; + int i, len = 0; + + // Get 0 = 'A' instead of 0 = '' and 1 = 'A' + num++; + + buf[len++] = ' '; + buf[len++] = ':'; + do + { + buf[len++] = alpha_digits[num % 26]; + } while(num /= 26); + + for(i = 0; len > 0; i++) + out[i] = buf[--len]; + + return out; +} + GtkWidget * badwolf_new_tab_box(const gchar *title, struct Client *browser) { (void)browser; - char context_id_str[7]; + char context_id_str[7] = ""; - snprintf(context_id_str, 7, "%4X: ", browser->context_id); + fmt_context_id(browser->context_id, context_id_str); GtkWidget *tab_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_name(tab_box, "browser__tabbox"); diff --git a/badwolf.h b/badwolf.h index a375be6..8a4edec 100644 --- a/badwolf.h +++ b/badwolf.h @@ -26,7 +26,7 @@ struct Client GtkWidget *auto_load_images; GtkWidget *location; - int context_id; + uint64_t context_id; WebKitWebView *webView; struct Window *window; diff --git a/interface.txt b/interface.txt index f23a149..42f7f5c 100644 --- a/interface.txt +++ b/interface.txt @@ -3,7 +3,7 @@ - Each tab contains a Browser View or the Downloads View ## Tab Labels -- An hexadecimal number identifying the webkit process context +- An A-Z represented number identifying the webkit process context - An icon to indicate if a media is playing - The title of the web view - A close button -- cgit v1.3.1-23-gd82d From 983c730b810db766662416282e7413311e5a33b7 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 31 Oct 2020 09:45:50 +0100 Subject: tab label: playing icon between the context_id and title --- badwolf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 0d391e1..7394c00 100644 --- a/badwolf.c +++ b/badwolf.c @@ -186,8 +186,8 @@ badwolf_new_tab_box(const gchar *title, struct Client *browser) gtk_label_set_single_line_mode(GTK_LABEL(label), TRUE); gtk_label_set_single_line_mode(GTK_LABEL(context_label), TRUE); - gtk_box_pack_start(GTK_BOX(tab_box), playing, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(tab_box), context_label, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(tab_box), playing, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(tab_box), label, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tab_box), close, FALSE, FALSE, 0); -- cgit v1.3.1-23-gd82d From fadd68541d5b6a2a251abd2e31e9c6197cd5d770 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Wed, 9 Dec 2020 12:17:54 +0100 Subject: badwolf.c: Fix `struct Download` allocation Found by Clang Static Analyzer (scan-build) --- badwolf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 7394c00..977f214 100644 --- a/badwolf.c +++ b/badwolf.c @@ -463,7 +463,7 @@ web_contextCb_download_started(WebKitWebContext *web_context, { (void)web_context; struct Client *browser = (struct Client *)user_data; - struct Download *download = malloc(sizeof(struct Client)); + struct Download *download = malloc(sizeof(struct Download)); if(download != NULL) { -- cgit v1.3.1-23-gd82d From 51119dfa4421858111ff85292c29f994b803bc9e Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Wed, 7 Apr 2021 04:25:08 +0200 Subject: badwolf: unref website_data_manager once hooked --- badwolf.c | 1 + 1 file changed, 1 insertion(+) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 977f214..1476868 100644 --- a/badwolf.c +++ b/badwolf.c @@ -671,6 +671,7 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b WebKitWebContext *web_context = webkit_web_context_new_with_website_data_manager(website_data_manager); + g_object_unref(website_data_manager); webkit_web_context_set_sandbox_enabled(web_context, TRUE); webkit_web_context_set_process_model(web_context, WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES); -- cgit v1.3.1-23-gd82d From 5e1c0583650a45ce07b1efb73502cdaef62030ec Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Wed, 7 Apr 2021 04:26:04 +0200 Subject: print: Fix wrong pointer to main_window --- badwolf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 1476868..eeaedb2 100644 --- a/badwolf.c +++ b/badwolf.c @@ -555,7 +555,7 @@ printCb_clicked(GtkButton *print, gpointer user_data) WebKitPrintOperation *print_operation = webkit_print_operation_new(browser->webView); - webkit_print_operation_run_dialog(print_operation, GTK_WINDOW(browser->window)); + webkit_print_operation_run_dialog(print_operation, GTK_WINDOW(browser->window->main_window)); } static gboolean -- cgit v1.3.1-23-gd82d From 4df40cf5a802aca6f986c3669212b3c6b072ba5b Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Wed, 7 Apr 2021 16:48:28 +0200 Subject: badwolf: Inherit the WebContext when old_browser is present --- badwolf.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index eeaedb2..9e8bbc6 100644 --- a/badwolf.c +++ b/badwolf.c @@ -623,6 +623,8 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b target_url = badwolf_ensure_uri_scheme(target_url, (old_browser == NULL)); char *badwolf_l10n = NULL; + WebKitWebContext *web_context; + if(browser == NULL) return NULL; browser->window = window; @@ -666,16 +668,19 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b browser->statuslabel = gtk_label_new(NULL); gtk_widget_set_name(browser->statuslabel, "browser__statuslabel"); - WebKitWebsiteDataManager *website_data_manager = webkit_website_data_manager_new_ephemeral(); - webkit_website_data_manager_set_itp_enabled(website_data_manager, TRUE); - - WebKitWebContext *web_context = - webkit_web_context_new_with_website_data_manager(website_data_manager); - g_object_unref(website_data_manager); - webkit_web_context_set_sandbox_enabled(web_context, TRUE); - webkit_web_context_set_process_model(web_context, - WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES); - webkit_web_context_set_web_extensions_directory(web_context, web_extensions_directory); + if(old_browser == NULL) { + WebKitWebsiteDataManager *website_data_manager = webkit_website_data_manager_new_ephemeral(); + webkit_website_data_manager_set_itp_enabled(website_data_manager, TRUE); + + web_context = webkit_web_context_new_with_website_data_manager(website_data_manager); + g_object_unref(website_data_manager); + webkit_web_context_set_sandbox_enabled(web_context, TRUE); + webkit_web_context_set_process_model(web_context, + WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES); + webkit_web_context_set_web_extensions_directory(web_context, web_extensions_directory); + } else { + web_context = webkit_web_view_get_context(old_browser->webView); + } badwolf_l10n = getenv("BADWOLF_L10N"); @@ -704,7 +709,9 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b settings, NULL)); gtk_widget_set_name(GTK_WIDGET(browser->webView), "browser__webView"); - g_object_unref(web_context); + if(old_browser == NULL) { + g_object_unref(web_context); + } g_object_unref(settings); gtk_box_pack_start( -- cgit v1.3.1-23-gd82d From 01237f5229147431a26c86675657e2fe588928fb Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 9 Apr 2021 04:13:41 +0200 Subject: Fix formatting --- badwolf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 9e8bbc6..23c444c 100644 --- a/badwolf.c +++ b/badwolf.c @@ -668,7 +668,8 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b browser->statuslabel = gtk_label_new(NULL); gtk_widget_set_name(browser->statuslabel, "browser__statuslabel"); - if(old_browser == NULL) { + if(old_browser == NULL) + { WebKitWebsiteDataManager *website_data_manager = webkit_website_data_manager_new_ephemeral(); webkit_website_data_manager_set_itp_enabled(website_data_manager, TRUE); @@ -678,7 +679,9 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b webkit_web_context_set_process_model(web_context, WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES); webkit_web_context_set_web_extensions_directory(web_context, web_extensions_directory); - } else { + } + else + { web_context = webkit_web_view_get_context(old_browser->webView); } @@ -709,7 +712,8 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b settings, NULL)); gtk_widget_set_name(GTK_WIDGET(browser->webView), "browser__webView"); - if(old_browser == NULL) { + if(old_browser == NULL) + { g_object_unref(web_context); } g_object_unref(settings); -- cgit v1.3.1-23-gd82d From 5547d3a708e75a62553b19c81e1afc66ef668a5c Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 15 Mar 2019 10:26:31 +0100 Subject: Handle WebKit content-filter --- badwolf.1 | 19 +++++++++---- badwolf.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- badwolf.h | 2 ++ po/messages.pot | 87 +++++++++++++++++++++++++++++++++++++-------------------- 4 files changed, 156 insertions(+), 39 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.1 b/badwolf.1 index 68a39ed..ae2dfa1 100644 --- a/badwolf.1 +++ b/badwolf.1 @@ -1,6 +1,6 @@ -./" BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser -./" Copyright © 2019-2020 Badwolf Authors -./" SPDX-License-Identifier: BSD-3-Clause +.\" BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser +.\" Copyright © 2019-2021 Badwolf Authors +.\" SPDX-License-Identifier: BSD-3-Clause .Dd 2019-10-31 .Dt BADWOLF 1 .Sh NAME @@ -75,6 +75,16 @@ A more generic variable name is also intended to be used in the future. .El .Sh FILES .Bl -tag -width Ds -compact +.It Pa ${XDG_CONFIG_HOME:-$HOME/.config}/badwolf/content-filters.json +WebKit-specific content-filter file, this allows to block unwanted content (ads, nagware, ...). +For some introductory information about the format see: +.Lk https://webkit.org/blog/3476/content-blockers-first-look/ +.Pp +For a converter using AblockPlus-style filters, try: +.Lk https://gitlab.com/eyeo/adblockplus/abp2blocklist +.Pp +For a ready-to-use file (that you should update periodically), try: +.Lk https://easylist-downloads.adblockplus.org/easylist_min_content_blocker.json .It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/bookmarks.xbel XBEL (XML Bookmark Exchange Language) file, known to be currently supported by: .Xr elinks 1 , @@ -90,10 +100,7 @@ to be loaded into .Nm . Note: They aren't the JavaScript-based Web-Extensions supported by Firefox or Chrome, but native code in shared objects using the WebKitGTK API. .Pp Examples of useful extensions may be found at: -.Bl -item -compact .Lk https://hacktivis.me/git/badwolf-extensions -.Lk https://github.com/jun7/wyebadblock -.El .It Pa ${DATADIR:-/usr/local/share}/badwolf/interface.css .It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/interface.css CSS files (respectively system and user-level) for styling badwolf interface. diff --git a/badwolf.c b/badwolf.c index 23c444c..ec2a691 100644 --- a/badwolf.c +++ b/badwolf.c @@ -70,6 +70,7 @@ static void new_tabCb_clicked(GtkButton *new_tab, gpointer user_data); static void closeCb_clicked(GtkButton *close, gpointer user_data); static void notebookCb_switch__page(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer user_data); +void content_managerCb_ready(GObject *store, GAsyncResult *result, gpointer user_data); static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data) @@ -710,6 +711,8 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b old_browser == NULL ? NULL : old_browser->webView, "settings", settings, + "user-content-manager", + window->content_manager, NULL)); gtk_widget_set_name(GTK_WIDGET(browser->webView), "browser__webView"); if(old_browser == NULL) @@ -950,10 +953,73 @@ notebookCb_switch__page(GtkNotebook *notebook, GtkWidget *page, guint page_num, gtk_window_set_title(GTK_WINDOW(window->main_window), gtk_widget_get_tooltip_text(label)); } +void +content_managerCb_ready(GObject *store, GAsyncResult *result, gpointer user_data) +{ + struct Window *window = (struct Window *)user_data; + GError *err = NULL; + + WebKitUserContentFilter *filter = + webkit_user_content_filter_store_load_finish(window->content_store, result, &err); + + if(filter == NULL) + { + if(err == NULL) + { + fprintf(stderr, _("badwolf: failed to load content-filter, err: [%d] %s\n"), -1, "unknown"); + } + else + { + fprintf(stderr, + _("badwolf: failed to load content-filter, err: [%d] %s\n"), + err->code, + err->message); + } + } + else + { + fprintf(stderr, _("badwolf: content-filter loaded, adding to content-manager…\n")); + webkit_user_content_manager_add_filter(window->content_manager, filter); + } +} + +static void +storeCb_finish(WebKitUserContentFilterStore *store, GAsyncResult *result, gpointer user_data) +{ + struct Window *window = (struct Window *)user_data; + GError *err = NULL; + + WebKitUserContentFilter *filter = + webkit_user_content_filter_store_save_finish(window->content_store, result, &err); + + if(filter == NULL) + { + if(err == NULL) + { + fprintf(stderr, + _("badwolf: failed to compile content-filters.json, err: [%d] %s\n"), + -1, + "unknown"); + } + else + { + fprintf(stderr, + _("badwolf: failed to compile content-filters.json, err: [%d] %s\n"), + err->code, + err->message); + } + } + else + { + webkit_user_content_filter_store_load( + window->content_store, "a", NULL, content_managerCb_ready, window); + } +} + int main(int argc, char *argv[]) { - struct Window *window = &(struct Window){NULL, NULL, NULL, NULL}; + struct Window *window = &(struct Window){NULL, NULL, NULL, NULL, NULL, NULL}; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, DATADIR "/locale"); bind_textdomain_codeset(PACKAGE, "UTF-8"); @@ -983,7 +1049,24 @@ main(int argc, char *argv[]) window->main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL); window->notebook = gtk_notebook_new(); window->new_tab = gtk_button_new_from_icon_name("tab-new-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR); - window->downloads_tab = badwolf_downloads_tab_new(); + window->downloads_tab = badwolf_downloads_tab_new(); + window->content_manager = webkit_user_content_manager_new(); + + gchar *contentFilterPath = + g_build_filename(g_get_user_config_dir(), g_get_prgname(), "content-filters.json", NULL); + GFile *contentFilterFile = g_file_new_for_path(contentFilterPath); + fprintf(stderr, _("content-filters file set to: %s\n"), contentFilterPath); + + gchar *filtersPath = g_build_filename(g_get_user_cache_dir(), g_get_prgname(), "filters", NULL); + fprintf(stderr, _("content-filters directory set to: %s\n"), filtersPath); + window->content_store = webkit_user_content_filter_store_new(filtersPath); + + webkit_user_content_filter_store_save_from_file(window->content_store, + "a", + contentFilterFile, + NULL, + (GAsyncReadyCallback)storeCb_finish, + window); gtk_window_set_default_size( GTK_WINDOW(window->main_window), BADWOLF_DEFAULT_WIDTH, BADWOLF_DEFAULT_HEIGHT); diff --git a/badwolf.h b/badwolf.h index e5b33f0..7919be8 100644 --- a/badwolf.h +++ b/badwolf.h @@ -14,6 +14,8 @@ struct Window GtkWidget *notebook; GtkWidget *new_tab; GtkWidget *downloads_tab; + WebKitUserContentManager *content_manager; + WebKitUserContentFilterStore *content_store; }; struct Client diff --git a/po/messages.pot b/po/messages.pot index c5a821c..093ddf2 100644 --- a/po/messages.pot +++ b/po/messages.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Badwolf 1.0.3+g1b10b339.develop\n" +"Project-Id-Version: Badwolf 1.0.3+gdf1e25f.content-blockers\n" "Report-Msgid-Bugs-To: contact+badwolf-msgid@hacktivis.me\n" -"POT-Creation-Date: 2021-03-30 14:25+0200\n" +"POT-Creation-Date: 2021-04-09 06:17+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -74,23 +74,23 @@ msgstr "" msgid "Bookmarks: unable to parse file \"%s\"\n" msgstr "" -#: badwolf.c:954 +#: badwolf.c:1030 #, c-format msgid "Buildtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:439 +#: badwolf.c:440 msgid "Continue" msgstr "" -#: badwolf.c:389 +#: badwolf.c:390 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:99 +#: badwolf.c:100 msgid "Crashed" msgstr "" @@ -98,31 +98,31 @@ msgstr "" msgid "Download starting…" msgstr "" -#: badwolf.c:412 +#: badwolf.c:413 msgid "Error: Some unknown error occurred validating the certificate.\n" msgstr "" -#: badwolf.c:393 +#: badwolf.c:394 msgid "Error: The X509 Certificate Authority is unknown.\n" msgstr "" -#: badwolf.c:406 +#: badwolf.c:407 msgid "Error: The certificate has been revoked.\n" msgstr "" -#: badwolf.c:403 +#: badwolf.c:404 msgid "Error: The certificate has expired. Check your system's clock.\n" msgstr "" -#: badwolf.c:409 +#: badwolf.c:410 msgid "Error: The certificate is considered to be insecure.\n" msgstr "" -#: badwolf.c:400 +#: badwolf.c:401 msgid "Error: The certificate isn't valid yet. Check your system's clock.\n" msgstr "" -#: badwolf.c:396 +#: badwolf.c:397 msgid "Error: The given identity doesn't match the expected one.\n" msgstr "" @@ -133,79 +133,104 @@ msgid "" "Runtime WebKit version: %d.%d.%d" msgstr "" -#: badwolf.c:889 +#: badwolf.c:904 msgid "New tab" msgstr "" -#: badwolf.c:1006 +#: badwolf.c:1099 msgid "Open new tab" msgstr "" -#: badwolf.c:103 +#: badwolf.c:104 msgid "Out of Memory" msgstr "" -#: badwolf.c:952 +#: badwolf.c:1028 #, c-format msgid "Running Badwolf version: %s\n" msgstr "" -#: badwolf.c:959 +#: badwolf.c:1035 #, c-format msgid "Runtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:436 +#: badwolf.c:437 #, c-format msgid "TLS Error for %s." msgstr "" -#: badwolf.c:439 +#: badwolf.c:440 msgid "Temporarily Add Exception" msgstr "" -#: badwolf.c:647 +#: badwolf.c:650 msgid "Toggle javascript" msgstr "" -#: badwolf.c:652 +#: badwolf.c:655 msgid "Toggle loading images automatically" msgstr "" -#: badwolf.c:107 +#: badwolf.c:108 msgid "Unknown Crash" msgstr "" -#: badwolf.c:650 +#: badwolf.c:653 msgid "_IMG" msgstr "" -#: badwolf.c:645 +#: badwolf.c:648 msgid "_JS" msgstr "" -#: badwolf.c:777 +#: badwolf.c:981 +#, c-format +msgid "badwolf: content-filter loaded, adding to content-manager…\n" +msgstr "" + +#: badwolf.c:999 badwolf.c:1004 +#, c-format +msgid "badwolf: failed to compile content-filters.json, err: [%d] %s\n" +msgstr "" + +#: badwolf.c:969 badwolf.c:974 +#, c-format +msgid "badwolf: failed to load content-filter, err: [%d] %s\n" +msgstr "" + +#: badwolf.c:1059 +#, c-format +msgid "content-filters directory set to: %s\n" +msgstr "" + +#: badwolf.c:1056 +#, c-format +msgid "content-filters file set to: %s\n" +msgstr "" + +#: badwolf.c:792 msgid "search in current page" msgstr "" -#: badwolf.c:98 +#: badwolf.c:99 msgid "the web process crashed.\n" msgstr "" -#: badwolf.c:102 +#: badwolf.c:103 msgid "the web process exceeded the memory limit.\n" msgstr "" -#: badwolf.c:106 +#: badwolf.c:107 msgid "the web process terminated for an unknown reason.\n" msgstr "" -#: badwolf.c:966 +#: badwolf.c:1042 #, c-format msgid "webkit-web-extension directory set to: %s\n" msgstr "" #. TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. -#: badwolf.c:1042 +#: badwolf.c:1135 msgid "ø" msgstr "" -- cgit v1.3.1-23-gd82d From 9be9423c9b7ba45fad205daaf818c8c653721538 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 9 Apr 2021 07:15:28 +0200 Subject: Fix unused parameter warnings --- badwolf.c | 2 ++ po/messages.pot | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index ec2a691..bad849d 100644 --- a/badwolf.c +++ b/badwolf.c @@ -956,6 +956,7 @@ notebookCb_switch__page(GtkNotebook *notebook, GtkWidget *page, guint page_num, void content_managerCb_ready(GObject *store, GAsyncResult *result, gpointer user_data) { + (void)store; struct Window *window = (struct Window *)user_data; GError *err = NULL; @@ -986,6 +987,7 @@ content_managerCb_ready(GObject *store, GAsyncResult *result, gpointer user_data static void storeCb_finish(WebKitUserContentFilterStore *store, GAsyncResult *result, gpointer user_data) { + (void)store; struct Window *window = (struct Window *)user_data; GError *err = NULL; diff --git a/po/messages.pot b/po/messages.pot index 093ddf2..c608db5 100644 --- a/po/messages.pot +++ b/po/messages.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Badwolf 1.0.3+gdf1e25f.content-blockers\n" +"Project-Id-Version: Badwolf 1.0.3+g972a533.content-blockers\n" "Report-Msgid-Bugs-To: contact+badwolf-msgid@hacktivis.me\n" -"POT-Creation-Date: 2021-04-09 06:17+0200\n" +"POT-Creation-Date: 2021-04-09 07:15+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -74,7 +74,7 @@ msgstr "" msgid "Bookmarks: unable to parse file \"%s\"\n" msgstr "" -#: badwolf.c:1030 +#: badwolf.c:1034 #, c-format msgid "Buildtime WebKit version: %d.%d.%d\n" msgstr "" @@ -137,7 +137,7 @@ msgstr "" msgid "New tab" msgstr "" -#: badwolf.c:1099 +#: badwolf.c:1103 msgid "Open new tab" msgstr "" @@ -145,12 +145,12 @@ msgstr "" msgid "Out of Memory" msgstr "" -#: badwolf.c:1028 +#: badwolf.c:1032 #, c-format msgid "Running Badwolf version: %s\n" msgstr "" -#: badwolf.c:1035 +#: badwolf.c:1039 #, c-format msgid "Runtime WebKit version: %d.%d.%d\n" msgstr "" @@ -184,27 +184,27 @@ msgstr "" msgid "_JS" msgstr "" -#: badwolf.c:981 +#: badwolf.c:982 #, c-format msgid "badwolf: content-filter loaded, adding to content-manager…\n" msgstr "" -#: badwolf.c:999 badwolf.c:1004 +#: badwolf.c:1002 badwolf.c:1009 #, c-format msgid "badwolf: failed to compile content-filters.json, err: [%d] %s\n" msgstr "" -#: badwolf.c:969 badwolf.c:974 +#: badwolf.c:970 badwolf.c:975 #, c-format msgid "badwolf: failed to load content-filter, err: [%d] %s\n" msgstr "" -#: badwolf.c:1059 +#: badwolf.c:1063 #, c-format msgid "content-filters directory set to: %s\n" msgstr "" -#: badwolf.c:1056 +#: badwolf.c:1060 #, c-format msgid "content-filters file set to: %s\n" msgstr "" @@ -225,12 +225,12 @@ msgstr "" msgid "the web process terminated for an unknown reason.\n" msgstr "" -#: badwolf.c:1042 +#: badwolf.c:1046 #, c-format msgid "webkit-web-extension directory set to: %s\n" msgstr "" #. TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. -#: badwolf.c:1135 +#: badwolf.c:1139 msgid "ø" msgstr "" -- cgit v1.3.1-23-gd82d From 46ce59c9d63a8ab20117b5eb85afb52c0d6390a1 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 9 Apr 2021 07:44:41 +0200 Subject: Update copyright year --- COPYING | 2 +- README.md | 2 +- badwolf.c | 2 +- keybindings.c | 4 ++-- uri.c | 2 +- uri_test.c | 2 +- usr.bin.badwolf | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) (limited to 'badwolf.c') diff --git a/COPYING b/COPYING index 6ba3f5f..ff830e0 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,4 @@ -Copyright (c) 2019-2020, Badwolf Authors +Copyright (c) 2019-2021, Badwolf Authors All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 8dd6cf2..d2f194b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Minimalist and privacy-oriented WebKitGTK+ browser. Homepage: ``` -Copyright © 2019-2020 Badwolf Authors +Copyright © 2019-2021 Badwolf Authors SPDX-License-Identifier: BSD-3-Clause ``` diff --git a/badwolf.c b/badwolf.c index bad849d..bf5d183 100644 --- a/badwolf.c +++ b/badwolf.c @@ -1,5 +1,5 @@ // BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser -// Copyright © 2019-2020 Badwolf Authors +// Copyright © 2019-2021 Badwolf Authors // SPDX-License-Identifier: BSD-3-Clause #include "badwolf.h" diff --git a/keybindings.c b/keybindings.c index 13f2a48..bfc8f7a 100644 --- a/keybindings.c +++ b/keybindings.c @@ -1,5 +1,5 @@ // BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser -// Copyright © 2019-2020 Badwolf Authors +// Copyright © 2019-2021 Badwolf Authors // SPDX-License-Identifier: BSD-3-Clause #include "keybindings.h" @@ -42,7 +42,7 @@ badwolf_about_dialog(GtkWindow *main_window, gpointer user_data) "SPDX-License-Identifier: BSD-3-Clause"); gtk_about_dialog_set_copyright( GTK_ABOUT_DIALOG(about_dialog), - "2019-2020 Badwolf Authors "); + "2019-2021 Badwolf Authors "); gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(about_dialog), homepage); gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(about_dialog), comments); gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(about_dialog), version); diff --git a/uri.c b/uri.c index 912bf86..3cbc1d6 100644 --- a/uri.c +++ b/uri.c @@ -1,5 +1,5 @@ // BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser -// Copyright © 2019-2020 Badwolf Authors +// Copyright © 2019-2021 Badwolf Authors // SPDX-License-Identifier: BSD-3-Clause #include "uri.h" diff --git a/uri_test.c b/uri_test.c index a153817..28bdde9 100644 --- a/uri_test.c +++ b/uri_test.c @@ -1,5 +1,5 @@ // BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser -// Copyright © 2019-2020 Badwolf Authors +// Copyright © 2019-2021 Badwolf Authors // SPDX-License-Identifier: BSD-3-Clause #include "uri.h" diff --git a/usr.bin.badwolf b/usr.bin.badwolf index 0ebce5d..861ee9f 100644 --- a/usr.bin.badwolf +++ b/usr.bin.badwolf @@ -1,5 +1,5 @@ # BadWolf: Minimalist and privacy-oriented WebKitGTK+ browser -# Copyright © 2019-2020 Badwolf Authors +# Copyright © 2019-2021 Badwolf Authors # SPDX-License-Identifier: BSD-3-Clause # # Made on Gentoo Linux with PREFIX=/usr -- cgit v1.3.1-23-gd82d From edbbb27736db50534c9f0e029bc04f3f462596d3 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 9 Apr 2021 08:47:01 +0200 Subject: Move filter directory information to manpage --- badwolf.1 | 2 ++ badwolf.c | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'badwolf.c') diff --git a/badwolf.1 b/badwolf.1 index 502d07e..111c0cc 100644 --- a/badwolf.1 +++ b/badwolf.1 @@ -89,6 +89,8 @@ For a converter using AblockPlus-style filters, try: .Pp For a ready-to-use file (that you should update periodically), try: .Lk https://easylist-downloads.adblockplus.org/easylist_min_content_blocker.json +.It Pa ${XDG_CACHE_HOME:-$HOME/.cache}/badwolf/filters +This is where the compiled filters are stored, the file(s) in it are automatically generated and so shouldn't be edited. .It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/bookmarks.xbel XBEL (XML Bookmark Exchange Language) file, known to be currently supported by: .Xr elinks 1 , diff --git a/badwolf.c b/badwolf.c index bf5d183..84f4104 100644 --- a/badwolf.c +++ b/badwolf.c @@ -1060,7 +1060,6 @@ main(int argc, char *argv[]) fprintf(stderr, _("content-filters file set to: %s\n"), contentFilterPath); gchar *filtersPath = g_build_filename(g_get_user_cache_dir(), g_get_prgname(), "filters", NULL); - fprintf(stderr, _("content-filters directory set to: %s\n"), filtersPath); window->content_store = webkit_user_content_filter_store_new(filtersPath); webkit_user_content_filter_store_save_from_file(window->content_store, -- cgit v1.3.1-23-gd82d From 5145eae758d3817c7bcc1a589514624bb62819e1 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 10 Apr 2021 17:39:05 +0200 Subject: assert webkit_download before using it --- badwolf.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 84f4104..af2fe78 100644 --- a/badwolf.c +++ b/badwolf.c @@ -10,6 +10,7 @@ #include "keybindings.h" #include "uri.h" +#include #include /* _() and other internationalization/localization helpers */ #include /* soup* */ #include /* LC_* */ @@ -466,6 +467,8 @@ web_contextCb_download_started(WebKitWebContext *web_context, struct Client *browser = (struct Client *)user_data; struct Download *download = malloc(sizeof(struct Download)); + assert(webkit_download); + if(download != NULL) { download->window = browser->window; -- cgit v1.3.1-23-gd82d From 52a75160abed353df818f26929e3bbf99382a660 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 10 Apr 2021 18:12:09 +0200 Subject: badwolf: Connect to WebContext only when created --- badwolf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index af2fe78..93523e1 100644 --- a/badwolf.c +++ b/badwolf.c @@ -683,6 +683,12 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b webkit_web_context_set_process_model(web_context, WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES); webkit_web_context_set_web_extensions_directory(web_context, web_extensions_directory); + + g_signal_connect(G_OBJECT(web_context), + "download-started", + G_CALLBACK(web_contextCb_download_started), + browser); + } else { @@ -870,12 +876,6 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b 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), - "download-started", - G_CALLBACK(web_contextCb_download_started), - browser); - /* signals for search widget */ g_signal_connect(browser->search, "next-match", G_CALLBACK(SearchEntryCb_next__match), browser); g_signal_connect( -- cgit v1.3.1-23-gd82d From 05361157c8daff3c75ec2a78c4f074149c4e8581 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 10 Apr 2021 18:48:06 +0200 Subject: fr: Update translation --- badwolf.c | 1 - po/fr.po | 82 +++++++++++++++++++++++++++++++++++++++------------------------ 2 files changed, 51 insertions(+), 32 deletions(-) (limited to 'badwolf.c') diff --git a/badwolf.c b/badwolf.c index 93523e1..aea2bbc 100644 --- a/badwolf.c +++ b/badwolf.c @@ -688,7 +688,6 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b "download-started", G_CALLBACK(web_contextCb_download_started), browser); - } else { diff --git a/po/fr.po b/po/fr.po index ba42e68..58d386a 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Badwolf 0.3.0+gd88f2e7\n" "Report-Msgid-Bugs-To: contact+badwolf-msgid@hacktivis.me\n" -"POT-Creation-Date: 2021-03-30 14:25+0200\n" -"PO-Revision-Date: 2021-03-30 14:52+0200\n" +"POT-Creation-Date: 2021-04-10 18:43+0200\n" +"PO-Revision-Date: 2021-04-10 18:43+0200\n" "Last-Translator: Haelwenn (lanodan) Monnier \n" "Language-Team: French\n" "Language: fr\n" @@ -74,16 +74,16 @@ msgstr "Marques-Pages: Échec à l'évaluation de l'expression XPath « %s »\ msgid "Bookmarks: unable to parse file \"%s\"\n" msgstr "Marques-Pages: Ëchec au parsage du fichier « %s »\n" -#: badwolf.c:954 +#: badwolf.c:1036 #, c-format msgid "Buildtime WebKit version: %d.%d.%d\n" msgstr "Version WebKit à la compilation: %d.%d.%d\n" -#: badwolf.c:439 +#: badwolf.c:441 msgid "Continue" msgstr "Continuer" -#: badwolf.c:389 +#: badwolf.c:391 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" @@ -94,7 +94,7 @@ msgstr "" "et son réseau.\n" "\n" -#: badwolf.c:99 +#: badwolf.c:101 msgid "Crashed" msgstr "Crash" @@ -102,33 +102,33 @@ msgstr "Crash" msgid "Download starting…" msgstr "Démarrage du téléchargement" -#: badwolf.c:412 +#: badwolf.c:414 msgid "Error: Some unknown error occurred validating the certificate.\n" msgstr "" "Erreur : Une erreur inconnue est apparue pendant la validation du " "certificat.\n" -#: badwolf.c:393 +#: badwolf.c:395 msgid "Error: The X509 Certificate Authority is unknown.\n" msgstr "Erreur : L'autorité de certification (CA X509) est inconnue.\n" -#: badwolf.c:406 +#: badwolf.c:408 msgid "Error: The certificate has been revoked.\n" msgstr "Erreur : Le certificat à été révoqué.\n" -#: badwolf.c:403 +#: badwolf.c:405 msgid "Error: The certificate has expired. Check your system's clock.\n" msgstr "Erreur : Le certificat a expiré.\n" -#: badwolf.c:409 +#: badwolf.c:411 msgid "Error: The certificate is considered to be insecure.\n" msgstr "Erreur : Le certificat est considéré comme non-sécurisé.\n" -#: badwolf.c:400 +#: badwolf.c:402 msgid "Error: The certificate isn't valid yet. Check your system's clock.\n" msgstr "Erreur : Le certificat n'est pas encore valide.\n" -#: badwolf.c:396 +#: badwolf.c:398 msgid "Error: The given identity doesn't match the expected one.\n" msgstr "Erreur : L'identité ne correspond pas à celle attendue.\n" @@ -141,79 +141,99 @@ msgstr "" "Navigateur WebKitGTK+ minimaliste et orienté vie privée\n" "Version WebKit au lancement: %d.%d.%d" -#: badwolf.c:889 +#: badwolf.c:906 msgid "New tab" msgstr "Nouvel onglet" -#: badwolf.c:1006 +#: badwolf.c:1104 msgid "Open new tab" msgstr "Ouvrir un nouvel onglet" -#: badwolf.c:103 +#: badwolf.c:105 msgid "Out of Memory" msgstr "Dépassement Mémoire" -#: badwolf.c:952 +#: badwolf.c:1034 #, c-format msgid "Running Badwolf version: %s\n" msgstr "Version de Badwolf: %s\n" -#: badwolf.c:959 +#: badwolf.c:1041 #, c-format msgid "Runtime WebKit version: %d.%d.%d\n" msgstr "Version WebKit au lancement: %d.%d.%d\n" -#: badwolf.c:436 +#: badwolf.c:438 #, c-format msgid "TLS Error for %s." msgstr "Erreur TLS pour %s." -#: badwolf.c:439 +#: badwolf.c:441 msgid "Temporarily Add Exception" msgstr "Ajouter Temporairement une Exception" -#: badwolf.c:647 +#: badwolf.c:653 msgid "Toggle javascript" msgstr "(Dés)activer javascript" -#: badwolf.c:652 +#: badwolf.c:658 msgid "Toggle loading images automatically" msgstr "(Dés)activer le chargement automatique des images" -#: badwolf.c:107 +#: badwolf.c:109 msgid "Unknown Crash" msgstr "Crash inconnu" -#: badwolf.c:650 +#: badwolf.c:656 msgid "_IMG" msgstr "_IMG" -#: badwolf.c:645 +#: badwolf.c:651 msgid "_JS" msgstr "_JS" -#: badwolf.c:777 +#: badwolf.c:984 +#, c-format +msgid "badwolf: content-filter loaded, adding to content-manager…\n" +msgstr "badwolf: content-filter chargé, ajout à content-manager…\n" + +#: badwolf.c:1004 badwolf.c:1011 +#, c-format +msgid "badwolf: failed to compile content-filters.json, err: [%d] %s\n" +msgstr "badwolf: échec de compilation de content-filters.json, err: [%d] %s\n" + +#: badwolf.c:972 badwolf.c:977 +#, c-format +msgid "badwolf: failed to load content-filter, err: [%d] %s\n" +msgstr "badwolf: échec de chargement de content-filter, err: [%d] %s\n" + +#: badwolf.c:1062 +#, c-format +msgid "content-filters file set to: %s\n" +msgstr "Fichier content-filters configuré à: %s\n" + +#: badwolf.c:800 msgid "search in current page" msgstr "recherche dans la page courante" -#: badwolf.c:98 +#: badwolf.c:100 msgid "the web process crashed.\n" msgstr "le processus web a cessé de fonctionner.\n" -#: badwolf.c:102 +#: badwolf.c:104 msgid "the web process exceeded the memory limit.\n" msgstr "le processus web a dépassé la limitation de mémoire.\n" -#: badwolf.c:106 +#: badwolf.c:108 msgid "the web process terminated for an unknown reason.\n" msgstr "le processus web s’est interrompu pour une raison inconnue.\n" -#: badwolf.c:966 +#: badwolf.c:1048 #, c-format msgid "webkit-web-extension directory set to: %s\n" msgstr "Répertoire webkit-web-extension configuré à %s\n" #. TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. -#: badwolf.c:1042 +#: badwolf.c:1140 msgid "ø" msgstr "" -- cgit v1.3.1-23-gd82d