gnome-games r9019 - trunk/libgames-support



Author: jclinton
Date: Wed Apr  8 18:59:59 2009
New Revision: 9019
URL: http://svn.gnome.org/viewvc/gnome-games?rev=9019&view=rev

Log:
Resync libegg smclient per mclasen request

Modified:
   trunk/libgames-support/eggdesktopfile.c
   trunk/libgames-support/eggsmclient-xsmp.c
   trunk/libgames-support/eggsmclient.c
   trunk/libgames-support/eggsmclient.h

Modified: trunk/libgames-support/eggdesktopfile.c
==============================================================================
--- trunk/libgames-support/eggdesktopfile.c	(original)
+++ trunk/libgames-support/eggdesktopfile.c	Wed Apr  8 18:59:59 2009
@@ -1440,6 +1440,19 @@
       g_error_free (error);
     }
 
+  if (egg_desktop_file) {
+    /* Set localized application name and default window icon */
+    if (egg_desktop_file->name)
+      g_set_application_name (egg_desktop_file->name);
+    if (egg_desktop_file->icon)
+      {
+        if (g_path_is_absolute (egg_desktop_file->icon))
+          gtk_window_set_default_icon_from_file (egg_desktop_file->icon, NULL);
+        else
+          gtk_window_set_default_icon_name (egg_desktop_file->icon);
+      }
+  }
+
   G_UNLOCK (egg_desktop_file);
 }
 

Modified: trunk/libgames-support/eggsmclient-xsmp.c
==============================================================================
--- trunk/libgames-support/eggsmclient-xsmp.c	(original)
+++ trunk/libgames-support/eggsmclient-xsmp.c	Wed Apr  8 18:59:59 2009
@@ -88,8 +88,6 @@
   char **restart_command;
   gboolean set_restart_command;
   int restart_style;
-  char **discard_command;
-  gboolean set_discard_command;
 
   guint idle;
 
@@ -119,9 +117,6 @@
 static void     sm_client_xsmp_set_restart_command (EggSMClient  *client,
 						    int           argc,
 						    const char  **argv);
-static void     sm_client_xsmp_set_discard_command (EggSMClient  *client,
-						    int           argc,
-						    const char  **argv);
 static void     sm_client_xsmp_will_quit (EggSMClient *client,
 					  gboolean     will_quit);
 static gboolean sm_client_xsmp_end_session (EggSMClient         *client,
@@ -155,7 +150,7 @@
 static void set_properties         (EggSMClientXSMP *xsmp, ...);
 static void delete_properties      (EggSMClientXSMP *xsmp, ...);
 
-static GPtrArray *generate_command (char       **argv,
+static GPtrArray *generate_command (char       **restart_command,
 				    const char  *client_id,
 				    const char  *state_file);
 
@@ -190,7 +185,6 @@
 
   sm_client_class->startup             = sm_client_xsmp_startup;
   sm_client_class->set_restart_command = sm_client_xsmp_set_restart_command;
-  sm_client_class->set_discard_command = sm_client_xsmp_set_discard_command;
   sm_client_class->will_quit           = sm_client_xsmp_will_quit;
   sm_client_class->end_session         = sm_client_xsmp_end_session;
 }
@@ -410,24 +404,6 @@
 }
 
 static void
-sm_client_xsmp_set_discard_command (EggSMClient  *client,
-				    int           argc,
-				    const char  **argv)
-{
-  EggSMClientXSMP *xsmp = (EggSMClientXSMP *)client;
-  int i;
-
-  g_strfreev (xsmp->discard_command);
-
-  xsmp->discard_command = g_new (char *, argc + 1);
-  for (i = 0; i < argc; i++)
-    xsmp->discard_command[i] = g_strdup (argv[i]);
-  xsmp->discard_command[i] = NULL;
-
-  xsmp->set_discard_command = TRUE;
-}
-
-static void
 sm_client_xsmp_will_quit (EggSMClient *client,
 			  gboolean     will_quit)
 {
@@ -795,7 +771,7 @@
   GKeyFile *state_file;
   char *state_file_path, *data;
   EggDesktopFile *desktop_file;
-  GPtrArray *restart, *discard;
+  GPtrArray *restart;
   int offset, fd;
 
   /* We set xsmp->state before emitting save_state, but our caller is
@@ -811,18 +787,7 @@
 		      ptrarray_prop (SmRestartCommand, restart),
 		      NULL);
       g_ptr_array_free (restart, TRUE);
-
-      if (xsmp->set_discard_command)
-        {
-          discard = generate_command (xsmp->discard_command, NULL, NULL);
-          set_properties (xsmp,
-                          ptrarray_prop (SmDiscardCommand, discard),
-                          NULL);
-          g_ptr_array_free (discard, TRUE);
-        }
-      else
-        delete_properties (xsmp, SmDiscardCommand, NULL);
-
+      delete_properties (xsmp, SmDiscardCommand, NULL);
       return;
     }
 
@@ -830,10 +795,14 @@
   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))
 	{
@@ -876,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
@@ -1069,14 +1041,14 @@
  * then free the array, but not its contents.
  */
 static GPtrArray *
-generate_command (char **argv, const char *client_id,
+generate_command (char **restart_command, const char *client_id,
 		  const char *state_file)
 {
   GPtrArray *cmd;
   int i;
 
   cmd = g_ptr_array_new ();
-  g_ptr_array_add (cmd, argv[0]);
+  g_ptr_array_add (cmd, restart_command[0]);
 
   if (client_id)
     {
@@ -1090,8 +1062,8 @@
       g_ptr_array_add (cmd, (char *)state_file);
     }
 
-  for (i = 1; argv[i]; i++)
-    g_ptr_array_add (cmd, argv[i]);
+  for (i = 1; restart_command[i]; i++)
+    g_ptr_array_add (cmd, restart_command[i]);
 
   return cmd;
 }

Modified: trunk/libgames-support/eggsmclient.c
==============================================================================
--- trunk/libgames-support/eggsmclient.c	(original)
+++ trunk/libgames-support/eggsmclient.c	Wed Apr  8 18:59:59 2009
@@ -445,27 +445,6 @@
 }
 
 /**
- * egg_sm_client_set_discard_command:
- * @client: the client
- * @argc: the length of @argv
- * @argv: argument vector
- *
- * Sets the command used to discard a custom state file if using
- * egg_sm_client_set_restart_command(), which must be called before 
- * using this function.
- **/
-void
-egg_sm_client_set_discard_command (EggSMClient  *client,
-				   int           argc,
-				   const char  **argv)
-{
-  g_return_if_fail (EGG_IS_SM_CLIENT (client));
-
-  if (EGG_SM_CLIENT_GET_CLASS (client)->set_discard_command)
-    EGG_SM_CLIENT_GET_CLASS (client)->set_discard_command (client, argc, argv);
-}
-
-/**
  * egg_sm_client_will_quit:
  * @client: the client
  * @will_quit: whether or not the application is willing to quit

Modified: trunk/libgames-support/eggsmclient.h
==============================================================================
--- trunk/libgames-support/eggsmclient.h	(original)
+++ trunk/libgames-support/eggsmclient.h	Wed Apr  8 18:59:59 2009
@@ -72,9 +72,6 @@
   void	   (*set_restart_command) (EggSMClient          *client,
 				   int                   argc,
 				   const char          **argv);
-  void	   (*set_discard_command) (EggSMClient          *client,
-				   int                   argc,
-				   const char          **argv);
   void	   (*will_quit)           (EggSMClient          *client,
 				   gboolean              will_quit);
   gboolean (*end_session)         (EggSMClient          *client,
@@ -105,9 +102,6 @@
 void             egg_sm_client_set_restart_command (EggSMClient  *client,
 						    int           argc,
 						    const char  **argv);
-void             egg_sm_client_set_discard_command (EggSMClient  *client,
-						    int           argc,
-						    const char  **argv);
 
 /* Handling "quit_requested" signal */
 void             egg_sm_client_will_quit           (EggSMClient *client,



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