Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitc323b97f353e6f5b0d363fb460f0de92028bad29 (patch)
Author
 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
2019-04-01 21:51:08 +0200
Committer
 Haelwenn (lanodan) Monnier <contact@hacktivis.me>
2019-04-01 23:34:21 +0200
Files6b990d6815fdf5eb1202472e5b52abed379af657
goodwolf-c323b97f353e6f5b0d363fb460f0de92028bad29.tar
goodwolf-c323b97f353e6f5b0d363fb460f0de92028bad29.tar.gz
goodwolf-c323b97f353e6f5b0d363fb460f0de92028bad29.zip
Parent71c47bfd0512ebe544faacef3d20f62b2351d5d1 (diff)
badwolf.c: Close the WebView
WebKitNetworkProcess seems to be remnant but at least the view closes more properly
1 files changed, 16 insertions, 10 deletions
-rw-r--r--badwolf.c26
diff --git a/badwolf.c b/badwolf.c
index be7aef0..724b4ab 100644
--- a/badwolf.c
+++ b/badwolf.c
@@ -29,7 +29,7 @@ struct Client
struct Window *window;
};
-static gboolean WebViewCb_close(WebKitWebView *webView, GtkWidget *window);
+static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data);
static gboolean WebViewCb_web_process_terminated(WebKitWebView *webView,
WebKitWebProcessTerminationReason reason);
static gboolean
@@ -63,10 +63,22 @@ int badwolf_new_tab(GtkNotebook *notebook, struct Client *browser);
GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser);
int main(int argc, char *argv[]);
-static gboolean WebViewCb_close(WebKitWebView *webView, GtkWidget *window)
+static gboolean WebViewCb_close(WebKitWebView *webView, gpointer user_data)
{
(void)webView;
- gtk_widget_destroy(window);
+ struct Client *browser = (struct Client *)user_data;
+ GtkNotebook *notebook = GTK_NOTEBOOK(browser->window->notebook);
+ GValue position = G_VALUE_INIT;
+ g_value_init(&position, G_TYPE_INT);
+
+ gtk_container_child_get_property(GTK_CONTAINER(notebook), browser->box, "position", &position);
+
+ gtk_notebook_remove_page(notebook, g_value_get_int(&position));
+
+ gtk_widget_destroy(browser->box);
+
+ free(browser);
+
return TRUE;
}
@@ -428,14 +440,8 @@ void closeCb_clicked(GtkButton *close, gpointer user_data)
{
(void)close;
struct Client *browser = (struct Client *)user_data;
- GtkNotebook *notebook = GTK_NOTEBOOK(browser->window->notebook);
- GValue position = G_VALUE_INIT;
- g_value_init(&position, G_TYPE_INT);
- gtk_container_child_get_property(GTK_CONTAINER(notebook), browser->box, "position", &position);
-
- gtk_notebook_remove_page(notebook, g_value_get_int(&position));
- free(browser);
+ webkit_web_view_try_close(browser->webView);
}
int main(int argc, char *argv[])