[totem] Update EggSmClient and EggDesktopFile from libegg master



commit 9784b9ffa96c872fb4c207eefea6c314c6bda5f1
Author: Philip Withnall <philip tecnocode co uk>
Date:   Wed Dec 22 16:47:45 2010 +0000

    Update EggSmClient and EggDesktopFile from libegg master

 src/eggdesktopfile.c      |   10 ++++++++++
 src/eggdesktopfile.h      |    3 +++
 src/eggsmclient-osx.c     |    2 +-
 src/eggsmclient-private.h |    8 +++++++-
 src/eggsmclient-xsmp.c    |    5 +++++
 src/eggsmclient.c         |   29 ++++++++++++++++++++++-------
 6 files changed, 48 insertions(+), 9 deletions(-)
---
diff --git a/src/eggdesktopfile.c b/src/eggdesktopfile.c
index 6f6b946..9b12af5 100644
--- a/src/eggdesktopfile.c
+++ b/src/eggdesktopfile.c
@@ -431,6 +431,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,
diff --git a/src/eggdesktopfile.h b/src/eggdesktopfile.h
index 18fe463..16c5426 100644
--- a/src/eggdesktopfile.h
+++ b/src/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/src/eggsmclient-osx.c b/src/eggsmclient-osx.c
index 6f3c481..7d3ff4b 100644
--- a/src/eggsmclient-osx.c
+++ b/src/eggsmclient-osx.c
@@ -37,7 +37,7 @@
 #include "config.h"
 
 #include "eggsmclient-private.h"
-#include <gdk/gdkquartz.h>
+#include <glib.h>
 #include <Carbon/Carbon.h>
 #include <CoreServices/CoreServices.h>
 
diff --git a/src/eggsmclient-private.h b/src/eggsmclient-private.h
index e391218..0c98eee 100644
--- a/src/eggsmclient-private.h
+++ b/src/eggsmclient-private.h
@@ -20,7 +20,13 @@
 #ifndef __EGG_SM_CLIENT_PRIVATE_H__
 #define __EGG_SM_CLIENT_PRIVATE_H__
 
-#include <gdk/gdk.h>
+#include <gtk/gtk.h>
+
+#if !GTK_CHECK_VERSION(2,91,7) && !GTK_CHECK_VERSION(3,0,0)
+/* GTK+ 3 includes this automatically */
+#include <gdkconfig.h>
+#endif
+
 #include "eggsmclient.h"
 
 G_BEGIN_DECLS
diff --git a/src/eggsmclient-xsmp.c b/src/eggsmclient-xsmp.c
index 69f96f8..45bdec9 100644
--- a/src/eggsmclient-xsmp.c
+++ b/src/eggsmclient-xsmp.c
@@ -36,6 +36,7 @@
 #include <X11/SM/SMlib.h>
 
 #include <gdk/gdk.h>
+#include <gdk/gdkx.h>
 
 #define EGG_TYPE_SM_CLIENT_XSMP            (egg_sm_client_xsmp_get_type ())
 #define EGG_SM_CLIENT_XSMP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP))
@@ -373,7 +374,11 @@ 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)
       gdk_set_sm_client_id (xsmp->client_id);
+#else
+      gdk_x11_set_sm_client_id (xsmp->client_id);
+#endif
       gdk_threads_leave ();
 
       g_debug ("Got client ID \"%s\"", xsmp->client_id);
diff --git a/src/eggsmclient.c b/src/eggsmclient.c
index 85aaee4..2198a55 100644
--- a/src/eggsmclient.c
+++ b/src/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]