[gnome-terminal] Fix smclient update



commit e176ee741bee7b74d22747c6272e7ce1738235e3
Author: Christian Persch <chpe gnome org>
Date:   Thu Dec 30 18:43:07 2010 +0100

    Fix smclient update
    
    The previous update lost our custom patches, and also
    changed the licence.

 src/eggdesktopfile.c      |    2 +-
 src/eggdesktopfile.h      |    2 +-
 src/eggshell.c            |    6 ++--
 src/eggshell.h            |    6 ++--
 src/eggsmclient-osx.c     |    8 +++---
 src/eggsmclient-private.h |    2 +-
 src/eggsmclient-win32.c   |    8 +++---
 src/eggsmclient-xsmp.c    |   58 ++++++++++++++++++++++++++++++++++++--------
 src/eggsmclient.c         |   29 +++++++++++++++++++---
 src/eggsmclient.h         |    8 +++++-
 10 files changed, 96 insertions(+), 33 deletions(-)
---
diff --git a/src/eggdesktopfile.c b/src/eggdesktopfile.c
index 9b12af5..edbddf6 100644
--- a/src/eggdesktopfile.c
+++ b/src/eggdesktopfile.c
@@ -7,7 +7,7 @@
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2 of
+ * as published by the Free Software Foundation; either version 3 of
  * the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful, but
diff --git a/src/eggdesktopfile.h b/src/eggdesktopfile.h
index 16c5426..55aaee3 100644
--- a/src/eggdesktopfile.h
+++ b/src/eggdesktopfile.h
@@ -3,7 +3,7 @@
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2 of
+ * as published by the Free Software Foundation; either version 3 of
  * the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful, but
diff --git a/src/eggshell.c b/src/eggshell.c
index 5d5e597..abf9854 100644
--- a/src/eggshell.c
+++ b/src/eggshell.c
@@ -6,16 +6,16 @@
  * This file is part of the Gnome Library.
  *
  * The Gnome Library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License as
+ * modify it under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 3 of the
  * License, or (at your option) any later version.
  *
  * The Gnome Library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
  * License along with the Gnome Library; see the file COPYING.LIB.  If not,
  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
diff --git a/src/eggshell.h b/src/eggshell.h
index 03f55db..80b6ba5 100644
--- a/src/eggshell.h
+++ b/src/eggshell.h
@@ -6,16 +6,16 @@
  * This file is part of the Gnome Library.
  *
  * The Gnome Library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public License as
+ * modify it under the terms of the GNU Lesser General Public License as
  * published by the Free Software Foundation; either version 3 of the
  * License, or (at your option) any later version.
  *
  * The Gnome Library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
  * License along with the Gnome Library; see the file COPYING.LIB.  If not,
  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
diff --git a/src/eggsmclient-osx.c b/src/eggsmclient-osx.c
index 7d3ff4b..a6e8087 100644
--- a/src/eggsmclient-osx.c
+++ b/src/eggsmclient-osx.c
@@ -3,16 +3,16 @@
  * Copyright (C) 2008 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 3 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
diff --git a/src/eggsmclient-private.h b/src/eggsmclient-private.h
index 0c98eee..ce948f9 100644
--- a/src/eggsmclient-private.h
+++ b/src/eggsmclient-private.h
@@ -4,7 +4,7 @@
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 3 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/src/eggsmclient-win32.c b/src/eggsmclient-win32.c
index 91a2571..c73cb4c 100644
--- a/src/eggsmclient-win32.c
+++ b/src/eggsmclient-win32.c
@@ -2,16 +2,16 @@
  * Copyright (C) 2007 Novell, Inc.
  *
  * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 3 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
diff --git a/src/eggsmclient-xsmp.c b/src/eggsmclient-xsmp.c
index ec1b594..c410332 100644
--- a/src/eggsmclient-xsmp.c
+++ b/src/eggsmclient-xsmp.c
@@ -6,16 +6,16 @@
  * session code (C) 1998 The Open Group.
  *
  * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 3 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
@@ -32,6 +32,7 @@
 #include <fcntl.h>
 #include <stdlib.h>
 #include <string.h>
+#include <time.h>
 #include <unistd.h>
 #include <X11/SM/SMlib.h>
 
@@ -89,6 +90,8 @@ struct _EggSMClientXSMP
   char **restart_command;
   gboolean set_restart_command;
   int restart_style;
+  char **discard_command;
+  gboolean set_discard_command;
 
   guint idle;
 
@@ -118,6 +121,9 @@ static void     sm_client_xsmp_startup (EggSMClient *client,
 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,
@@ -151,7 +157,7 @@ static SmProp *card8_prop        (const char    *name,
 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);
 
@@ -186,6 +192,7 @@ egg_sm_client_xsmp_class_init (EggSMClientXSMPClass *klass)
 
   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;
 }
@@ -409,6 +416,24 @@ sm_client_xsmp_set_restart_command (EggSMClient  *client,
 }
 
 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)
 {
@@ -776,7 +801,7 @@ save_state (EggSMClientXSMP *xsmp)
   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
@@ -792,7 +817,18 @@ save_state (EggSMClientXSMP *xsmp)
 		      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;
     }
 
@@ -1046,14 +1082,14 @@ xsmp_shutdown_cancelled (SmcConn   smc_conn,
  * 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)
     {
@@ -1067,8 +1103,8 @@ generate_command (char **restart_command, const char *client_id,
       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;
 }
diff --git a/src/eggsmclient.c b/src/eggsmclient.c
index 92be8a7..79064e4 100644
--- a/src/eggsmclient.c
+++ b/src/eggsmclient.c
@@ -2,16 +2,16 @@
  * Copyright (C) 2007 Novell, Inc.
  *
  * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 3 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
@@ -460,6 +460,27 @@ egg_sm_client_set_restart_command (EggSMClient  *client,
 }
 
 /**
+ * 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
diff --git a/src/eggsmclient.h b/src/eggsmclient.h
index e620b75..6de47b6 100644
--- a/src/eggsmclient.h
+++ b/src/eggsmclient.h
@@ -4,7 +4,7 @@
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
+ * version 3 of the License, or (at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -72,6 +72,9 @@ struct _EggSMClientClass
   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 @@ GKeyFile        *egg_sm_client_get_state_file      (EggSMClient *client);
 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]