[nautilus/wip/antoniof/gtk4-preparation-discontinued-api: 26/32] general: Prepare for non-GtkBin scrolled window
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gtk4-preparation-discontinued-api: 26/32] general: Prepare for non-GtkBin scrolled window
- Date: Sat, 1 Jan 2022 21:58:14 +0000 (UTC)
commit 5bb2e0019180cbe9e1d8c4b83287fb680bb84f2e
Author: António Fernandes <antoniof gnome org>
Date: Wed Dec 22 22:16:05 2021 +0000
general: Prepare for non-GtkBin scrolled window
In GTK 4, GtkScrolledWindow no longer inherits from GtkBin.
While a mechanical replacement of GtkBin with AdwBin is going to work
elsewhere, it's going to break here.
In order to prevent that introduce a wraper with ths same signature as
the GTK 4 GtkScrolledWindow:child getter.
src/nautilus-files-view.c | 2 +-
src/nautilus-gtk4-helpers.c | 8 ++++++++
src/nautilus-gtk4-helpers.h | 2 +-
src/nautilus-view-icon-controller.c | 3 ++-
4 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 9a9592e02..eb2616a15 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -3134,7 +3134,7 @@ nautilus_files_view_grab_focus (GtkWidget *widget)
view = NAUTILUS_FILES_VIEW (widget);
priv = nautilus_files_view_get_instance_private (view);
- child = gtk_bin_get_child (GTK_BIN (priv->scrolled_window));
+ child = gtk_scrolled_window_get_child (GTK_SCROLLED_WINDOW (priv->scrolled_window));
GTK_WIDGET_CLASS (nautilus_files_view_parent_class)->grab_focus (widget);
diff --git a/src/nautilus-gtk4-helpers.c b/src/nautilus-gtk4-helpers.c
index 445427943..d48358615 100644
--- a/src/nautilus-gtk4-helpers.c
+++ b/src/nautilus-gtk4-helpers.c
@@ -98,6 +98,14 @@ gtk_widget_get_first_child (GtkWidget *widget)
return NULL;
}
+GtkWidget *
+gtk_scrolled_window_get_child (GtkScrolledWindow *scrolled)
+{
+ g_assert (GTK_IS_SCROLLED_WINDOW (scrolled));
+
+ return gtk_bin_get_child (GTK_BIN (scrolled));
+}
+
GdkDisplay *
gtk_root_get_display (GtkRoot *root)
{
diff --git a/src/nautilus-gtk4-helpers.h b/src/nautilus-gtk4-helpers.h
index e5edb55a1..4ceb606f7 100644
--- a/src/nautilus-gtk4-helpers.h
+++ b/src/nautilus-gtk4-helpers.h
@@ -27,7 +27,7 @@ void gtk_revealer_set_child (GtkRevealer *revealer,
GtkWidget *child);
GtkWidget *gtk_widget_get_first_child (GtkWidget *widget);
-
+GtkWidget *gtk_scrolled_window_get_child (GtkScrolledWindow *scrolled);
void gtk_style_context_add_provider_for_display (GdkDisplay *display,
GtkStyleProvider *provider,
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index d85bb2805..df4d96f04 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -1420,7 +1420,8 @@ constructed (GObject *object)
(GCallback) on_longpress_gesture_pressed_callback,
self);
- gtk_container_add (GTK_CONTAINER (content_widget), GTK_WIDGET (self->view_ui));
+ gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (content_widget),
+ GTK_WIDGET (self->view_ui));
self->action_group = nautilus_files_view_get_action_group (NAUTILUS_FILES_VIEW (self));
g_action_map_add_action_entries (G_ACTION_MAP (self->action_group),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]