[gnome-games] aisleriot: Add widget style property for card-step
- From: Christian Persch <chpe src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-games] aisleriot: Add widget style property for card-step
- Date: Mon, 4 Jan 2010 13:16:04 +0000 (UTC)
commit 5a02a1661ab3e85a7d6163818e5ba96435b8157f
Author: Christian Persch <chpe gnome org>
Date: Mon Jan 4 14:15:49 2010 +0100
aisleriot: Add widget style property for card-step
aisleriot/ar-clutter-embed.c | 27 +++++++++++++++++++++++++--
aisleriot/ar-style-private.h | 3 +++
aisleriot/ar-style.c | 4 ++--
3 files changed, 30 insertions(+), 4 deletions(-)
---
diff --git a/aisleriot/ar-clutter-embed.c b/aisleriot/ar-clutter-embed.c
index edee8db..611473f 100644
--- a/aisleriot/ar-clutter-embed.c
+++ b/aisleriot/ar-clutter-embed.c
@@ -273,7 +273,7 @@ ar_clutter_embed_style_set (GtkWidget *widget,
ClutterColor selection_color;
int focus_line_width, focus_padding;
gboolean interior_focus;
- double card_slot_ratio, card_overhang;
+ double card_slot_ratio, card_overhang, card_step;
GTK_WIDGET_CLASS (ar_clutter_embed_parent_class)->style_set (widget, previous_style);
@@ -285,6 +285,7 @@ ar_clutter_embed_style_set (GtkWidget *widget,
"focus-padding", &focus_padding,
"card-slot-ratio", &card_slot_ratio,
"card-overhang", &card_overhang,
+ "card-step", &card_step,
"selection-color", &color,
NULL);
@@ -318,6 +319,12 @@ ar_clutter_embed_style_set (GtkWidget *widget,
g_object_notify (style_object, AR_STYLE_PROP_CARD_OVERHANG);
}
+ if (style_priv->card_step != card_step) {
+ style_priv->card_step = card_step;
+
+ g_object_notify (style_object, AR_STYLE_PROP_CARD_STEP);
+ }
+
if (color != NULL) {
_ar_clutter_color_from_gdk_color (&selection_color, color);
gdk_color_free (color);
@@ -521,13 +528,29 @@ ar_clutter_embed_class_init (ArClutterEmbedClass *klass)
/**
* ArClutterEmbed:card-overhang:
- */
+ *
+ * This controls how much of a card is allowed to hang off of the bottom
+ * of the screen. If set to %0.0, the last card is always fully visible.
+ */
gtk_widget_class_install_style_property
(widget_class,
g_param_spec_double ("card-overhang", NULL, NULL,
0.0, 1.0, DEFAULT_CARD_OVERHANG,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
+
+ /**
+ * ArClutterEmbed:card-step:
+ *
+ * This controls how much one card is offset the previous one in card stacks.
+ * A game-specified a value for the card step takes precedence over this.
+ */
+ gtk_widget_class_install_style_property
+ (widget_class,
+ g_param_spec_double ("card-step", NULL, NULL,
+ MIN_CARD_STEP, MAX_CARD_STEP, DEFAULT_CARD_STEP,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS));
}
/* public API */
diff --git a/aisleriot/ar-style-private.h b/aisleriot/ar-style-private.h
index c38fb59..0096336 100644
--- a/aisleriot/ar-style-private.h
+++ b/aisleriot/ar-style-private.h
@@ -32,6 +32,9 @@ static const GdkColor default_selection_color = { 0, 0 /* red */, 0 /* green */,
#endif /* !DEFAULT_CARD_SLOT_RATIO */
#define DEFAULT_CARD_OVERHANG (0.0)
+
+#define MIN_CARD_STEP (0.0)
+#define MAX_CARD_STEP (1.0) /* FIXMEchpe: allow values > 1.0 here? */
#define DEFAULT_CARD_STEP (0.2)
struct _ArStylePrivate
diff --git a/aisleriot/ar-style.c b/aisleriot/ar-style.c
index e885205..3d40ff6 100644
--- a/aisleriot/ar-style.c
+++ b/aisleriot/ar-style.c
@@ -279,13 +279,13 @@ ar_style_class_init (ArStyleClass *klass)
* ArStyle:card-step:
*
* This controls how much one card is offset the previous one in card stacks.
+ * A game-specified a value for the card step takes precedence over this.
*/
g_object_class_install_property
(object_class,
PROP_CARD_STEP,
g_param_spec_double (AR_STYLE_PROP_CARD_STEP, NULL, NULL,
- /* FIXMEchpe: allow values > 1.0 here? */
- 0.0, 1.0, DEFAULT_CARD_STEP,
+ MIN_CARD_STEP, MAX_CARD_STEP, DEFAULT_CARD_STEP,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]