diff options
author | Ondrej Holy <oholy@redhat.com> | 2022-01-07 08:40:54 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2022-01-07 08:48:19 +0100 |
commit | 9bb717562deb2b09e1d43736e9c84d19e33638e9 (patch) | |
tree | ad5983e6e466fc3ac04d5ee351050f16825b0d2f /src/nautilus-window.c | |
parent | 89a4eeb3d77392a7371fddc505613049d00bf803 (diff) | |
download | nautilus-wip/oholy/drop-size-allocate.tar.gz |
window: Drop size-allocate usagewip/oholy/drop-size-allocate
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.
Diffstat (limited to 'src/nautilus-window.c')
-rw-r--r-- | src/nautilus-window.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c index 19ebd74fc..2a6252f89 100644 --- a/src/nautilus-window.c +++ b/src/nautilus-window.c @@ -834,12 +834,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) { @@ -847,10 +847,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); @@ -1317,9 +1318,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), |