diff options
| Commit | 667c807f6eebe09ba075f763f2642e5241d2ac84 (patch) | |
|---|---|---|
| Author | 2021-10-02 19:06:14 +0200 | |
| Committer | 2021-10-02 19:06:14 +0200 | |
| Files | 1262fd4a5f08be5faeedde58b2f5200e20cba157 | |
| goodwolf-1.2.0.tar goodwolf-1.2.0.tar.gz goodwolf-1.2.0.zip | ||
| Parent | 762114dcc99d4e70a0472813ff41f77e44277bb8 (diff) | |
| Parent | f539edf6f68be78e7be36a94f5020a6193f58867 (diff) | |
Merge branch 'release-1.2' into missy for 1.2.0 v1.2.0
13 files changed, 459 insertions, 56 deletions
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 39 | ||||
| -rw-r--r-- | README.md | 12 | ||||
| -rw-r--r-- | badwolf.1 | 25 | ||||
| -rw-r--r-- | badwolf.c | 35 | ||||
| -rw-r--r-- | badwolf.h | 4 | ||||
| -rwxr-xr-x | configure | 121 | ||||
| -rw-r--r-- | downloads.c | 2 | ||||
| -rw-r--r-- | interface.txt | 4 | ||||
| -rw-r--r-- | keybindings.c | 20 | ||||
| -rw-r--r-- | keybindings.h | 2 | ||||
| -rw-r--r-- | po/vi.po | 237 | ||||
| -rwxr-xr-x | version.sh | 13 |
@@ -1,4 +1,5 @@ /badwolf /locale +/config.mk *.o *.mo @@ -3,41 +3,21 @@ # - Usage of ?= for defining variables when not already defined # - Usage of += for appending to a variable -PACKAGE = Badwolf -VERSION = 1.1.0 -VERSION_FULL = $(VERSION)`./version.sh` +include config.mk -PREFIX ?= /usr/local -BINDIR ?= $(PREFIX)/bin -MANDIR ?= $(PREFIX)/share/man -DOCDIR ?= $(PREFIX)/share/doc/badwolf-$(VERSION) -DATADIR ?= $(PREFIX)/share/badwolf -APPSDIR ?= $(PREFIX)/share/applications - -CC ?= cc -CFLAGS ?= -g -O2 -pie -fPIE -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wconversion -Wsign-conversion -O2 -Werror=implicit-function-declaration -Werror=implicit-int -Werror=vla -DBG ?= -PKGCONFIG ?= pkg-config -MSGFMT ?= msgfmt -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 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 EXE = badwolf EXE_test = uri_test -TRANS = fr.mo pt_BR.mo tr.mo de.mo +TRANS = fr.mo pt_BR.mo tr.mo de.mo vi.mo DOCS = usr.bin.badwolf README.md KnowledgeBase.md interface.txt -CDEPS = -DDATADIR=\"$(DATADIR)\" -DPACKAGE=\"$(PACKAGE)\" -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION_FULL)\" -CDEPS += `$(PKGCONFIG) --cflags $(DEPS)` -LIBS = `$(PKGCONFIG) --libs $(DEPS)` +all: config.mk $(EXE) $(TRANS) po/messages.pot -all: $(EXE) $(TRANS) po/messages.pot +config.mk: configure + @echo "Error: You need to execute ./configure before running make" + @exit 1 icons: $(ICON_SIZES) @@ -63,10 +43,10 @@ badwolf: $(OBJS) $(CC) -std=c11 -o $@ $(OBJS) $(LDFLAGS) $(LIBS) .c: - $(CC) -std=c11 $(CFLAGS) $(CDEPS) $(LDFLAGS) $(LIBS) -o $@ $< + $(CC) -std=c11 $(CFLAGS) $(LDFLAGS) $(LIBS) -o $@ $< .c.o: - $(CC) -std=c11 $(CFLAGS) $(CDEPS) -c -o $@ $< + $(CC) -std=c11 $(CFLAGS) -c -o $@ $< uri_test: uri.o uri_test.o $(CC) -std=c11 -o $@ uri.o uri_test.o $(LDFLAGS) $(LIBS) @@ -74,6 +54,7 @@ uri_test: uri.o uri_test.o .PHONY: test test: $(EXE_test) + $(MANDOC) -Tlint -Wunsupp,error,warning ./badwolf.1 .PHONY: install install: all @@ -94,7 +75,7 @@ install: all .PHONY: clean clean: - rm -fr locale $(OBJS) $(OBJS_test) $(EXE) $(EXE_test) + rm -fr locale config.mk $(OBJS) $(OBJS_test) $(EXE) $(EXE_test) format: *.c *.h clang-format -style=file -assume-filename=.clang-format -i *.c *.h @@ -34,8 +34,8 @@ You need to have gettext installed. If you want a GUI, poedit exists and Weblate - Initialising a new PO file (example for German, `de_DE`): ``msginit -l de_DE -i po/messages.pot -o po/de.po`` ## Contacts / Discussions -- IRC: `#badwolf-browser` on FreeNode -- Matrix (bridge): <https://matrix.to/#/#freenode_#badwolf-browser:matrix.org> +- IRC: `#badwolf-browser` on [GeekNode](https://www.geeknode.org/) +- Matrix (bridge): [#badwolf-browser:matrix.fdn.fr](https://matrix.to/#/#badwolf-browser:matrix.fdn.fr) ## Repositories ### git @@ -53,14 +53,16 @@ You need to have gettext installed. If you want a GUI, poedit exists and Weblate ## Manual Installation Dependencies are: +- POSIX-compatible Shell (ie. mrsh, dash, lksh) - C11 Compiler (such as clang or gcc) -- [WebKitGTK](https://webkitgtk.org/), only the latest stable is supported +- [WebKitGTK](https://webkitgtk.org/), only the latest stable(2.32.0+) 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) +- (optional) gettext implementation (such as GNU Gettext) +- (optional, test) [mandoc](https://mdocml.bsd.lv/) (the command) for linting the manpage -Compilation is done with `make`, install with `make install` (`DESTDIR` and `PREFIX` environment variables are supported, amongs other common ones). An example AppArmor profile is provided at `usr.bin.badwolf`, please do some long runtime checks before shipping it or a modified version, help can be provided but with no support. +Compilation is done with `./configure && make`, install with `make install` (`DESTDIR` and `PREFIX` environment variables are supported, amongs other common ones). An example AppArmor profile is provided at `usr.bin.badwolf`, please do some long runtime checks before shipping it or a modified version, help can be provided but with no support. You'll also need inkscape (command line only) if you want to regenerate the icons, for example after modifying them or adding a new size. These aren't needed for normal installation as it is bundled. @@ -3,6 +3,7 @@ .\" SPDX-License-Identifier: BSD-3-Clause .Dd 2019-10-31 .Dt BADWOLF 1 +.Os .Sh NAME .Nm badwolf .Nd minimalist and privacy-oriented web browser based on WebKitGTK @@ -43,7 +44,7 @@ Toggles caret browsing. .It browser F12 Opens the web inspector. .It browser Ctrl-[ / Ctrl-] -Go back/forward in current tab’s history +Go back/forward in current tab's history .It browser Ctrl-p Print the current page. (spawns a dialog) .It any Alt-Left / Alt-Right @@ -72,17 +73,26 @@ For example .Ic BADWOLF_L10N="en_GB:fr_FR:de_DE" . When this variable isn't set, spelling isn't activated. A more generic variable name is also intended to be used in the future. +.Pp +To get the list of supported dictionaries execute +.Ic enchant-lsmod-2 -list-dicts +or before enchant 2.0: +.Ic enchant-lsmod -list-dicts .El .Sh FILES +The following paths are using +.Xr sh 1 +syntax to correctly support XDG Base Directory Specification, you can use the +.Xr echo 1 +command to check where it is on your system. +.Pp .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: -.Bl -compact .Lk https://webkit.org/blog/3476/content-blockers-first-look/ .Lk https://webkit.org/blog/4062/targeting-domains-with-content-blockers/ .Lk https://developer.apple.com/documentation/safariservices/creating_a_content_blocker -.El .Pp For a converter using AblockPlus-style filters, try: .Lk https://gitlab.com/eyeo/adblockplus/abp2blocklist @@ -91,6 +101,7 @@ 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. +Documented here only for sandboxing / access-control purposes. .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 , @@ -99,7 +110,10 @@ XBEL (XML Bookmark Exchange Language) file, known to be currently supported by: .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/ +.Pp +For an example XBEL file see: +.Lk https://hacktivis.me/bookmarks.xbel +.It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/webkit-web-extension/ Directory containing the .Lk https://webkitgtk.org/reference/webkit2gtk/stable/WebKitWebExtension.html WebKitWebExtensions to be loaded into @@ -111,7 +125,8 @@ Examples of useful extensions may be found at: .It Pa ${XDG_DATA_HOME:-$HOME/.local/share}/badwolf/interface.css CSS files (respectively system and user-level) for styling badwolf interface. See -.Lk https://developer.gnome.org/gtk3/stable/chap-css-properties.html +.\" GNOME can't even into doing any redirections of the few docs available +.Lk http://web.archive.org/web/20210420214617/https://developer.gnome.org/gtk3/stable/chap-css-properties.html for the properties being available. .Pp For testing your styles I would recommend using the @@ -165,16 +165,23 @@ badwolf_new_tab_box(const gchar *title, struct Client *browser) GtkWidget *tab_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_set_name(tab_box, "browser__tabbox"); + GtkWidget *close = gtk_button_new_from_icon_name("window-close-symbolic", GTK_ICON_SIZE_LARGE_TOOLBAR); gtk_widget_set_name(close, "browser__tabbox__close"); GtkWidget *label = gtk_label_new(title); gtk_widget_set_name(label, "browser__tabbox__label"); + GtkWidget *label_event_box = gtk_event_box_new(); + gtk_container_add(GTK_CONTAINER(label_event_box), label); GtkWidget *context_label = gtk_label_new(context_id_str); gtk_widget_set_name(context_label, "browser__tabbox__context_label"); + GtkWidget *context_label_event_box = gtk_event_box_new(); + gtk_container_add(GTK_CONTAINER(context_label_event_box), 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"); + GtkWidget *playing_event_box = gtk_event_box_new(); + gtk_container_add(GTK_CONTAINER(playing_event_box), playing); #ifdef BADWOLF_TAB_BOX_WIDTH gtk_widget_set_size_request(label, BADWOLF_TAB_BOX_WIDTH, -1); @@ -188,9 +195,9 @@ 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), 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), context_label_event_box, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(tab_box), playing_event_box, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(tab_box), label_event_box, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(tab_box), close, FALSE, FALSE, 0); gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE); @@ -201,6 +208,9 @@ badwolf_new_tab_box(const gchar *title, struct Client *browser) gtk_widget_show_all(tab_box); gtk_widget_set_visible(playing, webkit_web_view_is_playing_audio(browser->webView)); + gtk_widget_set_events(label, GDK_BUTTON_RELEASE_MASK); + g_signal_connect( + tab_box, "button-release-event", G_CALLBACK(tab_boxCb_button_release_event), browser); return tab_box; } @@ -429,7 +439,8 @@ WebViewCb_load_failed_with_tls_errors(WebKitWebView *web_view, struct Client *browser = (struct Client *)user_data; gchar *error_details = detail_tls_certificate_flags(errors); gint dialog_response; - SoupURI *failing_uri = soup_uri_new(failing_text); + + GUri *failing_uri = g_uri_parse(failing_text, G_URI_FLAGS_NONE, NULL); GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(browser->window->main_window), GTK_DIALOG_MODAL & GTK_DIALOG_DESTROY_WITH_PARENT, @@ -439,6 +450,10 @@ WebViewCb_load_failed_with_tls_errors(WebKitWebView *web_view, failing_text); gtk_dialog_add_buttons( GTK_DIALOG(dialog), _("Temporarily Add Exception"), 1, _("Continue"), 0, NULL); + if(!failing_uri) + { + gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), 1, FALSE); + } gtk_dialog_set_default_response(GTK_DIALOG(dialog), 0); gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), "%s\n", error_details); @@ -447,11 +462,11 @@ WebViewCb_load_failed_with_tls_errors(WebKitWebView *web_view, if(dialog_response == 1) { webkit_web_context_allow_tls_certificate_for_host( - webkit_web_view_get_context(browser->webView), certificate, failing_uri->host); + webkit_web_view_get_context(browser->webView), certificate, g_uri_get_host(failing_uri)); webkit_web_view_reload(browser->webView); } - soup_uri_free(failing_uri); + g_free(failing_uri); g_free(error_details); gtk_widget_destroy(dialog); @@ -863,6 +878,7 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b browser); 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); g_signal_connect(browser->webView, "scroll-event", G_CALLBACK(WebViewCb_scroll_event), browser); @@ -1024,11 +1040,18 @@ int main(int argc, char *argv[]) { struct Window *window = &(struct Window){NULL, NULL, NULL, NULL, NULL, NULL}; + GApplication *application; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, DATADIR "/locale"); bind_textdomain_codeset(PACKAGE, "UTF-8"); textdomain(PACKAGE); + application = g_application_new("me.hacktivis.badwolf", + G_APPLICATION_HANDLES_COMMAND_LINE | + G_APPLICATION_SEND_ENVIRONMENT | G_APPLICATION_NON_UNIQUE); + g_application_register(application, NULL, NULL); + //g_application_activate(application); + gtk_init(&argc, &argv); fprintf(stderr, _("Running Badwolf version: %s\n"), version); @@ -5,6 +5,10 @@ #include <inttypes.h> /* uint64_t */ #include <webkit2/webkit2.h> +#if !WEBKIT_CHECK_VERSION(2, 32, 0) +#error WebkitGTK 2.32.0 is the latest supported version for badwolf. +#endif + extern const gchar *homepage; extern const gchar *version; diff --git a/configure b/configure new file mode 100755 index 0000000..3776bfa --- /dev/null +++ b/configure @@ -0,0 +1,121 @@ +#!/bin/sh +VERSION=1.2.0 +VERSION_FULL=${VERSION}$(./version.sh) +PREFIX="${PREFIX:-/usr/local}" +BINDIR="${BINDIR:-${PREFIX}/bin}" +MANDIR="${MANDIR:-${PREFIX}/share/man}" +DOCDIR="${DOCDIR:-${PREFIX}/share/doc/badwolf-${VERSION}}" +DATADIR="${DATADIR:-${PREFIX}/share/badwolf}" +APPSDIR="${APPSDIR:-${PREFIX}/share/applications}" + +PKGCONFIG="${PKGCONFIG:-pkg-config}" +MSGFMT="${MSGFMT:-msgfmt}" +INKSCAPE="${INKSCAPE:-inkscape}" +CC="${CC:-cc}" +CFLAGS="${CFLAGS:--g -O2 -pie -fPIE} -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wconversion -Wsign-conversion -Werror=implicit-function-declaration -Werror=implicit-int -Werror=vla ${EXTRA_CFLAGS}" +MANDOC="mandoc" + +DEPS="gtk+-3.0 libxml-2.0" + +is_ok() { + status="$?" + + if test $status -eq 0; then + printf " OK\n" + else + printf " FAIL\n" + fi + + return $status +} + +required() { + is_ok || exit 1 +} + +pkg_config_check() { + printf 'Checking: %s %s ...' "${PKGCONFIG}" "$*" + "${PKGCONFIG}" "$@" + is_ok +} + +printf 'Checking %s command existance ...' "${PKGCONFIG}" +command -v "${PKGCONFIG}" >/dev/null ; required + +printf 'Checking %s command existance ...' "${CC}" +command -v "${CC}" >/dev/null ; required + +printf 'Checking %s command existance ...' "${MANDOC}" +if command -v "${CC}" >/dev/null ; is_ok +then + : +else + MANDOC="true" +fi + + +for dep in ${DEPS} +do + pkg_config_check --exists "$dep" || exit 1 +done + +case "${WITH_WEBKITGTK}n" in + 4.1n) + pkg_config_check --atleast-version=2.32.0 webkit2gtk-4.1 || exit 1 + DEPS="${DEPS} webkit2gtk-4.1" + ;; + 4.0n) + pkg_config_check --atleast-version=2.32.0 webkit2gtk-4.0 || exit 1 + DEPS="${DEPS} webkit2gtk-4.0" + ;; + n) + echo "warning: Packagers should specify the ABI version (4.0 or 4.1) in WITH_WEBKITGTK" >&2 + if pkg_config_check --atleast-version=2.32.0 webkit2gtk-4.1 + then + DEPS="${DEPS} webkit2gtk-4.1" + else + pkg_config_check --atleast-version=2.32.0 webkit2gtk-4.0 || exit 1 + DEPS="${DEPS} webkit2gtk-4.0" + fi + ;; + *) + echo "error: invalid webkit2gtk version in WITH_WEBKITGTK environment variable, must be 4.0 or 4.1" >&2 + exit 1 + ;; +esac + +get_cflags() { "${PKGCONFIG}" --cflags "${DEPS}"; } +DEPS_cflags="$(get_cflags)" +get_libs() { "${PKGCONFIG}" --libs "${DEPS}"; } +DEPS_libs="$(get_libs)" + +ICON_SIZES="$(for i in 24 32 48 64 128 256; do printf 'icons/hicolor/%sx%s/apps/badwolf.png ' $i $i ; done)" + +printf 'Writing to config.mk ...' +cat >config.mk <<EOF +# Autogenerated by ./configure +PACKAGE = Badwolf +VERSION = ${VERSION} +VERSION_FULL = ${VERSION_FULL} + +PREFIX = ${PREFIX} +BINDIR = ${BINDIR} +MANDIR = ${MANDIR} +DOCDIR = ${DOCDIR} +DATADIR = ${DATADIR} +APPSDIR = ${APPSDIR} + +PKGCONFIG = ${PKGCONFIG} +CC = ${CC} +INKSCAPE = ${INKSCAPE} +MSGFMT = ${MSGFMT} +DBG = ${DBG} +MANDOC = ${MANDOC} + +CFLAGS = ${CFLAGS} -DDATADIR=\"\${DATADIR}\" -DPACKAGE=\"\${PACKAGE}\" -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"\${VERSION_FULL}\" ${DEPS_cflags} +LIBS = ${DEPS_libs} +ICON_SIZES = ${ICON_SIZES} +EOF +is_ok + +echo 'Done, you can now run make' diff --git a/downloads.c b/downloads.c index 09b7bb0..4c54b95 100644 --- a/downloads.c +++ b/downloads.c @@ -122,8 +122,6 @@ downloadCb_failed(WebKitDownload *webkit_download, GError *error, gpointer user_ gtk_label_set_text(GTK_LABEL(download->status), formatted); - gtk_widget_destroy(download->stop_icon); - gtk_image_set_from_icon_name( GTK_IMAGE(download->icon), "network-error-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR); } diff --git a/interface.txt b/interface.txt index 42f7f5c..e90e32b 100644 --- a/interface.txt +++ b/interface.txt @@ -1,5 +1,7 @@ # Badwolf -- A tablist with a new tab button at the end, right-clicking on the tablist gives you the list in a context-menu format +- A tablist with a new tab button at the end +- right-clicking on the tablist gives you the list in a context-menu format +- middle-clicking on the focused tab closes it - Each tab contains a Browser View or the Downloads View ## Tab Labels diff --git a/keybindings.c b/keybindings.c index bfc8f7a..7108acd 100644 --- a/keybindings.c +++ b/keybindings.c @@ -14,9 +14,9 @@ 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), FALSE); + badwolf_new_tab(GTK_NOTEBOOK(window->notebook), new_browser(window, uri, NULL), TRUE); - gtk_widget_destroy(GTK_WIDGET(about_dialog)); + gtk_window_close(GTK_WINDOW(about_dialog)); return TRUE; } @@ -102,7 +102,7 @@ commonCb_key_press_event(struct Window *window, GdkEvent *event, struct Client * return TRUE; case GDK_KEY_p: webkit_print_operation_run_dialog(webkit_print_operation_new(browser->webView), - GTK_WINDOW(browser->window)); + GTK_WINDOW(browser->window->main_window)); return TRUE; } } @@ -190,3 +190,17 @@ main_windowCb_key_press_event(GtkWidget *widget, GdkEvent *event, gpointer user_ return FALSE; } + +gboolean +tab_boxCb_button_release_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) +{ + (void)widget; + struct Client *browser = (struct Client *)user_data; + + if(((GdkEventButton *)event)->button == GDK_BUTTON_MIDDLE) + { + webkit_web_view_try_close(browser->webView); + return TRUE; + } + return FALSE; +} diff --git a/keybindings.h b/keybindings.h index e7d1d6b..bec9189 100644 --- a/keybindings.h +++ b/keybindings.h @@ -9,4 +9,6 @@ gboolean boxCb_key_press_event(GtkWidget *widget, GdkEvent *event, gpointer user gboolean commonCb_key_press_event(struct Window *window, GdkEvent *event, struct Client *browser); gboolean main_windowCb_key_press_event(GtkWidget *widget, GdkEvent *event, gpointer user_data); gboolean WebViewCb_key_press_event(WebKitWebView *webView, GdkEvent *event, gpointer user_data); +gboolean tab_boxCb_button_release_event(GtkWidget *widget, GdkEvent *event, gpointer user_data); + #endif /* KEYBINDINGS_H_INCLUDED */ diff --git a/po/vi.po b/po/vi.po new file mode 100644 index 0000000..b4e4ed8 --- /dev/null +++ b/po/vi.po @@ -0,0 +1,237 @@ +# Vietnamese translations for Badwolf package +# Bản dịch Tiếng Việt dành cho gói Badwolf. +# Copyright (C) 2021 Badwolf Authors <https://hacktivis.me/projects/badwolf> +# This file is distributed under the same license as the Badwolf package. +# Ngô Ngọc Đức Huy <huyngo@disroot.org>, 2021. +# +msgid "" +msgstr "" +"Project-Id-Version: Badwolf 1.0.3+gedbbb27.develop\n" +"Report-Msgid-Bugs-To: contact+badwolf-msgid@hacktivis.me\n" +"POT-Creation-Date: 2021-04-09 08:48+0200\n" +"PO-Revision-Date: 2021-09-29 10:51+0700\n" +"Last-Translator: Ngô Ngọc Đức Huy <huyngo@disroot.org>\n" +"Language-Team: Vietnamese\n" +"Language: vi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: downloads.c:117 +#, c-format +msgid "%02i:%02i:%02i Download cancelled" +msgstr "%02i:%02i:%02i Đã huỷ tải xuống" + +#: downloads.c:119 +#, c-format +msgid "%02i:%02i:%02i Download error" +msgstr "%02i:%02i:%02i Lỗi tải xuống" + +#: downloads.c:141 +#, c-format +msgid "%02i:%02i:%02i Download finished" +msgstr "%02i:%02i:%02i Đã tải xong" + +#: downloads.c:167 +#, c-format +msgid "%02i:%02i:%02i Downloading…" +msgstr "%02i:%02i:%02i Đang tải…" + +#: downloads.c:199 downloads.c:216 downloads.c:219 +msgid "Badwolf Downloads" +msgstr "Các tệp tin đã tải từ Badwolf" + +#: bookmarks.c:116 +msgid "Bookmarks: Done.\n" +msgstr "Dấu trang: Xong.\n" + +#: bookmarks.c:59 +#, c-format +msgid "Bookmarks: Found %d bookmarks.\n" +msgstr "Dấu trang: Đã tìm thấy %d dấu trang.\n" + +#: bookmarks.c:81 +#, c-format +msgid "Bookmarks: No loadable file found at %s\n" +msgstr "Dấu trang: Không có tệp tin nào được tìm thấy tại %s\n" + +#: bookmarks.c:85 +#, c-format +msgid "Bookmarks: loading at %s\n" +msgstr "Dấu trang: đang tải ở %s\n" + +#: bookmarks.c:99 +msgid "Bookmarks: unable to create new XPath context\n" +msgstr "Dấu trang: không thể tạo context XPath mới\n" + +#: bookmarks.c:107 +#, c-format +msgid "Bookmarks: unable to evaluate XPath expression \"%s\"\n" +msgstr "Dấu trang: không thể tính biểu thức XPath \"%s\"\n" + +#: bookmarks.c:89 +#, c-format +msgid "Bookmarks: unable to parse file \"%s\"\n" +msgstr "Dấu trang: không thể đọc tệp tin \"%s\"\n" + +#: badwolf.c:1034 +#, c-format +msgid "Buildtime WebKit version: %d.%d.%d\n" +msgstr "Phiên bản WebKit tại thời điểm dựng: %d.%d.%d\n" + +#: badwolf.c:440 +msgid "Continue" +msgstr "Tiếp tục" + +#: 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 "" +"Không thể xác thực chứng thực TLS để đảm bảo tính bảo mật của kết nối này." +"Bạn có thể muống xác thực máy của bạn và mạng.\n" + +#: badwolf.c:100 +msgid "Crashed" +msgstr "Gặp sự cố" + +#: downloads.c:39 +msgid "Download starting…" +msgstr "Bắt đầu tải xuống…" + +#: badwolf.c:413 +msgid "Error: Some unknown error occurred validating the certificate.\n" +msgstr "Lỗi: Có một lỗi không xác định đã xảy ra khi đang hợp lệ hoá chứng thực.\n" + +#: badwolf.c:394 +msgid "Error: The X509 Certificate Authority is unknown.\n" +msgstr "Lỗi: Nhà cung cấp Chứng thực X509 không được biết đến.\n" + +#: badwolf.c:407 +msgid "Error: The certificate has been revoked.\n" +msgstr "Lỗi: Chứng thực đã bị vô hiệu hoá.\n" + +#: badwolf.c:404 +msgid "Error: The certificate has expired. Check your system's clock.\n" +msgstr "Lỗi: Chứng thực đã hết hạn. Hãy kiểm tra đồng hồ hệ thống của bạn.\n" + +#: badwolf.c:410 +msgid "Error: The certificate is considered to be insecure.\n" +msgstr "Lỗi: Chứng thực được cho là không bảo mật.\n" + +#: badwolf.c:401 +msgid "Error: The certificate isn't valid yet. Check your system's clock.\n" +msgstr "" +"Lỗi: Chứng thực chưa có hiệu lực. Hãy kiểm tra đồng hồ hệ thống của bạn.\n" + +#: badwolf.c:397 +msgid "Error: The given identity doesn't match the expected one.\n" +msgstr "Lỗi: Danh tính nhận được không trùng khớp với danh tính mong đợi.\n" + +#: keybindings.c:32 +#, c-format +msgid "" +"Minimalist and privacy-oriented web browser based on WebKitGTK\n" +"Runtime WebKit version: %d.%d.%d" +msgstr "" +"Trình duyệt web tối giản và hướng đến sự riêng tư dựa trên WebKitGTK\n" +"Phiên bản WebKit tại thời điểm chạy: %d.%d.%d" + +#: badwolf.c:904 +msgid "New tab" +msgstr "Tab mới" + +#: badwolf.c:1102 +msgid "Open new tab" +msgstr "Mở tab mới" + +#: badwolf.c:104 +msgid "Out of Memory" +msgstr "Đầy bộ nhớ" + +#: badwolf.c:1032 +#, c-format +msgid "Running Badwolf version: %s\n" +msgstr "Phiên bản Badwolf đang chạy: %s\n" + +#: badwolf.c:1039 +#, c-format +msgid "Runtime WebKit version: %d.%d.%d\n" +msgstr "Phiên bản WebKit tại thời điểm chạy: %d.%d.%d\n" + +#: badwolf.c:437 +#, c-format +msgid "TLS Error for %s." +msgstr "Lỗi TLS cho %s." + +#: badwolf.c:440 +msgid "Temporarily Add Exception" +msgstr "Tạm thời thêm ngoại lệ" + +#: badwolf.c:650 +msgid "Toggle javascript" +msgstr "Bật/tắt javascript" + +#: badwolf.c:655 +msgid "Toggle loading images automatically" +msgstr "Bật/tắt tự động tải ảnh" + +#: badwolf.c:108 +msgid "Unknown Crash" +msgstr "Gặp sự cố không xác định" + +#: badwolf.c:653 +msgid "_IMG" +msgstr "_IMG" + +#: badwolf.c:648 +msgid "_JS" +msgstr "_JS" + +#: badwolf.c:982 +#, c-format +msgid "badwolf: content-filter loaded, adding to content-manager…\n" +msgstr "badwolf: đã tải bộ lọc nội dung, đang thêm vào trình quản lý nội dung…\n" + +#: badwolf.c:1002 badwolf.c:1009 +#, c-format +msgid "badwolf: failed to compile content-filters.json, err: [%d] %s\n" +msgstr "badwolf: biên dịch content-filters.json thất bại, lỗi: [%d] %s\n" + +#: badwolf.c:970 badwolf.c:975 +#, c-format +msgid "badwolf: failed to load content-filter, err: [%d] %s\n" +msgstr "badwolf: tải bộ lọc nội dung thất bại, lỗi: [%d] %s\n" + +#: badwolf.c:1060 +#, c-format +msgid "content-filters file set to: %s\n" +msgstr "tệp tin chứa bộ lọc nội dung đã được cài thành: %s\n" + +#: badwolf.c:792 +msgid "search in current page" +msgstr "tìm trong trang hiện tại" + +#: badwolf.c:99 +msgid "the web process crashed.\n" +msgstr "tiến trình web gặp sự cố.\n" + +#: badwolf.c:103 +msgid "the web process exceeded the memory limit.\n" +msgstr "tiến trình web dùng quá giới hạn bộ nhớ.\n" + +#: badwolf.c:107 +msgid "the web process terminated for an unknown reason.\n" +msgstr "tiến trình web đã kết thúc với lý do không xác định.\n" + +#: badwolf.c:1046 +#, c-format +msgid "webkit-web-extension directory set to: %s\n" +msgstr "thư mục chứa tiện ích mở rộng webkit đực cài thành: %s\n" + +#. TRANSLATOR Ignore this entry. Done for forcing Unicode in xgettext. +#: badwolf.c:1138 +msgid "ø" +msgstr "" @@ -1,9 +1,12 @@ #!/bin/sh -hash=$(git --git-dir="$(dirname $0)/.git" rev-parse --short HEAD 2>/dev/null) -branch=$(git --git-dir="$(dirname $0)/.git" rev-parse --abbrev-ref HEAD | sed -r 's/.*[^0-9A-Za-z-]([0-9A-Za-z-]*)$/\1/g') - -if [ -n "$hash" ] || [ -n "$branch" ] +if command -v git 2>/dev/null >/dev/null then - printf '+g%s.%s' "$hash" "$branch" + hash=$(git --git-dir="$(dirname $0)/.git" rev-parse --short HEAD 2>/dev/null) + branch=$(git --git-dir="$(dirname $0)/.git" rev-parse --abbrev-ref HEAD 2>/dev/null | sed -r 's/.*[^0-9A-Za-z-]([0-9A-Za-z-]*)$/\1/g') + + if [ -n "$hash" ] || [ -n "$branch" ] + then + printf '+g%s.%s' "$hash" "$branch" + fi fi echo |