[gnome-games] gnibbles: Put argument parser before clutter init to handle missing arguments



commit 1c444b82fd1e448a1d1863f104c4ed1762bbf061
Author: Marc Ruiz - radykal - <radykal radykal com>
Date:   Sun Jul 22 22:15:33 2012 +0200

    gnibbles: Put argument parser before clutter init to handle missing arguments
    
    Changed order of clutter init and argument parser in main so it handles missing arguments before trying to launch the game. BUG ID: 678326

 gnibbles/src/main.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/gnibbles/src/main.c b/gnibbles/src/main.c
index c1a7be4..75b51a5 100644
--- a/gnibbles/src/main.c
+++ b/gnibbles/src/main.c
@@ -900,6 +900,18 @@ main (int argc, char **argv)
   games_scores_startup ();
 
   g_set_application_name (_("Nibbles"));
+
+  context = g_option_context_new (NULL);
+  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
+  g_option_context_add_group (context, gtk_get_option_group (TRUE));
+
+  retval = g_option_context_parse (context, &argc, &argv, &error);
+  g_option_context_free (context);
+  if (!retval) {
+    g_print ("%s\n", error->message);
+    g_error_free (error);
+    exit (1);
+  }
   
   if (gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) {
     GtkWidget *dialog = gtk_message_dialog_new (NULL,
@@ -921,18 +933,6 @@ main (int argc, char **argv)
     g_free (name);
   }
 
-  context = g_option_context_new (NULL);
-  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
-  g_option_context_add_group (context, gtk_get_option_group (TRUE));
-
-  retval = g_option_context_parse (context, &argc, &argv, &error);
-  g_option_context_free (context);
-  if (!retval) {
-    g_print ("%s", error->message);
-    g_error_free (error);
-    exit (1);
-  }
-
   gtk_window_set_default_icon_name ("gnibbles");
   srand (time (NULL));
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]