From 5121b2a1841c9868eefe9e42d2443e56c4e49f03 Mon Sep 17 00:00:00 2001 From: "Gergely POLONKAI (W00d5t0ck)" Date: Tue, 17 Sep 2013 12:39:23 +0200 Subject: [PATCH] Moved command line options into main() Global variables for this just didn't seem right. --- src/astrognome.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/astrognome.c b/src/astrognome.c index a13fc52..bec68b7 100644 --- a/src/astrognome.c +++ b/src/astrognome.c @@ -13,16 +13,9 @@ #define UI_FILE PKGDATADIR "/astrognome.ui" GtkBuilder *builder; -static gboolean option_quit; -static gboolean option_version; -static gboolean option_new_window; - -static GOptionEntry options[] = { - { "new-window", 'n', 0, G_OPTION_ARG_NONE, &option_new_window, N_("Opens a new Astrognome window"), NULL }, - { "version", 'v', 0, G_OPTION_ARG_NONE, &option_version, N_("Display version and exit"), NULL }, - { "quit", 'q', 0, G_OPTION_ARG_NONE, &option_quit, N_("Quit any running Astrognome"), NULL }, - { NULL } -}; +static gboolean option_version, + option_quit, + option_new_window; const char *moonStateName[] = { "New Moon", @@ -69,6 +62,13 @@ main(int argc, char *argv[]) AgApp *app; GError *err = NULL; + GOptionEntry options[] = { + { "new-window", 'n', 0, G_OPTION_ARG_NONE, &option_new_window, N_("Opens a new Astrognome window"), NULL }, + { "version", 'v', 0, G_OPTION_ARG_NONE, &option_version, N_("Display version and exit"), NULL }, + { "quit", 'q', 0, G_OPTION_ARG_NONE, &option_quit, N_("Quit any running Astrognome"), NULL }, + { NULL } + }; + #ifdef ENABLE_NLS bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); @@ -77,6 +77,10 @@ main(int argc, char *argv[]) gswe_init(); + option_version = FALSE, + option_quit = FALSE, + option_new_window = FALSE; + if (!gtk_init_with_args(&argc, &argv, NULL, options, GETTEXT_PACKAGE, &err)) { g_printerr("%s\n", err->message);