g_object_get_property() with unknown type
- From: ole nielsby pils org
- To: gtk-list gnome org
- Subject: g_object_get_property() with unknown type
- Date: Mon, 31 Dec 2007 17:30:39 +0100 (CET)
Given a GObject* and a property name, what are the steps
required to extract the property inty a GValue, not
knowing its type beforehand?
It seems I can only make g_object_get_property work if
I set the type of the GValue before the call.
This code works when the property is string-valued:
GValue v = {0, };
g_value_init(&v, G_TYPE_STRING);
g_object_get_property(object, name, &v);
- but is it not possible to initialize the GValue in a
manner so that g_object_get_property() can switch to
the appropriate type?
I tried with G_TYPE_INVALID and G_TYPE_NONE but this doesn't
work.
If I really do need to walk the type information, what are the
steps required to find out the type and initialize the GValue?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]