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




commit f39e807cc2b701de6816b2d6641df72c96d110eb
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.

 src/nautilus-files-view.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index fb2b22675..b05499759 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -8250,6 +8250,12 @@ 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);
+    }
 
     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]