[gedit] Sync smclient with latest libegg version.



commit 2ebeadc30a0a124bc886efa4345461b55e747df5
Author: Paolo Borelli <pborelli gnome org>
Date:   Sun Apr 10 00:23:39 2011 +0200

    Sync smclient with latest libegg version.

 gedit/smclient/eggdesktopfile.c    |   23 ++++++++++++++++++++---
 gedit/smclient/eggdesktopfile.h    |    4 +++-
 gedit/smclient/eggsmclient-osx.c   |    1 -
 gedit/smclient/eggsmclient-win32.c |    1 -
 gedit/smclient/eggsmclient-xsmp.c  |    2 +-
 gedit/smclient/eggsmclient.c       |   30 ++++++++++++++++++++++--------
 gedit/smclient/eggsmclient.h       |    1 -
 7 files changed, 46 insertions(+), 16 deletions(-)
---
diff --git a/gedit/smclient/eggdesktopfile.c b/gedit/smclient/eggdesktopfile.c
index e1e7a76..443d5ec 100644
--- a/gedit/smclient/eggdesktopfile.c
+++ b/gedit/smclient/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;
 	}	  
@@ -1508,4 +1526,3 @@ egg_get_desktop_file (void)
 
   return retval;
 }
-/* ex:set ts=8 noet: */
diff --git a/gedit/smclient/eggdesktopfile.h b/gedit/smclient/eggdesktopfile.h
index c17d1c4..16c5426 100644
--- a/gedit/smclient/eggdesktopfile.h
+++ b/gedit/smclient/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,
@@ -158,4 +161,3 @@ EggDesktopFile *egg_get_desktop_file                  (void);
 G_END_DECLS
 
 #endif /* __EGG_DESKTOP_FILE_H__ */
-/* ex:set ts=8 noet: */
diff --git a/gedit/smclient/eggsmclient-osx.c b/gedit/smclient/eggsmclient-osx.c
index efa1cc7..7d3ff4b 100644
--- a/gedit/smclient/eggsmclient-osx.c
+++ b/gedit/smclient/eggsmclient-osx.c
@@ -233,4 +233,3 @@ sm_client_osx_end_session (EggSMClient         *client,
 
   return err == noErr;
 }
-/* ex:set ts=8 noet: */
diff --git a/gedit/smclient/eggsmclient-win32.c b/gedit/smclient/eggsmclient-win32.c
index 010e9a9..91a2571 100644
--- a/gedit/smclient/eggsmclient-win32.c
+++ b/gedit/smclient/eggsmclient-win32.c
@@ -351,4 +351,3 @@ sm_client_thread (gpointer smclient)
   while (GetMessage (&msg, NULL, 0, 0))
     DispatchMessage (&msg);
 }
-/* ex:set ts=8 noet: */
diff --git a/gedit/smclient/eggsmclient-xsmp.c b/gedit/smclient/eggsmclient-xsmp.c
index ec1b594..9fd1e5d 100644
--- a/gedit/smclient/eggsmclient-xsmp.c
+++ b/gedit/smclient/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/gedit/smclient/eggsmclient.c b/gedit/smclient/eggsmclient.c
index 65105db..92be8a7 100644
--- a/gedit/smclient/eggsmclient.c
+++ b/gedit/smclient/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 ();
@@ -587,4 +602,3 @@ egg_sm_client_debug_handler (const char *log_domain,
   if (debug)
     g_log_default_handler (log_domain, log_level, message, NULL);
 }
-/* ex:set ts=8 noet: */
diff --git a/gedit/smclient/eggsmclient.h b/gedit/smclient/eggsmclient.h
index 96f4040..e620b75 100644
--- a/gedit/smclient/eggsmclient.h
+++ b/gedit/smclient/eggsmclient.h
@@ -115,4 +115,3 @@ G_END_DECLS
 
 
 #endif /* __EGG_SM_CLIENT_H__ */
-/* ex:set ts=8 noet: */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]