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 336078 - [PATCH] Convert from popt to GOption
[PATCH] Convert from popt to GOption
Status: RESOLVED FIXED
Product: file-roller
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Paolo Bacchilega
file-roller-maint
Depends on:
Blocks:
 
 
Reported: 2006-03-26 13:49 UTC by Ruben Vermeersch
Modified: 2006-06-21 15:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
file-roller-goption.patch (5.80 KB, patch)
2006-03-26 13:50 UTC, Ruben Vermeersch
none Details | Review
file-roller-goption.patch 2 (5.95 KB, patch)
2006-03-27 09:41 UTC, Ruben Vermeersch
none Details | Review
file-roller-goption.patch 3 (6.05 KB, patch)
2006-03-28 08:37 UTC, Ruben Vermeersch
none Details | Review
file-roller-goption.patch 3 (6.04 KB, patch)
2006-03-28 08:39 UTC, Ruben Vermeersch
none Details | Review

Description Ruben Vermeersch 2006-03-26 13:49:20 UTC
In the spirit of GNOME Goals, here's file-roller's treatment.

http://live.gnome.org/GnomeGoals/PoptGOption
Comment 1 Ruben Vermeersch 2006-03-26 13:50:05 UTC
Created attachment 62040 [details] [review]
file-roller-goption.patch

Port to GOption.

 main.c |   75 ++++++++++++++++++++++++++++++++++-------------------------------
 1 file changed, 40 insertions(+), 35 deletions(-)
Comment 2 Sebastien Bacher 2006-03-27 09:14:42 UTC
"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);"
Comment 3 Ruben Vermeersch 2006-03-27 09:41:03 UTC
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(-)
Comment 4 Paolo Borelli 2006-03-28 08:16:51 UTC
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.
Comment 5 Ruben Vermeersch 2006-03-28 08:37:17 UTC
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(-)
Comment 6 Ruben Vermeersch 2006-03-28 08:39:40 UTC
Created attachment 62187 [details] [review]
file-roller-goption.patch 3

Small indentation fix
Comment 7 Christian Persch 2006-03-29 14:15:17 UTC
"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.
Comment 8 Paolo Bacchilega 2006-06-21 15:56:37 UTC
patch applied, thanks.