[gnome-session] egg: Update smclient code from libegg
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] egg: Update smclient code from libegg
- Date: Thu, 26 May 2011 10:38:19 +0000 (UTC)
commit 7e0f36901093412ea9b904c58fea39c1d73fee0b
Author: Vincent Untz <vuntz gnome org>
Date: Thu May 26 11:22:08 2011 +0200
egg: Update smclient code from libegg
egg/eggdesktopfile.c | 22 ++++++++++++++++++++--
egg/eggdesktopfile.h | 3 +++
egg/eggsmclient-xsmp.c | 2 +-
egg/eggsmclient.c | 29 ++++++++++++++++++++++-------
4 files changed, 46 insertions(+), 10 deletions(-)
---
diff --git a/egg/eggdesktopfile.c b/egg/eggdesktopfile.c
index 6f6b946..443d5ec 100644
--- a/egg/eggdesktopfile.c
+++ b/egg/eggdesktopfile.c
@@ -185,6 +185,9 @@ egg_desktop_file_new_from_key_file (GKeyFile *key_file,
{
g_set_error (error, EGG_DESKTOP_FILE_ERROR,
EGG_DESKTOP_FILE_ERROR_INVALID,
+ /* translators: 'Version' is from a desktop file, and
+ * should not be translated. '%s' would probably be a
+ * version number. */
_("Unrecognized desktop file Version '%s'"), version);
g_free (version);
g_key_file_free (key_file);
@@ -201,8 +204,11 @@ egg_desktop_file_new_from_key_file (GKeyFile *key_file,
else
desktop_file->source = g_strdup (source);
- desktop_file->name = g_key_file_get_string (key_file, EGG_DESKTOP_FILE_GROUP,
- EGG_DESKTOP_FILE_KEY_NAME, error);
+ desktop_file->name = g_key_file_get_locale_string (key_file,
+ EGG_DESKTOP_FILE_GROUP,
+ EGG_DESKTOP_FILE_KEY_NAME,
+ NULL,
+ error);
if (!desktop_file->name)
{
egg_desktop_file_free (desktop_file);
@@ -431,6 +437,16 @@ egg_desktop_file_get_numeric (EggDesktopFile *desktop_file,
error);
}
+int
+egg_desktop_file_get_integer (EggDesktopFile *desktop_file,
+ const char *key,
+ GError **error)
+{
+ return g_key_file_get_integer (desktop_file->key_file,
+ EGG_DESKTOP_FILE_GROUP, key,
+ error);
+}
+
char **
egg_desktop_file_get_string_list (EggDesktopFile *desktop_file,
const char *key,
@@ -1370,6 +1386,8 @@ egg_desktop_file_launch (EggDesktopFile *desktop_file,
{
g_set_error (error, EGG_DESKTOP_FILE_ERROR,
EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
+ /* translators: The 'Type=Link' string is found in a
+ * desktop file, and should not be translated. */
_("Can't pass document URIs to a 'Type=Link' desktop entry"));
return FALSE;
}
diff --git a/egg/eggdesktopfile.h b/egg/eggdesktopfile.h
index 18fe463..16c5426 100644
--- a/egg/eggdesktopfile.h
+++ b/egg/eggdesktopfile.h
@@ -127,6 +127,9 @@ gboolean egg_desktop_file_get_boolean (EggDesktopFile *desktop_file
double egg_desktop_file_get_numeric (EggDesktopFile *desktop_file,
const char *key,
GError **error);
+int egg_desktop_file_get_integer (EggDesktopFile *desktop_file,
+ const char *key,
+ GError **error);
char **egg_desktop_file_get_string_list (EggDesktopFile *desktop_file,
const char *key,
gsize *length,
diff --git a/egg/eggsmclient-xsmp.c b/egg/eggsmclient-xsmp.c
index ec1b594..9fd1e5d 100644
--- a/egg/eggsmclient-xsmp.c
+++ b/egg/eggsmclient-xsmp.c
@@ -368,7 +368,7 @@ sm_client_xsmp_startup (EggSMClient *client,
free (ret_client_id);
gdk_threads_enter ();
-#if !GTK_CHECK_VERSION(2,91,7) && !GTK_CHECK_VERSION(3,0,0)
+#if !GTK_CHECK_VERSION(2,23,3) && !GTK_CHECK_VERSION(3,0,0)
gdk_set_sm_client_id (xsmp->client_id);
#else
gdk_x11_set_sm_client_id (xsmp->client_id);
diff --git a/egg/eggsmclient.c b/egg/eggsmclient.c
index efa901d..92be8a7 100644
--- a/egg/eggsmclient.c
+++ b/egg/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 ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]