summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2022-01-07 08:40:54 +0100
committerAntónio Fernandes <antoniof@gnome.org>2022-01-09 01:44:32 +0000
commitbb31794019091ff59438b8fa10440e9230614c7a (patch)
tree7f33a96a65a82c425a554116eed815bac382fbd2
parente358c2343c47aa26d568254a12f06a8431b2da42 (diff)
downloadnautilus-bb31794019091ff59438b8fa10440e9230614c7a.tar.gz
window: Drop size-allocate usage
The `size-allocate` signal is used to determine width of the sidebar, but it is no more availabe in GTK 4. Let's use `notifiy::position` on `GtkPaned` instead to get rid of the runtime warnings.
-rw-r--r--src/nautilus-window.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 244adbf2a..93d3b56ff 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -829,12 +829,12 @@ save_sidebar_width_cb (gpointer user_data)
/* side pane helpers */
static void
-side_pane_size_allocate_callback (GtkWidget *widget,
- GtkAllocation *allocation,
- gpointer user_data)
+side_pane_notify_position_callback (GObject *object,
+ GParamSpec *pspec,
+ gpointer user_data)
{
NautilusWindow *window = user_data;
-
+ gint position;
if (window->sidebar_width_handler_id != 0)
{
@@ -842,10 +842,11 @@ side_pane_size_allocate_callback (GtkWidget *widget,
window->sidebar_width_handler_id = 0;
}
- if (allocation->width != window->side_pane_width &&
- allocation->width > 1)
+ position = gtk_paned_get_position (GTK_PANED (window->content_paned));
+ if (position != window->side_pane_width &&
+ position > 1)
{
- window->side_pane_width = allocation->width;
+ window->side_pane_width = position;
window->sidebar_width_handler_id =
g_idle_add (save_sidebar_width_cb, window);
@@ -1312,9 +1313,9 @@ static void
nautilus_window_set_up_sidebar (NautilusWindow *window)
{
setup_side_pane_width (window);
- g_signal_connect (window->sidebar,
- "size-allocate",
- G_CALLBACK (side_pane_size_allocate_callback),
+ g_signal_connect (window->content_paned,
+ "notify::position",
+ G_CALLBACK (side_pane_notify_position_callback),
window);
nautilus_gtk_places_sidebar_set_open_flags (NAUTILUS_GTK_PLACES_SIDEBAR (window->places_sidebar),