[epiphany] Keep window open when closing the last tab



commit 1519ffc4cdef26f220a80ade759cd67d631a0981
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Wed Dec 19 14:31:10 2018 +0100

    Keep window open when closing the last tab
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/80

 src/ephy-window.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 56dc46af0..490c2ff34 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -2636,16 +2636,14 @@ 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));
+  if (gtk_notebook_get_n_pages (window->notebook) > 1) {
+    g_object_set_data (G_OBJECT (tab), "ephy-window-close-tab-closed", GINT_TO_POINTER (TRUE));
+    gtk_widget_destroy (GTK_WIDGET (tab));
+  } else {
+    EphyWebView *web_view = ephy_embed_get_web_view (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));
+    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]