[gnome-games] Remove smclient code from remaining games



commit 97d3b142d7b5e5710e2bfbd3eae6d65b807a4a8c
Author: Robert Ancell <robert ancell canonical com>
Date:   Sat Dec 31 18:52:04 2011 +1100

    Remove smclient code from remaining games

 configure.ac                           |   53 --
 glines/src/glines.c                    |  106 ---
 gnobots2/src/gnobots.c                 |   75 --
 gnotski/src/gnotski.c                  |   60 --
 libgames-support/Makefile.am           |   23 -
 libgames-support/eggdesktopfile.c      | 1518 --------------------------------
 libgames-support/eggdesktopfile.h      |  160 ----
 libgames-support/eggsmclient-osx.c     |  235 -----
 libgames-support/eggsmclient-private.h |   59 --
 libgames-support/eggsmclient-win32.c   |  353 --------
 libgames-support/eggsmclient-xsmp.c    | 1411 -----------------------------
 libgames-support/eggsmclient.c         |  625 -------------
 libgames-support/eggsmclient.h         |  123 ---
 libgames-support/eggsmclient.patch     |  202 -----
 14 files changed, 0 insertions(+), 5003 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3197121..8cf1928 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,7 +116,6 @@ need_glx=no
 need_python=no
 need_clutter=no
 want_sound=no
-allow_smclient=no
 require_cairo_1_10=no
 
 for game in $gamelist; do
@@ -153,10 +152,6 @@ for game in $gamelist; do
     *) ;;
   esac
   case $game in
-    glines|gnobots2|gnotski) allow_smclient=yes ;;
-    *) ;;
-  esac
-  case $game in
     quadrapassel|lightsoff|swell-foop|gnibbles) need_clutter=yes ;;
     *) ;;
   esac
@@ -483,53 +478,6 @@ fi
 
 AM_CONDITIONAL([ENABLE_SOUND],[test "$enable_sound" = "yes"])
 
-# SMClient
-
-SMCLIENT_PKGS=
-if test "$allow_smclient" = "yes"; then
-  AC_MSG_CHECKING([for GDK target])
-  for target in $($PKG_CONFIG --variable targets gdk-3.0); do
-    GDK_TARGET="$target"
-    break
-  done
-  AC_MSG_RESULT([$GDK_TARGET])
-
-  case "$GDK_TARGET" in
-    x11|win32|quartz) ;;
-    *) AC_MSG_ERROR([unknown GDK target])
-  esac
-
-  AC_MSG_CHECKING([which smclient backend to use])
-  AC_ARG_WITH([smclient],
-    [AS_HELP_STRING([--with-smclient],[which smclient backend to use (xsmp|win32|quartz|no)])],
-    [],
-    [case "$with_platform" in
-       gnome|gtk-only) case "$GDK_TARGET" in
-                         x11) with_smclient=xsmp SMCLIENT_PKGS="sm ice" ;;
-                         win32|quartz) with_smclient=$GDK_TARGET ;;
-                         *) with_smclient=no ;;
-                       esac
-                       ;;
-     esac])
-  AC_MSG_RESULT([$with_smclient])
-
-  if test "$with_smclient" != "no"; then
-    if test -n "$SMCLIENT_PKGS"; then
-      PKG_CHECK_MODULES([SMCLIENT],[$SMCLIENT_PKGS])
-    fi
-
-    AC_DEFINE([WITH_SMCLIENT],[1],[Define if smclient is enabled])
-  fi
-
-else
-  with_smclient=no
-fi
-
-AM_CONDITIONAL([WITH_SMCLIENT],[test "$with_smclient" != "no"])
-AM_CONDITIONAL([WITH_SMCLIENT_XSMP],[test "$with_smclient" = "xsmp"])
-AM_CONDITIONAL([WITH_SMCLIENT_WIN32],[test "$with_smclient" = "win32"])
-AM_CONDITIONAL([WITH_SMCLIENT_QUARTZ],[test "$with_smclient" = "quartz"])
-
 # *****************
 # Extra build tools
 # *****************
@@ -896,7 +844,6 @@ echo "
     Games to be compiled:  ${gamelist}
 
     Help method:           ${with_help_method} ${with_help_file_format}
-    Using SM Client:       ${with_smclient}
     Using RSVG:            ${have_rsvg}
     Using SQLite:          ${have_sqlite}
     Use setgid binaries:   ${enable_setgid}
diff --git a/glines/src/glines.c b/glines/src/glines.c
index 40fed16..cc2d615 100644
--- a/glines/src/glines.c
+++ b/glines/src/glines.c
@@ -45,10 +45,6 @@
 #include <libgames-support/games-settings.h>
 #include <libgames-support/games-stock.h>
 
-#ifdef WITH_SMCLIENT
-#include <libgames-support/eggsmclient.h>
-#endif /* WITH_SMCLIENT */
-
 #include "glines.h"
 
 #define KEY_BACKGROUND_COLOR  "background-color"
@@ -1464,83 +1460,6 @@ configure_event_callback (GtkWidget * widget, GdkEventConfigure * event)
   return TRUE;
 }
 
-#ifdef WITH_SMCLIENT
-static int
-save_state_cb (EggSMClient *client,
-            GKeyFile* keyfile,
-            gpointer client_data)
-{
-  gchar *buf;
-  int argc = 0;
-  char *argv[1];
-  int i;
-
-  g_settings_set_int (settings, KEY_SAVED_SCORE, score);
-
-  buf = g_malloc (hfieldsize * vfieldsize * 4 + 1);
-  for (i = 0; i < hfieldsize * vfieldsize; i++) {
-    buf[i * 4] = field[i].color + 'h';
-    buf[i * 4 + 1] = field[i].pathsearch + 'h';
-    buf[i * 4 + 2] = field[i].phase + 'h';
-    buf[i * 4 + 3] = field[i].active + 'h';
-  }
-  buf[hfieldsize * vfieldsize * 4] = '\0';
-  g_settings_set_string (settings, KEY_SAVED_FIELD, buf);
-  for (i = 0; i < npieces; i++)
-    buf[i] = preview[i] + 'h';
-  buf[npieces] = '\0';
-  g_settings_set_string (settings, KEY_SAVED_PREVIEW, buf);
-  g_free (buf);
-
-  argv[argc++] = g_get_prgname ();
-
-  egg_sm_client_set_restart_command (client, argc, (const char **) argv);
-
-  return TRUE;
-}
-
-static gint
-quit_cb (EggSMClient *client,
-         gpointer client_data)
-{
-  gtk_main_quit ();
-
-  return FALSE;
-}
-
-static void
-restart (void)
-{
-  gchar *buf;
-  int i;
-
-  /* This isn't really a good idea, but if we're going to
-   * restore the game the score has to be stored somewhere
-   * and without some sort of restricted-access storage the
-   * user will always be able to change it. */
-  score = g_settings_get_int (settings, KEY_SAVED_SCORE);
-
-  buf = g_settings_get_string (settings, KEY_SAVED_FIELD);
-  if (buf) {
-    for (i = 0; i < hfieldsize * vfieldsize; i++) {
-      field[i].color = CLAMP (buf[i * 4] - 'h', 1, ncolors);
-      field[i].pathsearch =
-        CLAMP (buf[i * 4 + 1] - 'h', -1, hfieldsize * vfieldsize);
-      field[i].phase = CLAMP (buf[i * 4 + 2] - 'h', 0, 3);
-      field[i].active = CLAMP (buf[i * 4 + 3] - 'h', -1, 1);
-    }
-    g_free (buf);
-  }
-  buf = g_settings_get_string (settings, KEY_SAVED_PREVIEW);
-  if (buf) {
-    for (i = 0; i < npieces; i++)
-      preview[i] = CLAMP (buf[i] - 'h', 1, ncolors);
-    g_free (buf);
-  }
-}
-
-#endif /* WITH_SMCLIENT */
-
 static void
 load_properties (void)
 {
@@ -1583,9 +1502,6 @@ main (int argc, char *argv[])
   guint i;
   gboolean retval;
   GError *error = NULL;
-#ifdef WITH_SMCLIENT
-  EggSMClient *sm_client;
-#endif /* WITH_SMCLIENT */
 
   if (!games_runtime_init ("glines"))
     return 1;
@@ -1599,9 +1515,6 @@ main (int argc, char *argv[])
   context = g_option_context_new (NULL);
   g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
   g_option_context_add_group (context, gtk_get_option_group (TRUE));
-#ifdef WITH_SMCLIENT
-  g_option_context_add_group (context, egg_sm_client_get_option_group ());
-#endif /* WITH_SMCLIENT */
 
   retval = g_option_context_parse (context, &argc, &argv, &error);
   g_option_context_free (context);
@@ -1627,20 +1540,6 @@ main (int argc, char *argv[])
 
   gtk_window_set_default_icon_name ("glines");
 
-#ifdef WITH_SMCLIENT
-  sm_client = egg_sm_client_get ();
-  g_signal_connect (sm_client, "save-state",
-                    G_CALLBACK (save_state_cb), NULL);
-  g_signal_connect (sm_client, "quit",
-                    G_CALLBACK (quit_cb), NULL);
-  if (egg_sm_client_is_resumed(sm_client))
-    restart ();
-  else
-    reset_game ();
-#else
-  reset_game ();
-#endif /* WITH_SMCLIENT */
-
   ui_path = g_build_filename (games_runtime_get_directory (GAMES_RUNTIME_GAME_DATA_DIRECTORY), "glines.ui", NULL);
   builder = gtk_builder_new ();
   gtk_builder_add_from_file (builder, ui_path, &error);
@@ -1718,11 +1617,6 @@ main (int argc, char *argv[])
 
   g_settings_sync();
 
-#ifdef WITH_SMCLIENT
-  g_signal_handlers_disconnect_matched (sm_client, G_SIGNAL_MATCH_DATA,
-                                        0, 0, NULL, NULL, NULL);
-#endif /* WITH_SMCLIENT */
-
   games_runtime_shutdown ();
 
   return 0;
diff --git a/gnobots2/src/gnobots.c b/gnobots2/src/gnobots.c
index 1abdbf0..d3f1fa8 100644
--- a/gnobots2/src/gnobots.c
+++ b/gnobots2/src/gnobots.c
@@ -35,10 +35,6 @@
 #include <libgames-support/games-scores-dialog.h>
 #include <libgames-support/games-stock.h>
 
-#ifdef WITH_SMCLIENT
-#include <libgames-support/eggsmclient.h>
-#endif /* WITH_SMCLIENT */
-
 #include "gbdefs.h"
 #include "statusbar.h"
 #include "gameconfig.h"
@@ -116,10 +112,6 @@ static const GamesScoresCategory scorecats[] = {
 /**********************************************************************/
 /* Function Prototypes                                                */
 /**********************************************************************/
-#ifdef WITH_SMCLIENT
-static gint save_state_cb (EggSMClient *, GKeyFile *, gpointer);
-static gint quit_sm_cb (EggSMClient *, gpointer);
-#endif /* WITH_SMCLIENT */
 /**********************************************************************/
 
 
@@ -127,59 +119,6 @@ static gint quit_sm_cb (EggSMClient *, gpointer);
 /* Function Definitions                                               */
 /**********************************************************************/
 
-#ifdef WITH_SMCLIENT
-/**
- * save_state
- * @client: gnome client
- * @phase: phase
- * @save_style: save style
- * @shutdown: shutdown
- * @interact_style: interact style
- * @fast: fast shutdown
- * @client_data: client data
- *
- * Description:
- * saves session info
- *
- * Returns:
- * TRUE on success, FALSE otherwise
- **/
-static gint
-save_state_cb (EggSMClient *client,
-	    GKeyFile* keyfile,
-	    gpointer client_data)
-{
-  char *argv[20];
-  int i;
-  int xpos, ypos;
-
-  gdk_window_get_origin (gtk_widget_get_window (app), &xpos, &ypos);
-
-  i = 0;
-  argv[i++] = (char *) client_data;
-  argv[i++] = "-x";
-  argv[i++] = g_strdup_printf ("%d", xpos);
-  argv[i++] = "-y";
-  argv[i++] = g_strdup_printf ("%d", ypos);
-
-  egg_sm_client_set_restart_command (client, i, (const char **) argv);
-
-  g_free (argv[2]);
-  g_free (argv[4]);
-
-  return TRUE;
-}
-
-static gint
-quit_sm_cb (EggSMClient *client,
-         gpointer client_data)
-{
-  quit_game();
-
-  return FALSE;
-}
-#endif /* WITH_SMCLIENT */
-
 /**
  * main
  * @argc: number of arguments
@@ -203,9 +142,6 @@ main (int argc, char *argv[])
   gchar *config;
   gboolean retval;
   GError *error = NULL;
-#ifdef WITH_SMCLIENT
-  EggSMClient *sm_client;
-#endif /* WITH_SMCLIENT */
 
   if (!games_runtime_init ("gnobots2"))
     return 1;
@@ -220,9 +156,6 @@ main (int argc, char *argv[])
   context = g_option_context_new (NULL);
   g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
   g_option_context_add_group (context, gtk_get_option_group (TRUE));
-#ifdef WITH_SMCLIENT
-  g_option_context_add_group (context, egg_sm_client_get_option_group ());
-#endif /* WITH_SMCLIENT */
 
   g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
 
@@ -246,14 +179,6 @@ main (int argc, char *argv[])
 
   gtk_window_set_default_icon_name ("gnobots2");
 
-#ifdef WITH_SMCLIENT
-  sm_client = egg_sm_client_get ();
-  g_signal_connect (sm_client, "save-state",
-		    G_CALLBACK (save_state_cb), NULL);
-  g_signal_connect (sm_client, "quit",
-                    G_CALLBACK (quit_sm_cb), NULL);
-#endif /* WITH_SMCLIENT */
-
   app = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_set_title (GTK_WINDOW (app), _("Robots"));
 
diff --git a/gnotski/src/gnotski.c b/gnotski/src/gnotski.c
index f2feedb..50836c7 100644
--- a/gnotski/src/gnotski.c
+++ b/gnotski/src/gnotski.c
@@ -38,10 +38,6 @@
 #include <libgames-support/games-stock.h>
 #include <libgames-support/games-fullscreen-action.h>
 
-#ifdef WITH_SMCLIENT
-#include <libgames-support/eggsmclient.h>
-#endif /* WITH_SMCLIENT */
-
 #include "pieces.h"
 
 #define APPNAME "gnotski"
@@ -145,10 +141,6 @@ void set_piece_id (char *, gint, gint, gint);
 gint move_piece (gint, gint, gint, gint, gint);
 void copymap (char *, char *);
 gint mapcmp (char *, char *);
-#ifdef WITH_SMCLIENT
-static int save_state_cb (EggSMClient *client, GKeyFile *keyfile, gpointer client_data);
-static int quit_cb (EggSMClient *client, gpointer client_data);
-#endif /* WITH_SMCLIENT */     
 void new_move (void);
 void game_score (void);
 gint game_over (void);
@@ -471,9 +463,6 @@ main (int argc, char **argv)
   gint startup_level;
   gboolean retval;
   GError *error = NULL;
-#ifdef WITH_SMCLIENT
-  EggSMClient *sm_client;
-#endif /* WITH_SMCLIENT */
 
   if (!games_runtime_init ("gnotski"))
     return 1;
@@ -485,9 +474,6 @@ main (int argc, char **argv)
   context = g_option_context_new (NULL);
   g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
   g_option_context_add_group (context, gtk_get_option_group (TRUE));
-#ifdef WITH_SMCLIENT
-  g_option_context_add_group (context, egg_sm_client_get_option_group ());
-#endif /* WITH_SMCLIENT */
   g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
 
   retval = g_option_context_parse (context, &argc, &argv, &error);
@@ -506,14 +492,6 @@ main (int argc, char **argv)
 
   gtk_window_set_default_icon_name ("gnotski");
   
-#ifdef WITH_SMCLIENT
-  sm_client = egg_sm_client_get ();
-  g_signal_connect (sm_client, "save-state",
-		    G_CALLBACK (save_state_cb), NULL);
-  g_signal_connect (sm_client, "quit",
-                    G_CALLBACK (quit_cb), NULL);
-#endif /* WITH_SMCLIENT */
-
   highscores = games_scores_new ("gnotski",
                                  scorecats, G_N_ELEMENTS (scorecats),
                                  NULL, NULL,
@@ -1403,44 +1381,6 @@ quit_game_cb (GtkAction * action)
   gtk_main_quit ();
 }
 
-#ifdef WITH_SMCLIENT
-static int
-save_state_cb (EggSMClient *client,
-	    GKeyFile* keyfile,
-	    gpointer client_data)
-{
-  gchar *argv[20];
-  gint argc;
-  gint xpos, ypos;
-
-  gdk_window_get_origin (gtk_widget_get_window (window), &xpos, &ypos);
-
-  argc = 0;
-  argv[argc++] = g_get_prgname ();
-  argv[argc++] = "-x";
-  argv[argc++] = g_strdup_printf ("%d", xpos);
-  argv[argc++] = "-y";
-  argv[argc++] = g_strdup_printf ("%d", ypos);
-
-  egg_sm_client_set_restart_command (client, argc, (const char **) argv);
-
-  g_free (argv[2]);
-  g_free (argv[4]);
-
-  return TRUE;
-}
-
-static gint
-quit_cb (EggSMClient *client,
-         gpointer client_data)
-{
-  gtk_main_quit ();
-
-  return FALSE;
-}
-
-#endif /* WITH_SMCLIENT */
-
 void
 level_cb (GtkAction * action, GtkRadioAction * current)
 {
diff --git a/libgames-support/Makefile.am b/libgames-support/Makefile.am
index 81fad4f..46720ac 100644
--- a/libgames-support/Makefile.am
+++ b/libgames-support/Makefile.am
@@ -97,29 +97,6 @@ libgames_support_la_CFLAGS += $(GIO_CFLAGS)
 libgames_support_la_LIBADD += $(GIO_LIBS)
 endif
 
-if WITH_SMCLIENT
-libgames_support_la_SOURCES += \
-	eggsmclient.c \
-	eggsmclient.h \
-	eggsmclient-private.h
-libgames_support_la_CFLAGS += $(SMCLIENT_CFLAGS)
-libgames_support_la_LIBADD += $(SMCLIENT_LIBS)
-
-if WITH_SMCLIENT_XSMP
-libgames_support_la_SOURCES += \
-	eggdesktopfile.c \
-	eggdesktopfile.h \
-	eggsmclient-xsmp.c
-libgames_support_la_CPPFLAGS += -DEGG_SM_CLIENT_BACKEND_XSMP
-endif
-if WITH_SMCLIENT_WIN32
-libgames_support_la_SOURCES += eggsmclient-win32.c
-endif
-if WITH_SMCLIENT_QUARTZ
-libgames_support_la_SOURCES += eggsmclient-osx.c
-endif
-endif # WITH_SMCLIENT
-
 if HAVE_GNOME
 libgames_support_la_CFLAGS += $(GNOME_CFLAGS)
 libgames_support_la_LIBADD += $(GNOME_LIBS)



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