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.
This commit is contained in:
Owen Taylor 2000-10-29 07:02:48 +00:00 committed by Owen Taylor
parent c5695bf798
commit 300e3bb247
3 changed files with 43 additions and 0 deletions

View File

@ -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

View File

@ -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,

View File

@ -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,