[nautilus/wip/toolbar-start-end: 2/4] window, toolbar: Change toolbar visibility based on size
- From: Christopher Davis <christopherdavis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/toolbar-start-end: 2/4] window, toolbar: Change toolbar visibility based on size
- Date: Sun, 31 Jul 2022 19:31:29 +0000 (UTC)
commit 79733a6fcb7b60264953e40437ad31f4c7f14b52
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/nautilus-window.c | 1 -
src/resources/ui/nautilus-toolbar.ui | 20 ++++++++++++++++----
src/resources/ui/nautilus-window.ui | 16 ++++++++++++++++
4 files changed, 50 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 4bbc62f14..8f508900c 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -64,6 +64,8 @@ struct _NautilusToolbar
gboolean show_sidebar_button;
gboolean sidebar_button_active;
+ gboolean show_toolbar_children;
+
GtkWidget *search_button;
GtkWidget *location_entry_close_button;
@@ -81,6 +83,7 @@ enum
PROP_SEARCHING,
PROP_SHOW_SIDEBAR_BUTTON,
PROP_SIDEBAR_BUTTON_ACTIVE,
+ PROP_SHOW_TOOLBAR_CHILDREN,
NUM_PROPERTIES
};
@@ -302,6 +305,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);
@@ -419,6 +428,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);
@@ -510,6 +525,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/nautilus-window.c b/src/nautilus-window.c
index ca037ab1a..655f97b24 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1539,7 +1539,6 @@ nautilus_window_initialize_actions (NautilusWindow *window)
action, "enabled", G_BINDING_SYNC_CREATE);
}
-
static void
nautilus_window_constructed (GObject *self)
{
diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui
index 51b131e12..d7f8f4ecb 100644
--- a/src/resources/ui/nautilus-toolbar.ui
+++ b/src/resources/ui/nautilus-toolbar.ui
@@ -126,8 +126,14 @@
</object>
</child>
<child type="start">
- <object class="NautilusHistoryControls">
- <property name="window-slot" bind-source="NautilusToolbar" bind-property="window-slot"
bind-flags="sync-create"/>
+ <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="NautilusHistoryControls">
+ <property name="window-slot" bind-source="NautilusToolbar" bind-property="window-slot"
bind-flags="sync-create"/>
+ </object>
+ </property>
</object>
</child>
<child type="end">
@@ -163,8 +169,14 @@
</object>
</child>
<child type="end">
- <object class="NautilusToolbarEnd">
- <property name="window-slot" bind-source="NautilusToolbar" bind-property="window-slot"
bind-flags="sync-create"/>
+ <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="NautilusToolbarEnd">
+ <property name="window-slot" bind-source="NautilusToolbar" bind-property="window-slot"
bind-flags="sync-create"/>
+ </object>
+ </property>
</object>
</child>
</object>
diff --git a/src/resources/ui/nautilus-window.ui b/src/resources/ui/nautilus-window.ui
index fed197148..19f9c7015 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,21 @@
</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="NautilusToolbarEnd">
+ <property name="window-slot" bind-source="NautilusWindow" bind-property="active-slot"
bind-flags="sync-create"/>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
</property>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]