X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=sidebyside;f=cut-n-paste%2Fsmclient%2Feggsmclient.c;h=efa901d532457897b89d30a2806a2bb1cee86c87;hb=3d3c4a5a08f1b8b536542735110c1376fb3e30bf;hp=642703faa7f7e6f3d16be11ac320d6e4ff23e3be;hpb=83a7a11ba109b8aee5cdc047dec8b93967ccfc0e;p=evince.git diff --git a/cut-n-paste/smclient/eggsmclient.c b/cut-n-paste/smclient/eggsmclient.c index 642703fa..efa901d5 100644 --- a/cut-n-paste/smclient/eggsmclient.c +++ b/cut-n-paste/smclient/eggsmclient.c @@ -38,7 +38,7 @@ enum { LAST_SIGNAL }; -static guint signals[LAST_SIGNAL] = { 0 }; +static guint signals[LAST_SIGNAL]; struct _EggSMClientPrivate { GKeyFile *state_file; @@ -178,19 +178,7 @@ egg_sm_client_class_init (EggSMClientClass *klass) static gboolean sm_client_disable = FALSE; static char *sm_client_state_file = NULL; static char *sm_client_id = NULL; - -static GOptionEntry entries[] = { - { "sm-client-disable", 0, 0, - G_OPTION_ARG_NONE, &sm_client_disable, - N_("Disable connection to session manager"), NULL }, - { "sm-client-state-file", 0, 0, - G_OPTION_ARG_STRING, &sm_client_state_file, - N_("Specify file containing saved configuration"), N_("FILE") }, - { "sm-client-id", 0, 0, - G_OPTION_ARG_STRING, &sm_client_id, - N_("Specify session management ID"), N_("ID") }, - { NULL } -}; +static char *sm_config_prefix = NULL; static gboolean sm_client_post_parse_func (GOptionContext *context, @@ -200,6 +188,20 @@ sm_client_post_parse_func (GOptionContext *context, { EggSMClient *client = egg_sm_client_get (); + if (sm_client_id == NULL) + { + const gchar *desktop_autostart_id; + + desktop_autostart_id = g_getenv ("DESKTOP_AUTOSTART_ID"); + + if (desktop_autostart_id != NULL) + sm_client_id = g_strdup (desktop_autostart_id); + } + + /* Unset DESKTOP_AUTOSTART_ID in order to avoid child processes to + * 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); return TRUE; @@ -217,6 +219,29 @@ sm_client_post_parse_func (GOptionContext *context, GOptionGroup * egg_sm_client_get_option_group (void) { + const GOptionEntry entries[] = { + { "sm-client-disable", 0, 0, + G_OPTION_ARG_NONE, &sm_client_disable, + N_("Disable connection to session manager"), NULL }, + { "sm-client-state-file", 0, 0, + G_OPTION_ARG_FILENAME, &sm_client_state_file, + N_("Specify file containing saved configuration"), N_("FILE") }, + { "sm-client-id", 0, 0, + G_OPTION_ARG_STRING, &sm_client_id, + N_("Specify session management ID"), N_("ID") }, + /* GnomeClient compatibility option */ + { "sm-disable", 0, G_OPTION_FLAG_HIDDEN, + G_OPTION_ARG_NONE, &sm_client_disable, + NULL, NULL }, + /* GnomeClient compatibility option. This is a dummy option that only + * exists so that sessions saved by apps with GnomeClient can be restored + * later when they've switched to EggSMClient. See bug #575308. + */ + { "sm-config-prefix", 0, G_OPTION_FLAG_HIDDEN, + G_OPTION_ARG_STRING, &sm_config_prefix, + NULL, NULL }, + { NULL } + }; GOptionGroup *group; /* Use our own debug handler for the "EggSMClient" domain. */ @@ -224,8 +249,8 @@ egg_sm_client_get_option_group (void) egg_sm_client_debug_handler, NULL); group = g_option_group_new ("sm-client", - _("Session Management Options"), - _("Show Session Management options"), + _("Session management options:"), + _("Show session management options"), NULL, NULL); g_option_group_add_entries (group, entries); g_option_group_set_parse_hooks (group, NULL, sm_client_post_parse_func); @@ -300,16 +325,16 @@ egg_sm_client_get (void) #elif defined (GDK_WINDOWING_QUARTZ) global_client = egg_sm_client_osx_new (); #else - /* If both D-Bus and XSMP are compiled in, try D-Bus first - * and fall back to XSMP if D-Bus session management isn't - * available. + /* If both D-Bus and XSMP are compiled in, try XSMP first + * (since it supports state saving) and fall back to D-Bus + * if XSMP isn't available. */ -# ifdef EGG_SM_CLIENT_BACKEND_DBUS - global_client = egg_sm_client_dbus_new (); -# endif # ifdef EGG_SM_CLIENT_BACKEND_XSMP + global_client = egg_sm_client_xsmp_new (); +# endif +# ifdef EGG_SM_CLIENT_BACKEND_DBUS if (!global_client) - global_client = egg_sm_client_xsmp_new (); + global_client = egg_sm_client_dbus_new (); # endif #endif }