[gnome-text-editor/gnome-41] window: fix ctrl+w after last page is closed



commit 225a650b6481cd7dc53f431c05557718da55ed06
Author: Christian Hergert <chergert redhat com>
Date:   Wed Oct 6 10:12:39 2021 -0700

    window: fix ctrl+w after last page is closed
    
    Fixes #173

 src/editor-window-actions.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/editor-window-actions.c b/src/editor-window-actions.c
index c38ad6c..adf33d1 100644
--- a/src/editor-window-actions.c
+++ b/src/editor-window-actions.c
@@ -56,15 +56,18 @@ editor_window_actions_close_page_cb (GtkWidget  *widget,
 
   g_assert (EDITOR_IS_WINDOW (self));
 
+  if (editor_window_get_visible_page (self) == NULL)
+    {
+      gtk_window_close (GTK_WINDOW (self));
+      return;
+    }
+
   if ((page = editor_window_get_visible_page (self)) &&
       _editor_window_request_close_page (self, page))
     {
       EditorSession *session = editor_application_get_session (EDITOR_APPLICATION_DEFAULT);
 
       editor_session_remove_page (session, page);
-
-      if (editor_window_get_visible_page (self) == NULL)
-        gtk_window_close (GTK_WINDOW (self));
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]