[nautilus/wip/antoniof/gtk4-preparation-drop-outgoing-api: 84/97] files-view: Handle parent changes in GObject::notify
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gtk4-preparation-drop-outgoing-api: 84/97] files-view: Handle parent changes in GObject::notify
- Date: Mon, 22 Nov 2021 15:16:22 +0000 (UTC)
commit 0105bfb8accb22e6aeb3b88fb20559b44d14d16e
Author: Ernestas Kulik <ernestask gnome org>
Date: Tue Jul 10 15:11:46 2018 +0300
files-view: Handle parent changes in GObject::notify
GtkWidget::parent-set is gone in GTK4.
Rebased and ammended by António Fernandes <antoniof gnome org>
src/nautilus-files-view.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index c93ad689c..994179d80 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -9403,25 +9403,22 @@ action_stop_enabled_changed (GActionGroup *action_group,
}
static void
-nautilus_files_view_parent_set (GtkWidget *widget,
- GtkWidget *old_parent)
+on_parent_changed (GObject *object,
+ GParamSpec *pspec,
+ gpointer user_data)
{
+ GtkWidget *widget;
NautilusWindow *window;
NautilusFilesView *view;
NautilusFilesViewPrivate *priv;
GtkWidget *parent;
- view = NAUTILUS_FILES_VIEW (widget);
+ widget = GTK_WIDGET (object);
+ view = NAUTILUS_FILES_VIEW (object);
priv = nautilus_files_view_get_instance_private (view);
parent = gtk_widget_get_parent (widget);
window = nautilus_files_view_get_window (view);
- g_assert (parent == NULL || old_parent == NULL);
-
- if (GTK_WIDGET_CLASS (nautilus_files_view_parent_class)->parent_set != NULL)
- {
- GTK_WIDGET_CLASS (nautilus_files_view_parent_class)->parent_set (widget, old_parent);
- }
if (priv->stop_signal_handler > 0)
{
@@ -9437,8 +9434,6 @@ nautilus_files_view_parent_set (GtkWidget *widget,
if (parent != NULL)
{
- g_assert (old_parent == NULL);
-
if (priv->slot == nautilus_window_get_active_slot (window))
{
priv->active = TRUE;
@@ -9674,7 +9669,6 @@ nautilus_files_view_class_init (NautilusFilesViewClass *klass)
oclass->set_property = nautilus_files_view_set_property;
widget_class->event = nautilus_files_view_event;
- widget_class->parent_set = nautilus_files_view_parent_set;
widget_class->grab_focus = nautilus_files_view_grab_focus;
@@ -9871,6 +9865,10 @@ nautilus_files_view_init (NautilusFilesView *view)
"notify::selection",
G_CALLBACK (nautilus_files_view_preview_update),
view);
+ g_signal_connect (view,
+ "notify::parent",
+ G_CALLBACK (on_parent_changed),
+ NULL);
g_object_unref (builder);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]