[nautilus/wip/antoniof/gtk4-preparation-drop-outgoing-api: 3/49] floating-bar: Handle parent changes in GObject::notify
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gtk4-preparation-drop-outgoing-api: 3/49] floating-bar: Handle parent changes in GObject::notify
- Date: Sun, 15 Aug 2021 19:37:31 +0000 (UTC)
commit a5db6ee0b9dd22d370e612d91e14bdc4d644197a
Author: António Fernandes <antoniof gnome org>
Date: Thu Aug 5 23:16:54 2021 +0100
floating-bar: Handle parent changes in GObject::notify
GtkWidget::parent-set is gone in GTK4.
src/nautilus-floating-bar.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-floating-bar.c b/src/nautilus-floating-bar.c
index d6cbd2084..f65b52d7c 100644
--- a/src/nautilus-floating-bar.c
+++ b/src/nautilus-floating-bar.c
@@ -290,13 +290,14 @@ on_event_controller_motion_motion (GtkEventControllerMotion *controller,
}
static void
-nautilus_floating_bar_parent_set (GtkWidget *widget,
- GtkWidget *old_parent)
+on_parent_changed (GObject *object,
+ GParamSpec *pspec,
+ gpointer user_data)
{
- NautilusFloatingBar *self = NAUTILUS_FLOATING_BAR (widget);
+ NautilusFloatingBar *self = NAUTILUS_FLOATING_BAR (object);
GtkWidget *parent;
- parent = gtk_widget_get_parent (widget);
+ parent = gtk_widget_get_parent (GTK_WIDGET (object));
if (parent != NULL)
@@ -468,6 +469,11 @@ nautilus_floating_bar_init (NautilusFloatingBar *self)
self->motion_controller = NULL;
self->pointer_y_in_parent_coordinates = -1;
+
+ g_signal_connect (self,
+ "notify::parent",
+ G_CALLBACK (on_parent_changed),
+ NULL);
}
static void
@@ -485,7 +491,6 @@ nautilus_floating_bar_class_init (NautilusFloatingBarClass *klass)
wclass->get_preferred_width_for_height = nautilus_floating_bar_get_preferred_width_for_height;
wclass->get_preferred_height = nautilus_floating_bar_get_preferred_height;
wclass->get_preferred_height_for_width = nautilus_floating_bar_get_preferred_height_for_width;
- wclass->parent_set = nautilus_floating_bar_parent_set;
properties[PROP_PRIMARY_LABEL] =
g_param_spec_string ("primary-label",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]