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 700643 - Allow creating custom tree models
Allow creating custom tree models
Status: RESOLVED OBSOLETE
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
: 690780 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-05-19 16:43 UTC by Giovanni Campagna
Modified: 2018-01-27 11:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
boxed: mark structs with gpointer fields as simple (1.67 KB, patch)
2013-05-19 16:44 UTC, Giovanni Campagna
none Details | Review
Add support for marshalling void* (4.61 KB, patch)
2013-05-19 16:44 UTC, Giovanni Campagna
none Details | Review

Description Giovanni Campagna 2013-05-19 16:43:58 UTC
I don't know why, because the treemodel API is definitely not JS friendly, but apparently developers would like to build GtkTreeModels in JS, without extending or wrapping ListStore/TreeStore.
(https://live.gnome.org/NikitaChuraev/GlaringGjsApiIssues)

AFAIK, the only thing blocking it is that GtkTreeIter does not have a constructor, and we prevent simple construction of structures with pointer fields.
This is correct for complex pointer fields, as we cannot memory manage them, but for opaque pointers just having them always null should be fine.

I also prepared a patch that introduces marshalling of gpointer (so that you can use the rest of GtkTreeIter), but the more I look at it, the less I like it...
Comment 1 Giovanni Campagna 2013-05-19 16:44:29 UTC
Created attachment 244719 [details] [review]
boxed: mark structs with gpointer fields as simple

Even if we cannot set the field, it's pretty safe to initialize
it to NULL, and then you can use the rest of the structure.
This enables construction of Gtk.TreeIter, even if limited to
stamp.
Comment 2 Giovanni Campagna 2013-05-19 16:44:33 UTC
Created attachment 244720 [details] [review]
Add support for marshalling void*

void pointers are sometimes used for tags, such as in GtkTreeIter,
so it is useful to have basic marshalling implemented.
Note that they're treated like integers, and marshalled as doubles
in 64-bit arches, so there is no memory management involved.
Comment 3 Cosimo Cecchi 2015-10-28 01:00:55 UTC
*** Bug 690780 has been marked as a duplicate of this bug. ***
Comment 4 Philip Chimento 2017-04-02 23:52:21 UTC
Cosimo, my notes from when we were talking about this bug say "better solved with some kind of override" but now I can't remember what our plan was :-(
Comment 5 GNOME Infrastructure Team 2018-01-27 11:53:21 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gjs/issues/71.