GNOME Bugzilla – Bug 689434
gi: Add a nicer toString() for boxed objects too
Last modified: 2012-12-01 20:48:49 UTC
Previously we just printed "GLib_Boxed"; but now you see the same thing we print for GObjects. This is useful for all the same reasons, but the one I wanted in particular for debugging my app was to know the GIName/GType.
Created attachment 230389 [details] [review] gi: Add a nicer toString() for boxed objects too
Review of attachment 230389 [details] [review]: Maybe this makes sense for more types, like unions, interfaces and paramspecs. ::: gi/boxed.c @@ +107,3 @@ + gjs_throw(context, + "This JS object wrapper isn't wrapping a GBoxed." + " If this is a custom subclass, are you sure you chained" We don't support inheriting from GBoxed.
Created attachment 230400 [details] [review] gi: Add a nicer toString() for boxed objects too Use priv_from_js_with_typecheck() rather than open-coding it. Add unions too. I didn't add this to GObject_Interface because honestly you never see them - they're basically a hidden implementation detail of method lookups. If for example you call GLib.File.new_for_path(), which is annotated to return the interface Gio.File, we find the underlying GType and give you an object proxy back for that; we don't give you a gjs GObject_Interface wrapper. As for paramspecs - seems like a separate patch to me, since it needs something more custom. I never see paramspecs personally either...
Review of attachment 230400 [details] [review]: Looks fine
Attachment 230400 [details] pushed as 58cb9cd - gi: Add a nicer toString() for boxed objects too