From ebfa85f2cfbd3770fae4f83d7457dcfb001b5fd1 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Tue, 12 Mar 2019 08:37:52 +0100 Subject: fixup: Add configuration of tab label (ellipsis, size) --- badwolf.c | 4 ++-- config.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/badwolf.c b/badwolf.c index b0fa3f1..117f19a 100644 --- a/badwolf.c +++ b/badwolf.c @@ -113,8 +113,8 @@ GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser) GtkWidget *playing = gtk_image_new_from_icon_name("media-playback-start-symbolic", GTK_ICON_SIZE_SMALL_TOOLBAR); - gtk_label_set_width_chars(GTK_LABEL(label), BADWOLF_TAB_LABEL_CHARWIDTH); // 26 - gtk_label_set_ellipsize(GTK_LABEL(label), BADWOLF_TAB_LABEL_ELLIPSIZE); // PANGO_ELLIPSIZE_MIDDLE + gtk_label_set_width_chars(GTK_LABEL(label), BADWOLF_TAB_LABEL_CHARWIDTH); + gtk_label_set_ellipsize(GTK_LABEL(label), BADWOLF_TAB_LABEL_ELLIPSIZE); gtk_label_set_single_line_mode(GTK_LABEL(label), TRUE); gtk_box_pack_start(GTK_BOX(tab_box), playing, FALSE, FALSE, 0); diff --git a/config.h b/config.h index 9202a1e..f4a8a59 100644 --- a/config.h +++ b/config.h @@ -19,6 +19,7 @@ * * See https://developer.gnome.org/pango/stable/pango-Layout-Objects.html#PangoEllipsizeMode */ +#define BADWOLF_TAB_LABEL_ELLIPSIZE PANGO_ELLIPSIZE_MIDDLE // BADWOLF_BOX_PADDING: Amount of padding between browser’s box (tab child) elements #define BADWOLF_BOX_PADDING 0 -- cgit v1.3.1-23-gd82d From 9d8d2acedf71b890c7bf0ff94f28b317b3ec1b9a Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sun, 16 Jun 2019 05:22:19 +0200 Subject: Release 0.2.1 --- badwolf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/badwolf.c b/badwolf.c index b91d4da..62eb9ea 100644 --- a/badwolf.c +++ b/badwolf.c @@ -12,7 +12,7 @@ #include const gchar *homepage = "https://hacktivis.me/projects/badwolf"; -const gchar *version = "0.2.0"; +const gchar *version = "0.2.1"; struct Window { -- cgit v1.3.1-23-gd82d From bfc4e50960f19156cb644015b185d14efdd9d55c Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 17 May 2019 12:57:30 +0200 Subject: Bugfix: correctly use initialized web_context --- badwolf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/badwolf.c b/badwolf.c index 62eb9ea..62cfc79 100644 --- a/badwolf.c +++ b/badwolf.c @@ -550,7 +550,7 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web browser->webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW, "web-context", - webkit_web_context_new_ephemeral(), + web_context, "related-view", related_web_view, "settings", -- cgit v1.3.1-23-gd82d From bdcf4d1bda0c8c3efacfeaf8a8b75f64acd4a26a Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Sat, 18 May 2019 17:15:13 +0200 Subject: badwolf.c: Fix usage of ensure_uri_scheme try_file argument --- badwolf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/badwolf.c b/badwolf.c index 62cfc79..fef7d36 100644 --- a/badwolf.c +++ b/badwolf.c @@ -456,7 +456,7 @@ locationCb_activate(GtkEntry *location, gpointer user_data) char *target_url; struct Client *browser = (struct Client *)user_data; - target_url = ensure_uri_scheme((char *)gtk_entry_get_text(location), FALSE); + target_url = ensure_uri_scheme((char *)gtk_entry_get_text(location), TRUE); if(target_url != NULL) webkit_web_view_load_uri(browser->webView, target_url); @@ -530,7 +530,7 @@ struct Client * new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web_view) { struct Client *browser = g_malloc(sizeof(struct Client)); - target_url = ensure_uri_scheme(target_url, (related_web_view != NULL)); + target_url = ensure_uri_scheme(target_url, (related_web_view == NULL)); browser->window = window; browser->box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); -- cgit v1.3.1-23-gd82d From 401c239d9be8d9162fd4459eb195bfd5b91369d1 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 14 Jun 2019 05:59:02 +0200 Subject: Sync & init the menu-label of a tab with it’s title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- badwolf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/badwolf.c b/badwolf.c index fef7d36..2d4d8df 100644 --- a/badwolf.c +++ b/badwolf.c @@ -369,7 +369,9 @@ webView_tab_label_change(struct Client *browser, const gchar *title) gtk_notebook_set_tab_label( GTK_NOTEBOOK(notebook), browser->box, badwolf_new_tab_box(title, browser)); + 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(get_tab_position(GTK_CONTAINER(notebook), browser->box) == gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook))) gtk_window_set_title(GTK_WINDOW(browser->window->main_window), title); @@ -657,6 +659,7 @@ badwolf_new_tab(GtkNotebook *notebook, struct Client *browser) gtk_notebook_set_tab_reorderable(notebook, browser->box, TRUE); gtk_notebook_set_tab_label(notebook, browser->box, badwolf_new_tab_box(title, browser)); + gtk_notebook_set_menu_label_text(GTK_NOTEBOOK(notebook), browser->box, title); gtk_widget_queue_draw(GTK_WIDGET(notebook)); -- cgit v1.3.1-23-gd82d From b3426f0fe4b262bda2473ad142e5099f0436e5dd Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 17 Jun 2019 06:36:00 +0200 Subject: Bugfix: don't abort on malloc failure --- badwolf.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/badwolf.c b/badwolf.c index 2d4d8df..d882547 100644 --- a/badwolf.c +++ b/badwolf.c @@ -531,9 +531,11 @@ SearchEntryCb_stop__search(GtkSearchEntry *search, gpointer user_data) struct Client * new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web_view) { - struct Client *browser = g_malloc(sizeof(struct Client)); + struct Client *browser = g_try_malloc(sizeof(struct Client)); target_url = ensure_uri_scheme(target_url, (related_web_view == NULL)); + if(browser == NULL) return NULL; + browser->window = window; browser->box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); browser->toolbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); @@ -644,12 +646,21 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web return browser; } +/* badwolf_new_tab: Inserts struct Client *browser in GtkNotebook *notebook + * + * returns: + * 0 : Ran successfully + * -1 : Failed to insert a page for browser->box + * -2 : browser is NULL + */ int badwolf_new_tab(GtkNotebook *notebook, struct Client *browser) { gint current_page = gtk_notebook_get_current_page(notebook); gchar *title = _("New tab"); + if(browser == NULL) return -2; + gtk_widget_show_all(browser->box); if(gtk_notebook_insert_page(notebook, browser->box, NULL, (current_page + 2)) == -1) @@ -710,6 +721,7 @@ get_tab_position(GtkContainer *notebook, GtkWidget *child) int main(int argc, char *argv[]) { + // getting an abort if this one fails to alloc struct Window *window = g_malloc(sizeof(struct Client)); gchar *target_url = NULL; -- cgit v1.3.1-23-gd82d From a7976a3530a69823ceff4b58773886c3e15a5d6c Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 17 Jun 2019 06:38:40 +0200 Subject: Bugfix: fix wrong argument to sizeof for *window g_malloc --- badwolf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/badwolf.c b/badwolf.c index d882547..67979b7 100644 --- a/badwolf.c +++ b/badwolf.c @@ -722,7 +722,7 @@ int main(int argc, char *argv[]) { // getting an abort if this one fails to alloc - struct Window *window = g_malloc(sizeof(struct Client)); + struct Window *window = g_malloc(sizeof(struct Window)); gchar *target_url = NULL; setlocale(LC_ALL, ""); -- cgit v1.3.1-23-gd82d From 404358779b24f0c4b54cdd63a9aa9c8d4d7f01c2 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Mon, 17 Jun 2019 07:01:41 +0200 Subject: badwolf.1: Add missing doc on some keybinds --- badwolf.1 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/badwolf.1 b/badwolf.1 index 54ce1ac..01af4e8 100644 --- a/badwolf.1 +++ b/badwolf.1 @@ -20,10 +20,12 @@ will probably get added at a later release. .Sh KEYBINDINGS The following section lists the keybinding by their action, each item is described by the widget the focus is on or .Aq any -if it works for the whole window, followed by the keybind it grabs. C is short for Control, S is short for Shift. +if it works for the whole window, followed by the keybind it grabs. A is short for Alt, C is short for Control, S is short for Shift. .Bl -width Ds -tag .It webview C-Scroll Zooms the webpage in/out. +.It webview C-0 +Resets webpage zoom to 100%. .It any C-t Creates a new tab (in a new session, similar as pressing the button) .It browser C-F4 @@ -32,10 +34,14 @@ Closes the current tab Focuses on the search entry .It browser C-l Focuses on the location(URL) entry -.It browser C-S-r / C-r +.It browser C-S-r / C-r, browser F5 Reloads the current tab (with/without clearing cache) -.It browser Alt-[ / C-] +.It browser C-[ / C-] Go back/forward in current tab’s history +.It any A-Left / A-Right +Go to the previous/next tab +.It any F1 +Shows the about dialog .El .Ss DEFAULT ONES Here is a incomplete list of the default Webkit/GTK keybindings: -- cgit v1.3.1-23-gd82d From 1f94afe441c6b4ba0700923ed9a1475f091e2364 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Thu, 13 Jun 2019 02:51:37 +0200 Subject: only display mouse hover uri when it is a link --- badwolf.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/badwolf.c b/badwolf.c index 67979b7..cecfb96 100644 --- a/badwolf.c +++ b/badwolf.c @@ -406,11 +406,17 @@ WebViewCb_mouse_target_changed(WebKitWebView *webView, (void)webView; (void)modifiers; struct Client *browser = (struct Client *)user_data; - const gchar *link_uri = webkit_hit_test_result_get_link_uri(hit); - gtk_label_set_text(GTK_LABEL(browser->statuslabel), webkit_uri_for_display(link_uri)); + if(webkit_hit_test_result_context_is_link(hit)) + { + const gchar *link_uri = webkit_hit_test_result_get_link_uri(hit); - return TRUE; + gtk_label_set_text(GTK_LABEL(browser->statuslabel), webkit_uri_for_display(link_uri)); + } + else + gtk_label_set_text(GTK_LABEL(browser->statuslabel), NULL); + + return FALSE; } static gboolean -- cgit v1.3.1-23-gd82d From 582b91d23bd1eba52f77ba1cc68a21f8061ea50a Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 21 Jun 2019 00:28:59 +0200 Subject: badwolf.c: Try +1 on current_page when creating a tab again --- badwolf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/badwolf.c b/badwolf.c index cecfb96..2ba2bda 100644 --- a/badwolf.c +++ b/badwolf.c @@ -669,7 +669,7 @@ badwolf_new_tab(GtkNotebook *notebook, struct Client *browser) gtk_widget_show_all(browser->box); - if(gtk_notebook_insert_page(notebook, browser->box, NULL, (current_page + 2)) == -1) + if(gtk_notebook_insert_page(notebook, browser->box, NULL, (current_page + 1)) == -1) { return -1; } -- cgit v1.3.1-23-gd82d