[nautilus/wip/antoniof/use-cached-templates-menu-model: 3/5] files-view: Add scripts_menu cache
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/use-cached-templates-menu-model: 3/5] files-view: Add scripts_menu cache
- Date: Tue, 26 Oct 2021 16:45:03 +0000 (UTC)
commit 6ccb029feef942773dbd59ddbad16b3ad33254ed
Author: António Fernandes <antoniof gnome org>
Date: Tue Oct 26 17:20:30 2021 +0100
files-view: Add scripts_menu cache
The cache is not used yet, but is needed for the next commit.
Also, remove scripts_present boolean, now that we can directly check
whether the scripts_menu is present (i.e., not NULL).
src/nautilus-files-view.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index afadd42ae..7dcd15020 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -221,7 +221,6 @@ typedef struct
* after it finishes loading the directory and its view.
*/
gboolean loading;
- gboolean scripts_present;
gboolean in_destruction;
@@ -276,6 +275,9 @@ typedef struct
GMenuModel *extensions_background_menu;
GMenuModel *templates_menu;
+ /* Non exported menu, only for caching */
+ GMenuModel *scripts_menu;
+
gulong stop_signal_handler;
gulong reload_signal_handler;
@@ -5607,6 +5609,7 @@ update_scripts_menu (NautilusFilesView *view,
directory = nautilus_directory_get_by_uri (scripts_directory_uri);
submenu = update_directory_in_scripts_menu (view, directory);
+ g_set_object (&priv->scripts_menu, G_MENU_MODEL (submenu));
if (submenu != NULL)
{
GObject *object;
@@ -5619,8 +5622,6 @@ update_scripts_menu (NautilusFilesView *view,
}
nautilus_directory_unref (directory);
-
- priv->scripts_present = submenu != NULL;
}
static void
@@ -7928,7 +7929,7 @@ real_update_actions_state (NautilusFilesView *view)
action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
"scripts");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
- priv->scripts_present);
+ priv->scripts_menu != NULL);
/* Background menu actions */
action = g_action_map_lookup_action (G_ACTION_MAP (view_action_group),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]