Constructs a OptionGroup suitable for use with Glib's command-line option parser.
This function is a bit sneaky in that it will make a copy of the program's argc and argv <emphasis>before</emphasis> GTK+ etc. has a chance to mess around with it, so SMClient can later construct an accurate restart command. Instead of calling init or init_with_args, instead you'd do something like:
<informalexample><programlisting> GOptionContext *context = g_option_context_new(""); g_option_context_add_group(context, gtk_get_option_group(TRUE)); g_option_context_add_group(context, xfce_sm_client_get_option_group(argc, argv); g_option_context_parse( context, &argc, &argv, NULL); </programlisting></informalexample>
Error checking is omitted here for brevity, and of course you could add your app's own options with add_main_entries or similar.
| argc |
The application's argument count |
| argv |
The application's argument vector |
|
A new OptionGroup |