logo

badwolf

Minimalist and privacy-oriented WebKitGTK+ browser
commit: cb232d9e919d67c71a96d7ab1fc85cf5aa968b81
parent: 4b85e087dad714f6e969f702e8be7319531afc37
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 16 Jun 2020 01:45:13 +0200

Add webcontext hex id to tab label

Diffstat:

Mbadwolf.c20+++++++++++++++-----
Mbadwolf.h1+
Minterface.txt1+
Mpo/messages.pot64++++++++++++++++++++++++++++++++--------------------------------
4 files changed, 49 insertions(+), 37 deletions(-)

diff --git a/badwolf.c b/badwolf.c @@ -12,13 +12,14 @@ #include <glib/gi18n.h> /* _() and other internationalization/localization helpers */ #include <libsoup/soup.h> /* soup* */ #include <locale.h> /* LC_* */ -#include <stdio.h> /* perror(), fprintf() */ +#include <stdio.h> /* perror(), fprintf(), snprintf() */ #include <stdlib.h> /* malloc() */ #include <unistd.h> /* 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); diff --git a/badwolf.h b/badwolf.h @@ -26,6 +26,7 @@ struct Client GtkWidget *auto_load_images; GtkWidget *location; + int context_id; WebKitWebView *webView; struct Window *window; diff --git a/interface.txt b/interface.txt @@ -3,6 +3,7 @@ - Each tab contains a Browser View or the Downloads View ## Tab Labels +- An hexadecimal number identifying the webkit process context - An icon to indicate if a media is playing - The title of the web view - A close button diff --git a/po/messages.pot b/po/messages.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Badwolf 1.0.0+g828e2e3.develop\n" +"Project-Id-Version: Badwolf 1.0.0+g4b85e08.context-id\n" "Report-Msgid-Bugs-To: contact+badwolf-msgid@hacktivis.me\n" -"POT-Creation-Date: 2020-06-12 02:16+0200\n" +"POT-Creation-Date: 2020-06-16 01:41+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" @@ -37,27 +37,27 @@ msgstr "" msgid "%02i:%02i:%02i Downloading…" msgstr "" -#: downloads.c:199 downloads.c:216 downloads.c:218 +#: downloads.c:199 downloads.c:216 downloads.c:219 msgid "Badwolf Downloads" msgstr "" -#: badwolf.c:910 +#: badwolf.c:920 #, c-format msgid "Buildtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:403 +#: badwolf.c:412 msgid "Continue" msgstr "" -#: badwolf.c:353 +#: badwolf.c:362 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 "" @@ -65,31 +65,31 @@ msgstr "" msgid "Download starting…" msgstr "" -#: badwolf.c:376 +#: badwolf.c:385 msgid "Error: Some unknown error occurred validating the certificate.\n" msgstr "" -#: badwolf.c:357 +#: badwolf.c:366 msgid "Error: The X509 Certificate Authority is unknown.\n" msgstr "" -#: badwolf.c:370 +#: badwolf.c:379 msgid "Error: The certificate has been revoked.\n" msgstr "" -#: badwolf.c:367 +#: badwolf.c:376 msgid "Error: The certificate has expired. Check your system's clock.\n" msgstr "" -#: badwolf.c:373 +#: badwolf.c:382 msgid "Error: The certificate is considered to be insecure.\n" msgstr "" -#: badwolf.c:364 +#: badwolf.c:373 msgid "Error: The certificate isn't valid yet. Check your system's clock.\n" msgstr "" -#: badwolf.c:360 +#: badwolf.c:369 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:839 +#: badwolf.c:849 msgid "New tab" msgstr "" -#: badwolf.c:959 +#: badwolf.c:969 msgid "Open new tab" msgstr "" -#: badwolf.c:103 +#: badwolf.c:104 msgid "Out of Memory" msgstr "" -#: badwolf.c:908 +#: badwolf.c:918 #, c-format msgid "Running Badwolf version: %s\n" msgstr "" -#: badwolf.c:915 +#: badwolf.c:925 #, c-format msgid "Runtime WebKit version: %d.%d.%d\n" msgstr "" -#: badwolf.c:400 +#: badwolf.c:409 #, c-format msgid "TLS Error for %s." msgstr "" -#: badwolf.c:403 +#: badwolf.c:412 msgid "Temporarily Add Exception" msgstr "" -#: badwolf.c:610 +#: badwolf.c:620 msgid "Toggle javascript" msgstr "" -#: badwolf.c:615 +#: badwolf.c:625 msgid "Toggle loading images automatically" msgstr "" -#: badwolf.c:107 +#: badwolf.c:108 msgid "Unknown Crash" msgstr "" -#: badwolf.c:613 +#: badwolf.c:623 msgid "_IMG" msgstr "" -#: badwolf.c:608 +#: badwolf.c:618 msgid "_JS" msgstr "" -#: badwolf.c:728 +#: badwolf.c:738 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:922 +#: badwolf.c:932 #, c-format msgid "webkit-web-extension directory set to: %s\n" msgstr "" #. TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. -#: badwolf.c:993 +#: badwolf.c:1003 msgid "ø" msgstr ""