]> Pileus Git - ~andy/gtk/commitdiff
use the second argument to the weak ref notify, cleaning up some uglyness.
authorJames Henstridge <james@daa.com.au>
Sat, 18 Aug 2001 03:14:41 +0000 (03:14 +0000)
committerJames Henstridge <jamesh@src.gnome.org>
Sat, 18 Aug 2001 03:14:41 +0000 (03:14 +0000)
2001-08-18  James Henstridge  <james@daa.com.au>

* gtk/gtkaccelgroup.c (gtk_accel_group_object_destroy): use the
second argument to the weak ref notify, cleaning up some uglyness.
(gtk_accel_group_attach): remove and add the weak notifier when
changing the accel groups slist.
(gtk_accel_group_detach): same here.

ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkaccelgroup.c

index 8cdec99e5153010f718315aa7bd48b0edf7f65df..7b3eda5f2648fe4bcdff0a339ad17453805a6640 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-08-18  James Henstridge  <james@daa.com.au>
+
+       * gtk/gtkaccelgroup.c (gtk_accel_group_object_destroy): use the
+       second argument to the weak ref notify, cleaning up some uglyness.
+       (gtk_accel_group_attach): remove and add the weak notifier when
+       changing the accel groups slist.
+       (gtk_accel_group_detach): same here.
+
 2001-08-17  Darin Adler  <darin@bentspoon.com>
 
        * gtk/gtktreeview.c: (gtk_tree_view_search_equal_func): Add
index 8cdec99e5153010f718315aa7bd48b0edf7f65df..7b3eda5f2648fe4bcdff0a339ad17453805a6640 100644 (file)
@@ -1,3 +1,11 @@
+2001-08-18  James Henstridge  <james@daa.com.au>
+
+       * gtk/gtkaccelgroup.c (gtk_accel_group_object_destroy): use the
+       second argument to the weak ref notify, cleaning up some uglyness.
+       (gtk_accel_group_attach): remove and add the weak notifier when
+       changing the accel groups slist.
+       (gtk_accel_group_detach): same here.
+
 2001-08-17  Darin Adler  <darin@bentspoon.com>
 
        * gtk/gtktreeview.c: (gtk_tree_view_search_equal_func): Add
index 8cdec99e5153010f718315aa7bd48b0edf7f65df..7b3eda5f2648fe4bcdff0a339ad17453805a6640 100644 (file)
@@ -1,3 +1,11 @@
+2001-08-18  James Henstridge  <james@daa.com.au>
+
+       * gtk/gtkaccelgroup.c (gtk_accel_group_object_destroy): use the
+       second argument to the weak ref notify, cleaning up some uglyness.
+       (gtk_accel_group_attach): remove and add the weak notifier when
+       changing the accel groups slist.
+       (gtk_accel_group_detach): same here.
+
 2001-08-17  Darin Adler  <darin@bentspoon.com>
 
        * gtk/gtktreeview.c: (gtk_tree_view_search_equal_func): Add
index 8cdec99e5153010f718315aa7bd48b0edf7f65df..7b3eda5f2648fe4bcdff0a339ad17453805a6640 100644 (file)
@@ -1,3 +1,11 @@
+2001-08-18  James Henstridge  <james@daa.com.au>
+
+       * gtk/gtkaccelgroup.c (gtk_accel_group_object_destroy): use the
+       second argument to the weak ref notify, cleaning up some uglyness.
+       (gtk_accel_group_attach): remove and add the weak notifier when
+       changing the accel groups slist.
+       (gtk_accel_group_detach): same here.
+
 2001-08-17  Darin Adler  <darin@bentspoon.com>
 
        * gtk/gtktreeview.c: (gtk_tree_view_search_equal_func): Add
index 8cdec99e5153010f718315aa7bd48b0edf7f65df..7b3eda5f2648fe4bcdff0a339ad17453805a6640 100644 (file)
@@ -1,3 +1,11 @@
+2001-08-18  James Henstridge  <james@daa.com.au>
+
+       * gtk/gtkaccelgroup.c (gtk_accel_group_object_destroy): use the
+       second argument to the weak ref notify, cleaning up some uglyness.
+       (gtk_accel_group_attach): remove and add the weak notifier when
+       changing the accel groups slist.
+       (gtk_accel_group_detach): same here.
+
 2001-08-17  Darin Adler  <darin@bentspoon.com>
 
        * gtk/gtktreeview.c: (gtk_tree_view_search_equal_func): Add
index 8cdec99e5153010f718315aa7bd48b0edf7f65df..7b3eda5f2648fe4bcdff0a339ad17453805a6640 100644 (file)
@@ -1,3 +1,11 @@
+2001-08-18  James Henstridge  <james@daa.com.au>
+
+       * gtk/gtkaccelgroup.c (gtk_accel_group_object_destroy): use the
+       second argument to the weak ref notify, cleaning up some uglyness.
+       (gtk_accel_group_attach): remove and add the weak notifier when
+       changing the accel groups slist.
+       (gtk_accel_group_detach): same here.
+
 2001-08-17  Darin Adler  <darin@bentspoon.com>
 
        * gtk/gtktreeview.c: (gtk_tree_view_search_equal_func): Add
index 8cdec99e5153010f718315aa7bd48b0edf7f65df..7b3eda5f2648fe4bcdff0a339ad17453805a6640 100644 (file)
@@ -1,3 +1,11 @@
+2001-08-18  James Henstridge  <james@daa.com.au>
+
+       * gtk/gtkaccelgroup.c (gtk_accel_group_object_destroy): use the
+       second argument to the weak ref notify, cleaning up some uglyness.
+       (gtk_accel_group_attach): remove and add the weak notifier when
+       changing the accel groups slist.
+       (gtk_accel_group_detach): same here.
+
 2001-08-17  Darin Adler  <darin@bentspoon.com>
 
        * gtk/gtktreeview.c: (gtk_tree_view_search_equal_func): Add
index 8f7639d78b6f5baa7938d37a02508008d3ab3e74..881a7a2c26b4d972f2e3c09399eb3a94e06b60f1 100644 (file)
@@ -201,19 +201,17 @@ gtk_accel_group_unref (GtkAccelGroup  *accel_group)
 }
 
 static void
-gtk_accel_group_object_destroy (GObject *object)
+gtk_accel_group_object_destroy (GSList *free_list,
+                               GObject *where_the_object_was)
 {
-  GSList *free_list, *slist;
-  
-  free_list = g_object_get_qdata (object, accel_groups_key_id);
-  g_object_set_qdata (object, accel_groups_key_id, NULL);
+  GSList *slist;
   
   for (slist = free_list; slist; slist = slist->next)
     {
       GtkAccelGroup *accel_group;
       
       accel_group = slist->data;
-      accel_group->attach_objects = g_slist_remove (accel_group->attach_objects, object);
+      accel_group->attach_objects = g_slist_remove (accel_group->attach_objects, where_the_object_was);
       g_object_unref (accel_group);
     }
   g_slist_free (free_list);
@@ -232,12 +230,15 @@ gtk_accel_group_attach (GtkAccelGroup     *accel_group,
   accel_group->attach_objects = g_slist_prepend (accel_group->attach_objects, object);
   g_object_ref (accel_group);
   slist = g_object_get_qdata (object, accel_groups_key_id);
-  if (!slist)
-    g_object_weak_ref(object,
-                     (GWeakNotify)gtk_accel_group_object_destroy,
-                     object);
+  if (slist)
+    g_object_weak_unref(object,
+                       (GWeakNotify)gtk_accel_group_object_destroy,
+                       slist);
   slist = g_slist_prepend (slist, accel_group);
   g_object_set_qdata (object, accel_groups_key_id, slist);
+  g_object_weak_ref(object,
+                   (GWeakNotify)gtk_accel_group_object_destroy,
+                   slist);
 }
 
 void
@@ -253,12 +254,15 @@ gtk_accel_group_detach (GtkAccelGroup     *accel_group,
   accel_group->attach_objects = g_slist_remove (accel_group->attach_objects, object);
   g_object_unref (accel_group);
   slist = g_object_get_qdata (object, accel_groups_key_id);
+  g_object_weak_unref(object,
+                     (GWeakNotify)gtk_accel_group_object_destroy,
+                     slist);
   slist = g_slist_remove (slist, accel_group);
-  if (!slist)
-    g_object_weak_unref(object,
-                       (GWeakNotify)gtk_accel_group_object_destroy,
-                       object);
   g_object_set_qdata (object, accel_groups_key_id, slist);
+  if (slist)
+    g_object_weak_ref(object,
+                     (GWeakNotify)gtk_accel_group_object_destroy,
+                     slist);
 }
 
 void