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 547427 - working with json
working with json
Status: RESOLVED NOTABUG
Product: cluttermm
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: cluttermm-maint
cluttermm-maint
Depends on:
Blocks:
 
 
Reported: 2008-08-12 13:27 UTC by gonen
Modified: 2011-02-28 13:46 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description gonen 2008-08-12 13:27:39 UTC
Hi,

I was thinking about how json script works with cluttermm.
From what I understand from the code, use json will call the clutter json parser, which will find the objects needed by the json script, and create them using glib object create with they type needed. But in case I subclass with cluttermm, and want to create that new object in a json file, that will not work, because glib create object cannot create c++ objects.

any ideas?
Comment 1 Murray Cumming 2008-08-15 12:40:49 UTC
Could you give us a small example of how you think an application should use the API? Then we can figure out how t make it work that way.

libglademm and Gtk::Builder both override a vfunc to give the underlying C code a chance to discover the gtkmm_* GType name to use.
Comment 2 gonen 2008-08-17 11:54:35 UTC
(In reply to comment #1)
> Could you give us a small example of how you think an application should use
> the API? Then we can figure out how t make it work that way.
> 
> libglademm and Gtk::Builder both override a vfunc to give the underlying C code
> a chance to discover the gtkmm_* GType name to use.
> 

part of example json file

{
        "id" : "green-button",
        "type" : "ClutterRectangle",
        "color" : "#00ff00ff",
        "border-width" : 5,
        "border-color" : "#00cc00ff",
        "x" : 200,
        "y" : 50,
        "width" : 100,
        "height" : 100,
        "reactive" : true,
        "signals" : [
          { "name" : "button-press-event", "handler" : "clutter_main_quit" }
        ]
      }, 

When you load the script, a script parser will go over the script, and create new glib objects as needed, in this example, it will create ClutterRectangle object.
I would like to be able to inherit from clutter::actor, and then be able to use the json script to create those objects, not sure how you specify that it isnt a c object, but a c++ object, maybe you can define a special object c object for that, and add parameter like c++type: to specify the c++ object that is really needed.
Comment 3 Murray Cumming 2009-01-07 21:44:18 UTC
So, can't this just be like libglademm and/or Gtk::Builder?

A link to a simple C example would be nice too.
Comment 4 Murray Cumming 2010-09-02 13:05:07 UTC
Please?
Comment 5 Chris Kühl 2011-02-28 13:46:32 UTC
This was brought up on the gtkmm mailing list[1]. I think you'll find the solution there. This was not a bug just a little awkward due to the naming.

[1] https://mail.gnome.org/archives/gtkmm-list/2011-February/msg00110.html