logo

badwolf

minimalist and privacy-oriented web browser based on WebKitGTK git clone https://hacktivis.me/git/badwolf.git
commit: 0728f8a127f4dc14e438b9912feefc2799aa8ba2
parent d995f70a93c8701b0bb881e10ba19f367badc950
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat, 13 Apr 2019 20:28:51 +0200

webView_tab_label_change: Add title argument (nullable)

Diffstat:

Mbadwolf.c17++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/badwolf.c b/badwolf.c @@ -41,7 +41,7 @@ static gboolean WebViewCb_notify__title(WebKitWebView *webView, GParamSpec *pspec, gpointer user_data); static gboolean WebViewCb_notify__is__playing__audio(WebKitWebView *webView, GParamSpec *pspec, gpointer user_data); -void webView_tab_label_change(struct Client *browser); +void webView_tab_label_change(struct Client *browser, const gchar *title); static gboolean WebViewCb_notify__estimated_load_progress(WebKitWebView *webView, GParamSpec *pspec, gpointer user_data); @@ -156,7 +156,7 @@ WebViewCb_notify__title(WebKitWebView *webView, GParamSpec *pspec, gpointer user (void)pspec; struct Client *browser = (struct Client *)user_data; - webView_tab_label_change(browser); + webView_tab_label_change(browser, NULL); return TRUE; } @@ -168,22 +168,21 @@ WebViewCb_notify__is__playing__audio(WebKitWebView *webView, GParamSpec *pspec, (void)pspec; struct Client *browser = (struct Client *)user_data; - webView_tab_label_change(browser); + webView_tab_label_change(browser, NULL); return TRUE; } void -webView_tab_label_change(struct Client *browser) +webView_tab_label_change(struct Client *browser, const gchar *title) { - const gchar *title; GtkWidget *notebook = browser->window->notebook; - title = webkit_web_view_get_title(browser->webView); + if(title == NULL || title == "") title = webkit_web_view_get_title(browser->webView); - if(title == NULL) title = webkit_web_view_get_uri(browser->webView); + if(title == NULL || title == "") title = webkit_web_view_get_uri(browser->webView); - if(title == NULL) title = "BadWolf"; + if(title == NULL || title == "") title = "BadWolf"; gtk_notebook_set_tab_label( GTK_NOTEBOOK(notebook), browser->box, badwolf_new_tab_box(title, browser)); @@ -405,7 +404,7 @@ new_browser(struct Window *window, gchar *target_url, WebKitWebView *related_web g_signal_connect(browser->webView, "web-process-terminated", G_CALLBACK(WebViewCb_web_process_terminated), - NULL); + browser); g_signal_connect(browser->webView, "notify::uri", G_CALLBACK(WebViewCb_notify__uri), browser); g_signal_connect(browser->webView, "notify::title", G_CALLBACK(WebViewCb_notify__title), browser); g_signal_connect(browser->webView,