G_PARAM_SPEC_VALUE_TYPE() question
- From: Marc Balmer <marc msys ch>
- To: gtk-app-devel-list gnome org
- Subject: G_PARAM_SPEC_VALUE_TYPE() question
- Date: Tue, 15 May 2012 08:39:12 +0200
Hi
I want to set properties of an object using the g_value_set_<type>()
functions and to cast my value (which I get from a Lua script, which
e.g. does not differentiate between integers and floats) I need to know
the type of the property.
Ideally something like the following:
switch (G_PARAM_SPEC_VALUE_TYPE(prop)) {
case G_TYPE_INT:
g_value_set_int(...);
break;
case G_TYPE_STRING:
g_value_set_string(...);
break;
}
You get the idea... This works for basic types, but not for e.g.
GParamEnum, i.e. when G_PARAM_SPEC_TYPE_NAME() returns "GParamEnum",
above scheme seems not to work. There is a type G_TYPE_ENUM, but it is
not returned in case of "GParamEnum".
(In my example I want to set the 'tab-pos' property of a Notebook widget).
Any hints how I can discriminate on the type of an enum?
- mb
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]