nautilus r15174 - in trunk: . cut-n-paste-code/libegg



Author: cosimoc
Date: Wed Apr  8 23:28:28 2009
New Revision: 15174
URL: http://svn.gnome.org/viewvc/nautilus?rev=15174&view=rev

Log:
2009-04-09  Cosimo Cecchi  <cosimoc gnome org>

	* cut-n-paste-code/libegg/eggsmclient-xsmp.c: (save_state),
	(set_properties), (ptrarray_prop):
	* cut-n-paste-code/libegg/eggsmclient.c:
	(egg_sm_client_get_option_group):
	Update the EggSMClient code from libegg trunk.


Modified:
   trunk/ChangeLog
   trunk/cut-n-paste-code/libegg/eggsmclient-xsmp.c
   trunk/cut-n-paste-code/libegg/eggsmclient.c

Modified: trunk/cut-n-paste-code/libegg/eggsmclient-xsmp.c
==============================================================================
--- trunk/cut-n-paste-code/libegg/eggsmclient-xsmp.c	(original)
+++ trunk/cut-n-paste-code/libegg/eggsmclient-xsmp.c	Wed Apr  8 23:28:28 2009
@@ -795,14 +795,18 @@
   if (desktop_file)
     {
       GKeyFile *merged_file;
+      char *desktop_file_path;
 
       merged_file = g_key_file_new ();
-      if (g_key_file_load_from_file (merged_file,
-				     egg_desktop_file_get_source (desktop_file),
+      desktop_file_path =
+	g_filename_from_uri (egg_desktop_file_get_source (desktop_file),
+			     NULL, NULL);
+      if (desktop_file_path &&
+	  g_key_file_load_from_file (merged_file, desktop_file_path,
 				     G_KEY_FILE_KEEP_COMMENTS |
 				     G_KEY_FILE_KEEP_TRANSLATIONS, NULL))
 	{
-	  int g, k, i;
+	  guint g, k, i;
 	  char **groups, **keys, *value, *exec;
 
 	  groups = g_key_file_get_groups (state_file, NULL);
@@ -841,8 +845,11 @@
 				 EGG_DESKTOP_FILE_KEY_EXEC,
 				 exec);
 	  g_free (exec);
-
 	}
+      else
+	desktop_file = NULL;
+
+      g_free (desktop_file_path);
     }
 
   /* Now write state_file to disk. (We can't use mktemp(), because
@@ -1071,7 +1078,7 @@
   GPtrArray *props;
   SmProp *prop;
   va_list ap;
-  int i;
+  guint i;
 
   props = g_ptr_array_new ();
 
@@ -1164,7 +1171,7 @@
   SmProp *prop;
   SmPropValue pv;
   GArray *vals;
-  int i;
+  guint i;
 
   prop = g_new (SmProp, 1);
   prop->name = (char *)name;

Modified: trunk/cut-n-paste-code/libegg/eggsmclient.c
==============================================================================
--- trunk/cut-n-paste-code/libegg/eggsmclient.c	(original)
+++ trunk/cut-n-paste-code/libegg/eggsmclient.c	Wed Apr  8 23:28:28 2009
@@ -38,7 +38,7 @@
   LAST_SIGNAL
 };
 
-static guint signals[LAST_SIGNAL] = { 0 };
+static guint signals[LAST_SIGNAL];
 
 struct _EggSMClientPrivate {
   GKeyFile *state_file;
@@ -178,23 +178,7 @@
 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") },
-  /* Compatibility options */
-  { "sm-disable", 0, G_OPTION_FLAG_HIDDEN,
-    G_OPTION_ARG_NONE, &sm_client_disable,
-    NULL, NULL },
-  { NULL }
-};
+static char *sm_config_prefix = NULL;
 
 static gboolean
 sm_client_post_parse_func (GOptionContext  *context,
@@ -235,6 +219,29 @@
 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. */
@@ -242,8 +249,8 @@
 		     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);



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