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 635879 - Change the gdk_rgba_parse() function to something usable from language bindings
Change the gdk_rgba_parse() function to something usable from language bindings
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
2.91.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2010-11-26 21:20 UTC by Emmanuele Bassi (:ebassi)
Modified: 2010-11-29 12:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
rgba: Invert the arguments and improve bindability (6.09 KB, patch)
2010-11-28 18:55 UTC, Emmanuele Bassi (:ebassi)
committed Details | Review
rgba: Invert the arguments and improve bindability (6.09 KB, patch)
2010-11-29 12:47 UTC, Emmanuele Bassi (:ebassi)
none Details | Review

Description Emmanuele Bassi (:ebassi) 2010-11-26 21:20:16 UTC
the GdkRGBA.parse() function inherited the wrong signature from GdkColor:

  gboolean gdk_rgba_parse (const char *string, GdkRGBA *color);

this leads to odd, or ad hoc bindings for other languages - and with introspection it results in something that has to be special-cased.

the correct function signature should be:

  gboolean gdk_rgba_parse (GdkRGBA *color, const char *string);

which will translate into:

  color.parse(string)

instead of:

  Gdk.RGBA.parse(string, color);

for prior art, I submit clutter_color_from_string(), which had to be fixed for the very same reason.

the patch is trivial, and I can cook it up in 5 minutes.
Comment 1 Matthias Clasen 2010-11-28 02:02:37 UTC
> the patch is trivial, and I can cook it up in 5 minut

If you can do it before Monday, I can include it in 2.91.5.
Comment 2 Emmanuele Bassi (:ebassi) 2010-11-28 18:55:49 UTC
Created attachment 175426 [details] [review]
rgba: Invert the arguments and improve bindability

Since parse() is a method of the Gdk.RGBA class, the GdkRGBA pointer
should be the first argument, and the string the second one, to allow a
more natural binding.
Comment 3 Matthias Clasen 2010-11-28 20:54:59 UTC
Review of attachment 175426 [details] [review]:

Looks easy enough. Of course, rebasing gtk-style-context will be a bit more work...
Comment 4 Emmanuele Bassi (:ebassi) 2010-11-28 21:17:01 UTC
Attachment 175426 [details] pushed as 1779ae7 - rgba: Invert the arguments and improve bindability
Comment 5 Emmanuele Bassi (:ebassi) 2010-11-29 12:47:50 UTC
Created attachment 175458 [details] [review]
rgba: Invert the arguments and improve bindability

Since parse() is a method of the Gdk.RGBA class, the GdkRGBA pointer
should be the first argument, and the string the second one, to allow a
more natural binding.