Index: shell/main.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/main.c,v
retrieving revision 1.180
diff -u -r1.180 main.c
--- shell/main.c	20 Feb 2006 23:33:55 -0000	1.180
+++ shell/main.c	25 Mar 2006 15:56:02 -0000
@@ -103,6 +103,7 @@
 
 static char *default_component_id = NULL;
 static char *evolution_debug_log = NULL;
+static gchar **remaining_args;
 
 static void
 no_windows_left_cb (EShell *shell, gpointer data)
@@ -460,44 +461,45 @@
 #define setup_segv_redirect() 0
 #endif
 
+static const GOptionEntry options[] = {
+	{ "component", 'c', 0, G_OPTION_ARG_STRING, &default_component_id,
+	  N_("Start Evolution activating the specified component"), NULL },
+	{ "offline", '\0', 0, G_OPTION_ARG_NONE, &start_offline,
+	  N_("Start in offline mode"), NULL },
+	{ "online", '\0', 0, G_OPTION_ARG_NONE, &start_online,
+	  N_("Start in online mode"), NULL },
+#ifdef KILL_PROCESS_CMD
+	{ "force-shutdown", '\0', 0, G_OPTION_ARG_NONE, &killev, 
+	  N_("Forcibly shut down all Evolution components"), NULL },
+#endif
+#if DEVELOPMENT
+	{ "force-migrate", '\0', 0, G_OPTION_ARG_NONE, &force_migrate, 
+	  N_("Forcibly re-migrate from Evolution 1.4"), NULL },
+#endif
+	{ "debug", '\0', 0, G_OPTION_ARG_STRING, &evolution_debug_log, 
+	  N_("Send the debugging output of all components to a file."), NULL },
+	{ "disable-eplugin", '\0', 0, G_OPTION_ARG_NONE, &disable_eplugin, 
+	  N_("Disable loading of any plugins."), NULL },
+	{ "setup-only", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE,
+	  &setup_only, NULL, NULL },
+	{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_STRING_ARRAY, &remaining_args, NULL, NULL },
+		{ NULL }
+};
+
 int
 main (int argc, char **argv)
 {
 #ifdef G_OS_WIN32
 	extern void link_shutdown (void);
 #endif
-	struct poptOption options[] = {
-		{ "component", 'c', POPT_ARG_STRING, &default_component_id, 0,
-		  N_("Start Evolution activating the specified component"), NULL },
-		{ "offline", '\0', POPT_ARG_NONE, &start_offline, 0, 
-		  N_("Start in offline mode"), NULL },
-		{ "online", '\0', POPT_ARG_NONE, &start_online, 0, 
-		  N_("Start in online mode"), NULL },
-#ifdef KILL_PROCESS_CMD
-		{ "force-shutdown", '\0', POPT_ARG_NONE, &killev, 0, 
-		  N_("Forcibly shut down all Evolution components"), NULL },
-#endif
-#if DEVELOPMENT
-		{ "force-migrate", '\0', POPT_ARG_NONE, &force_migrate, 0, 
-		  N_("Forcibly re-migrate from Evolution 1.4"), NULL },
-#endif
-		{ "debug", '\0', POPT_ARG_STRING, &evolution_debug_log, 0, 
-		  N_("Send the debugging output of all components to a file."), NULL },
-		{ "disable-eplugin", '\0', POPT_ARG_NONE, &disable_eplugin, 0, 
-		  N_("Disable loading of any plugins."), NULL },
-		{ "setup-only", '\0', POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN,
-		  &setup_only, 0, NULL, NULL },
-		{ NULL, '\0', 0, NULL, 0, NULL, NULL }
-	};
+
 #if DEVELOPMENT
 	GConfClient *client;
 	gboolean skip_warning_dialog;
 #endif
 	GSList *uri_list;
-	GValue popt_context_value = { 0, };
 	GnomeProgram *program;
-	poptContext popt_context;
-	const char **args;
+        GOptionContext *context;
 	GList *icon_list;
 	char *filename;
 
@@ -508,9 +510,13 @@
 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 	textdomain (GETTEXT_PACKAGE);
 
+        context = g_option_context_new (_("- Evolution"));
+
+        g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
+
 	program = gnome_program_init (PACKAGE "-" BASE_VERSION, VERSION, LIBGNOMEUI_MODULE, argc, argv, 
 				      GNOME_PROGRAM_STANDARD_PROPERTIES,
-				      GNOME_PARAM_POPT_TABLE, options,
+				      GNOME_PARAM_GOPTION_CONTEXT, context,
 				      GNOME_PARAM_HUMAN_READABLE_NAME, _("Evolution"),
 				      NULL);
 
@@ -570,18 +576,14 @@
 
 	uri_list = NULL;
 
-	g_value_init (&popt_context_value, G_TYPE_POINTER);
-	g_object_get_property (G_OBJECT (program), GNOME_PARAM_POPT_CONTEXT, &popt_context_value);
-	popt_context = g_value_get_pointer (&popt_context_value);
-	args = poptGetArgs (popt_context);
-	if (args != NULL) {
+	if (remaining_args != NULL) {
 		const char **p;
 
-		for (p = args; *p != NULL; p++)
+		for (p = (const char**)remaining_args; *p != NULL; p++)
 			uri_list = g_slist_prepend (uri_list, (char *) *p);
 	}
 	uri_list = g_slist_reverse (uri_list);
-	g_value_unset (&popt_context_value);
+	
 
 	gnome_sound_init ("localhost");
 
