GNOME Bugzilla – Bug 547427
working with json
Last modified: 2011-02-28 13:46:32 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?
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.
(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.
So, can't this just be like libglademm and/or Gtk::Builder? A link to a simple C example would be nice too.
Please?
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