After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 307312 - gnome_program_init () should support GOption
gnome_program_init () should support GOption
Product: libgnome
Classification: Deprecated
Component: general
Other Linux
: Normal normal
: ---
Assigned To: libgnome maintainer
libgnome maintainer
Depends on: 302632 308886
Blocks: 310620
Reported: 2005-06-11 18:29 UTC by Hans Breuer
Modified: 2005-10-03 14:52 UTC
See Also:
GNOME target: ---
GNOME version: ---

GOption patch for libgnome (13.06 KB, patch)
2005-06-19 18:43 UTC, Pawel Sliwowski
none Details | Review
GOption Patch for libgnomeui (5.89 KB, patch)
2005-06-19 18:45 UTC, Pawel Sliwowski
none Details | Review
GOption Patch for libbonobo (2.15 KB, patch)
2005-06-19 18:45 UTC, Pawel Sliwowski
none Details | Review
GOption patch for libbonoboui (3.36 KB, patch)
2005-06-19 18:47 UTC, Pawel Sliwowski
none Details | Review
GOption patch for libbonoboui (3.32 KB, patch)
2005-06-19 19:18 UTC, Pawel Sliwowski
none Details | Review
Add GOption to libgnome (13.62 KB, patch)
2005-06-21 23:48 UTC, Pawel Sliwowski
none Details | Review
updated patch for libbonobo (3.12 KB, patch)
2005-09-29 13:52 UTC, Christian Persch
none Details | Review
updated libgnome patch (13.98 KB, patch)
2005-09-29 14:00 UTC, Christian Persch
none Details | Review
updated libbonoboui patch (2.68 KB, patch)
2005-09-29 14:01 UTC, Christian Persch
none Details | Review
updated libgnomeui patch (8.67 KB, patch)
2005-09-29 14:03 UTC, Christian Persch
none Details | Review

Description Hans Breuer 2005-06-11 18:29:52 UTC
With glib-2.6 there was the the GOption parsing facility
added. This is much appreciated - especially for programs
which are also cross platform like Dia.
But there seems to be no clean way to integrate required
gnome program initialization GOption.
So currently POPT (for GNOME) and GOption (for the rest) 
need to maintained which is quite a bloody mess:

See also:
Comment 1 Pawel Sliwowski 2005-06-19 18:43:28 UTC
Created attachment 48010 [details] [review]
GOption patch for libgnome

Added 4 new parms
- PARM_GOPTION_CONTEXT (readonly) - GOption Contexzt
- PARM_GOPTION_TABLE - The Applications GOptionEntry
- PARM_GOPTION_NAME - The name to add to help
- PARM_GOPTION_ENABLE - tell libgnome to use goption (default is FALSE)
Using to get the other GOptionGroup from the modules
that get loaded
Comment 2 Pawel Sliwowski 2005-06-19 18:45:01 UTC
Created attachment 48011 [details] [review]
GOption Patch for libgnomeui

Just added GoptionTable to the GnomeModuleInfo and add GOptionGroup to
Comment 3 Pawel Sliwowski 2005-06-19 18:45:44 UTC
Created attachment 48012 [details] [review]
GOption Patch for libbonobo

Just added GoptionTable to the GnomeModuleInfo and add GOptionGroup to
Comment 4 Pawel Sliwowski 2005-06-19 18:47:47 UTC
Created attachment 48013 [details] [review]
GOption patch for libbonoboui

Just added GoptionTable to the GnomeModuleInfo and added GOptionGroup to
expansion1. Need to check if goption is enabled for bonobo-ui-init_gtk.c
because gtk_get_option_group sets up the arguments and calls gtk_init already
for us.
Comment 5 Pawel Sliwowski 2005-06-19 18:51:02 UTC
Just apply all the patches above in the appropriate modules.

Just tell me if you need anything changed or added. I used to expansion1 to
avoid adding a new gpointer to GnomeModuleInfo, but would be easy to change that.
Comment 6 Pawel Sliwowski 2005-06-19 18:55:04 UTC
This patchset depends on the patch from Bug 302632: no way to have a no-arg
G_OPTION_ARG_CALLBACK; which now has been committed.
Comment 7 Pawel Sliwowski 2005-06-19 19:18:59 UTC
Created attachment 48015 [details] [review]
GOption patch for libbonoboui

I had debug g_print statement in the last patch, which I forgot to remove.
Comment 8 Pawel Sliwowski 2005-06-21 23:48:41 UTC
Created attachment 48136 [details] [review]
Add GOption to libgnome

I fixed a bug in my libgnome patch concerning error handling of
goption_context_parse. So now it will inform the user of incorrect options and
tell them to type --help.
Comment 9 Kjartan Maraas 2005-06-30 21:59:20 UTC
Anders, could you comment on these?
Comment 10 Pawel Sliwowski 2005-07-01 00:51:05 UTC
This patch has another dependency for bug 308886. I am currently using
G_OPTION_FLAG_NO_ARG for some of the goption_tables, but this flag might be
removed for a more generic G_OPTION_CALLBACK.
Comment 11 Pawel Sliwowski 2005-07-12 19:23:41 UTC
Bug 308886 has been fixed and nothing has to be changed with the patches; so
they can be used now without any problems.
Comment 12 Pawel Sliwowski 2005-07-22 02:34:21 UTC
Can someone look at this patch and commit it?
Comment 13 Christian Persch 2005-07-23 22:33:55 UTC
I noticed that you only added a param for an array of GOptionEntry:s, which
means that all of the program's options will be in just one, the main, option
group. I think it would make sense to add a parm for an array of GOptionGroup:s,
so that programs can organise their options into option groups.
Comment 14 Christian Persch 2005-09-26 19:14:03 UTC
Mr. Meeks: kmaraas ok'd the libgnome[ui] patches on irc, but they depend on the
libbonobo[ui] patches (attachment 48012 [details] [review] and attachment 48015 [details] [review]); are those ok with
Comment 15 Michael Meeks 2005-09-27 06:42:04 UTC
I have no problem with the thrust of the patch as long as it doesn't break the
ABI :-)
Comment 16 Christian Persch 2005-09-29 13:52:13 UTC
Created attachment 52803 [details] [review]
updated patch for libbonobo

Final libbonobo patch: bump libbonobo version to 2.13.0, and update glib

No ABI changes; one API addition: bonobo_activation_get_goption_group(), which
is similar to the existing extern struct poptOption
bonobo_activation_popt_options[] for popt.
Comment 17 Christian Persch 2005-09-29 14:00:13 UTC
Created attachment 52804 [details] [review]
updated libgnome patch

Final patch for libgnome: bump libbonobo and glib requirements.

I simplified the previous patch: instead of passing GNOME_PARAM_GOPTION_ENABLE,
_TABLE, _NAME (and _GETTEXT_DOMAIN, which the patch was missing!) just so
libgnome can do g_option_context_new() + g_option_context_add_main_entries(), I
reduced that to one param GNOME_PARAM_GOPTION_CONTEXT which if set enabled
GOption argument parsing, i.e. like this:

context = g_option_context_new ("test");
g_option_context_add_main_entries (context, entries, GETTEXT_DOMAIN);
gnome_program_inti (...., GNOME_PARAM_GOPTION_CONTEXT, context,...);

One thing I'm unsure about is memory management: should the context become the
owned by the GnomeProgram (it's that way now), or not? (GOptionContext isn't

I added documentation for the new parameter, and note to gnome_program_preinit
docs that it'll return NULL when using GOption parsing (this is no API or ABI
breakage since GOption parsing is enabled only when you enable it explicitly).
Comment 18 Christian Persch 2005-09-29 14:01:52 UTC
Created attachment 52805 [details] [review]
updated libbonoboui patch

Final patch for libbonoboui: bump version to 2.13.0, and
bonobo-activation/libgnome requirements to 2.13.0 and glib to 2.8.0 to
appropriate value.
Comment 19 Christian Persch 2005-09-29 14:03:23 UTC
Created attachment 52806 [details] [review]
updated libgnomeui patch

Final patch for libgnomeui: bump bonobo/glib/libgnome required versions. 

Use GOption parsing in testgnome.c.
Comment 20 Christian Persch 2005-09-29 18:38:21 UTC
Fixed on libbonobo/libgnome/libonoboui/libgnomeui HEAD. I filed bug 317545 to
deprecated the old popt argument parsing.