gnome-settings-daemon r611 - in trunk: . gnome-settings-daemon



Author: behdad
Date: Mon Nov 24 21:25:25 2008
New Revision: 611
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=611&view=rev

Log:
2008-11-24  Behdad Esfahbod  <behdad gnome org>

        * gnome-settings-daemon/main.c (parse_args), (main): Fix --no-daemon
        (bug #562175)

Modified:
   trunk/ChangeLog
   trunk/gnome-settings-daemon/main.c

Modified: trunk/gnome-settings-daemon/main.c
==============================================================================
--- trunk/gnome-settings-daemon/main.c	(original)
+++ trunk/gnome-settings-daemon/main.c	Mon Nov 24 21:25:25 2008
@@ -310,6 +310,36 @@
         close (pipefds[1]);
 }
 
+static void
+parse_args (int *argc, char ***argv)
+{
+        GError *error;
+        GOptionContext *context;
+
+        gnome_settings_profile_start (NULL);
+
+
+        context = g_option_context_new (NULL);
+
+        g_option_context_add_main_entries (context, entries, NULL);
+        g_option_context_add_group (context, gtk_get_option_group (FALSE));
+
+        error = NULL;
+        if (!g_option_context_parse (context, argc, argv, &error)) {
+                if (error != NULL) {
+                        g_warning ("%s", error->message);
+                        g_error_free (error);
+                } else {
+                        g_warning ("Unable to initialize GTK+");
+                }
+                exit (EXIT_FAILURE);
+        }
+
+        g_option_context_free (context);
+
+        gnome_settings_profile_end (NULL);
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -322,29 +352,24 @@
 
         gnome_settings_profile_start (NULL);
 
-        daemon_start ();
-
         bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR);
         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
         textdomain (GETTEXT_PACKAGE);
-
         setlocale (LC_ALL, "");
 
+        parse_args (&argc, &argv);
+
+        daemon_start ();
+
         g_type_init ();
 
-        gnome_settings_profile_start ("gtk init");
-        error = NULL;
-        if (! gtk_init_with_args (&argc, &argv, NULL, entries, NULL, &error)) {
-                if (error != NULL) {
-                        g_warning ("%s", error->message);
-                        g_error_free (error);
-                } else {
-                        g_warning ("Unable to initialize GTK+");
-                }
+        gnome_settings_profile_start ("opening gtk display");
+        if (! gtk_init_check (NULL, NULL)) {
+                g_warning ("Unable to initialize GTK+");
                 daemon_terminate_parent ();
                 exit (EXIT_FAILURE);
         }
-        gnome_settings_profile_end ("gtk init");
+        gnome_settings_profile_end ("opening gtk display");
 
         daemon_detach ();
 



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