[gnome-keyring] If DBus couldn't be initialized when starting up try again.



commit c4fa06918c5d0b115928822dce79a3a842c14991
Author: Stef Walter <stef memberwebs com>
Date:   Wed Jan 19 15:05:42 2011 -0600

    If DBus couldn't be initialized when starting up try again.
    
    Try again when we are asked to initialize a certain component. This allows
    gnome-keyring-daemon --start (when run a second time later on) to make
    dbus work in the first daemon.

 daemon/dbus/gkd-dbus.c |    5 +++--
 daemon/dbus/gkd-dbus.h |    2 +-
 daemon/gkd-main.c      |   20 +++++++++++++++-----
 3 files changed, 19 insertions(+), 8 deletions(-)
---
diff --git a/daemon/dbus/gkd-dbus.c b/daemon/dbus/gkd-dbus.c
index e5a29b6..90fad59 100644
--- a/daemon/dbus/gkd-dbus.c
+++ b/daemon/dbus/gkd-dbus.c
@@ -276,13 +276,13 @@ dbus_cleanup (gpointer unused)
 	gkd_dbus_environment_cleanup (dbus_conn);
 }
 
-void
+gboolean
 gkd_dbus_setup (void)
 {
 	gboolean unused;
 
 	if (!connect_to_session_bus ())
-		return;
+		return FALSE;
 
 	/* Our singleton, and internal service API */
 	gkd_dbus_singleton_acquire (&unused);
@@ -295,4 +295,5 @@ gkd_dbus_setup (void)
 	gkd_dbus_secrets_init (dbus_conn);
 
 	egg_cleanup_register (dbus_cleanup, NULL);
+	return TRUE;
 }
diff --git a/daemon/dbus/gkd-dbus.h b/daemon/dbus/gkd-dbus.h
index 93cfe9a..a5e20b6 100644
--- a/daemon/dbus/gkd-dbus.h
+++ b/daemon/dbus/gkd-dbus.h
@@ -26,7 +26,7 @@
 
 #include <glib.h>
 
-void      gkd_dbus_setup            (void);
+gboolean      gkd_dbus_setup                    (void);
 
 gboolean  gkd_dbus_secrets_startup  (void);
 
diff --git a/daemon/gkd-main.c b/daemon/gkd-main.c
index 7ea67ff..602d87a 100644
--- a/daemon/gkd-main.c
+++ b/daemon/gkd-main.c
@@ -109,6 +109,7 @@ static gboolean pkcs11_started = FALSE;
 static gboolean secrets_started = FALSE;
 static gboolean ssh_started = FALSE;
 static gboolean gpg_started = FALSE;
+static gboolean dbus_started = FALSE;
 
 static gboolean run_foreground = FALSE;
 static gboolean run_daemonized = FALSE;
@@ -708,7 +709,9 @@ gkr_daemon_initialize_steps (const gchar *components)
 			egg_secure_strclear (login_password);
 		}
 
-		gkd_dbus_setup ();
+		dbus_started = TRUE;
+		if (!gkd_dbus_setup ())
+			dbus_started = FALSE;
 	}
 
 	/* The Secret Service API */
@@ -716,10 +719,17 @@ gkr_daemon_initialize_steps (const gchar *components)
 		if (secrets_started) {
 			g_message ("The Secret Service was already initialized");
 		} else {
-			secrets_started = TRUE;
-			if (!gkd_dbus_secrets_startup ()) {
-				secrets_started = FALSE;
-				return FALSE;
+			if (!dbus_started) {
+				dbus_started = TRUE;
+				if (!gkd_dbus_setup ())
+					dbus_started = FALSE;
+			}
+			if (dbus_started) {
+				secrets_started = TRUE;
+				if (!gkd_dbus_secrets_startup ()) {
+					secrets_started = FALSE;
+					return FALSE;
+				}
 			}
 		}
 	}



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