[gnome-games] aisleriot: Move card theme support from libgames-support to aisleriot
- From: Christian Persch <chpe src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-games] aisleriot: Move card theme support from libgames-support to aisleriot
- Date: Tue, 9 Feb 2010 19:31:32 +0000 (UTC)
commit 0dea6d77e3e05f4055eb4dea1952d344187671bf
Author: Christian Persch <chpe gnome org>
Date: Tue Feb 9 20:30:05 2010 +0100
aisleriot: Move card theme support from libgames-support to aisleriot
Move libgames-support/games-card*.[ch] to aisleriot/lib, and rename to
ar-card-*.[ch], and adapt code accordingly.
Move the the SVG files to aisleriot/data.
aisleriot/Makefile.am | 6 +-
aisleriot/ar-style-private.h | 2 +-
aisleriot/ar-style.c | 10 +-
aisleriot/ar-style.h | 6 +-
aisleriot/board-noclutter.c | 54 ++--
aisleriot/board-noclutter.h | 2 -
aisleriot/board.c | 20 +-
aisleriot/card.c | 18 +-
aisleriot/card.h | 4 +-
.../data}/gnomangelo_bitmap.svg | 0
{libgames-support => aisleriot/data}/slot.svg | 0
.../data}/theme-install.ini | 0
aisleriot/game.c | 2 +-
aisleriot/game.h | 2 +-
.../lib/ar-card-images.c | 300 ++++++++++----------
.../lib/ar-card-images.h | 74 +++---
.../lib/ar-card-private.h | 10 +-
.../lib/ar-card-textures-cache.c | 154 +++++-----
aisleriot/lib/ar-card-textures-cache.h | 74 +++++
.../lib/ar-card-theme-fixed.c | 102 ++++----
.../lib/ar-card-theme-kde.c | 132 +++++-----
.../lib/ar-card-theme-preimage.c | 90 +++---
aisleriot/lib/ar-card-theme-private.h | 261 +++++++++++++++++
.../lib/ar-card-theme-pysol.c | 94 +++---
.../lib/ar-card-theme-sliced.c | 104 ++++----
.../lib/ar-card-theme-svg.c | 68 +++---
.../lib/ar-card-theme.c | 184 ++++++------
aisleriot/lib/ar-card-theme.h | 100 +++++++
.../lib/ar-card-themes.c | 206 +++++++-------
aisleriot/lib/ar-card-themes.h | 68 +++++
.../games-card.c => aisleriot/lib/ar-card.c | 58 ++--
.../games-card.h => aisleriot/lib/ar-card.h | 70 +++---
.../lib/ar-pixbuf-utils.c | 10 +-
.../lib/ar-pixbuf-utils.h | 4 +-
{libgames-support => aisleriot/lib}/render-cards.c | 47 ++--
aisleriot/slot-renderer.c | 14 +-
aisleriot/slot-renderer.h | 4 +-
aisleriot/window.c | 64 ++--
configure.in | 12 +-
libgames-support/Makefile.am | 145 ----------
libgames-support/games-card-textures-cache.h | 74 -----
libgames-support/games-card-theme-private.h | 261 -----------------
libgames-support/games-card-theme.h | 100 -------
libgames-support/games-card-themes.h | 68 -----
libgames-support/games-files.c | 1 -
po/POTFILES.in | 2 +-
46 files changed, 1466 insertions(+), 1615 deletions(-)
---
diff --git a/aisleriot/Makefile.am b/aisleriot/Makefile.am
index 99c786a..ba1d8e5 100644
--- a/aisleriot/Makefile.am
+++ b/aisleriot/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = rules
+SUBDIRS = rules data lib
if BUILD_HELP
SUBDIRS += help
@@ -66,6 +66,8 @@ endif
sol_CPPFLAGS = \
-I$(top_srcdir) \
+ -I$(top_srcdir)/aisleriot/lib \
+ -Ilib \
-DDOC_MODULE=\"$(DOC_MODULE)\" \
$(AM_CPPFLAGS)
@@ -78,8 +80,8 @@ sol_LDFLAGS = \
$(AM_LDFLAGS)
sol_LDADD = \
+ lib/libaisleriot.la \
$(top_builddir)/libgames-support/libgames-support.la \
- $(top_builddir)/libgames-support/libgamescards.la \
$(GTK_LIBS) \
$(GUILE_LIBS)
diff --git a/aisleriot/ar-style-private.h b/aisleriot/ar-style-private.h
index 97fcbb1..b933c88 100644
--- a/aisleriot/ar-style-private.h
+++ b/aisleriot/ar-style-private.h
@@ -46,7 +46,7 @@ static const GdkColor default_selection_color = { 0, 0 /* red */, 0 /* green */,
struct _ArStylePrivate
{
- GamesCardTheme* card_theme;
+ ArCardTheme* card_theme;
#ifdef HAVE_CLUTTER
ClutterColor selection_color;
diff --git a/aisleriot/ar-style.c b/aisleriot/ar-style.c
index e5f5164..beaa488 100644
--- a/aisleriot/ar-style.c
+++ b/aisleriot/ar-style.c
@@ -368,7 +368,7 @@ ar_style_class_init (ArStyleClass *klass)
(object_class,
PROP_CARD_THEME,
g_param_spec_object (AR_STYLE_PROP_CARD_THEME, NULL, NULL,
- GAMES_TYPE_CARD_THEME,
+ AR_TYPE_CARD_THEME,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
@@ -649,9 +649,9 @@ ar_style_set_click_to_move (ArStyle *style,
* ar_style_get_card_theme:
* @style: an #ArStyle
*
- * Returns: @style's #GamesCardTheme
+ * Returns: @style's #ArCardTheme
*/
-GamesCardTheme *
+ArCardTheme *
ar_style_get_card_theme (ArStyle *style)
{
ArStylePrivate *priv = style->priv;
@@ -662,14 +662,14 @@ ar_style_get_card_theme (ArStyle *style)
/**
* ar_style_set_card_theme:
* @style: an #ArStyle
- * @card_theme: a #GamesCardTheme
+ * @card_theme: a #ArCardTheme
*
* Note that animations are only used when this the
* global gtk-enable-animations setting is enabled as well.
*/
void
ar_style_set_card_theme (ArStyle *style,
- GamesCardTheme *theme)
+ ArCardTheme *theme)
{
ArStylePrivate *priv = style->priv;
diff --git a/aisleriot/ar-style.h b/aisleriot/ar-style.h
index ae9e3c3..d054779 100644
--- a/aisleriot/ar-style.h
+++ b/aisleriot/ar-style.h
@@ -26,7 +26,7 @@
#include <gdk/gdk.h>
#endif
-#include <libgames-support/games-card-theme.h>
+#include "ar-card-theme.h"
G_BEGIN_DECLS
@@ -88,9 +88,9 @@ gboolean ar_style_get_click_to_move (ArStyle *style);
void ar_style_set_click_to_move (ArStyle *style,
gboolean enable);
-GamesCardTheme *ar_style_get_card_theme (ArStyle *style);
+ArCardTheme *ar_style_get_card_theme (ArStyle *style);
void ar_style_set_card_theme (ArStyle *style,
- GamesCardTheme *theme);
+ ArCardTheme *theme);
/* Read-only properties */
gboolean ar_style_get_touchscreen_mode (ArStyle *style);
diff --git a/aisleriot/board-noclutter.c b/aisleriot/board-noclutter.c
index af50210..206344f 100644
--- a/aisleriot/board-noclutter.c
+++ b/aisleriot/board-noclutter.c
@@ -21,26 +21,26 @@
#include <config.h>
+#include "board-noclutter.h"
+
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
-#include <libgames-support/games-card-images.h>
#include <libgames-support/games-files.h>
#include <libgames-support/games-glib-compat.h>
#include <libgames-support/games-gtk-compat.h>
#include <libgames-support/games-marshal.h>
-#include <libgames-support/games-pixbuf-utils.h>
#include <libgames-support/games-runtime.h>
#include <libgames-support/games-sound.h>
#include "conf.h"
#include "game.h"
-#include "ar-style-gtk.h"
+#include "ar-card-images.h"
#include "ar-cursor.h"
-
-#include "board-noclutter.h"
+#include "ar-pixbuf-utils.h"
+#include "ar-style-gtk.h"
#define AISLERIOT_BOARD_GET_PRIVATE(board)(G_TYPE_INSTANCE_GET_PRIVATE ((board), AISLERIOT_TYPE_BOARD, AisleriotBoardPrivate))
@@ -109,7 +109,7 @@ struct _AisleriotBoardPrivate
int xbaseoffset;
/* Cards cache */
- GamesCardImages *images;
+ ArCardImages *images;
/* ArSlot */
gpointer slot_image; /* either a GdkPixbuf or GdkPixmap, depending on drawing mode */
@@ -757,7 +757,7 @@ slot_update_card_images_full (AisleriotBoard *board,
int highlight_start_card_id)
{
AisleriotBoardPrivate *priv = board->priv;
- GamesCardImages *images = priv->images;
+ ArCardImages *images = priv->images;
GPtrArray *card_images;
guint n_cards, first_exposed_card_id, i;
guint8 *cards;
@@ -789,7 +789,7 @@ slot_update_card_images_full (AisleriotBoard *board,
is_highlighted = (i >= highlight_start_card_id);
g_ptr_array_add (card_images,
- games_card_images_get_card_pixbuf (images, card, is_highlighted));
+ ar_card_images_get_card_pixbuf (images, card, is_highlighted));
}
} else {
for (i = first_exposed_card_id; i < n_cards; ++i) {
@@ -799,7 +799,7 @@ slot_update_card_images_full (AisleriotBoard *board,
is_highlighted = (i >= highlight_start_card_id);
g_ptr_array_add (card_images,
- games_card_images_get_card_pixmap (images, card, is_highlighted));
+ ar_card_images_get_card_pixmap (images, card, is_highlighted));
}
}
}
@@ -854,12 +854,12 @@ aisleriot_board_setup_geometry (AisleriotBoard *board)
priv->xslotstep = ((double) priv->allocation.width) / priv->width;
priv->yslotstep = ((double) priv->allocation.height) / priv->height;
- size_changed = games_card_images_set_size (priv->images,
+ size_changed = ar_card_images_set_size (priv->images,
priv->xslotstep,
priv->yslotstep,
priv->card_slot_ratio);
- games_card_images_get_size (priv->images, &card_size);
+ ar_card_images_get_size (priv->images, &card_size);
priv->card_size = card_size;
/* If the cards are too far apart, bunch them in the middle. */
@@ -880,13 +880,13 @@ aisleriot_board_setup_geometry (AisleriotBoard *board)
priv->yoffset = (priv->yslotstep - card_size.height) / 2;
if (PIXBUF_DRAWING_LIKELIHOOD (priv->use_pixbuf_drawing)) {
- priv->slot_image = games_card_images_get_slot_pixbuf (priv->images, FALSE);
+ priv->slot_image = ar_card_images_get_slot_pixbuf (priv->images, FALSE);
} else {
- priv->slot_image = games_card_images_get_slot_pixmap (priv->images, FALSE);
+ priv->slot_image = ar_card_images_get_slot_pixmap (priv->images, FALSE);
}
- gdk_gc_set_clip_mask (priv->slot_gc, games_card_images_get_slot_mask (priv->images));
- gdk_gc_set_clip_mask (priv->draw_gc, games_card_images_get_card_mask (priv->images));
+ gdk_gc_set_clip_mask (priv->slot_gc, ar_card_images_get_slot_mask (priv->images));
+ gdk_gc_set_clip_mask (priv->draw_gc, ar_card_images_get_card_mask (priv->images));
/* NOTE! Updating the slots checks that geometry is set, so
* we set it to TRUE already.
@@ -1012,7 +1012,7 @@ drag_begin (AisleriotBoard *board)
0, 0, width, height);
gdk_gc_set_foreground (gc2, &unmasked);
- card_mask = games_card_images_get_card_mask (priv->images);
+ card_mask = ar_card_images_get_card_mask (priv->images);
gdk_gc_set_clip_mask (gc1, card_mask);
gdk_gc_set_clip_mask (gc2, card_mask);
@@ -1033,7 +1033,7 @@ drag_begin (AisleriotBoard *board)
if (PIXBUF_DRAWING_LIKELIHOOD (use_pixbuf_drawing)) {
GdkPixbuf *pixbuf;
- pixbuf = games_card_images_get_card_pixbuf (priv->images, hcard, FALSE);
+ pixbuf = ar_card_images_get_card_pixbuf (priv->images, hcard, FALSE);
if (!pixbuf)
goto next;
@@ -1046,7 +1046,7 @@ drag_begin (AisleriotBoard *board)
} else {
GdkPixmap *pixmap;
- pixmap = games_card_images_get_card_pixmap (priv->images, hcard, FALSE);
+ pixmap = ar_card_images_get_card_pixmap (priv->images, hcard, FALSE);
if (!pixmap)
goto next;
@@ -2366,7 +2366,7 @@ aisleriot_board_realize (GtkWidget *widget)
display = gtk_widget_get_display (widget);
- games_card_images_set_drawable (priv->images, window);
+ ar_card_images_set_drawable (priv->images, window);
priv->draw_gc = gdk_gc_new (window);
@@ -2411,7 +2411,7 @@ aisleriot_board_unrealize (GtkWidget *widget)
}
#endif /* !HAVE_HILDON*/
- games_card_images_set_drawable (priv->images, NULL);
+ ar_card_images_set_drawable (priv->images, NULL);
clear_state (board);
@@ -2441,14 +2441,14 @@ aisleriot_board_sync_style (ArStyle *style,
}
if (pspec_name == NULL || pspec_name == I_(AR_STYLE_PROP_CARD_THEME)) {
- GamesCardTheme *theme;
+ ArCardTheme *theme;
theme = ar_style_get_card_theme (style);
if (theme != NULL) {
priv->geometry_set = FALSE;
priv->slot_image = NULL;
- games_card_images_set_theme (priv->images, theme);
+ ar_card_images_set_theme (priv->images, theme);
update_geometry |= TRUE;
queue_redraw |= TRUE;
@@ -2519,7 +2519,7 @@ aisleriot_board_sync_style (ArStyle *style,
GdkColor selection_color;
ar_style_get_selection_color (priv->style, &selection_color);
- games_card_images_set_selection_color (priv->images, &selection_color);
+ ar_card_images_set_selection_color (priv->images, &selection_color);
/* FIXMEchpe: update the cached images in the selection slot!! */
redraw_selection = TRUE;
@@ -2534,7 +2534,7 @@ aisleriot_board_sync_style (ArStyle *style,
priv->use_pixbuf_drawing = pixbuf_drawing;
- games_card_images_set_cache_mode (priv->images,
+ ar_card_images_set_cache_mode (priv->images,
pixbuf_drawing ? CACHE_PIXBUFS : CACHE_PIXMAPS);
update_geometry |= TRUE;
@@ -3161,7 +3161,7 @@ aisleriot_board_expose_event (GtkWidget *widget,
if (G_LIKELY (hslot != highlight_slot)) {
pixbuf = priv->slot_image;
} else {
- pixbuf = games_card_images_get_slot_pixbuf (priv->images,
+ pixbuf = ar_card_images_get_slot_pixbuf (priv->images,
priv->show_highlight);
}
@@ -3177,7 +3177,7 @@ aisleriot_board_expose_event (GtkWidget *widget,
if (G_LIKELY (hslot != highlight_slot)) {
pixmap = priv->slot_image;
} else {
- pixmap = games_card_images_get_slot_pixmap (priv->images,
+ pixmap = ar_card_images_get_slot_pixmap (priv->images,
priv->show_highlight);
}
@@ -3351,7 +3351,7 @@ aisleriot_board_init (AisleriotBoard *board)
priv->moving_cards = g_byte_array_sized_new (SLOT_CARDS_N_PREALLOC);
- priv->images = games_card_images_new ();
+ priv->images = ar_card_images_new ();
gtk_widget_set_events (widget,
gtk_widget_get_events (widget) |
diff --git a/aisleriot/board-noclutter.h b/aisleriot/board-noclutter.h
index bda4a56..f6a52f2 100644
--- a/aisleriot/board-noclutter.h
+++ b/aisleriot/board-noclutter.h
@@ -21,8 +21,6 @@
#include <gtk/gtk.h>
-#include <libgames-support/games-card-theme.h>
-
#include "game.h"
#include "ar-style.h"
diff --git a/aisleriot/board.c b/aisleriot/board.c
index 8a87e66..79a8648 100644
--- a/aisleriot/board.c
+++ b/aisleriot/board.c
@@ -21,6 +21,8 @@
#include <config.h>
+#include "board.h"
+
#include <string.h>
#include <gtk/gtk.h>
@@ -28,20 +30,18 @@
#include <clutter/clutter.h>
-#include <libgames-support/games-card-textures-cache.h>
#include <libgames-support/games-debug.h>
#include <libgames-support/games-files.h>
#include <libgames-support/games-glib-compat.h>
#include <libgames-support/games-marshal.h>
-#include <libgames-support/games-pixbuf-utils.h>
#include <libgames-support/games-sound.h>
#include "conf.h"
#include "game.h"
-#include "board.h"
#include "card.h"
#include "slot-renderer.h"
+#include "ar-card-textures-cache.h"
#include "ar-cursor.h"
#define AISLERIOT_BOARD_GET_PRIVATE(board)(G_TYPE_INSTANCE_GET_PRIVATE ((board), AISLERIOT_TYPE_BOARD, AisleriotBoardPrivate))
@@ -116,7 +116,7 @@ struct _AisleriotBoardPrivate
CardSize card_size;
/* Cards cache */
- GamesCardTexturesCache *textures;
+ ArCardTexturesCache *textures;
double width;
double height;
@@ -973,7 +973,7 @@ aisleriot_board_setup_geometry (AisleriotBoard *board)
{
AisleriotBoardPrivate *priv = board->priv;
ClutterActor *actor = CLUTTER_ACTOR (board);
- GamesCardTheme *theme;
+ ArCardTheme *theme;
GPtrArray *slots;
guint i, n_slots;
CardSize card_size;
@@ -995,12 +995,12 @@ aisleriot_board_setup_geometry (AisleriotBoard *board)
priv->xslotstep = ((double) priv->allocation.x2 - priv->allocation.x1) / priv->width;
priv->yslotstep = ((double) priv->allocation.y2 - priv->allocation.y1) / priv->height;
- games_card_theme_set_size (theme,
+ ar_card_theme_set_size (theme,
priv->xslotstep,
priv->yslotstep,
priv->card_slot_ratio);
- games_card_theme_get_size (theme, &card_size);
+ ar_card_theme_get_size (theme, &card_size);
priv->card_size = card_size;
/* If the cards are too far apart, bunch them in the middle. */
@@ -2157,11 +2157,11 @@ aisleriot_board_sync_style (ArStyle *style,
}
if (pspec_name == NULL || pspec_name == I_(AR_STYLE_PROP_CARD_THEME)) {
- GamesCardTheme *theme;
+ ArCardTheme *theme;
theme = ar_style_get_card_theme (style);
if (theme != NULL) {
- games_card_textures_cache_set_theme (priv->textures, theme);
+ ar_card_textures_cache_set_theme (priv->textures, theme);
priv->geometry_set = FALSE;
@@ -3107,7 +3107,7 @@ aisleriot_board_init (AisleriotBoard *board)
priv = board->priv = AISLERIOT_BOARD_GET_PRIVATE (board);
- priv->textures = games_card_textures_cache_new ();
+ priv->textures = ar_card_textures_cache_new ();
memset (&priv->allocation, 0, sizeof (ClutterActorBox));
diff --git a/aisleriot/card.c b/aisleriot/card.c
index 393c4e4..4409b45 100644
--- a/aisleriot/card.c
+++ b/aisleriot/card.c
@@ -51,7 +51,7 @@ static void aisleriot_card_get_property (GObject *self,
static void aisleriot_card_unref_cache (AisleriotCard *card);
static void aisleriot_card_set_cache (AisleriotCard *card,
- GamesCardTexturesCache *cache);
+ ArCardTexturesCache *cache);
#define ANGLE_IS_UPSIDE_DOWN(angle) \
((ABS (angle) + CLUTTER_INT_TO_FIXED (90)) \
@@ -68,7 +68,7 @@ struct _AisleriotCardPrivate
{
Card bottom_card, top_card;
- GamesCardTexturesCache *cache;
+ ArCardTexturesCache *cache;
};
enum
@@ -108,7 +108,7 @@ aisleriot_card_class_init (AisleriotCardClass *klass)
g_object_class_install_property (gobject_class, PROP_TOP_CARD, pspec);
pspec = g_param_spec_object ("cache", NULL, NULL,
- GAMES_TYPE_CARD_TEXTURES_CACHE,
+ AR_TYPE_CARD_TEXTURES_CACHE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
@@ -136,7 +136,7 @@ aisleriot_card_dispose (GObject *self)
}
ClutterActor *
-aisleriot_card_new (GamesCardTexturesCache *cache,
+aisleriot_card_new (ArCardTexturesCache *cache,
Card bottom_card,
Card top_card)
{
@@ -158,7 +158,7 @@ aisleriot_card_get_preferred_width (ClutterActor *self,
CoglHandle tex;
guint width;
- tex = games_card_textures_cache_get_card_texture (priv->cache,
+ tex = ar_card_textures_cache_get_card_texture (priv->cache,
priv->top_card);
if (G_UNLIKELY (tex == COGL_INVALID_HANDLE))
@@ -184,7 +184,7 @@ aisleriot_card_get_preferred_height (ClutterActor *self,
CoglHandle tex;
guint height;
- tex = games_card_textures_cache_get_card_texture (priv->cache,
+ tex = ar_card_textures_cache_get_card_texture (priv->cache,
priv->top_card);
if (G_UNLIKELY (tex == COGL_INVALID_HANDLE))
@@ -210,9 +210,9 @@ aisleriot_card_paint (ClutterActor *actor)
cogl_set_backface_culling_enabled (TRUE);
- top_tex = games_card_textures_cache_get_card_texture (priv->cache,
+ top_tex = ar_card_textures_cache_get_card_texture (priv->cache,
priv->top_card);
- bottom_tex = games_card_textures_cache_get_card_texture (priv->cache,
+ bottom_tex = ar_card_textures_cache_get_card_texture (priv->cache,
priv->bottom_card);
if (G_UNLIKELY (top_tex == COGL_INVALID_HANDLE
|| bottom_tex == COGL_INVALID_HANDLE))
@@ -347,7 +347,7 @@ aisleriot_card_unref_cache (AisleriotCard *card)
}
static void
-aisleriot_card_set_cache (AisleriotCard *card, GamesCardTexturesCache *cache)
+aisleriot_card_set_cache (AisleriotCard *card, ArCardTexturesCache *cache)
{
AisleriotCardPrivate *priv = card->priv;
diff --git a/aisleriot/card.h b/aisleriot/card.h
index 3ec9f70..b66775a 100644
--- a/aisleriot/card.h
+++ b/aisleriot/card.h
@@ -19,7 +19,7 @@
#define AISLERIOT_CARD_H
#include <clutter/clutter.h>
-#include <libgames-support/games-card-textures-cache.h>
+#include "ar-card-textures-cache.h"
G_BEGIN_DECLS
@@ -62,7 +62,7 @@ struct _AisleriotCard
GType aisleriot_card_get_type (void) G_GNUC_CONST;
-ClutterActor *aisleriot_card_new (GamesCardTexturesCache *cache,
+ClutterActor *aisleriot_card_new (ArCardTexturesCache *cache,
Card bottom_card,
Card top_card);
diff --git a/libgames-support/gnomangelo_bitmap.svg b/aisleriot/data/gnomangelo_bitmap.svg
similarity index 100%
rename from libgames-support/gnomangelo_bitmap.svg
rename to aisleriot/data/gnomangelo_bitmap.svg
diff --git a/libgames-support/slot.svg b/aisleriot/data/slot.svg
similarity index 100%
rename from libgames-support/slot.svg
rename to aisleriot/data/slot.svg
diff --git a/libgames-support/theme-install.ini b/aisleriot/data/theme-install.ini
similarity index 100%
rename from libgames-support/theme-install.ini
rename to aisleriot/data/theme-install.ini
diff --git a/aisleriot/game.c b/aisleriot/game.c
index c19203d..e42c88c 100644
--- a/aisleriot/game.c
+++ b/aisleriot/game.c
@@ -1455,7 +1455,7 @@ ar_slot_get_hint_string (ArSlot *slot,
if (cardid < 0)
return g_strdup (ar_slot_get_type_string (slot));
- card_name = games_card_get_locale_name (CARD (slot->cards->data[cardid]));
+ card_name = ar_card_get_locale_name (CARD (slot->cards->data[cardid]));
switch (slot->type) {
case AR_SLOT_FOUNDATION:
diff --git a/aisleriot/game.h b/aisleriot/game.h
index 87c1a18..6d4a0a1 100644
--- a/aisleriot/game.h
+++ b/aisleriot/game.h
@@ -20,7 +20,7 @@
#include <gdk/gdk.h>
-#include <libgames-support/games-card.h>
+#include "ar-card.h"
#ifdef HAVE_CLUTTER
#include <clutter/clutter.h>
diff --git a/libgames-support/games-card-images.c b/aisleriot/lib/ar-card-images.c
similarity index 69%
rename from libgames-support/games-card-images.c
rename to aisleriot/lib/ar-card-images.c
index faa2bf3..cc4ea83 100644
--- a/libgames-support/games-card-images.c
+++ b/aisleriot/lib/ar-card-images.c
@@ -26,21 +26,22 @@
#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "games-card-images.h"
+#include <libgames-support/games-debug.h>
-#include "games-pixbuf-utils.h"
-#include "games-card.h"
-#include "games-card-private.h"
-#include "games-debug.h"
+#include "ar-card-images.h"
-struct _GamesCardImagesClass {
+#include "ar-pixbuf-utils.h"
+#include "ar-card.h"
+#include "ar-card-private.h"
+
+struct _ArCardImagesClass {
GObjectClass parent_class;
};
-struct _GamesCardImages {
+struct _ArCardImages {
GObject parent;
- GamesCardTheme *theme;
+ ArCardTheme *theme;
GdkDrawable *drawable;
GdkBitmap *card_mask;
GdkBitmap *slot_mask;
@@ -61,7 +62,7 @@ enum {
PROP_THEME
};
-/* MARK_IS_TRANSFORMED must be the same value as GAMES_CARD_IMAGES_HIGHLIGHTED ! */
+/* MARK_IS_TRANSFORMED must be the same value as AR_CARD_IMAGES_HIGHLIGHTED ! */
enum {
MARK_IS_PIXMAP = 1U << 0,
MARK_IS_TRANSFORMED = 1U << 1,
@@ -78,7 +79,7 @@ enum {
#define IS_FAILED_POINTER(ptr) (G_UNLIKELY ((ptr) == FAILED_POINTER))
-#define CACHE_SIZE (2 * GAMES_CARDS_TOTAL)
+#define CACHE_SIZE (2 * AR_CARDS_TOTAL)
/* Threshold for rendering the pixbuf to card and alpha mask */
#define CARD_ALPHA_THRESHOLD (127)
@@ -96,12 +97,12 @@ enum {
#endif /* GNOME_ENABLE_DEBUG */
static void
-games_card_images_clear_cache (GamesCardImages * images)
+ar_card_images_clear_cache (ArCardImages * images)
{
guint i;
_games_debug_print (GAMES_DEBUG_CARD_CACHE,
- "games_card_images_clear_cache\n");
+ "ar_card_images_clear_cache\n");
for (i = 0; i < CACHE_SIZE; i++) {
gpointer data = UNMARK_POINTER (images->cache[i]);
@@ -124,10 +125,10 @@ games_card_images_clear_cache (GamesCardImages * images)
}
static void
-games_card_images_theme_changed_cb (GamesCardTheme * theme,
- GamesCardImages * images)
+ar_card_images_theme_changed_cb (ArCardTheme * theme,
+ ArCardImages * images)
{
- games_card_images_clear_cache (images);
+ ar_card_images_clear_cache (images);
}
/* Consider the cache as a 2-dimensional array: [0..TOTAL-1 , 0..1]:
@@ -140,34 +141,33 @@ games_card_images_theme_changed_cb (GamesCardTheme * theme,
* image), we transform it, and store the result in cache[i][j].
*/
static GdkPixbuf *
-create_pixbuf (GamesCardImages * images, guint card_id)
+create_pixbuf (ArCardImages * images, guint card_id)
{
GdkPixbuf *pixbuf;
g_assert (images->cache[card_id] == NULL &&
- images->cache[card_id + GAMES_CARDS_TOTAL] == NULL);
+ images->cache[card_id + AR_CARDS_TOTAL] == NULL);
- pixbuf = games_card_theme_get_card_pixbuf (images->theme, card_id);
+ pixbuf = ar_card_theme_get_card_pixbuf (images->theme, card_id);
if (!pixbuf)
return NULL;
images->cache[card_id] = pixbuf;
- images->cache[card_id + GAMES_CARDS_TOTAL] = g_object_ref (pixbuf);
+ images->cache[card_id + AR_CARDS_TOTAL] = g_object_ref (pixbuf);
return pixbuf;
}
static GdkPixbuf *
-transform_pixbuf (GamesCardImages * images, GdkPixbuf * pixbuf, guint idx)
+transform_pixbuf (ArCardImages * images, GdkPixbuf * pixbuf, guint idx)
{
GdkPixbuf *transformed_pixbuf;
g_assert (pixbuf != NULL);
g_assert (pixbuf == UNMARK_POINTER (images->cache[idx]));
- transformed_pixbuf = games_pixbuf_utils_create_highlight (pixbuf,
- &images->
- selection_colour);
+ transformed_pixbuf = ar_pixbuf_utils_create_highlight (pixbuf,
+ &images->selection_colour);
if (!transformed_pixbuf)
return NULL;
@@ -202,10 +202,10 @@ create_mask (GdkDrawable * drawable,
/* Class implementation */
-G_DEFINE_TYPE (GamesCardImages, games_card_images, G_TYPE_OBJECT);
+G_DEFINE_TYPE (ArCardImages, ar_card_images, G_TYPE_OBJECT);
static void
-games_card_images_init (GamesCardImages * images)
+ar_card_images_init (ArCardImages * images)
{
const GdkColor background_colour =
{ 0, 0 /* red */ , 0 /* green */ , 0 /* blue */ };
@@ -221,16 +221,16 @@ games_card_images_init (GamesCardImages * images)
}
static void
-games_card_images_finalize (GObject * object)
+ar_card_images_finalize (GObject * object)
{
- GamesCardImages *images = GAMES_CARD_IMAGES (object);
+ ArCardImages *images = AR_CARD_IMAGES (object);
- games_card_images_clear_cache (images);
+ ar_card_images_clear_cache (images);
g_free (images->cache);
if (images->theme) {
g_signal_handlers_disconnect_by_func (images->theme,
- G_CALLBACK (games_card_images_theme_changed_cb),
+ G_CALLBACK (ar_card_images_theme_changed_cb),
images);
g_object_unref (images->theme);
}
@@ -238,26 +238,26 @@ games_card_images_finalize (GObject * object)
#ifdef GNOME_ENABLE_DEBUG
_GAMES_DEBUG_IF (GAMES_DEBUG_CARD_CACHE) {
_games_debug_print (GAMES_DEBUG_CARD_CACHE,
- "GamesCardImages %p statistics: %u calls with %u hits and %u misses for a hit/total of %.3f\n",
+ "ArCardImages %p statistics: %u calls with %u hits and %u misses for a hit/total of %.3f\n",
images, images->n_calls, images->cache_hits, images->n_calls - images->cache_hits,
images->n_calls > 0 ? (double) images->cache_hits / (double) images->n_calls : 0.0);
}
#endif
- G_OBJECT_CLASS (games_card_images_parent_class)->finalize (object);
+ G_OBJECT_CLASS (ar_card_images_parent_class)->finalize (object);
}
static void
-games_card_images_set_property (GObject *object,
+ar_card_images_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- GamesCardImages *images = GAMES_CARD_IMAGES (object);
+ ArCardImages *images = AR_CARD_IMAGES (object);
switch (prop_id) {
case PROP_THEME:
- games_card_images_set_theme (images, g_value_get_object (value));
+ ar_card_images_set_theme (images, g_value_get_object (value));
break;
default:
@@ -267,16 +267,16 @@ games_card_images_set_property (GObject *object,
}
static void
-games_card_images_get_property (GObject *object,
+ar_card_images_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec * pspec)
{
- GamesCardImages *images = GAMES_CARD_IMAGES (object);
+ ArCardImages *images = AR_CARD_IMAGES (object);
switch (prop_id) {
case PROP_THEME:
- g_value_set_object (value, games_card_images_get_theme (images));
+ g_value_set_object (value, ar_card_images_get_theme (images));
break;
default:
@@ -286,19 +286,19 @@ games_card_images_get_property (GObject *object,
}
static void
-games_card_images_class_init (GamesCardImagesClass * class)
+ar_card_images_class_init (ArCardImagesClass * class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- gobject_class->get_property = games_card_images_get_property;
- gobject_class->set_property = games_card_images_set_property;
- gobject_class->finalize = games_card_images_finalize;
+ gobject_class->get_property = ar_card_images_get_property;
+ gobject_class->set_property = ar_card_images_set_property;
+ gobject_class->finalize = ar_card_images_finalize;
g_object_class_install_property
(gobject_class,
PROP_THEME,
g_param_spec_object ("theme", NULL, NULL,
- GAMES_TYPE_CARD_THEME,
+ AR_TYPE_CARD_THEME,
G_PARAM_READWRITE |
G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK |
@@ -308,38 +308,38 @@ games_card_images_class_init (GamesCardImagesClass * class)
/* public API */
/**
- * games_card_images_new:
+ * ar_card_images_new:
*
- * Returns: a new #GamesCardImages
+ * Returns: a new #ArCardImages
*/
-GamesCardImages *
-games_card_images_new (void)
+ArCardImages *
+ar_card_images_new (void)
{
- return g_object_new (GAMES_TYPE_CARD_IMAGES, NULL);
+ return g_object_new (AR_TYPE_CARD_IMAGES, NULL);
}
/**
- * games_card_images_set_theme:
+ * ar_card_images_set_theme:
* @images:
- * @theme: a #GamesCardTheme
+ * @theme: a #ArCardTheme
*
* Sets @theme in @images.
*/
void
-games_card_images_set_theme (GamesCardImages *images,
- GamesCardTheme *theme)
+ar_card_images_set_theme (ArCardImages *images,
+ ArCardTheme *theme)
{
- g_return_if_fail (GAMES_IS_CARD_IMAGES (images));
- g_return_if_fail (GAMES_IS_CARD_THEME (theme));
+ g_return_if_fail (AR_IS_CARD_IMAGES (images));
+ g_return_if_fail (AR_IS_CARD_THEME (theme));
if (images->theme == theme)
return;
if (images->theme) {
g_signal_handlers_disconnect_by_func (images->theme,
- G_CALLBACK (games_card_images_theme_changed_cb),
+ G_CALLBACK (ar_card_images_theme_changed_cb),
images);
- games_card_images_clear_cache (images);
+ ar_card_images_clear_cache (images);
g_object_unref (images->theme);
}
@@ -347,42 +347,42 @@ games_card_images_set_theme (GamesCardImages *images,
if (theme) {
g_object_ref (images->theme);
g_signal_connect (images->theme, "changed",
- G_CALLBACK (games_card_images_theme_changed_cb), images);
+ G_CALLBACK (ar_card_images_theme_changed_cb), images);
}
g_object_notify (G_OBJECT (images), "theme");
}
/**
- * games_card_images_get_theme:
+ * ar_card_images_get_theme:
* @images:
*
- * Returns the #GamesCardTheme currently in use in @images.
+ * Returns the #ArCardTheme currently in use in @images.
*/
-GamesCardTheme *
-games_card_images_get_theme (GamesCardImages *images)
+ArCardTheme *
+ar_card_images_get_theme (ArCardImages *images)
{
- g_return_val_if_fail (GAMES_IS_CARD_IMAGES (images), NULL);
+ g_return_val_if_fail (AR_IS_CARD_IMAGES (images), NULL);
return images->theme;
}
/**
- * games_card_images_set_cache_mode:
+ * ar_card_images_set_cache_mode:
* @images:
* @mode:
*
* Select whether @images stores #GdkPixbuf:s or #GdkPixmap:s.
- * It is an error to use games_card_images_get_*_pixbuf*() while
- * storing pixmaps, and to use games_card_images_get_*_pixmap*() while
+ * It is an error to use ar_card_images_get_*_pixbuf*() while
+ * storing pixmaps, and to use ar_card_images_get_*_pixmap*() while
* storing pixbufs.
* Changing the cache mode invalidates all stored images.
*/
void
-games_card_images_set_cache_mode (GamesCardImages * images,
- GamesCardImagesCacheMode mode)
+ar_card_images_set_cache_mode (ArCardImages * images,
+ ArCardImagesCacheMode mode)
{
- g_return_if_fail (GAMES_IS_CARD_IMAGES (images));
+ g_return_if_fail (AR_IS_CARD_IMAGES (images));
g_return_if_fail (mode < LAST_CACHE_MODE);
if (mode == images->cache_mode)
@@ -390,28 +390,28 @@ games_card_images_set_cache_mode (GamesCardImages * images,
/* If we were storing pixmaps, we need to clear them */
if (images->cache_mode == CACHE_PIXMAPS) {
- games_card_images_clear_cache (images);
+ ar_card_images_clear_cache (images);
}
images->cache_mode = mode;
}
/**
- * games_card_images_drop_cache:
- * @images: a #GamesCardImages
+ * ar_card_images_drop_cache:
+ * @images: a #ArCardImages
*
* Clears the image cache.
*/
void
-games_card_images_drop_cache (GamesCardImages *images)
+ar_card_images_drop_cache (ArCardImages *images)
{
- g_return_if_fail (GAMES_IS_CARD_IMAGES (images));
+ g_return_if_fail (AR_IS_CARD_IMAGES (images));
- games_card_images_clear_cache (images);
+ ar_card_images_clear_cache (images);
}
/**
- * games_card_images_set_drawable:
+ * ar_card_images_set_drawable:
* @images:
* @drawable: a #GdkDrawable
*
@@ -422,22 +422,22 @@ games_card_images_drop_cache (GamesCardImages *images)
* Changing the drawable invalidates all cached pixmaps and masks.
*/
void
-games_card_images_set_drawable (GamesCardImages * images,
+ar_card_images_set_drawable (ArCardImages * images,
GdkWindow * drawable)
{
- g_return_if_fail (GAMES_IS_CARD_IMAGES (images));
+ g_return_if_fail (AR_IS_CARD_IMAGES (images));
g_return_if_fail (drawable == NULL || GDK_IS_DRAWABLE (drawable));
if (drawable == images->drawable)
return;
- games_card_images_clear_cache (images);
+ ar_card_images_clear_cache (images);
images->drawable = drawable;
}
/**
- * games_card_images_set_size:
+ * ar_card_images_set_size:
* @images:
* @width: the maximum width
* @height: the maximum height
@@ -446,7 +446,7 @@ games_card_images_set_drawable (GamesCardImages * images,
* Calculates the card size to use. The passed-in dimensions are not used
* directly; instead the width and height used are calculated using the
* card theme's aspect ratio and, if using a prerendered card theme, from the
- * available sizes. You can use games_card_images_get_size() to get
+ * available sizes. You can use ar_card_images_get_size() to get
* the real card size afterwards.
* If the card size was changed, all cached pixbufs and pixmaps will
* have been invalidated.
@@ -454,28 +454,28 @@ games_card_images_set_drawable (GamesCardImages * images,
* Returns: %TRUE iff the card size was changed
*/
gboolean
-games_card_images_set_size (GamesCardImages * images,
+ar_card_images_set_size (ArCardImages * images,
gint width, gint height, gdouble proportion)
{
- return games_card_theme_set_size (images->theme,
+ return ar_card_theme_set_size (images->theme,
width, height, proportion);
}
/**
- * games_card_images_get_size:
+ * ar_card_images_get_size:
* @images:
*
* Returns: the currently selected card size
*/
void
-games_card_images_get_size (GamesCardImages *images,
+ar_card_images_get_size (ArCardImages *images,
CardSize *size)
{
- games_card_theme_get_size (images->theme, size);
+ ar_card_theme_get_size (images->theme, size);
}
/**
- * games_card_images_set_background_color:
+ * ar_card_images_set_background_color:
* @images:
* @colour:
*
@@ -483,10 +483,10 @@ games_card_images_get_size (GamesCardImages *images,
* Changing the selection colour invalidates all cached pixmaps.
*/
void
-games_card_images_set_background_color (GamesCardImages * images,
+ar_card_images_set_background_color (ArCardImages * images,
const GdkColor * color)
{
- g_return_if_fail (GAMES_IS_CARD_IMAGES (images));
+ g_return_if_fail (AR_IS_CARD_IMAGES (images));
g_return_if_fail (color != NULL);
if (gdk_color_equal (&images->background_colour, color))
@@ -495,12 +495,12 @@ games_card_images_set_background_color (GamesCardImages * images,
images->background_colour = *color;
if (images->cache_mode == CACHE_PIXMAPS) {
- games_card_images_clear_cache (images);
+ ar_card_images_clear_cache (images);
}
}
/**
- * games_card_images_set_selection_color:
+ * ar_card_images_set_selection_color:
* @images:
* @colour:
*
@@ -509,10 +509,10 @@ games_card_images_set_background_color (GamesCardImages * images,
* and pixmaps.
*/
void
-games_card_images_set_selection_color (GamesCardImages * images,
+ar_card_images_set_selection_color (ArCardImages * images,
const GdkColor * color)
{
- g_return_if_fail (GAMES_IS_CARD_IMAGES (images));
+ g_return_if_fail (AR_IS_CARD_IMAGES (images));
g_return_if_fail (color != NULL);
if (gdk_color_equal (&images->selection_colour, color))
@@ -520,11 +520,11 @@ games_card_images_set_selection_color (GamesCardImages * images,
images->selection_colour = *color;
- games_card_images_clear_cache (images);
+ ar_card_images_clear_cache (images);
}
/**
- * games_card_images_get_card_pixbuf_by_id:
+ * ar_card_images_get_card_pixbuf_by_id:
* @images:
* @card_id:
*
@@ -535,22 +535,22 @@ games_card_images_set_selection_color (GamesCardImages * images,
* Returns: a #GdkPixbuf owned by @images; you must not change or unref it
*/
GdkPixbuf *
-games_card_images_get_card_pixbuf_by_id (GamesCardImages * images,
+ar_card_images_get_card_pixbuf_by_id (ArCardImages * images,
guint card_id, gboolean highlighted)
{
gpointer data;
GdkPixbuf *pixbuf;
guint idx;
- g_return_val_if_fail (GAMES_IS_CARD_IMAGES (images), NULL);
- g_return_val_if_fail ((card_id < GAMES_CARDS_TOTAL), NULL);
+ g_return_val_if_fail (AR_IS_CARD_IMAGES (images), NULL);
+ g_return_val_if_fail ((card_id < AR_CARDS_TOTAL), NULL);
g_return_val_if_fail (images->cache_mode == CACHE_PIXBUFS, NULL);
LOG_CALL (images);
idx = card_id;
if (G_UNLIKELY (highlighted)) {
- idx += GAMES_CARDS_TOTAL;
+ idx += AR_CARDS_TOTAL;
}
data = images->cache[idx];
@@ -597,7 +597,7 @@ games_card_images_get_card_pixbuf_by_id (GamesCardImages * images,
}
/**
- * games_card_images_get_card_pixbuf:
+ * ar_card_images_get_card_pixbuf:
* @images:
* @card:
*
@@ -608,29 +608,29 @@ games_card_images_get_card_pixbuf_by_id (GamesCardImages * images,
* Returns: a #GdkPixbuf owned by @images; you must not change or unref it
*/
GdkPixbuf *
-games_card_images_get_card_pixbuf (GamesCardImages * images,
+ar_card_images_get_card_pixbuf (ArCardImages * images,
Card card, gboolean highlighted)
{
- return games_card_images_get_card_pixbuf_by_id (images,
- _games_card_to_index (card),
+ return ar_card_images_get_card_pixbuf_by_id (images,
+ _ar_card_to_index (card),
highlighted);
}
/**
- * games_card_images_get_card_pixmap_by_id:
+ * ar_card_images_get_card_pixmap_by_id:
* @images:
* @card_id:
*
* Returns a #GdkPixmap for @card_id using the currently loaded
* theme and the currently selected size.
* You must set a drawable on @images before using this function,
- * see games_card_images_set_drawable().
+ * see ar_card_images_set_drawable().
* Returns %NULL on failure.
*
* Returns: a #GdkPixmap owned by @images; you must not change or unref it
*/
GdkPixmap *
-games_card_images_get_card_pixmap_by_id (GamesCardImages * images,
+ar_card_images_get_card_pixmap_by_id (ArCardImages * images,
guint card_id, gboolean highlighted)
{
gpointer data, pixbuf_or_pixmap;
@@ -640,8 +640,8 @@ games_card_images_get_card_pixmap_by_id (GamesCardImages * images,
int width, height;
guint idx;
- g_return_val_if_fail (GAMES_IS_CARD_IMAGES (images), NULL);
- g_return_val_if_fail ((card_id < GAMES_CARDS_TOTAL), NULL);
+ g_return_val_if_fail (AR_IS_CARD_IMAGES (images), NULL);
+ g_return_val_if_fail ((card_id < AR_CARDS_TOTAL), NULL);
g_return_val_if_fail (images->cache_mode == CACHE_PIXMAPS, NULL);
g_return_val_if_fail (images->drawable != NULL, NULL);
@@ -649,7 +649,7 @@ games_card_images_get_card_pixmap_by_id (GamesCardImages * images,
idx = card_id;
if (G_UNLIKELY (highlighted)) {
- idx += GAMES_CARDS_TOTAL;
+ idx += AR_CARDS_TOTAL;
}
data = images->cache[idx];
@@ -703,11 +703,11 @@ games_card_images_get_card_pixmap_by_id (GamesCardImages * images,
height = gdk_pixbuf_get_height (pixbuf);
/* If we don't have the mask yet, create it now */
- if (G_UNLIKELY (card_id == GAMES_CARD_BACK && images->card_mask == NULL)) {
+ if (G_UNLIKELY (card_id == AR_CARD_BACK && images->card_mask == NULL)) {
images->card_mask =
create_mask (images->drawable, pixbuf, CARD_ALPHA_THRESHOLD);
} else
- if (G_UNLIKELY (card_id == GAMES_CARD_SLOT && images->slot_mask == NULL))
+ if (G_UNLIKELY (card_id == AR_CARD_SLOT && images->slot_mask == NULL))
{
images->slot_mask =
create_mask (images->drawable, pixbuf, SLOT_ALPHA_THRESHOLD);
@@ -744,54 +744,54 @@ games_card_images_get_card_pixmap_by_id (GamesCardImages * images,
}
/**
- * games_card_pixmaps_get_card_pixmap_by_id:
+ * ar_card_pixmaps_get_card_pixmap_by_id:
* @images:
* @card_id:
*
* Returns a #GdkPixmap for @card using the currently loaded
* theme and the currently selected size.
* You must set a drawable on @images before using this function,
- * see games_card_images_set_drawable().
+ * see ar_card_images_set_drawable().
* Returns %NULL on failure.
*
* Returns: a #GdkPixmap owned by @images; you must not change or unref it
*/
GdkPixmap *
-games_card_images_get_card_pixmap (GamesCardImages * images,
+ar_card_images_get_card_pixmap (ArCardImages * images,
Card card, gboolean highlighted)
{
- return games_card_images_get_card_pixmap_by_id (images,
- _games_card_to_index (card),
+ return ar_card_images_get_card_pixmap_by_id (images,
+ _ar_card_to_index (card),
highlighted);
}
/**
- * games_card_images_get_card_mask:
+ * ar_card_images_get_card_mask:
* @images:
*
* Returns the card mask for the currently loaded theme at the currently
* selected size.
* You must set a drawable on @images before using this function,
- * see games_card_images_set_drawable().
+ * see ar_card_images_set_drawable().
* Returns %NULL on failure.
*
* Returns: a #GdkBitmap owned by @images; you must not change or unref it
*/
GdkBitmap *
-games_card_images_get_card_mask (GamesCardImages * images)
+ar_card_images_get_card_mask (ArCardImages * images)
{
- g_return_val_if_fail (GAMES_IS_CARD_IMAGES (images), NULL);
+ g_return_val_if_fail (AR_IS_CARD_IMAGES (images), NULL);
g_return_val_if_fail (images->drawable != NULL, NULL);
if (images->card_mask == NULL) {
if (images->cache_mode == CACHE_PIXMAPS) {
/* Always use the back of the cards to draw the mask */
- games_card_images_get_card_pixmap_by_id (images, GAMES_CARD_BACK,
+ ar_card_images_get_card_pixmap_by_id (images, AR_CARD_BACK,
FALSE);
} else {
images->card_mask = create_mask (images->drawable,
- games_card_images_get_card_pixbuf_by_id
- (images, GAMES_CARD_BACK, FALSE),
+ ar_card_images_get_card_pixbuf_by_id
+ (images, AR_CARD_BACK, FALSE),
CARD_ALPHA_THRESHOLD);
}
}
@@ -800,7 +800,7 @@ games_card_images_get_card_mask (GamesCardImages * images)
}
/**
- * games_card_images_get_slot_pixbuf:
+ * ar_card_images_get_slot_pixbuf:
* @images:
*
* Returns a #GdkPixbuf for card slot using the currently loaded
@@ -810,59 +810,59 @@ games_card_images_get_card_mask (GamesCardImages * images)
* Returns: a #GdkPixbuf owned by @images; you must not change or unref it
*/
GdkPixbuf *
-games_card_images_get_slot_pixbuf (GamesCardImages * images,
+ar_card_images_get_slot_pixbuf (ArCardImages * images,
gboolean highlighted)
{
- return games_card_images_get_card_pixbuf_by_id (images,
- GAMES_CARD_SLOT,
+ return ar_card_images_get_card_pixbuf_by_id (images,
+ AR_CARD_SLOT,
highlighted);
}
/**
- * games_card_images_get_slot_pixmap:
+ * ar_card_images_get_slot_pixmap:
* @images:
*
* Returns a #GdkPixbuf for card slot using the currently loaded
* theme at the currently selected size.
* You must set a drawable on @images before using this function,
- * see games_card_images_set_drawable().
+ * see ar_card_images_set_drawable().
* Returns %NULL on failure.
*
* Returns: a #GdkPixmap owned by @images; you must not change or unref it
*/
GdkPixmap *
-games_card_images_get_slot_pixmap (GamesCardImages * images,
+ar_card_images_get_slot_pixmap (ArCardImages * images,
gboolean highlighted)
{
- return games_card_images_get_card_pixmap_by_id (images,
- GAMES_CARD_SLOT,
+ return ar_card_images_get_card_pixmap_by_id (images,
+ AR_CARD_SLOT,
highlighted);
}
/**
- * games_card_images_get_slot_mask:
+ * ar_card_images_get_slot_mask:
* @images:
*
* Returns the slot mask for the currently loaded theme at the currently
* selected size.
* You must set a drawable on @images before using this function,
- * see games_card_images_set_drawable().
+ * see ar_card_images_set_drawable().
* Returns %NULL on failure.
*
* Returns: a #GdkBitmap owned by @images; you must not change or unref it
*/
GdkBitmap *
-games_card_images_get_slot_mask (GamesCardImages * images)
+ar_card_images_get_slot_mask (ArCardImages * images)
{
- g_return_val_if_fail (GAMES_IS_CARD_IMAGES (images), NULL);
+ g_return_val_if_fail (AR_IS_CARD_IMAGES (images), NULL);
g_return_val_if_fail (images->drawable != NULL, NULL);
if (images->slot_mask == NULL) {
if (images->cache_mode == CACHE_PIXMAPS) {
- games_card_images_get_slot_pixmap (images, FALSE);
+ ar_card_images_get_slot_pixmap (images, FALSE);
} else {
images->slot_mask = create_mask (images->drawable,
- games_card_images_get_slot_pixbuf
+ ar_card_images_get_slot_pixbuf
(images, FALSE), SLOT_ALPHA_THRESHOLD);
}
}
@@ -873,7 +873,7 @@ games_card_images_get_slot_mask (GamesCardImages * images)
/* Deprecated, going to remove these! */
/**
- * games_card_images_get_card_pixbuf_by_suit_and_rank:
+ * ar_card_images_get_card_pixbuf_by_suit_and_rank:
* @images:
* @suit:
* @rank:
@@ -884,18 +884,18 @@ games_card_images_get_slot_mask (GamesCardImages * images)
* Returns: a #GdkPixbuf owned by @images; you must not change or unref it
*/
GdkPixbuf *
-games_card_images_get_card_pixbuf_by_suit_and_rank (GamesCardImages * images,
+ar_card_images_get_card_pixbuf_by_suit_and_rank (ArCardImages * images,
guint suit, guint rank)
{
- g_return_val_if_fail (GAMES_IS_CARD_IMAGES (images), NULL);
+ g_return_val_if_fail (AR_IS_CARD_IMAGES (images), NULL);
- return games_card_images_get_card_pixbuf_by_id (images,
- GAMES_CARD_ID (suit, rank),
+ return ar_card_images_get_card_pixbuf_by_id (images,
+ AR_CARD_ID (suit, rank),
FALSE);
}
/**
- * games_card_images_get_card_pixmap_by_suit_and_rank:
+ * ar_card_images_get_card_pixmap_by_suit_and_rank:
* @images:
* @suit:
* @rank:
@@ -903,21 +903,21 @@ games_card_images_get_card_pixbuf_by_suit_and_rank (GamesCardImages * images,
* Returns a #GdkPixmap for the selected card using the currently loaded
* theme and the currently selected size.
* You must set a drawable on @images before using this function,
- * see games_card_images_set_drawable().
+ * see ar_card_images_set_drawable().
* Returns %NULL on failure.
*
* Returns: a #GdkPixmap owned by @images; you must not change or unref it
*/
GdkPixmap *
-games_card_images_get_card_pixmap_by_suit_and_rank (GamesCardImages * images,
+ar_card_images_get_card_pixmap_by_suit_and_rank (ArCardImages * images,
guint suit, guint rank)
{
- g_return_val_if_fail (( /* (suit >= GAMES_CARDS_CLUBS) && */
- (suit <= GAMES_CARDS_SPADES)), NULL);
- g_return_val_if_fail (((rank >= GAMES_CARD_ACE) &&
- (rank <= GAMES_CARD_ACE_HIGH)), NULL);
+ g_return_val_if_fail (( /* (suit >= AR_CARDS_CLUBS) && */
+ (suit <= AR_CARDS_SPADES)), NULL);
+ g_return_val_if_fail (((rank >= AR_CARD_ACE) &&
+ (rank <= AR_CARD_ACE_HIGH)), NULL);
- return games_card_images_get_card_pixmap_by_id (images,
- GAMES_CARD_ID (suit, rank),
+ return ar_card_images_get_card_pixmap_by_id (images,
+ AR_CARD_ID (suit, rank),
FALSE);
}
diff --git a/libgames-support/games-card-images.h b/aisleriot/lib/ar-card-images.h
similarity index 51%
rename from libgames-support/games-card-images.h
rename to aisleriot/lib/ar-card-images.h
index 00da735..fdbaaa0 100644
--- a/libgames-support/games-card-images.h
+++ b/aisleriot/lib/ar-card-images.h
@@ -20,104 +20,104 @@
/* Manage a set of pixbufs containing a deck of cards. */
-#ifndef GAMES_CARD_IMAGES_H
-#define GAMES_CARD_IMAGES_H
+#ifndef AR_CARD_IMAGES_H
+#define AR_CARD_IMAGES_H
#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "games-card.h"
-#include "games-card-theme.h"
+#include "ar-card.h"
+#include "ar-card-theme.h"
G_BEGIN_DECLS
-#define GAMES_TYPE_CARD_IMAGES (games_card_images_get_type ())
-#define GAMES_CARD_IMAGES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAMES_TYPE_CARD_IMAGES, GamesCardImages))
-#define GAMES_CARD_IMAGES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAMES_TYPE_CARD_IMAGES, GamesCardImagesClass))
-#define GAMES_IS_CARD_IMAGES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAMES_TYPE_CARD_IMAGES))
-#define GAMES_IS_CARD_IMAGES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAMES_TYPE_CARD_IMAGES))
-#define GAMES_CARD_IMAGES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GAMES_TYPE_CARD_IMAGES, GamesCardImagesClass))
+#define AR_TYPE_CARD_IMAGES (ar_card_images_get_type ())
+#define AR_CARD_IMAGES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AR_TYPE_CARD_IMAGES, ArCardImages))
+#define AR_CARD_IMAGES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AR_TYPE_CARD_IMAGES, ArCardImagesClass))
+#define AR_IS_CARD_IMAGES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AR_TYPE_CARD_IMAGES))
+#define AR_IS_CARD_IMAGES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AR_TYPE_CARD_IMAGES))
+#define AR_CARD_IMAGES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AR_TYPE_CARD_IMAGES, ArCardImagesClass))
typedef enum
{
CACHE_PIXBUFS,
CACHE_PIXMAPS,
LAST_CACHE_MODE
-} GamesCardImagesCacheMode;
+} ArCardImagesCacheMode;
-typedef struct _GamesCardImages GamesCardImages;
-typedef struct _GamesCardImagesClass GamesCardImagesClass;
+typedef struct _ArCardImages ArCardImages;
+typedef struct _ArCardImagesClass ArCardImagesClass;
-GType games_card_images_get_type (void);
+GType ar_card_images_get_type (void);
-GamesCardImages *games_card_images_new (void);
+ArCardImages *ar_card_images_new (void);
-void games_card_images_set_theme (GamesCardImages *images,
- GamesCardTheme *theme);
+void ar_card_images_set_theme (ArCardImages *images,
+ ArCardTheme *theme);
-GamesCardTheme *games_card_images_get_theme (GamesCardImages *images);
+ArCardTheme *ar_card_images_get_theme (ArCardImages *images);
-void games_card_images_set_cache_mode (GamesCardImages * images,
- GamesCardImagesCacheMode mode);
+void ar_card_images_set_cache_mode (ArCardImages * images,
+ ArCardImagesCacheMode mode);
-void games_card_images_drop_cache (GamesCardImages *images);
+void ar_card_images_drop_cache (ArCardImages *images);
-void games_card_images_set_drawable (GamesCardImages * images,
+void ar_card_images_set_drawable (ArCardImages * images,
GdkWindow * drawable);
-gboolean games_card_images_set_size (GamesCardImages * images,
+gboolean ar_card_images_set_size (ArCardImages * images,
gint width,
gint height, gdouble proportion);
-void games_card_images_get_size (GamesCardImages *images,
+void ar_card_images_get_size (ArCardImages *images,
CardSize *size);
-void games_card_images_set_background_color (GamesCardImages * images,
+void ar_card_images_set_background_color (ArCardImages * images,
const GdkColor * color);
-void games_card_images_set_selection_color (GamesCardImages * images,
+void ar_card_images_set_selection_color (ArCardImages * images,
const GdkColor * color);
/* Pixbuf routines */
-GdkPixbuf *games_card_images_get_card_pixbuf_by_id (GamesCardImages * images,
+GdkPixbuf *ar_card_images_get_card_pixbuf_by_id (ArCardImages * images,
guint card_id,
gboolean highlighted);
-GdkPixbuf *games_card_images_get_card_pixbuf (GamesCardImages * images,
+GdkPixbuf *ar_card_images_get_card_pixbuf (ArCardImages * images,
Card card,
gboolean highlighted);
/* Pixmap routines */
-GdkPixmap *games_card_images_get_card_pixmap_by_id (GamesCardImages * images,
+GdkPixmap *ar_card_images_get_card_pixmap_by_id (ArCardImages * images,
guint card_id,
gboolean highlighted);
-GdkPixmap *games_card_images_get_card_pixmap (GamesCardImages * images,
+GdkPixmap *ar_card_images_get_card_pixmap (ArCardImages * images,
Card card,
gboolean highlighted);
-GdkBitmap *games_card_images_get_card_mask (GamesCardImages * images);
+GdkBitmap *ar_card_images_get_card_mask (ArCardImages * images);
/* Slot routines */
-GdkPixbuf *games_card_images_get_slot_pixbuf (GamesCardImages * images,
+GdkPixbuf *ar_card_images_get_slot_pixbuf (ArCardImages * images,
gboolean highlighted);
-GdkPixmap *games_card_images_get_slot_pixmap (GamesCardImages * images,
+GdkPixmap *ar_card_images_get_slot_pixmap (ArCardImages * images,
gboolean highlighted);
-GdkBitmap *games_card_images_get_slot_mask (GamesCardImages * images);
+GdkBitmap *ar_card_images_get_slot_mask (ArCardImages * images);
/* Deprecated */
-GdkPixbuf *games_card_images_get_card_pixbuf_by_suit_and_rank (GamesCardImages
+GdkPixbuf *ar_card_images_get_card_pixbuf_by_suit_and_rank (ArCardImages
* images,
guint suit,
guint rank);
-GdkPixmap *games_card_images_get_card_pixmap_by_suit_and_rank (GamesCardImages
+GdkPixmap *ar_card_images_get_card_pixmap_by_suit_and_rank (ArCardImages
* images,
guint suit,
guint rank);
G_END_DECLS
-#endif /* GAMES_CARD_IMAGES_H */
+#endif /* AR_CARD_IMAGES_H */
diff --git a/libgames-support/games-card-private.h b/aisleriot/lib/ar-card-private.h
similarity index 80%
rename from libgames-support/games-card-private.h
rename to aisleriot/lib/ar-card-private.h
index fa3aea1..4483236 100644
--- a/libgames-support/games-card-private.h
+++ b/aisleriot/lib/ar-card-private.h
@@ -19,15 +19,15 @@
/* Authors: Callum McKenzie <callum physics otago ac nz> */
-#ifndef GAMES_CARD_PRIVATE_H
-#define GAMES_CARD_PRIVATE_H
+#ifndef AR_CARD_PRIVATE_H
+#define AR_CARD_PRIVATE_H
G_BEGIN_DECLS
-#define GAMES_CARD_ID(suit, rank) ((13*(suit)) + ((rank-1)%13))
+#define AR_CARD_ID(suit, rank) ((13*(suit)) + ((rank-1)%13))
-guint _games_card_to_index (Card card);
+guint _ar_card_to_index (Card card);
G_END_DECLS
-#endif /* !GAMES_CARD_PRIVATE_H */
+#endif /* !AR_CARD_PRIVATE_H */
diff --git a/libgames-support/games-card-textures-cache.c b/aisleriot/lib/ar-card-textures-cache.c
similarity index 56%
rename from libgames-support/games-card-textures-cache.c
rename to aisleriot/lib/ar-card-textures-cache.c
index 8ed6f8e..48c6fd5 100644
--- a/libgames-support/games-card-textures-cache.c
+++ b/aisleriot/lib/ar-card-textures-cache.c
@@ -22,14 +22,14 @@
#include <gtk/gtk.h>
#include <cogl/cogl.h>
-#include "games-card-textures-cache.h"
+#include <libgames-support/games-debug.h>
-#include "games-card-private.h"
-#include "games-debug.h"
+#include "ar-card-textures-cache.h"
+#include "ar-card-private.h"
-struct _GamesCardTexturesCachePrivate
+struct _ArCardTexturesCachePrivate
{
- GamesCardTheme *theme;
+ ArCardTheme *theme;
guint theme_changed_handler;
CoglHandle *cards;
@@ -61,25 +61,25 @@ enum
#define LOG_CACHE_MISS(obj)
#endif /* GNOME_ENABLE_DEBUG */
-static void games_card_textures_cache_dispose (GObject *object);
-static void games_card_textures_cache_finalize (GObject *object);
+static void ar_card_textures_cache_dispose (GObject *object);
+static void ar_card_textures_cache_finalize (GObject *object);
-G_DEFINE_TYPE (GamesCardTexturesCache, games_card_textures_cache, G_TYPE_OBJECT);
+G_DEFINE_TYPE (ArCardTexturesCache, ar_card_textures_cache, G_TYPE_OBJECT);
-#define GAMES_CARD_TEXTURES_CACHE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GAMES_TYPE_CARD_TEXTURES_CACHE, GamesCardTexturesCachePrivate))
+#define AR_CARD_TEXTURES_CACHE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), AR_TYPE_CARD_TEXTURES_CACHE, ArCardTexturesCachePrivate))
/* Helper functions */
static void
-games_card_textures_cache_clear (GamesCardTexturesCache *cache)
+ar_card_textures_cache_clear (ArCardTexturesCache *cache)
{
- GamesCardTexturesCachePrivate *priv = cache->priv;
+ ArCardTexturesCachePrivate *priv = cache->priv;
int i;
_games_debug_print (GAMES_DEBUG_CARD_CACHE,
- "games_card_textures_cache_clear\n");
+ "ar_card_textures_cache_clear\n");
- for (i = 0; i < GAMES_CARDS_TOTAL; i++) {
+ for (i = 0; i < AR_CARDS_TOTAL; i++) {
CoglHandle handle = priv->cards[i];
if (handle != COGL_INVALID_HANDLE &&
@@ -92,9 +92,9 @@ games_card_textures_cache_clear (GamesCardTexturesCache *cache)
}
static void
-games_card_textures_cache_unset_theme (GamesCardTexturesCache *cache)
+ar_card_textures_cache_unset_theme (ArCardTexturesCache *cache)
{
- GamesCardTexturesCachePrivate *priv = cache->priv;
+ ArCardTexturesCachePrivate *priv = cache->priv;
if (priv->theme) {
g_signal_handler_disconnect (priv->theme, priv->theme_changed_handler);
@@ -107,57 +107,57 @@ games_card_textures_cache_unset_theme (GamesCardTexturesCache *cache)
/* Class implementation */
static void
-games_card_textures_cache_init (GamesCardTexturesCache *self)
+ar_card_textures_cache_init (ArCardTexturesCache *self)
{
- GamesCardTexturesCachePrivate *priv;
+ ArCardTexturesCachePrivate *priv;
- priv = self->priv = GAMES_CARD_TEXTURES_CACHE_GET_PRIVATE (self);
+ priv = self->priv = AR_CARD_TEXTURES_CACHE_GET_PRIVATE (self);
- priv->cards = g_malloc0 (sizeof (CoglHandle) * GAMES_CARDS_TOTAL);
+ priv->cards = g_malloc0 (sizeof (CoglHandle) * AR_CARDS_TOTAL);
}
static void
-games_card_textures_cache_dispose (GObject *object)
+ar_card_textures_cache_dispose (GObject *object)
{
- GamesCardTexturesCache *cache = GAMES_CARD_TEXTURES_CACHE (object);
+ ArCardTexturesCache *cache = AR_CARD_TEXTURES_CACHE (object);
- games_card_textures_cache_clear (cache);
- games_card_textures_cache_unset_theme (cache);
+ ar_card_textures_cache_clear (cache);
+ ar_card_textures_cache_unset_theme (cache);
- G_OBJECT_CLASS (games_card_textures_cache_parent_class)->dispose (object);
+ G_OBJECT_CLASS (ar_card_textures_cache_parent_class)->dispose (object);
}
static void
-games_card_textures_cache_finalize (GObject *object)
+ar_card_textures_cache_finalize (GObject *object)
{
- GamesCardTexturesCache *cache = GAMES_CARD_TEXTURES_CACHE (object);
- GamesCardTexturesCachePrivate *priv = cache->priv;
+ ArCardTexturesCache *cache = AR_CARD_TEXTURES_CACHE (object);
+ ArCardTexturesCachePrivate *priv = cache->priv;
g_free (priv->cards);
#ifdef GNOME_ENABLE_DEBUG
_GAMES_DEBUG_IF (GAMES_DEBUG_CARD_CACHE) {
_games_debug_print (GAMES_DEBUG_CARD_CACHE,
- "GamesCardTexturesCache %p statistics: %u calls with %u hits and %u misses for a hit/total of %.3f\n",
+ "ArCardTexturesCache %p statistics: %u calls with %u hits and %u misses for a hit/total of %.3f\n",
cache, priv->n_calls, priv->cache_hits, priv->n_calls - priv->cache_hits,
priv->n_calls > 0 ? (double) priv->cache_hits / (double) priv->n_calls : 0.0);
}
#endif
- G_OBJECT_CLASS (games_card_textures_cache_parent_class)->finalize (object);
+ G_OBJECT_CLASS (ar_card_textures_cache_parent_class)->finalize (object);
}
static void
-games_card_textures_cache_set_property (GObject *self,
+ar_card_textures_cache_set_property (GObject *self,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
- GamesCardTexturesCache *cache = GAMES_CARD_TEXTURES_CACHE (self);
+ ArCardTexturesCache *cache = AR_CARD_TEXTURES_CACHE (self);
switch (property_id) {
case PROP_THEME:
- games_card_textures_cache_set_theme (cache, g_value_get_object (value));
+ ar_card_textures_cache_set_theme (cache, g_value_get_object (value));
break;
default:
@@ -167,16 +167,16 @@ games_card_textures_cache_set_property (GObject *self,
}
static void
-games_card_textures_cache_get_property (GObject *self,
+ar_card_textures_cache_get_property (GObject *self,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
- GamesCardTexturesCache *cache = GAMES_CARD_TEXTURES_CACHE (self);
+ ArCardTexturesCache *cache = AR_CARD_TEXTURES_CACHE (self);
switch (property_id) {
case PROP_THEME:
- g_value_set_object (value, games_card_textures_cache_get_theme (cache));
+ g_value_set_object (value, ar_card_textures_cache_get_theme (cache));
break;
default:
@@ -186,20 +186,20 @@ games_card_textures_cache_get_property (GObject *self,
}
static void
-games_card_textures_cache_class_init (GamesCardTexturesCacheClass *klass)
+ar_card_textures_cache_class_init (ArCardTexturesCacheClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
- gobject_class->dispose = games_card_textures_cache_dispose;
- gobject_class->finalize = games_card_textures_cache_finalize;
- gobject_class->set_property = games_card_textures_cache_set_property;
- gobject_class->get_property = games_card_textures_cache_get_property;
+ gobject_class->dispose = ar_card_textures_cache_dispose;
+ gobject_class->finalize = ar_card_textures_cache_finalize;
+ gobject_class->set_property = ar_card_textures_cache_set_property;
+ gobject_class->get_property = ar_card_textures_cache_get_property;
- g_type_class_add_private (klass, sizeof (GamesCardTexturesCachePrivate));
+ g_type_class_add_private (klass, sizeof (ArCardTexturesCachePrivate));
pspec = g_param_spec_object ("theme", NULL, NULL,
- GAMES_TYPE_CARD_THEME,
+ AR_TYPE_CARD_THEME,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_NAME |
@@ -211,58 +211,58 @@ games_card_textures_cache_class_init (GamesCardTexturesCacheClass *klass)
/* Public API */
/**
- * games_card_textures_cache_new:
+ * ar_card_textures_cache_new:
*
- * Returns: a new #GamesCardTexturesCache object
+ * Returns: a new #ArCardTexturesCache object
*/
-GamesCardTexturesCache *
-games_card_textures_cache_new (void)
+ArCardTexturesCache *
+ar_card_textures_cache_new (void)
{
- return g_object_new (GAMES_TYPE_CARD_TEXTURES_CACHE, NULL);
+ return g_object_new (AR_TYPE_CARD_TEXTURES_CACHE, NULL);
}
/**
- * games_card_textures_cache_drop:
- * @images: a #GamesCardImages
+ * ar_card_textures_cache_drop:
+ * @images: a #ArCardImages
*
* Clears the image cache.
*/
void
-games_card_textures_cache_drop (GamesCardTexturesCache *cache)
+ar_card_textures_cache_drop (ArCardTexturesCache *cache)
{
- g_return_if_fail (GAMES_IS_CARD_TEXTURES_CACHE (cache));
+ g_return_if_fail (AR_IS_CARD_TEXTURES_CACHE (cache));
- games_card_textures_cache_clear (cache);
+ ar_card_textures_cache_clear (cache);
}
/**
- * games_card_textures_cache_set_theme:
+ * ar_card_textures_cache_set_theme:
* @cache:
* @theme:
*
* Sets the card theme.
*/
void
-games_card_textures_cache_set_theme (GamesCardTexturesCache *cache,
- GamesCardTheme *theme)
+ar_card_textures_cache_set_theme (ArCardTexturesCache *cache,
+ ArCardTheme *theme)
{
- GamesCardTexturesCachePrivate *priv = cache->priv;
+ ArCardTexturesCachePrivate *priv = cache->priv;
- g_return_if_fail (GAMES_IS_CARD_TEXTURES_CACHE (cache));
- g_return_if_fail (theme == NULL || GAMES_IS_CARD_THEME (theme));
+ g_return_if_fail (AR_IS_CARD_TEXTURES_CACHE (cache));
+ g_return_if_fail (theme == NULL || AR_IS_CARD_THEME (theme));
if (priv->theme == theme)
return;
- games_card_textures_cache_clear (cache);
- games_card_textures_cache_unset_theme (cache);
+ ar_card_textures_cache_clear (cache);
+ ar_card_textures_cache_unset_theme (cache);
priv->theme = theme;
if (theme) {
g_object_ref (theme);
priv->theme_changed_handler = g_signal_connect_swapped (theme, "changed",
- G_CALLBACK (games_card_textures_cache_clear),
+ G_CALLBACK (ar_card_textures_cache_clear),
cache);
}
@@ -270,34 +270,34 @@ games_card_textures_cache_set_theme (GamesCardTexturesCache *cache,
}
/**
- * games_card_textures_cache_get_theme:
+ * ar_card_textures_cache_get_theme:
* @cache:
*
* Returns: the the card theme of @cache
*/
-GamesCardTheme *
-games_card_textures_cache_get_theme (GamesCardTexturesCache *cache)
+ArCardTheme *
+ar_card_textures_cache_get_theme (ArCardTexturesCache *cache)
{
- g_return_val_if_fail (GAMES_IS_CARD_TEXTURES_CACHE (cache), NULL);
+ g_return_val_if_fail (AR_IS_CARD_TEXTURES_CACHE (cache), NULL);
return cache->priv->theme;
}
/**
- * games_card_textures_cache_get_card_texture_by_id:
+ * ar_card_textures_cache_get_card_texture_by_id:
* @cache:
* @card_id:
*
* Returns: a cached #CoglHandle for @card_id.
*/
CoglHandle
-games_card_textures_cache_get_card_texture_by_id (GamesCardTexturesCache *cache,
+ar_card_textures_cache_get_card_texture_by_id (ArCardTexturesCache *cache,
guint card_id)
{
- GamesCardTexturesCachePrivate *priv = cache->priv;
+ ArCardTexturesCachePrivate *priv = cache->priv;
CoglHandle handle;
- g_return_val_if_fail (card_id < GAMES_CARDS_TOTAL , NULL);
+ g_return_val_if_fail (card_id < AR_CARDS_TOTAL , NULL);
LOG_CALL (cache);
@@ -312,7 +312,7 @@ games_card_textures_cache_get_card_texture_by_id (GamesCardTexturesCache *cache,
LOG_CACHE_MISS (cache);
- pixbuf = games_card_theme_get_card_pixbuf (priv->theme, card_id);
+ pixbuf = ar_card_theme_get_card_pixbuf (priv->theme, card_id);
if (!pixbuf) {
priv->cards[card_id] = FAILED_HANDLE;
return COGL_INVALID_HANDLE;
@@ -343,7 +343,7 @@ games_card_textures_cache_get_card_texture_by_id (GamesCardTexturesCache *cache,
}
/**
- * games_card_textures_cache_get_card_texture:
+ * ar_card_textures_cache_get_card_texture:
* @cache:
* @card:
* @highlighted:
@@ -351,23 +351,23 @@ games_card_textures_cache_get_card_texture_by_id (GamesCardTexturesCache *cache,
* Returns: a cached #CoglHandle for @card.
*/
CoglHandle
-games_card_textures_cache_get_card_texture (GamesCardTexturesCache *cache,
+ar_card_textures_cache_get_card_texture (ArCardTexturesCache *cache,
Card card)
{
- guint card_id = _games_card_to_index (card);
+ guint card_id = _ar_card_to_index (card);
- return games_card_textures_cache_get_card_texture_by_id (cache, card_id);
+ return ar_card_textures_cache_get_card_texture_by_id (cache, card_id);
}
/**
- * games_card_textures_cache_get_slot_texture:
+ * ar_card_textures_cache_get_slot_texture:
* @cache:
* @highlighted:
*
* Returns: a cached #CoglHandle for the slot.
*/
CoglHandle
-games_card_textures_cache_get_slot_texture (GamesCardTexturesCache *cache)
+ar_card_textures_cache_get_slot_texture (ArCardTexturesCache *cache)
{
- return games_card_textures_cache_get_card_texture_by_id (cache, GAMES_CARD_SLOT);
+ return ar_card_textures_cache_get_card_texture_by_id (cache, AR_CARD_SLOT);
}
diff --git a/aisleriot/lib/ar-card-textures-cache.h b/aisleriot/lib/ar-card-textures-cache.h
new file mode 100644
index 0000000..3f281c4
--- /dev/null
+++ b/aisleriot/lib/ar-card-textures-cache.h
@@ -0,0 +1,74 @@
+/*
+ Copyright © 2008 Neil Roberts
+ Copyright © 2008 Christian Persch
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef AR_CARD_TEXTURES_CACHE_H
+#define AR_CARD_TEXTURES_CACHE_H
+
+#include <glib-object.h>
+#include <cogl/cogl.h>
+
+#include "ar-card.h"
+#include "ar-card-theme.h"
+
+G_BEGIN_DECLS
+
+#define AR_TYPE_CARD_TEXTURES_CACHE (ar_card_textures_cache_get_type())
+#define AR_CARD_TEXTURES_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AR_TYPE_CARD_TEXTURES_CACHE, ArCardTexturesCache))
+#define AR_CARD_TEXTURES_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AR_TYPE_CARD_TEXTURES_CACHE, ArCardTexturesCacheClass))
+#define AR_IS_CARD_TEXTURES_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AR_TYPE_CARD_TEXTURES_CACHE))
+#define AR_IS_CARD_TEXTURES_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AR_TYPE_CARD_TEXTURES_CACHE))
+#define AR_CARD_TEXTURES_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AR_TYPE_CARD_TEXTURES_CACHE, ArCardTexturesCacheClass))
+
+typedef struct _ArCardTexturesCache ArCardTexturesCache;
+typedef struct _ArCardTexturesCacheClass ArCardTexturesCacheClass;
+typedef struct _ArCardTexturesCachePrivate ArCardTexturesCachePrivate;
+
+struct _ArCardTexturesCacheClass
+{
+ GObjectClass parent_class;
+};
+
+struct _ArCardTexturesCache
+{
+ GObject parent;
+
+ ArCardTexturesCachePrivate *priv;
+};
+
+GType ar_card_textures_cache_get_type (void);
+
+ArCardTexturesCache *ar_card_textures_cache_new (void);
+
+void ar_card_textures_cache_drop (ArCardTexturesCache *cache);
+
+void ar_card_textures_cache_set_theme (ArCardTexturesCache *cache,
+ ArCardTheme *theme);
+
+ArCardTheme *ar_card_textures_cache_get_theme (ArCardTexturesCache *cache);
+
+CoglHandle ar_card_textures_cache_get_card_texture (ArCardTexturesCache *cache,
+ Card card);
+
+CoglHandle ar_card_textures_cache_get_card_texture_by_id (ArCardTexturesCache *cache,
+ guint card_id);
+
+CoglHandle ar_card_textures_cache_get_slot_texture (ArCardTexturesCache *cache);
+
+G_END_DECLS
+
+#endif /* AR_CARD_TEXTURES_CACHE_H */
diff --git a/libgames-support/games-card-theme-fixed.c b/aisleriot/lib/ar-card-theme-fixed.c
similarity index 73%
rename from libgames-support/games-card-theme-fixed.c
rename to aisleriot/lib/ar-card-theme-fixed.c
index 549f18b..dfafc82 100644
--- a/libgames-support/games-card-theme-fixed.c
+++ b/aisleriot/lib/ar-card-theme-fixed.c
@@ -25,21 +25,21 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
-#include "games-debug.h"
-#include "games-runtime.h"
-#include "games-string-utils.h"
+#include <libgames-support/games-debug.h>
+#include <libgames-support/games-runtime.h>
+#include <libgames-support/games-string-utils.h>
-#include "games-card-theme.h"
-#include "games-card-theme-private.h"
+#include "ar-card-theme.h"
+#include "ar-card-theme-private.h"
-struct _GamesCardThemeFixedClass {
- GamesCardThemeClass parent_class;
+struct _ArCardThemeFixedClass {
+ ArCardThemeClass parent_class;
};
-struct _GamesCardThemeFixed {
- GamesCardTheme parent_instance;
+struct _ArCardThemeFixed {
+ ArCardTheme parent_instance;
- /* Switched on GamesCardThemeFixed.use_scalable */
+ /* Switched on ArCardThemeFixed.use_scalable */
char *themesizepath;
CardSize *card_sizes;
guint n_card_sizes;
@@ -52,14 +52,14 @@ struct _GamesCardThemeFixed {
/* Class implementation */
-G_DEFINE_TYPE (GamesCardThemeFixed, games_card_theme_fixed, GAMES_TYPE_CARD_THEME);
+G_DEFINE_TYPE (ArCardThemeFixed, ar_card_theme_fixed, AR_TYPE_CARD_THEME);
static gboolean
-games_card_theme_fixed_load (GamesCardTheme *card_theme,
+ar_card_theme_fixed_load (ArCardTheme *card_theme,
GError **error__)
{
- GamesCardThemeFixed *theme = (GamesCardThemeFixed *) card_theme;
- GamesCardThemeInfo *theme_info = card_theme->theme_info;
+ ArCardThemeFixed *theme = (ArCardThemeFixed *) card_theme;
+ ArCardThemeInfo *theme_info = card_theme->theme_info;
GKeyFile *key_file;
char *path;
GError *error = NULL;
@@ -138,7 +138,7 @@ loser:
}
static void
-games_card_theme_fixed_init (GamesCardThemeFixed *theme)
+ar_card_theme_fixed_init (ArCardThemeFixed *theme)
{
theme->card_size.width = theme->card_size.height = -1;
@@ -153,24 +153,24 @@ games_card_theme_fixed_init (GamesCardThemeFixed *theme)
}
static void
-games_card_theme_fixed_finalize (GObject * object)
+ar_card_theme_fixed_finalize (GObject * object)
{
- GamesCardThemeFixed *theme = GAMES_CARD_THEME_FIXED (object);
+ ArCardThemeFixed *theme = AR_CARD_THEME_FIXED (object);
g_free (theme->card_sizes);
g_free (theme->themesizepath);
- G_OBJECT_CLASS (games_card_theme_fixed_parent_class)->finalize (object);
+ G_OBJECT_CLASS (ar_card_theme_fixed_parent_class)->finalize (object);
}
static gboolean
-games_card_theme_fixed_set_card_size (GamesCardTheme *card_theme,
+ar_card_theme_fixed_set_card_size (ArCardTheme *card_theme,
int width,
int height,
double proportion)
{
- GamesCardThemeFixed *theme = (GamesCardThemeFixed *) card_theme;
- GamesCardThemeInfo *theme_info = card_theme->theme_info;
+ ArCardThemeFixed *theme = (ArCardThemeFixed *) card_theme;
+ ArCardThemeInfo *theme_info = card_theme->theme_info;
if ((width == theme->slot_size.width) &&
(height == theme->slot_size.height))
@@ -246,33 +246,33 @@ games_card_theme_fixed_set_card_size (GamesCardTheme *card_theme,
}
}
- _games_card_theme_emit_changed (card_theme);
+ _ar_card_theme_emit_changed (card_theme);
return TRUE;
}
static void
-games_card_theme_fixed_get_card_size (GamesCardTheme *card_theme,
+ar_card_theme_fixed_get_card_size (ArCardTheme *card_theme,
CardSize *size)
{
- GamesCardThemeFixed *theme = (GamesCardThemeFixed *) card_theme;
+ ArCardThemeFixed *theme = (ArCardThemeFixed *) card_theme;
*size = theme->card_size;
}
static double
-games_card_theme_fixed_get_card_aspect (GamesCardTheme *card_theme)
+ar_card_theme_fixed_get_card_aspect (ArCardTheme *card_theme)
{
- GamesCardThemeFixed *theme = (GamesCardThemeFixed *) card_theme;
+ ArCardThemeFixed *theme = (ArCardThemeFixed *) card_theme;
return ((double) theme->card_size.width) / ((double) theme->card_size.height);
}
static GdkPixbuf *
-games_card_theme_fixed_get_card_pixbuf (GamesCardTheme *card_theme,
+ar_card_theme_fixed_get_card_pixbuf (ArCardTheme *card_theme,
int card_id)
{
- GamesCardThemeFixed *theme = (GamesCardThemeFixed *) card_theme;
+ ArCardThemeFixed *theme = (ArCardThemeFixed *) card_theme;
GdkPixbuf *pixbuf;
GError *error = NULL;
char name[32], filename[36];
@@ -281,7 +281,7 @@ games_card_theme_fixed_get_card_pixbuf (GamesCardTheme *card_theme,
if (!theme->size_available)
return NULL;
- games_card_get_name_by_id_snprintf (name, sizeof (name), card_id);
+ ar_card_get_name_by_id_snprintf (name, sizeof (name), card_id);
g_snprintf (filename, sizeof (filename), "%s.png", name);
path = g_build_filename (theme->themesizepath, filename, NULL);
@@ -298,12 +298,12 @@ games_card_theme_fixed_get_card_pixbuf (GamesCardTheme *card_theme,
return pixbuf;
}
-static GamesCardThemeInfo *
-games_card_theme_fixed_class_get_theme_info (GamesCardThemeClass *klass,
+static ArCardThemeInfo *
+ar_card_theme_fixed_class_get_theme_info (ArCardThemeClass *klass,
const char *path,
const char *filename)
{
- GamesCardThemeInfo *info;
+ ArCardThemeInfo *info;
char *display_name, *pref_name;
if (!g_str_has_suffix (filename, ".card-theme"))
@@ -321,7 +321,7 @@ games_card_theme_fixed_class_get_theme_info (GamesCardThemeClass *klass,
pref_name = g_strdup_printf ("fixed:%s", filename);
#endif
- info = _games_card_theme_info_new (G_OBJECT_CLASS_TYPE (klass),
+ info = _ar_card_theme_info_new (G_OBJECT_CLASS_TYPE (klass),
path,
filename,
display_name /* adopts */,
@@ -332,43 +332,43 @@ games_card_theme_fixed_class_get_theme_info (GamesCardThemeClass *klass,
}
static gboolean
-games_card_theme_fixed_class_foreach_theme_dir (GamesCardThemeClass *klass,
- GamesCardThemeForeachFunc callback,
+ar_card_theme_fixed_class_foreach_theme_dir (ArCardThemeClass *klass,
+ ArCardThemeForeachFunc callback,
gpointer data)
{
- if (!_games_card_theme_class_foreach_env (klass, "GAMES_CARD_THEME_PATH_FIXED", callback, data))
+ if (!_ar_card_theme_class_foreach_env (klass, "AR_CARD_THEME_PATH_FIXED", callback, data))
return FALSE;
return callback (klass, games_runtime_get_directory (GAMES_RUNTIME_PRERENDERED_CARDS_DIRECTORY), data);
}
static void
-games_card_theme_fixed_class_init (GamesCardThemeFixedClass * klass)
+ar_card_theme_fixed_class_init (ArCardThemeFixedClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GamesCardThemeClass *theme_class = GAMES_CARD_THEME_CLASS (klass);
+ ArCardThemeClass *theme_class = AR_CARD_THEME_CLASS (klass);
- gobject_class->finalize = games_card_theme_fixed_finalize;
+ gobject_class->finalize = ar_card_theme_fixed_finalize;
- theme_class->get_theme_info = games_card_theme_fixed_class_get_theme_info;
- theme_class->foreach_theme_dir = games_card_theme_fixed_class_foreach_theme_dir;
+ theme_class->get_theme_info = ar_card_theme_fixed_class_get_theme_info;
+ theme_class->foreach_theme_dir = ar_card_theme_fixed_class_foreach_theme_dir;
- theme_class->load = games_card_theme_fixed_load;
- theme_class->set_card_size = games_card_theme_fixed_set_card_size;
- theme_class->get_card_size = games_card_theme_fixed_get_card_size;
- theme_class->get_card_aspect = games_card_theme_fixed_get_card_aspect;
- theme_class->get_card_pixbuf = games_card_theme_fixed_get_card_pixbuf;
+ theme_class->load = ar_card_theme_fixed_load;
+ theme_class->set_card_size = ar_card_theme_fixed_set_card_size;
+ theme_class->get_card_size = ar_card_theme_fixed_get_card_size;
+ theme_class->get_card_aspect = ar_card_theme_fixed_get_card_aspect;
+ theme_class->get_card_pixbuf = ar_card_theme_fixed_get_card_pixbuf;
}
/* public API */
/**
- * games_card_theme_fixed_new:
+ * ar_card_theme_fixed_new:
*
- * Returns: a new #GamesCardThemeFixed
+ * Returns: a new #ArCardThemeFixed
*/
-GamesCardTheme *
-games_card_theme_fixed_new (void)
+ArCardTheme *
+ar_card_theme_fixed_new (void)
{
- return g_object_new (GAMES_TYPE_CARD_THEME_FIXED, NULL);
+ return g_object_new (AR_TYPE_CARD_THEME_FIXED, NULL);
}
diff --git a/libgames-support/games-card-theme-kde.c b/aisleriot/lib/ar-card-theme-kde.c
similarity index 73%
rename from libgames-support/games-card-theme-kde.c
rename to aisleriot/lib/ar-card-theme-kde.c
index 14b7458..aaecf1e 100644
--- a/libgames-support/games-card-theme-kde.c
+++ b/aisleriot/lib/ar-card-theme-kde.c
@@ -24,15 +24,15 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
-#include "games-debug.h"
-#include "games-profile.h"
-#include "games-preimage.h"
-#include "games-preimage-private.h"
-#include "games-runtime.h"
-#include "games-string-utils.h"
+#include <libgames-support/games-debug.h>
+#include <libgames-support/games-profile.h>
+#include <libgames-support/games-preimage.h>
+#include <libgames-support/games-preimage-private.h>
+#include <libgames-support/games-runtime.h>
+#include <libgames-support/games-string-utils.h>
-#include "games-card-theme.h"
-#include "games-card-theme-private.h"
+#include "ar-card-theme.h"
+#include "ar-card-theme-private.h"
#define MAX_N_BACKS (10)
@@ -44,12 +44,12 @@ typedef struct {
double y;
} CardBbox;
-struct _GamesCardThemeKDEClass {
- GamesCardThemePreimageClass parent_class;
+struct _ArCardThemeKDEClass {
+ ArCardThemePreimageClass parent_class;
};
-struct _GamesCardThemeKDE {
- GamesCardThemePreimage parent_instance;
+struct _ArCardThemeKDE {
+ ArCardThemePreimage parent_instance;
CardBbox *bboxes;
@@ -111,7 +111,7 @@ get_is_blacklisted (const char *filename)
#ifdef HAVE_NEW_RSVG
static CardBbox *
-games_card_theme_kde_get_card_bbox (GamesCardThemeKDE *theme,
+ar_card_theme_kde_get_card_bbox (ArCardThemeKDE *theme,
int card_id,
const char *node)
{
@@ -125,7 +125,7 @@ games_card_theme_kde_get_card_bbox (GamesCardThemeKDE *theme,
if (bbox->initialised)
return bbox;
- preimage = ((GamesCardThemePreimage *) theme)->cards_preimage;
+ preimage = ((ArCardThemePreimage *) theme)->cards_preimage;
_games_profile_start ("rsvg_handle_get_dimensions_sub node %s", node);
retval = rsvg_handle_get_dimensions_sub (preimage->rsvg_handle, &dim, node);
@@ -169,10 +169,10 @@ games_card_theme_kde_get_card_bbox (GamesCardThemeKDE *theme,
/* Class implementation */
-G_DEFINE_TYPE (GamesCardThemeKDE, games_card_theme_kde, GAMES_TYPE_CARD_THEME_PREIMAGE);
+G_DEFINE_TYPE (ArCardThemeKDE, ar_card_theme_kde, AR_TYPE_CARD_THEME_PREIMAGE);
static gboolean
-games_card_theme_kde_load (GamesCardTheme *card_theme,
+ar_card_theme_kde_load (ArCardTheme *card_theme,
GError **error)
{
#ifdef HAVE_NEW_RSVG
@@ -181,21 +181,21 @@ games_card_theme_kde_load (GamesCardTheme *card_theme,
"#red_back",
"#green_back"
};
- GamesCardThemeKDE *theme = (GamesCardThemeKDE *) card_theme;
+ ArCardThemeKDE *theme = (ArCardThemeKDE *) card_theme;
GamesPreimage *preimage;
char node[32];
guint i;
gboolean has_red_joker, has_black_joker, has_joker;
- if (!GAMES_CARD_THEME_CLASS (games_card_theme_kde_parent_class)->load (card_theme, error))
+ if (!AR_CARD_THEME_CLASS (ar_card_theme_kde_parent_class)->load (card_theme, error))
return FALSE;
- preimage = ((GamesCardThemePreimage *) theme)->cards_preimage;
+ preimage = ((ArCardThemePreimage *) theme)->cards_preimage;
/* Check available backs */
g_assert (theme->n_backs == 0);
- games_card_get_node_by_id_snprintf (node, sizeof (node), GAMES_CARD_BACK);
+ ar_card_get_node_by_id_snprintf (node, sizeof (node), AR_CARD_BACK);
if (rsvg_handle_has_sub (preimage->rsvg_handle, node)) {
theme->backs[theme->n_backs++] = g_strdup (node);
}
@@ -218,9 +218,9 @@ games_card_theme_kde_load (GamesCardTheme *card_theme,
return FALSE;
/* Look for the jokers */
- games_card_get_node_by_id_snprintf (node, sizeof (node), GAMES_CARD_BLACK_JOKER);
+ ar_card_get_node_by_id_snprintf (node, sizeof (node), AR_CARD_BLACK_JOKER);
has_black_joker = rsvg_handle_has_sub (preimage->rsvg_handle, node);
- games_card_get_node_by_id_snprintf (node, sizeof (node), GAMES_CARD_RED_JOKER);
+ ar_card_get_node_by_id_snprintf (node, sizeof (node), AR_CARD_RED_JOKER);
has_red_joker = rsvg_handle_has_sub (preimage->rsvg_handle, node);
has_joker = rsvg_handle_has_sub (preimage->rsvg_handle, "#joker");
@@ -229,8 +229,8 @@ games_card_theme_kde_load (GamesCardTheme *card_theme,
theme->has_joker = has_joker;
/* Get the bbox of the card back, which we use to compute the theme's aspect ratio */
- if (!games_card_theme_kde_get_card_bbox (theme, GAMES_CARD_BACK, theme->backs[theme->back_index])) {
- g_set_error (error, GAMES_CARD_THEME_ERROR, GAMES_CARD_THEME_ERROR_GENERIC,
+ if (!ar_card_theme_kde_get_card_bbox (theme, AR_CARD_BACK, theme->backs[theme->back_index])) {
+ g_set_error (error, AR_CARD_THEME_ERROR, AR_CARD_THEME_ERROR_GENERIC,
"Failed to get the theme's aspect ratio");
return FALSE;
}
@@ -242,24 +242,24 @@ games_card_theme_kde_load (GamesCardTheme *card_theme,
}
static double
-games_card_theme_kde_get_card_aspect (GamesCardTheme* card_theme)
+ar_card_theme_kde_get_card_aspect (ArCardTheme* card_theme)
{
- GamesCardThemeKDE *theme = (GamesCardThemeKDE *) card_theme;
+ ArCardThemeKDE *theme = (ArCardThemeKDE *) card_theme;
CardBbox *bbox;
- bbox = &theme->bboxes[GAMES_CARD_BACK];
+ bbox = &theme->bboxes[AR_CARD_BACK];
g_assert (bbox->initialised);
return bbox->width / bbox->height;
}
static GdkPixbuf *
-games_card_theme_kde_get_card_pixbuf (GamesCardTheme *card_theme,
+ar_card_theme_kde_get_card_pixbuf (ArCardTheme *card_theme,
int card_id)
{
#ifdef HAVE_NEW_RSVG
- GamesCardThemePreimage *preimage_card_theme = (GamesCardThemePreimage *) card_theme;
- GamesCardThemeKDE *theme = (GamesCardThemeKDE *) card_theme;
+ ArCardThemePreimage *preimage_card_theme = (ArCardThemePreimage *) card_theme;
+ ArCardThemeKDE *theme = (ArCardThemeKDE *) card_theme;
GamesPreimage *preimage = preimage_card_theme->cards_preimage;
GdkPixbuf *subpixbuf;
double card_width, card_height;
@@ -268,7 +268,7 @@ games_card_theme_kde_get_card_pixbuf (GamesCardTheme *card_theme,
char node[32];
CardBbox *bbox;
- if (G_UNLIKELY (card_id == GAMES_CARD_SLOT)) {
+ if (G_UNLIKELY (card_id == AR_CARD_SLOT)) {
subpixbuf = games_preimage_render (preimage_card_theme->slot_preimage,
preimage_card_theme->card_size.width,
preimage_card_theme->card_size.height);
@@ -276,9 +276,9 @@ games_card_theme_kde_get_card_pixbuf (GamesCardTheme *card_theme,
return subpixbuf;
}
- games_card_get_node_by_id_snprintf (node, sizeof (node), card_id);
+ ar_card_get_node_by_id_snprintf (node, sizeof (node), card_id);
- bbox = games_card_theme_kde_get_card_bbox (theme, card_id, node);
+ bbox = ar_card_theme_kde_get_card_bbox (theme, card_id, node);
if (!bbox)
return NULL;
@@ -311,18 +311,18 @@ games_card_theme_kde_get_card_pixbuf (GamesCardTheme *card_theme,
}
static void
-games_card_theme_kde_init (GamesCardThemeKDE *theme)
+ar_card_theme_kde_init (ArCardThemeKDE *theme)
{
- theme->bboxes = g_new0 (CardBbox, GAMES_CARDS_TOTAL);
+ theme->bboxes = g_new0 (CardBbox, AR_CARDS_TOTAL);
theme->n_backs = 0;
theme->back_index = 0;
}
static void
-games_card_theme_kde_finalize (GObject * object)
+ar_card_theme_kde_finalize (GObject * object)
{
- GamesCardThemeKDE *theme = GAMES_CARD_THEME_KDE (object);
+ ArCardThemeKDE *theme = AR_CARD_THEME_KDE (object);
guint i;
g_free (theme->bboxes);
@@ -330,16 +330,16 @@ games_card_theme_kde_finalize (GObject * object)
for (i = 0; i < theme->n_backs; ++i)
g_free (theme->backs[i]);
- G_OBJECT_CLASS (games_card_theme_kde_parent_class)->finalize (object);
+ G_OBJECT_CLASS (ar_card_theme_kde_parent_class)->finalize (object);
}
-static GamesCardThemeInfo *
-games_card_theme_kde_class_get_theme_info (GamesCardThemeClass *klass,
+static ArCardThemeInfo *
+ar_card_theme_kde_class_get_theme_info (ArCardThemeClass *klass,
const char *path,
const char *filename)
{
#ifdef HAVE_NEW_RSVG
- GamesCardThemeInfo *info = NULL;
+ ArCardThemeInfo *info = NULL;
char *base_path = NULL, *key_file_path = NULL;
GKeyFile *key_file = NULL;
char *svg_filename = NULL, *name = NULL, *display_name, *pref_name;
@@ -369,7 +369,7 @@ games_card_theme_kde_class_get_theme_info (GamesCardThemeClass *klass,
display_name = g_strdup_printf ("%s (KDE)", name);
pref_name = g_strdup_printf ("kde:%s", filename);
- info = _games_card_theme_info_new (G_OBJECT_CLASS_TYPE (klass),
+ info = _ar_card_theme_info_new (G_OBJECT_CLASS_TYPE (klass),
base_path,
svg_filename,
display_name /* adopts */,
@@ -392,11 +392,11 @@ out:
}
static gboolean
-games_card_theme_kde_class_foreach_theme_dir (GamesCardThemeClass *klass,
- GamesCardThemeForeachFunc callback,
+ar_card_theme_kde_class_foreach_theme_dir (ArCardThemeClass *klass,
+ ArCardThemeForeachFunc callback,
gpointer data)
{
- if (!_games_card_theme_class_foreach_env (klass, "GAMES_CARD_THEME_PATH_KDE", callback, data))
+ if (!_ar_card_theme_class_foreach_env (klass, "AR_CARD_THEME_PATH_KDE", callback, data))
return FALSE;
/* FIXMEchpe: is this universal, or ubuntu specific? */
@@ -404,12 +404,12 @@ games_card_theme_kde_class_foreach_theme_dir (GamesCardThemeClass *klass,
}
static void
-games_card_theme_kde_get_property (GObject *object,
+ar_card_theme_kde_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
- GamesCardThemeKDE *theme = GAMES_CARD_THEME_KDE (object);
+ ArCardThemeKDE *theme = AR_CARD_THEME_KDE (object);
switch (property_id) {
case PROP_BACK_INDEX:
@@ -426,12 +426,12 @@ games_card_theme_kde_get_property (GObject *object,
}
static void
-games_card_theme_kde_set_property (GObject *object,
+ar_card_theme_kde_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
- GamesCardThemeKDE *theme = GAMES_CARD_THEME_KDE (object);
+ ArCardThemeKDE *theme = AR_CARD_THEME_KDE (object);
switch (property_id) {
case PROP_BACK_INDEX:
@@ -439,7 +439,7 @@ games_card_theme_kde_set_property (GObject *object,
theme->back_index = CLAMP (theme->back_index, 0, theme->n_backs);
/* FIXMEchpe don't invalidate the whole thing, just the BACK card */
- _games_card_theme_emit_changed (GAMES_CARD_THEME (theme));
+ _ar_card_theme_emit_changed (AR_CARD_THEME (theme));
break;
case PROP_N_BACKS:
@@ -450,22 +450,22 @@ games_card_theme_kde_set_property (GObject *object,
}
static void
-games_card_theme_kde_class_init (GamesCardThemeKDEClass * klass)
+ar_card_theme_kde_class_init (ArCardThemeKDEClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GamesCardThemeClass *theme_class = GAMES_CARD_THEME_CLASS (klass);
- GamesCardThemePreimageClass *preimage_theme_class = GAMES_CARD_THEME_PREIMAGE_CLASS (klass);
+ ArCardThemeClass *theme_class = AR_CARD_THEME_CLASS (klass);
+ ArCardThemePreimageClass *preimage_theme_class = AR_CARD_THEME_PREIMAGE_CLASS (klass);
- gobject_class->finalize = games_card_theme_kde_finalize;
- gobject_class->get_property = games_card_theme_kde_get_property;
- gobject_class->set_property = games_card_theme_kde_set_property;
+ gobject_class->finalize = ar_card_theme_kde_finalize;
+ gobject_class->get_property = ar_card_theme_kde_get_property;
+ gobject_class->set_property = ar_card_theme_kde_set_property;
- theme_class->get_theme_info = games_card_theme_kde_class_get_theme_info;
- theme_class->foreach_theme_dir = games_card_theme_kde_class_foreach_theme_dir;
+ theme_class->get_theme_info = ar_card_theme_kde_class_get_theme_info;
+ theme_class->foreach_theme_dir = ar_card_theme_kde_class_foreach_theme_dir;
- theme_class->load = games_card_theme_kde_load;
- theme_class->get_card_aspect = games_card_theme_kde_get_card_aspect;
- theme_class->get_card_pixbuf = games_card_theme_kde_get_card_pixbuf;
+ theme_class->load = ar_card_theme_kde_load;
+ theme_class->get_card_aspect = ar_card_theme_kde_get_card_aspect;
+ theme_class->get_card_pixbuf = ar_card_theme_kde_get_card_pixbuf;
preimage_theme_class->needs_scalable_cards = TRUE;
@@ -490,12 +490,12 @@ games_card_theme_kde_class_init (GamesCardThemeKDEClass * klass)
/* private API */
/**
- * games_card_theme_kde_new:
+ * ar_card_theme_kde_new:
*
- * Returns: a new #GamesCardThemeKDE
+ * Returns: a new #ArCardThemeKDE
*/
-GamesCardTheme*
-games_card_theme_kde_new (void)
+ArCardTheme*
+ar_card_theme_kde_new (void)
{
- return g_object_new (GAMES_TYPE_CARD_THEME_KDE, NULL);
+ return g_object_new (AR_TYPE_CARD_THEME_KDE, NULL);
}
diff --git a/libgames-support/games-card-theme-preimage.c b/aisleriot/lib/ar-card-theme-preimage.c
similarity index 65%
rename from libgames-support/games-card-theme-preimage.c
rename to aisleriot/lib/ar-card-theme-preimage.c
index 19c1ef3..1c5bc7b 100644
--- a/libgames-support/games-card-theme-preimage.c
+++ b/aisleriot/lib/ar-card-theme-preimage.c
@@ -29,12 +29,12 @@
#include <librsvg/librsvg-features.h>
#endif
-#include "games-preimage.h"
-#include "games-runtime.h"
+#include <libgames-support/games-preimage.h>
+#include <libgames-support/games-runtime.h>
+#include <libgames-support/games-string-utils.h>
-#include "games-card-theme.h"
-#include "games-card-theme-private.h"
-#include "games-string-utils.h"
+#include "ar-card-theme.h"
+#include "ar-card-theme-private.h"
#define N_ROWS ((double) 5.0)
#define N_COLS ((double) 13.0)
@@ -43,24 +43,24 @@
/* Class implementation */
-G_DEFINE_ABSTRACT_TYPE (GamesCardThemePreimage, games_card_theme_preimage, GAMES_TYPE_CARD_THEME);
+G_DEFINE_ABSTRACT_TYPE (ArCardThemePreimage, ar_card_theme_preimage, AR_TYPE_CARD_THEME);
void
-_games_card_theme_preimage_clear_sized_theme_data (GamesCardThemePreimage *theme)
+_ar_card_theme_preimage_clear_sized_theme_data (ArCardThemePreimage *theme)
{
- void (* clear_sized_theme_data) (GamesCardThemePreimage *) =
- GAMES_CARD_THEME_PREIMAGE_GET_CLASS (theme)->clear_sized_theme_data;
+ void (* clear_sized_theme_data) (ArCardThemePreimage *) =
+ AR_CARD_THEME_PREIMAGE_GET_CLASS (theme)->clear_sized_theme_data;
if (clear_sized_theme_data)
clear_sized_theme_data (theme);
}
static gboolean
-games_card_theme_preimage_load (GamesCardTheme *card_theme,
+ar_card_theme_preimage_load (ArCardTheme *card_theme,
GError **error)
{
- GamesCardThemePreimage *theme = (GamesCardThemePreimage *) card_theme;
- GamesCardThemeInfo *theme_info = card_theme->theme_info;
+ ArCardThemePreimage *theme = (ArCardThemePreimage *) card_theme;
+ ArCardThemeInfo *theme_info = card_theme->theme_info;
const char *slot_dir;
char *path;
@@ -81,9 +81,9 @@ games_card_theme_preimage_load (GamesCardTheme *card_theme,
if (!theme->cards_preimage)
return FALSE;
- if (GAMES_CARD_THEME_PREIMAGE_GET_CLASS (theme)->needs_scalable_cards &&
+ if (AR_CARD_THEME_PREIMAGE_GET_CLASS (theme)->needs_scalable_cards &&
!games_preimage_is_scalable (theme->cards_preimage)) {
- g_set_error (error, GAMES_CARD_THEME_ERROR, GAMES_CARD_THEME_ERROR_NOT_SCALABLE,
+ g_set_error (error, AR_CARD_THEME_ERROR, AR_CARD_THEME_ERROR_NOT_SCALABLE,
"Theme is not scalable");
return FALSE;
}
@@ -97,7 +97,7 @@ games_card_theme_preimage_load (GamesCardTheme *card_theme,
}
static void
-games_card_theme_preimage_init (GamesCardThemePreimage *theme)
+ar_card_theme_preimage_init (ArCardThemePreimage *theme)
{
theme->cards_preimage = NULL;
theme->slot_preimage = NULL;
@@ -110,11 +110,11 @@ games_card_theme_preimage_init (GamesCardThemePreimage *theme)
}
static void
-games_card_theme_preimage_finalize (GObject * object)
+ar_card_theme_preimage_finalize (GObject * object)
{
- GamesCardThemePreimage *theme = GAMES_CARD_THEME_PREIMAGE (object);
+ ArCardThemePreimage *theme = AR_CARD_THEME_PREIMAGE (object);
- _games_card_theme_preimage_clear_sized_theme_data (theme);
+ _ar_card_theme_preimage_clear_sized_theme_data (theme);
if (theme->cards_preimage != NULL) {
g_object_unref (theme->cards_preimage);
@@ -127,14 +127,14 @@ games_card_theme_preimage_finalize (GObject * object)
cairo_font_options_destroy (theme->font_options);
}
- G_OBJECT_CLASS (games_card_theme_preimage_parent_class)->finalize (object);
+ G_OBJECT_CLASS (ar_card_theme_preimage_parent_class)->finalize (object);
}
static void
-games_card_theme_preimage_set_font_options (GamesCardTheme *card_theme,
+ar_card_theme_preimage_set_font_options (ArCardTheme *card_theme,
const cairo_font_options_t *font_options)
{
- GamesCardThemePreimage *theme = (GamesCardThemePreimage *) card_theme;
+ ArCardThemePreimage *theme = (ArCardThemePreimage *) card_theme;
if (font_options &&
theme->font_options &&
@@ -151,17 +151,17 @@ games_card_theme_preimage_set_font_options (GamesCardTheme *card_theme,
theme->font_options = NULL;
}
- _games_card_theme_preimage_clear_sized_theme_data (theme);
- _games_card_theme_emit_changed (card_theme);
+ _ar_card_theme_preimage_clear_sized_theme_data (theme);
+ _ar_card_theme_emit_changed (card_theme);
}
static gboolean
-games_card_theme_preimage_set_card_size (GamesCardTheme *card_theme,
+ar_card_theme_preimage_set_card_size (ArCardTheme *card_theme,
int width,
int height,
double proportion)
{
- GamesCardThemePreimage *theme = (GamesCardThemePreimage *) card_theme;
+ ArCardThemePreimage *theme = (ArCardThemePreimage *) card_theme;
double aspect_ratio, twidth, theight;
if ((width == theme->slot_size.width) &&
@@ -174,7 +174,7 @@ games_card_theme_preimage_set_card_size (GamesCardTheme *card_theme,
/* Now calculate the card size: find the maximum size that fits
* into the given area, preserving the card's aspect ratio.
*/
- aspect_ratio = games_card_theme_get_aspect (card_theme);
+ aspect_ratio = ar_card_theme_get_aspect (card_theme);
twidth = proportion * width;
theight = proportion * height;
@@ -191,25 +191,25 @@ games_card_theme_preimage_set_card_size (GamesCardTheme *card_theme,
theme->card_size.width = twidth;
theme->card_size.height = theight;
- _games_card_theme_preimage_clear_sized_theme_data (theme);
- _games_card_theme_emit_changed (card_theme);
+ _ar_card_theme_preimage_clear_sized_theme_data (theme);
+ _ar_card_theme_emit_changed (card_theme);
return TRUE;
}
static void
-games_card_theme_preimage_get_card_size (GamesCardTheme *card_theme,
+ar_card_theme_preimage_get_card_size (ArCardTheme *card_theme,
CardSize *size)
{
- GamesCardThemePreimage *theme = (GamesCardThemePreimage *) card_theme;
+ ArCardThemePreimage *theme = (ArCardThemePreimage *) card_theme;
*size = theme->card_size;
}
static double
-games_card_theme_preimage_get_card_aspect (GamesCardTheme* card_theme)
+ar_card_theme_preimage_get_card_aspect (ArCardTheme* card_theme)
{
- GamesCardThemePreimage *theme = (GamesCardThemePreimage *) card_theme;
+ ArCardThemePreimage *theme = (ArCardThemePreimage *) card_theme;
double aspect;
aspect =
(((double) games_preimage_get_width (theme->cards_preimage))
@@ -220,13 +220,13 @@ aspect =
return aspect;
}
-static GamesCardThemeInfo *
-games_card_theme_preimage_class_get_theme_info (GamesCardThemeClass *klass,
+static ArCardThemeInfo *
+ar_card_theme_preimage_class_get_theme_info (ArCardThemeClass *klass,
const char *path,
const char *filename)
{
#ifdef HAVE_RSVG
- GamesCardThemeInfo *info;
+ ArCardThemeInfo *info;
char *display_name;
if (!g_str_has_suffix (filename, ".svg")
@@ -237,7 +237,7 @@ games_card_theme_preimage_class_get_theme_info (GamesCardThemeClass *klass,
return NULL;
display_name = games_filename_to_display_name (filename);
- info = _games_card_theme_info_new (G_OBJECT_CLASS_TYPE (klass),
+ info = _ar_card_theme_info_new (G_OBJECT_CLASS_TYPE (klass),
path,
filename,
display_name /* adopts */,
@@ -251,19 +251,19 @@ games_card_theme_preimage_class_get_theme_info (GamesCardThemeClass *klass,
}
static void
-games_card_theme_preimage_class_init (GamesCardThemePreimageClass * klass)
+ar_card_theme_preimage_class_init (ArCardThemePreimageClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GamesCardThemeClass *theme_class = GAMES_CARD_THEME_CLASS (klass);
+ ArCardThemeClass *theme_class = AR_CARD_THEME_CLASS (klass);
- gobject_class->finalize = games_card_theme_preimage_finalize;
+ gobject_class->finalize = ar_card_theme_preimage_finalize;
- theme_class->get_theme_info = games_card_theme_preimage_class_get_theme_info;
+ theme_class->get_theme_info = ar_card_theme_preimage_class_get_theme_info;
- theme_class->load = games_card_theme_preimage_load;
- theme_class->set_card_size = games_card_theme_preimage_set_card_size;
- theme_class->get_card_size = games_card_theme_preimage_get_card_size;
- theme_class->get_card_aspect = games_card_theme_preimage_get_card_aspect;
+ theme_class->load = ar_card_theme_preimage_load;
+ theme_class->set_card_size = ar_card_theme_preimage_set_card_size;
+ theme_class->get_card_size = ar_card_theme_preimage_get_card_size;
+ theme_class->get_card_aspect = ar_card_theme_preimage_get_card_aspect;
theme_class->get_card_pixbuf = NULL;
- theme_class->set_font_options = games_card_theme_preimage_set_font_options;
+ theme_class->set_font_options = ar_card_theme_preimage_set_font_options;
}
diff --git a/aisleriot/lib/ar-card-theme-private.h b/aisleriot/lib/ar-card-theme-private.h
new file mode 100644
index 0000000..5943520
--- /dev/null
+++ b/aisleriot/lib/ar-card-theme-private.h
@@ -0,0 +1,261 @@
+/*
+ Copyright © 2004 Callum McKenzie
+ Copyright © 2007, 2008, 2009 Christian Persch
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ar-card.h"
+
+#ifdef HAVE_RSVG
+#include <libgames-support/games-preimage.h>
+#endif
+
+#define FLOAT_TO_INT_CEIL(f) ((int) (f + 0.5f))
+
+/* ArCardThemeInfo */
+
+struct _ArCardThemeInfo {
+ int ref_count;
+ GType type;
+ char *path;
+ char *filename;
+ char *display_name;
+ char *pref_name;
+
+ gpointer data;
+ GDestroyNotify destroy_notify;
+};
+
+ArCardThemeInfo *_ar_card_theme_info_new (GType type,
+ const char *path,
+ const char *filename,
+ char *display_name /* adopts */,
+ char *pref_name /* adopts */,
+ gpointer data,
+ GDestroyNotify destroy_notify);
+
+guint _ar_card_theme_info_hash (const ArCardThemeInfo *a);
+
+int _ar_card_theme_info_collate (const ArCardThemeInfo *a,
+ const ArCardThemeInfo *b);
+
+/* ArCardTheme */
+
+/* Return TRUE to continue, FALSE to abort */
+typedef gboolean (* ArCardThemeForeachFunc) (ArCardThemeClass *klass,
+ const char *path,
+ gpointer data);
+
+struct _ArCardThemeClass {
+ GObjectClass parent_class;
+
+ /* class vfuncs */
+ ArCardThemeInfo * (* get_theme_info) (ArCardThemeClass *klass,
+ const char *dir,
+ const char *filename);
+ gboolean (* foreach_theme_dir) (ArCardThemeClass *klass,
+ ArCardThemeForeachFunc,
+ gpointer data);
+
+ /* vfuncs */
+ gboolean (* load) (ArCardTheme *theme,
+ GError **error);
+ gboolean (* set_card_size) (ArCardTheme *theme,
+ int width,
+ int height,
+ double proportion);
+ void (* get_card_size) (ArCardTheme *theme,
+ CardSize *size);
+ double (* get_card_aspect) (ArCardTheme *theme);
+ GdkPixbuf* (* get_card_pixbuf) (ArCardTheme *theme,
+ int card_id);
+
+#if GTK_CHECK_VERSION (2, 10, 0)
+ void (* set_font_options) (ArCardTheme *theme,
+ const cairo_font_options_t *font_options);
+#endif
+};
+
+struct _ArCardTheme {
+ GObject parent;
+
+ ArCardThemeClass *klass;
+
+ ArCardThemeInfo *theme_info;
+};
+
+void _ar_card_theme_class_get_theme_infos (ArCardThemeClass *klass,
+ GList **list);
+ArCardThemeInfo *_ar_card_theme_class_get_theme_info (ArCardThemeClass *klass,
+ const char *dir,
+ const char *filename);
+
+gboolean _ar_card_theme_class_foreach_theme_dir (ArCardThemeClass *klass,
+ ArCardThemeForeachFunc callback,
+ gpointer data);
+gboolean _ar_card_theme_class_foreach_env (ArCardThemeClass *klass,
+ const char *env,
+ ArCardThemeForeachFunc callback,
+ gpointer data);
+
+void _ar_card_theme_emit_changed (ArCardTheme *theme);
+
+#ifdef HAVE_RSVG
+
+/* ArCardThemePreimage (abstract) */
+
+#define AR_TYPE_CARD_THEME_PREIMAGE (ar_card_theme_preimage_get_type ())
+#define AR_CARD_THEME_PREIMAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AR_TYPE_CARD_THEME_PREIMAGE, ArCardThemePreimage))
+#define AR_CARD_THEME_PREIMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AR_TYPE_CARD_THEME_PREIMAGE, ArCardThemePreimageClass))
+#define AR_IS_CARD_THEME_PREIMAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AR_TYPE_CARD_THEME_PREIMAGE))
+#define AR_IS_CARD_THEME_PREIMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AR_TYPE_CARD_THEME_PREIMAGE))
+#define AR_CARD_THEME_PREIMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AR_TYPE_CARD_THEME_PREIMAGE, ArCardThemePreimageClass))
+
+typedef struct _ArCardThemePreimageClass ArCardThemePreimageClass;
+typedef struct _ArCardThemePreimage ArCardThemePreimage;
+
+struct _ArCardThemePreimageClass {
+ ArCardThemeClass parent_class;
+
+ gboolean needs_scalable_cards;
+
+ void (* clear_sized_theme_data) (ArCardThemePreimage *card_theme);
+};
+
+struct _ArCardThemePreimage {
+ ArCardTheme parent_instance;
+
+ char *theme_dir;
+ char *theme_name;
+
+ GamesPreimage *cards_preimage;
+ GamesPreimage *slot_preimage;
+ GdkPixbuf *source;
+ CardSize subsize;
+
+ CardSize slot_size;
+ CardSize card_size;
+
+ guint size_available : 1;
+
+ cairo_font_options_t *font_options;
+};
+
+GType ar_card_theme_preimage_get_type (void);
+
+void _ar_card_theme_preimage_clear_sized_theme_data (ArCardThemePreimage *theme);
+
+/* ArCardThemeSVG */
+
+#ifdef ENABLE_CARD_THEME_FORMAT_SVG
+
+#define AR_TYPE_CARD_THEME_SVG (ar_card_theme_svg_get_type ())
+#define AR_CARD_THEME_SVG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AR_TYPE_CARD_THEME_SVG, ArCardThemeSVG))
+#define AR_CARD_THEME_SVG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AR_TYPE_CARD_THEME_SVG, ArCardThemeSVGClass))
+#define AR_IS_CARD_THEME_SVG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AR_TYPE_CARD_THEME_SVG))
+#define AR_IS_CARD_THEME_SVG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AR_TYPE_CARD_THEME_SVG))
+#define AR_CARD_THEME_SVG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AR_TYPE_CARD_THEME_SVG, ArCardThemeSVGClass))
+
+typedef struct _ArCardThemeSVGClass ArCardThemeSVGClass;
+typedef struct _ArCardThemeSVG ArCardThemeSVG;
+
+GType ar_card_theme_svg_get_type (void);
+
+ArCardTheme* ar_card_theme_svg_new (void);
+
+#endif /* ENABLE_CARD_THEME_FORMAT_SVG */
+
+/* ArCardThemeKDE */
+
+#ifdef ENABLE_CARD_THEME_FORMAT_KDE
+
+#define AR_TYPE_CARD_THEME_KDE (ar_card_theme_kde_get_type ())
+#define AR_CARD_THEME_KDE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AR_TYPE_CARD_THEME_KDE, ArCardThemeKDE))
+#define AR_CARD_THEME_KDE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AR_TYPE_CARD_THEME_KDE, ArCardThemeKDEClass))
+#define AR_IS_CARD_THEME_KDE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AR_TYPE_CARD_THEME_KDE))
+#define AR_IS_CARD_THEME_KDE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AR_TYPE_CARD_THEME_KDE))
+#define AR_CARD_THEME_KDE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AR_TYPE_CARD_THEME_KDE, ArCardThemeKDEClass))
+
+typedef struct _ArCardThemeKDEClass ArCardThemeKDEClass;
+typedef struct _ArCardThemeKDE ArCardThemeKDE;
+
+GType ar_card_theme_kde_get_type (void);
+
+ArCardTheme* ar_card_theme_kde_new (void);
+
+#endif /* ENABLE_CARD_THEME_FORMAT_KDE */
+
+/* */
+
+#endif /* HAVE_RSVG */
+
+/* ArCardThemeSliced */
+
+#ifdef ENABLE_CARD_THEME_FORMAT_SLICED
+
+#define AR_TYPE_CARD_THEME_SLICED (ar_card_theme_sliced_get_type ())
+#define AR_CARD_THEME_SLICED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AR_TYPE_CARD_THEME_SLICED, ArCardThemeSliced))
+#define AR_CARD_THEME_SLICED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AR_TYPE_CARD_THEME_SLICED, ArCardThemeSlicedClass))
+#define AR_IS_CARD_THEME_SLICED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AR_TYPE_CARD_THEME_SLICED))
+#define AR_IS_CARD_THEME_SLICED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AR_TYPE_CARD_THEME_SLICED))
+#define AR_CARD_THEME_SLICED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AR_TYPE_CARD_THEME_SLICED, ArCardThemeSlicedClass))
+
+typedef struct _ArCardThemeSlicedClass ArCardThemeSlicedClass;
+typedef struct _ArCardThemeSliced ArCardThemeSliced;
+
+GType ar_card_theme_sliced_get_type (void);
+
+ArCardTheme* ar_card_theme_sliced_new (void);
+
+#endif /* ENABLE_CARD_THEME_FORMAT_SLICED */
+
+/* ArCardThemeFixed */
+
+#ifdef ENABLE_CARD_THEME_FORMAT_FIXED
+
+#define AR_TYPE_CARD_THEME_FIXED (ar_card_theme_fixed_get_type ())
+#define AR_CARD_THEME_FIXED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AR_TYPE_CARD_THEME_FIXED, ArCardThemeFixed))
+#define AR_CARD_THEME_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AR_TYPE_CARD_THEME_FIXED, ArCardThemeFixedClass))
+#define AR_IS_CARD_THEME_FIXED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AR_TYPE_CARD_THEME_FIXED))
+#define AR_IS_CARD_THEME_FIXED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AR_TYPE_CARD_THEME_FIXED))
+#define AR_CARD_THEME_FIXED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AR_TYPE_CARD_THEME_FIXED, ArCardThemeFixedClass))
+
+typedef struct _ArCardThemeFixedClass ArCardThemeFixedClass;
+typedef struct _ArCardThemeFixed ArCardThemeFixed;
+
+GType ar_card_theme_fixed_get_type (void);
+
+ArCardTheme* ar_card_theme_fixed_new (void);
+
+#endif /* ENABLE_CARD_THEME_FORMAT_FIXED */
+/* ArCardThemePysol */
+
+#ifdef ENABLE_CARD_THEME_FORMAT_PYSOL
+
+#define AR_TYPE_CARD_THEME_PYSOL (ar_card_theme_pysol_get_type ())
+#define AR_CARD_THEME_PYSOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AR_TYPE_CARD_THEME_PYSOL, ArCardThemePysol))
+#define AR_CARD_THEME_PYSOL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AR_TYPE_CARD_THEME_PYSOL, ArCardThemePysolClass))
+#define AR_IS_CARD_THEME_PYSOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AR_TYPE_CARD_THEME_PYSOL))
+#define AR_IS_CARD_THEME_PYSOL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AR_TYPE_CARD_THEME_PYSOL))
+#define AR_CARD_THEME_PYSOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AR_TYPE_CARD_THEME_PYSOL, ArCardThemePysolClass))
+
+typedef struct _ArCardThemePysolClass ArCardThemePysolClass;
+typedef struct _ArCardThemePysol ArCardThemePysol;
+
+GType ar_card_theme_pysol_get_type (void);
+
+ArCardTheme* ar_card_theme_pysol_new (void);
+
+#endif /* ENABLE_CARD_THEME_FORMAT_PYSOL */
diff --git a/libgames-support/games-card-theme-pysol.c b/aisleriot/lib/ar-card-theme-pysol.c
similarity index 82%
rename from libgames-support/games-card-theme-pysol.c
rename to aisleriot/lib/ar-card-theme-pysol.c
index 6cdc124..52ff312 100644
--- a/libgames-support/games-card-theme-pysol.c
+++ b/aisleriot/lib/ar-card-theme-pysol.c
@@ -24,19 +24,19 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
-#include "games-debug.h"
-#include "games-runtime.h"
-#include "games-string-utils.h"
+#include <libgames-support/games-debug.h>
+#include <libgames-support/games-runtime.h>
+#include <libgames-support/games-string-utils.h>
-#include "games-card-theme.h"
-#include "games-card-theme-private.h"
+#include "ar-card-theme.h"
+#include "ar-card-theme-private.h"
-struct _GamesCardThemePysolClass {
- GamesCardThemeClass parent_class;
+struct _ArCardThemePysolClass {
+ ArCardThemeClass parent_class;
};
-struct _GamesCardThemePysol {
- GamesCardTheme parent_instance;
+struct _ArCardThemePysol {
+ ArCardTheme parent_instance;
};
enum {
@@ -287,10 +287,10 @@ out:
/* Class implementation */
-G_DEFINE_TYPE (GamesCardThemePysol, games_card_theme_pysol, GAMES_TYPE_CARD_THEME);
+G_DEFINE_TYPE (ArCardThemePysol, ar_card_theme_pysol, AR_TYPE_CARD_THEME);
static gboolean
-games_card_theme_pysol_load (GamesCardTheme *card_theme,
+ar_card_theme_pysol_load (ArCardTheme *card_theme,
GError **error)
{
/* nothing more to do here, we have all the info in our PySolConfigTxtData */
@@ -298,12 +298,12 @@ games_card_theme_pysol_load (GamesCardTheme *card_theme,
}
static void
-games_card_theme_pysol_init (GamesCardThemePysol *theme)
+ar_card_theme_pysol_init (ArCardThemePysol *theme)
{
}
static gboolean
-games_card_theme_pysol_set_card_size (GamesCardTheme *card_theme,
+ar_card_theme_pysol_set_card_size (ArCardTheme *card_theme,
int width,
int height,
double proportion)
@@ -313,17 +313,17 @@ games_card_theme_pysol_set_card_size (GamesCardTheme *card_theme,
}
static void
-games_card_theme_pysol_get_card_size (GamesCardTheme *card_theme,
+ar_card_theme_pysol_get_card_size (ArCardTheme *card_theme,
CardSize *size)
{
- GamesCardThemeInfo *theme_info = card_theme->theme_info;
+ ArCardThemeInfo *theme_info = card_theme->theme_info;
PySolConfigTxtData *pysol_data = theme_info->data;
*size = pysol_data->card_size;
}
static double
-games_card_theme_pysol_get_card_aspect (GamesCardTheme *card_theme)
+ar_card_theme_pysol_get_card_aspect (ArCardTheme *card_theme)
{
PySolConfigTxtData *pysol_data = card_theme->theme_info->data;
@@ -331,7 +331,7 @@ games_card_theme_pysol_get_card_aspect (GamesCardTheme *card_theme)
}
static GdkPixbuf *
-games_card_theme_pysol_get_card_pixbuf (GamesCardTheme *card_theme,
+ar_card_theme_pysol_get_card_pixbuf (ArCardTheme *card_theme,
int card_id)
{
PySolConfigTxtData *data = card_theme->theme_info->data;
@@ -339,9 +339,9 @@ games_card_theme_pysol_get_card_pixbuf (GamesCardTheme *card_theme,
char *path;
GError *error = NULL;
- if (G_UNLIKELY (card_id == GAMES_CARD_SLOT)) {
+ if (G_UNLIKELY (card_id == AR_CARD_SLOT)) {
path = g_build_filename (data->base_path, "bottom01.gif" /* FIXMEchpe ext! */, NULL);
- } else if (G_UNLIKELY (card_id == GAMES_CARD_BACK)) {
+ } else if (G_UNLIKELY (card_id == AR_CARD_BACK)) {
path = g_build_filename (data->base_path, data->backs[data->back_index], NULL);
} else {
static const char suit_char[] = "cdhs";
@@ -371,12 +371,12 @@ games_card_theme_pysol_get_card_pixbuf (GamesCardTheme *card_theme,
return pixbuf;
}
-static GamesCardThemeInfo *
-games_card_theme_pysol_class_get_theme_info (GamesCardThemeClass *klass,
+static ArCardThemeInfo *
+ar_card_theme_pysol_class_get_theme_info (ArCardThemeClass *klass,
const char *path,
const char *filename)
{
- GamesCardThemeInfo *info = NULL;
+ ArCardThemeInfo *info = NULL;
PySolConfigTxtData *pysol_data;
char *display_name, *pref_name;
@@ -389,7 +389,7 @@ games_card_theme_pysol_class_get_theme_info (GamesCardThemeClass *klass,
display_name = g_strdup_printf ("%s (PySol)", pysol_data->name);
pref_name = g_strdup_printf ("pysol:%s", filename);
- info = _games_card_theme_info_new (G_OBJECT_CLASS_TYPE (klass),
+ info = _ar_card_theme_info_new (G_OBJECT_CLASS_TYPE (klass),
path,
filename,
display_name /* adopts */,
@@ -401,11 +401,11 @@ games_card_theme_pysol_class_get_theme_info (GamesCardThemeClass *klass,
}
static gboolean
-games_card_theme_pysol_class_foreach_theme_dir (GamesCardThemeClass *klass,
- GamesCardThemeForeachFunc callback,
+ar_card_theme_pysol_class_foreach_theme_dir (ArCardThemeClass *klass,
+ ArCardThemeForeachFunc callback,
gpointer data)
{
- if (!_games_card_theme_class_foreach_env (klass, "GAMES_CARD_THEME_PATH_PYSOL", callback, data))
+ if (!_ar_card_theme_class_foreach_env (klass, "AR_CARD_THEME_PATH_PYSOL", callback, data))
return FALSE;
/* FIXMEchpe: is this univeral or ubuntu specific? */
@@ -413,12 +413,12 @@ games_card_theme_pysol_class_foreach_theme_dir (GamesCardThemeClass *klass,
}
static void
-games_card_theme_pysol_get_property (GObject *object,
+ar_card_theme_pysol_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
- GamesCardTheme *card_theme = GAMES_CARD_THEME (object);
+ ArCardTheme *card_theme = AR_CARD_THEME (object);
PySolConfigTxtData *data = card_theme->theme_info->data;
switch (property_id) {
@@ -436,12 +436,12 @@ games_card_theme_pysol_get_property (GObject *object,
}
static void
-games_card_theme_pysol_set_property (GObject *object,
+ar_card_theme_pysol_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
- GamesCardTheme *card_theme = GAMES_CARD_THEME (object);
+ ArCardTheme *card_theme = AR_CARD_THEME (object);
PySolConfigTxtData *data = card_theme->theme_info->data;
switch (property_id) {
@@ -456,7 +456,7 @@ games_card_theme_pysol_set_property (GObject *object,
}
/* FIXMEchpe don't invalidate the whole thing, just the BACK card */
- _games_card_theme_emit_changed (card_theme);
+ _ar_card_theme_emit_changed (card_theme);
break;
}
@@ -468,22 +468,22 @@ games_card_theme_pysol_set_property (GObject *object,
}
static void
-games_card_theme_pysol_class_init (GamesCardThemePysolClass * klass)
+ar_card_theme_pysol_class_init (ArCardThemePysolClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GamesCardThemeClass *theme_class = GAMES_CARD_THEME_CLASS (klass);
+ ArCardThemeClass *theme_class = AR_CARD_THEME_CLASS (klass);
- gobject_class->get_property = games_card_theme_pysol_get_property;
- gobject_class->set_property = games_card_theme_pysol_set_property;
+ gobject_class->get_property = ar_card_theme_pysol_get_property;
+ gobject_class->set_property = ar_card_theme_pysol_set_property;
- theme_class->get_theme_info = games_card_theme_pysol_class_get_theme_info;
- theme_class->foreach_theme_dir = games_card_theme_pysol_class_foreach_theme_dir;
+ theme_class->get_theme_info = ar_card_theme_pysol_class_get_theme_info;
+ theme_class->foreach_theme_dir = ar_card_theme_pysol_class_foreach_theme_dir;
- theme_class->load = games_card_theme_pysol_load;
- theme_class->set_card_size = games_card_theme_pysol_set_card_size;
- theme_class->get_card_size = games_card_theme_pysol_get_card_size;
- theme_class->get_card_aspect = games_card_theme_pysol_get_card_aspect;
- theme_class->get_card_pixbuf = games_card_theme_pysol_get_card_pixbuf;
+ theme_class->load = ar_card_theme_pysol_load;
+ theme_class->set_card_size = ar_card_theme_pysol_set_card_size;
+ theme_class->get_card_size = ar_card_theme_pysol_get_card_size;
+ theme_class->get_card_aspect = ar_card_theme_pysol_get_card_aspect;
+ theme_class->get_card_pixbuf = ar_card_theme_pysol_get_card_pixbuf;
g_object_class_install_property
(gobject_class,
@@ -505,12 +505,12 @@ games_card_theme_pysol_class_init (GamesCardThemePysolClass * klass)
/* public API */
/**
- * games_card_theme_pysol_new:
+ * ar_card_theme_pysol_new:
*
- * Returns: a new #GamesCardThemePysol
+ * Returns: a new #ArCardThemePysol
*/
-GamesCardTheme *
-games_card_theme_pysol_new (void)
+ArCardTheme *
+ar_card_theme_pysol_new (void)
{
- return g_object_new (GAMES_TYPE_CARD_THEME_PYSOL, NULL);
+ return g_object_new (AR_TYPE_CARD_THEME_PYSOL, NULL);
}
diff --git a/libgames-support/games-card-theme-sliced.c b/aisleriot/lib/ar-card-theme-sliced.c
similarity index 62%
rename from libgames-support/games-card-theme-sliced.c
rename to aisleriot/lib/ar-card-theme-sliced.c
index ee1657d..5d822dd 100644
--- a/libgames-support/games-card-theme-sliced.c
+++ b/aisleriot/lib/ar-card-theme-sliced.c
@@ -25,20 +25,20 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
-#include "games-preimage.h"
-#include "games-profile.h"
-#include "games-runtime.h"
-#include "games-string-utils.h"
+#include <libgames-support/games-preimage.h>
+#include <libgames-support/games-profile.h>
+#include <libgames-support/games-runtime.h>
+#include <libgames-support/games-string-utils.h>
-#include "games-card-theme.h"
-#include "games-card-theme-private.h"
+#include "ar-card-theme.h"
+#include "ar-card-theme-private.h"
-struct _GamesCardThemeSlicedClass {
- GamesCardThemePreimageClass parent_class;
+struct _ArCardThemeSlicedClass {
+ ArCardThemePreimageClass parent_class;
};
-struct _GamesCardThemeSliced {
- GamesCardThemePreimage parent_instance;
+struct _ArCardThemeSliced {
+ ArCardThemePreimage parent_instance;
GdkPixbuf *source;
CardSize subsize;
@@ -53,12 +53,12 @@ struct _GamesCardThemeSliced {
/* Class implementation */
-G_DEFINE_TYPE (GamesCardThemeSliced, games_card_theme_sliced, GAMES_TYPE_CARD_THEME_PREIMAGE);
+G_DEFINE_TYPE (ArCardThemeSliced, ar_card_theme_sliced, AR_TYPE_CARD_THEME_PREIMAGE);
static void
-games_card_theme_sliced_clear_sized_theme_data (GamesCardThemePreimage *preimage_card_theme)
+ar_card_theme_sliced_clear_sized_theme_data (ArCardThemePreimage *preimage_card_theme)
{
- GamesCardThemeSliced *theme = GAMES_CARD_THEME_SLICED (preimage_card_theme);
+ ArCardThemeSliced *theme = AR_CARD_THEME_SLICED (preimage_card_theme);
if (theme->scalable &&
theme->source) {
@@ -68,13 +68,13 @@ games_card_theme_sliced_clear_sized_theme_data (GamesCardThemePreimage *preimage
}
static gboolean
-games_card_theme_sliced_load (GamesCardTheme *card_theme,
+ar_card_theme_sliced_load (ArCardTheme *card_theme,
GError **error)
{
- GamesCardThemePreimage *preimage_card_theme = (GamesCardThemePreimage *) card_theme;
- GamesCardThemeSliced *theme = (GamesCardThemeSliced *) card_theme;
+ ArCardThemePreimage *preimage_card_theme = (ArCardThemePreimage *) card_theme;
+ ArCardThemeSliced *theme = (ArCardThemeSliced *) card_theme;
- if (!GAMES_CARD_THEME_CLASS (games_card_theme_sliced_parent_class)->load (card_theme, error))
+ if (!AR_CARD_THEME_CLASS (ar_card_theme_sliced_parent_class)->load (card_theme, error))
return FALSE;
/* If we don't have a scalable format, build an unscaled pixbuf that we'll cut up later */
@@ -93,19 +93,19 @@ games_card_theme_sliced_load (GamesCardTheme *card_theme,
}
static gboolean
-games_card_theme_sliced_prerender_scalable (GamesCardThemeSliced *theme)
+ar_card_theme_sliced_prerender_scalable (ArCardThemeSliced *theme)
{
- GamesCardThemePreimage *preimage_card_theme = (GamesCardThemePreimage *) theme;
+ ArCardThemePreimage *preimage_card_theme = (ArCardThemePreimage *) theme;
g_assert (theme->source == NULL);
- _games_profile_start ("prerendering source pixbuf for %s card theme %s", G_OBJECT_TYPE_NAME (theme), ((GamesCardTheme*)theme)->theme_info->display_name);
+ _games_profile_start ("prerendering source pixbuf for %s card theme %s", G_OBJECT_TYPE_NAME (theme), ((ArCardTheme*)theme)->theme_info->display_name);
theme->source = games_preimage_render (preimage_card_theme->cards_preimage,
preimage_card_theme->card_size.width * 13,
preimage_card_theme->card_size.height * 5);
- _games_profile_end ("prerendering source pixbuf for %s card theme %s", G_OBJECT_TYPE_NAME (theme), ((GamesCardTheme*)theme)->theme_info->display_name);
+ _games_profile_end ("prerendering source pixbuf for %s card theme %s", G_OBJECT_TYPE_NAME (theme), ((ArCardTheme*)theme)->theme_info->display_name);
if (!theme->source)
return FALSE;
@@ -117,15 +117,15 @@ games_card_theme_sliced_prerender_scalable (GamesCardThemeSliced *theme)
}
static GdkPixbuf *
-games_card_theme_sliced_get_card_pixbuf (GamesCardTheme *card_theme,
+ar_card_theme_sliced_get_card_pixbuf (ArCardTheme *card_theme,
int card_id)
{
- GamesCardThemePreimage *preimage_card_theme = (GamesCardThemePreimage *) card_theme;
- GamesCardThemeSliced *theme = (GamesCardThemeSliced *) card_theme;
+ ArCardThemePreimage *preimage_card_theme = (ArCardThemePreimage *) card_theme;
+ ArCardThemeSliced *theme = (ArCardThemeSliced *) card_theme;
GdkPixbuf *subpixbuf, *card_pixbuf;
int suit, rank;
- if (G_UNLIKELY (card_id == GAMES_CARD_SLOT)) {
+ if (G_UNLIKELY (card_id == AR_CARD_SLOT)) {
subpixbuf = games_preimage_render (preimage_card_theme->slot_preimage,
preimage_card_theme->card_size.width,
preimage_card_theme->card_size.height);
@@ -138,7 +138,7 @@ games_card_theme_sliced_get_card_pixbuf (GamesCardTheme *card_theme,
if (!theme->source &&
(!theme->scalable ||
- !games_card_theme_sliced_prerender_scalable (theme)))
+ !ar_card_theme_sliced_prerender_scalable (theme)))
return NULL;
subpixbuf = gdk_pixbuf_new_subpixbuf (theme->source,
@@ -162,30 +162,30 @@ games_card_theme_sliced_get_card_pixbuf (GamesCardTheme *card_theme,
}
static void
-games_card_theme_sliced_init (GamesCardThemeSliced *theme)
+ar_card_theme_sliced_init (ArCardThemeSliced *theme)
{
theme->subsize.width = theme->subsize.height = -1;
}
static void
-games_card_theme_sliced_finalize (GObject * object)
+ar_card_theme_sliced_finalize (GObject * object)
{
- GamesCardThemeSliced *theme = GAMES_CARD_THEME_SLICED (object);
+ ArCardThemeSliced *theme = AR_CARD_THEME_SLICED (object);
theme->scalable = TRUE; /* so the call to clear unrefs the source pixbuf */
- G_OBJECT_CLASS (games_card_theme_sliced_parent_class)->finalize (object);
+ G_OBJECT_CLASS (ar_card_theme_sliced_parent_class)->finalize (object);
}
-static GamesCardThemeInfo *
-games_card_theme_sliced_class_get_theme_info (GamesCardThemeClass *klass,
+static ArCardThemeInfo *
+ar_card_theme_sliced_class_get_theme_info (ArCardThemeClass *klass,
const char *path,
const char *filename)
{
- GamesCardThemeInfo *info;
+ ArCardThemeInfo *info;
char *name, *display_name, *pref_name;
- info = GAMES_CARD_THEME_CLASS (games_card_theme_sliced_parent_class)->get_theme_info (klass, path, filename);
+ info = AR_CARD_THEME_CLASS (ar_card_theme_sliced_parent_class)->get_theme_info (klass, path, filename);
if (info) {
g_assert (info->pref_name == NULL);
info->pref_name = g_strdup_printf ("sliced:%s", filename);
@@ -199,7 +199,7 @@ games_card_theme_sliced_class_get_theme_info (GamesCardThemeClass *klass,
name = games_filename_to_display_name (filename);
display_name = g_strdup_printf ("%s (Ugly)", name);
pref_name = g_strdup_printf ("sliced:%s", filename);
- info = _games_card_theme_info_new (G_OBJECT_CLASS_TYPE (klass),
+ info = _ar_card_theme_info_new (G_OBJECT_CLASS_TYPE (klass),
path,
filename,
display_name /* adopts */,
@@ -211,14 +211,14 @@ games_card_theme_sliced_class_get_theme_info (GamesCardThemeClass *klass,
}
static gboolean
-games_card_theme_sliced_class_foreach_theme_dir (GamesCardThemeClass *klass,
- GamesCardThemeForeachFunc callback,
+ar_card_theme_sliced_class_foreach_theme_dir (ArCardThemeClass *klass,
+ ArCardThemeForeachFunc callback,
gpointer data)
{
char *dir;
gboolean retval;
- if (!_games_card_theme_class_foreach_env (klass, "GAMES_CARD_THEME_PATH_SLICED", callback, data))
+ if (!_ar_card_theme_class_foreach_env (klass, "AR_CARD_THEME_PATH_SLICED", callback, data))
return FALSE;
/* Themes in the pre-2.19 theme format: $(datadir)/pixmaps/gnome-games-common/cards */
@@ -231,33 +231,33 @@ games_card_theme_sliced_class_foreach_theme_dir (GamesCardThemeClass *klass,
}
static void
-games_card_theme_sliced_class_init (GamesCardThemeSlicedClass * klass)
+ar_card_theme_sliced_class_init (ArCardThemeSlicedClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GamesCardThemeClass *theme_class = GAMES_CARD_THEME_CLASS (klass);
- GamesCardThemePreimageClass *preimage_theme_class = GAMES_CARD_THEME_PREIMAGE_CLASS (klass);
+ ArCardThemeClass *theme_class = AR_CARD_THEME_CLASS (klass);
+ ArCardThemePreimageClass *preimage_theme_class = AR_CARD_THEME_PREIMAGE_CLASS (klass);
- gobject_class->finalize = games_card_theme_sliced_finalize;
+ gobject_class->finalize = ar_card_theme_sliced_finalize;
- theme_class->get_theme_info = games_card_theme_sliced_class_get_theme_info;
- theme_class->foreach_theme_dir = games_card_theme_sliced_class_foreach_theme_dir;
+ theme_class->get_theme_info = ar_card_theme_sliced_class_get_theme_info;
+ theme_class->foreach_theme_dir = ar_card_theme_sliced_class_foreach_theme_dir;
- theme_class->load = games_card_theme_sliced_load;
- theme_class->get_card_pixbuf = games_card_theme_sliced_get_card_pixbuf;
+ theme_class->load = ar_card_theme_sliced_load;
+ theme_class->get_card_pixbuf = ar_card_theme_sliced_get_card_pixbuf;
preimage_theme_class->needs_scalable_cards = FALSE;
- preimage_theme_class->clear_sized_theme_data = games_card_theme_sliced_clear_sized_theme_data;
+ preimage_theme_class->clear_sized_theme_data = ar_card_theme_sliced_clear_sized_theme_data;
}
/* private API */
/**
- * games_card_theme_sliced_new:
+ * ar_card_theme_sliced_new:
*
- * Returns: a new #GamesCardThemeSliced
+ * Returns: a new #ArCardThemeSliced
*/
-GamesCardTheme*
-games_card_theme_sliced_new (void)
+ArCardTheme*
+ar_card_theme_sliced_new (void)
{
- return g_object_new (GAMES_TYPE_CARD_THEME_SLICED, NULL);
+ return g_object_new (AR_TYPE_CARD_THEME_SLICED, NULL);
}
diff --git a/libgames-support/games-card-theme-svg.c b/aisleriot/lib/ar-card-theme-svg.c
similarity index 63%
rename from libgames-support/games-card-theme-svg.c
rename to aisleriot/lib/ar-card-theme-svg.c
index 7991993..4685a35 100644
--- a/libgames-support/games-card-theme-svg.c
+++ b/aisleriot/lib/ar-card-theme-svg.c
@@ -25,20 +25,20 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
-#include "games-preimage.h"
-#include "games-preimage-private.h"
-#include "games-runtime.h"
-#include "games-string-utils.h"
+#include <libgames-support/games-preimage.h>
+#include <libgames-support/games-preimage-private.h>
+#include <libgames-support/games-runtime.h>
+#include <libgames-support/games-string-utils.h>
-#include "games-card-theme.h"
-#include "games-card-theme-private.h"
+#include "ar-card-theme.h"
+#include "ar-card-theme-private.h"
-struct _GamesCardThemeSVGClass {
- GamesCardThemePreimageClass parent_class;
+struct _ArCardThemeSVGClass {
+ ArCardThemePreimageClass parent_class;
};
-struct _GamesCardThemeSVG {
- GamesCardThemePreimage parent_instance;
+struct _ArCardThemeSVG {
+ ArCardThemePreimage parent_instance;
};
#define N_ROWS ((double) 5.0)
@@ -48,13 +48,13 @@ struct _GamesCardThemeSVG {
/* Class implementation */
-G_DEFINE_TYPE (GamesCardThemeSVG, games_card_theme_svg, GAMES_TYPE_CARD_THEME_PREIMAGE);
+G_DEFINE_TYPE (ArCardThemeSVG, ar_card_theme_svg, AR_TYPE_CARD_THEME_PREIMAGE);
static GdkPixbuf *
-games_card_theme_svg_get_card_pixbuf (GamesCardTheme *card_theme,
+ar_card_theme_svg_get_card_pixbuf (ArCardTheme *card_theme,
int card_id)
{
- GamesCardThemePreimage *preimage_card_theme = (GamesCardThemePreimage *) card_theme;
+ ArCardThemePreimage *preimage_card_theme = (ArCardThemePreimage *) card_theme;
GamesPreimage *preimage = preimage_card_theme->cards_preimage;
GdkPixbuf *subpixbuf;
int suit, rank;
@@ -64,7 +64,7 @@ games_card_theme_svg_get_card_pixbuf (GamesCardTheme *card_theme,
double zoomx, zoomy;
char node[32];
- if (G_UNLIKELY (card_id == GAMES_CARD_SLOT)) {
+ if (G_UNLIKELY (card_id == AR_CARD_SLOT)) {
subpixbuf = games_preimage_render (preimage_card_theme->slot_preimage,
preimage_card_theme->card_size.width,
preimage_card_theme->card_size.height);
@@ -87,7 +87,7 @@ games_card_theme_svg_get_card_pixbuf (GamesCardTheme *card_theme,
zoomx = width / card_width;
zoomy = height / card_height;
- games_card_get_node_by_suit_and_rank_snprintf (node, sizeof (node), suit, rank);
+ ar_card_get_node_by_suit_and_rank_snprintf (node, sizeof (node), suit, rank);
subpixbuf = games_preimage_render_sub (preimage,
node,
@@ -100,18 +100,18 @@ games_card_theme_svg_get_card_pixbuf (GamesCardTheme *card_theme,
}
static void
-games_card_theme_svg_init (GamesCardThemeSVG * cardtheme)
+ar_card_theme_svg_init (ArCardThemeSVG * cardtheme)
{
}
-static GamesCardThemeInfo *
-games_card_theme_svg_class_get_theme_info (GamesCardThemeClass *klass,
+static ArCardThemeInfo *
+ar_card_theme_svg_class_get_theme_info (ArCardThemeClass *klass,
const char *path,
const char *filename)
{
- GamesCardThemeInfo *info;
+ ArCardThemeInfo *info;
- info = GAMES_CARD_THEME_CLASS (games_card_theme_svg_parent_class)->get_theme_info (klass, path, filename);
+ info = AR_CARD_THEME_CLASS (ar_card_theme_svg_parent_class)->get_theme_info (klass, path, filename);
if (info) {
g_assert (info->pref_name == NULL);
@@ -127,26 +127,26 @@ games_card_theme_svg_class_get_theme_info (GamesCardThemeClass *klass,
}
static gboolean
-games_card_theme_svg_class_foreach_theme_dir (GamesCardThemeClass *klass,
- GamesCardThemeForeachFunc callback,
+ar_card_theme_svg_class_foreach_theme_dir (ArCardThemeClass *klass,
+ ArCardThemeForeachFunc callback,
gpointer data)
{
- if (!_games_card_theme_class_foreach_env (klass, "GAMES_CARD_THEME_PATH_SVG", callback, data))
+ if (!_ar_card_theme_class_foreach_env (klass, "AR_CARD_THEME_PATH_SVG", callback, data))
return FALSE;
return callback (klass, games_runtime_get_directory (GAMES_RUNTIME_SCALABLE_CARDS_DIRECTORY), data);
}
static void
-games_card_theme_svg_class_init (GamesCardThemeSVGClass * klass)
+ar_card_theme_svg_class_init (ArCardThemeSVGClass * klass)
{
- GamesCardThemeClass *theme_class = GAMES_CARD_THEME_CLASS (klass);
- GamesCardThemePreimageClass *preimage_theme_class = GAMES_CARD_THEME_PREIMAGE_CLASS (klass);
+ ArCardThemeClass *theme_class = AR_CARD_THEME_CLASS (klass);
+ ArCardThemePreimageClass *preimage_theme_class = AR_CARD_THEME_PREIMAGE_CLASS (klass);
- theme_class->get_theme_info = games_card_theme_svg_class_get_theme_info;
- theme_class->foreach_theme_dir = games_card_theme_svg_class_foreach_theme_dir;
+ theme_class->get_theme_info = ar_card_theme_svg_class_get_theme_info;
+ theme_class->foreach_theme_dir = ar_card_theme_svg_class_foreach_theme_dir;
- theme_class->get_card_pixbuf = games_card_theme_svg_get_card_pixbuf;
+ theme_class->get_card_pixbuf = ar_card_theme_svg_get_card_pixbuf;
preimage_theme_class->needs_scalable_cards = TRUE;
}
@@ -154,12 +154,12 @@ games_card_theme_svg_class_init (GamesCardThemeSVGClass * klass)
/* private API */
/**
- * games_card_theme_svg_new:
+ * ar_card_theme_svg_new:
*
- * Returns: a new #GamesCardThemeSVG
+ * Returns: a new #ArCardThemeSVG
*/
-GamesCardTheme*
-games_card_theme_svg_new (void)
+ArCardTheme*
+ar_card_theme_svg_new (void)
{
- return g_object_new (GAMES_TYPE_CARD_THEME_SVG, NULL);
+ return g_object_new (AR_TYPE_CARD_THEME_SVG, NULL);
}
diff --git a/libgames-support/games-card-theme.c b/aisleriot/lib/ar-card-theme.c
similarity index 67%
rename from libgames-support/games-card-theme.c
rename to aisleriot/lib/ar-card-theme.c
index 86c11df..fdba51a 100644
--- a/libgames-support/games-card-theme.c
+++ b/aisleriot/lib/ar-card-theme.c
@@ -25,12 +25,12 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
-#include "games-debug.h"
-#include "games-profile.h"
-#include "games-runtime.h"
+#include <libgames-support/games-debug.h>
+#include <libgames-support/games-profile.h>
+#include <libgames-support/games-runtime.h>
-#include "games-card-theme.h"
-#include "games-card-theme-private.h"
+#include "ar-card-theme.h"
+#include "ar-card-theme-private.h"
enum {
PROP_0,
@@ -46,52 +46,52 @@ static guint signals[LAST_SIGNAL];
/* Class implementation */
-G_DEFINE_ABSTRACT_TYPE (GamesCardTheme, games_card_theme, G_TYPE_OBJECT);
+G_DEFINE_ABSTRACT_TYPE (ArCardTheme, ar_card_theme, G_TYPE_OBJECT);
static void
-games_card_theme_init (GamesCardTheme * theme)
+ar_card_theme_init (ArCardTheme * theme)
{
}
static GObject *
-games_card_theme_constructor (GType type,
+ar_card_theme_constructor (GType type,
guint n_construct_properties,
GObjectConstructParam *construct_params)
{
GObject *object;
- GamesCardTheme *theme;
+ ArCardTheme *theme;
- object = G_OBJECT_CLASS (games_card_theme_parent_class)->constructor
+ object = G_OBJECT_CLASS (ar_card_theme_parent_class)->constructor
(type, n_construct_properties, construct_params);
- theme = GAMES_CARD_THEME (object);
+ theme = AR_CARD_THEME (object);
g_assert (theme->theme_info != NULL);
/* NOTE! We have to do this here, since it returns the wrong class
- * (GamesCardThemeClass) when called in games_card_theme_init() !
+ * (ArCardThemeClass) when called in ar_card_theme_init() !
*/
- theme->klass = GAMES_CARD_THEME_GET_CLASS (theme);
+ theme->klass = AR_CARD_THEME_GET_CLASS (theme);
return object;
}
static void
-games_card_theme_finalize (GObject *object)
+ar_card_theme_finalize (GObject *object)
{
- GamesCardTheme *theme = GAMES_CARD_THEME (object);
+ ArCardTheme *theme = AR_CARD_THEME (object);
- games_card_theme_info_unref (theme->theme_info);
+ ar_card_theme_info_unref (theme->theme_info);
- G_OBJECT_CLASS (games_card_theme_parent_class)->finalize (object);
+ G_OBJECT_CLASS (ar_card_theme_parent_class)->finalize (object);
}
static void
-games_card_theme_set_property (GObject * object,
+ar_card_theme_set_property (GObject * object,
guint prop_id,
const GValue * value, GParamSpec * pspec)
{
- GamesCardTheme *theme = GAMES_CARD_THEME (object);
+ ArCardTheme *theme = AR_CARD_THEME (object);
switch (prop_id) {
case PROP_THEME_INFO:
@@ -104,8 +104,8 @@ games_card_theme_set_property (GObject * object,
}
}
-static GamesCardThemeInfo *
-games_card_theme_class_get_theme_info (GamesCardThemeClass *klass,
+static ArCardThemeInfo *
+ar_card_theme_class_get_theme_info (ArCardThemeClass *klass,
const char *dir,
const char *filename)
{
@@ -113,21 +113,21 @@ games_card_theme_class_get_theme_info (GamesCardThemeClass *klass,
}
static void
-games_card_theme_class_init (GamesCardThemeClass * klass)
+ar_card_theme_class_init (ArCardThemeClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->set_property = games_card_theme_set_property;
- gobject_class->constructor = games_card_theme_constructor;
- gobject_class->finalize = games_card_theme_finalize;
+ gobject_class->set_property = ar_card_theme_set_property;
+ gobject_class->constructor = ar_card_theme_constructor;
+ gobject_class->finalize = ar_card_theme_finalize;
- klass->get_theme_info = games_card_theme_class_get_theme_info;
+ klass->get_theme_info = ar_card_theme_class_get_theme_info;
g_object_class_install_property
(gobject_class,
PROP_THEME_INFO,
g_param_spec_boxed ("theme-info", NULL, NULL,
- GAMES_TYPE_CARD_THEME_INFO,
+ AR_TYPE_CARD_THEME_INFO,
G_PARAM_WRITABLE |
G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK |
@@ -135,7 +135,7 @@ games_card_theme_class_init (GamesCardThemeClass * klass)
G_PARAM_CONSTRUCT_ONLY));
/**
- * GamesCardTheme:changed:
+ * ArCardTheme:changed:
* @theme: the object on which the signal is emitted
*
* The ::changed signal is emitted when the card theme has
@@ -156,13 +156,13 @@ games_card_theme_class_init (GamesCardThemeClass * klass)
/* private API */
void
-_games_card_theme_emit_changed (GamesCardTheme *theme)
+_ar_card_theme_emit_changed (ArCardTheme *theme)
{
g_signal_emit (theme, signals[CHANGED], 0);
}
-GamesCardThemeInfo *
-_games_card_theme_class_get_theme_info (GamesCardThemeClass *klass,
+ArCardThemeInfo *
+_ar_card_theme_class_get_theme_info (ArCardThemeClass *klass,
const char *dir,
const char *filename)
{
@@ -170,17 +170,17 @@ _games_card_theme_class_get_theme_info (GamesCardThemeClass *klass,
}
gboolean
-_games_card_theme_class_foreach_theme_dir (GamesCardThemeClass *klass,
- GamesCardThemeForeachFunc callback,
+_ar_card_theme_class_foreach_theme_dir (ArCardThemeClass *klass,
+ ArCardThemeForeachFunc callback,
gpointer data)
{
return klass->foreach_theme_dir (klass, callback, data);
}
gboolean
-_games_card_theme_class_foreach_env (GamesCardThemeClass *klass,
+_ar_card_theme_class_foreach_env (ArCardThemeClass *klass,
const char *env,
- GamesCardThemeForeachFunc callback,
+ ArCardThemeForeachFunc callback,
gpointer data)
{
const char *value;
@@ -217,17 +217,17 @@ _games_card_theme_class_foreach_env (GamesCardThemeClass *klass,
#if GTK_CHECK_VERSION (2, 10, 0)
/**
- * games_card_theme_set_font_options:
+ * ar_card_theme_set_font_options:
* @theme:
* @font_options: the #cairo_font_options_t to use
*
* Sets the font options to use when drawing the card images.
*/
void
-games_card_theme_set_font_options (GamesCardTheme *theme,
+ar_card_theme_set_font_options (ArCardTheme *theme,
const cairo_font_options_t *font_options)
{
- g_return_if_fail (GAMES_IS_CARD_THEME (theme));
+ g_return_if_fail (AR_IS_CARD_THEME (theme));
if (!theme->klass->set_font_options)
return;
@@ -239,21 +239,21 @@ games_card_theme_set_font_options (GamesCardTheme *theme,
/**
- * games_card_theme_get_theme_info:
+ * ar_card_theme_get_theme_info:
* @theme:
*
- * Returns: the #GamesCardThemeInfo corresponding to @theme.
+ * Returns: the #ArCardThemeInfo corresponding to @theme.
*/
-GamesCardThemeInfo *
-games_card_theme_get_theme_info (GamesCardTheme *theme)
+ArCardThemeInfo *
+ar_card_theme_get_theme_info (ArCardTheme *theme)
{
- g_return_val_if_fail (GAMES_IS_CARD_THEME (theme), NULL);
+ g_return_val_if_fail (AR_IS_CARD_THEME (theme), NULL);
return theme->theme_info;
}
/**
- * games_card_theme_set_size:
+ * ar_card_theme_set_size:
* @theme:
* @width: the maximum width
* @height: the maximum height
@@ -268,46 +268,46 @@ games_card_theme_get_theme_info (GamesCardTheme *theme)
* Returns: %TRUE iff the card size was changed
*/
gboolean
-games_card_theme_set_size (GamesCardTheme *theme,
+ar_card_theme_set_size (ArCardTheme *theme,
int width,
int height,
double proportion)
{
- g_return_val_if_fail (GAMES_IS_CARD_THEME (theme), FALSE);
+ g_return_val_if_fail (AR_IS_CARD_THEME (theme), FALSE);
return theme->klass->set_card_size (theme, width, height, proportion);
}
/**
- * games_card_theme_get_size:
+ * ar_card_theme_get_size:
* @theme:
* @size: location to store the card size
*
* Returns the currently selected card size in @size.
*/
void
-games_card_theme_get_size (GamesCardTheme *theme,
+ar_card_theme_get_size (ArCardTheme *theme,
CardSize *size)
{
theme->klass->get_card_size (theme, size);
}
/**
- * games_card_theme_get_aspect:
+ * ar_card_theme_get_aspect:
* @theme:
*
* Returns: the aspect ratio of the cards in the currently loaded theme
*/
double
-games_card_theme_get_aspect (GamesCardTheme * theme)
+ar_card_theme_get_aspect (ArCardTheme * theme)
{
- g_return_val_if_fail (GAMES_IS_CARD_THEME (theme), 1.0);
+ g_return_val_if_fail (AR_IS_CARD_THEME (theme), 1.0);
return theme->klass->get_card_aspect (theme);
}
/**
- * games_card_theme_get_card_pixbuf:
+ * ar_card_theme_get_card_pixbuf:
* @theme:
* @card_id:
*
@@ -317,12 +317,12 @@ games_card_theme_get_aspect (GamesCardTheme * theme)
* Returns: a new #GdkPixbuf, or %NULL if there was an error
*/
GdkPixbuf *
-games_card_theme_get_card_pixbuf (GamesCardTheme *theme,
+ar_card_theme_get_card_pixbuf (ArCardTheme *theme,
int card_id)
{
GdkPixbuf *pixbuf;
- g_return_val_if_fail ((card_id >= 0) && (card_id < GAMES_CARDS_TOTAL), NULL);
+ g_return_val_if_fail ((card_id >= 0) && (card_id < AR_CARDS_TOTAL), NULL);
_games_profile_start ("loading card %d from theme %s", card_id, theme->theme_info->display_name);
@@ -333,7 +333,7 @@ games_card_theme_get_card_pixbuf (GamesCardTheme *theme,
return pixbuf;
}
-/* GamesCardThemeInfo impl */
+/* ArCardThemeInfo impl */
static int
theme_type_compare (GType a,
@@ -343,22 +343,22 @@ theme_type_compare (GType a,
/* List of supported theme types, in order of decreasing precedence */
#ifdef HAVE_RSVG
#ifdef ENABLE_CARD_THEME_FORMAT_SVG
- GAMES_TYPE_CARD_THEME_SVG,
+ AR_TYPE_CARD_THEME_SVG,
#endif
#ifdef ENABLE_CARD_THEME_FORMAT_KDE
- GAMES_TYPE_CARD_THEME_KDE,
+ AR_TYPE_CARD_THEME_KDE,
#endif
#endif /* HAVE_RSVG */
#ifndef HAVE_HILDON
#ifdef ENABLE_CARD_THEME_FORMAT_SLICED
- GAMES_TYPE_CARD_THEME_SLICED,
+ AR_TYPE_CARD_THEME_SLICED,
#endif
#ifdef ENABLE_CARD_THEME_FORMAT_PYSOL
- GAMES_TYPE_CARD_THEME_PYSOL,
+ AR_TYPE_CARD_THEME_PYSOL,
#endif
#endif /* !HAVE_HILDON */
#ifdef ENABLE_CARD_THEME_FORMAT_FIXED
- GAMES_TYPE_CARD_THEME_FIXED
+ AR_TYPE_CARD_THEME_FIXED
#endif
};
guint ia, ib;
@@ -376,7 +376,7 @@ theme_type_compare (GType a,
/* private API */
/**
- * _games_card_theme_info_new:
+ * _ar_card_theme_info_new:
* @type:
* @path:
* @filename:
@@ -385,10 +385,10 @@ theme_type_compare (GType a,
* @data:
* @destroy_notify:
*
- * Returns: a new #GamesCardThemeInfo with refcount 1
+ * Returns: a new #ArCardThemeInfo with refcount 1
*/
-GamesCardThemeInfo *
-_games_card_theme_info_new (GType type,
+ArCardThemeInfo *
+_ar_card_theme_info_new (GType type,
const char *path,
const char *filename,
char *display_name /* adopts */,
@@ -396,12 +396,12 @@ _games_card_theme_info_new (GType type,
gpointer data /* adoptes */,
GDestroyNotify destroy_notify)
{
- GamesCardThemeInfo *info;
+ ArCardThemeInfo *info;
#if GLIB_CHECK_VERSION (2, 10, 0)
- info = g_slice_new (GamesCardThemeInfo);
+ info = g_slice_new (ArCardThemeInfo);
#else
- info = g_new (GamesCardThemeInfo, 1);
+ info = g_new (ArCardThemeInfo, 1);
#endif
info->ref_count = 1;
@@ -414,14 +414,14 @@ _games_card_theme_info_new (GType type,
info->destroy_notify = destroy_notify;
_games_debug_print (GAMES_DEBUG_CARD_THEME,
- "Created GamesCardThemeInfo for type=%s path=%s filename=%s display-name=%s\n",
+ "Created ArCardThemeInfo for type=%s path=%s filename=%s display-name=%s\n",
g_type_name (type), path, filename, display_name);
return info;
}
guint
-_games_card_theme_info_hash (const GamesCardThemeInfo *a)
+_ar_card_theme_info_hash (const ArCardThemeInfo *a)
{
return g_int_hash (&a->type) ^
g_str_hash (a->path) ^
@@ -429,7 +429,7 @@ _games_card_theme_info_hash (const GamesCardThemeInfo *a)
}
/**
- * _games_card_theme_info_collate:
+ * _ar_card_theme_info_collate:
* @a:
* @b:
*
@@ -439,8 +439,8 @@ _games_card_theme_info_hash (const GamesCardThemeInfo *a)
* %0 if @a and @b are equal.
*/
int
-_games_card_theme_info_collate (const GamesCardThemeInfo *a,
- const GamesCardThemeInfo *b)
+_ar_card_theme_info_collate (const ArCardThemeInfo *a,
+ const ArCardThemeInfo *b)
{
g_return_val_if_fail (a != NULL && b != NULL, 0);
@@ -453,19 +453,19 @@ _games_card_theme_info_collate (const GamesCardThemeInfo *a,
/* public API */
#if defined(G_DEFINE_BOXED_TYPE)
-G_DEFINE_BOXED_TYPE (GamesCardThemeInfo, games_card_theme_info,
- games_card_theme_info_ref,
- games_card_theme_info_unref);
+G_DEFINE_BOXED_TYPE (ArCardThemeInfo, ar_card_theme_info,
+ ar_card_theme_info_ref,
+ ar_card_theme_info_unref);
#else
GType
-games_card_theme_info_get_type (void)
+ar_card_theme_info_get_type (void)
{
static GType type = 0;
if (G_UNLIKELY (type == 0)) {
- type = g_boxed_type_register_static ("GamesCardThemeInfo",
- (GBoxedCopyFunc) games_card_theme_info_ref,
- (GBoxedFreeFunc) games_card_theme_info_unref);
+ type = g_boxed_type_register_static ("ArCardThemeInfo",
+ (GBoxedCopyFunc) ar_card_theme_info_ref,
+ (GBoxedFreeFunc) ar_card_theme_info_unref);
}
return type;
@@ -473,15 +473,15 @@ games_card_theme_info_get_type (void)
#endif /* defined(G_DEFINE_BOXED_TYPE) */
/**
- * games_card_theme_info_ref:
+ * ar_card_theme_info_ref:
* @info:
*
* Refs @info.
*
* Returns: @info
*/
-GamesCardThemeInfo *
-games_card_theme_info_ref (GamesCardThemeInfo *info)
+ArCardThemeInfo *
+ar_card_theme_info_ref (ArCardThemeInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
@@ -490,13 +490,13 @@ games_card_theme_info_ref (GamesCardThemeInfo *info)
}
/**
- * games_card_theme_info_unref:
+ * ar_card_theme_info_unref:
* @info:
*
* Unrefs @info. If the refcount reaches %0, @info is freed.
*/
void
-games_card_theme_info_unref (GamesCardThemeInfo *info)
+ar_card_theme_info_unref (ArCardThemeInfo *info)
{
g_return_if_fail (info != NULL);
@@ -512,20 +512,20 @@ games_card_theme_info_unref (GamesCardThemeInfo *info)
info->destroy_notify (info->data);
#if GLIB_CHECK_VERSION (2, 10, 0)
- g_slice_free (GamesCardThemeInfo, info);
+ g_slice_free (ArCardThemeInfo, info);
#else
g_free (info);
#endif
}
/**
- * games_card_theme_info_get_display_name :
+ * ar_card_theme_info_get_display_name :
* @info:
*
* Returns: the user readable name of @info
*/
const char *
-games_card_theme_info_get_display_name (GamesCardThemeInfo *info)
+ar_card_theme_info_get_display_name (ArCardThemeInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
@@ -533,13 +533,13 @@ games_card_theme_info_get_display_name (GamesCardThemeInfo *info)
}
/**
- * games_card_theme_info_get_persistent_name :
+ * ar_card_theme_info_get_persistent_name :
* @info:
*
* Returns: the user readable name of @info
*/
const char *
-games_card_theme_info_get_persistent_name (GamesCardThemeInfo *info)
+ar_card_theme_info_get_persistent_name (ArCardThemeInfo *info)
{
g_return_val_if_fail (info != NULL, NULL);
@@ -549,13 +549,13 @@ games_card_theme_info_get_persistent_name (GamesCardThemeInfo *info)
}
/**
- * games_card_theme_info_equal:
+ * ar_card_theme_info_equal:
*
* Returns: %TRUE iff @a and @b refer to the same card theme
*/
gboolean
-games_card_theme_info_equal (const GamesCardThemeInfo *a,
- const GamesCardThemeInfo *b)
+ar_card_theme_info_equal (const ArCardThemeInfo *a,
+ const ArCardThemeInfo *b)
{
g_return_val_if_fail (a != NULL && b != NULL, FALSE);
diff --git a/aisleriot/lib/ar-card-theme.h b/aisleriot/lib/ar-card-theme.h
new file mode 100644
index 0000000..53dba54
--- /dev/null
+++ b/aisleriot/lib/ar-card-theme.h
@@ -0,0 +1,100 @@
+/*
+ Copyright © 2004 Callum McKenzie
+ Copyright © 2007, 2008, 2009 Christian Persch
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* Authors: Callum McKenzie <callum physics otago ac nz> */
+
+#ifndef AR_CARD_THEME_H
+#define AR_CARD_THEME_H
+
+#include <glib.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define AR_CARD_THEME_ERROR (g_quark_from_static_string ("games-card-theme"))
+
+typedef enum {
+ AR_CARD_THEME_ERROR_GENERIC = 0,
+ AR_CARD_THEME_ERROR_NOT_SCALABLE = 1
+} ArCardThemeError;
+
+/* ArCardThemeInfo (boxed) */
+
+#define AR_TYPE_CARD_THEME_INFO (ar_card_theme_info_get_type ())
+
+typedef struct _ArCardThemeInfo ArCardThemeInfo;
+
+GType ar_card_theme_info_get_type (void);
+
+ArCardThemeInfo *ar_card_theme_info_ref (ArCardThemeInfo *info);
+
+void ar_card_theme_info_unref (ArCardThemeInfo *info);
+
+const char *ar_card_theme_info_get_display_name (ArCardThemeInfo *info);
+
+const char *ar_card_theme_info_get_persistent_name (ArCardThemeInfo *info);
+
+gboolean ar_card_theme_info_equal (const ArCardThemeInfo *a,
+ const ArCardThemeInfo *b);
+
+/* ArCardTheme (abstract) */
+
+#define AR_TYPE_CARD_THEME (ar_card_theme_get_type ())
+#define AR_CARD_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AR_TYPE_CARD_THEME, ArCardTheme))
+#define AR_CARD_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AR_TYPE_CARD_THEME, ArCardThemeClass))
+#define AR_IS_CARD_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AR_TYPE_CARD_THEME))
+#define AR_IS_CARD_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AR_TYPE_CARD_THEME))
+#define AR_CARD_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AR_TYPE_CARD_THEME, ArCardThemeClass))
+
+typedef struct {
+ int width;
+ int height;
+} CardSize;
+
+typedef struct _ArCardThemeClass ArCardThemeClass;
+typedef struct _ArCardTheme ArCardTheme;
+
+GType ar_card_theme_get_type (void);
+
+#if GTK_CHECK_VERSION (2, 10, 0)
+void ar_card_theme_set_font_options (ArCardTheme *theme,
+ const cairo_font_options_t *font_options);
+#endif
+
+gboolean ar_card_theme_set_theme (ArCardTheme *theme,
+ ArCardThemeInfo *info);
+
+ArCardThemeInfo *ar_card_theme_get_theme_info (ArCardTheme * theme);
+
+gboolean ar_card_theme_set_size (ArCardTheme * theme,
+ int width,
+ int height,
+ double proportion);
+
+void ar_card_theme_get_size (ArCardTheme *theme,
+ CardSize *size);
+
+double ar_card_theme_get_aspect (ArCardTheme * theme);
+
+GdkPixbuf *ar_card_theme_get_card_pixbuf (ArCardTheme * theme,
+ int cardid);
+
+G_END_DECLS
+
+#endif /* AR_CARD_THEME_H */
diff --git a/libgames-support/games-card-themes.c b/aisleriot/lib/ar-card-themes.c
similarity index 76%
rename from libgames-support/games-card-themes.c
rename to aisleriot/lib/ar-card-themes.c
index d9c1c54..1e9072f 100644
--- a/libgames-support/games-card-themes.c
+++ b/aisleriot/lib/ar-card-themes.c
@@ -33,18 +33,18 @@
#include <gdk/gdkx.h>
#endif
-#include "games-debug.h"
-#include "games-profile.h"
-#include "games-runtime.h"
+#include <libgames-support/games-debug.h>
+#include <libgames-support/games-profile.h>
+#include <libgames-support/games-runtime.h>
-#include "games-card-themes.h"
-#include "games-card-theme-private.h"
+#include "ar-card-themes.h"
+#include "ar-card-theme-private.h"
-struct _GamesCardThemesClass {
+struct _ArCardThemesClass {
GObjectClass parent_class;
};
-struct _GamesCardThemes {
+struct _ArCardThemes {
GObject parent;
GHashTable *theme_infos;
@@ -79,26 +79,26 @@ theme_type_from_string (const char *type_str,
} type_strings[] = {
#ifdef HAVE_RSVG
#ifdef ENABLE_CARD_THEME_FORMAT_SVG
- { "svg", GAMES_TYPE_CARD_THEME_SVG },
+ { "svg", AR_TYPE_CARD_THEME_SVG },
#endif
#ifdef ENABLE_CARD_THEME_FORMAT_KDE
- { "kde", GAMES_TYPE_CARD_THEME_KDE },
+ { "kde", AR_TYPE_CARD_THEME_KDE },
#endif
#endif /* HAVE_RSVG */
#ifdef ENABLE_CARD_THEME_FORMAT_SLICED
- { "sliced", GAMES_TYPE_CARD_THEME_SLICED },
+ { "sliced", AR_TYPE_CARD_THEME_SLICED },
#endif
#ifdef ENABLE_CARD_THEME_FORMAT_PYSOL
- { "pysol", GAMES_TYPE_CARD_THEME_PYSOL },
+ { "pysol", AR_TYPE_CARD_THEME_PYSOL },
#endif
#ifdef ENABLE_CARD_THEME_FORMAT_FIXED
- { "fixed", GAMES_TYPE_CARD_THEME_FIXED }
+ { "fixed", AR_TYPE_CARD_THEME_FIXED }
#endif
};
GType type = G_TYPE_INVALID;
if (type_str_len == 0) {
- static const char default_type_string[] = GAMES_CARD_THEME_DEFAULT_FORMAT_STRING;
+ static const char default_type_string[] = AR_CARD_THEME_DEFAULT_FORMAT_STRING;
/* Use the default type */
type = theme_type_from_string (default_type_string, strlen (default_type_string));
@@ -139,7 +139,7 @@ theme_filename_and_type_from_name (const char *theme_name,
theme_name ? theme_name : "(null)");
if (!theme_name || !theme_name[0])
- theme_name = GAMES_CARD_THEME_DEFAULT;
+ theme_name = AR_CARD_THEME_DEFAULT;
colon = strchr (theme_name, ':');
*type = theme_type_from_string (theme_name, colon ? colon - theme_name : 0);
@@ -160,17 +160,17 @@ theme_filename_and_type_from_name (const char *theme_name,
if (dot == NULL) {
/* No dot? Try appending the default, for compatibility with old settings */
#if defined(ENABLE_CARD_THEME_FORMAT_FIXED)
- if (*type == GAMES_TYPE_CARD_THEME_FIXED) {
+ if (*type == AR_TYPE_CARD_THEME_FIXED) {
return g_strconcat (filename, ".card-theme", NULL);
}
#elif defined(ENABLE_CARD_THEME_FORMAT_SVG)
- if (*type == GAMES_TYPE_CARD_THEME_SVG) {
+ if (*type == AR_TYPE_CARD_THEME_SVG) {
return g_strconcat (filename, ".svg", NULL);
}
#endif
} else {
#if defined(HAVE_GNOME) && defined(ENABLE_CARD_THEME_FORMAT_SVG)
- if (*type == GAMES_TYPE_CARD_THEME_SVG &&
+ if (*type == AR_TYPE_CARD_THEME_SVG &&
g_str_has_suffix (filename, ".png")) {
char *base_name, *retval;
@@ -188,11 +188,11 @@ theme_filename_and_type_from_name (const char *theme_name,
}
static gboolean
-games_card_themes_foreach_theme_dir (GType type,
- GamesCardThemeForeachFunc callback,
+ar_card_themes_foreach_theme_dir (GType type,
+ ArCardThemeForeachFunc callback,
gpointer data)
{
- GamesCardThemeClass *klass;
+ ArCardThemeClass *klass;
gboolean retval;
klass = g_type_class_ref (type);
@@ -200,7 +200,7 @@ games_card_themes_foreach_theme_dir (GType type,
return TRUE;
_games_profile_start ("foreach %s card themes", G_OBJECT_CLASS_NAME (klass));
- retval = _games_card_theme_class_foreach_theme_dir (klass, callback, data);
+ retval = _ar_card_theme_class_foreach_theme_dir (klass, callback, data);
_games_profile_end ("foreach %s card themes", G_OBJECT_CLASS_NAME (klass));
g_type_class_unref (klass);
@@ -208,35 +208,35 @@ games_card_themes_foreach_theme_dir (GType type,
}
static gboolean
-games_card_themes_foreach_theme_type_and_dir (GamesCardThemes *theme_manager,
- GamesCardThemeForeachFunc callback,
+ar_card_themes_foreach_theme_type_and_dir (ArCardThemes *theme_manager,
+ ArCardThemeForeachFunc callback,
gpointer data)
{
const GType types[] = {
/* List of supported theme types, in order of decreasing precedence */
#ifdef HAVE_RSVG
#ifdef ENABLE_CARD_THEME_FORMAT_SVG
- GAMES_TYPE_CARD_THEME_SVG,
+ AR_TYPE_CARD_THEME_SVG,
#endif
#ifdef ENABLE_CARD_THEME_FORMAT_KDE
- GAMES_TYPE_CARD_THEME_KDE,
+ AR_TYPE_CARD_THEME_KDE,
#endif
#endif /* HAVE_RSVG */
#ifdef ENABLE_CARD_THEME_FORMAT_SLICED
- GAMES_TYPE_CARD_THEME_SLICED,
+ AR_TYPE_CARD_THEME_SLICED,
#endif
#ifdef ENABLE_CARD_THEME_FORMAT_PYSOL
- GAMES_TYPE_CARD_THEME_PYSOL,
+ AR_TYPE_CARD_THEME_PYSOL,
#endif
#ifdef ENABLE_CARD_THEME_FORMAT_FIXED
- GAMES_TYPE_CARD_THEME_FIXED
+ AR_TYPE_CARD_THEME_FIXED
#endif
};
guint i;
gboolean retval = TRUE;
for (i = 0; i < G_N_ELEMENTS (types); ++i) {
- retval = games_card_themes_foreach_theme_dir (types[i], callback, data);
+ retval = ar_card_themes_foreach_theme_dir (types[i], callback, data);
if (!retval)
break;
}
@@ -245,9 +245,9 @@ games_card_themes_foreach_theme_type_and_dir (GamesCardThemes *theme_manager,
}
static gboolean
-games_card_themes_get_theme_infos_in_dir (GamesCardThemeClass *klass,
+ar_card_themes_get_theme_infos_in_dir (ArCardThemeClass *klass,
const char *path,
- GamesCardThemes *theme_manager)
+ ArCardThemes *theme_manager)
{
GDir *iter;
const char *filename;
@@ -264,10 +264,10 @@ games_card_themes_get_theme_infos_in_dir (GamesCardThemeClass *klass,
goto out;
while ((filename = g_dir_read_name (iter)) != NULL) {
- GamesCardThemeInfo *info;
+ ArCardThemeInfo *info;
_games_profile_start ("checking for %s card theme in file %s", G_OBJECT_CLASS_NAME (klass), filename);
- info = _games_card_theme_class_get_theme_info (klass, path, filename);
+ info = _ar_card_theme_class_get_theme_info (klass, path, filename);
_games_profile_end ("checking for %s card theme in file %s", G_OBJECT_CLASS_NAME (klass), filename);
if (info)
@@ -285,11 +285,11 @@ out:
typedef struct {
const char *filename;
- GamesCardThemeInfo *theme_info;
+ ArCardThemeInfo *theme_info;
} LookupData;
static gboolean
-games_card_themes_try_theme_info_by_filename (GamesCardThemeClass *klass,
+ar_card_themes_try_theme_info_by_filename (ArCardThemeClass *klass,
const char *path,
LookupData *data)
{
@@ -300,14 +300,14 @@ games_card_themes_try_theme_info_by_filename (GamesCardThemeClass *klass,
path);
/* Try constructing the theme info */
- data->theme_info = _games_card_theme_class_get_theme_info (klass, path, data->filename);
+ data->theme_info = _ar_card_theme_class_get_theme_info (klass, path, data->filename);
/* Continue until found */
return data->theme_info == NULL;
}
static void
-games_card_themes_load_theme_infos (GamesCardThemes *theme_manager)
+ar_card_themes_load_theme_infos (ArCardThemes *theme_manager)
{
_games_debug_print (GAMES_DEBUG_CARD_THEME,
"Scanning theme directories\n");
@@ -315,8 +315,8 @@ games_card_themes_load_theme_infos (GamesCardThemes *theme_manager)
/* FIXMEchpe: clear the hash table here? */
_games_profile_start ("looking for card themes");
- games_card_themes_foreach_theme_type_and_dir (theme_manager,
- (GamesCardThemeForeachFunc) games_card_themes_get_theme_infos_in_dir,
+ ar_card_themes_foreach_theme_type_and_dir (theme_manager,
+ (ArCardThemeForeachFunc) ar_card_themes_get_theme_infos_in_dir,
theme_manager);
_games_profile_end ("looking for card themes");
@@ -328,12 +328,12 @@ games_card_themes_load_theme_infos (GamesCardThemes *theme_manager)
typedef struct {
GType type;
const char *filename;
- GamesCardThemeInfo *theme_info;
+ ArCardThemeInfo *theme_info;
} ThemesByTypeAndFilenameData;
static void
themes_foreach_by_type_and_filename (gpointer key,
- GamesCardThemeInfo *theme_info,
+ ArCardThemeInfo *theme_info,
ThemesByTypeAndFilenameData *data)
{
if (data->theme_info)
@@ -346,32 +346,32 @@ themes_foreach_by_type_and_filename (gpointer key,
static void
themes_foreach_add_to_list (gpointer key,
- GamesCardThemeInfo *theme_info,
+ ArCardThemeInfo *theme_info,
GList **list)
{
- *list = g_list_prepend (*list, games_card_theme_info_ref (theme_info));
+ *list = g_list_prepend (*list, ar_card_theme_info_ref (theme_info));
}
typedef struct {
- GamesCardThemes *theme_manager;
- GamesCardTheme *theme;
+ ArCardThemes *theme_manager;
+ ArCardTheme *theme;
} ThemesAnyData;
static void
themes_foreach_any (gpointer key,
- GamesCardThemeInfo *theme_info,
+ ArCardThemeInfo *theme_info,
ThemesAnyData *data)
{
if (data->theme)
return;
- data->theme = games_card_themes_get_theme (data->theme_manager, theme_info);
+ data->theme = ar_card_themes_get_theme (data->theme_manager, theme_info);
}
#ifdef ENABLE_CARD_THEMES_INSTALLER
typedef struct {
- GamesCardThemes *theme_manager;
+ ArCardThemes *theme_manager;
DBusGProxy *proxy;
} ThemeInstallData;
@@ -388,7 +388,7 @@ theme_install_reply_cb (DBusGProxy *proxy,
DBusGProxyCall *call,
ThemeInstallData *data)
{
- GamesCardThemes *theme_manager = data->theme_manager;
+ ArCardThemes *theme_manager = data->theme_manager;
GError *error = NULL;
if (!dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID)) {
@@ -400,45 +400,45 @@ theme_install_reply_cb (DBusGProxy *proxy,
}
/* Installation succeeded. Now re-scan the theme directories */
- games_card_themes_load_theme_infos (theme_manager);
+ ar_card_themes_load_theme_infos (theme_manager);
}
#endif /* ENABLE_CARD_THEMES_INSTALLER */
/* Class implementation */
-G_DEFINE_TYPE (GamesCardThemes, games_card_themes, G_TYPE_OBJECT);
+G_DEFINE_TYPE (ArCardThemes, ar_card_themes, G_TYPE_OBJECT);
static void
-games_card_themes_init (GamesCardThemes *theme_manager)
+ar_card_themes_init (ArCardThemes *theme_manager)
{
/* Hash table: pref name => theme info */
theme_manager->theme_infos = g_hash_table_new_full (g_str_hash, g_str_equal,
NULL /* key is owned by data */,
- (GDestroyNotify) games_card_theme_info_unref);
+ (GDestroyNotify) ar_card_theme_info_unref);
theme_manager->theme_infos_loaded = FALSE;
}
static void
-games_card_themes_finalize (GObject *object)
+ar_card_themes_finalize (GObject *object)
{
- GamesCardThemes *theme_manager = GAMES_CARD_THEMES (object);
+ ArCardThemes *theme_manager = AR_CARD_THEMES (object);
g_hash_table_destroy (theme_manager->theme_infos);
- G_OBJECT_CLASS (games_card_themes_parent_class)->finalize (object);
+ G_OBJECT_CLASS (ar_card_themes_parent_class)->finalize (object);
}
static void
-games_card_themes_class_init (GamesCardThemesClass * klass)
+ar_card_themes_class_init (ArCardThemesClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- gobject_class->finalize = games_card_themes_finalize;
+ gobject_class->finalize = ar_card_themes_finalize;
/**
- * GamesCardThemes:changed:
+ * ArCardThemes:changed:
*
* The ::changed signal is emitted when the list of card themes has
* changed.
@@ -457,50 +457,50 @@ games_card_themes_class_init (GamesCardThemesClass * klass)
/* public API */
/**
- * games_card_themes_new:
+ * ar_card_themes_new:
*
- * Returns: a new #GamesCardThemes object
+ * Returns: a new #ArCardThemes object
*/
-GamesCardThemes *
-games_card_themes_new (void)
+ArCardThemes *
+ar_card_themes_new (void)
{
- return g_object_new (GAMES_TYPE_CARD_THEMES, NULL);
+ return g_object_new (AR_TYPE_CARD_THEMES, NULL);
}
/**
- * games_card_themes_request_themes:
+ * ar_card_themes_request_themes:
* @theme_manager:
*
* Scans all theme directories for themes, if necessary. If the
* themes list has changed, emits the "changed" signal synchronously.
*/
void
-games_card_themes_request_themes (GamesCardThemes *theme_manager)
+ar_card_themes_request_themes (ArCardThemes *theme_manager)
{
- g_return_if_fail (GAMES_IS_CARD_THEMES (theme_manager));
+ g_return_if_fail (AR_IS_CARD_THEMES (theme_manager));
if (theme_manager->theme_infos_loaded)
return;
- games_card_themes_load_theme_infos (theme_manager);
+ ar_card_themes_load_theme_infos (theme_manager);
}
/**
- * games_card_themes_get_theme:
+ * ar_card_themes_get_theme:
* @theme_manager:
- * @info: a #GamesCardThemeInfo
+ * @info: a #ArCardThemeInfo
*
- * Returns: a new #GamesCardTheme for @info, or %NULL if there was an
+ * Returns: a new #ArCardTheme for @info, or %NULL if there was an
* error while loading the theme.
*/
-GamesCardTheme *
-games_card_themes_get_theme (GamesCardThemes *theme_manager,
- GamesCardThemeInfo *info)
+ArCardTheme *
+ar_card_themes_get_theme (ArCardThemes *theme_manager,
+ ArCardThemeInfo *info)
{
- GamesCardTheme *theme;
+ ArCardTheme *theme;
GError *error = NULL;
- g_return_val_if_fail (GAMES_IS_CARD_THEMES (theme_manager), NULL);
+ g_return_val_if_fail (AR_IS_CARD_THEMES (theme_manager), NULL);
g_return_val_if_fail (info != NULL, NULL);
if (info->type == G_TYPE_INVALID)
@@ -532,25 +532,25 @@ games_card_themes_get_theme (GamesCardThemes *theme_manager,
}
/**
- * games_card_themes_get_theme_by_name:
+ * ar_card_themes_get_theme_by_name:
* @theme_manager:
* @theme_name: a theme name, or %NULL to get the default theme
*
- * Gets a #GamesCardTheme by its persistent name. If @theme_name is %NULL,
+ * Gets a #ArCardTheme by its persistent name. If @theme_name is %NULL,
* gets the defaul theme.
*
- * Returns: a new #GamesCardTheme for @theme_name, or %NULL if there was an
+ * Returns: a new #ArCardTheme for @theme_name, or %NULL if there was an
* error while loading the theme
*/
-GamesCardTheme *
-games_card_themes_get_theme_by_name (GamesCardThemes *theme_manager,
+ArCardTheme *
+ar_card_themes_get_theme_by_name (ArCardThemes *theme_manager,
const char *theme_name)
{
GType type;
char *filename;
- GamesCardThemeInfo *theme_info = NULL;
+ ArCardThemeInfo *theme_info = NULL;
- g_return_val_if_fail (GAMES_IS_CARD_THEMES (theme_manager), NULL);
+ g_return_val_if_fail (AR_IS_CARD_THEMES (theme_manager), NULL);
filename = theme_filename_and_type_from_name (theme_name, &type);
_games_debug_print (GAMES_DEBUG_CARD_THEME,
@@ -574,7 +574,7 @@ games_card_themes_get_theme_by_name (GamesCardThemes *theme_manager,
!theme_manager->theme_infos_loaded) {
LookupData data = { filename, NULL };
- games_card_themes_foreach_theme_dir (type, (GamesCardThemeForeachFunc) games_card_themes_try_theme_info_by_filename, &data);
+ ar_card_themes_foreach_theme_dir (type, (ArCardThemeForeachFunc) ar_card_themes_try_theme_info_by_filename, &data);
theme_info = data.theme_info;
if (theme_info)
@@ -586,28 +586,28 @@ games_card_themes_get_theme_by_name (GamesCardThemes *theme_manager,
if (theme_info == NULL)
return NULL;
- return games_card_themes_get_theme (theme_manager, theme_info);
+ return ar_card_themes_get_theme (theme_manager, theme_info);
}
/**
- * games_card_themes_get_theme_any:
+ * ar_card_themes_get_theme_any:
*
* Loads all card themes until loading one succeeds, and returns it; or
* %NULL if all card themes fail to load.
*
* Returns:
*/
-GamesCardTheme *
-games_card_themes_get_theme_any (GamesCardThemes *theme_manager)
+ArCardTheme *
+ar_card_themes_get_theme_any (ArCardThemes *theme_manager)
{
ThemesAnyData data = { theme_manager, NULL };
- g_return_val_if_fail (GAMES_IS_CARD_THEMES (theme_manager), NULL);
+ g_return_val_if_fail (AR_IS_CARD_THEMES (theme_manager), NULL);
_games_debug_print (GAMES_DEBUG_CARD_THEME,
"Fallback: trying to load any theme\n");
- games_card_themes_request_themes (theme_manager);
+ ar_card_themes_request_themes (theme_manager);
g_hash_table_foreach (theme_manager->theme_infos, (GHFunc) themes_foreach_any, &data);
@@ -615,48 +615,48 @@ games_card_themes_get_theme_any (GamesCardThemes *theme_manager)
}
/**
- * games_card_themes_get_themes_loaded:
+ * ar_card_themes_get_themes_loaded:
*
* Returns: %TRUE iff the themes list has been loaded
*/
gboolean
-games_card_themes_get_themes_loaded (GamesCardThemes *theme_manager)
+ar_card_themes_get_themes_loaded (ArCardThemes *theme_manager)
{
- g_return_val_if_fail (GAMES_IS_CARD_THEMES (theme_manager), FALSE);
+ g_return_val_if_fail (AR_IS_CARD_THEMES (theme_manager), FALSE);
return theme_manager->theme_infos_loaded;
}
/**
- * games_card_themes_get_themes:
+ * ar_card_themes_get_themes:
*
* Gets the list of known themes. Note that you may need to call
- * games_card_themes_request_themes() first ensure the themes
+ * ar_card_themes_request_themes() first ensure the themes
* information has been collected.
*
- * Returns: a newly allocated list of referenced #GamesCardThemeInfo objects
+ * Returns: a newly allocated list of referenced #ArCardThemeInfo objects
*/
GList *
-games_card_themes_get_themes (GamesCardThemes *theme_manager)
+ar_card_themes_get_themes (ArCardThemes *theme_manager)
{
GList *list = NULL;
- g_return_val_if_fail (GAMES_IS_CARD_THEMES (theme_manager), NULL);
+ g_return_val_if_fail (AR_IS_CARD_THEMES (theme_manager), NULL);
g_hash_table_foreach (theme_manager->theme_infos, (GHFunc) themes_foreach_add_to_list, &list);
- return g_list_sort (list, (GCompareFunc) _games_card_theme_info_collate);
+ return g_list_sort (list, (GCompareFunc) _ar_card_theme_info_collate);
}
/**
- * games_card_themes_can_install_themes:
+ * ar_card_themes_can_install_themes:
* @theme_manager:
*
* Returns: whether the new theme installer is supported
*/
gboolean
-games_card_themes_can_install_themes (GamesCardThemes *theme_manager)
+ar_card_themes_can_install_themes (ArCardThemes *theme_manager)
{
#ifdef ENABLE_CARD_THEMES_INSTALLER
return TRUE;
@@ -666,7 +666,7 @@ games_card_themes_can_install_themes (GamesCardThemes *theme_manager)
}
/**
- * games_card_themes_install_themes:
+ * ar_card_themes_install_themes:
* @theme_manager:
* @parent_window:
* @user_time:
@@ -674,7 +674,7 @@ games_card_themes_can_install_themes (GamesCardThemes *theme_manager)
* Try to install more card themes.
*/
void
-games_card_themes_install_themes (GamesCardThemes *theme_manager,
+ar_card_themes_install_themes (ArCardThemes *theme_manager,
GtkWindow *parent_window,
guint user_time)
{
diff --git a/aisleriot/lib/ar-card-themes.h b/aisleriot/lib/ar-card-themes.h
new file mode 100644
index 0000000..d88322e
--- /dev/null
+++ b/aisleriot/lib/ar-card-themes.h
@@ -0,0 +1,68 @@
+/*
+ Copyright © 2004 Callum McKenzie
+ Copyright © 2007, 2008, 2009 Christian Persch
+
+ 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 3 of the License, or
+ (at your option) any later version.
+
+ This program 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 Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* Authors: Callum McKenzie <callum physics otago ac nz> */
+
+#ifndef AR_CARD_THEMES_H
+#define AR_CARD_THEMES_H
+
+#include <glib.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gtk/gtk.h>
+
+#include "ar-card-theme.h"
+
+G_BEGIN_DECLS
+
+#define AR_TYPE_CARD_THEMES (ar_card_themes_get_type ())
+#define AR_CARD_THEMES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), AR_TYPE_CARD_THEMES, ArCardThemes))
+#define AR_CARD_THEMES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), AR_TYPE_CARD_THEMES, ArCardThemesClass))
+#define AR_IS_CARD_THEMES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), AR_TYPE_CARD_THEMES))
+#define AR_IS_CARD_THEMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), AR_TYPE_CARD_THEMES))
+#define AR_CARD_THEMES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), AR_TYPE_CARD_THEMES, ArCardThemesClass))
+
+typedef struct _ArCardThemesClass ArCardThemesClass;
+typedef struct _ArCardThemes ArCardThemes;
+
+GType ar_card_themes_get_type (void);
+
+ArCardThemes *ar_card_themes_new (void);
+
+void ar_card_themes_request_themes (ArCardThemes *theme_manager);
+
+gboolean ar_card_themes_get_themes_loaded (ArCardThemes *theme_manager);
+
+GList *ar_card_themes_get_themes (ArCardThemes *theme_manager);
+
+ArCardTheme *ar_card_themes_get_theme (ArCardThemes *theme_manager,
+ ArCardThemeInfo *info);
+
+ArCardTheme *ar_card_themes_get_theme_by_name (ArCardThemes *theme_manager,
+ const char *theme_name);
+
+ArCardTheme *ar_card_themes_get_theme_any (ArCardThemes *theme_manager);
+
+gboolean ar_card_themes_can_install_themes (ArCardThemes *theme_manager);
+
+void ar_card_themes_install_themes (ArCardThemes *theme_manager,
+ GtkWindow *parent_window,
+ guint user_time);
+
+G_END_DECLS
+
+#endif /* AR_CARD_THEMES_H */
diff --git a/libgames-support/games-card.c b/aisleriot/lib/ar-card.c
similarity index 83%
rename from libgames-support/games-card.c
rename to aisleriot/lib/ar-card.c
index d4a5f2e..9fc7b61 100644
--- a/libgames-support/games-card.c
+++ b/aisleriot/lib/ar-card.c
@@ -19,8 +19,8 @@
#include <glib/gi18n.h>
-#include "games-card.h"
-#include "games-card-private.h"
+#include "ar-card.h"
+#include "ar-card-private.h"
static const char extra_cards[] =
"black_joker\0"
@@ -60,7 +60,7 @@ static const guint8 rank_offsets[] = {
};
/**
- * games_card_get_node_by_suit_and_rank_snprintf:
+ * ar_card_get_node_by_suit_and_rank_snprintf:
* @buffer: the output buffer
* @bufsize: the size of the output buffer
* @suit: the suit of the card
@@ -72,7 +72,7 @@ static const guint8 rank_offsets[] = {
* was large enough.
*/
int
-games_card_get_node_by_suit_and_rank_snprintf (char *buffer,
+ar_card_get_node_by_suit_and_rank_snprintf (char *buffer,
gsize bufsize,
int suit,
int rank)
@@ -93,7 +93,7 @@ games_card_get_node_by_suit_and_rank_snprintf (char *buffer,
/**
- * games_card_get_node_by_suit_and_rank_snprintf:
+ * ar_card_get_node_by_suit_and_rank_snprintf:
* @buffer: the output buffer
* @bufsize: the size of the output buffer
* @card_id: the ID of the card
@@ -104,7 +104,7 @@ games_card_get_node_by_suit_and_rank_snprintf (char *buffer,
* was large enough.
*/
int
-games_card_get_node_by_id_snprintf (char *buffer,
+ar_card_get_node_by_id_snprintf (char *buffer,
gsize bufsize,
int card_id)
{
@@ -113,11 +113,11 @@ games_card_get_node_by_id_snprintf (char *buffer,
suit = card_id / 13;
rank = card_id % 13;
- return games_card_get_node_by_suit_and_rank_snprintf (buffer, bufsize, suit, rank);
+ return ar_card_get_node_by_suit_and_rank_snprintf (buffer, bufsize, suit, rank);
}
/**
- * games_card_get_name_by_id_snprintf:
+ * ar_card_get_name_by_id_snprintf:
* @buffer: the output buffer
* @bufsize: the size of the output buffer
* @card_id: the ID of the card
@@ -128,7 +128,7 @@ games_card_get_node_by_id_snprintf (char *buffer,
* was large enough.
*/
int
-games_card_get_name_by_id_snprintf (char *buffer,
+ar_card_get_name_by_id_snprintf (char *buffer,
gsize bufsize,
int card_id)
{
@@ -150,7 +150,7 @@ games_card_get_name_by_id_snprintf (char *buffer,
}
/**
- * games_card_get_name_by_id:
+ * ar_card_get_name_by_id:
* @card_id:
*
* Returns the name of the card @cardid
@@ -158,23 +158,23 @@ games_card_get_name_by_id_snprintf (char *buffer,
* Returns: a newly allocated string containing the identifier for @card_id
*/
char *
-games_card_get_name_by_id (gint card_id)
+ar_card_get_name_by_id (gint card_id)
{
char name[128];
- games_card_get_name_by_id_snprintf (name, sizeof (name), card_id);
+ ar_card_get_name_by_id_snprintf (name, sizeof (name), card_id);
return g_strdup (name);
}
/**
- * games_card_get_localised_rank_symbol:
+ * ar_card_get_localised_rank_symbol:
* @rank: the card rank
*
* Returns: the localised rank card symbol
*/
const char *
-games_card_get_localised_rank_symbol (int rank)
+ar_card_get_localised_rank_symbol (int rank)
{
#if GLIB_CHECK_VERSION (2, 18, 0)
static const char *rank_texts[] = {
@@ -210,38 +210,38 @@ games_card_get_localised_rank_symbol (int rank)
NC_("card symbol", "1")
};
- g_return_val_if_fail (rank >= GAMES_CARD_JOKER && rank <= GAMES_CARD_ACE_HIGH, NULL);
+ g_return_val_if_fail (rank >= AR_CARD_JOKER && rank <= AR_CARD_ACE_HIGH, NULL);
return g_dpgettext2 (GETTEXT_PACKAGE, "card symbol", rank_texts[rank]);
#else
static const char rank_texts[][6] = { "JOKER", "A", "1", "2", "3", "4", "5", "6", "7", "8", "9", "J", "Q", "K", "A" };
- g_return_val_if_fail (rank >= GAMES_CARD_JOKER && rank <= GAMES_CARD_ACE_HIGH, NULL);
+ g_return_val_if_fail (rank >= AR_CARD_JOKER && rank <= AR_CARD_ACE_HIGH, NULL);
return rank_texts[rank];
#endif /* GLIB >= 2.18.0 */
}
guint
-_games_card_to_index (Card card)
+_ar_card_to_index (Card card)
{
guint card_id;
if (CARD_GET_FACE_DOWN (card)) {
- card_id = GAMES_CARD_BACK;
+ card_id = AR_CARD_BACK;
} else if (G_UNLIKELY (CARD_GET_RANK (card) == 0)) {
/* A joker */
- if (CARD_GET_SUIT (card) == GAMES_CARDS_CLUBS ||
- CARD_GET_SUIT (card) == GAMES_CARDS_SPADES) {
+ if (CARD_GET_SUIT (card) == AR_CARDS_CLUBS ||
+ CARD_GET_SUIT (card) == AR_CARDS_SPADES) {
/* A black joker. */
- card_id = GAMES_CARD_BLACK_JOKER;
+ card_id = AR_CARD_BLACK_JOKER;
} else {
/* A red joker. */
- card_id = GAMES_CARD_RED_JOKER;
+ card_id = AR_CARD_RED_JOKER;
}
} else {
- card_id = GAMES_CARD_ID (CARD_GET_SUIT (card), CARD_GET_RANK (card));
+ card_id = AR_CARD_ID (CARD_GET_SUIT (card), CARD_GET_RANK (card));
}
return card_id;
@@ -302,17 +302,17 @@ static const char *card_names[] = {
N_("queen of spades"),
N_("king of spades")
};
-#define GAMES_CARD_ID(suit, rank) ((13*(suit)) + ((rank-1)%13))
+#define AR_CARD_ID(suit, rank) ((13*(suit)) + ((rank-1)%13))
/**
- * games_card_get_localized_name:
+ * ar_card_get_localized_name:
* @card:
*
* Returns: a localised name for @card, e.g. "Face-down card" or
* "9 of clubs", etc.
*/
const char *
-games_card_get_locale_name (Card card)
+ar_card_get_locale_name (Card card)
{
guint rank, suit;
@@ -325,8 +325,8 @@ games_card_get_locale_name (Card card)
if (G_UNLIKELY (rank == 0)) {
/* A joker */
- if (suit == GAMES_CARDS_CLUBS ||
- suit == GAMES_CARDS_SPADES) {
+ if (suit == AR_CARDS_CLUBS ||
+ suit == AR_CARDS_SPADES) {
/* A black joker. */
return _("black joker");
} else {
@@ -335,5 +335,5 @@ games_card_get_locale_name (Card card)
}
}
- return _(card_names[GAMES_CARD_ID(suit, rank)]);
+ return _(card_names[AR_CARD_ID(suit, rank)]);
}
diff --git a/libgames-support/games-card.h b/aisleriot/lib/ar-card.h
similarity index 69%
rename from libgames-support/games-card.h
rename to aisleriot/lib/ar-card.h
index afec8d7..8b62588 100644
--- a/libgames-support/games-card.h
+++ b/aisleriot/lib/ar-card.h
@@ -20,12 +20,12 @@
/* Common definitions for all card handling routines. */
-#ifndef GAMES_CARD_H
-#define GAMES_CARD_H
+#ifndef AR_CARD_H
+#define AR_CARD_H
#include <glib.h>
-#include "games-glib-compat.h"
+#include <libgames-support/games-glib-compat.h>
G_BEGIN_DECLS
@@ -71,57 +71,57 @@ G_STATIC_ASSERT(sizeof (Card) == sizeof (guint8));
typedef enum {
/* Cards */
- GAMES_CARD_JOKER = 0,
- GAMES_CARD_ACE = 1,
- GAMES_CARD_TWO = 2,
- GAMES_CARD_THREE = 3,
- GAMES_CARD_FOUR = 4,
- GAMES_CARD_FIVE = 5,
- GAMES_CARD_SIX = 6,
- GAMES_CARD_SEVEN = 7,
- GAMES_CARD_EIGHT = 8,
- GAMES_CARD_NINE = 9,
- GAMES_CARD_TEN = 10,
- GAMES_CARD_JACK = 11,
- GAMES_CARD_QUEEN = 12,
- GAMES_CARD_KING = 13,
- GAMES_CARD_ACE_HIGH = 14,
+ AR_CARD_JOKER = 0,
+ AR_CARD_ACE = 1,
+ AR_CARD_TWO = 2,
+ AR_CARD_THREE = 3,
+ AR_CARD_FOUR = 4,
+ AR_CARD_FIVE = 5,
+ AR_CARD_SIX = 6,
+ AR_CARD_SEVEN = 7,
+ AR_CARD_EIGHT = 8,
+ AR_CARD_NINE = 9,
+ AR_CARD_TEN = 10,
+ AR_CARD_JACK = 11,
+ AR_CARD_QUEEN = 12,
+ AR_CARD_KING = 13,
+ AR_CARD_ACE_HIGH = 14,
/* Suites */
- GAMES_CARDS_CLUBS = 0,
- GAMES_CARDS_DIAMONDS = 1,
- GAMES_CARDS_HEARTS = 2,
- GAMES_CARDS_SPADES = 3,
+ AR_CARDS_CLUBS = 0,
+ AR_CARDS_DIAMONDS = 1,
+ AR_CARDS_HEARTS = 2,
+ AR_CARDS_SPADES = 3,
/* Jokers */
- GAMES_CARD_BLACK_JOKER = 52,
- GAMES_CARD_RED_JOKER = 53,
+ AR_CARD_BLACK_JOKER = 52,
+ AR_CARD_RED_JOKER = 53,
/* Special */
- GAMES_CARD_BACK = 54,
- GAMES_CARD_SLOT = 55,
- GAMES_CARDS_TOTAL = 56,
-} GamesCardIDType;
+ AR_CARD_BACK = 54,
+ AR_CARD_SLOT = 55,
+ AR_CARDS_TOTAL = 56,
+} ArCardIDType;
-int games_card_get_node_by_suit_and_rank_snprintf (char *buffer,
+int ar_card_get_node_by_suit_and_rank_snprintf (char *buffer,
gsize bufsize,
int suit,
int rank);
-int games_card_get_node_by_id_snprintf (char *buffer,
+int ar_card_get_node_by_id_snprintf (char *buffer,
gsize bufsize,
int card_id);
-int games_card_get_name_by_id_snprintf (char *buffer,
+int ar_card_get_name_by_id_snprintf (char *buffer,
gsize bufsize,
int card_id);
-char * games_card_get_name_by_id (int card_id);
+char * ar_card_get_name_by_id (int card_id);
-const char * games_card_get_localised_rank_symbol (int rank);
+const char * ar_card_get_localised_rank_symbol (int rank);
-const char * games_card_get_locale_name (Card card);
+const char * ar_card_get_locale_name (Card card);
G_END_DECLS
-#endif /* !GAMES_CARD_H */
+#endif /* !AR_CARD_H */
diff --git a/libgames-support/games-pixbuf-utils.c b/aisleriot/lib/ar-pixbuf-utils.c
similarity index 92%
rename from libgames-support/games-pixbuf-utils.c
rename to aisleriot/lib/ar-pixbuf-utils.c
index 450c233..a2d2735 100644
--- a/libgames-support/games-pixbuf-utils.c
+++ b/aisleriot/lib/ar-pixbuf-utils.c
@@ -18,12 +18,12 @@
#include <config.h>
-#include <string.h>
+#include "ar-pixbuf-utils.h"
-#include "games-pixbuf-utils.h"
+#include <string.h>
/**
- * games_pixbuf_utils_create_highlight:
+ * ar_pixbuf_utils_create_highlight:
* @pixbuf: the original pixbuf
* @highligh_colour: the colour to use for the highlight
*
@@ -32,8 +32,8 @@
* Returns: a new #GdkPixbuf, or %NULL if there was an error
*/
GdkPixbuf *
-games_pixbuf_utils_create_highlight (GdkPixbuf *pixbuf,
- const GdkColor *highligh_colour)
+ar_pixbuf_utils_create_highlight (GdkPixbuf *pixbuf,
+ const GdkColor *highligh_colour)
{
GdkPixbuf *comppixbuf;
guint x, y, width, height, rowstride;
diff --git a/libgames-support/games-pixbuf-utils.h b/aisleriot/lib/ar-pixbuf-utils.h
similarity index 85%
rename from libgames-support/games-pixbuf-utils.h
rename to aisleriot/lib/ar-pixbuf-utils.h
index 574bb99..2631234 100644
--- a/libgames-support/games-pixbuf-utils.h
+++ b/aisleriot/lib/ar-pixbuf-utils.h
@@ -23,8 +23,8 @@
G_BEGIN_DECLS
-GdkPixbuf *games_pixbuf_utils_create_highlight (GdkPixbuf *pixbuf,
- const GdkColor *highligh_colour);
+GdkPixbuf *ar_pixbuf_utils_create_highlight (GdkPixbuf *pixbuf,
+ const GdkColor *highligh_colour);
G_END_DECLS
diff --git a/libgames-support/render-cards.c b/aisleriot/lib/render-cards.c
similarity index 85%
rename from libgames-support/render-cards.c
rename to aisleriot/lib/render-cards.c
index acd99b4..40943f5 100644
--- a/libgames-support/render-cards.c
+++ b/aisleriot/lib/render-cards.c
@@ -26,20 +26,21 @@
#include <gtk/gtk.h>
-#include "games-runtime.h"
-#include "games-card-theme.h"
-#include "games-card-themes.h"
-#include "games-card-theme-private.h"
-#include "games-string-utils.h"
+#include <libgames-support/games-runtime.h>
+#include <libgames-support/games-string-utils.h>
+
+#include "ar-card-theme.h"
+#include "ar-card-themes.h"
+#include "ar-card-theme-private.h"
int
main (int argc, char *argv[])
{
GError *err = NULL;
char *basepath = NULL, *kfname, *kfpath, *theme_filename;
- GamesCardThemeInfo *theme_info = NULL;
- GamesCardThemes *theme_manager = NULL;
- GamesCardTheme *theme = NULL;
+ ArCardThemeInfo *theme_info = NULL;
+ ArCardThemes *theme_manager = NULL;
+ ArCardTheme *theme = NULL;
GKeyFile *key_file = NULL;
int i;
int retval = EXIT_FAILURE;
@@ -131,15 +132,15 @@ main (int argc, char *argv[])
}
theme_filename = g_strdup_printf ("%s.svg", theme_name);
- theme_info = _games_card_theme_info_new (GAMES_TYPE_CARD_THEME_SVG,
- theme_dir ? theme_dir : games_runtime_get_directory (GAMES_RUNTIME_SCALABLE_CARDS_DIRECTORY),
- theme_filename,
- games_filename_to_display_name (theme_name),
- g_strdup_printf ("svg:%s", theme_filename) /* FIXMEchpe is this correct? */,
- NULL, NULL);
+ theme_info = _ar_card_theme_info_new (AR_TYPE_CARD_THEME_SVG,
+ theme_dir ? theme_dir : games_runtime_get_directory (GAMES_RUNTIME_SCALABLE_CARDS_DIRECTORY),
+ theme_filename,
+ games_filename_to_display_name (theme_name),
+ g_strdup_printf ("svg:%s", theme_filename) /* FIXMEchpe is this correct? */,
+ NULL, NULL);
g_free (theme_filename);
- theme_manager = games_card_themes_new ();
- theme = games_card_themes_get_theme (theme_manager, theme_info);
+ theme_manager = ar_card_themes_new ();
+ theme = ar_card_themes_get_theme (theme_manager, theme_info);
if (!theme) {
/* FIXMEchpe print real error */
g_printerr ("Failed to load theme '%s'\n", theme_name);
@@ -152,7 +153,7 @@ main (int argc, char *argv[])
font_options = cairo_font_options_create ();
cairo_font_options_set_antialias (font_options, antialias_mode);
cairo_font_options_set_subpixel_order (font_options, subpixels);
- games_card_theme_set_font_options (theme, font_options);
+ ar_card_theme_set_font_options (theme, font_options);
cairo_font_options_destroy (font_options);
}
@@ -180,7 +181,7 @@ main (int argc, char *argv[])
if (size == 0 || errno != 0)
goto loser;
- games_card_theme_set_size (theme, size, -1, 1.0);
+ ar_card_theme_set_size (theme, size, -1, 1.0);
g_snprintf (sizestr, sizeof (sizestr), "%d", size);
sizepath = g_build_filename (basepath, sizestr, NULL);
@@ -191,16 +192,16 @@ main (int argc, char *argv[])
goto loser;
}
- for (j = 0; j < GAMES_CARDS_TOTAL; ++j) {
+ for (j = 0; j < AR_CARDS_TOTAL; ++j) {
GdkPixbuf *pixbuf;
char *name, *filename, *path;
GError *error = NULL;
- pixbuf = games_card_theme_get_card_pixbuf (theme, j);
+ pixbuf = ar_card_theme_get_card_pixbuf (theme, j);
if (!pixbuf)
goto loser;
- name = games_card_get_name_by_id (j);
+ name = ar_card_get_name_by_id (j);
filename = g_strdup_printf ("%s.png", name);
path = g_build_filename (sizepath, filename, NULL);
@@ -222,7 +223,7 @@ main (int argc, char *argv[])
sizes[i] = size;
- games_card_theme_get_size (theme, &card_size);
+ ar_card_theme_get_size (theme, &card_size);
g_key_file_set_integer (key_file, sizestr, "Width", card_size.width);
g_key_file_set_integer (key_file, sizestr, "Height", card_size.height);
}
@@ -263,7 +264,7 @@ loser:
if (theme)
g_object_unref (theme);
if (theme_info)
- games_card_theme_info_unref (theme_info);
+ ar_card_theme_info_unref (theme_info);
if (theme_manager)
g_object_unref (theme_manager);
if (key_file)
diff --git a/aisleriot/slot-renderer.c b/aisleriot/slot-renderer.c
index 879b627..8e233c7 100644
--- a/aisleriot/slot-renderer.c
+++ b/aisleriot/slot-renderer.c
@@ -43,7 +43,7 @@ static void aisleriot_slot_renderer_get_property (GObject *object,
static void aisleriot_slot_renderer_paint (ClutterActor *actor);
static void aisleriot_slot_renderer_set_cache (AisleriotSlotRenderer *srend,
- GamesCardTexturesCache *cache);
+ ArCardTexturesCache *cache);
static void completed_cb (AisleriotSlotRenderer *srend);
@@ -61,7 +61,7 @@ struct _AisleriotSlotRendererPrivate
{
ArStyle *style;
- GamesCardTexturesCache *cache;
+ ArCardTexturesCache *cache;
ArSlot *slot;
@@ -142,7 +142,7 @@ aisleriot_slot_renderer_class_init (AisleriotSlotRendererClass *klass)
G_PARAM_STATIC_STRINGS));
pspec = g_param_spec_object ("cache", NULL, NULL,
- GAMES_TYPE_CARD_TEXTURES_CACHE,
+ AR_TYPE_CARD_TEXTURES_CACHE,
G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
@@ -235,7 +235,7 @@ aisleriot_slot_renderer_finalize (GObject *object)
ClutterActor *
aisleriot_slot_renderer_new (ArStyle *style,
- GamesCardTexturesCache *cache,
+ ArCardTexturesCache *cache,
ArSlot *slot)
{
return g_object_new (AISLERIOT_TYPE_SLOT_RENDERER,
@@ -247,7 +247,7 @@ aisleriot_slot_renderer_new (ArStyle *style,
static void
aisleriot_slot_renderer_set_cache (AisleriotSlotRenderer *srend,
- GamesCardTexturesCache *cache)
+ ArCardTexturesCache *cache)
{
AisleriotSlotRendererPrivate *priv = srend->priv;
@@ -393,7 +393,7 @@ aisleriot_slot_renderer_paint_card (AisleriotSlotRenderer *srend,
guint tex_width, tex_height;
int cardx, cardy;
- cogl_tex = games_card_textures_cache_get_card_texture (priv->cache, card);
+ cogl_tex = ar_card_textures_cache_get_card_texture (priv->cache, card);
if (G_UNLIKELY (cogl_tex == COGL_INVALID_HANDLE))
return;
@@ -435,7 +435,7 @@ aisleriot_slot_renderer_paint (ClutterActor *actor)
CoglHandle cogl_tex;
guint tex_width, tex_height;
- cogl_tex = games_card_textures_cache_get_slot_texture (priv->cache);
+ cogl_tex = ar_card_textures_cache_get_slot_texture (priv->cache);
if (G_UNLIKELY (cogl_tex == COGL_INVALID_HANDLE))
return;
diff --git a/aisleriot/slot-renderer.h b/aisleriot/slot-renderer.h
index e96737b..930abd5 100644
--- a/aisleriot/slot-renderer.h
+++ b/aisleriot/slot-renderer.h
@@ -19,9 +19,9 @@
#define __AISLERIOT_SLOT_RENDERER_H__
#include <clutter/clutter.h>
-#include <libgames-support/games-card-textures-cache.h>
#include "game.h"
+#include "ar-card-textures-cache.h"
#include "ar-style.h"
G_BEGIN_DECLS
@@ -74,7 +74,7 @@ struct _AisleriotAnimStart
GType aisleriot_slot_renderer_get_type (void) G_GNUC_CONST;
ClutterActor *aisleriot_slot_renderer_new (ArStyle *style,
- GamesCardTexturesCache *cache,
+ ArCardTexturesCache *cache,
ArSlot *slot);
void aisleriot_slot_renderer_set_highlight (AisleriotSlotRenderer *srend,
diff --git a/aisleriot/window.c b/aisleriot/window.c
index d7373cf..08107f4 100644
--- a/aisleriot/window.c
+++ b/aisleriot/window.c
@@ -37,8 +37,6 @@
#endif
#endif /* HAVE_HILDON */
-#include <libgames-support/games-card-theme.h>
-#include <libgames-support/games-card-themes.h>
#include <libgames-support/games-clock.h>
#include <libgames-support/games-debug.h>
#include <libgames-support/games-glib-compat.h>
@@ -60,6 +58,8 @@
#include "board-noclutter.h"
#endif
+#include "ar-card-theme.h"
+#include "ar-card-themes.h"
#include "conf.h"
#include "game.h"
#include "stats-dialog.h"
@@ -140,8 +140,8 @@ struct _AisleriotWindowPrivate
AisleriotBoard *board;
#endif
- GamesCardThemes *theme_manager;
- GamesCardTheme *theme;
+ ArCardThemes *theme_manager;
+ ArCardTheme *theme;
#ifdef HAVE_HILDON
guint game_message_hash;
@@ -579,7 +579,7 @@ install_themes_cb (GtkAction *action,
{
AisleriotWindowPrivate *priv = window->priv;
- games_card_themes_install_themes (priv->theme_manager,
+ ar_card_themes_install_themes (priv->theme_manager,
GTK_WINDOW (window),
gtk_get_current_event_time ());
}
@@ -1391,7 +1391,7 @@ install_recently_played_menu (AisleriotWindow *window)
static void
aisleriot_window_take_card_theme (AisleriotWindow *window,
- GamesCardTheme *theme /* adopting */)
+ ArCardTheme *theme /* adopting */)
{
AisleriotWindowPrivate *priv = window->priv;
#if GTK_CHECK_VERSION (2, 10, 0)
@@ -1411,7 +1411,7 @@ aisleriot_window_take_card_theme (AisleriotWindow *window,
const cairo_font_options_t *font_options;
font_options = gdk_screen_get_font_options (gtk_widget_get_screen (widget));
- games_card_theme_set_font_options (theme, font_options);
+ ar_card_theme_set_font_options (theme, font_options);
}
#endif /* GTK+ 2.10.0 */
@@ -1423,8 +1423,8 @@ card_theme_changed_cb (GtkToggleAction *action,
AisleriotWindow *window)
{
AisleriotWindowPrivate *priv = window->priv;
- GamesCardThemeInfo *current_theme_info = NULL, *new_theme_info;
- GamesCardTheme *theme;
+ ArCardThemeInfo *current_theme_info = NULL, *new_theme_info;
+ ArCardTheme *theme;
const char *theme_name;
if (!gtk_toggle_action_get_active (action))
@@ -1434,13 +1434,13 @@ card_theme_changed_cb (GtkToggleAction *action,
g_assert (new_theme_info != NULL);
if (priv->theme) {
- current_theme_info = games_card_theme_get_theme_info (priv->theme);
+ current_theme_info = ar_card_theme_get_theme_info (priv->theme);
}
- if (games_card_theme_info_equal (new_theme_info, current_theme_info))
+ if (ar_card_theme_info_equal (new_theme_info, current_theme_info))
return;
- theme = games_card_themes_get_theme (priv->theme_manager, new_theme_info);
+ theme = ar_card_themes_get_theme (priv->theme_manager, new_theme_info);
if (!theme) {
GSList *group, *l;
@@ -1455,13 +1455,13 @@ card_theme_changed_cb (GtkToggleAction *action,
group = gtk_radio_action_get_group (GTK_RADIO_ACTION (action));
for (l = group; l != NULL; l = l->next) {
GtkToggleAction *theme_action = GTK_TOGGLE_ACTION (l->data);
- GamesCardThemeInfo *info;
+ ArCardThemeInfo *info;
if (theme_action == action)
continue;
info = g_object_get_data (G_OBJECT (theme_action), "theme-info");
- if (!games_card_theme_info_equal (info, current_theme_info))
+ if (!ar_card_theme_info_equal (info, current_theme_info))
continue;
/* The check at the top will prevent an infinite loop */
@@ -1474,18 +1474,18 @@ card_theme_changed_cb (GtkToggleAction *action,
aisleriot_window_take_card_theme (window, theme);
- theme_name = games_card_theme_info_get_persistent_name (new_theme_info);
+ theme_name = ar_card_theme_info_get_persistent_name (new_theme_info);
games_conf_set_string (NULL, aisleriot_conf_get_key (CONF_THEME), theme_name);
}
static void
-install_card_theme_menu (GamesCardThemes *theme_manager,
+install_card_theme_menu (ArCardThemes *theme_manager,
AisleriotWindow *window)
{
AisleriotWindowPrivate *priv = window->priv;
GList *list, *l;
GSList *radio_group = NULL;
- GamesCardThemeInfo *current_theme_info;
+ ArCardThemeInfo *current_theme_info;
guint i = 0;
/* Clean out the old menu */
@@ -1501,11 +1501,11 @@ install_card_theme_menu (GamesCardThemes *theme_manager,
/* See gtk bug #424448 */
gtk_ui_manager_ensure_update (priv->ui_manager);
- list = games_card_themes_get_themes (priv->theme_manager);
+ list = ar_card_themes_get_themes (priv->theme_manager);
/* No need to install the menu when there's only one theme available anyway */
if (list == NULL || list->next == NULL) {
- g_list_foreach (list, (GFunc) games_card_theme_info_unref, NULL);
+ g_list_foreach (list, (GFunc) ar_card_theme_info_unref, NULL);
g_list_free (list);
return;
}
@@ -1517,18 +1517,18 @@ install_card_theme_menu (GamesCardThemes *theme_manager,
priv->card_themes_merge_id = gtk_ui_manager_new_merge_id (priv->ui_manager);
if (priv->theme) {
- current_theme_info = games_card_theme_get_theme_info (priv->theme);
+ current_theme_info = ar_card_theme_get_theme_info (priv->theme);
} else {
current_theme_info = NULL;
}
for (l = list; l != NULL; l = l->next) {
- GamesCardThemeInfo *info = (GamesCardThemeInfo *) l->data;
+ ArCardThemeInfo *info = (ArCardThemeInfo *) l->data;
GtkRadioAction *action;
char actionname[32];
char *display_name, *tooltip;
- display_name = g_strdup (games_card_theme_info_get_display_name (info));
+ display_name = g_strdup (ar_card_theme_info_get_display_name (info));
g_snprintf (actionname, sizeof (actionname), "Theme%d", i);
#ifdef HAVE_HILDON
@@ -1544,13 +1544,13 @@ install_card_theme_menu (GamesCardThemes *theme_manager,
radio_group = gtk_radio_action_get_group (action);
/* Check if this is the current theme's action. Do this before connecting the callback */
- if (games_card_theme_info_equal (info, current_theme_info)) {
+ if (ar_card_theme_info_equal (info, current_theme_info)) {
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
}
/* We steal the data from the list */
g_object_set_data_full (G_OBJECT (action), "theme-info",
- l->data, (GDestroyNotify) games_card_theme_info_unref);
+ l->data, (GDestroyNotify) ar_card_theme_info_unref);
l->data = NULL;
g_signal_connect (action, "toggled",
@@ -1586,7 +1586,7 @@ view_menu_activate_cb (GtkAction *action,
/* Request the list of themes. If it wasn't updated yet, the "changed"
* callback will build the card themes submenu.
*/
- games_card_themes_request_themes (priv->theme_manager);
+ ar_card_themes_request_themes (priv->theme_manager);
}
/* Callbacks */
@@ -2118,7 +2118,7 @@ aisleriot_window_style_set (GtkWidget *widget,
return;
font_options = gdk_screen_get_font_options (gtk_widget_get_screen (widget));
- games_card_theme_set_font_options (priv->theme, font_options);
+ ar_card_theme_set_font_options (priv->theme, font_options);
/* FIXMEchpe: clear the cached cards in the slots?? */
}
@@ -2487,7 +2487,7 @@ aisleriot_window_init (AisleriotWindow *window)
GtkAccelGroup *accel_group;
GtkAction *action;
char *theme_name;
- GamesCardTheme *theme;
+ ArCardTheme *theme;
guint i;
#ifndef HAVE_HILDON
GtkStatusbar *statusbar;
@@ -2505,7 +2505,7 @@ aisleriot_window_init (AisleriotWindow *window)
priv->game = aisleriot_game_new ();
- priv->theme_manager = games_card_themes_new ();
+ priv->theme_manager = ar_card_themes_new ();
priv->board_style = ar_style_new ();
@@ -2539,11 +2539,11 @@ aisleriot_window_init (AisleriotWindow *window)
#endif /* HAVE_CLUTTER */
theme_name = games_conf_get_string (NULL, aisleriot_conf_get_key (CONF_THEME), NULL);
- theme = games_card_themes_get_theme_by_name (priv->theme_manager, theme_name);
+ theme = ar_card_themes_get_theme_by_name (priv->theme_manager, theme_name);
g_free (theme_name);
if (!theme) {
/* Last-ditch fallback: try getting *any* theme */
- theme = games_card_themes_get_theme_any (priv->theme_manager);
+ theme = ar_card_themes_get_theme_any (priv->theme_manager);
}
if (theme) {
aisleriot_window_take_card_theme (window, theme /* adopts */);
@@ -2707,7 +2707,7 @@ aisleriot_window_init (AisleriotWindow *window)
* if the theme loading above involved the fallback); in that case
* we need to update the menu right now.
*/
- if (games_card_themes_get_themes_loaded (priv->theme_manager))
+ if (ar_card_themes_get_themes_loaded (priv->theme_manager))
install_card_theme_menu (priv->theme_manager, window);
/* Rebuild the themes menu when the themes list changes */
@@ -2748,7 +2748,7 @@ aisleriot_window_init (AisleriotWindow *window)
#ifdef ENABLE_CARD_THEMES_INSTALLER
action = gtk_action_group_get_action (priv->action_group, "InstallThemes");
- gtk_action_set_sensitive (action, games_card_themes_can_install_themes (priv->theme_manager));
+ gtk_action_set_sensitive (action, ar_card_themes_can_install_themes (priv->theme_manager));
#endif /* ENABLE_CARD_THEMES_INSTALLER */
set_fullscreen_actions (window, FALSE);
diff --git a/configure.in b/configure.in
index d580165..9b9623a 100644
--- a/configure.in
+++ b/configure.in
@@ -120,7 +120,6 @@ allow_smclient=no
disallow_hildon=no
require_gtk_2_16=no
libgames_support_full=no
-build_libgamescards=no
for game in $gamelist; do
case $game in
@@ -167,14 +166,9 @@ for game in $gamelist; do
aisleriot) ;;
*) libgames_support_full=yes ;;
esac
- case $game in
- aisleriot) build_libgamescards=yes ;;
- *) ;;
- esac
done
AM_CONDITIONAL([LIBGAMES_SUPPORT_FULL],[test "$libgames_support_full" = "yes"])
-AM_CONDITIONAL([BUILD_LIBGAMESCARDS],[test "$build_libgamescards" = "yes"])
# Set a conditional for each game to build
@@ -470,7 +464,7 @@ AC_ARG_WITH([default-card-theme],
esac])
AC_MSG_RESULT([$with_default_card_theme])
-AC_DEFINE_UNQUOTED([GAMES_CARD_THEME_DEFAULT],["$with_default_card_theme"],[The default card theme])
+AC_DEFINE_UNQUOTED([AR_CARD_THEME_DEFAULT],["$with_default_card_theme"],[The default card theme])
AC_MSG_CHECKING([which card theme format to use by default])
AC_ARG_WITH([default-card-theme-format],
@@ -486,7 +480,7 @@ case "$with_default_card_theme_format" in
*) AC_MSG_ERROR([card theme format $with_default_card_theme_format unknown])
esac
-AC_DEFINE_UNQUOTED([GAMES_CARD_THEME_DEFAULT_FORMAT_STRING],["$with_default_card_theme_format"],[The default card theme format type string])
+AC_DEFINE_UNQUOTED([AR_CARD_THEME_DEFAULT_FORMAT_STRING],["$with_default_card_theme_format"],[The default card theme format type string])
# ********************
# Card theme installer
@@ -1093,6 +1087,8 @@ gnibbles/pix/Makefile
aisleriot/Makefile
aisleriot/sol.desktop.in
aisleriot/freecell.desktop.in
+aisleriot/data/Makefile
+aisleriot/lib/Makefile
aisleriot/rules/Makefile
aisleriot/help/Makefile
glchess/Makefile
diff --git a/libgames-support/Makefile.am b/libgames-support/Makefile.am
index 1ff5352..e5dd35c 100644
--- a/libgames-support/Makefile.am
+++ b/libgames-support/Makefile.am
@@ -9,10 +9,6 @@ EXTRA_DIST = \
noinst_LTLIBRARIES = libgames-support.la
-if BUILD_LIBGAMESCARDS
-noinst_LTLIBRARIES += libgamescards.la
-endif
-
pkglib_LTLIBRARIES =
# libgames-support.la
@@ -148,147 +144,6 @@ libgames_support_la_CFLAGS += $(HILDON_CFLAGS)
libgames_support_la_LIBADD += $(HILDON_LIBS)
endif
-# libgamescards.la
-
-if BUILD_LIBGAMESCARDS
-
-libgamescards_la_SOURCES = \
- games-card.c \
- games-card.h \
- games-card-images.c \
- games-card-images.h \
- games-card-private.h \
- games-card-theme.c \
- games-card-theme.h \
- games-card-theme-private.h \
- games-card-themes.c \
- games-card-themes.h \
- games-pixbuf-utils.c \
- games-pixbuf-utils.h \
- $(NULL)
-
-if HAVE_CLUTTER
-libgamescards_la_SOURCES += \
- games-card-textures-cache.c \
- games-card-textures-cache.h \
- $(NULL)
-endif # HAVE_CLUTTER
-
-if HAVE_RSVG
-libgamescards_la_SOURCES += games-card-theme-preimage.c
-
-if ENABLE_CARD_THEME_FORMAT_SVG
-libgamescards_la_SOURCES += games-card-theme-svg.c
-endif
-
-if ENABLE_CARD_THEME_FORMAT_KDE
-libgamescards_la_SOURCES += games-card-theme-kde.c
-endif
-
-endif # HAVE_RSVG
-
-if ENABLE_CARD_THEME_FORMAT_SLICED
-if !HAVE_RSVG
-libgamescards_la_SOURCES += games-card-theme-preimage.c
-endif
-libgamescards_la_SOURCES += games-card-theme-sliced.c
-endif # ENABLE_CARD_THEME_FORMAT_SLICED
-
-if ENABLE_CARD_THEME_FORMAT_PYSOL
-libgamescards_la_SOURCES += games-card-theme-pysol.c
-endif
-
-if ENABLE_CARD_THEME_FORMAT_FIXED
-libgamescards_la_SOURCES += games-card-theme-fixed.c
-endif
-
-libgamescards_la_CPPFLAGS = \
- $(AM_CPPFLAGS)
-
-libgamescards_la_CFLAGS = \
- $(GTK_CFLAGS) \
- $(AM_CFLAGS)
-
-libgamescards_la_LIBADD = \
- libgames-support.la \
- $(GTK_LIBS)
-
-if HAVE_RSVG
-libgamescards_la_CFLAGS += $(RSVG_CFLAGS)
-libgamescards_la_LIBADD += $(RSVG_LIBS)
-endif # HAVE_RSVG
-
-if HAVE_CLUTTER
-libgamescards_la_CFLAGS += $(CLUTTER_CFLAGS)
-libgamescards_la_LIBADD += $(CLUTTER_LIBS)
-endif # HAVE_CLUTTER
-
-if ENABLE_CARD_THEMES_INSTALLER
-libgamescards_la_CFLAGS += $(DBUS_GLIB_CFLAGS)
-libgamescards_la_LIBADD += $(DBUS_GLIB_LIBS)
-endif # ENABLE_CARD_THEMES_INSTALLER
-
-if HAVE_HILDON
-libgamescards_la_CFLAGS += $(HILDON_CFLAGS)
-libgamescards_la_LIBADD += $(HILDON_LIBS)
-endif
-
-# Data used in libgamescards
-
-if ENABLE_CARD_THEME_FORMAT_SVG
-carddir = $(commondatadir)/cards
-dist_card_DATA = \
- gnomangelo_bitmap.svg \
- $(NULL)
-endif # ENABLE_CARD_THEME_FORMAT_SVG
-
-if HAVE_RSVG
-slotdir = $(pkgdatadir)/pixmaps
-dist_slot_DATA = slot.svg
-endif # HAVE_RSVG
-
-if ENABLE_CARD_THEMES_INSTALLER
-themeinstalldir = $(commondatadir)
-dist_themeinstall_DATA = theme-install.ini
-endif # ENABLE_CARD_THEMES_INSTALLER
-
-endif # BUILD_LIBGAMESCARDS
-
-# Auxiliary programme to prerender card images
-
-if BUILD_LIBGAMESCARDS
-if HAVE_RSVG
-
-pkglib_PROGRAMS = gnome-games-render-cards
-
-gnome_games_render_cards_SOURCES = \
- render-cards.c
-
-gnome_games_render_cards_CPPFLAGS = \
- $(AM_CPPFLAGS)
-
-gnome_games_render_cards_CFLAGS = \
- $(GTK_CFLAGS) \
- $(RSVG_CFLAGS) \
- $(AM_CFLAGS)
-
-gnome_games_render_cards_LDFLAGS = \
- $(AM_LDFLAGS)
-
-gnome_games_render_cards_LDADD = \
- libgames-support.la \
- libgamescards.la \
- $(GTK_LIBS) \
- $(RSVG_LIBS)
-
-if WITH_GTHREAD
-gnome_games_render_cards_CFLAGS += $(GHTREAD_CFLAGS)
-gnome_games_render_cards_LDADD += $(GTHREAD_LIBS)
-endif # WITH_GTHREAD
-
-endif # HAVE_RSVG
-endif # BUILD_LIBGAMESCARDS
-
install-data-local:
if GCONF_SCHEMAS_INSTALL
if test -z "$(DESTDIR)" ; then \
diff --git a/libgames-support/games-files.c b/libgames-support/games-files.c
index 041e83a..473f7bf 100644
--- a/libgames-support/games-files.c
+++ b/libgames-support/games-files.c
@@ -40,7 +40,6 @@
#endif
#endif
-#include "games-card.h"
#include "games-runtime.h"
#include "games-files.h"
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e9a4dfd..b6ee48d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -16,6 +16,7 @@ aisleriot/sol.scm
aisleriot/stats-dialog.c
aisleriot/util.c
aisleriot/window.c
+aisleriot/lib/ar-card.c
aisleriot/rules/accordion.scm
aisleriot/rules/agnes.scm
aisleriot/rules/athena.scm
@@ -245,7 +246,6 @@ libgames-support/eggsmclient.c
libgames-support/eggsmclient-osx.c
libgames-support/eggsmclient-win32.c
libgames-support/eggsmclient-xsmp.c
-libgames-support/games-card.c
libgames-support/games-controls.c
libgames-support/games-files.c
libgames-support/games-gridframe.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]