[gnome-panel] [panel] Update to latest EggSMClient code, and adapt code
- From: Vincent Untz <vuntz src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-panel] [panel] Update to latest EggSMClient code, and adapt code
- Date: Wed, 13 Jan 2010 11:17:43 +0000 (UTC)
commit 3d2dc42b4bfe3448a941af0dc1c1486ec3e28859
Author: Vincent Untz <vuntz gnome org>
Date: Wed Jan 13 12:16:37 2010 +0100
[panel] Update to latest EggSMClient code, and adapt code
We don't need egg_sm_client_startup() anymore: changing the mode will be
enough now.
gnome-panel/libegg/eggsmclient.c | 61 +++++++++++++------------------------
gnome-panel/libegg/eggsmclient.h | 1 -
gnome-panel/panel-session.c | 2 +-
3 files changed, 23 insertions(+), 41 deletions(-)
---
diff --git a/gnome-panel/libegg/eggsmclient.c b/gnome-panel/libegg/eggsmclient.c
index c8c064d..92be8a7 100644
--- a/gnome-panel/libegg/eggsmclient.c
+++ b/gnome-panel/libegg/eggsmclient.c
@@ -202,7 +202,8 @@ sm_client_post_parse_func (GOptionContext *context,
* use the same client id. */
g_unsetenv ("DESKTOP_AUTOSTART_ID");
- if (EGG_SM_CLIENT_GET_CLASS (client)->startup)
+ if (global_client_mode != EGG_SM_CLIENT_MODE_DISABLED &&
+ EGG_SM_CLIENT_GET_CLASS (client)->startup)
EGG_SM_CLIENT_GET_CLASS (client)->startup (client, sm_client_id);
return TRUE;
}
@@ -265,9 +266,9 @@ egg_sm_client_get_option_group (void)
* Sets the "mode" of #EggSMClient as follows:
*
* %EGG_SM_CLIENT_MODE_DISABLED: Session management is completely
- * disabled. The application will not even connect to the session
- * manager. (egg_sm_client_get() will still return an #EggSMClient,
- * but it will just be a dummy object.)
+ * disabled, until the mode is changed again. The application will
+ * not even connect to the session manager. (egg_sm_client_get()
+ * will still return an #EggSMClient object.)
*
* %EGG_SM_CLIENT_MODE_NO_RESTART: The application will connect to
* the session manager (and thus will receive notification when the
@@ -277,12 +278,27 @@ egg_sm_client_get_option_group (void)
* %EGG_SM_CLIENT_MODE_NORMAL: The default. #EggSMCLient will
* function normally.
*
- * This must be called before the application's main loop begins.
+ * This must be called before the application's main loop begins and
+ * before any call to egg_sm_client_get(), unless the mode was set
+ * earlier to %EGG_SM_CLIENT_MODE_DISABLED and this call enables
+ * session management. Note that option parsing will call
+ * egg_sm_client_get().
**/
void
egg_sm_client_set_mode (EggSMClientMode mode)
{
+ EggSMClientMode old_mode = global_client_mode;
+
+ g_return_if_fail (global_client == NULL || global_client_mode == EGG_SM_CLIENT_MODE_DISABLED);
+ g_return_if_fail (!(global_client != NULL && mode == EGG_SM_CLIENT_MODE_DISABLED));
+
global_client_mode = mode;
+
+ if (global_client != NULL && old_mode == EGG_SM_CLIENT_MODE_DISABLED)
+ {
+ if (EGG_SM_CLIENT_GET_CLASS (global_client)->startup)
+ EGG_SM_CLIENT_GET_CLASS (global_client)->startup (global_client, sm_client_id);
+ }
}
/**
@@ -317,8 +333,7 @@ egg_sm_client_get (void)
{
if (!global_client)
{
- if (global_client_mode != EGG_SM_CLIENT_MODE_DISABLED &&
- !sm_client_disable)
+ if (!sm_client_disable)
{
#if defined (GDK_WINDOWING_WIN32)
global_client = egg_sm_client_win32_new ();
@@ -350,38 +365,6 @@ egg_sm_client_get (void)
}
/**
- * egg_sm_client_startup:
- * @client: the client
- *
- * Connects to the session manager.
- *
- * This should only be used if the global #EggSMClientMode was set to
- * %EGG_SM_CLIENT_MODE_DISABLED before. This is useful when you need to control
- * when your application connects to the session manager (by default, it
- * connects to it when the options are parsed).
- **/
-void
-egg_sm_client_startup (EggSMClientMode mode)
-{
- EggSMClient *client;
-
- g_return_if_fail (global_client_mode == EGG_SM_CLIENT_MODE_DISABLED);
- /* we make sure that the current client is a dummy one */
- g_return_if_fail (global_client == NULL || G_TYPE_FROM_INSTANCE (global_client) == EGG_TYPE_SM_CLIENT);
-
- if (global_client) {
- g_object_unref (global_client);
- global_client = NULL;
- }
-
- egg_sm_client_set_mode (mode);
- client = egg_sm_client_get ();
-
- if (EGG_SM_CLIENT_GET_CLASS (client)->startup)
- EGG_SM_CLIENT_GET_CLASS (client)->startup (client, sm_client_id);
-}
-
-/**
* egg_sm_client_is_resumed:
* @client: the client
*
diff --git a/gnome-panel/libegg/eggsmclient.h b/gnome-panel/libegg/eggsmclient.h
index ae4f834..e620b75 100644
--- a/gnome-panel/libegg/eggsmclient.h
+++ b/gnome-panel/libegg/eggsmclient.h
@@ -93,7 +93,6 @@ GOptionGroup *egg_sm_client_get_option_group (void);
void egg_sm_client_set_mode (EggSMClientMode mode);
EggSMClientMode egg_sm_client_get_mode (void);
EggSMClient *egg_sm_client_get (void);
-void egg_sm_client_startup (EggSMClientMode mode);
/* Resuming a saved session */
gboolean egg_sm_client_is_resumed (EggSMClient *client);
diff --git a/gnome-panel/panel-session.c b/gnome-panel/panel-session.c
index 55149af..8ebc742 100644
--- a/gnome-panel/panel-session.c
+++ b/gnome-panel/panel-session.c
@@ -67,7 +67,7 @@ panel_session_init (void)
else
mode = EGG_SM_CLIENT_MODE_NORMAL;
- egg_sm_client_startup (mode);
+ egg_sm_client_set_mode (mode);
client = egg_sm_client_get ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]