commit: e2b66bcb48a0170481966d23d371f2e4cbc3423f
parent: 911b61968acb8d85584a047a123e1e80c6b46b1c
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 13 Apr 2019 21:06:13 +0200
hotfix WebViewCb_web_process_terminated changes
Diffstat:
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/badwolf.c b/badwolf.c
@@ -33,7 +33,8 @@ struct Client
static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data);
static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView,
- WebKitWebProcessTerminationReason reason);
+ WebKitWebProcessTerminationReason reason,
+ gpointer user_data);
static gboolean
WebViewCb_notify__uri(WebKitWebView *webView, GParamSpec *pspec, gpointer user_data);
GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser);
@@ -84,15 +85,16 @@ WebViewCb_close(WebKitWebView *webView, gpointer user_data)
}
static gboolean
-WebViewCb_web_process_terminated(WebKitWebView *webView, WebKitWebProcessTerminationReason reason)
+WebViewCb_web_process_terminated(WebKitWebView *webView, WebKitWebProcessTerminationReason reason, gpointer user_data)
{
(void)webView;
+ struct Client *browser = (struct Client *)user_data;
switch(reason)
{
- case WEBKIT_WEB_PROCESS_CRASHED: g_fprintf(stderr, "the web process crashed."; webView_tab_label_change(browser, "Crashed"); break;
+ case WEBKIT_WEB_PROCESS_CRASHED: g_fprintf(stderr, "the web process crashed."); webView_tab_label_change(browser, "Crashed"); break;
case WEBKIT_WEB_PROCESS_EXCEEDED_MEMORY_LIMIT:
- g_fprintf(stderr, "the web process exceeded the memory limit.";
+ g_fprintf(stderr, "the web process exceeded the memory limit.");
webView_tab_label_change(browser, "Out of Memory");
break;
default: g_fprintf(stderr, "the web process terminated for an unknown reason.");
@@ -177,11 +179,11 @@ webView_tab_label_change(struct Client *browser, const gchar *title)
{
GtkWidget *notebook = browser->window->notebook;
- if(title == NULL || title == "") title = webkit_web_view_get_title(browser->webView);
-
- if(title == NULL || title == "") title = webkit_web_view_get_uri(browser->webView);
+#define title_IS_EMPTY (title == NULL) || (title == "")
- if(title == NULL || title == "") title = "BadWolf";
+ if(title_IS_EMPTY) title = webkit_web_view_get_title(browser->webView);
+ if(title_IS_EMPTY) title = webkit_web_view_get_uri(browser->webView);
+ if(title_IS_EMPTY) title = "BadWolf";
gtk_notebook_set_tab_label(
GTK_NOTEBOOK(notebook), browser->box, badwolf_new_tab_box(title, browser));