[nautilus/wip/corey/selection-performance: 4/6] files-view: Reorganize real_update_context_menus
- From: Corey Berla <coreyberla src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/corey/selection-performance: 4/6] files-view: Reorganize real_update_context_menus
- Date: Sat, 1 Oct 2022 15:51:07 +0000 (UTC)
commit 034233bbcc99e07d8c81157eef51ce1d49b4f3ff
Author: Corey Berla <corey berla me>
Date: Sat Oct 1 08:17:18 2022 -0700
files-view: Reorganize real_update_context_menus
This doesn't have any functional changes, it is necessary for the
next commit
src/nautilus-files-view.c | 44 +++++++++++++++++++++++++-------------------
1 file changed, 25 insertions(+), 19 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index d7549b02f..9a9bfeff6 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -5136,13 +5136,15 @@ build_menu_for_extension_menu_items (NautilusFilesView *view,
}
static void
-update_extensions_menus (NautilusFilesView *view,
- GtkBuilder *builder)
+update_extensions_menus (NautilusFilesView *view)
{
GList *selection_items, *background_items;
GObject *object;
g_autoptr (GMenuModel) background_menu = NULL;
g_autoptr (GMenuModel) selection_menu = NULL;
+ g_autoptr (GtkBuilder) builder = NULL;
+
+ builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-files-view-context-menus.ui");
selection_items = get_extension_selection_menu_items (view);
if (selection_items != NULL)
@@ -7942,11 +7944,11 @@ nautilus_files_view_update_actions_state (NautilusFilesView *view)
}
static void
-update_selection_menu (NautilusFilesView *view,
- GtkBuilder *builder)
+update_selection_menu (NautilusFilesView *view)
{
NautilusFilesViewPrivate *priv = nautilus_files_view_get_instance_private (view);
g_autolist (NautilusFile) selection = NULL;
+ g_autoptr (GtkBuilder) builder = NULL;
GList *l;
gint selection_count;
gboolean show_app;
@@ -7968,6 +7970,13 @@ update_selection_menu (NautilusFilesView *view,
gint i;
GDriveStartStopType start_stop_type;
+ builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-files-view-context-menus.ui");
+
+ g_clear_object (&priv->selection_menu_model);
+
+ object = gtk_builder_get_object (builder, "selection-menu");
+ priv->selection_menu_model = g_object_ref (G_MENU (object));
+
selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
selection_count = g_list_length (selection);
@@ -8230,14 +8239,21 @@ update_selection_menu (NautilusFilesView *view,
}
static void
-update_background_menu (NautilusFilesView *view,
- GtkBuilder *builder)
+update_background_menu (NautilusFilesView *view)
{
NautilusFilesViewPrivate *priv = nautilus_files_view_get_instance_private (view);
+ g_autoptr (GtkBuilder) builder = NULL;
GObject *object;
gboolean remove_submenu = TRUE;
gint i;
+ builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-files-view-context-menus.ui");
+
+ g_clear_object (&priv->background_menu_model);
+
+ object = gtk_builder_get_object (builder, "background-menu");
+ priv->background_menu_model = g_object_ref (G_MENU (object));
+
if (nautilus_files_view_supports_creating_files (view) &&
!showing_recent_directory (view) &&
!showing_starred_directory (view))
@@ -8279,24 +8295,14 @@ static void
real_update_context_menus (NautilusFilesView *view)
{
NautilusFilesViewPrivate *priv;
- g_autoptr (GtkBuilder) builder = NULL;
- GObject *object;
priv = nautilus_files_view_get_instance_private (view);
- builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-files-view-context-menus.ui");
- g_clear_object (&priv->background_menu_model);
- g_clear_object (&priv->selection_menu_model);
- object = gtk_builder_get_object (builder, "background-menu");
- priv->background_menu_model = g_object_ref (G_MENU (object));
-
- object = gtk_builder_get_object (builder, "selection-menu");
- priv->selection_menu_model = g_object_ref (G_MENU (object));
- update_selection_menu (view, builder);
- update_background_menu (view, builder);
- update_extensions_menus (view, builder);
+ update_selection_menu (view);
+ update_background_menu (view);
+ update_extensions_menus (view);
nautilus_files_view_update_actions_state (view);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]