summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Davis <christopherdavis@gnome.org>2023-03-16 00:41:17 -0400
committerChristopher Davis <christopherdavis@gnome.org>2023-03-16 18:36:05 -0400
commit3f737da4eea26c98deea6af779c95ad5bb03e6ea (patch)
tree5de43b85e9ca42d6892541787d584ce1955957c5
parentdb69e0ccae92dfd4a77e098c7f81812802540b25 (diff)
downloadnautilus-wip/cdavis/adaptive-states.tar.gz
window: Use AdwUtilityPaneView instead of AdwFlapwip/cdavis/adaptive-states
AdwFlap has the same issues as all of our other adaptive widgetry. In order to get rid of the issues caused by it, we need new widgetry that can be manually used with AdwAdaptiveState. This commit ports the main window to the new AdwUtilityPaneView widget. This widget is a simplified alternative to AdwFlap, and for our use case it's a drop-in replacement.
-rw-r--r--build-aux/flatpak/org.gnome.Nautilus.json2
-rw-r--r--src/nautilus-window.c10
-rw-r--r--src/resources/ui/nautilus-window.ui32
3 files changed, 19 insertions, 25 deletions
diff --git a/build-aux/flatpak/org.gnome.Nautilus.json b/build-aux/flatpak/org.gnome.Nautilus.json
index 0bf549546..6389a2a54 100644
--- a/build-aux/flatpak/org.gnome.Nautilus.json
+++ b/build-aux/flatpak/org.gnome.Nautilus.json
@@ -180,7 +180,7 @@
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/libadwaita.git",
- "branch" : "wip/exalm/adaptive-states"
+ "branch" : "wip/exalm/browsing-view"
}
]
},
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 30299b19d..9fcea3319 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -103,7 +103,7 @@ struct _NautilusWindow
GList *slots;
NautilusWindowSlot *active_slot; /* weak reference */
- GtkWidget *content_flap;
+ GtkWidget *utility_pane;
/* Side Pane */
GtkWidget *places_sidebar; /* the actual GtkPlacesSidebar */
@@ -1016,8 +1016,8 @@ action_toggle_sidebar (GSimpleAction *action,
NautilusWindow *window = NAUTILUS_WINDOW (user_data);
gboolean revealed;
- revealed = adw_flap_get_reveal_flap (ADW_FLAP (window->content_flap));
- adw_flap_set_reveal_flap (ADW_FLAP (window->content_flap), !revealed);
+ revealed = adw_utility_pane_view_get_reveal_sidebar (ADW_UTILITY_PANE_VIEW (window->utility_pane));
+ adw_utility_pane_view_set_reveal_sidebar (ADW_UTILITY_PANE_VIEW (window->utility_pane), !revealed);
}
@@ -1607,7 +1607,7 @@ nautilus_window_initialize_actions (NautilusWindow *window)
#undef ACCELS
action = g_action_map_lookup_action (G_ACTION_MAP (window), "toggle-sidebar");
- g_object_bind_property (window->content_flap, "folded",
+ g_object_bind_property (window->utility_pane, "folded",
action, "enabled", G_BINDING_SYNC_CREATE);
}
@@ -2292,7 +2292,7 @@ nautilus_window_class_init (NautilusWindowClass *class)
gtk_widget_class_set_template_from_resource (wclass,
"/org/gnome/nautilus/ui/nautilus-window.ui");
gtk_widget_class_bind_template_child (wclass, NautilusWindow, toolbar);
- gtk_widget_class_bind_template_child (wclass, NautilusWindow, content_flap);
+ gtk_widget_class_bind_template_child (wclass, NautilusWindow, utility_pane);
gtk_widget_class_bind_template_child (wclass, NautilusWindow, places_sidebar);
gtk_widget_class_bind_template_child (wclass, NautilusWindow, toast_overlay);
gtk_widget_class_bind_template_child (wclass, NautilusWindow, tab_view);
diff --git a/src/resources/ui/nautilus-window.ui b/src/resources/ui/nautilus-window.ui
index 1af126399..9e139d01b 100644
--- a/src/resources/ui/nautilus-window.ui
+++ b/src/resources/ui/nautilus-window.ui
@@ -45,34 +45,28 @@
<child>
<object class="AdwToastOverlay" id="toast_overlay">
<property name="child">
- <object class="GtkBox">
- <property name="orientation">vertical</property>
- <child>
+ <object class="AdwToolbarView">
+ <property name="top-bar-style">raised</property>
+ <property name="bottom-bar-style">raised</property>
+ <child type="top">
<object class="NautilusToolbar" id="toolbar">
<property name="show-toolbar-children">True</property>
- <property name="sidebar-button-active" bind-source="content_flap" bind-property="reveal-flap" bind-flags="bidirectional|sync-create"/>
+ <property name="sidebar-button-active" bind-source="utility_pane" bind-property="reveal-sidebar" bind-flags="bidirectional|sync-create"/>
<property name="window-slot" bind-source="NautilusWindow" bind-property="active-slot" bind-flags="sync-create"/>
</object>
</child>
<child>
- <object class="AdwFlap" id="content_flap">
- <property name="swipe-to-close" bind-source="content_flap" bind-property="folded" bind-flags="sync-create"/>
- <property name="fold-policy">never</property>
- <child type="flap">
+ <object class="AdwUtilityPaneView" id="utility_pane">
+ <property name="swipe-to-close" bind-source="utility_pane" bind-property="folded" bind-flags="sync-create"/>
+ <property name="sidebar">
<object class="NautilusGtkPlacesSidebar" id="places_sidebar">
<property name="vexpand">True</property>
<property name="show-other-locations">True</property>
<property name="show-starred-location">True</property>
<property name="width-request">240</property>
- <style>
- <class name="background"/>
- </style>
</object>
- </child>
- <child type="separator">
- <object class="GtkSeparator"/>
- </child>
- <child>
+ </property>
+ <property name="content">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
@@ -86,10 +80,10 @@
</object>
</child>
</object>
- </child>
+ </property>
</object>
</child>
- <child>
+ <child type="bottom">
<object class="GtkActionBar" id="action_bar">
<property name="revealed">False</property>
<child type="start">
@@ -119,7 +113,7 @@
<child>
<object class="AdwAdaptiveState" id="narrow_state">
<condition type="max-width">600</condition>
- <setter object="content_flap" property="fold-policy">always</setter>
+ <setter object="utility_pane" property="folded">True</setter>
<setter object="toolbar" property="show-sidebar-button">True</setter>
<setter object="toolbar" property="show-toolbar-children">False</setter>
<setter object="action_bar" property="revealed">True</setter>