summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntónio Fernandes <antoniof@gnome.org>2022-01-01 19:26:53 +0000
committerAntónio Fernandes <antoniojpfernandes@gmail.com>2022-01-05 01:44:35 +0000
commit8a7f041c8865008ecb959541356b58c257fa9009 (patch)
tree7d33c483e33b3a764994936b82da6a481b568876
parent212f7efc61a77cf0e7f3cc5b25eeedf604b5b73e (diff)
downloadnautilus-8a7f041c8865008ecb959541356b58c257fa9009.tar.gz
view-icon-controller: Stop using gtk_container_get_focus_child()
Use a wrapper that mocks the GTK 4 API.
-rw-r--r--src/nautilus-gtk4-helpers.c8
-rw-r--r--src/nautilus-gtk4-helpers.h1
-rw-r--r--src/nautilus-view-icon-controller.c3
3 files changed, 11 insertions, 1 deletions
diff --git a/src/nautilus-gtk4-helpers.c b/src/nautilus-gtk4-helpers.c
index d48358615..78071ee43 100644
--- a/src/nautilus-gtk4-helpers.c
+++ b/src/nautilus-gtk4-helpers.c
@@ -99,6 +99,14 @@ gtk_widget_get_first_child (GtkWidget *widget)
}
GtkWidget *
+gtk_widget_get_focus_child (GtkWidget *widget)
+{
+ g_assert (GTK_IS_CONTAINER (widget));
+
+ return gtk_container_get_focus_child (GTK_CONTAINER (widget));
+}
+
+GtkWidget *
gtk_scrolled_window_get_child (GtkScrolledWindow *scrolled)
{
g_assert (GTK_IS_SCROLLED_WINDOW (scrolled));
diff --git a/src/nautilus-gtk4-helpers.h b/src/nautilus-gtk4-helpers.h
index 4ceb606f7..4f269afda 100644
--- a/src/nautilus-gtk4-helpers.h
+++ b/src/nautilus-gtk4-helpers.h
@@ -27,6 +27,7 @@ void gtk_revealer_set_child (GtkRevealer *revealer,
GtkWidget *child);
GtkWidget *gtk_widget_get_first_child (GtkWidget *widget);
+GtkWidget *gtk_widget_get_focus_child (GtkWidget *widget);
GtkWidget *gtk_scrolled_window_get_child (GtkScrolledWindow *scrolled);
void gtk_style_context_add_provider_for_display (GdkDisplay *display,
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index df4d96f04..98599862c 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -9,6 +9,7 @@
#include "nautilus-directory.h"
#include "nautilus-global-preferences.h"
#include "nautilus-thumbnails.h"
+#include "nautilus-gtk4-helpers.h"
struct _NautilusViewIconController
{
@@ -718,7 +719,7 @@ real_reveal_for_selection_context_menu (NautilusFilesView *files_view)
/* Get the focused item_ui, if selected.
* Otherwise, get the selected item_ui which is sorted the lowest.*/
- item_ui = gtk_container_get_focus_child (GTK_CONTAINER (self->view_ui));
+ item_ui = gtk_widget_get_focus_child (GTK_WIDGET (self->view_ui));
if (item_ui == NULL || !gtk_flow_box_child_is_selected (GTK_FLOW_BOX_CHILD (item_ui)))
{
g_autoptr (GList) list = gtk_flow_box_get_selected_children (self->view_ui);