[nautilus/wip/antoniof/templates-submenu-fix: 25/26] files-view: Reset templates model to NULL if unwanted




commit c87bbd97043669f508c883344740009fbf604a82
Author: António Fernandes <antoniof gnome org>
Date:   Tue Aug 23 20:14:59 2022 +0100

    files-view: Reset templates model to NULL if unwanted
    
    Otherwise the pathbar still displays the submenu in locations where
    creation of new files is not supported.
    
    Resolves https://gitlab.gnome.org/GNOME/nautilus/-/issues/2455

 src/nautilus-files-view.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index fb2b22675..eff1fe368 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -8250,6 +8250,16 @@ update_background_menu (NautilusFilesView *view,
             remove_submenu = FALSE;
         }
     }
+    else
+    {
+        /* This is necessary because the pathbar menu relies on it being NULL
+         * to hide the submenu. */
+        nautilus_view_set_templates_menu (NAUTILUS_VIEW (view), NULL);
+
+        /* And this is necessary to regenerate the templates menu when we go
+         * back to a normal folder. */
+        priv->templates_menu_updated = FALSE;
+    }
 
     i = nautilus_g_menu_model_find_by_string (G_MENU_MODEL (priv->background_menu_model),
                                               "nautilus-menu-item",


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