/* This method returns a particular metadata entry in the given namespace. The * namespace must have already been loaded before calling this function. See * GObjectIntrospection::Repository#get_n_infos() to find the maximum number * of entries. * * @param [String] namespace The namespace to fetch the metadata entry from. * @param [Fixnum] index The index of the entry. * * @return [GObjectIntrospection::BaseInfo] The metadata entry. */ static VALUE rg_get_info(VALUE self, VALUE rb_namespace, VALUE rb_n) { GIRepository *repository; const gchar *namespace_; gint n; GIBaseInfo *info; repository = SELF(self); namespace_ = RVAL2CSTR(rb_namespace); n = NUM2INT(rb_n); info = g_irepository_get_info(repository, namespace_, n); return GI_BASE_INFO2RVAL_WITH_UNREF(info); }
static PyObject * _wrap_g_irepository_get_infos (PyGIRepository *self, PyObject *args, PyObject *kwargs) { static char *kwlist[] = { "namespace", NULL }; const char *namespace_; gssize n_infos; PyObject *infos; gssize i; if (!PyArg_ParseTupleAndKeywords (args, kwargs, "s:Repository.get_infos", kwlist, &namespace_)) { return NULL; } n_infos = g_irepository_get_n_infos (self->repository, namespace_); if (n_infos < 0) { PyErr_Format (PyExc_RuntimeError, "Namespace '%s' not loaded", namespace_); return NULL; } infos = PyTuple_New (n_infos); for (i = 0; i < n_infos; i++) { GIBaseInfo *info; PyObject *py_info; info = g_irepository_get_info (self->repository, namespace_, i); g_assert (info != NULL); py_info = _pygi_info_new (info); g_base_info_unref (info); if (py_info == NULL) { Py_CLEAR (infos); break; } PyTuple_SET_ITEM (infos, i, py_info); } return infos; }