[nautilus/2070-menu-item-re-organization: 113/116] toolbar-view-menu: Drop 100% zoom button




commit 828550a027035bdcc8f12aa5a9299959ee0ab54d
Author: António Fernandes <antoniof gnome org>
Date:   Mon Jan 10 12:48:15 2022 +0000

    toolbar-view-menu: Drop 100% zoom button
    
    The zoom section in GTK 3 looked like this:
    
    [ - | 100% | + ]
    
    But in GTK 4 it now looks like this:
    
    [     -     | 100%  Ctrl+0 |     +     ]
    
    There is an obvious bug because the accelerator causes all buttons to
    become too wide.
    
    While the GTK3 look matches other applications with zoom controls,
    the concept of zoom doesn't really make sense here:
     * Text size doesn't change with zoom.
     * The 100% state is not actually showing files at 100% scale, as
       the thumbnails are always a very zoomed out version of the file.
    
    Instead, we control the icon size, so let's drop the 100% button and
    have only two buttons to increase and decrease icon size, like so:
    
    Icon size   [ - ] [ + ]
    
    Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2118

 src/nautilus-files-view.c                      | 9 ---------
 src/resources/ui/nautilus-toolbar-view-menu.ui | 6 ------
 src/resources/ui/nautilus-toolbar.ui           | 3 ++-
 3 files changed, 2 insertions(+), 16 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index ca337455c..d979a7350 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -8148,21 +8148,12 @@ nautilus_files_view_reset_view_menu (NautilusFilesView *view)
 {
     NautilusFilesViewPrivate *priv = nautilus_files_view_get_instance_private (view);
     NautilusFile *file;
-    GMenuModel *zoom_section = priv->toolbar_menu_sections->zoom_section;
     GMenuModel *sort_section = priv->toolbar_menu_sections->sort_section;
-    g_autofree gchar *zoom_level_percent = NULL;
     const gchar *trashed_action;
     gint i;
 
     file = nautilus_files_view_get_directory_as_file (NAUTILUS_FILES_VIEW (view));
 
-    /* We want to show the percentage like this:    [ - | 100% | + ]   */
-    zoom_level_percent = g_strdup_printf ("%.0f%%", nautilus_files_view_get_zoom_level_percentage (view) * 
100.0);
-    i = nautilus_g_menu_model_find_by_string (zoom_section, "action", "view.zoom-standard");
-    g_return_if_fail (i != -1);
-    nautilus_g_menu_replace_string_in_item (G_MENU (zoom_section), i,
-                                            "label", zoom_level_percent);
-
     /* When not in Trash, set an inexistant action to hide the menu item. This
      * works under the assumptiont that the menu item has its "hidden-when"
      * attribute set to "action-disabled", and that an inexistant action is
diff --git a/src/resources/ui/nautilus-toolbar-view-menu.ui b/src/resources/ui/nautilus-toolbar-view-menu.ui
index a951047cf..2d0260ee5 100644
--- a/src/resources/ui/nautilus-toolbar-view-menu.ui
+++ b/src/resources/ui/nautilus-toolbar-view-menu.ui
@@ -7,12 +7,6 @@
       <attribute name="action">view.zoom-out</attribute>
       <attribute name="verb-icon">zoom-out-symbolic</attribute>
     </item>
-    <item>
-      <!-- This label is a placeholder. The view is going to replace it with a
-           percentage, like this:   [ - | 100% | + ]                       -->
-      <attribute name="label" translatable="yes">Reset zoom</attribute>
-      <attribute name="action">view.zoom-standard</attribute>
-    </item>
     <item>
       <attribute name="label" translatable="yes">Zoom in</attribute>
       <attribute name="action">view.zoom-in</attribute>
diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui
index e10a11cce..e8e6776ac 100644
--- a/src/resources/ui/nautilus-toolbar.ui
+++ b/src/resources/ui/nautilus-toolbar.ui
@@ -5,7 +5,8 @@
   <object class="GtkPopoverMenu" id="forward_menu"/>
   <menu id="view_menu">
     <section>
-      <attribute name="display-hint">horizontal-buttons</attribute>
+      <attribute name="label" translatable="yes">Icon size</attribute>
+      <attribute name="display-hint">inline-buttons</attribute>
       <!--
            Zoom section.
 


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