GNOME Bugzilla – Bug 336078
[PATCH] Convert from popt to GOption
Last modified: 2006-06-21 15:56:37 UTC
In the spirit of GNOME Goals, here's file-roller's treatment. http://live.gnome.org/GnomeGoals/PoptGOption
Created attachment 62040 [details] [review] file-roller-goption.patch Port to GOption. main.c | 75 ++++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 40 insertions(+), 35 deletions(-)
"context = g_option_context_new (_(" - File Roller"));" Should rather the Comment ("Create and modify an archive") from the .desktop be used? If you want to use the currently translated string, maybe something like: "description = g_strdup_printf ("- %s", _("Create and modify an archive"))); context = g_option_context_new (description); g_free (description);"
Created attachment 62102 [details] [review] file-roller-goption.patch 2 Second version, which uses the description from the .desktop file. main.c | 77 +++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 42 insertions(+), 35 deletions(-)
If you use the trick suggested by seb, you should declare 'gchar *description' at the top of the block, otherwise it will break non C99 compilers.
Created attachment 62186 [details] [review] file-roller-goption.patch 3 Third version, as to Paolo's suggestion. main.c | 78 +++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 43 insertions(+), 35 deletions(-)
Created attachment 62187 [details] [review] file-roller-goption.patch 3 Small indentation fix
"extract-to", "extract-here" and "default-dir" options should use G_OPTION_ARG_FILENAME, not STRING. However the current popt code doesn't seem to make a distinction either, and there's more code to check (check that the arguments are converted to UTF-8 whenever they're used for display, but used as-is when used in filenames/paths), so I guess that could be done in a follow-up bug.
patch applied, thanks.