static VALUE rg_get_signal(VALUE self, VALUE rb_n_or_name) { GIInterfaceInfo *info; GISignalInfo *signal_info; info = SELF(self); if (RB_TYPE_P(rb_n_or_name, T_FIXNUM)) { gint n; n = NUM2INT(rb_n_or_name); signal_info = g_interface_info_get_signal(info, n); } else { #ifdef HAVE_G_INTERFACE_INFO_FIND_SIGNAL const char *name; name = RVAL2CSTR(rb_n_or_name); signal_info = g_interface_info_find_signal(info, name); #else rb_raise(rb_eArgError, "g_interface_info_find_signal() is defined " "since GObjectIntrospection 1.34"); #endif } return GI_BASE_INFO2RVAL_WITH_UNREF(signal_info); }
static GISignalInfo * _pygi_lookup_signal_from_g_type (GType g_type, const gchar *signal_name) { GIRepository *repository; GIBaseInfo *info; GISignalInfo *signal_info = NULL; repository = g_irepository_get_default(); info = g_irepository_find_by_gtype (repository, g_type); if (info == NULL) return NULL; if (GI_IS_OBJECT_INFO (info)) signal_info = g_object_info_find_signal ((GIObjectInfo *) info, signal_name); else if (GI_IS_INTERFACE_INFO (info)) signal_info = g_interface_info_find_signal ((GIInterfaceInfo *) info, signal_name); g_base_info_unref (info); return signal_info; }