[maemo-developers] g_enum_get_value_by_name

From: Claudio Saavedra csaavedra at igalia.com
Date: Wed Dec 17 23:34:40 EET 2008
On Wed, 2008-12-17 at 23:15 +0200, Arto Karppinen wrote:
> Hi.
> 
> I need to save and read an enum from a GKeyFile. I was going save the 
> value as a string into the keyfile and use g_enum_get_value_by_name() to 
> parse the value, but i cant figure out how to get the GEnumClass parameter.
> 
> GEnumValue* g_enum_get_value_by_name(GEnumClass *enum_class, 
> 
>                                       const gchar *name);
> 
> Or should i be doing something else?

You can use glib-mkenums to parse your enumeration and generate these
classes automatically. That's usually done as part of the compilation
process of your application or library.

Claudio



More information about the maemo-developers mailing list