summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniof@gnome.org>2022-07-31 21:56:49 +0100
committerAntónio Fernandes <antoniof@gnome.org>2022-08-01 02:13:18 +0100
commit6936ece13297d114c7bf3d4466cbce8832d7675d (patch)
treed322ad8636280197b0c282371ad1b69b46153be9
parentdfac6f4fa32c8970f6dc7e63e8f29d4c0c55cd32 (diff)
downloadnautilus-6936ece13297d114c7bf3d4466cbce8832d7675d.tar.gz
toolbar: Drop view menu
There are a few reasons to drop the view menu: * We already have primary (hamburger) and secondary (ellipsis) menus * It holds only sort options now, which are broken in list view dure to GTK not exposing the last clicked column header. * The button doesn't indicate the current sort order. * The grid view has already grown its own sort menu. * It's disconnected from the current folder, despite its sorting options being per-folder. * It shares tooltip with the view toggle button. This is also going to allow to a few followup cleanups and make adaptiveness easier.
-rw-r--r--src/nautilus-toolbar.c20
-rw-r--r--src/resources/ui/nautilus-toolbar.ui15
2 files changed, 4 insertions, 31 deletions
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 27a5f6402..131ebdf82 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -71,8 +71,7 @@ struct _NautilusToolbar
GtkWidget *operations_revealer;
GtkWidget *operations_icon;
- GtkWidget *view_split_button;
- GMenuModel *view_menu;
+ GtkWidget *view_toggle_button;
GtkWidget *app_button;
GMenuModel *undo_redo_section;
@@ -1179,8 +1178,7 @@ 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_menu);
- gtk_widget_class_bind_template_child (widget_class, NautilusToolbar, view_split_button);
+ 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);
@@ -1276,19 +1274,7 @@ on_slot_toolbar_menu_sections_changed (NautilusToolbar *self,
new_sections = nautilus_window_slot_get_toolbar_menu_sections (slot);
- gtk_widget_set_sensitive (self->view_split_button, (new_sections != NULL));
- if (new_sections == NULL)
- {
- return;
- }
-
- /* Let's assume that sort section is the first item
- * in view_menu, as per nautilus-toolbar.ui. */
-
- sort_item = g_menu_item_new_from_model (self->view_menu, 0);
- g_menu_remove (G_MENU (self->view_menu), 0);
- g_menu_item_set_section (sort_item, new_sections->sort_section);
- g_menu_insert_item (G_MENU (self->view_menu), 0, sort_item);
+ gtk_widget_set_sensitive (self->view_toggle_button, (new_sections != NULL));
}
diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui
index e42bb2c46..b1d71ee5f 100644
--- a/src/resources/ui/nautilus-toolbar.ui
+++ b/src/resources/ui/nautilus-toolbar.ui
@@ -3,17 +3,6 @@
<requires lib="gtk" version="4.0"/>
<object class="GtkPopoverMenu" id="back_menu"/>
<object class="GtkPopoverMenu" id="forward_menu"/>
- <menu id="view_menu">
- <section>
- <attribute name="label" translatable="yes" context="menu item" comments="Translators: a menu item in a group of sorting options in a toolbar menu, with criterions such as &quot;A-Z&quot; or &quot;Last Modified&quot;.">Sort</attribute>
- <!--
- Sort section.
-
- The toolbar code assumes this is the second item of this menu model.
- Its contents is provided by the view.
- -->
- </section>
- </menu>
<menu id="app_menu">
<section>
<item>
@@ -219,12 +208,10 @@
</object>
</child>
<child type="end">
- <object class="AdwSplitButton" id="view_split_button">
+ <object class="GtkToggleButton" id="view_toggle_button">
<property name="halign">center</property>
<property name="valign">center</property>
- <property name="tooltip_text" translatable="yes" comments="Translators: This is a noun, meaning the options pertaining to the view.">View options</property>
<property name="action_name">slot.files-view-mode-toggle</property>
- <property name="menu-model">view_menu</property>
<binding name="icon-name">
<lookup name="icon-name">
<lookup name="window-slot">NautilusToolbar</lookup>