[gnome-main-menu] [application-browser] Port to GOption
- From: Vincent Untz <vuntz src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-main-menu] [application-browser] Port to GOption
- Date: Sat, 8 Aug 2009 15:10:37 +0000 (UTC)
commit fcb21959d7b208ee2fe8df12c06e9e181ec22d97
Author: Vincent Untz <vuntz gnome org>
Date: Sat Aug 8 17:09:05 2009 +0200
[application-browser] Port to GOption
application-browser/src/application-browser.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/application-browser/src/application-browser.c b/application-browser/src/application-browser.c
index 4b7d471..f986b7a 100644
--- a/application-browser/src/application-browser.c
+++ b/application-browser/src/application-browser.c
@@ -58,6 +58,11 @@ main (int argc, char *argv[])
{
UniqueApp *unique_app = NULL;
gboolean hidden = FALSE;
+ 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
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
@@ -65,20 +70,14 @@ main (int argc, char *argv[])
textdomain (GETTEXT_PACKAGE);
#endif
- if (argc > 1)
- {
- if (argc != 2 || strcmp ("-h", argv[1]))
- {
- printf ("Usage - application-browser [-h]\n");
- printf ("Options: -h : hide on start\n");
- printf ("\tUseful if you want to autostart the application-browser singleton so it can get all it's slow loading done\n");
- exit (1);
- }
- hidden = TRUE;
+ error = NULL;
+ if (!gtk_init_with_args (&argc, &argv,
+ NULL, options, GETTEXT_PACKAGE, &error)) {
+ g_printerr ("%s\n", error->message);
+ g_error_free (error);
+ return 1;
}
- gtk_init (&argc, &argv);
-
unique_app = unique_app_new ("org.gnome.MainMenu", NULL);
if (unique_app_is_running (unique_app))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]