summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2000-10-29 07:02:48 +0000
committerOwen Taylor <otaylor@src.gnome.org>2000-10-29 07:02:48 +0000
commit300e3bb247216fee40254822c2fb60a78a8ef21c (patch)
treeeec8e992611087ebd8d4224240784b4c08d3060e
parentc5695bf798f899db7536d8aa930f9f439beef29a (diff)
Add g_type_signals() - a function to list all signals for a given type.
Sun Oct 29 01:58:44 2000 Owen Taylor <otaylor@redhat.com> * gsignal.h: Add g_type_signals() - a function to list all signals for a given type.
-rw-r--r--gobject/ChangeLog5
-rw-r--r--gobject/gsignal.c36
-rw-r--r--gobject/gsignal.h2
3 files changed, 43 insertions, 0 deletions
diff --git a/gobject/ChangeLog b/gobject/ChangeLog
index 511bcc0ee..4a01755e6 100644
--- a/gobject/ChangeLog
+++ b/gobject/ChangeLog
@@ -1,3 +1,8 @@
+Sun Oct 29 01:58:44 2000 Owen Taylor <otaylor@redhat.com>
+
+ * gsignal.h: Add g_type_signals() - a function to list
+ all signals for a given type.
+
Sat Oct 28 00:28:09 2000 Tim Janik <timj@gtk.org>
* gclosure.c (g_closure_add_marshal_guards): fixed notifier position
diff --git a/gobject/gsignal.c b/gobject/gsignal.c
index 0c4f11759..1a32234ba 100644
--- a/gobject/gsignal.c
+++ b/gobject/gsignal.c
@@ -690,6 +690,42 @@ g_signal_query (guint signal_id,
G_UNLOCK (g_signal_mutex);
}
+/**
+ * gtk_signals_list:
+ * @itype: an
+ * @n_ids: location to store number of ids in @itype
+ *
+ * List all signals for a given type.
+ *
+ * Return value: Array
+ **/
+guint *
+g_type_signals (GType itype,
+ guint *n_ids)
+{
+ guint i;
+ SignalKey *keys;
+ guint n_nodes;
+ GArray *result;
+
+ 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);
+
+ 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)
+ g_array_append_val (result, keys[i].signal_id);
+ }
+
+ *n_ids = result->len;
+
+ return (guint *) g_array_free (result, FALSE);
+}
+
guint
g_signal_newv (const gchar *signal_name,
GType itype,
diff --git a/gobject/gsignal.h b/gobject/gsignal.h
index bc2f75c80..600b93d41 100644
--- a/gobject/gsignal.h
+++ b/gobject/gsignal.h
@@ -105,6 +105,8 @@ 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);
/* --- signal handlers --- */
guint g_signal_connect_closure (gpointer instance,