[gtk+] gail: use a weak pointer instead of an invalid destroy signal



commit 5fbd77526a0da53b53e19fe8bf2d26038a084ab8
Author: William Jon McCann <jmccann redhat com>
Date:   Sat Oct 2 15:45:46 2010 -0400

    gail: use a weak pointer instead of an invalid destroy signal

 modules/other/gail/gailadjustment.c |   24 +++++-------------------
 1 files changed, 5 insertions(+), 19 deletions(-)
---
diff --git a/modules/other/gail/gailadjustment.c b/modules/other/gail/gailadjustment.c
index 5226488..0a5a9c0 100644
--- a/modules/other/gail/gailadjustment.c
+++ b/modules/other/gail/gailadjustment.c
@@ -43,9 +43,6 @@ static void	 gail_adjustment_get_minimum_increment (AtkValue        *obj,
 static gboolean	 gail_adjustment_set_current_value (AtkValue            *obj,
                                                     const GValue        *value);
 
-static void      gail_adjustment_destroyed         (GtkAdjustment       *adjustment,
-                                                    GailAdjustment      *gail_adjustment);
-
 G_DEFINE_TYPE_WITH_CODE (GailAdjustment, gail_adjustment, ATK_TYPE_OBJECT,
                          G_IMPLEMENT_INTERFACE (ATK_TYPE_VALUE, atk_value_interface_init))
 
@@ -83,18 +80,18 @@ gail_adjustment_real_initialize (AtkObject *obj,
                                  gpointer  data)
 {
   GtkAdjustment *adjustment;
+  GailAdjustment *gail_adjustment;
 
   ATK_OBJECT_CLASS (gail_adjustment_parent_class)->initialize (obj, data);
 
   adjustment = GTK_ADJUSTMENT (data);
 
   obj->role = ATK_ROLE_UNKNOWN;
-  GAIL_ADJUSTMENT (obj)->adjustment = adjustment;
+  gail_adjustment = GAIL_ADJUSTMENT (obj);
+  gail_adjustment->adjustment = adjustment;
 
-  g_signal_connect_object (G_OBJECT (adjustment),
-                           "destroy",
-                           G_CALLBACK (gail_adjustment_destroyed),
-                           obj, 0);
+  g_object_add_weak_pointer (G_OBJECT (adjustment),
+                             (gpointer *) &gail_adjustment->adjustment);
 }
 
 static void	 
@@ -231,14 +228,3 @@ gail_adjustment_set_current_value (AtkValue             *obj,
   else
     return FALSE;
 }
-
-static void
-gail_adjustment_destroyed (GtkAdjustment       *adjustment,
-                           GailAdjustment      *gail_adjustment)
-{
-  /*
-   * This is the signal handler for the "destroy" signal for the 
-   * GtkAdjustment. We set the  pointer location to NULL;
-   */
-  gail_adjustment->adjustment = NULL;
-}



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