GNOME Bugzilla – Bug 721947
Improve GApplication ⇔ GOptionContext compatibility
Last modified: 2014-01-11 05:48:53 UTC
See patches.
Created attachment 265952 [details] [review] GOptionContext: add memory-friendly parse mode Add g_option_context_parse_strv() that obeys the normal memory conventions for dealing with a strv instead of assuming that we're dealing with the 'argv' parameter to main(). This will help for using GOptionContext with GApplication.
Created attachment 265953 [details] [review] tests: fix leaks in option-context test Use the new g_option_context_parse_strv() to patch up some leaks in some insufficiently-argv-emulating testcases in option-context.c. This gives some test coverage of the new function while also making option-context now leak-free.
Created attachment 265956 [details] [review] gedit-app: use g_option_context_parse_strv() Instead of our own function to do (almost) the same.
Review of attachment 265952 [details] [review]: See minor comment. Apart from that looks good. ::: glib/goption.c @@ +2474,3 @@ + * @context: a #GOptionContext + * @arguments: (inout) (array null-terminated=1): a pointer to the command line arguments + * @error: a return location for errors missing annotation?
Review of attachment 265953 [details] [review]: Looks good
Review of attachment 265956 [details] [review]: nice. go ahead
Review of attachment 265952 [details] [review]: ::: glib/goption.c @@ +2486,3 @@ + * + * This function is useful if you are trying to use #GOptionContext with + * #GApplication. I think this calls or an example (probably over on the GApplication side)
I've started writing docs (with examples) here: https://wiki.gnome.org/HowDoI/GtkApplication/CommandLine