[libchamplain] Make fade-in a property of a tile
- From: Pierre-Luc Beaudoin <plbeaudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] Make fade-in a property of a tile
- Date: Tue, 23 Mar 2010 14:43:11 +0000 (UTC)
commit bce55b53e6f65ddfc6a791ef46cd6c4501221919
Author: JiÅ?Ã Techet <techet gmail com>
Date: Fri Mar 19 21:49:37 2010 +0100
Make fade-in a property of a tile
fade-in should be independent of champlain_tile_set_content() for greater
flexibility. In addition, memphis and error tile sources load tiles fast
and don't need to be faded in.
Signed-off-by: JiÅ?Ã Techet <techet gmail com>
champlain/champlain-error-tile-source.c | 2 +-
champlain/champlain-file-cache.c | 2 +-
champlain/champlain-memphis-tile-source.c | 2 +-
champlain/champlain-network-tile-source.c | 3 +-
champlain/champlain-tile.c | 66 +++++++++++++++++++++++++---
champlain/champlain-tile.h | 5 +-
6 files changed, 67 insertions(+), 13 deletions(-)
---
diff --git a/champlain/champlain-error-tile-source.c b/champlain/champlain-error-tile-source.c
index e56968d..b100823 100644
--- a/champlain/champlain-error-tile-source.c
+++ b/champlain/champlain-error-tile-source.c
@@ -147,6 +147,6 @@ fill_tile (ChamplainMapSource *map_source, ChamplainTile *tile)
clone = clutter_clone_new (priv->error_actor);
- champlain_tile_set_content (tile, clone, TRUE);
+ champlain_tile_set_content (tile, clone);
champlain_tile_set_state (tile, CHAMPLAIN_STATE_DONE);
}
diff --git a/champlain/champlain-file-cache.c b/champlain/champlain-file-cache.c
index 71c6c6a..74855fa 100644
--- a/champlain/champlain-file-cache.c
+++ b/champlain/champlain-file-cache.c
@@ -599,7 +599,7 @@ tile_loaded_cb (ClutterTexture *texture,
goto load_next;
}
- champlain_tile_set_content (tile, actor, FALSE);
+ champlain_tile_set_content (tile, actor);
/* Retrieve modification time */
file = g_file_new_for_path (filename);
diff --git a/champlain/champlain-memphis-tile-source.c b/champlain/champlain-memphis-tile-source.c
index 59b9b31..7062241 100644
--- a/champlain/champlain-memphis-tile-source.c
+++ b/champlain/champlain-memphis-tile-source.c
@@ -407,7 +407,7 @@ tile_loaded_cb (gpointer worker_data)
g_object_unref (pixbuf);
}
- champlain_tile_set_content (tile, actor, TRUE);
+ champlain_tile_set_content (tile, actor);
champlain_tile_set_state (tile, CHAMPLAIN_STATE_DONE);
cleanup:
diff --git a/champlain/champlain-network-tile-source.c b/champlain/champlain-network-tile-source.c
index 92efe4a..6184a87 100644
--- a/champlain/champlain-network-tile-source.c
+++ b/champlain/champlain-network-tile-source.c
@@ -624,7 +624,8 @@ tile_loaded_cb (SoupSession *session,
goto load_next_cleanup;
}
- champlain_tile_set_content (tile, actor, TRUE);
+ champlain_tile_set_fade_in (tile, TRUE);
+ champlain_tile_set_content (tile, actor);
goto finish;
diff --git a/champlain/champlain-tile.c b/champlain/champlain-tile.c
index c7b4ca5..b9baf65 100644
--- a/champlain/champlain-tile.c
+++ b/champlain/champlain-tile.c
@@ -48,7 +48,8 @@ enum
PROP_SIZE,
PROP_STATE,
PROP_CONTENT,
- PROP_ETAG
+ PROP_ETAG,
+ PROP_FADE_IN
};
struct _ChamplainTilePrivate {
@@ -95,6 +96,9 @@ champlain_tile_get_property (GObject *object,
case PROP_ETAG:
g_value_set_string (value, champlain_tile_get_etag (self));
break;
+ case PROP_FADE_IN:
+ g_value_set_boolean (value, champlain_tile_get_fade_in (self));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -125,11 +129,14 @@ champlain_tile_set_property (GObject *object,
champlain_tile_set_state (self, g_value_get_enum (value));
break;
case PROP_CONTENT:
- champlain_tile_set_content (self, g_value_get_object (value), FALSE);
+ champlain_tile_set_content (self, g_value_get_object (value));
break;
case PROP_ETAG:
champlain_tile_set_etag (self, g_value_get_string (value));
break;
+ case PROP_FADE_IN:
+ champlain_tile_set_fade_in (self, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
@@ -281,6 +288,20 @@ champlain_tile_class_init (ChamplainTileClass *klass)
NULL,
G_PARAM_READWRITE));
+ /**
+ * ChamplainTile:fade-in:
+ *
+ * Specifies whether the tile should fade in when loading
+ *
+ * Since: 0.6
+ */
+ g_object_class_install_property (object_class,
+ PROP_FADE_IN,
+ g_param_spec_boolean ("fade-in",
+ "Fade In",
+ "Tile should fade in",
+ FALSE,
+ G_PARAM_READWRITE));
}
static void
@@ -657,7 +678,6 @@ champlain_tile_set_etag (ChamplainTile *self,
* champlain_tile_set_content:
* @self: the #ChamplainTile
* @actor: the new content
- * @fade_in: if the new content should be faded in
*
* Sets the tile's content
*
@@ -665,16 +685,13 @@ champlain_tile_set_etag (ChamplainTile *self,
*/
void
champlain_tile_set_content (ChamplainTile *self,
- ClutterActor *actor,
- gboolean fade_in)
+ ClutterActor *actor)
{
g_return_if_fail (CHAMPLAIN_TILE (self));
g_return_if_fail (CLUTTER_ACTOR (actor));
ChamplainTilePrivate *priv = GET_PRIVATE (self);
- priv->fade_in = fade_in;
-
if (priv->content_actor &&
clutter_actor_get_parent (priv->content_actor) != CLUTTER_ACTOR (self))
clutter_actor_destroy (priv->content_actor);
@@ -700,3 +717,38 @@ champlain_tile_get_content (ChamplainTile *self)
return GET_PRIVATE (self)->content_actor;
}
+
+/**
+ * champlain_tile_get_fade_in:
+ * @self: the #ChamplainTile
+ *
+ * Returns: the return value determines whether the tile should fade in when loading.
+ *
+ * Since: 0.6
+ */
+gboolean
+champlain_tile_get_fade_in (ChamplainTile *self)
+{
+ g_return_val_if_fail (CHAMPLAIN_TILE (self), FALSE);
+
+ return GET_PRIVATE (self)->fade_in;
+}
+
+/**
+ * champlain_tile_set_fade_in:
+ * @self: the #ChamplainTile
+ * @fade_in: determines whether the tile should fade in when loading
+ *
+ * Sets the flag determining whether the tile should fade in when loading
+ *
+ * Since: 0.6
+ */
+void
+champlain_tile_set_fade_in (ChamplainTile *self, gboolean fade_in)
+{
+ g_return_if_fail (CHAMPLAIN_TILE (self));
+
+ GET_PRIVATE (self)->fade_in = fade_in;
+
+ g_object_notify (G_OBJECT (self), "fade-in");
+}
diff --git a/champlain/champlain-tile.h b/champlain/champlain-tile.h
index 2ee4863..586b45a 100644
--- a/champlain/champlain-tile.h
+++ b/champlain/champlain-tile.h
@@ -73,6 +73,7 @@ ClutterActor * champlain_tile_get_content (ChamplainTile *self);
const GTimeVal * champlain_tile_get_modified_time (ChamplainTile *self);
gchar * champlain_tile_get_modified_time_string (ChamplainTile *self);
const gchar * champlain_tile_get_etag (ChamplainTile *self);
+gboolean champlain_tile_get_fade_in (ChamplainTile *self);
void champlain_tile_set_x (ChamplainTile *self,
gint x);
@@ -84,12 +85,12 @@ void champlain_tile_set_size (ChamplainTile *self,
void champlain_tile_set_state (ChamplainTile *self,
ChamplainState state);
void champlain_tile_set_content (ChamplainTile *self,
- ClutterActor* actor,
- gboolean fade_in);
+ ClutterActor* actor);
void champlain_tile_set_etag (ChamplainTile *self,
const gchar *etag);
void champlain_tile_set_modified_time (ChamplainTile *self,
const GTimeVal *time);
+void champlain_tile_set_fade_in (ChamplainTile *self, gboolean fade_in);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]