[nautilus/wip/exalm/libhandy] window: Close window when closing last tab
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [nautilus/wip/exalm/libhandy] window: Close window when closing last tab
- Date: Sun, 10 Jul 2022 16:25:37 +0000 (UTC)
commit a6546903daf108ca056f5503e8708c8482d0961f
Author: Christopher Davis <christopherdavis gnome org>
Date:   Sun Jul 10 12:14:09 2022 -0400
    window: Close window when closing last tab
    
    Prevents a crash from trying to update the selected
    page after the last page is closed. Instead of letting
    the code progress to that point, we simply check for
    the number of pages and close the window at the right
    point.
 src/nautilus-window.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 237782963..fe91ea92d 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -164,6 +164,12 @@ action_close_current_view (GSimpleAction *action,
     NautilusWindow *window = user_data;
     AdwTabPage *page = window->menu_page;
 
+    if (adw_tab_view_get_n_pages (window->tab_view) <= 1)
+    {
+        nautilus_window_close (window);
+        return;
+    }
+
     if (page == NULL)
     {
         page = adw_tab_view_get_selected_page (window->tab_view);
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]