After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 695217 - Add G_SETTINGS_BIND_ENUM.
Add G_SETTINGS_BIND_ENUM.
Status: RESOLVED NOTABUG
Product: glib
Classification: Platform
Component: gsettings
2.35.x
Other Linux
: Normal enhancement
: ---
Assigned To: Allison Karlitskaya (desrt)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-03-05 14:39 UTC by Matthew Barnes
Modified: 2013-03-06 16:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (5.22 KB, patch)
2013-03-05 16:12 UTC, Matthew Barnes
none Details | Review

Description Matthew Barnes 2013-03-05 14:39:10 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().
Comment 1 Matthew Barnes 2013-03-05 16:12:38 UTC
Created attachment 238140 [details] [review]
Proposed patch

First attempt at a patch.  Mapping functions were slightly more complicated than anticipated, but not too bad.
Comment 2 Matthew Barnes 2013-03-05 16:21:15 UTC
s/integral/integer/ in the docs.  Apparently I'm misusing that word.
Comment 3 Allison Karlitskaya (desrt) 2013-03-06 15:59:27 UTC
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.
Comment 4 Matthew Barnes 2013-03-06 16:41:13 UTC
You're right.  On second look I was trying bind to a G_TYPE_INT property.

Apologies for the false report.  Closing as NOTABUG.