diff --git a/giinterfaceinfo.c b/giinterfaceinfo.c index 69cd63d90..f998da446 100644 --- a/giinterfaceinfo.c +++ b/giinterfaceinfo.c @@ -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 diff --git a/giinterfaceinfo.h b/giinterfaceinfo.h index 8cab9961a..ce40cda7e 100644 --- a/giinterfaceinfo.h +++ b/giinterfaceinfo.h @@ -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);