[nautilus/wip/gbsneto/actionbar-review2: 524/525] actionbar: remove Bookmars and Properties buttons



commit 653a72525383bfc8bf0d2964f863da0182ad1c6d
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Jun 16 09:32:08 2016 -0300

    actionbar: remove Bookmars and Properties buttons
    
    They look ambiguous, and it's not clear they're related
    to the actual folder.

 src/nautilus-action-bar.c               |   24 +++-------
 src/resources/ui/nautilus-action-bar.ui |   72 -------------------------------
 2 files changed, 7 insertions(+), 89 deletions(-)
---
diff --git a/src/nautilus-action-bar.c b/src/nautilus-action-bar.c
index e03026f..a164ec1 100644
--- a/src/nautilus-action-bar.c
+++ b/src/nautilus-action-bar.c
@@ -47,9 +47,6 @@ struct _NautilusActionBar
   GtkWidget          *new_folder_0_button;
   GtkWidget          *paste_button;
   GtkWidget          *select_all_button;
-  GtkWidget          *no_selection_separator;
-  GtkWidget          *bookmark_button;
-  GtkWidget          *properties_0_button;
   GtkWidget          *no_selection_overflow_button;
   GtkWidget          *no_selection_folder_label;
 
@@ -63,7 +60,7 @@ struct _NautilusActionBar
   GtkWidget          *properties_folders_button;
   GtkWidget          *folders_overflow_button;
 
-  GtkWidget          *no_selection_widgets    [5];
+  GtkWidget          *no_selection_widgets    [3];
   GtkWidget          *files_folders_widgets   [5];
 
   /* Labels */
@@ -532,9 +529,9 @@ nautilus_action_bar_set_property (GObject      *object,
 static void
 set_visible_buttons (GtkWidget **widgets,
                      GtkWidget  *overflow,
+                     gint        length,
                      gint        visible_items)
 {
-  const gint length = 5;
   gint i;
 
   gtk_widget_set_visible (overflow, visible_items < length);
@@ -551,12 +548,13 @@ nautilus_action_bar_size_allocate (GtkWidget     *widget,
   GtkWidget **widgets;
   GtkWidget *overflow_button, *reference_button;
   gint visible_items, button_width, overflow_button_width, static_button_width;
-  gint max_width;
+  gint max_width, max_items;
 
   self = NAUTILUS_ACTION_BAR (widget);
   max_width = 2 * allocation->width / 3 - 2 * gtk_container_get_border_width (GTK_CONTAINER (self->stack));
   reference_button = overflow_button = NULL;
   static_button_width = 0;
+  max_items = 5;
 
   switch (self->mode)
     {
@@ -564,6 +562,7 @@ nautilus_action_bar_size_allocate (GtkWidget     *widget,
       overflow_button = self->no_selection_overflow_button;
       reference_button = self->new_folder_0_button;
       widgets = self->no_selection_widgets;
+      max_items = 3;
       break;
 
     case MODE_FILES_ONLY:
@@ -615,14 +614,10 @@ nautilus_action_bar_size_allocate (GtkWidget     *widget,
     }
 
   /* Number of visible widgets */
-  visible_items = CLAMP ((max_width - overflow_button_width - static_button_width) / MAX (button_width, 1), 
0, 5);
+  visible_items = CLAMP ((max_width - overflow_button_width - static_button_width) / MAX (button_width, 1), 
0, max_items);
 
   if (visible_items > 0)
-    set_visible_buttons (widgets, overflow_button, visible_items);
-
-  /* Hide the separator if needed */
-  if (self->mode == MODE_NO_SELECTION)
-    gtk_widget_set_visible (self->no_selection_separator, visible_items > 3);
+    set_visible_buttons (widgets, overflow_button, max_items, visible_items);
 
   /* Let GtkBox allocate and position the widgets */
   GTK_WIDGET_CLASS (nautilus_action_bar_parent_class)->size_allocate (widget, allocation);
@@ -694,7 +689,6 @@ nautilus_action_bar_class_init (NautilusActionBarClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/nautilus/ui/nautilus-action-bar.ui");
 
-  gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, bookmark_button);
   gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, copy_folders_button);
   gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, default_app_button);
   gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, default_app_icon);
@@ -706,11 +700,9 @@ nautilus_action_bar_class_init (NautilusActionBarClass *klass)
   gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, new_folder_0_button);
   gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, no_selection_folder_label);
   gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, no_selection_overflow_button);
-  gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, no_selection_separator);
   gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, open_file_box);
   gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, open_folders_button);
   gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, paste_button);
-  gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, properties_0_button);
   gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, properties_folders_button);
   gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, rename_folders_button);
   gtk_widget_class_bind_template_child (widget_class, NautilusActionBar, select_all_button);
@@ -732,8 +724,6 @@ nautilus_action_bar_init (NautilusActionBar *self)
   self->no_selection_widgets[0] = self->new_folder_0_button;
   self->no_selection_widgets[1] = self->paste_button;
   self->no_selection_widgets[2] = self->select_all_button;
-  self->no_selection_widgets[3] = self->bookmark_button;
-  self->no_selection_widgets[4] = self->properties_0_button;
 
   /* Folder- and folder-only widgets */
   self->files_folders_widgets[0] = self->move_folders_button;
diff --git a/src/resources/ui/nautilus-action-bar.ui b/src/resources/ui/nautilus-action-bar.ui
index 2d4835a..032d00f 100644
--- a/src/resources/ui/nautilus-action-bar.ui
+++ b/src/resources/ui/nautilus-action-bar.ui
@@ -65,44 +65,6 @@
               </packing>
             </child>
             <child>
-              <object class="GtkSeparator" id="no_selection_separator">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">3</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="bookmark_button">
-                <property name="label" translatable="yes">Bookmark</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">4</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkButton" id="properties_0_button">
-                <property name="label" translatable="yes">Properties</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="action_name">view.properties</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">5</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkMenuButton" id="no_selection_overflow_button">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -465,39 +427,7 @@
             <property name="position">3</property>
           </packing>
         </child>
-        <child>
-          <object class="GtkModelButton">
-            <property name="visible" bind-source="bookmark_button" bind-property="visible" 
bind-flags="default|invert-boolean" />
-            <property name="can_focus">True</property>
-            <property name="receives_default">True</property>
-            <property name="action_name">view.bookmark</property>
-            <property name="text" translatable="yes">Bookmark</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">4</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkModelButton">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="receives_default">True</property>
-            <property name="action_name">view.properties</property>
-            <property name="text" translatable="yes">Properties</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">5</property>
-          </packing>
-        </child>
       </object>
-      <packing>
-        <property name="submenu">submenu0</property>
-        <property name="position">1</property>
-      </packing>
     </child>
   </object>
   <object class="GtkPopoverMenu" id="folders_popover">
@@ -625,8 +555,6 @@
       <widget name="new_folder_0_button"/>
       <widget name="paste_button"/>
       <widget name="select_all_button"/>
-      <widget name="bookmark_button"/>
-      <widget name="properties_0_button"/>
     </widgets>
   </object>
 </interface>


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