Use GOption in the shell

This commit is contained in:
Vincent Untz 2009-08-08 14:57:37 +02:00
parent cbd893fda9
commit 525d09fc83

View file

@ -107,6 +107,11 @@ main (int argc, char *argv[])
gboolean hidden = FALSE; gboolean hidden = FALSE;
AppShellData *app_data; AppShellData *app_data;
GSList *actions; GSList *actions;
GError *error;
GOptionEntry options[] = {
{ "hide", 0, 0, G_OPTION_ARG_NONE, &hidden, N_("Hide on start (useful to preload the shell)"), NULL },
{ NULL }
};
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
@ -114,19 +119,13 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE); textdomain (GETTEXT_PACKAGE);
#endif #endif
if (argc > 1) error = NULL;
{ if (!gtk_init_with_args (&argc, &argv,
if (argc != 2 || strcmp ("-h", argv[1])) NULL, options, GETTEXT_PACKAGE, &error)) {
{ g_printerr ("%s", error->message);
printf ("Usage - gnome-control-center [-h]\n"); g_error_free (error);
printf ("Options: -h : hide on start\n"); return 1;
printf ("\tUseful if you want to autostart the control-center singleton so it can get all its slow loading done\n");
exit (1);
} }
hidden = TRUE;
}
gtk_init (&argc, &argv);
app_data = appshelldata_new ("gnomecc.menu", NULL, CONTROL_CENTER_PREFIX, app_data = appshelldata_new ("gnomecc.menu", NULL, CONTROL_CENTER_PREFIX,
GTK_ICON_SIZE_DND, FALSE, TRUE); GTK_ICON_SIZE_DND, FALSE, TRUE);