GNOME Bugzilla – Bug 695217
Add G_SETTINGS_BIND_ENUM.
Last modified: 2013-03-06 16:41:13 UTC
I have a few cases in Evolution where I'd like to bind a GSettings string key -- which is marked in the schema file as an enumerated type -- to a GObject property of an equivalent GEnumClass type. Currently g_settings_bind() rejects this with a "type not compatible" warning. I propose adding a new flag -- G_SETTINGS_BIND_ENUM -- which would use a pair of mapping functions that call g_settings_get/set_enum(). Similar to G_SETTINGS_BIND_INVERT_BOOLEAN, this flag can only be used with g_settings_bind(), not with g_settings_bind_with_mapping().
Created attachment 238140 [details] [review] Proposed patch First attempt at a patch. Mapping functions were slightly more complicated than anticipated, but not too bad.
s/integral/integer/ in the docs. Apparently I'm misusing that word.
Something must be wrong here. If you try to bind a GSettings string to a paramspec that has an enum type then GSettings will automatically do the conversion for you; not using g_settings_get_enum() but rather using the information from GObject based on the type of the paramspec.... I think this is NOTABUG.
You're right. On second look I was trying bind to a G_TYPE_INT property. Apologies for the false report. Closing as NOTABUG.