[libadwaita/wip/exalm/oops] action-row: Fix the sensitive binding




commit 07a9ebd9071a7804b77b35bfd69946f8c3249c78
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Feb 11 15:47:23 2022 +0500

    action-row: Fix the sensitive binding
    
    I clicked merge too quickly. Fix a leak, clean up the code.

 src/adw-action-row.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/adw-action-row.c b/src/adw-action-row.c
index c6acc5dc..216ee5a7 100644
--- a/src/adw-action-row.c
+++ b/src/adw-action-row.c
@@ -65,7 +65,7 @@ typedef struct
   int title_lines;
   int subtitle_lines;
   GtkWidget *activatable_widget;
-  GBinding  *activatable_binding;
+  GBinding *activatable_binding;
 } AdwActionRowPrivate;
 
 static void adw_action_row_buildable_init (GtkBuildableIface *iface);
@@ -553,13 +553,6 @@ adw_action_row_set_activatable_widget (AdwActionRow *self,
 
   g_clear_pointer (&priv->activatable_binding, g_binding_unbind);
 
-  if (widget) {
-    priv->activatable_binding = g_object_bind_property (widget, "sensitive",
-                                                        self, "activatable",
-                                                        G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
-    g_object_ref (priv->activatable_binding);
-  }
-
   if (priv->activatable_widget)
     g_object_weak_unref (G_OBJECT (priv->activatable_widget),
                          activatable_widget_weak_notify,
@@ -572,6 +565,11 @@ adw_action_row_set_activatable_widget (AdwActionRow *self,
                        activatable_widget_weak_notify,
                        self);
     gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (self), TRUE);
+
+    priv->activatable_binding =
+      g_object_bind_property (widget, "sensitive",
+                              self, "activatable",
+                              G_BINDING_SYNC_CREATE);
   }
 
   g_object_notify_by_pspec (G_OBJECT (self), props[PROP_ACTIVATABLE_WIDGET]);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]