[nautilus/wip/antoniof/experimental-gtk4-build: 3/55] view-icon-controller: Stop using gtk_container_get_focus_child()
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/experimental-gtk4-build: 3/55] view-icon-controller: Stop using gtk_container_get_focus_child()
- Date: Sat, 1 Jan 2022 21:47:00 +0000 (UTC)
commit 7b4999f4f4f5aba4c07d32b0dc2006798dd6bc98
Author: António Fernandes <antoniof gnome org>
Date: Sat Jan 1 19:26:53 2022 +0000
view-icon-controller: Stop using gtk_container_get_focus_child()
Use a wrapper that mocks of the GTK 4 API
src/nautilus-gtk4-helpers.c | 8 ++++++++
src/nautilus-gtk4-helpers.h | 1 +
src/nautilus-view-icon-controller.c | 3 ++-
3 files changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-gtk4-helpers.c b/src/nautilus-gtk4-helpers.c
index a5d643406..8f9c7bd35 100644
--- a/src/nautilus-gtk4-helpers.c
+++ b/src/nautilus-gtk4-helpers.c
@@ -166,6 +166,14 @@ gtk_widget_get_first_child (GtkWidget *widget)
return NULL;
}
+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)
{
diff --git a/src/nautilus-gtk4-helpers.h b/src/nautilus-gtk4-helpers.h
index 815f017eb..77bf8089d 100644
--- a/src/nautilus-gtk4-helpers.h
+++ b/src/nautilus-gtk4-helpers.h
@@ -47,6 +47,7 @@ GtkWidget *gtk_center_box_new (void);
gboolean gtk_check_button_get_active (GtkCheckButton *button);
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 943fd5f75..f56797771 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]