girepository: Add g_interface_info_find_signal

Add the convenience method g_interface_info_find_signal, mirroring
g_object_info_find_signal.

https://bugzilla.gnome.org/show_bug.cgi?id=682672
This commit is contained in:
Torsten Schönfeld 2012-08-25 15:51:15 +02:00
parent 3bcc0e43c6
commit 27f11b2e51
2 changed files with 35 additions and 0 deletions

View File

@ -292,6 +292,39 @@ g_interface_info_get_signal (GIInterfaceInfo *info,
rinfo->typelib, offset);
}
/**
* g_interface_info_find_signal:
* @info: a #GIInterfaceInfo
* @name: Name of signal
*
* Returns: (transfer full): Info for the signal with name @name in @info, or
* %NULL on failure.
*
* Since: 1.34
*/
GISignalInfo *
g_interface_info_find_signal (GIInterfaceInfo *info,
const gchar *name)
{
gint n_signals;
gint i;
n_signals = g_interface_info_get_n_signals (info);
for (i = 0; i < n_signals; i++)
{
GISignalInfo *siginfo = g_interface_info_get_signal (info, i);
if (g_strcmp0 (g_base_info_get_name (siginfo), name) != 0)
{
g_base_info_unref ((GIBaseInfo*)siginfo);
continue;
}
return siginfo;
}
return NULL;
}
/**
* g_interface_info_get_n_vfuncs:
* @info: a #GIInterfaceInfo

View File

@ -48,6 +48,8 @@ GIFunctionInfo * g_interface_info_find_method (GIInterfaceInfo *info,
gint g_interface_info_get_n_signals (GIInterfaceInfo *info);
GISignalInfo * g_interface_info_get_signal (GIInterfaceInfo *info,
gint n);
GISignalInfo * g_interface_info_find_signal (GIInterfaceInfo *info,
const gchar *name);
gint g_interface_info_get_n_vfuncs (GIInterfaceInfo *info);
GIVFuncInfo * g_interface_info_get_vfunc (GIInterfaceInfo *info,
gint n);