install style-property in gtk3 of type enum

Viewed 77

I want to install a enum-style- property using g_param_spec_enum:

  gtk_widget_class_install_style_property(gobject_class, g_param_spec_enum(
          "shadow-type",                //name
          "shadow-type",                //nick
          "type of shadow",             //blurb
          GtkShadowType,                //type
          GTK_SHADOW_NONE,              //default
          G_PARAM_READWRITE ));         //flags

However GtkShadowType is not a GType, so it will not work this way:

thunar-statusbar.c:106:12: error: expected expression before ‘GtkShadowType’
            GtkShadowType,    //type

Any idea how I can get a GType out of GtkShadowType?

My current fix is, to just use g_param_spec_int instead:

  gtk_widget_class_install_style_property(gobject_class, g_param_spec_int (
          "shadow-type",                //name
          "shadow-type",                //nick
          "the type of the shadow",     //blurb
          GTK_SHADOW_NONE,              //min
          GTK_SHADOW_ETCHED_OUT,        //max
          GTK_SHADOW_NONE,              //default
          G_PARAM_READWRITE));         //flags

Seems to work, but is not the official way to deal with enums.

1 Answers
Related