[aisleriot] all: Declutter



commit beb99f3d396784fe6d383c3a2ca0bbb46d507122
Author: Christian Persch <chpe gnome org>
Date:   Tue Sep 13 13:31:05 2011 +0200

    all: Declutter
    
    Conflicts:
    
        configure.ac
        po/POTFILES.in
        src/Makefile.am
        src/ar-clutter-embed.c
        src/board.c
        src/card.c
        src/game.c
        src/lib/Makefile.am
        src/slot-renderer.c
    
    Conflicts:
        po/POTFILES.in
        src/Makefile.am
        src/ar-clutter-embed.c
        src/window.c

 configure.ac                     |   37 -
 po/POTFILES.in                   |    2 -
 src/Makefile.am                  |   52 -
 src/ar-clutter-embed.c           |  270 ---
 src/ar-clutter-embed.h           |   61 -
 src/baize.c                      |   91 -
 src/baize.h                      |   65 -
 src/board.c                      | 3524 --------------------------------------
 src/board.h                      |   99 --
 src/card.c                       |  360 ----
 src/card.h                       |   79 -
 src/game.c                       |   55 -
 src/game.h                       |   14 -
 src/lib/Makefile.am              |   12 -
 src/lib/ar-card-textures-cache.c |  374 ----
 src/lib/ar-card-textures-cache.h |   74 -
 src/slot-renderer.c              |  700 --------
 src/slot-renderer.h              |  101 --
 src/sol.c                        |   12 -
 src/window.c                     |  155 +--
 20 files changed, 13 insertions(+), 6124 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index da24c4f..7526b05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,21 +114,6 @@ esac
 AC_MSG_RESULT([$os_win32])
 AM_CONDITIONAL([PLATFORM_WIN32_NATIVE],[test "$os_win32" = "yes"])
 
-# *******
-# Clutter
-# *******
-
-AC_MSG_CHECKING([whether to enable clutter])
-AC_ARG_WITH([clutter],
-  [AS_HELP_STRING([--with-clutter],[Enable the clutter version of aisleriot (default: disabled)])],
-  [],[with_clutter=no])
-AC_MSG_RESULT([$with_clutter])
-
-if test "$with_clutter" = "yes"; then
-  # Distro packagers: DO NOT ENABLE AISLERIOT/CLUTTER IN YOUR DISTRO PACKAGES, OR ELSE!
-  AC_MSG_NOTICE([Aisleriot/Clutter is experimental; do not enable this for distribution packages!])
-fi
-
 # ******************
 # Card theme formats
 # ******************
@@ -332,28 +317,6 @@ fi
 
 AM_CONDITIONAL([HAVE_RSVG],[test "$have_rsvg" = "yes"])
 
-# Check for Clutter
-
-if test "$with_clutter" = "yes"; then
-  CLUTTER_REQUIRED=1.0.0
-
-  PKG_CHECK_MODULES([CLUTTER],[clutter-1.0 >= $CLUTTER_REQUIRED])
-  AC_SUBST([CLUTTER_CFLAGS])
-  AC_SUBST([CLUTTER_LIBS])
-
-  case "$with_gtk" in
-    3.0) CLUTTER_GTK_API_VERSION=1.0
-         CLUTTER_GTK_REQUIRED=0.91.6
-         ;;
-  esac
-
-  PKG_CHECK_MODULES([CLUTTER_GTK],[clutter-gtk-$CLUTTER_GTK_API_VERSION >= $CLUTTER_GTK_REQUIRED])
-  AC_SUBST([CLUTTER_GTK_CFLAGS])
-  AC_SUBST([CLUTTER_GTK_LIBS])
-fi
-
-AM_CONDITIONAL([HAVE_CLUTTER],[test "$with_clutter" = "yes"])
-
 # *****************
 # Extra build tools
 # *****************
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 66c15f9..c3a7bfb 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -5,10 +5,8 @@ data/sol.appdata.xml.in
 data/sol.desktop.in.in
 src/aisleriot.schemas.in
 src/ar-application.c
-src/ar-clutter-embed.c
 src/ar-game-chooser.c
 src/ar-stock.c
-src/board.c
 src/board-noclutter.c
 src/conf.c
 src/game.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 9d2a210..77b8a68 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -63,58 +63,6 @@ if PLATFORM_WIN32_NATIVE
 sol_LDFLAGS += -mwindows
 endif
 
-if HAVE_CLUTTER
-
-noinst_PROGRAMS = sol-clutter
-
-sol_clutter_SOURCES = \
-       ar-application.c \
-       ar-application.h \
-       ar-clock.c      \
-       ar-clock.h      \
-       ar-clutter-embed.c \
-       ar-clutter-embed.h \
-       ar-cursor.c     \
-       ar-cursor.h     \
-       ar-game-chooser.c \
-       ar-game-chooser.h \
-       ar-resources.c  \
-       ar-resources.h  \
-       ar-stock.c      \
-       ar-stock.h      \
-       ar-style.c      \
-       ar-style.h      \
-       ar-style-private.h \
-       ar-style-gtk.c  \
-       ar-style-gtk.h  \
-       baize.c         \
-       baize.h         \
-       board.c         \
-       board.h         \
-       card.c          \
-       card.h          \
-       conf.c          \
-       conf.h          \
-       game.c          \
-       game.h          \
-       sol.c           \
-       slot-renderer.c \
-       slot-renderer.h \
-       stats-dialog.c  \
-       stats-dialog.h  \
-       util.c          \
-       util.h          \
-       window.c        \
-       window.h        \
-       $(NULL)
-
-sol_clutter_CPPFLAGS = $(sol_CPPFLAGS) -DHAVE_CLUTTER
-sol_clutter_CFLAGS = $(sol_CFLAGS) $(CLUTTER_GTK_CFLAGS) $(CLUTTER_CFLAGS)
-sol_clutter_LDFLAGS = $(sol_LDFLAGS)
-sol_clutter_LDADD = $(sol_LDADD) $(CLUTTER_GTK_LIBS) $(CLUTTER_LIBS)
-
-endif # HAVE_CLUTTER
-
 BUILT_SOURCES = \
        ar-resources.c \
        ar-resources.h \
diff --git a/src/game.c b/src/game.c
index 378c1c8..b196bdc 100644
--- a/src/game.c
+++ b/src/game.c
@@ -27,10 +27,6 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 
-#ifdef HAVE_CLUTTER
-#include <clutter/clutter.h>
-#endif
-
 #include "ar-debug.h"
 #include "ar-runtime.h"
 #include "ar-string-utils.h"
@@ -251,16 +247,7 @@ clear_slots (AisleriotGame *game,
   for (i = 0; i < n_slots; ++i) {
     ArSlot *slot = game->slots->pdata[i];
 
-#ifdef HAVE_CLUTTER
-    if (slot->slot_renderer) {
-      clutter_actor_destroy (slot->slot_renderer);
-      g_object_unref (slot->slot_renderer);
-    }
-
-    g_byte_array_free (slot->old_cards, TRUE);
-#else
     g_ptr_array_free (slot->card_images, TRUE);
-#endif /* HAVE_CLUTTER */
     g_byte_array_free (slot->cards, TRUE);
 
     g_slice_free (ArSlot, slot);
@@ -672,11 +659,7 @@ cscmi_add_slot (SCM slot_data)
   slot->expanded_down = expanded_down != FALSE;
   slot->expanded_right = expanded_right != FALSE;
 
-#ifdef HAVE_CLUTTER
-  slot->old_cards = g_byte_array_sized_new (SLOT_CARDS_N_PREALLOC);
-#else
   slot->card_images = g_ptr_array_sized_new (SLOT_CARDS_N_PREALLOC);
-#endif
 
   slot->needs_update = TRUE;
 
@@ -2582,44 +2565,6 @@ aisleriot_game_get_score (AisleriotGame *game)
   return game->score ? game->score : "";
 }
 
-#ifdef HAVE_CLUTTER
-
-void
-aisleriot_game_get_card_offset (ArSlot *slot,
-                                guint card_num,
-                                gboolean old_cards,
-                                gint *xoff, gint *yoff)
-{
-  gint n_cards, exposed;
-
-  if (old_cards) {
-    n_cards = (gint) slot->old_cards->len;
-    exposed = (gint) slot->old_exposed;
-  } else {
-    n_cards = (gint) slot->cards->len;
-    exposed = (gint) slot->exposed;
-  }
-
-  if (card_num >= n_cards - exposed) {
-    gint idx = card_num + exposed - n_cards;
-    *xoff = slot->pixeldx * idx;
-    *yoff = slot->pixeldy * idx;
-  } else {
-    *xoff = 0;
-    *yoff = 0;
-  }
-}
-
-void
-aisleriot_game_reset_old_cards (ArSlot *slot)
-{
-  g_byte_array_set_size (slot->old_cards, 0);
-  g_byte_array_append (slot->old_cards, slot->cards->data, slot->cards->len);
-  slot->old_exposed = slot->exposed;
-}
-
-#endif /* HAVE_CLUTTER */
-
 static void
 append_games_from_path (GHashTable *hash_table,
                         const char *path,
diff --git a/src/game.h b/src/game.h
index 4779ed1..1d73f52 100644
--- a/src/game.h
+++ b/src/game.h
@@ -22,10 +22,6 @@
 
 #include "ar-card.h"
 
-#ifdef HAVE_CLUTTER
-#include <clutter/clutter.h>
-#endif
-
 G_BEGIN_DECLS
 
 /* A slot */
@@ -45,11 +41,6 @@ typedef struct {
   ArSlotType type;
 
   GByteArray *cards;
-#ifdef HAVE_CLUTTER
-  /* The old state of the cards so we can check for differences */
-  guint old_exposed;
-  GByteArray *old_cards;
-#endif /* HAVE_CLUTTER */
 
   /* the topmost |exposed| cards are shown on the pile */
   guint exposed;
@@ -71,13 +62,8 @@ typedef struct {
   /* The location in pixel units. Filled in by the scaling code. */
   GdkRectangle rect;
 
-#ifdef HAVE_CLUTTER
-  /* Actor for the slot */
-  ClutterActor *slot_renderer;
-#else
   /* GdkPixbuf* or GdkPixmap*, no reference owned */
   GPtrArray *card_images;
-#endif /* HAVE_CLUTTER */
 
   guint expanded_right : 1;
   guint expanded_down : 1;
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index de938fc..24cbce6 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -42,13 +42,6 @@ nodist_libaisleriot_la_SOURCES = \
        $(BUILT_SOURCES) \
        $(NULL)
 
-if HAVE_CLUTTER
-libaisleriot_la_SOURCES += \
-       ar-card-textures-cache.c \
-       ar-card-textures-cache.h \
-       $(NULL)
-endif # HAVE_CLUTTER
-
 if HAVE_RSVG
 libaisleriot_la_SOURCES += \
        ar-svg.c \
@@ -93,11 +86,6 @@ libaisleriot_la_CFLAGS = \
 libaisleriot_la_LIBADD = \
        $(AISLERIOT_LIBS)
 
-if HAVE_CLUTTER
-libaisleriot_la_CFLAGS += $(CLUTTER_CFLAGS)
-libaisleriot_la_LIBADD += $(CLUTTER_LIBS)
-endif # HAVE_CLUTTER
-
 gsettingsschema_in_files = org.gnome.Patience.WindowState.gschema.xml.in
 gsettings_SCHEMAS = $(gsettingsschema_in_files:.gschema.xml.in=.gschema.xml)
 
diff --git a/src/sol.c b/src/sol.c
index 993baa9..529dcec 100644
--- a/src/sol.c
+++ b/src/sol.c
@@ -28,12 +28,6 @@
 
 #include <gtk/gtk.h>
 
-#ifdef HAVE_CLUTTER
-#include <cogl/cogl.h>
-#include <clutter/clutter.h>
-#include <clutter-gtk/clutter-gtk.h>
-#endif
-
 #include "ar-debug.h"
 #include "ar-stock.h"
 #include "ar-runtime.h"
@@ -99,12 +93,6 @@ main_prog (void *closure, int argc, char *argv[])
 
   g_option_context_add_group (option_context, gtk_get_option_group (TRUE));
 
-#ifdef HAVE_CLUTTER
-  g_option_context_add_group (option_context, cogl_get_option_group ());
-  g_option_context_add_group (option_context, clutter_get_option_group_without_init ());
-  g_option_context_add_group (option_context, gtk_clutter_get_option_group ());
-#endif /* HAVE_CLUTTER */
-
   retval = g_option_context_parse (option_context, &argc, &argv, &error);
   g_option_context_free (option_context);
 
diff --git a/src/window.c b/src/window.c
index 210cd82..e3ce0b1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -39,14 +39,7 @@
 #include "ar-string-utils.h"
 #include "ar-gsettings.h"
 
-#ifdef HAVE_CLUTTER
-#include "ar-clutter-embed.h"
-#include "ar-style.h"
-#include "baize.h"
-#include "board.h"
-#else
 #include "board-noclutter.h"
-#endif
 
 #include "ar-card-theme.h"
 #include "ar-card-themes.h"
@@ -93,13 +86,7 @@ struct _AisleriotWindowPrivate
 {
   AisleriotGame *game;
   ArStyle *board_style;
-#ifdef HAVE_CLUTTER
-  ArClutterEmbed *board;
-  ClutterActor *baize_actor;
-  ClutterActor *board_actor;
-#else
   AisleriotBoard *board;
-#endif
 
   ArCardThemes *theme_manager;
   ArCardTheme *theme;
@@ -901,22 +888,6 @@ sound_toggle_cb (GtkToggleAction *action,
 }
 
 static void
-animations_toggle_cb (GtkToggleAction *action,
-                      AisleriotWindow *window)
-{
-#ifdef HAVE_CLUTTER
-  AisleriotWindowPrivate *priv = window->priv;
-  gboolean enabled;
-
-  enabled = gtk_toggle_action_get_active (action);
-
-  ar_style_set_enable_animations (priv->board_style, enabled);
-  
-  ar_conf_set_boolean (NULL, aisleriot_conf_get_key (CONF_ANIMATIONS), enabled);
-#endif /* HAVE_CLUTTER */
-}
-
-static void
 show_hint_cb (GtkAction *action,
               AisleriotWindow *window)
 {
@@ -1705,12 +1676,13 @@ game_exception_cb (AisleriotGame *game,
   gtk_widget_show (dialog);
 }
 
+#if defined(ENABLE_SOUND)
+
 static void
 settings_changed_cb (GtkSettings *settings,
                      GParamSpec *pspec,
                      AisleriotWindow *window)
 {
-#if defined(HAVE_CLUTTER) || defined(ENABLE_SOUND)
   AisleriotWindowPrivate *priv = window->priv;
   GtkAction *action;
   gboolean enabled;
@@ -1721,26 +1693,12 @@ settings_changed_cb (GtkSettings *settings,
   else
     name = NULL;
 
-#ifdef HAVE_CLUTTER
-  if (name == NULL || strcmp (name, "gtk-enable-animations") == 0)
-    g_object_get (settings, "gtk-enable-animations", &enabled, NULL);
-  else
-#endif /* HAVE_CLUTTER */
-    enabled = FALSE;
-
-  action = gtk_action_group_get_action (priv->action_group, "Animations");
-  gtk_action_set_visible (action, enabled);
-
-#ifdef ENABLE_SOUND
-  if (name == NULL || strcmp (name, "gtk-enable-event-sounds") == 0)
+  if (name == NULL || strcmp (name, "gtk-enable-event-sounds") == 0) {
     g_object_get (settings, "gtk-enable-event-sounds", &enabled, NULL);
-  else
-#endif /* ENABLE_SOUND */
-    enabled = FALSE;
 
-  action = gtk_action_group_get_action (priv->action_group, "Sound");
-  gtk_action_set_visible (action, enabled);
-#endif /* HAVE_CLUTTER || ENABLE_SOUND */
+    action = gtk_action_group_get_action (priv->action_group, "Sound");
+    gtk_action_set_visible (action, enabled);
+  }
 }
 
 static void
@@ -1748,7 +1706,6 @@ screen_changed_cb (GtkWidget *widget,
                    GdkScreen *previous_screen,
                    AisleriotWindow *window)
 {
-#if defined(HAVE_CLUTTER) || defined(ENABLE_SOUND)
   GdkScreen *screen;
   GtkSettings *settings;
 
@@ -1765,23 +1722,16 @@ screen_changed_cb (GtkWidget *widget,
   if (screen == NULL)
     return;
 
-#ifdef ENABLE_SOUND
   ar_sound_init (screen);
-#endif
 
   settings = gtk_widget_get_settings (widget);
   settings_changed_cb (settings, NULL, window);
-#ifdef HAVE_CLUTTER
-  g_signal_connect (settings, "notify::gtk-enable-animations",
-                    G_CALLBACK (settings_changed_cb), window);
-#endif
-#ifdef ENABLE_SOUND
   g_signal_connect (settings, "notify::gtk-enable-event-sounds",
                     G_CALLBACK (settings_changed_cb), window);
-#endif
-#endif /* HAVE_CLUTTER || ENABLE_SOUND */
 }
 
+#endif /* ENABLE_SOUND */
+
 static void
 board_status_message_cb (AisleriotBoard *board,
                          const char *status_message,
@@ -1796,35 +1746,6 @@ board_status_message_cb (AisleriotBoard *board,
   }
 }
 
-#ifdef HAVE_CLUTTER
-
-static void
-board_cursor_cb (AisleriotBoard *board,
-                 int cursor_type,
-                 ArClutterEmbed *embed)
-{
-  ar_clutter_embed_set_cursor (embed, (ArCursorType) cursor_type);
-}
-
-static void
-board_error_bell_cb (AisleriotBoard *board,
-                     ArClutterEmbed *embed)
-{
-  gtk_widget_error_bell (GTK_WIDGET (embed));
-}
-
-static void
-embed_size_allocate_cb (ArClutterEmbed *embed,
-                        GtkAllocation *allocation,
-                        AisleriotWindow *window)
-{
-  AisleriotWindowPrivate *priv = window->priv;
-
-  clutter_actor_set_size (priv->board_actor, allocation->width, allocation->height);
-}
-
-#endif /* HAVE_CLUTTER */
-
 /* Class implementation */
 
 G_DEFINE_TYPE (AisleriotWindow, aisleriot_window, GTK_TYPE_APPLICATION_WINDOW)
@@ -1993,10 +1914,6 @@ aisleriot_window_init (AisleriotWindow *window)
       N_("Whether or not to play event sounds"),
       G_CALLBACK (sound_toggle_cb),
       FALSE /* not active by default */ },
-   { "Animations", NULL, N_("_Animations"), NULL,
-      N_("Whether or not to animate card moves"),
-      G_CALLBACK (animations_toggle_cb),
-      FALSE /* not active by default */ },
   };
 
   static const char names[][16] = {
@@ -2021,9 +1938,6 @@ aisleriot_window_init (AisleriotWindow *window)
   GtkStatusbar *statusbar;
   GtkWidget *statusbar_hbox, *label, *time_box;
   GError *error = NULL;
-#ifdef HAVE_CLUTTER
-  ClutterContainer *stage;
-#endif
 
   g_assert (G_N_ELEMENTS (names) == LAST_ACTION);
 
@@ -2037,34 +1951,7 @@ aisleriot_window_init (AisleriotWindow *window)
 
   priv->board_style = ar_style_new ();
 
-#ifdef HAVE_CLUTTER
-  priv->board = ar_clutter_embed_new (priv->board_style);
-
-  priv->baize_actor = aisleriot_baize_new ();
-
-  stage = CLUTTER_CONTAINER (gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (priv->board)));
-  clutter_container_add (stage, priv->baize_actor, NULL);
-  /* FIXMEchpe: how to ensure this is ALWAYS the lowest actor? */
-  clutter_actor_lower_bottom (priv->baize_actor);
-
-  priv->board_actor = aisleriot_board_new (priv->board_style, priv->game);
-  clutter_container_add (stage, priv->board_actor, NULL);
-
-  /* FIXMEchpe */
-  clutter_stage_set_key_focus (CLUTTER_STAGE (stage), priv->board_actor);
-
-  g_signal_connect_after (priv->board, "size-allocate",
-                          G_CALLBACK (embed_size_allocate_cb), window);
-
-  g_signal_connect (priv->board_actor, "request-cursor",
-                    G_CALLBACK (board_cursor_cb), priv->board);
-  g_signal_connect (priv->board_actor, "error-bell",
-                    G_CALLBACK (board_error_bell_cb), priv->board);
-
-  /* FIXMEchpe: unref baize & board_actor here? */
-#else
   priv->board = AISLERIOT_BOARD (aisleriot_board_new (priv->board_style, priv->game));
-#endif /* HAVE_CLUTTER */
 
   theme_name = ar_conf_get_string (NULL, aisleriot_conf_get_key (CONF_THEME), NULL);
   theme = ar_card_themes_get_theme_by_name (priv->theme_manager, theme_name);
@@ -2115,13 +2002,8 @@ aisleriot_window_init (AisleriotWindow *window)
 
   priv->game_message_id = gtk_statusbar_get_context_id (priv->statusbar, "board-message");
 
-#ifdef HAVE_CLUTTER
-  g_signal_connect (priv->board_actor, "status-message",
-                    G_CALLBACK (board_status_message_cb), window);
-#else
   g_signal_connect (priv->board, "status-message",
                     G_CALLBACK (board_status_message_cb), window);
-#endif
 
   gtk_window_set_has_resize_grip (GTK_WINDOW (window), TRUE);
 
@@ -2218,19 +2100,12 @@ aisleriot_window_init (AisleriotWindow *window)
 
   set_fullscreen_actions (window, FALSE);
 
-#ifdef HAVE_CLUTTER
-  action = gtk_action_group_get_action (priv->action_group, "Animations");
-  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
-                                ar_conf_get_boolean (NULL, aisleriot_conf_get_key (CONF_ANIMATIONS), NULL));
-
-#endif /* HAVE_CLUTTER */
-
-#if defined(HAVE_CLUTTER) || defined(ENABLE_SOUND)
+#if defined(ENABLE_SOUND)
   /* Set the action visibility and listen for animation and sound mode changes */
   screen_changed_cb (GTK_WIDGET (window), NULL, window);
   g_signal_connect (window, "screen-changed",
                     G_CALLBACK (screen_changed_cb), window);
-#endif /* HAVE_CLUTTER || ENABLE_SOUND */
+#endif /* ENABLE_SOUND */
 
   /* Now set up the widgets */
   main_vbox = gtk_vbox_new (FALSE, 0);
@@ -2286,12 +2161,12 @@ aisleriot_window_dispose (GObject *object)
 {
   AisleriotWindow *window = AISLERIOT_WINDOW (object);
   AisleriotWindowPrivate *priv = window->priv;
-  
-#ifdef HAVE_CLUTTER
+
+#ifdef ENABLE_SOUND
   g_signal_handlers_disconnect_by_func (gtk_widget_get_settings (GTK_WIDGET (window)),
                                         G_CALLBACK (settings_changed_cb),
                                         window);
-#endif /* HAVE_CLUTTER */
+#endif /* ENABLE_SOUND */
 
   if (priv->hint_dialog) {
     gtk_widget_destroy (priv->hint_dialog);
@@ -2331,10 +2206,6 @@ aisleriot_window_finalize (GObject *object)
   AisleriotWindow *window = AISLERIOT_WINDOW (object);
   AisleriotWindowPrivate *priv = window->priv;
 
-#ifdef HAVE_CLUTTER
-  g_object_unref (priv->board_style);
-#endif /* HAVE_CLUTTER */
-
   if (priv->theme) {
     g_object_unref (priv->theme);
   }


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