GNOME Bugzilla – Bug 605778
[PATCH] [scanner] Add an --add-init-function argument
Last modified: 2015-02-07 16:58:45 UTC
Created attachment 150597 [details] [review] Add an --add-init-function argument One might need to call some init functions before being able to call get_type() to create the types of a library. --add-init-function let the user insert some init functions in the introspection program. This is similar to the --type-init-func argument of gtk-doc's scangobj. I needed this when introspecting a GstElement that needs to have GStreamer initialized before creating the element.
Review of attachment 150597 [details] [review]: What do you think about --add-init-section="<arbitrary code block here>"? This is really close it seems, all we're doing is appending ";".
Created attachment 150851 [details] [review] take 2 (call the argument --add-init-section instead of --add-init-function) That's absolutely fine with me and is more general indeed. Updated patch attached.
Review of attachment 150851 [details] [review]: ::: giscanner/dumper.py @@ +99,3 @@ + self._options.init_sections]) + tpl_args['init_sections'] = ''.join([section + ";\n" for section in + tpl_args = {} You're still suffixing the ';' here, which feels too magic. It feels more natural to me like: g-ir-scanner --add-init-section="foo_init(); bar_init(BAR_OPT_BAZ);" i.e. we're just inserting your arbitrary C code exactly as is, rather than g-ir-scanner --add-init-section="foo_init()" --add-init-section="bar_init(BAR_OPT_BAZ)"
Created attachment 150852 [details] [review] take 3 (don't add ';' at the end of each section) I noticed that the gtk-doc counterpart allowed not to put the ';' and it should not hurt to add random ';' at the end of each sections. That said it's not particularly useful nor beautiful.
Review of attachment 150852 [details] [review]: Great, thank you!
Can you commit it? I don't have a GNOME account (yet! might ask for one soon :p)
*** Bug 594209 has been marked as a duplicate of this bug. ***
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]