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 725282 - Some fixes and improvements to GParamSpec
Some fixes and improvements to GParamSpec
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2014-02-26 22:05 UTC by Giovanni Campagna
Modified: 2014-04-10 23:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ParamSpec: fix argument marshalling (2.66 KB, patch)
2014-02-26 22:05 UTC, Giovanni Campagna
committed Details | Review
GParamSpec: remove custom constructor (14.79 KB, patch)
2014-02-26 22:05 UTC, Giovanni Campagna
committed Details | Review
GParamSpec: implement methods (7.08 KB, patch)
2014-02-26 22:05 UTC, Giovanni Campagna
committed Details | Review
all: fix method resolution on prototypes (13.13 KB, patch)
2014-02-26 22:05 UTC, Giovanni Campagna
committed Details | Review
param: use accessors to read name, nick, blurb and default value (6.22 KB, patch)
2014-02-26 22:06 UTC, Giovanni Campagna
committed Details | Review
param: implement static methods (3.06 KB, patch)
2014-02-26 22:06 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2014-02-26 22:05:15 UTC
This started of as a crasher fix for GObject.param_spec_* (which is
in the documentation), and ended up with a lot of improvements.

Unfortunately, the most beautiful improvement of all, killing off
the hand coded GParamSpec constructors, is not possible because
the JS variants have the flags argument in the wrong place.
Having automatic static methods for GParamSpec is still useful
for, say, g_param_spec_unichar(), which is not hand-coded.

Needs a gobject-introspection fix to pick up the methods.
Comment 1 Giovanni Campagna 2014-02-26 22:05:18 UTC
Created attachment 270429 [details] [review]
ParamSpec: fix argument marshalling

We need to treat GParamSpec and derived classes as gjs_param,
otherwise we fallback on gjs_fundamental and crash.
Comment 2 Giovanni Campagna 2014-02-26 22:05:25 UTC
Created attachment 270430 [details] [review]
GParamSpec: remove custom constructor

With proper argument marshalling, we don't need the custom code
anymore, the regular GObject functions works just as well.
We still need a lot of JS override code, because the arguments
are swapped...
Comment 3 Giovanni Campagna 2014-02-26 22:05:35 UTC
Created attachment 270431 [details] [review]
GParamSpec: implement methods

Methods are definitely expected for GParamSpec classes, even
more than fields, and are easy to implement.
Comment 4 Giovanni Campagna 2014-02-26 22:05:54 UTC
Created attachment 270432 [details] [review]
all: fix method resolution on prototypes

We must define as methods on prototypes only the functions
that have the IS_METHOD flag, or we get static functions there.
Comment 5 Giovanni Campagna 2014-02-26 22:06:00 UTC
Created attachment 270433 [details] [review]
param: use accessors to read name, nick, blurb and default value

The GParamSpec API provides binding friendly accessors for
name, nick, blurb and default, so we don't need to recurse the
hierarchy looking for a field.
Comment 6 Giovanni Campagna 2014-02-26 22:06:06 UTC
Created attachment 270434 [details] [review]
param: implement static methods

We can share the code with object, and get them for free.
Comment 7 Giovanni Campagna 2014-04-10 23:36:21 UTC
Attachment 270429 [details] pushed as 45bbf5b - ParamSpec: fix argument marshalling
Attachment 270430 [details] pushed as 221e158 - GParamSpec: remove custom constructor
Attachment 270431 [details] pushed as a393b31 - GParamSpec: implement methods
Attachment 270432 [details] pushed as aae358f - all: fix method resolution on prototypes
Attachment 270433 [details] pushed as c57a4d7 - param: use accessors to read name, nick, blurb and default value
Attachment 270434 [details] pushed as e20d7d7 - param: implement static methods