Index: nautilus-2.30.1/cut-n-paste-code/libegg/eggsmclient-xsmp.c =================================================================== --- nautilus-2.30.1.orig/cut-n-paste-code/libegg/eggsmclient-xsmp.c +++ nautilus-2.30.1/cut-n-paste-code/libegg/eggsmclient-xsmp.c @@ -317,6 +317,9 @@ sm_client_xsmp_startup (EggSMClient *cli char *ret_client_id; char error_string_ret[256]; + if (xsmp->connection) + return; + xsmp->client_id = g_strdup (client_id); ice_init (); Index: nautilus-2.30.1/cut-n-paste-code/libegg/eggsmclient.c =================================================================== --- nautilus-2.30.1.orig/cut-n-paste-code/libegg/eggsmclient.c +++ nautilus-2.30.1/cut-n-paste-code/libegg/eggsmclient.c @@ -175,6 +175,7 @@ egg_sm_client_class_init (EggSMClientCla 0); } +static gboolean sm_client_connect = FALSE; static gboolean sm_client_disable = FALSE; static char *sm_client_state_file = NULL; static char *sm_client_id = NULL; @@ -202,8 +203,10 @@ sm_client_post_parse_func (GOptionContex * use the same client id. */ g_unsetenv ("DESKTOP_AUTOSTART_ID"); - if (EGG_SM_CLIENT_GET_CLASS (client)->startup) - EGG_SM_CLIENT_GET_CLASS (client)->startup (client, sm_client_id); + if (sm_client_connect) { + if (EGG_SM_CLIENT_GET_CLASS (client)->startup) + EGG_SM_CLIENT_GET_CLASS (client)->startup (client, sm_client_id); + } return TRUE; } @@ -240,6 +243,14 @@ egg_sm_client_get_option_group (void) { "sm-config-prefix", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &sm_config_prefix, NULL, NULL }, + /* Normally the client is connected to the session manager + * automatically, when calling 'egg_sm_client_get_option_group'. + * One can disable this automatic connect by calling this function. + * Using this function should definitely be an exception. + */ + { "sm-connect", 0, 0, + G_OPTION_ARG_NONE, &sm_client_connect, + NULL, NULL }, { NULL } }; GOptionGroup *group; @@ -472,6 +483,15 @@ egg_sm_client_will_quit (EggSMClient *cl EGG_SM_CLIENT_GET_CLASS (client)->will_quit (client, will_quit); } +void +egg_sm_client_startup (EggSMClient *client) +{ + g_return_if_fail (EGG_IS_SM_CLIENT (client)); + + if (EGG_SM_CLIENT_GET_CLASS (client)->startup) + EGG_SM_CLIENT_GET_CLASS (client)->startup (client, sm_client_id); +} + /** * egg_sm_client_end_session: * @style: a hint at how to end the session Index: nautilus-2.30.1/cut-n-paste-code/libegg/eggsmclient.h =================================================================== --- nautilus-2.30.1.orig/cut-n-paste-code/libegg/eggsmclient.h +++ nautilus-2.30.1/cut-n-paste-code/libegg/eggsmclient.h @@ -106,6 +106,8 @@ void egg_sm_client_set_resta /* Handling "quit_requested" signal */ void egg_sm_client_will_quit (EggSMClient *client, gboolean will_quit); +/* startup the client (connect to sm) */ +void egg_sm_client_startup (EggSMClient *client); /* Initiate a logout/reboot/shutdown */ gboolean egg_sm_client_end_session (EggSMClientEndStyle style, Index: nautilus-2.30.1/src/nautilus-main.c =================================================================== --- nautilus-2.30.1.orig/src/nautilus-main.c +++ nautilus-2.30.1/src/nautilus-main.c @@ -315,6 +315,13 @@ setup_debug_log (void) setup_debug_log_glog (); } +static gboolean +startup_done_cb (EggSMClient *client) +{ + egg_sm_client_startup (client); + return FALSE; +} + int main (int argc, char *argv[]) { @@ -541,6 +548,11 @@ main (int argc, char *argv[]) } if (is_event_loop_needed ()) { + /* Register with the session manager when we're done bringing up the + * desktop. This means we don't have to compete for resources with the + * application startup phase, so the desktop comes up sooner. */ + g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc) startup_done_cb, application->smclient, NULL); + gtk_main (); } }