[nautilus/wip/antoniof/three-menus-no-more: 6/7] toolbar-menu-sections: Remove and cleanup




commit 1e452e1f3937219e4159ccbc2097a7ac0f684b3f
Author: António Fernandes <antoniof gnome org>
Date:   Sun Jul 31 22:33:39 2022 +0100

    toolbar-menu-sections: Remove and cleanup
    
    There is no use for this now.

 src/meson.build                      |  1 -
 src/nautilus-files-view.c            | 36 +++++-------------------------------
 src/nautilus-places-view.c           |  8 --------
 src/nautilus-toolbar-menu-sections.h | 30 ------------------------------
 src/nautilus-toolbar.c               | 36 ------------------------------------
 src/nautilus-types.h                 |  1 -
 src/nautilus-view.c                  | 18 ------------------
 src/nautilus-view.h                  |  8 --------
 src/nautilus-window-slot.c           | 26 --------------------------
 src/nautilus-window-slot.h           |  2 --
 10 files changed, 5 insertions(+), 161 deletions(-)
---
diff --git a/src/meson.build b/src/meson.build
index a0c92c92b..2176f1d29 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -124,7 +124,6 @@ libnautilus_sources = [
   'nautilus-star-cell.h',
   'nautilus-toolbar.c',
   'nautilus-toolbar.h',
-  'nautilus-toolbar-menu-sections.h',
   'nautilus-trash-bar.c',
   'nautilus-trash-bar.h',
   'nautilus-view.c',
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index d6bc389f0..ca0d54b23 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -258,8 +258,7 @@ typedef struct
     guint floating_bar_set_passthrough_timeout_id;
     GtkWidget *floating_bar;
 
-    /* Toolbar menu */
-    NautilusToolbarMenuSections *toolbar_menu_sections;
+    GMenuModel *sort_menu;
 
     /* Exposed menus, for the path bar etc. */
     GMenuModel *extensions_background_menu;
@@ -723,28 +722,6 @@ nautilus_files_view_reveal_selection (NautilusFilesView *view)
     NAUTILUS_FILES_VIEW_CLASS (G_OBJECT_GET_CLASS (view))->reveal_selection (view);
 }
 
-/**
- * nautilus_files_view_get_toolbar_menu_sections:
- * @view: a #NautilusFilesView
- *
- * Retrieves the menu sections that should be added to the toolbar menu when
- * this view is active
- *
- * Returns: (transfer none): a #NautilusToolbarMenuSections with the details of
- * which menu sections should be added to the menu
- */
-static NautilusToolbarMenuSections *
-nautilus_files_view_get_toolbar_menu_sections (NautilusView *view)
-{
-    NautilusFilesViewPrivate *priv;
-
-    g_return_val_if_fail (NAUTILUS_IS_FILES_VIEW (view), NULL);
-
-    priv = nautilus_files_view_get_instance_private (NAUTILUS_FILES_VIEW (view));
-
-    return priv->toolbar_menu_sections;
-}
-
 static GMenuModel *
 nautilus_files_view_get_templates_menu (NautilusView *self)
 {
@@ -3316,7 +3293,6 @@ nautilus_files_view_finalize (GObject *object)
     g_clear_object (&priv->view_action_group);
     g_clear_object (&priv->background_menu_model);
     g_clear_object (&priv->selection_menu_model);
-    g_clear_object (&priv->toolbar_menu_sections->sort_section);
     g_clear_object (&priv->extensions_background_menu);
     g_clear_object (&priv->templates_menu);
     g_clear_object (&priv->rename_file_controller);
@@ -3325,7 +3301,7 @@ nautilus_files_view_finalize (GObject *object)
     /* We don't own the slot, so no unref */
     priv->slot = NULL;
 
-    g_free (priv->toolbar_menu_sections);
+    g_clear_object (&priv->sort_menu);
 
     g_hash_table_destroy (priv->non_ready_files);
     g_hash_table_destroy (priv->pending_reveal);
@@ -8214,7 +8190,7 @@ nautilus_files_view_reset_view_menu (NautilusFilesView *view)
 {
     NautilusFilesViewPrivate *priv = nautilus_files_view_get_instance_private (view);
     NautilusFile *file;
-    GMenuModel *sort_section = priv->toolbar_menu_sections->sort_section;
+    GMenuModel *sort_section = priv->sort_menu;
     const gchar *action;
     gint i;
 
@@ -9371,7 +9347,6 @@ nautilus_files_view_iface_init (NautilusViewInterface *iface)
     iface->set_selection = nautilus_files_view_set_selection;
     iface->get_search_query = nautilus_files_view_get_search_query;
     iface->set_search_query = nautilus_files_view_set_search_query;
-    iface->get_toolbar_menu_sections = nautilus_files_view_get_toolbar_menu_sections;
     iface->is_searching = nautilus_files_view_is_searching;
     iface->is_loading = nautilus_files_view_is_loading;
     iface->get_view_id = nautilus_files_view_get_view_id;
@@ -9598,8 +9573,7 @@ nautilus_files_view_init (NautilusFilesView *view)
 
     /* Toolbar menu */
     builder = gtk_builder_new_from_resource ("/org/gnome/nautilus/ui/nautilus-toolbar-view-menu.ui");
-    priv->toolbar_menu_sections = g_new0 (NautilusToolbarMenuSections, 1);
-    priv->toolbar_menu_sections->sort_section = G_MENU_MODEL (g_object_ref (gtk_builder_get_object (builder, 
"sort_section")));
+    priv->sort_menu = G_MENU_MODEL (g_object_ref (gtk_builder_get_object (builder, "sort_section")));
 
     g_signal_connect (view,
                       "end-file-changes",
@@ -9620,7 +9594,7 @@ nautilus_files_view_init (NautilusFilesView *view)
     gtk_widget_init_template (GTK_WIDGET (view));
 
     gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (priv->sort_menu_button),
-                                    priv->toolbar_menu_sections->sort_section);
+                                    priv->sort_menu);
 
     controller = gtk_event_controller_scroll_new (GTK_EVENT_CONTROLLER_SCROLL_VERTICAL |
                                                   GTK_EVENT_CONTROLLER_SCROLL_DISCRETE);
diff --git a/src/nautilus-places-view.c b/src/nautilus-places-view.c
index 30c944c8a..aa87db2bd 100644
--- a/src/nautilus-places-view.c
+++ b/src/nautilus-places-view.c
@@ -23,7 +23,6 @@
 
 #include "nautilus-application.h"
 #include "nautilus-file.h"
-#include "nautilus-toolbar-menu-sections.h"
 #include "nautilus-view.h"
 #include "nautilus-window-slot.h"
 
@@ -303,12 +302,6 @@ nautilus_places_view_set_search_query (NautilusView  *view,
     g_free (text);
 }
 
-static NautilusToolbarMenuSections *
-nautilus_places_view_get_toolbar_menu_sections (NautilusView *view)
-{
-    return NULL;
-}
-
 static gboolean
 nautilus_places_view_is_loading (NautilusView *view)
 {
@@ -344,7 +337,6 @@ nautilus_places_view_iface_init (NautilusViewInterface *iface)
     iface->set_selection = nautilus_places_view_set_selection;
     iface->get_search_query = nautilus_places_view_get_search_query;
     iface->set_search_query = nautilus_places_view_set_search_query;
-    iface->get_toolbar_menu_sections = nautilus_places_view_get_toolbar_menu_sections;
     iface->is_loading = nautilus_places_view_is_loading;
     iface->is_searching = nautilus_places_view_is_searching;
     iface->get_view_id = nautilus_places_view_get_view_id;
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 131ebdf82..7522c4212 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -34,7 +34,6 @@
 #include "nautilus-pathbar.h"
 #include "nautilus-progress-info-manager.h"
 #include "nautilus-progress-info-widget.h"
-#include "nautilus-toolbar-menu-sections.h"
 #include "nautilus-ui-utilities.h"
 #include "nautilus-window.h"
 
@@ -71,8 +70,6 @@ struct _NautilusToolbar
     GtkWidget *operations_revealer;
     GtkWidget *operations_icon;
 
-    GtkWidget *view_toggle_button;
-
     GtkWidget *app_button;
     GMenuModel *undo_redo_section;
 
@@ -1178,7 +1175,6 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass)
     gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, operations_popover);
     gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, operations_list);
     gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, operations_revealer);
-    gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_toggle_button);
     gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, app_button);
     gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, undo_redo_section);
     gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, back_button);
@@ -1263,34 +1259,6 @@ slot_on_templates_menu_changed (NautilusToolbar    *self,
                                           menu);
 }
 
-static void
-on_slot_toolbar_menu_sections_changed (NautilusToolbar    *self,
-                                       GParamSpec         *param,
-                                       NautilusWindowSlot *slot)
-{
-    NautilusToolbarMenuSections *new_sections;
-    g_autoptr (GMenuItem) zoom_item = NULL;
-    g_autoptr (GMenuItem) sort_item = NULL;
-
-    new_sections = nautilus_window_slot_get_toolbar_menu_sections (slot);
-
-    gtk_widget_set_sensitive (self->view_toggle_button, (new_sections != NULL));
-}
-
-
-static void
-disconnect_toolbar_menu_sections_change_handler (NautilusToolbar *self)
-{
-    if (self->window_slot == NULL)
-    {
-        return;
-    }
-
-    g_signal_handlers_disconnect_by_func (self->window_slot,
-                                          G_CALLBACK (on_slot_toolbar_menu_sections_changed),
-                                          self);
-}
-
 /* Called from on_window_slot_destroyed(), since bindings and signal handlers
  * are automatically removed once the slot goes away.
  */
@@ -1313,9 +1281,6 @@ nautilus_toolbar_set_window_slot_real (NautilusToolbar    *self,
                                                        self, "searching",
                                                        G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
 
-        on_slot_toolbar_menu_sections_changed (self, NULL, self->window_slot);
-        g_signal_connect_swapped (self->window_slot, "notify::toolbar-menu-sections",
-                                  G_CALLBACK (on_slot_toolbar_menu_sections_changed), self);
         g_signal_connect_swapped (self->window_slot, "notify::extensions-background-menu",
                                   G_CALLBACK (slot_on_extensions_background_menu_changed), self);
         g_signal_connect_swapped (self->window_slot, "notify::templates-menu",
@@ -1352,7 +1317,6 @@ nautilus_toolbar_set_window_slot (NautilusToolbar    *self,
 
     g_clear_pointer (&self->search_binding, g_binding_unbind);
 
-    disconnect_toolbar_menu_sections_change_handler (self);
     if (self->window_slot != NULL)
     {
         g_signal_handlers_disconnect_by_data (self->window_slot, self);
diff --git a/src/nautilus-types.h b/src/nautilus-types.h
index 6a13ebb6d..714508c77 100644
--- a/src/nautilus-types.h
+++ b/src/nautilus-types.h
@@ -41,7 +41,6 @@ typedef struct _NautilusListBase            NautilusListBase;
 typedef struct  NautilusMonitor             NautilusMonitor;
 typedef struct _NautilusQuery               NautilusQuery;
 typedef struct _NautilusQueryEditor         NautilusQueryEditor;
-typedef struct _NautilusToolbarMenuSections NautilusToolbarMenuSections;
 typedef struct _NautilusView                NautilusView;
 typedef struct _NautilusWindow              NautilusWindow;
 typedef struct _NautilusWindowSlot          NautilusWindowSlot;
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 2463ba632..117136a7a 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -179,24 +179,6 @@ nautilus_view_get_view_id (NautilusView *view)
     return NAUTILUS_VIEW_GET_IFACE (view)->get_view_id (view);
 }
 
-/**
- * nautilus_view_get_toolbar_menu_sections:
- * @view: a #NautilusView
- *
- * Retrieves the menu sections to show in the main toolbar menu when this view
- * is active
- *
- * Returns: (transfer none): a #NautilusToolbarMenuSections with the sections to
- * be displayed
- */
-NautilusToolbarMenuSections *
-nautilus_view_get_toolbar_menu_sections (NautilusView *view)
-{
-    g_return_val_if_fail (NAUTILUS_VIEW_GET_IFACE (view)->get_toolbar_menu_sections, NULL);
-
-    return NAUTILUS_VIEW_GET_IFACE (view)->get_toolbar_menu_sections (view);
-}
-
 GMenuModel *
 nautilus_view_get_extensions_background_menu (NautilusView *view)
 {
diff --git a/src/nautilus-view.h b/src/nautilus-view.h
index 9a8911e28..431b7989c 100644
--- a/src/nautilus-view.h
+++ b/src/nautilus-view.h
@@ -22,7 +22,6 @@
 #include <gtk/gtk.h>
 
 #include "nautilus-query.h"
-#include "nautilus-toolbar-menu-sections.h"
 
 /* Keep values in sync with the org.gnome.nautilus.FolderView schema enums: */
 #define NAUTILUS_VIEW_LIST_ID            1
@@ -42,11 +41,6 @@ struct _NautilusViewInterface
         GTypeInterface parent;
 
         guint                           (*get_view_id)               (NautilusView         *view);
-        /*
-         * Returns the menu sections that should be shown in the toolbar menu
-         * when this view is active. Implementations must not return %NULL
-         */
-        NautilusToolbarMenuSections *   (*get_toolbar_menu_sections) (NautilusView         *view);
 
         /*
          * Returns the menu for the background click of extensions.
@@ -90,8 +84,6 @@ const gchar *                        nautilus_view_get_tooltip               (gu
 
 guint                          nautilus_view_get_view_id               (NautilusView         *view);
 
-NautilusToolbarMenuSections *  nautilus_view_get_toolbar_menu_sections (NautilusView         *view);
-
 GFile *                        nautilus_view_get_location              (NautilusView         *view);
 
 void                           nautilus_view_set_location              (NautilusView         *view,
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 976429e27..ac7ec49e8 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -54,7 +54,6 @@ enum
     PROP_ACTIVE = 1,
     PROP_WINDOW,
     PROP_ICON_NAME,
-    PROP_TOOLBAR_MENU_SECTIONS,
     PROP_EXTENSIONS_BACKGROUND_MENU,
     PROP_TEMPLATES_MENU,
     PROP_LOADING,
@@ -825,12 +824,6 @@ nautilus_window_slot_get_property (GObject    *object,
         }
         break;
 
-        case PROP_TOOLBAR_MENU_SECTIONS:
-        {
-            g_value_set_object (value, nautilus_window_slot_get_toolbar_menu_sections (self));
-        }
-        break;
-
         case PROP_EXTENSIONS_BACKGROUND_MENU:
         {
             g_value_set_object (value, real_get_extensions_background_menu (self));
@@ -2864,7 +2857,6 @@ nautilus_window_slot_switch_new_content_view (NautilusWindowSlot *self)
                                                                self, "templates-menu",
                                                                G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
         g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ICON_NAME]);
-        g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TOOLBAR_MENU_SECTIONS]);
         g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_EXTENSIONS_BACKGROUND_MENU]);
         g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TEMPLATES_MENU]);
         g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TOOLTIP]);
@@ -3044,12 +3036,6 @@ nautilus_window_slot_class_init (NautilusWindowSlotClass *klass)
                              NULL,
                              G_PARAM_READABLE);
 
-    properties[PROP_TOOLBAR_MENU_SECTIONS] =
-        g_param_spec_pointer ("toolbar-menu-sections",
-                              "Menu sections for the toolbar menu",
-                              "The menu sections to add to the toolbar menu for this slot",
-                              G_PARAM_READABLE);
-
     properties[PROP_EXTENSIONS_BACKGROUND_MENU] =
         g_param_spec_object ("extensions-background-menu",
                              "Background menu of extensions",
@@ -3358,18 +3344,6 @@ nautilus_window_slot_get_tooltip (NautilusWindowSlot *self)
     }
 }
 
-NautilusToolbarMenuSections *
-nautilus_window_slot_get_toolbar_menu_sections (NautilusWindowSlot *self)
-{
-    NautilusView *view;
-
-    g_return_val_if_fail (NAUTILUS_IS_WINDOW_SLOT (self), NULL);
-
-    view = nautilus_window_slot_get_current_view (self);
-
-    return view ? nautilus_view_get_toolbar_menu_sections (view) : NULL;
-}
-
 gboolean
 nautilus_window_slot_get_active (NautilusWindowSlot *self)
 {
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index 364c63728..b82adfc96 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -84,8 +84,6 @@ const gchar*   nautilus_window_slot_get_icon_name                (NautilusWindow
 
 const gchar*   nautilus_window_slot_get_tooltip                  (NautilusWindowSlot *slot);
 
-NautilusToolbarMenuSections * nautilus_window_slot_get_toolbar_menu_sections (NautilusWindowSlot *slot);
-
 GMenuModel* nautilus_window_slot_get_templates_menu (NautilusWindowSlot *self);
 
 GMenuModel* nautilus_window_slot_get_extensions_background_menu (NautilusWindowSlot *self);


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