I am trying to work with the g_enum_get_value() and seems to work, but I am not sure if I am colleting the Information in the right way.
Is this a good approach ?
#include <gtk/gtk.h>
int main ( void )
{
GtkWidget *button;
GParamSpec *property;
const GValue *default_prop_value;
/// ***
gtk_init ( NULL, NULL );
/// ***
button = gtk_button_new_with_label ( "Click" );
g_object_set( button, "relief", GTK_RELIEF_NONE, NULL );
/// *** Find the Property
property = g_object_class_find_property ( G_OBJECT_GET_CLASS ( button ), "relief" );
/// *** Get the name of the Property
g_print ( "The property name\t=\t%-10s\n", g_param_spec_get_name( property ) );
/// *** Get the default value of the Property
default_prop_value = g_param_spec_get_default_value ( property );
/// *** Print the Value
GEnumClass *enum_class;
GEnumValue *enum_value;
gint actual_enum_value;
GType type_default_value;
/// Get the actual value
g_object_get ( button, "relief", &actual_enum_value, NULL );
/// Get the Type of the default value
type_default_value = G_VALUE_TYPE ( default_prop_value );
enum_class = g_type_class_ref ( type_default_value );
enum_value = g_enum_get_value ( enum_class, actual_enum_value );
g_print ( "The value is\t\t=\t%s\n", enum_value->value_name );
g_type_class_unref ( enum_class );
gtk_main ();
}
Outputs:
The property name = relief
The value is = GTK_RELIEF_NONE