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 336286 - control-center should use goption instead of popt
control-center should use goption instead of popt
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: general
git master
Other All
: Normal enhancement
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-03-28 04:50 UTC by Michael Plump
Modified: 2007-02-07 17:52 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
patch that replaces popt with goption in control-center (12.66 KB, patch)
2006-03-28 04:50 UTC, Michael Plump
none Details | Review
Fixed version (12.62 KB, patch)
2006-03-28 06:00 UTC, Michael Plump
none Details | Review
Updated patch. (11.67 KB, patch)
2006-08-09 05:42 UTC, Lucas Rocha
needs-work Details | Review
updated patch for themus-theme-applier (3.85 KB, patch)
2007-01-07 12:40 UTC, Christian Persch
reviewed Details | Review
updated patch to apply cleanly to trunk (3.85 KB, patch)
2007-01-07 16:09 UTC, Christian Persch
reviewed Details | Review

Description Michael Plump 2006-03-28 04:50:05 UTC
Attached (in a second) is a patch to replace popt with goption in the various
control-center modules.  I did not bother patching modules that don't get built
(specifically: archiver, file-types, and rollback)
Comment 1 Michael Plump 2006-03-28 04:50:36 UTC
Created attachment 62176 [details] [review]
patch that replaces popt with goption in control-center
Comment 2 Michael Plump 2006-03-28 06:00:52 UTC
Created attachment 62177 [details] [review]
Fixed version
Comment 3 Luis Menina 2006-07-21 12:00:24 UTC
Could anyone review this, please ?
Comment 4 Lucas Rocha 2006-08-09 05:42:42 UTC
Created attachment 70524 [details] [review]
Updated patch.

Updated patch to apply in HEAD. Ok to commit. We'll need to wait until next development cycle because this patch adds new strings and we're string frozen now.
Comment 5 Lucas Rocha 2006-08-09 05:44:05 UTC
Don't forget to add libgnome 2.14.0 dependecy after commiting this patch.
Comment 6 André Klapper 2006-11-29 15:31:00 UTC
gnome-control-center has been branched for gnome 2.17.

Lucas, ready to commit this patch to HEAD?
Comment 7 Lucas Rocha 2006-11-30 10:38:01 UTC
Andre, it's up to gnome-control-center maintainers. I can commit as soon as they say it's ok.
Comment 8 Rodney Dawes 2006-12-22 15:34:11 UTC
The background portion is OK save for a few minor details. The mixed use of char and gchar. Please just use gchar everywhere. And the "description" being passed in is wrong. It should say "Desktop Background Preferences" rather than "Properties".
Comment 9 Rodrigo Moya 2007-01-06 18:59:17 UTC
Committed patch with corrections
Comment 10 Christian Persch 2007-01-06 20:27:39 UTC
Just a quick note: doing it like this doesn't work:

  context = g_option_context_new(_("- GNOME Theme Applier"));
  	         g_option_context_add_main_entries(context, options, NULL);

because you use _() before setlocale has been called.

Instead, you should use N_() (to mark the string for translation only) and g_option_context_set_translation_domain() (since glib 2.12).
Comment 11 André Klapper 2007-01-06 23:51:01 UTC
reopening as per last comment
Comment 12 Christian Persch 2007-01-07 12:40:44 UTC
Created attachment 79619 [details] [review]
updated patch for themus-theme-applier 

thos reverted the patch for themus; this patch reapplies and fixes it.
Comment 13 Christian Persch 2007-01-07 12:56:08 UTC
More comments about the committed patches:

* for background capplet:

+  if (command_line_files != NULL) {
     const gchar ** p;
 
-    for (p = args; *p != NULL; p++) {
+    for (p = (const gchar **) command_line_files; *p != NULL; p++) {
       capplet->uri_list = g_slist_append (capplet->uri_list, (gchar *) *p);
     }
---> you should |g_strfreev (command_line_files)| here.
   }

- forgets to g_object_unref (program) just before return in main()

* common/capplet-util.c:

	gnome_program_init (argv[0], VERSION, LIBGNOMEUI_MODULE, argc, argv,
-			    GNOME_PARAM_POPT_TABLE, cap_options,
+			    GNOME_PARAM_GOPTION_CONTEXT, context,
 			    NULL);

Still leaks the GnomeProgram.

* keyboard:

 	gnome_program_init ("gnome-keyboard-properties", VERSION, LIBGNOMEUI_MODULE, argc, argv,
-			    GNOME_PARAM_POPT_TABLE, cap_options,
+			    GNOME_PARAM_GOPTION_CONTEXT, context,
 			    GNOME_PARAM_APP_DATADIR, GNOMECC_DATA_DIR,
 			    NULL);

Leaks the GnomeProgram;

* Mouse:

same.

* sound:

Same, plus:

 	gnome_program_init ("gnome-sound-properties", VERSION,
 			    LIBGNOMEUI_MODULE, argc, argv,
-			    GNOME_PARAM_POPT_TABLE, cap_options,
+ 			    GNOME_PARAM_GOPTION_CONTEXT, context,
 			    NULL);
 
+	gst_init (&argc, &argv);

No! You should instead use 

g_option_context_add_group (context,  gst_init_get_option_group ());

before calling gnome_program_init.
Comment 14 Thomas Wood 2007-01-07 12:58:09 UTC
The updated patch for themus-theme-applier looks better, but there appears to be some extra glade changes at the end. Other than that, it seems to apply and build fine.
Comment 15 Christian Persch 2007-01-07 16:09:59 UTC
Created attachment 79641 [details] [review]
updated patch to apply cleanly to trunk

The 'extra glade changes' are a fix for wrong spacing in the dialogue that I had in my checkout tree. If you prefer, I can file it separately.
Comment 16 Christian Persch 2007-01-07 21:28:24 UTC
> ---> you should |g_strfreev (command_line_files)| here.

Sorry that was wrong, since the list takes the pointers... still |command_line_files| need to be free'd at the end of the programme.
Comment 17 Thomas Wood 2007-01-19 14:48:51 UTC
Patch looks ok (removing the glade changes), except the use of goto will probably make people twitch a little. If there is a patch without the goto and without the extra glade changes, it should be fine to commit.
Comment 18 Jens Granseuer 2007-02-07 17:52:24 UTC
I committed a slightly modified version of Christian's patch (sans glade changes).