[nautilus/wip/antoniof/use-cached-templates-menu-model: 1/5] files-view: Clear :templates-menu if it should not be used




commit c6cd28baec54da99d9b8cf58741d57fb10928278
Author: António Fernandes <antoniof gnome org>
Date:   Tue Oct 26 17:05:31 2021 +0100

    files-view: Clear :templates-menu if it should not be used
    
    If the templates dir is set to Home, then it should not be used.
    We set the priv->templates_present boolean to FALSE in that case,
    but forget to set the :templates-menu property to NULL too.
    
    Fix that corner case issue. Also, drop the useless boolean and
    just check directly whether the menu is present (i.e. not NULL).

 src/nautilus-files-view.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 4e57ae61e..8f7c1586b 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -220,7 +220,6 @@ typedef struct
      * after it finishes loading the directory and its view.
      */
     gboolean loading;
-    gboolean templates_present;
     gboolean scripts_present;
 
     gboolean in_destruction;
@@ -5895,7 +5894,7 @@ update_templates_menu (NautilusFilesView *view,
     }
     else
     {
-        priv->templates_present = FALSE;
+        nautilus_view_set_templates_menu (NAUTILUS_VIEW (view), NULL);
         return;
     }
 
@@ -5929,8 +5928,6 @@ update_templates_menu (NautilusFilesView *view,
 
     nautilus_directory_unref (directory);
 
-    priv->templates_present = submenu != NULL;
-
     g_free (templates_directory_uri);
 }
 
@@ -7967,7 +7964,7 @@ real_update_actions_state (NautilusFilesView *view)
                                  can_create_files &&
                                  !selection_contains_recent &&
                                  !selection_contains_starred &&
-                                 priv->templates_present);
+                                 priv->templates_menu != NULL);
 
     /* Actions that are related to the clipboard need request, request the data
      * and update them once we have the data */


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