From 3f737da4eea26c98deea6af779c95ad5bb03e6ea Mon Sep 17 00:00:00 2001 From: Christopher Davis Date: Thu, 16 Mar 2023 00:41:17 -0400 Subject: window: Use AdwUtilityPaneView instead of AdwFlap 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. --- build-aux/flatpak/org.gnome.Nautilus.json | 2 +- src/nautilus-window.c | 10 +++++----- src/resources/ui/nautilus-window.ui | 32 +++++++++++++------------------ 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 @@ - - vertical - + + raised + raised + True - + - - - never - + + + True True True 240 - - - - - - + + vertical @@ -86,10 +80,10 @@ - + - + False @@ -119,7 +113,7 @@ 600 - always + True True False True -- cgit v1.2.1