After I was reading the documentation of Gvalue, GType, GparamSpec and
Parameters and Values I noticed that I can not figure out how to store
the value of a property in the Text format.
Short answer is: you can’t.
Long answer is: The thing that made me say “you can’t” is that a GValue
can hold raw pointers and whatnot, and it doesn’t make sense to store
those. For the same reason, you cannot really serialize all GObject either.
This pretty much answers the question why there isn’t
g_value_to_string()/g_value_from_string() functions.
You can somewhat g_value_transform() [1], but it explicitly tells you
not to for anything else than debugging. Same goes for
g_strdup_value_contents().
However, you can partly do this for a selected set of GTypes. You’ll
have to handle some of those manually, but it might give you what you want.
[1]
[…]
I can retrive its default value, but I cannot fugure out how to print it
to the screen in Text mode, something like:The Default Value of the property is “GTK_RELIEF_NORMAL”. |
You can use g_enum_get_value() [2], see
[2]