cheese r1106 - in branches/gnome-2-24: . src



Author: dgsiegel
Date: Mon Oct 13 19:14:30 2008
New Revision: 1106
URL: http://svn.gnome.org/viewvc/cheese?rev=1106&view=rev

Log:
Exit correctly with unknown command line arguments, fixes bug #556084, courtesy of Baptiste Mille-Mathias


Modified:
   branches/gnome-2-24/ChangeLog
   branches/gnome-2-24/src/cheese.c

Modified: branches/gnome-2-24/src/cheese.c
==============================================================================
--- branches/gnome-2-24/src/cheese.c	(original)
+++ branches/gnome-2-24/src/cheese.c	Mon Oct 13 19:14:30 2008
@@ -156,6 +156,7 @@
 {
   GOptionContext *context;
   CheeseDbus     *dbus_server;
+  GError *error = NULL;
 
   GOptionEntry options[] = {
     {"verbose",    'v', 0,                    G_OPTION_ARG_NONE,   &CheeseOptions.verbose,       _("Be verbose"), NULL},
@@ -180,7 +181,12 @@
   g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
   g_option_context_add_group (context, gtk_get_option_group (TRUE));
   g_option_context_add_group (context, gst_init_get_option_group ());
-  g_option_context_parse (context, &argc, &argv, NULL);
+  if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+    g_print (_("%s\nRun '%s --help' to see a full list of available command line options.\n"), error->message, argv[0]);
+    g_error_free (error);
+    g_option_context_free (context);
+    return -1;
+  }
   g_option_context_free (context);
 
   dbus_server = cheese_dbus_new ();



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