gnome-games r9022 - branches/gnome-2-26/libgames-support



Author: jclinton
Date: Wed Apr  8 20:01:09 2009
New Revision: 9022
URL: http://svn.gnome.org/viewvc/gnome-games?rev=9022&view=rev

Log:
Re-apply our custom patches to smclient.

Modified:
   branches/gnome-2-26/libgames-support/eggdesktopfile.c
   branches/gnome-2-26/libgames-support/eggsmclient-xsmp.c
   branches/gnome-2-26/libgames-support/eggsmclient.c
   branches/gnome-2-26/libgames-support/eggsmclient.h
   branches/gnome-2-26/libgames-support/eggsmclient.patch

Modified: branches/gnome-2-26/libgames-support/eggdesktopfile.c
==============================================================================
--- branches/gnome-2-26/libgames-support/eggdesktopfile.c	(original)
+++ branches/gnome-2-26/libgames-support/eggdesktopfile.c	Wed Apr  8 20:01:09 2009
@@ -1440,19 +1440,6 @@
       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: branches/gnome-2-26/libgames-support/eggsmclient-xsmp.c
==============================================================================
--- branches/gnome-2-26/libgames-support/eggsmclient-xsmp.c	(original)
+++ branches/gnome-2-26/libgames-support/eggsmclient-xsmp.c	Wed Apr  8 20:01:09 2009
@@ -88,6 +88,8 @@
   char **restart_command;
   gboolean set_restart_command;
   int restart_style;
+  char **discard_command;
+  gboolean set_discard_command;
 
   guint idle;
 
@@ -117,6 +119,9 @@
 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,
@@ -150,7 +155,7 @@
 static void set_properties         (EggSMClientXSMP *xsmp, ...);
 static void delete_properties      (EggSMClientXSMP *xsmp, ...);
 
-static GPtrArray *generate_command (char       **restart_command,
+static GPtrArray *generate_command (char       **argv,
 				    const char  *client_id,
 				    const char  *state_file);
 
@@ -185,6 +190,7 @@
 
   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;
 }
@@ -404,6 +410,24 @@
 }
 
 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)
 {
@@ -771,7 +795,7 @@
   GKeyFile *state_file;
   char *state_file_path, *data;
   EggDesktopFile *desktop_file;
-  GPtrArray *restart;
+  GPtrArray *restart, *discard;
   int offset, fd;
 
   /* We set xsmp->state before emitting save_state, but our caller is
@@ -787,7 +811,18 @@
 		      ptrarray_prop (SmRestartCommand, restart),
 		      NULL);
       g_ptr_array_free (restart, TRUE);
-      delete_properties (xsmp, SmDiscardCommand, NULL);
+
+      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);
+
       return;
     }
 
@@ -1041,14 +1076,14 @@
  * then free the array, but not its contents.
  */
 static GPtrArray *
-generate_command (char **restart_command, const char *client_id,
+generate_command (char **argv, const char *client_id,
 		  const char *state_file)
 {
   GPtrArray *cmd;
   int i;
 
   cmd = g_ptr_array_new ();
-  g_ptr_array_add (cmd, restart_command[0]);
+  g_ptr_array_add (cmd, argv[0]);
 
   if (client_id)
     {
@@ -1062,8 +1097,8 @@
       g_ptr_array_add (cmd, (char *)state_file);
     }
 
-  for (i = 1; restart_command[i]; i++)
-    g_ptr_array_add (cmd, restart_command[i]);
+  for (i = 1; argv[i]; i++)
+    g_ptr_array_add (cmd, argv[i]);
 
   return cmd;
 }

Modified: branches/gnome-2-26/libgames-support/eggsmclient.c
==============================================================================
--- branches/gnome-2-26/libgames-support/eggsmclient.c	(original)
+++ branches/gnome-2-26/libgames-support/eggsmclient.c	Wed Apr  8 20:01:09 2009
@@ -445,6 +445,27 @@
 }
 
 /**
+ * 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: branches/gnome-2-26/libgames-support/eggsmclient.h
==============================================================================
--- branches/gnome-2-26/libgames-support/eggsmclient.h	(original)
+++ branches/gnome-2-26/libgames-support/eggsmclient.h	Wed Apr  8 20:01:09 2009
@@ -72,6 +72,9 @@
   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,
@@ -102,6 +105,9 @@
 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,

Modified: branches/gnome-2-26/libgames-support/eggsmclient.patch
==============================================================================
--- branches/gnome-2-26/libgames-support/eggsmclient.patch	(original)
+++ branches/gnome-2-26/libgames-support/eggsmclient.patch	Wed Apr  8 20:01:09 2009
@@ -1,5 +1,29 @@
+diff --git a/libegg/smclient/eggdesktopfile.c b/libegg/smclient/eggdesktopfile.c
+index 357e548..ce0c6f3 100644
+--- a/libegg/smclient/eggdesktopfile.c
++++ b/libegg/smclient/eggdesktopfile.c
+@@ -1440,19 +1440,6 @@ egg_set_desktop_file (const char *desktop_file_path)
+       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);
+ }
+ 
 diff --git a/libegg/smclient/eggsmclient-xsmp.c b/libegg/smclient/eggsmclient-xsmp.c
-index e4b11f6..dcaf36b 100644
+index 1a56156..81af7d2 100644
 --- a/libegg/smclient/eggsmclient-xsmp.c
 +++ b/libegg/smclient/eggsmclient-xsmp.c
 @@ -88,6 +88,8 @@ struct _EggSMClientXSMP
@@ -92,7 +116,7 @@
        return;
      }
  
-@@ -1034,14 +1069,14 @@ xsmp_shutdown_cancelled (SmcConn   smc_conn,
+@@ -1041,14 +1076,14 @@ xsmp_shutdown_cancelled (SmcConn   smc_conn,
   * then free the array, but not its contents.
   */
  static GPtrArray *
@@ -109,7 +133,7 @@
  
    if (client_id)
      {
-@@ -1055,8 +1090,8 @@ generate_command (char **restart_command, const char *client_id,
+@@ -1062,8 +1097,8 @@ generate_command (char **restart_command, const char *client_id,
        g_ptr_array_add (cmd, (char *)state_file);
      }
  
@@ -121,10 +145,10 @@
    return cmd;
  }
 diff --git a/libegg/smclient/eggsmclient.c b/libegg/smclient/eggsmclient.c
-index 8e2254f..6bec6ed 100644
+index efa901d..85aaee4 100644
 --- a/libegg/smclient/eggsmclient.c
 +++ b/libegg/smclient/eggsmclient.c
-@@ -437,6 +437,27 @@ egg_sm_client_set_restart_command (EggSMClient  *client,
+@@ -445,6 +445,27 @@ egg_sm_client_set_restart_command (EggSMClient  *client,
  }
  
  /**



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