static PyObject * _wrap_g_constant_info_get_value (PyGIBaseInfo *self) { GITypeInfo *type_info; GIArgument value; PyObject *py_value; gboolean free_array = FALSE; if (g_constant_info_get_value ( (GIConstantInfo *) self->info, &value) < 0) { PyErr_SetString (PyExc_RuntimeError, "unable to get value"); return NULL; } type_info = g_constant_info_get_type ( (GIConstantInfo *) self->info); if (g_type_info_get_tag (type_info) == GI_TYPE_TAG_ARRAY) { value.v_pointer = _pygi_argument_to_array (&value, NULL, NULL, type_info, &free_array); } py_value = _pygi_argument_to_object (&value, type_info, GI_TRANSFER_NOTHING); if (free_array) { g_array_free (value.v_pointer, FALSE); } g_constant_info_free_value (self->info, &value); g_base_info_unref ( (GIBaseInfo *) type_info); return py_value; }
/* * Define constants toplevel. Uses the casing as in the typelib */ static void seed_gi_importer_handle_constant(JSContextRef ctx, JSObjectRef namespace_ref, GIConstantInfo* info, JSValueRef* exception) { GArgument argument; GITypeInfo* constant_type = g_constant_info_get_type(info); JSValueRef constant_value; g_constant_info_get_value(info, &argument); constant_value = seed_value_from_gi_argument(ctx, &argument, constant_type, exception); seed_object_set_property(ctx, namespace_ref, g_base_info_get_name((GIBaseInfo*) info), constant_value); g_base_info_unref((GIBaseInfo*) constant_type); g_constant_info_free_value(info, &argument); }