[nautilus] application: fix interaction with SMCLient
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] application: fix interaction with SMCLient
- Date: Sat, 30 Oct 2010 15:23:55 +0000 (UTC)
commit f48796637854ca784f7458a387e3607917ef5990
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sat Oct 30 17:19:35 2010 +0200
application: fix interaction with SMCLient
Use late-initialization, otherwise we and up locked while reading
session information. Also, don't try to use that information more than
once in the app lifetime.
src/nautilus-application-smclient.c | 3 +++
src/nautilus-application.c | 17 ++++++++++++-----
src/nautilus-application.h | 2 ++
3 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-application-smclient.c b/src/nautilus-application-smclient.c
index af2abba..98f3e6d 100644
--- a/src/nautilus-application-smclient.c
+++ b/src/nautilus-application-smclient.c
@@ -403,6 +403,9 @@ nautilus_application_smclient_init (NautilusApplication *self)
{
g_assert (self->smclient == NULL);
+ egg_sm_client_set_mode (EGG_SM_CLIENT_MODE_NORMAL);
+
+ /* TODO: Should connect to quit_requested and block logout on active transfer? */
self->smclient = egg_sm_client_get ();
g_signal_connect (self->smclient, "save_state",
G_CALLBACK (smclient_save_state_cb),
diff --git a/src/nautilus-application.c b/src/nautilus-application.c
index c0a916e..cedea2e 100644
--- a/src/nautilus-application.c
+++ b/src/nautilus-application.c
@@ -1577,8 +1577,12 @@ nautilus_application_command_line (GApplication *app,
} else {
char *accel_map_filename;
- if (egg_sm_client_is_resumed (self->smclient)) {
- no_default_window = TRUE;
+ if (!self->sm_initialized) {
+ nautilus_application_smclient_init (self);
+
+ if (egg_sm_client_is_resumed (self->smclient)) {
+ no_default_window = TRUE;
+ }
}
if (!no_desktop &&
@@ -1636,8 +1640,11 @@ nautilus_application_command_line (GApplication *app,
browser_window);
}
- /* Load session info if availible */
- nautilus_application_smclient_load (self);
+ if (!self->sm_initialized) {
+ /* Load session info if availible */
+ nautilus_application_smclient_load (self);
+ self->sm_initialized = TRUE;
+ }
/* load accelerator map, and register save callback */
accel_map_filename = nautilus_get_accel_map_file ();
@@ -1671,7 +1678,7 @@ nautilus_application_startup (GApplication *app)
self->undo_manager = nautilus_undo_manager_new ();
/* initialize the session manager client */
- nautilus_application_smclient_init (self);
+ egg_sm_client_set_mode (EGG_SM_CLIENT_MODE_DISABLED);
/* Initialize preferences. This is needed to create the
* global GSettings objects.
diff --git a/src/nautilus-application.h b/src/nautilus-application.h
index dfe8f1c..776079a 100644
--- a/src/nautilus-application.h
+++ b/src/nautilus-application.h
@@ -64,6 +64,8 @@ typedef struct {
unsigned int automount_idle_id;
GDBusProxy *proxy;
gboolean session_is_active;
+
+ gboolean sm_initialized;
} NautilusApplication;
typedef struct {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]