[epiphany] Keep window open when closing the last non overview tab
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Keep window open when closing the last non overview tab
- Date: Mon, 24 Dec 2018 19:15:36 +0000 (UTC)
commit fed1608828d009f4e8d27b8da8c1f6503a5c9e32
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Wed Dec 19 14:31:10 2018 +0100
Keep window open when closing the last non overview tab
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/80
src/ephy-window.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 6273c739d..6670babcc 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -2627,6 +2627,8 @@ static void
ephy_window_close_tab (EphyWindow *window,
EphyEmbed *tab)
{
+ EphyWebView *web_view;
+
/* This function can be called many times for the same embed if the
* web process (or network process) has hung. E.g. the user could
* click the close button several times. This is difficult to guard
@@ -2648,16 +2650,21 @@ ephy_window_close_tab (EphyWindow *window,
if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tab), "ephy-window-close-tab-closed")))
return;
- g_object_set_data (G_OBJECT (tab), "ephy-window-close-tab-closed", GINT_TO_POINTER (TRUE));
- gtk_widget_destroy (GTK_WIDGET (tab));
+ web_view = ephy_embed_get_web_view (tab);
+ if (gtk_notebook_get_n_pages (window->notebook) > 1 || ephy_web_view_is_overview (web_view)) {
+ g_object_set_data (G_OBJECT (tab), "ephy-window-close-tab-closed", GINT_TO_POINTER (TRUE));
+ gtk_widget_destroy (GTK_WIDGET (tab));
- /* If that was the last tab, destroy the window.
- *
- * Beware: window->closing could be true now, after destroying the
- * tab, even if it wasn't at the start of this function.
- */
- if (!window->closing && gtk_notebook_get_n_pages (window->notebook) == 0)
- gtk_widget_destroy (GTK_WIDGET (window));
+ /* If that was the last tab, destroy the window.
+ *
+ * Beware: window->closing could be true now, after destroying the
+ * tab, even if it wasn't at the start of this function.
+ */
+ if (!window->closing && gtk_notebook_get_n_pages (window->notebook) == 0)
+ gtk_widget_destroy (GTK_WIDGET (window));
+ } else {
+ ephy_web_view_load_url (web_view, "about:overview");
+ }
}
typedef struct {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]