renamed owen's g_type_signals(), added required mutex locks.
authorTim Janik <timj@gtk.org>
Mon, 30 Oct 2000 03:36:22 +0000 (03:36 +0000)
committerTim Janik <timj@src.gnome.org>
Mon, 30 Oct 2000 03:36:22 +0000 (03:36 +0000)
Mon Oct 30 03:00:07 2000  Tim Janik  <timj@gtk.org>

        * gsignal.[hc] (g_signal_list_ids): renamed owen's g_type_signals(),
        added required mutex locks.

gobject/ChangeLog
gobject/gsignal.c
gobject/gsignal.h

index 49e93e4..2b4b184 100644 (file)
@@ -1,3 +1,8 @@
+Mon Oct 30 03:00:07 2000  Tim Janik  <timj@gtk.org>
+
+       * gsignal.[hc] (g_signal_list_ids): renamed owen's g_type_signals(),
+       added required mutex locks.
+
 Sun Oct 29 02:31:03 2000  Owen Taylor  <otaylor@redhat.com>
 
        * gsignal.c (g_type_signals): Fix problem where signals
index 48ad7c1..6744eac 100644 (file)
@@ -693,45 +693,48 @@ g_signal_query (guint         signal_id,
 }
 
 /**
- * gtk_signals_list:
+ * g_signal_list_ids:
  * @itype: an  
- * @n_ids: location to store number of ids in @itype
+ * @n_ids: location to store number of signal ids for @itype
  * 
  * List all signals for a given type.
  *
- * Return value: Array 
+ * Return value: Newly allocated array of signal ids.
  **/
-guint *
-g_type_signals (GType    itype,
-               guint   *n_ids)
+guint*
+g_signal_list_ids (GType  itype,
+                  guint *n_ids)
 {
-  guint i;
   SignalKey *keys;
-  guint n_nodes;
   GArray *result;
+  guint n_nodes;
+  guint i;
 
-  g_return_val_if_fail (n_ids != NULL, NULL);
   g_return_val_if_fail (G_TYPE_IS_INSTANTIATABLE (itype) || G_TYPE_IS_INTERFACE (itype), NULL);
+  g_return_val_if_fail (n_ids != NULL, NULL);
+
+  G_LOCK (g_signal_mutex);
 
   keys = g_signal_key_bsa.nodes;
   n_nodes  = g_signal_key_bsa.n_nodes;
   result = g_array_new (FALSE, FALSE, sizeof (guint));
   
   for (i = 0; i < n_nodes; i++)
-    {
-      if (keys[i].itype == itype)
-       {
-         gchar *name = g_quark_to_string (keys[i].quark);
-         /* Signal names with "_" in them are aliases to the same
-          * name with "-" instead of "_".
-          */
-         if (!strchr (name, '_'))
-           g_array_append_val (result, keys[i].signal_id);
-       }
-    }
+    if (keys[i].itype == itype)
+      {
+       gchar *name = g_quark_to_string (keys[i].quark);
+
+       /* Signal names with "_" in them are aliases to the same
+        * name with "-" instead of "_".
+        */
+       if (!strchr (name, '_'))
+         g_array_append_val (result, keys[i].signal_id);
+      }
 
   *n_ids = result->len;
 
+  G_UNLOCK (g_signal_mutex);
+  
   return (guint *) g_array_free (result, FALSE);
 }
 
index 600b93d..f6db745 100644 (file)
@@ -104,9 +104,8 @@ guint       g_signal_lookup                 (const gchar            *name,
 gchar* g_signal_name                   (guint                   signal_id);
 void   g_signal_query                  (guint                   signal_id,
                                         GSignalQuery           *query);
-
-guint * g_type_signals                  (GType                   itype,
-                                        guint                  *n_ids);
+guint* g_signal_list_ids               (GType                   itype,
+                                        guint                  *n_ids);
 
 /* --- signal handlers --- */
 guint   g_signal_connect_closure       (gpointer                instance,