[nautilus/wip/toolbar-start-end: 75/77] window, toolbar: Change toolbar visibility based on size




commit e7b13aa66150dfe76783af5e66dc0730b3d0fdfe
Author: Christopher Davis <christopherdavis gnome org>
Date:   Fri Jul 22 23:41:35 2022 -0400

    window, toolbar: Change toolbar visibility based on size
    
    Show a bottom bar at small sizes, while hiding the start
    and end children.

 src/nautilus-toolbar.c               | 18 ++++++++++
 src/resources/ui/nautilus-toolbar.ui | 67 ++++++++++++++++++++++--------------
 src/resources/ui/nautilus-window.ui  | 24 +++++++++++++
 3 files changed, 84 insertions(+), 25 deletions(-)
---
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index edff8f2ff..555435e6c 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -60,6 +60,8 @@ struct _NautilusToolbar
     gboolean show_sidebar_button;
     gboolean sidebar_button_active;
 
+    gboolean show_toolbar_children;
+
     GtkWidget *search_button;
 
     GtkWidget *location_entry_close_button;
@@ -77,6 +79,7 @@ enum
     PROP_SEARCHING,
     PROP_SHOW_SIDEBAR_BUTTON,
     PROP_SIDEBAR_BUTTON_ACTIVE,
+    PROP_SHOW_TOOLBAR_CHILDREN,
     NUM_PROPERTIES
 };
 
@@ -299,6 +302,12 @@ nautilus_toolbar_get_property (GObject    *object,
         }
         break;
 
+        case PROP_SHOW_TOOLBAR_CHILDREN:
+        {
+            g_value_set_boolean (value, self->show_toolbar_children);
+        }
+        break;
+
         default:
         {
             G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -416,6 +425,12 @@ nautilus_toolbar_set_property (GObject      *object,
         }
         break;
 
+        case PROP_SHOW_TOOLBAR_CHILDREN:
+        {
+            self->show_toolbar_children = g_value_get_boolean (value);
+        }
+        break;
+
         default:
         {
             G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -507,6 +522,9 @@ nautilus_toolbar_class_init (NautilusToolbarClass *klass)
     properties[PROP_SIDEBAR_BUTTON_ACTIVE] =
         g_param_spec_boolean ("sidebar-button-active", NULL, NULL, FALSE,
                               G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+    properties[PROP_SHOW_TOOLBAR_CHILDREN] =
+        g_param_spec_boolean ("show-toolbar-children", NULL, NULL, TRUE,
+                              G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
     g_object_class_install_properties (oclass, NUM_PROPERTIES, properties);
 
diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui
index b5cb3918c..1a7fcf4ed 100644
--- a/src/resources/ui/nautilus-toolbar.ui
+++ b/src/resources/ui/nautilus-toolbar.ui
@@ -126,20 +126,26 @@
           </object>
         </child>
         <child type="start">
-          <object class="GtkBox">
-            <property name="spacing">6</property>
-            <child>
-              <object class="NautilusHistoryControls">
-                <property name="window-slot" bind-source="NautilusToolbar" bind-property="window-slot" 
bind-flags="sync-create"/>
-              </object>
-            </child>
-            <child>
-              <object class="GtkSeparator">
-                <style>
-                  <class name="spacer"/>
-                </style>
+          <object class="GtkRevealer">
+            <property name="reveal-child" bind-source="NautilusToolbar" 
bind-property="show-toolbar-children" bind-flags="sync-create"/>
+            <property name="transition-type">slide-right</property>
+            <property name="child">
+              <object class="GtkBox">
+                <property name="spacing">6</property>
+                <child>
+                  <object class="NautilusHistoryControls">
+                    <property name="window-slot" bind-source="NautilusToolbar" bind-property="window-slot" 
bind-flags="sync-create"/>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkSeparator">
+                    <style>
+                      <class name="spacer"/>
+                    </style>
+                  </object>
+                </child>
               </object>
-            </child>
+            </property>
           </object>
         </child>
         <child type="end">
@@ -175,18 +181,29 @@
           </object>
         </child>
         <child type="end">
-          <object class="NautilusViewControls">
-            <property name="window-slot" bind-source="NautilusToolbar" bind-property="window-slot" 
bind-flags="sync-create"/>
-          </object>
-        </child>
-        <child type="end">
-          <object class="NautilusProgressIndicator"/>
-        </child>
-        <child type="end">
-          <object class="GtkSeparator">
-            <style>
-              <class name="spacer"/>
-            </style>
+          <object class="GtkRevealer">
+            <property name="reveal-child" bind-source="NautilusToolbar" 
bind-property="show-toolbar-children" bind-flags="sync-create"/>
+            <property name="transition-type">slide-left</property>
+            <property name="child">
+              <object class="GtkBox">
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkSeparator">
+                    <style>
+                      <class name="spacer"/>
+                    </style>
+                  </object>
+                </child>
+                <child>
+                  <object class="NautilusProgressIndicator"/>
+                </child>
+                <child>
+                  <object class="NautilusViewControls">
+                    <property name="window-slot" bind-source="NautilusToolbar" bind-property="window-slot" 
bind-flags="sync-create"/>
+                  </object>
+                </child>
+              </object>
+            </property>
           </object>
         </child>
       </object>
diff --git a/src/resources/ui/nautilus-window.ui b/src/resources/ui/nautilus-window.ui
index fed197148..6c7083c82 100644
--- a/src/resources/ui/nautilus-window.ui
+++ b/src/resources/ui/nautilus-window.ui
@@ -37,6 +37,7 @@
               <object class="NautilusToolbar" id="toolbar">
                 <property name="show-sidebar-button" bind-source="content_flap" bind-property="folded" 
bind-flags="sync-create"/>
                 <property name="sidebar-button-active" bind-source="content_flap" 
bind-property="reveal-flap" bind-flags="bidirectional|sync-create"/>
+                <property name="show-toolbar-children" bind-source="content_flap" bind-property="folded" 
bind-flags="sync-create|invert-boolean"/>
                 <property name="window-slot" bind-source="NautilusWindow" bind-property="active-slot" 
bind-flags="sync-create"/>
               </object>
             </child>
@@ -74,6 +75,29 @@
                 </child>
               </object>
             </child>
+            <child>
+              <object class="GtkActionBar">
+                <property name="revealed" bind-source="content_flap" bind-property="folded" 
bind-flags="sync-create"/>
+                <child type="start">
+                  <object class="NautilusHistoryControls">
+                    <property name="window-slot" bind-source="NautilusWindow" bind-property="active-slot" 
bind-flags="sync-create"/>
+                  </object>
+                </child>
+                <child type="end">
+                  <object class="GtkBox">
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="NautilusProgressIndicator"/>
+                    </child>
+                    <child>
+                      <object class="NautilusViewControls">
+                        <property name="window-slot" bind-source="NautilusWindow" 
bind-property="active-slot" bind-flags="sync-create"/>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
           </object>
         </property>
       </object>


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