gnome-games r8178 - trunk/aisleriot



Author: chpe
Date: Tue Oct 21 21:50:20 2008
New Revision: 8178
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8178&view=rev

Log:
Make clutter in aisleriot optional.

Modified:
   trunk/aisleriot/Makefile.am
   trunk/aisleriot/game.c
   trunk/aisleriot/game.h
   trunk/aisleriot/sol.c

Modified: trunk/aisleriot/Makefile.am
==============================================================================
--- trunk/aisleriot/Makefile.am	(original)
+++ trunk/aisleriot/Makefile.am	Tue Oct 21 21:50:20 2008
@@ -17,20 +17,11 @@
 bin_PROGRAMS = sol
 
 sol_SOURCES = \
-	baize.c		\
-	baize.h		\
-	board.c		\
 	board.h		\
-	card.c          \
-	card.h          \
-	card-cache.c    \
-	card-cache.h    \
 	conf.c		\
 	conf.h		\
 	game.c		\
 	game.h		\
-	slot-renderer.c \
-	slot-renderer.h \
 	sol.c		\
 	stats-dialog.c	\
 	stats-dialog.h	\
@@ -40,6 +31,24 @@
 	window.h	\
 	$(NULL)
 
+if HAVE_CLUTTER
+sol_SOURCES += \
+	board.c		\
+	baize.c		\
+	baize.h		\
+	card.c          \
+	card.h          \
+	card-cache.c    \
+	card-cache.h    \
+	slot-renderer.c \
+	slot-renderer.h \
+	$(NULL)
+else
+sol_SOURCES += \
+	board-noclutter.c \
+	$(NULL)
+endif
+
 if !HAVE_GUILE_1_8
 sol_SOURCES += guile16-compat.h
 endif
@@ -59,8 +68,6 @@
 
 sol_CFLAGS = \
 	$(GTK_CFLAGS)	      \
-	$(CLUTTER_CFLAGS)     \
-	$(CLUTTER_GTK_CFLAGS) \
 	$(GUILE_CFLAGS)	      \
 	$(AM_CFLAGS)
 
@@ -70,8 +77,6 @@
 sol_LDADD = \
 	$(top_builddir)/libgames-support/libgames-support.la	\
 	$(GTK_LIBS)	    \
-	$(CLUTTER_LIBS)     \
-	$(CLUTTER_GTK_LIBS) \
 	$(GUILE_LIBS)
 
 if HAVE_HILDON
@@ -95,6 +100,11 @@
 sol_LDADD += $(GTHREAD_LIBS)
 endif
 
+if HAVE_CLUTTER
+sol_CFLAGS += $(CLUTTER_CFLAGS)
+sol_LDADD += $(CLUTTER_LIBS)
+endif
+
 desktop_in_files = \
 	sol.desktop.in.in
 

Modified: trunk/aisleriot/game.c
==============================================================================
--- trunk/aisleriot/game.c	(original)
+++ trunk/aisleriot/game.c	Tue Oct 21 21:50:20 2008
@@ -33,11 +33,14 @@
 #include <glib.h>
 #include <glib/gi18n.h>
 
+#ifdef HAVE_CLUTTER
+#include <clutter/clutter-actor.h>
+#endif
+
 #include "conf.h"
 #include "util.h"
 
 #include <libgames-support/games-runtime.h>
-#include <clutter/clutter-actor.h>
 
 #include "game.h"
 
@@ -238,13 +241,17 @@
   for (i = 0; i < n_slots; ++i) {
     Slot *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->cards, TRUE);
     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 (Slot, slot);
   }
@@ -579,7 +586,6 @@
   slot->id = scm_to_int (SCM_CAR (slot_data));
 
   slot->cards = g_byte_array_sized_new (SLOT_CARDS_N_PREALLOC);
-  slot->old_cards = g_byte_array_sized_new (SLOT_CARDS_N_PREALLOC);
   slot->exposed = 0;
   slot->x = scm_num2dbl (SCM_CAR (SCM_CADR (SCM_CADDR (slot_data))), NULL);
   slot->y = scm_num2dbl (SCM_CADR (SCM_CADR (SCM_CADDR (slot_data))), NULL);
@@ -590,6 +596,12 @@
   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;
 
   /* this will update the slot length too */
@@ -2068,6 +2080,8 @@
   aisleriot_game_test_end_of_game (game);
 }
 
+#ifdef HAVE_CLUTTER
+
 void
 aisleriot_game_get_card_offset (Slot *slot,
                                 guint card_num,
@@ -2101,3 +2115,5 @@
   g_byte_array_append (slot->old_cards, slot->cards->data, slot->cards->len);
   slot->old_exposed = slot->exposed;
 }
+
+#endif /* HAVE_CLUTTER */

Modified: trunk/aisleriot/game.h
==============================================================================
--- trunk/aisleriot/game.h	(original)
+++ trunk/aisleriot/game.h	Tue Oct 21 21:50:20 2008
@@ -24,7 +24,10 @@
 #include <gdk/gdktypes.h>
 
 #include <libgames-support/games-card.h>
+
+#ifdef HAVE_CLUTTER
 #include <clutter/clutter-actor.h>
+#endif
 
 G_BEGIN_DECLS
 
@@ -34,9 +37,11 @@
   int id;
 
   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;
@@ -58,8 +63,13 @@
   /* 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;

Modified: trunk/aisleriot/sol.c
==============================================================================
--- trunk/aisleriot/sol.c	(original)
+++ trunk/aisleriot/sol.c	Tue Oct 21 21:50:20 2008
@@ -33,7 +33,10 @@
 #include <gtk/gtkicontheme.h>
 #include <gtk/gtkmain.h>
 #include <gtk/gtkmessagedialog.h>
+
+#ifdef HAVE_CLUTTER
 #include <clutter-gtk/gtk-clutter-embed.h>
+#endif
 
 #ifdef HAVE_HILDON
 #include <libosso.h>
@@ -538,7 +541,10 @@
   games_sound_enable (FALSE);
   games_sound_add_option_group (option_context);
 
+#ifdef HAVE_CLUTTER
+  /* FIXMEchpe: use option group instead */
   gtk_clutter_init (&argc, &argv);
+#endif
 
   g_option_context_add_group (option_context, gtk_get_option_group (TRUE));
 #ifdef WITH_SMCLIENT



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