[libchamplain] Reformat code with uncrustify and fix manually
- From: Jiří Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] Reformat code with uncrustify and fix manually
- Date: Sun, 1 Aug 2010 23:16:59 +0000 (UTC)
commit 8d6d014b10a7ca3d182cfd00f4b13f7baf4713b3
Author: JiÅ?Ã Techet <techet gmail com>
Date: Mon Aug 2 00:18:31 2010 +0200
Reformat code with uncrustify and fix manually
uncrustify seems to be a very good and customizable
pretty-printer and does a very good job formating
the code to match the telepathy style. The minor problems
where it failed were corrected manually.
Signed-off-by: JiÅ?Ã Techet <techet gmail com>
champlain-gtk/gtk-champlain-embed.c | 120 ++-
champlain-gtk/gtk-champlain-embed.h | 15 +-
champlain/champlain-base-marker.c | 158 ++--
champlain/champlain-base-marker.h | 15 +-
champlain/champlain-bounding-box.c | 4 +
champlain/champlain-bounding-box.h | 7 +-
champlain/champlain-debug.c | 17 +-
champlain/champlain-debug.h | 7 +-
champlain/champlain-defines.h | 2 +-
champlain/champlain-file-cache.c | 228 +++--
champlain/champlain-file-cache.h | 4 +-
champlain/champlain-file-tile-source.c | 27 +-
champlain/champlain-file-tile-source.h | 11 +-
champlain/champlain-image-renderer.c | 54 +-
champlain/champlain-image-renderer.h | 14 +-
champlain/champlain-layer.c | 37 +-
champlain/champlain-layer.h | 12 +-
champlain/champlain-map-source-chain.c | 76 +-
champlain/champlain-map-source-chain.h | 2 +-
champlain/champlain-map-source-desc.c | 7 +-
champlain/champlain-map-source-desc.h | 14 +-
champlain/champlain-map-source-factory.c | 279 +++---
champlain/champlain-map-source-factory.h | 28 +-
champlain/champlain-map-source.c | 162 ++--
champlain/champlain-map-source.h | 41 +-
champlain/champlain-marker.c | 464 +++++----
champlain/champlain-marker.h | 32 +-
champlain/champlain-memory-cache.h | 3 +-
champlain/champlain-memphis-renderer.c | 174 ++--
champlain/champlain-memphis-renderer.h | 31 +-
champlain/champlain-network-bbox-tile-source.c | 138 ++--
champlain/champlain-network-bbox-tile-source.h | 12 +-
champlain/champlain-network-tile-source.c | 161 ++--
champlain/champlain-network-tile-source.h | 6 +-
champlain/champlain-null-tile-source.c | 2 +-
champlain/champlain-point.c | 3 +
champlain/champlain-point.h | 4 +-
champlain/champlain-polygon.c | 287 +++---
champlain/champlain-polygon.h | 22 +-
champlain/champlain-private.h | 8 +-
champlain/champlain-renderer.c | 30 +-
champlain/champlain-renderer.h | 32 +-
champlain/champlain-selection-layer.c | 93 ++-
champlain/champlain-selection-layer.h | 17 +-
champlain/champlain-tile-cache.c | 22 +-
champlain/champlain-tile-cache.h | 7 +-
champlain/champlain-tile-source.c | 162 ++--
champlain/champlain-tile.c | 265 +++--
champlain/champlain-tile.h | 25 +-
champlain/champlain-view.c | 1271 +++++++++++++-----------
champlain/champlain-view.h | 27 +-
champlain/champlain.h | 30 +-
demos/animated-marker.c | 6 +-
demos/launcher-gtk.c | 92 +-
demos/launcher.c | 20 +-
demos/local-rendering.c | 156 ++--
demos/markers.c | 10 +-
demos/markers.h | 2 +-
demos/minimal-gtk.c | 4 +-
demos/minimal.c | 4 +-
demos/polygons.c | 9 +-
demos/url-marker.c | 43 +-
62 files changed, 2860 insertions(+), 2155 deletions(-)
---
diff --git a/champlain-gtk/gtk-champlain-embed.c b/champlain-gtk/gtk-champlain-embed.c
index 3c9999f..b592ad5 100644
--- a/champlain-gtk/gtk-champlain-embed.c
+++ b/champlain-gtk/gtk-champlain-embed.c
@@ -51,10 +51,10 @@ enum
PROP_VIEW
};
-//static guint gtk_champlain_embed_embed_signals[LAST_SIGNAL] = { 0, };
+/* static guint gtk_champlain_embed_embed_signals[LAST_SIGNAL] = { 0, }; */
#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), GTK_TYPE_CHAMPLAIN_EMBED, GtkChamplainEmbedPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_CHAMPLAIN_EMBED, GtkChamplainEmbedPrivate))
struct _GtkChamplainEmbedPrivate
{
@@ -69,20 +69,27 @@ struct _GtkChamplainEmbedPrivate
};
-static void gtk_champlain_embed_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec);
-static void gtk_champlain_embed_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec);
+static void gtk_champlain_embed_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gtk_champlain_embed_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void gtk_champlain_embed_finalize (GObject *object);
static void gtk_champlain_embed_dispose (GObject *object);
static void gtk_champlain_embed_class_init (GtkChamplainEmbedClass *klass);
static void gtk_champlain_embed_init (GtkChamplainEmbed *view);
static void view_size_allocated_cb (GtkWidget *widget,
- GtkAllocation *allocation, GtkChamplainEmbed *view);
-static gboolean mouse_button_cb (GtkWidget *widget, GdkEventButton *event,
+ GtkAllocation *allocation,
+ GtkChamplainEmbed *view);
+static gboolean mouse_button_cb (GtkWidget *widget,
+ GdkEventButton *event,
GtkChamplainEmbed *view);
static void view_size_allocated_cb (GtkWidget *widget,
- GtkAllocation *allocation, GtkChamplainEmbed *view);
+ GtkAllocation *allocation,
+ GtkChamplainEmbed *view);
static void view_realize_cb (GtkWidget *widget,
GtkChamplainEmbed *view);
@@ -97,32 +104,32 @@ gtk_champlain_embed_get_property (GObject *object,
GtkChamplainEmbed *embed = GTK_CHAMPLAIN_EMBED (object);
GtkChamplainEmbedPrivate *priv = embed->priv;
- switch(prop_id)
+ switch (prop_id)
{
- case PROP_VIEW:
- g_value_set_object (value, priv->view);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ case PROP_VIEW:
+ g_value_set_object (value, priv->view);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
+
static void
gtk_champlain_embed_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- //GtkChamplainEmbed *embed = GTK_CHAMPLAIN_EMBED (object);
- //GtkChamplainEmbedPrivate *priv = embed->priv;
-
- switch(prop_id)
- {
+ switch (prop_id)
+ {
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
+ }
}
+
static void
gtk_champlain_embed_dispose (GObject *object)
{
@@ -150,12 +157,14 @@ gtk_champlain_embed_dispose (GObject *object)
G_OBJECT_CLASS (gtk_champlain_embed_parent_class)->dispose (object);
}
+
static void
gtk_champlain_embed_finalize (GObject *object)
{
G_OBJECT_CLASS (gtk_champlain_embed_parent_class)->finalize (object);
}
+
static void
gtk_champlain_embed_class_init (GtkChamplainEmbedClass *klass)
{
@@ -168,23 +177,24 @@ gtk_champlain_embed_class_init (GtkChamplainEmbedClass *klass)
object_class->set_property = gtk_champlain_embed_set_property;
/**
- * GtkChamplainEmbed:champlain-view:
- *
- * The #ChamplainView to embed in the Gtk+ widget.
- *
- * Since: 0.4
- */
+ * GtkChamplainEmbed:champlain-view:
+ *
+ * The #ChamplainView to embed in the Gtk+ widget.
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_VIEW,
g_param_spec_object ("champlain-view",
- "Champlain view",
- "The ChamplainView to embed into the Gtk+ widget",
- CHAMPLAIN_TYPE_VIEW,
- G_PARAM_READABLE));
+ "Champlain view",
+ "The ChamplainView to embed into the Gtk+ widget",
+ CHAMPLAIN_TYPE_VIEW,
+ G_PARAM_READABLE));
}
+
static void
-set_view (GtkChamplainEmbed* embed,
+set_view (GtkChamplainEmbed *embed,
ChamplainView *view)
{
GtkChamplainEmbedPrivate *priv = embed->priv;
@@ -204,6 +214,7 @@ set_view (GtkChamplainEmbed* embed,
clutter_container_add_actor (CLUTTER_CONTAINER (stage), CLUTTER_ACTOR (priv->view));
}
+
static void
gtk_champlain_embed_init (GtkChamplainEmbed *embed)
{
@@ -211,46 +222,47 @@ gtk_champlain_embed_init (GtkChamplainEmbed *embed)
ClutterActor *stage;
GtkChamplainEmbedPrivate *priv = GET_PRIVATE (embed);
+
embed->priv = priv;
priv->clutter_embed = gtk_clutter_embed_new ();
g_signal_connect (priv->clutter_embed,
- "size-allocate",
- G_CALLBACK (view_size_allocated_cb),
- embed);
+ "size-allocate",
+ G_CALLBACK (view_size_allocated_cb),
+ embed);
g_signal_connect (priv->clutter_embed,
- "realize",
- G_CALLBACK (view_realize_cb),
- embed);
+ "realize",
+ G_CALLBACK (view_realize_cb),
+ embed);
g_signal_connect (priv->clutter_embed,
- "button-press-event",
- G_CALLBACK (mouse_button_cb),
- embed);
+ "button-press-event",
+ G_CALLBACK (mouse_button_cb),
+ embed);
g_signal_connect (priv->clutter_embed,
- "button-release-event",
- G_CALLBACK (mouse_button_cb),
- embed);
- // Setup cursors
+ "button-release-event",
+ G_CALLBACK (mouse_button_cb),
+ embed);
+ /* Setup cursors */
priv->cursor_hand_open = gdk_cursor_new (GDK_HAND1);
priv->cursor_hand_closed = gdk_cursor_new (GDK_FLEUR);
priv->view = NULL;
set_view (embed, CHAMPLAIN_VIEW (champlain_view_new ()));
- // Setup stage
+ /* Setup stage */
stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (priv->clutter_embed));
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
gtk_container_add (GTK_CONTAINER (embed), priv->clutter_embed);
-
}
+
static void
view_realize_cb (GtkWidget *widget,
GtkChamplainEmbed *view)
{
- ClutterColor color = {0, 0, 0, };
+ ClutterColor color = { 0, 0, 0, };
GtkChamplainEmbedPrivate *priv = view->priv;
/* Setup mouse cursor to a hand */
@@ -266,6 +278,7 @@ view_realize_cb (GtkWidget *widget,
/* To be added later: bg[active] (for selected markers, but focus is on another widget) */
}
+
static void
view_size_allocated_cb (GtkWidget *widget,
GtkAllocation *allocation,
@@ -280,6 +293,7 @@ view_size_allocated_cb (GtkWidget *widget,
priv->height = allocation->height;
}
+
static gboolean
mouse_button_cb (GtkWidget *widget,
GdkEventButton *event,
@@ -289,14 +303,15 @@ mouse_button_cb (GtkWidget *widget,
if (event->type == GDK_BUTTON_PRESS)
gdk_window_set_cursor (gtk_widget_get_window (priv->clutter_embed),
- priv->cursor_hand_closed);
+ priv->cursor_hand_closed);
else
gdk_window_set_cursor (gtk_widget_get_window (priv->clutter_embed),
- priv->cursor_hand_open);
+ priv->cursor_hand_open);
return FALSE;
}
+
/**
* gtk_champlain_embed_new:
*
@@ -312,6 +327,7 @@ gtk_champlain_embed_new ()
return g_object_new (GTK_TYPE_CHAMPLAIN_EMBED, NULL);
}
+
/**
* gtk_champlain_embed_get_view:
* @embed: a #ChamplainView, the map view to embed
@@ -323,9 +339,9 @@ gtk_champlain_embed_new ()
* Since: 0.4
*/
ChamplainView *
-gtk_champlain_embed_get_view (GtkChamplainEmbed* embed)
+gtk_champlain_embed_get_view (GtkChamplainEmbed *embed)
{
- g_return_val_if_fail (GTK_CHAMPLAIN_IS_EMBED(embed), NULL);
+ g_return_val_if_fail (GTK_CHAMPLAIN_IS_EMBED (embed), NULL);
GtkChamplainEmbedPrivate *priv = embed->priv;
return priv->view;
diff --git a/champlain-gtk/gtk-champlain-embed.h b/champlain-gtk/gtk-champlain-embed.h
index 34f34d3..b39bc61 100644
--- a/champlain-gtk/gtk-champlain-embed.h
+++ b/champlain-gtk/gtk-champlain-embed.h
@@ -29,22 +29,22 @@
G_BEGIN_DECLS
#define GTK_TYPE_CHAMPLAIN_EMBED \
- (gtk_champlain_embed_get_type())
+ (gtk_champlain_embed_get_type ())
#define GTK_CHAMPLAIN_EMBED(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_CHAMPLAIN_EMBED, GtkChamplainEmbed))
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CHAMPLAIN_EMBED, GtkChamplainEmbed))
#define GTK_CHAMPLAIN_EMBED_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_CHAMPLAIN_EMBED, GtkChamplainEmbedClass))
+ (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CHAMPLAIN_EMBED, GtkChamplainEmbedClass))
#define GTK_CHAMPLAIN_IS_EMBED(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_CHAMPLAIN_EMBED))
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CHAMPLAIN_EMBED))
#define GTK_CHAMPLAIN_IS_EMBED_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_CHAMPLAIN_EMBED))
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CHAMPLAIN_EMBED))
#define GTK_CHAMPLAIN_EMBED_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_CHAMPLAIN_EMBED, GtkChamplainEmbedClass))
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CHAMPLAIN_EMBED, GtkChamplainEmbedClass))
typedef struct _GtkChamplainEmbedPrivate GtkChamplainEmbedPrivate;
@@ -62,13 +62,12 @@ struct _GtkChamplainEmbed
struct _GtkChamplainEmbedClass
{
GtkAlignmentClass parent_class;
-
};
GType gtk_champlain_embed_get_type (void);
GtkWidget *gtk_champlain_embed_new (void);
-ChamplainView *gtk_champlain_embed_get_view (GtkChamplainEmbed* embed);
+ChamplainView *gtk_champlain_embed_get_view (GtkChamplainEmbed *embed);
G_END_DECLS
diff --git a/champlain/champlain-base-marker.c b/champlain/champlain-base-marker.c
index 3a76fe3..6251998 100644
--- a/champlain/champlain-base-marker.c
+++ b/champlain/champlain-base-marker.c
@@ -63,12 +63,12 @@ enum
PROP_HIGHLIGHTED,
};
-//static guint champlain_base_marker_signals[LAST_SIGNAL] = { 0, };
+/* static guint champlain_base_marker_signals[LAST_SIGNAL] = { 0, }; */
G_DEFINE_TYPE (ChamplainBaseMarker, champlain_base_marker, CLUTTER_TYPE_GROUP);
#define CHAMPLAIN_BASE_MARKER_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_BASE_MARKER, ChamplainBaseMarkerPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_BASE_MARKER, ChamplainBaseMarkerPrivate))
struct _ChamplainBaseMarkerPrivate
{
@@ -83,71 +83,81 @@ champlain_base_marker_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- ChamplainBaseMarker *base_marker = CHAMPLAIN_BASE_MARKER (object);
- ChamplainBaseMarkerPrivate *priv = base_marker->priv;
-
- switch (prop_id)
- {
- case PROP_LONGITUDE:
- g_value_set_double (value, priv->lon);
- break;
- case PROP_LATITUDE:
- g_value_set_double (value, priv->lat);
- break;
- case PROP_HIGHLIGHTED:
- g_value_set_boolean (value, priv->highlighted);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
+ ChamplainBaseMarker *base_marker = CHAMPLAIN_BASE_MARKER (object);
+ ChamplainBaseMarkerPrivate *priv = base_marker->priv;
+
+ switch (prop_id)
+ {
+ case PROP_LONGITUDE:
+ g_value_set_double (value, priv->lon);
+ break;
+
+ case PROP_LATITUDE:
+ g_value_set_double (value, priv->lat);
+ break;
+
+ case PROP_HIGHLIGHTED:
+ g_value_set_boolean (value, priv->highlighted);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
}
+
static void
champlain_base_marker_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- ChamplainBaseMarker *base_marker = CHAMPLAIN_BASE_MARKER (object);
- ChamplainBaseMarkerPrivate *priv = base_marker->priv;
+ ChamplainBaseMarker *base_marker = CHAMPLAIN_BASE_MARKER (object);
+ ChamplainBaseMarkerPrivate *priv = base_marker->priv;
+
+ switch (prop_id)
+ {
+ case PROP_LONGITUDE:
+ {
+ gdouble lon = g_value_get_double (value);
+ champlain_base_marker_set_position (base_marker, priv->lat, lon);
+ break;
+ }
+
+ case PROP_LATITUDE:
+ {
+ gdouble lat = g_value_get_double (value);
+ champlain_base_marker_set_position (base_marker, lat, priv->lon);
+ break;
+ }
- switch (prop_id)
+ case PROP_HIGHLIGHTED:
{
- case PROP_LONGITUDE:
- {
- gdouble lon = g_value_get_double (value);
- champlain_base_marker_set_position (base_marker, priv->lat, lon);
- break;
- }
- case PROP_LATITUDE:
- {
- gdouble lat = g_value_get_double (value);
- champlain_base_marker_set_position (base_marker, lat, priv->lon);
- break;
- }
- case PROP_HIGHLIGHTED:
- {
- gboolean bvalue = g_value_get_boolean (value);
- champlain_base_marker_set_highlighted (base_marker, bvalue);
- break;
- }
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ gboolean bvalue = g_value_get_boolean (value);
+ champlain_base_marker_set_highlighted (base_marker, bvalue);
+ break;
+ }
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
+
static void
champlain_base_marker_dispose (GObject *object)
{
G_OBJECT_CLASS (champlain_base_marker_parent_class)->dispose (object);
}
+
static void
champlain_base_marker_finalize (GObject *object)
{
G_OBJECT_CLASS (champlain_base_marker_parent_class)->finalize (object);
}
+
static void
champlain_base_marker_class_init (ChamplainBaseMarkerClass *marker_class)
{
@@ -160,42 +170,43 @@ champlain_base_marker_class_init (ChamplainBaseMarkerClass *marker_class)
object_class->set_property = champlain_base_marker_set_property;
/**
- * ChamplainBaseMarker:longitude:
- *
- * The longitude coordonate of the map
- *
- * Since: 0.4
- */
+ * ChamplainBaseMarker:longitude:
+ *
+ * The longitude coordonate of the map
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_LONGITUDE,
g_param_spec_double ("longitude", "Longitude",
"The longitude coordonate of the base_marker",
-180.0f, 180.0f, 0.0f, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainBaseMarker:latitude:
- *
- * The latitude coordonate of the map
- *
- * Since: 0.4
- */
+ * ChamplainBaseMarker:latitude:
+ *
+ * The latitude coordonate of the map
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_LATITUDE,
g_param_spec_double ("latitude", "Latitude",
"The latitude coordonate of the base_marker",
-90.0f, 90.0f, 0.0f, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainBaseMarker:highlighted:
- *
- * The highlighted state of the marker
- *
- * Since: 0.4
- */
+ * ChamplainBaseMarker:highlighted:
+ *
+ * The highlighted state of the marker
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_HIGHLIGHTED,
g_param_spec_boolean ("highlighted", "Highlighted",
"The highlighted stated of the marker",
FALSE, CHAMPLAIN_PARAM_READWRITE));
}
+
static void
champlain_base_marker_init (ChamplainBaseMarker *marker)
{
@@ -228,6 +239,7 @@ champlain_base_marker_new (void)
return CLUTTER_ACTOR (base_marker);
}
+
/**
* champlain_base_marker_set_position:
* @marker: a #ChamplainBaseMarker
@@ -254,6 +266,7 @@ champlain_base_marker_set_position (ChamplainBaseMarker *marker,
g_object_notify (G_OBJECT (marker), "longitude");
}
+
/**
* champlain_base_marker_get_latitude:
* @marker: a #ChamplainBaseMarker
@@ -264,13 +277,15 @@ champlain_base_marker_set_position (ChamplainBaseMarker *marker,
*
* Since: 0.6
*/
-gdouble champlain_base_marker_get_latitude (ChamplainBaseMarker *marker)
+gdouble
+champlain_base_marker_get_latitude (ChamplainBaseMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_BASE_MARKER (marker), 0.0);
return marker->priv->lat;
}
+
/**
* champlain_base_marker_get_longitude:
* @marker: a #ChamplainBaseMarker
@@ -281,13 +296,15 @@ gdouble champlain_base_marker_get_latitude (ChamplainBaseMarker *marker)
*
* Since: 0.6
*/
-gdouble champlain_base_marker_get_longitude (ChamplainBaseMarker *marker)
+gdouble
+champlain_base_marker_get_longitude (ChamplainBaseMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_BASE_MARKER (marker), 0.0);
return marker->priv->lon;
}
+
/**
* champlain_base_marker_set_highlighted:
* @marker: a #ChamplainBaseMarker
@@ -309,6 +326,7 @@ champlain_base_marker_set_highlighted (ChamplainBaseMarker *marker,
g_object_notify (G_OBJECT (marker), "highlighted");
}
+
/**
* champlain_base_marker_get_highlighted:
* @marker: a #ChamplainBaseMarker
@@ -327,6 +345,7 @@ champlain_base_marker_get_highlighted (ChamplainBaseMarker *marker)
return marker->priv->highlighted;
}
+
/**
* champlain_base_marker_animate_in:
* @marker: The marker
@@ -341,6 +360,7 @@ champlain_base_marker_animate_in (ChamplainBaseMarker *marker)
champlain_base_marker_animate_in_with_delay (marker, 0);
}
+
/**
* champlain_base_marker_animate_in_with_delay :
* @marker: The marker
@@ -373,6 +393,7 @@ champlain_base_marker_animate_in_with_delay (ChamplainBaseMarker *marker,
"scale-x", 1.0, "scale-y", 1.0, NULL);
}
+
/**
* champlain_base_marker_animate_out:
* @marker: The marker
@@ -387,8 +408,9 @@ champlain_base_marker_animate_out (ChamplainBaseMarker *marker)
champlain_base_marker_animate_out_with_delay (marker, 0);
}
+
static gboolean
-on_idle (ChamplainBaseMarker* marker)
+on_idle (ChamplainBaseMarker *marker)
{
/* Notify the view that the position changed so that the marker's
* position is reset, it has to happen on idle as Clutter seems to
@@ -400,16 +422,18 @@ on_idle (ChamplainBaseMarker* marker)
return FALSE;
}
+
static void
-on_animation_completed (G_GNUC_UNUSED ClutterAnimation* animation,
+on_animation_completed (G_GNUC_UNUSED ClutterAnimation *animation,
ChamplainBaseMarker *marker)
{
g_idle_add_full (G_PRIORITY_DEFAULT,
- (GSourceFunc)on_idle,
- g_object_ref (marker),
- (GDestroyNotify)g_object_unref);
+ (GSourceFunc) on_idle,
+ g_object_ref (marker),
+ (GDestroyNotify) g_object_unref);
}
+
/**
* champlain_base_marker_animate_out_with_delay :
* @marker: The marker
diff --git a/champlain/champlain-base-marker.h b/champlain/champlain-base-marker.h
index dd770f8..90266da 100644
--- a/champlain/champlain-base-marker.h
+++ b/champlain/champlain-base-marker.h
@@ -30,22 +30,22 @@
G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_BASE_MARKER champlain_base_marker_get_type()
+#define CHAMPLAIN_TYPE_BASE_MARKER champlain_base_marker_get_type ()
#define CHAMPLAIN_BASE_MARKER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), CHAMPLAIN_TYPE_BASE_MARKER, ChamplainBaseMarker))
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_BASE_MARKER, ChamplainBaseMarker))
#define CHAMPLAIN_BASE_MARKER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), CHAMPLAIN_TYPE_BASE_MARKER, ChamplainBaseMarkerClass))
+ (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_BASE_MARKER, ChamplainBaseMarkerClass))
#define CHAMPLAIN_IS_BASE_MARKER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), CHAMPLAIN_TYPE_BASE_MARKER))
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_BASE_MARKER))
#define CHAMPLAIN_IS_BASE_MARKER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), CHAMPLAIN_TYPE_BASE_MARKER))
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_BASE_MARKER))
#define CHAMPLAIN_BASE_MARKER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), CHAMPLAIN_TYPE_BASE_MARKER, ChamplainBaseMarkerClass))
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_BASE_MARKER, ChamplainBaseMarkerClass))
typedef struct _ChamplainBaseMarkerPrivate ChamplainBaseMarkerPrivate;
@@ -70,7 +70,8 @@ GType champlain_base_marker_get_type (void);
ClutterActor *champlain_base_marker_new (void);
void champlain_base_marker_set_position (ChamplainBaseMarker *marker,
- gdouble latitude, gdouble longitude);
+ gdouble latitude,
+ gdouble longitude);
gdouble champlain_base_marker_get_latitude (ChamplainBaseMarker *marker);
gdouble champlain_base_marker_get_longitude (ChamplainBaseMarker *marker);
void champlain_base_marker_set_highlighted (ChamplainBaseMarker *marker,
diff --git a/champlain/champlain-bounding-box.c b/champlain/champlain-bounding-box.c
index 0cd8fef..531706b 100644
--- a/champlain/champlain-bounding-box.c
+++ b/champlain/champlain-bounding-box.c
@@ -45,6 +45,7 @@ champlain_bounding_box_get_type (void)
return type;
}
+
/**
* champlain_bounding_box_new:
*
@@ -61,6 +62,7 @@ champlain_bounding_box_new (void)
return g_slice_new (ChamplainBoundingBox);
}
+
/**
* champlain_bounding_box_copy:
* @bbox: a #ChamplainBoundingBox
@@ -81,6 +83,7 @@ champlain_bounding_box_copy (const ChamplainBoundingBox *bbox)
return NULL;
}
+
/**
* champlain_bounding_box_free:
* @bbox: a #ChamplainBoundingBox
@@ -99,6 +102,7 @@ champlain_bounding_box_free (ChamplainBoundingBox *bbox)
g_slice_free (ChamplainBoundingBox, bbox);
}
+
/**
* champlain_bounding_box_get_center:
* @bbox: a #ChamplainBoundingBox
diff --git a/champlain/champlain-bounding-box.h b/champlain/champlain-bounding-box.h
index 3bf5a8f..7d97bc5 100644
--- a/champlain/champlain-bounding-box.h
+++ b/champlain/champlain-bounding-box.h
@@ -42,7 +42,8 @@ typedef struct _ChamplainBoundingBox ChamplainBoundingBox;
*
* Since: 0.6
*/
-struct _ChamplainBoundingBox {
+struct _ChamplainBoundingBox
+{
gdouble left;
gdouble bottom;
gdouble right;
@@ -52,9 +53,9 @@ struct _ChamplainBoundingBox {
GType champlain_bounding_box_get_type (void) G_GNUC_CONST;
#define CHAMPLAIN_TYPE_BOUNDING_BOX (champlain_bounding_box_get_type ())
-ChamplainBoundingBox * champlain_bounding_box_new (void);
+ChamplainBoundingBox *champlain_bounding_box_new (void);
-ChamplainBoundingBox * champlain_bounding_box_copy (const ChamplainBoundingBox *bbox);
+ChamplainBoundingBox *champlain_bounding_box_copy (const ChamplainBoundingBox *bbox);
void champlain_bounding_box_free (ChamplainBoundingBox *bbox);
diff --git a/champlain/champlain-debug.c b/champlain/champlain-debug.c
index 40828c7..582d8be 100644
--- a/champlain/champlain-debug.c
+++ b/champlain/champlain-debug.c
@@ -52,27 +52,31 @@ debug_set_flags (ChamplainDebugFlags new_flags)
flags |= new_flags;
}
+
void
champlain_debug_set_flags (const gchar *flags_string)
{
guint nkeys;
- for (nkeys = 0; keys[nkeys].value; nkeys++);
+ for (nkeys = 0; keys[nkeys].value; nkeys++)
+ ;
if (flags_string)
- debug_set_flags (g_parse_debug_string (flags_string, keys, nkeys));
+ debug_set_flags (g_parse_debug_string (flags_string, keys, nkeys));
}
+
gboolean
champlain_debug_flag_is_set (ChamplainDebugFlags flag)
{
return (flag & flags) != 0;
}
+
void
champlain_debug (ChamplainDebugFlags flag,
- const gchar *format,
- ...)
+ const gchar *format,
+ ...)
{
if (flag & flags)
{
@@ -83,6 +87,7 @@ champlain_debug (ChamplainDebugFlags flag,
}
}
+
#else
gboolean
@@ -91,15 +96,17 @@ champlain_debug_flag_is_set (ChamplainDebugFlags flag)
return FALSE;
}
+
void
champlain_debug (ChamplainDebugFlags flag, const gchar *format, ...)
{
}
+
void
champlain_debug_set_flags (const gchar *flags_string)
{
}
-#endif /* ENABLE_DEBUG */
+#endif /* ENABLE_DEBUG */
diff --git a/champlain/champlain-debug.h b/champlain/champlain-debug.h
index 5566c72..97a8a14 100644
--- a/champlain/champlain-debug.h
+++ b/champlain/champlain-debug.h
@@ -41,8 +41,9 @@ typedef enum
} ChamplainDebugFlags;
gboolean champlain_debug_flag_is_set (ChamplainDebugFlags flag);
-void champlain_debug (ChamplainDebugFlags flag, const gchar *format, ...)
- G_GNUC_PRINTF (2, 3);
+void champlain_debug (ChamplainDebugFlags flag,
+ const gchar *format,
+ ...) G_GNUC_PRINTF (2, 3);
void champlain_debug_set_flags (const gchar *flags_string);
G_END_DECLS
@@ -71,7 +72,7 @@ G_END_DECLS
#undef DEBUG
#define DEBUG(format, ...) \
- champlain_debug (DEBUG_FLAG, "%s: " format, G_STRFUNC, ##__VA_ARGS__)
+ champlain_debug (DEBUG_FLAG, "%s: " format, G_STRFUNC, ## __VA_ARGS__)
#undef DEBUGGING
#define DEBUGGING champlain_debug_flag_is_set (DEBUG_FLAG)
diff --git a/champlain/champlain-defines.h b/champlain/champlain-defines.h
index 767e8d7..56ba8f2 100644
--- a/champlain/champlain-defines.h
+++ b/champlain/champlain-defines.h
@@ -23,7 +23,7 @@
#ifndef CHAMPLAIN_DEFINES_H
#define CHAMPLAIN_DEFINES_H
-#define CHAMPLAIN_API __attribute__((visibility("default")))
+#define CHAMPLAIN_API __attribute__((visibility ("default")))
typedef struct _ChamplainView ChamplainView;
typedef struct _ChamplainViewClass ChamplainViewClass;
diff --git a/champlain/champlain-file-cache.c b/champlain/champlain-file-cache.c
index c759718..37b140a 100644
--- a/champlain/champlain-file-cache.c
+++ b/champlain/champlain-file-cache.c
@@ -41,7 +41,7 @@
G_DEFINE_TYPE (ChamplainFileCache, champlain_file_cache, CHAMPLAIN_TYPE_TILE_CACHE);
#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_FILE_CACHE, ChamplainFileCachePrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_FILE_CACHE, ChamplainFileCachePrivate))
enum
{
@@ -61,7 +61,7 @@ struct _ChamplainFileCachePrivate
};
static void finalize_sql (ChamplainFileCache *file_cache);
-static void init_cache (ChamplainFileCache *file_cache);
+static void init_cache (ChamplainFileCache *file_cache);
static gchar *get_filename (ChamplainFileCache *file_cache,
ChamplainTile *tile);
static gboolean tile_is_expired (ChamplainFileCache *file_cache,
@@ -95,14 +95,17 @@ champlain_file_cache_get_property (GObject *object,
case PROP_SIZE_LIMIT:
g_value_set_uint (value, champlain_file_cache_get_size_limit (file_cache));
break;
+
case PROP_CACHE_DIR:
g_value_set_string (value, champlain_file_cache_get_cache_dir (file_cache));
break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
+
static void
champlain_file_cache_set_property (GObject *object,
guint property_id,
@@ -117,22 +120,26 @@ champlain_file_cache_set_property (GObject *object,
case PROP_SIZE_LIMIT:
champlain_file_cache_set_size_limit (file_cache, g_value_get_uint (value));
break;
+
case PROP_CACHE_DIR:
if (priv->cache_dir)
g_free (priv->cache_dir);
priv->cache_dir = g_strdup (g_value_get_string (value));
break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
+
static void
champlain_file_cache_dispose (GObject *object)
{
G_OBJECT_CLASS (champlain_file_cache_parent_class)->dispose (object);
}
+
static void
finalize_sql (ChamplainFileCache *file_cache)
{
@@ -161,11 +168,10 @@ finalize_sql (ChamplainFileCache *file_cache)
}
-
static void
champlain_file_cache_finalize (GObject *object)
{
- ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE(object);
+ ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE (object);
ChamplainFileCachePrivate *priv = file_cache->priv;
finalize_sql (file_cache);
@@ -175,6 +181,7 @@ champlain_file_cache_finalize (GObject *object)
G_OBJECT_CLASS (champlain_file_cache_parent_class)->finalize (object);
}
+
static gboolean
create_cache_dir (const gchar *dir_name)
{
@@ -184,7 +191,7 @@ create_cache_dir (const gchar *dir_name)
if (g_mkdir_with_parents (dir_name, 0700) == -1 && errno != EEXIST)
{
g_warning ("Unable to create the image cache path '%s': %s",
- dir_name, g_strerror (errno));
+ dir_name, g_strerror (errno));
return FALSE;
}
}
@@ -193,7 +200,7 @@ create_cache_dir (const gchar *dir_name)
static void
-init_cache (ChamplainFileCache *file_cache)
+init_cache (ChamplainFileCache *file_cache)
{
ChamplainFileCachePrivate *priv = file_cache->priv;
gchar *filename = NULL;
@@ -203,9 +210,9 @@ init_cache (ChamplainFileCache *file_cache)
g_return_if_fail (create_cache_dir (priv->cache_dir));
filename = g_build_filename (priv->cache_dir,
- "cache.db", NULL);
+ "cache.db", NULL);
error = sqlite3_open_v2 (filename, &priv->db,
- SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
+ SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
g_free (filename);
if (error == SQLITE_ERROR)
@@ -240,8 +247,8 @@ init_cache (ChamplainFileCache *file_cache)
}
error = sqlite3_prepare_v2 (priv->db,
- "SELECT etag FROM tiles WHERE filename = ?", -1,
- &priv->stmt_select, NULL);
+ "SELECT etag FROM tiles WHERE filename = ?", -1,
+ &priv->stmt_select, NULL);
if (error != SQLITE_OK)
{
priv->stmt_select = NULL;
@@ -251,8 +258,8 @@ init_cache (ChamplainFileCache *file_cache)
}
error = sqlite3_prepare_v2 (priv->db,
- "UPDATE tiles SET popularity = popularity + 1 WHERE filename = ?", -1,
- &priv->stmt_update, NULL);
+ "UPDATE tiles SET popularity = popularity + 1 WHERE filename = ?", -1,
+ &priv->stmt_update, NULL);
if (error != SQLITE_OK)
{
priv->stmt_update = NULL;
@@ -264,10 +271,11 @@ init_cache (ChamplainFileCache *file_cache)
g_object_notify (G_OBJECT (file_cache), "cache-dir");
}
+
static void
champlain_file_cache_constructed (GObject *object)
{
- ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE(object);
+ ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE (object);
ChamplainFileCachePrivate *priv = file_cache->priv;
if (!priv->cache_dir)
@@ -276,8 +284,8 @@ champlain_file_cache_constructed (GObject *object)
priv->cache_dir = g_strdup ("/home/user/MyDocs/.Maps/");
#else
priv->cache_dir = g_build_path (G_DIR_SEPARATOR_S,
- g_get_user_cache_dir (),
- "champlain", NULL);
+ g_get_user_cache_dir (),
+ "champlain", NULL);
#endif
}
@@ -286,6 +294,7 @@ champlain_file_cache_constructed (GObject *object)
G_OBJECT_CLASS (champlain_file_cache_parent_class)->constructed (object);
}
+
static void
champlain_file_cache_class_init (ChamplainFileCacheClass *klass)
{
@@ -304,35 +313,35 @@ champlain_file_cache_class_init (ChamplainFileCacheClass *klass)
object_class->constructed = champlain_file_cache_constructed;
/**
- * ChamplainFileCache:size-limit:
- *
- * The cache size limit in bytes.
- *
- * Note: this new value will not be applied until you call #champlain_cache_purge
- *
- * Since: 0.4
- */
+ * ChamplainFileCache:size-limit:
+ *
+ * The cache size limit in bytes.
+ *
+ * Note: this new value will not be applied until you call #champlain_cache_purge
+ *
+ * Since: 0.4
+ */
pspec = g_param_spec_uint ("size-limit",
- "Size Limit",
- "The cache's size limit (Mb)",
- 1,
- G_MAXINT,
- 100000000,
- G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
+ "Size Limit",
+ "The cache's size limit (Mb)",
+ 1,
+ G_MAXINT,
+ 100000000,
+ G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_SIZE_LIMIT, pspec);
/**
- * ChamplainFileCache:cache-dir:
- *
- * The directory where the tile database is stored.
- *
- * Since: 0.6
- */
+ * ChamplainFileCache:cache-dir:
+ *
+ * The directory where the tile database is stored.
+ *
+ * Since: 0.6
+ */
pspec = g_param_spec_string ("cache-dir",
- "Cache Directory",
- "The directory of the cache",
- cache_dir,
- G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
+ "Cache Directory",
+ "The directory of the cache",
+ cache_dir,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_CACHE_DIR, pspec);
tile_cache_class->store_tile = store_tile;
@@ -342,6 +351,7 @@ champlain_file_cache_class_init (ChamplainFileCacheClass *klass)
map_source_class->fill_tile = fill_tile;
}
+
static void
champlain_file_cache_init (ChamplainFileCache *file_cache)
{
@@ -357,6 +367,7 @@ champlain_file_cache_init (ChamplainFileCache *file_cache)
priv->stmt_update = NULL;
}
+
/**
* champlain_file_cache_new_full:
* @size_limit: maximal size of the cache in bytes
@@ -370,19 +381,22 @@ champlain_file_cache_init (ChamplainFileCache *file_cache)
*
* Since: 0.6
*/
-ChamplainFileCache* champlain_file_cache_new_full (guint size_limit,
+ChamplainFileCache *
+champlain_file_cache_new_full (guint size_limit,
const gchar *cache_dir,
ChamplainRenderer *renderer)
{
- ChamplainFileCache * cache;
- cache = g_object_new (CHAMPLAIN_TYPE_FILE_CACHE,
+ ChamplainFileCache *cache;
+
+ cache = g_object_new (CHAMPLAIN_TYPE_FILE_CACHE,
"size-limit", size_limit,
- "cache-dir", cache_dir,
+ "cache-dir", cache_dir,
"renderer", renderer,
NULL);
return cache;
}
+
/**
* champlain_file_cache_get_size_limit:
* @file_cache: a #ChamplainFileCache
@@ -401,6 +415,7 @@ champlain_file_cache_get_size_limit (ChamplainFileCache *file_cache)
return file_cache->priv->size_limit;
}
+
/**
* champlain_file_cache_get_cache_dir:
* @file_cache: a #ChamplainFileCache
@@ -419,6 +434,7 @@ champlain_file_cache_get_cache_dir (ChamplainFileCache *file_cache)
return file_cache->priv->cache_dir;
}
+
/**
* champlain_file_cache_set_size_limit:
* @file_cache: a #ChamplainFileCache
@@ -440,6 +456,7 @@ champlain_file_cache_set_size_limit (ChamplainFileCache *file_cache,
g_object_notify (G_OBJECT (file_cache), "size-limit");
}
+
static gchar *
get_filename (ChamplainFileCache *file_cache,
ChamplainTile *tile)
@@ -450,20 +467,21 @@ get_filename (ChamplainFileCache *file_cache,
g_return_val_if_fail (CHAMPLAIN_IS_TILE (tile), NULL);
g_return_val_if_fail (priv->cache_dir, NULL);
- ChamplainMapSource* map_source = CHAMPLAIN_MAP_SOURCE(file_cache);
+ ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE (file_cache);
gchar *filename = g_strdup_printf ("%s" G_DIR_SEPARATOR_S
- "%s" G_DIR_SEPARATOR_S
- "%d" G_DIR_SEPARATOR_S
- "%d" G_DIR_SEPARATOR_S "%d.png",
- priv->cache_dir,
- champlain_map_source_get_id (map_source),
- champlain_tile_get_zoom_level (tile),
- champlain_tile_get_x (tile),
- champlain_tile_get_y (tile));
+ "%s" G_DIR_SEPARATOR_S
+ "%d" G_DIR_SEPARATOR_S
+ "%d" G_DIR_SEPARATOR_S "%d.png",
+ priv->cache_dir,
+ champlain_map_source_get_id (map_source),
+ champlain_tile_get_zoom_level (tile),
+ champlain_tile_get_x (tile),
+ champlain_tile_get_y (tile));
return filename;
}
+
static gboolean
tile_is_expired (ChamplainFileCache *file_cache,
ChamplainTile *tile)
@@ -471,22 +489,23 @@ tile_is_expired (ChamplainFileCache *file_cache,
g_return_val_if_fail (CHAMPLAIN_FILE_CACHE (file_cache), FALSE);
g_return_val_if_fail (CHAMPLAIN_TILE (tile), FALSE);
- GTimeVal now = {0, };
+ GTimeVal now = { 0, };
const GTimeVal *modified_time = champlain_tile_get_modified_time (tile);
gboolean validate_cache = TRUE;
if (modified_time)
{
g_get_current_time (&now);
- g_time_val_add (&now, (-24ul * 60ul * 60ul * 1000ul * 1000ul * 7ul)); // Cache expires in 7 days
+ g_time_val_add (&now, (-24ul * 60ul * 60ul * 1000ul * 1000ul * 7ul)); /* Cache expires in 7 days */
validate_cache = modified_time->tv_sec < now.tv_sec;
}
- DEBUG ("%p is %s expired", tile, (validate_cache ? "": "not"));
+ DEBUG ("%p is %s expired", tile, (validate_cache ? "" : "not"));
return validate_cache;
}
+
typedef struct
{
ChamplainMapSource *map_source;
@@ -503,18 +522,18 @@ tile_loaded_cb (ClutterTexture *texture,
ChamplainMapSource *map_source = user_data->map_source;
gchar *filename = user_data->filename;
ChamplainTile *tile = user_data->tile;
- ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE(map_source);
+ ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE (map_source);
ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
ChamplainFileCachePrivate *priv = file_cache->priv;
GFileInfo *info = NULL;
GFile *file = NULL;
- ClutterActor *actor = CLUTTER_ACTOR(texture);
- GTimeVal modified_time = {0,};
+ ClutterActor *actor = CLUTTER_ACTOR (texture);
+ GTimeVal modified_time = { 0, };
g_signal_handler_disconnect (texture, user_data->handler);
if (tile)
- g_object_remove_weak_pointer (G_OBJECT (tile), (gpointer*)&user_data->tile);
+ g_object_remove_weak_pointer (G_OBJECT (tile), (gpointer *) &user_data->tile);
g_free (user_data);
@@ -538,8 +557,8 @@ tile_loaded_cb (ClutterTexture *texture,
/* Retrieve modification time */
file = g_file_new_for_path (filename);
info = g_file_query_info (file,
- G_FILE_ATTRIBUTE_TIME_MODIFIED,
- G_FILE_QUERY_INFO_NONE, NULL, NULL);
+ G_FILE_ATTRIBUTE_TIME_MODIFIED,
+ G_FILE_QUERY_INFO_NONE, NULL, NULL);
if (info)
{
g_file_info_get_modification_time (info, &modified_time);
@@ -550,8 +569,8 @@ tile_loaded_cb (ClutterTexture *texture,
g_object_unref (file);
/* Notify other caches that the tile has been filled */
- if (CHAMPLAIN_IS_TILE_CACHE(next_source))
- on_tile_filled (CHAMPLAIN_TILE_CACHE(next_source), tile);
+ if (CHAMPLAIN_IS_TILE_CACHE (next_source))
+ on_tile_filled (CHAMPLAIN_TILE_CACHE (next_source), tile);
if (tile_is_expired (file_cache, tile))
{
@@ -598,20 +617,21 @@ tile_loaded_cb (ClutterTexture *texture,
}
load_next:
- if (CHAMPLAIN_IS_MAP_SOURCE(next_source))
+ if (CHAMPLAIN_IS_MAP_SOURCE (next_source))
champlain_map_source_fill_tile (next_source, tile);
else if (champlain_tile_get_state (tile) == CHAMPLAIN_STATE_LOADED)
- {
- /* if we have some content, use the tile even if it wasn't validated */
- champlain_tile_set_state (tile, CHAMPLAIN_STATE_DONE);
- champlain_tile_display_content (tile);
- }
+ {
+ /* if we have some content, use the tile even if it wasn't validated */
+ champlain_tile_set_state (tile, CHAMPLAIN_STATE_DONE);
+ champlain_tile_display_content (tile);
+ }
cleanup:
g_free (filename);
g_object_unref (map_source);
}
+
static void
fill_tile (ChamplainMapSource *map_source,
ChamplainTile *tile)
@@ -621,7 +641,7 @@ fill_tile (ChamplainMapSource *map_source,
if (champlain_tile_get_state (tile) != CHAMPLAIN_STATE_LOADED)
{
- ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE(map_source);
+ ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE (map_source);
TileLoadedCallbackData *callback_data;
ClutterTexture *texture;
@@ -632,14 +652,14 @@ fill_tile (ChamplainMapSource *map_source,
DEBUG ("fill of %s", callback_data->filename);
- g_object_add_weak_pointer (G_OBJECT (tile), (gpointer*)&callback_data->tile);
+ g_object_add_weak_pointer (G_OBJECT (tile), (gpointer *) &callback_data->tile);
g_object_ref (map_source);
/* Load the cached version */
- texture = CLUTTER_TEXTURE(clutter_texture_new ());
+ texture = CLUTTER_TEXTURE (clutter_texture_new ());
callback_data->handler = g_signal_connect (texture, "load-finished",
- G_CALLBACK (tile_loaded_cb),
- callback_data);
+ G_CALLBACK (tile_loaded_cb),
+ callback_data);
clutter_texture_set_load_async (texture, TRUE);
clutter_texture_set_from_file (texture, callback_data->filename, NULL);
}
@@ -648,20 +668,21 @@ fill_tile (ChamplainMapSource *map_source,
ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
/* Previous cache in the chain is validating its contents */
- if (CHAMPLAIN_IS_MAP_SOURCE(next_source))
+ if (CHAMPLAIN_IS_MAP_SOURCE (next_source))
champlain_map_source_fill_tile (next_source, tile);
}
}
+
static void
refresh_tile_time (ChamplainTileCache *tile_cache,
ChamplainTile *tile)
{
g_return_if_fail (CHAMPLAIN_IS_FILE_CACHE (tile_cache));
- ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE(tile_cache);
+ ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE (tile_cache);
ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
- ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE(tile_cache);
+ ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE (tile_cache);
gchar *filename = NULL;
GFile *file;
GFileInfo *info;
@@ -671,11 +692,11 @@ refresh_tile_time (ChamplainTileCache *tile_cache,
g_free (filename);
info = g_file_query_info (file, G_FILE_ATTRIBUTE_TIME_MODIFIED,
- G_FILE_QUERY_INFO_NONE, NULL, NULL);
+ G_FILE_QUERY_INFO_NONE, NULL, NULL);
if (info)
{
- GTimeVal now = {0, };
+ GTimeVal now = { 0, };
g_get_current_time (&now);
@@ -686,10 +707,11 @@ refresh_tile_time (ChamplainTileCache *tile_cache,
g_object_unref (file);
g_object_unref (info);
- if (CHAMPLAIN_IS_TILE_CACHE(next_source))
- champlain_tile_cache_refresh_tile_time (CHAMPLAIN_TILE_CACHE(next_source), tile);
+ if (CHAMPLAIN_IS_TILE_CACHE (next_source))
+ champlain_tile_cache_refresh_tile_time (CHAMPLAIN_TILE_CACHE (next_source), tile);
}
+
static void
store_tile (ChamplainTileCache *tile_cache,
ChamplainTile *tile,
@@ -698,9 +720,9 @@ store_tile (ChamplainTileCache *tile_cache,
{
g_return_if_fail (CHAMPLAIN_IS_FILE_CACHE (tile_cache));
- ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE(tile_cache);
+ ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE (tile_cache);
ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
- ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE(tile_cache);
+ ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE (tile_cache);
ChamplainFileCachePrivate *priv = file_cache->priv;
gchar *query = NULL;
gchar *error = NULL;
@@ -726,7 +748,7 @@ store_tile (ChamplainTileCache *tile_cache,
if (errno != EEXIST)
{
g_warning ("Unable to create the image cache path '%s': %s",
- path, g_strerror (errno));
+ path, g_strerror (errno));
goto store_next;
}
}
@@ -740,7 +762,7 @@ store_tile (ChamplainTileCache *tile_cache,
}
/* Write the cache */
- if (!g_output_stream_write_all (G_OUTPUT_STREAM(ostream), contents, size, &bytes_written, NULL, &gerror))
+ if (!g_output_stream_write_all (G_OUTPUT_STREAM (ostream), contents, size, &bytes_written, NULL, &gerror))
{
DEBUG ("Writing file contents failed: %s", gerror->message);
g_error_free (gerror);
@@ -751,9 +773,9 @@ store_tile (ChamplainTileCache *tile_cache,
g_object_unref (ostream);
query = sqlite3_mprintf ("REPLACE INTO tiles (filename, etag, size) VALUES (%Q, %Q, %d)",
- filename,
- champlain_tile_get_etag (tile),
- size);
+ filename,
+ champlain_tile_get_etag (tile),
+ size);
sqlite3_exec (priv->db, query, NULL, NULL, &error);
if (error != NULL)
{
@@ -763,14 +785,15 @@ store_tile (ChamplainTileCache *tile_cache,
sqlite3_free (query);
store_next:
- if (CHAMPLAIN_IS_TILE_CACHE(next_source))
- champlain_tile_cache_store_tile (CHAMPLAIN_TILE_CACHE(next_source), tile, contents, size);
+ if (CHAMPLAIN_IS_TILE_CACHE (next_source))
+ champlain_tile_cache_store_tile (CHAMPLAIN_TILE_CACHE (next_source), tile, contents, size);
g_free (filename);
g_free (path);
g_object_unref (file);
}
+
static void
on_tile_filled (ChamplainTileCache *tile_cache,
ChamplainTile *tile)
@@ -778,9 +801,9 @@ on_tile_filled (ChamplainTileCache *tile_cache,
g_return_if_fail (CHAMPLAIN_IS_FILE_CACHE (tile_cache));
g_return_if_fail (CHAMPLAIN_IS_TILE (tile));
- ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE(tile_cache);
+ ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE (tile_cache);
ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
- ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE(tile_cache);
+ ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE (tile_cache);
ChamplainFileCachePrivate *priv = file_cache->priv;
int sql_rc = SQLITE_OK;
gchar *filename = NULL;
@@ -794,7 +817,7 @@ on_tile_filled (ChamplainTileCache *tile_cache,
if (sql_rc != SQLITE_OK)
{
DEBUG ("Failed to set values to the popularity query of '%s', error: %s",
- filename, sqlite3_errmsg (priv->db));
+ filename, sqlite3_errmsg (priv->db));
goto call_next;
}
@@ -806,8 +829,8 @@ on_tile_filled (ChamplainTileCache *tile_cache,
}
call_next:
- if (CHAMPLAIN_IS_TILE_CACHE(next_source))
- champlain_tile_cache_on_tile_filled (CHAMPLAIN_TILE_CACHE(next_source), tile);
+ if (CHAMPLAIN_IS_TILE_CACHE (next_source))
+ champlain_tile_cache_on_tile_filled (CHAMPLAIN_TILE_CACHE (next_source), tile);
}
@@ -839,6 +862,7 @@ delete_tile (ChamplainFileCache *file_cache, const gchar *filename)
g_object_unref (file);
}
+
static gboolean
purge_on_idle (gpointer data)
{
@@ -846,6 +870,7 @@ purge_on_idle (gpointer data)
return FALSE;
}
+
/**
* champlain_file_cache_purge_on_idle:
* @file_cache: a #ChamplainFileCache
@@ -860,11 +885,12 @@ champlain_file_cache_purge_on_idle (ChamplainFileCache *file_cache)
{
g_return_if_fail (CHAMPLAIN_IS_FILE_CACHE (file_cache));
g_idle_add_full (G_PRIORITY_DEFAULT,
- (GSourceFunc)purge_on_idle,
- g_object_ref (file_cache),
- (GDestroyNotify)g_object_unref);
+ (GSourceFunc) purge_on_idle,
+ g_object_ref (file_cache),
+ (GDestroyNotify) g_object_unref);
}
+
/**
* champlain_file_cache_purge:
* @file_cache: a #ChamplainFileCache
@@ -897,7 +923,7 @@ champlain_file_cache_purge (ChamplainFileCache *file_cache)
if (rc != SQLITE_ROW)
{
DEBUG ("Failed to count the total cache consumption %s",
- sqlite3_errmsg (priv->db));
+ sqlite3_errmsg (priv->db));
sqlite3_finalize (stmt);
return;
}
@@ -942,7 +968,7 @@ champlain_file_cache_purge (ChamplainFileCache *file_cache)
sqlite3_finalize (stmt);
query = sqlite3_mprintf ("UPDATE tiles SET popularity = popularity - %d",
- highest_popularity);
+ highest_popularity);
sqlite3_exec (priv->db, query, NULL, NULL, &error);
if (error != NULL)
{
@@ -951,5 +977,3 @@ champlain_file_cache_purge (ChamplainFileCache *file_cache)
}
sqlite3_free (query);
}
-
-
diff --git a/champlain/champlain-file-cache.h b/champlain/champlain-file-cache.h
index aaebaf5..32830e4 100644
--- a/champlain/champlain-file-cache.h
+++ b/champlain/champlain-file-cache.h
@@ -65,7 +65,7 @@ struct _ChamplainFileCacheClass
GType champlain_file_cache_get_type (void);
-ChamplainFileCache* champlain_file_cache_new_full (guint size_limit,
+ChamplainFileCache *champlain_file_cache_new_full (guint size_limit,
const gchar *cache_dir,
ChamplainRenderer *renderer);
@@ -73,7 +73,7 @@ guint champlain_file_cache_get_size_limit (ChamplainFileCache *file_cache);
void champlain_file_cache_set_size_limit (ChamplainFileCache *file_cache,
guint size_limit);
-const gchar * champlain_file_cache_get_cache_dir (ChamplainFileCache *file_cache);
+const gchar *champlain_file_cache_get_cache_dir (ChamplainFileCache *file_cache);
void champlain_file_cache_purge (ChamplainFileCache *file_cache);
void champlain_file_cache_purge_on_idle (ChamplainFileCache *file_cache);
diff --git a/champlain/champlain-file-tile-source.c b/champlain/champlain-file-tile-source.c
index 4e44a5b..81c428b 100644
--- a/champlain/champlain-file-tile-source.c
+++ b/champlain/champlain-file-tile-source.c
@@ -46,12 +46,14 @@ champlain_file_tile_source_dispose (GObject *object)
G_OBJECT_CLASS (champlain_file_tile_source_parent_class)->dispose (object);
}
+
static void
champlain_file_tile_source_finalize (GObject *object)
{
G_OBJECT_CLASS (champlain_file_tile_source_parent_class)->finalize (object);
}
+
static void
champlain_file_tile_source_class_init (ChamplainFileTileSourceClass *klass)
{
@@ -64,11 +66,13 @@ champlain_file_tile_source_class_init (ChamplainFileTileSourceClass *klass)
map_source_class->fill_tile = fill_tile;
}
+
static void
champlain_file_tile_source_init (ChamplainFileTileSource *self)
{
}
+
/*
* champlain_file_tile_source_new:
*
@@ -78,7 +82,7 @@ champlain_file_tile_source_init (ChamplainFileTileSource *self)
*
* Since: 0.6
*/
-ChamplainFileTileSource*
+ChamplainFileTileSource *
champlain_file_tile_source_new_full (const gchar *id,
const gchar *name,
const gchar *license,
@@ -89,16 +93,17 @@ champlain_file_tile_source_new_full (const gchar *id,
ChamplainMapProjection projection,
ChamplainRenderer *renderer)
{
- ChamplainFileTileSource * source;
- source = g_object_new (CHAMPLAIN_TYPE_FILE_TILE_SOURCE,
+ ChamplainFileTileSource *source;
+
+ source = g_object_new (CHAMPLAIN_TYPE_FILE_TILE_SOURCE,
"id", id,
- "name", name,
- "license", license,
+ "name", name,
+ "license", license,
"license-uri", license_uri,
- "min-zoom-level", min_zoom,
+ "min-zoom-level", min_zoom,
"max-zoom-level", max_zoom,
- "tile-size", tile_size,
- "projection", projection,
+ "tile-size", tile_size,
+ "projection", projection,
"renderer", renderer,
NULL);
return source;
@@ -130,17 +135,18 @@ champlain_file_tile_source_load_map_data (ChamplainFileTileSource *self,
return;
}
- renderer = champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (self));
+ renderer = champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (self));
champlain_renderer_set_data (renderer, data, length);
g_free (data);
}
+
static void
tile_rendered_cb (ChamplainTile *tile,
ChamplainRenderCallbackData *data,
ChamplainMapSource *map_source)
{
- ChamplainTileSource *tile_source = CHAMPLAIN_TILE_SOURCE(map_source);
+ ChamplainTileSource *tile_source = CHAMPLAIN_TILE_SOURCE (map_source);
ChamplainTileCache *tile_cache = champlain_tile_source_get_cache (tile_source);
ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
@@ -160,6 +166,7 @@ tile_rendered_cb (ChamplainTile *tile,
g_signal_handlers_disconnect_by_func (tile, tile_rendered_cb, map_source);
}
+
static void
fill_tile (ChamplainMapSource *map_source,
ChamplainTile *tile)
diff --git a/champlain/champlain-file-tile-source.h b/champlain/champlain-file-tile-source.h
index fbf9bb0..e7fe4ee 100644
--- a/champlain/champlain-file-tile-source.h
+++ b/champlain/champlain-file-tile-source.h
@@ -30,7 +30,7 @@
G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_FILE_TILE_SOURCE champlain_file_tile_source_get_type()
+#define CHAMPLAIN_TYPE_FILE_TILE_SOURCE champlain_file_tile_source_get_type ()
#define CHAMPLAIN_FILE_TILE_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_FILE_TILE_SOURCE, ChamplainFileTileSource))
@@ -49,18 +49,19 @@ G_BEGIN_DECLS
typedef struct _ChamplainFileTileSourcePrivate ChamplainFileTileSourcePrivate;
-typedef struct {
+typedef struct
+{
ChamplainTileSource parent;
} ChamplainFileTileSource;
-typedef struct {
+typedef struct
+{
ChamplainTileSourceClass parent_class;
} ChamplainFileTileSourceClass;
GType champlain_file_tile_source_get_type (void);
-ChamplainFileTileSource*
-champlain_file_tile_source_new_full (const gchar *id,
+ChamplainFileTileSource *champlain_file_tile_source_new_full (const gchar *id,
const gchar *name,
const gchar *license,
const gchar *license_uri,
diff --git a/champlain/champlain-image-renderer.c b/champlain/champlain-image-renderer.c
index 953eca1..82208cf 100644
--- a/champlain/champlain-image-renderer.c
+++ b/champlain/champlain-image-renderer.c
@@ -19,7 +19,7 @@
#include "champlain-image-renderer.h"
#include <gdk/gdk.h>
-G_DEFINE_TYPE(ChamplainImageRenderer, champlain_image_renderer, CHAMPLAIN_TYPE_RENDERER)
+G_DEFINE_TYPE (ChamplainImageRenderer, champlain_image_renderer, CHAMPLAIN_TYPE_RENDERER)
#define GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_IMAGE_RENDERER, ChamplainImageRendererPrivate))
@@ -30,8 +30,11 @@ struct _ChamplainImageRendererPrivate
guint size;
};
-static void set_data (ChamplainRenderer *renderer, const gchar *data, guint size);
-static void render (ChamplainRenderer *renderer, ChamplainTile *tile);
+static void set_data (ChamplainRenderer *renderer,
+ const gchar *data,
+ guint size);
+static void render (ChamplainRenderer *renderer,
+ ChamplainTile *tile);
static void
@@ -52,9 +55,10 @@ champlain_image_renderer_finalize (GObject *object)
}
-static void champlain_image_renderer_class_init(ChamplainImageRendererClass *klass)
+static void
+champlain_image_renderer_class_init (ChamplainImageRendererClass *klass)
{
- GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
ChamplainRendererClass *renderer_class = CHAMPLAIN_RENDERER_CLASS (klass);
g_type_class_add_private (klass, sizeof (ChamplainImageRendererPrivate));
@@ -67,7 +71,8 @@ static void champlain_image_renderer_class_init(ChamplainImageRendererClass *kla
}
-static void champlain_image_renderer_init(ChamplainImageRenderer *self)
+static void
+champlain_image_renderer_init (ChamplainImageRenderer *self)
{
ChamplainImageRendererPrivate *priv = GET_PRIVATE (self);
@@ -77,13 +82,15 @@ static void champlain_image_renderer_init(ChamplainImageRenderer *self)
}
-ChamplainImageRenderer *champlain_image_renderer_new(void)
+ChamplainImageRenderer *
+champlain_image_renderer_new (void)
{
- return g_object_new (CHAMPLAIN_TYPE_IMAGE_RENDERER, NULL);
+ return g_object_new (CHAMPLAIN_TYPE_IMAGE_RENDERER, NULL);
}
-static void set_data (ChamplainRenderer *renderer, const gchar *data, guint size)
+static void
+set_data (ChamplainRenderer *renderer, const gchar *data, guint size)
{
ChamplainImageRendererPrivate *priv = GET_PRIVATE (renderer);
@@ -95,22 +102,23 @@ static void set_data (ChamplainRenderer *renderer, const gchar *data, guint size
}
-static void render (ChamplainRenderer *renderer, ChamplainTile *tile)
+static void
+render (ChamplainRenderer *renderer, ChamplainTile *tile)
{
ChamplainImageRendererPrivate *priv = GET_PRIVATE (renderer);
ChamplainRenderCallbackData callback_data;
- GdkPixbufLoader* loader = NULL;
+ GdkPixbufLoader *loader = NULL;
GError *error = NULL;
ClutterActor *actor = NULL;
- GdkPixbuf* pixbuf;
+ GdkPixbuf *pixbuf;
callback_data.error = FALSE;
loader = gdk_pixbuf_loader_new ();
if (!gdk_pixbuf_loader_write (loader,
- (const guchar *) priv->data,
- priv->size,
- &error))
+ (const guchar *) priv->data,
+ priv->size,
+ &error))
{
if (error)
{
@@ -133,14 +141,14 @@ static void render (ChamplainRenderer *renderer, ChamplainTile *tile)
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
actor = clutter_texture_new ();
if (!clutter_texture_set_from_rgb_data (CLUTTER_TEXTURE (actor),
- gdk_pixbuf_get_pixels (pixbuf),
- gdk_pixbuf_get_has_alpha (pixbuf),
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf),
- gdk_pixbuf_get_rowstride (pixbuf),
- gdk_pixbuf_get_bits_per_sample (pixbuf) *
- gdk_pixbuf_get_n_channels (pixbuf) / 8,
- 0, &error))
+ gdk_pixbuf_get_pixels (pixbuf),
+ gdk_pixbuf_get_has_alpha (pixbuf),
+ gdk_pixbuf_get_width (pixbuf),
+ gdk_pixbuf_get_height (pixbuf),
+ gdk_pixbuf_get_rowstride (pixbuf),
+ gdk_pixbuf_get_bits_per_sample (pixbuf) *
+ gdk_pixbuf_get_n_channels (pixbuf) / 8,
+ 0, &error))
{
if (error)
{
diff --git a/champlain/champlain-image-renderer.h b/champlain/champlain-image-renderer.h
index e8b25a0..a5b8e11 100644
--- a/champlain/champlain-image-renderer.h
+++ b/champlain/champlain-image-renderer.h
@@ -28,22 +28,22 @@
G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_IMAGE_RENDERER champlain_image_renderer_get_type()
+#define CHAMPLAIN_TYPE_IMAGE_RENDERER champlain_image_renderer_get_type ()
#define CHAMPLAIN_IMAGE_RENDERER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), CHAMPLAIN_TYPE_IMAGE_RENDERER, ChamplainImageRenderer))
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_IMAGE_RENDERER, ChamplainImageRenderer))
#define CHAMPLAIN_IMAGE_RENDERER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), CHAMPLAIN_TYPE_IMAGE_RENDERER, ChamplainImageRendererClass))
+ (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_IMAGE_RENDERER, ChamplainImageRendererClass))
#define CHAMPLAIN_IS_IMAGE_RENDERER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), CHAMPLAIN_TYPE_IMAGE_RENDERER))
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_IMAGE_RENDERER))
#define CHAMPLAIN_IS_IMAGE_RENDERER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), CHAMPLAIN_TYPE_IMAGE_RENDERER))
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_IMAGE_RENDERER))
#define CHAMPLAIN_IMAGE_RENDERER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), CHAMPLAIN_TYPE_IMAGE_RENDERER, ChamplainImageRendererClass))
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_IMAGE_RENDERER, ChamplainImageRendererClass))
typedef struct _ChamplainImageRendererPrivate ChamplainImageRendererPrivate;
@@ -64,7 +64,7 @@ struct _ChamplainImageRendererClass
GType champlain_image_renderer_get_type (void);
-ChamplainImageRenderer* champlain_image_renderer_new (void);
+ChamplainImageRenderer *champlain_image_renderer_new (void);
G_END_DECLS
diff --git a/champlain/champlain-layer.c b/champlain/champlain-layer.c
index 571bcca..2ef5c21 100644
--- a/champlain/champlain-layer.c
+++ b/champlain/champlain-layer.c
@@ -57,40 +57,44 @@ champlain_layer_get_property (GObject *object,
G_GNUC_UNUSED GValue *value,
GParamSpec *pspec)
{
- //ChamplainLayer *self = CHAMPLAIN_LAYER (object);
+ /* ChamplainLayer *self = CHAMPLAIN_LAYER (object); */
switch (property_id)
{
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
+
static void
champlain_layer_set_property (GObject *object,
guint property_id,
G_GNUC_UNUSED const GValue *value,
GParamSpec *pspec)
{
- //ChamplainLayer *self = CHAMPLAIN_LAYER (object);
+ /* ChamplainLayer *self = CHAMPLAIN_LAYER (object); */
switch (property_id)
{
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
+
static void
champlain_layer_dispose (GObject *object)
{
G_OBJECT_CLASS (champlain_layer_parent_class)->dispose (object);
}
+
static void
champlain_layer_finalize (GObject *object)
{
G_OBJECT_CLASS (champlain_layer_parent_class)->finalize (object);
}
+
static void
champlain_layer_class_init (ChamplainLayerClass *klass)
{
@@ -102,6 +106,7 @@ champlain_layer_class_init (ChamplainLayerClass *klass)
object_class->set_property = champlain_layer_set_property;
}
+
static void
champlain_layer_init (ChamplainLayer *self)
{
@@ -111,6 +116,7 @@ champlain_layer_init (ChamplainLayer *self)
G_CALLBACK (layer_remove_cb), NULL);
}
+
/* This callback serves to keep the markers ordered by their latitude.
* Markers that are up north on the map should be lowered in the list so that
* they are drawn the first. This is to make the illusion of a semi-3d plane
@@ -132,10 +138,10 @@ reorder_marker (ClutterGroup *layer,
{
ChamplainBaseMarker *prev_marker = CHAMPLAIN_BASE_MARKER (clutter_group_get_nth_child (layer, i));
- if (prev_marker == (ChamplainBaseMarker*) marker)
+ if (prev_marker == (ChamplainBaseMarker *) marker)
continue;
- g_object_get(G_OBJECT(prev_marker), "latitude", &tmp_y, NULL);
+ g_object_get (G_OBJECT (prev_marker), "latitude", &tmp_y, NULL);
tmp_y = 90 - tmp_y;
if (y < tmp_y && tmp_y < low_y)
@@ -146,10 +152,11 @@ reorder_marker (ClutterGroup *layer,
}
if (lowest)
- clutter_container_lower_child (CLUTTER_CONTAINER(layer),
+ clutter_container_lower_child (CLUTTER_CONTAINER (layer),
CLUTTER_ACTOR (marker), CLUTTER_ACTOR (lowest));
}
+
static void
marker_position_notify (GObject *gobject,
G_GNUC_UNUSED GParamSpec *pspec,
@@ -158,18 +165,21 @@ marker_position_notify (GObject *gobject,
reorder_marker (CLUTTER_GROUP (user_data), CHAMPLAIN_BASE_MARKER (gobject));
}
+
static void
layer_add_cb (ClutterGroup *layer,
ClutterActor *actor,
G_GNUC_UNUSED gpointer data)
{
ChamplainBaseMarker *marker = CHAMPLAIN_BASE_MARKER (actor);
+
reorder_marker (layer, marker);
g_signal_connect (G_OBJECT (marker), "notify::latitude",
G_CALLBACK (marker_position_notify), layer);
}
+
static void
layer_remove_cb (ClutterGroup *layer,
ClutterActor *actor,
@@ -179,6 +189,7 @@ layer_remove_cb (ClutterGroup *layer,
G_CALLBACK (marker_position_notify), layer);
}
+
/**
* champlain_layer_new:
*
@@ -194,6 +205,7 @@ champlain_layer_new ()
return g_object_new (CHAMPLAIN_TYPE_LAYER, NULL);
}
+
/**
* champlain_layer_add_marker:
* @layer: a #ChamplainLayer
@@ -213,6 +225,7 @@ champlain_layer_add_marker (ChamplainLayer *layer,
clutter_container_add_actor (CLUTTER_CONTAINER (layer), CLUTTER_ACTOR (marker));
}
+
/**
* champlain_layer_remove_marker:
* @layer: a #ChamplainLayer
@@ -232,6 +245,7 @@ champlain_layer_remove_marker (ChamplainLayer *layer,
clutter_container_remove_actor (CLUTTER_CONTAINER (layer), CLUTTER_ACTOR (marker));
}
+
/**
* champlain_layer_show:
* @layer: a #ChamplainLayer
@@ -248,6 +262,7 @@ champlain_layer_show (ChamplainLayer *layer)
clutter_actor_show (CLUTTER_ACTOR (layer));
}
+
/**
* champlain_layer_hide:
* @layer: a #ChamplainLayer
@@ -264,6 +279,7 @@ champlain_layer_hide (ChamplainLayer *layer)
clutter_actor_hide (CLUTTER_ACTOR (layer));
}
+
/**
* champlain_layer_animate_in_all_markers:
* @layer: a #ChamplainLayer
@@ -289,6 +305,7 @@ champlain_layer_animate_in_all_markers (ChamplainLayer *layer)
}
}
+
/**
* champlain_layer_animate_out_all_markers:
* @layer: a #ChamplainLayer
@@ -314,6 +331,7 @@ champlain_layer_animate_out_all_markers (ChamplainLayer *layer)
}
}
+
/**
* champlain_layer_show_all_markers:
* @layer: a #ChamplainLayer
@@ -337,6 +355,7 @@ champlain_layer_show_all_markers (ChamplainLayer *layer)
}
}
+
/**
* champlain_layer_hide_all_markers:
* @layer: a #ChamplainLayer
diff --git a/champlain/champlain-layer.h b/champlain/champlain-layer.h
index e088421..326de5e 100644
--- a/champlain/champlain-layer.h
+++ b/champlain/champlain-layer.h
@@ -31,7 +31,7 @@
G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_LAYER champlain_layer_get_type()
+#define CHAMPLAIN_TYPE_LAYER champlain_layer_get_type ()
#define CHAMPLAIN_LAYER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_LAYER, ChamplainLayer))
@@ -48,20 +48,22 @@ G_BEGIN_DECLS
#define CHAMPLAIN_LAYER_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_LAYER, ChamplainLayerClass))
-typedef struct _ChamplainLayer ChamplainLayer;
+typedef struct _ChamplainLayer ChamplainLayer;
typedef struct _ChamplainLayerClass ChamplainLayerClass;
-struct _ChamplainLayer {
+struct _ChamplainLayer
+{
ClutterGroup parent;
};
-struct _ChamplainLayerClass {
+struct _ChamplainLayerClass
+{
ClutterGroupClass parent_class;
};
GType champlain_layer_get_type (void);
-ChamplainLayer* champlain_layer_new (void);
+ChamplainLayer *champlain_layer_new (void);
void champlain_layer_show (ChamplainLayer *layer);
void champlain_layer_hide (ChamplainLayer *layer);
diff --git a/champlain/champlain-map-source-chain.c b/champlain/champlain-map-source-chain.c
index cf0aaa7..ea291b5 100644
--- a/champlain/champlain-map-source-chain.c
+++ b/champlain/champlain-map-source-chain.c
@@ -37,7 +37,7 @@
G_DEFINE_TYPE (ChamplainMapSourceChain, champlain_map_source_chain, CHAMPLAIN_TYPE_MAP_SOURCE);
#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_MAP_SOURCE_CHAIN, ChamplainMapSourceChainPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_MAP_SOURCE_CHAIN, ChamplainMapSourceChainPrivate))
struct _ChamplainMapSourceChainPrivate
{
@@ -54,15 +54,17 @@ static guint get_min_zoom_level (ChamplainMapSource *map_source);
static guint get_max_zoom_level (ChamplainMapSource *map_source);
static guint get_tile_size (ChamplainMapSource *map_source);
-static void fill_tile (ChamplainMapSource *map_source, ChamplainTile *tile);
+static void fill_tile (ChamplainMapSource *map_source,
+ ChamplainTile *tile);
static void on_set_next_source (ChamplainMapSource *map_source,
ChamplainMapSource *old_next_source,
ChamplainMapSource *new_next_source);
+
static void
champlain_map_source_chain_dispose (GObject *object)
{
- ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN(object);
+ ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (object);
while (source_chain->priv->stack_top)
champlain_map_source_chain_pop (source_chain);
@@ -70,16 +72,18 @@ champlain_map_source_chain_dispose (GObject *object)
G_OBJECT_CLASS (champlain_map_source_chain_parent_class)->dispose (object);
}
+
static void
champlain_map_source_chain_finalize (GObject *object)
{
G_OBJECT_CLASS (champlain_map_source_chain_parent_class)->finalize (object);
}
+
static void
champlain_map_source_chain_class_init (ChamplainMapSourceChainClass *klass)
{
- GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
g_type_class_add_private (klass, sizeof (ChamplainMapSourceChainPrivate));
@@ -100,10 +104,11 @@ champlain_map_source_chain_class_init (ChamplainMapSourceChainClass *klass)
map_source_class->on_set_next_source = on_set_next_source;
}
+
static void
champlain_map_source_chain_init (ChamplainMapSourceChain *source_chain)
{
- ChamplainMapSourceChainPrivate *priv = GET_PRIVATE(source_chain);
+ ChamplainMapSourceChainPrivate *priv = GET_PRIVATE (source_chain);
source_chain->priv = priv;
@@ -111,6 +116,7 @@ champlain_map_source_chain_init (ChamplainMapSourceChain *source_chain)
priv->stack_bottom = NULL;
}
+
/**
* champlain_map_source_chain_new:
*
@@ -120,16 +126,18 @@ champlain_map_source_chain_init (ChamplainMapSourceChain *source_chain)
*
* Since: 0.6
*/
-ChamplainMapSourceChain*
+ChamplainMapSourceChain *
champlain_map_source_chain_new (void)
{
return g_object_new (CHAMPLAIN_TYPE_MAP_SOURCE_CHAIN, NULL);
}
+
static const gchar *
get_id (ChamplainMapSource *map_source)
{
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (map_source);
+
g_return_val_if_fail (source_chain, NULL);
ChamplainMapSourceChainPrivate *priv = source_chain->priv;
@@ -138,10 +146,12 @@ get_id (ChamplainMapSource *map_source)
return champlain_map_source_get_id (priv->stack_top);
}
+
static const gchar *
get_name (ChamplainMapSource *map_source)
{
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (map_source);
+
g_return_val_if_fail (source_chain, NULL);
ChamplainMapSourceChainPrivate *priv = source_chain->priv;
@@ -150,10 +160,12 @@ get_name (ChamplainMapSource *map_source)
return champlain_map_source_get_name (priv->stack_top);
}
+
static const gchar *
get_license (ChamplainMapSource *map_source)
{
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (map_source);
+
g_return_val_if_fail (source_chain, NULL);
ChamplainMapSourceChainPrivate *priv = source_chain->priv;
@@ -162,10 +174,12 @@ get_license (ChamplainMapSource *map_source)
return champlain_map_source_get_license (priv->stack_top);
}
+
static const gchar *
get_license_uri (ChamplainMapSource *map_source)
{
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (map_source);
+
g_return_val_if_fail (source_chain, NULL);
ChamplainMapSourceChainPrivate *priv = source_chain->priv;
@@ -174,10 +188,12 @@ get_license_uri (ChamplainMapSource *map_source)
return champlain_map_source_get_license_uri (priv->stack_top);
}
+
static guint
get_min_zoom_level (ChamplainMapSource *map_source)
{
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (map_source);
+
g_return_val_if_fail (source_chain, 0);
ChamplainMapSourceChainPrivate *priv = source_chain->priv;
@@ -186,10 +202,12 @@ get_min_zoom_level (ChamplainMapSource *map_source)
return champlain_map_source_get_min_zoom_level (priv->stack_top);
}
+
static guint
get_max_zoom_level (ChamplainMapSource *map_source)
{
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (map_source);
+
g_return_val_if_fail (source_chain, 0);
ChamplainMapSourceChainPrivate *priv = source_chain->priv;
@@ -198,10 +216,12 @@ get_max_zoom_level (ChamplainMapSource *map_source)
return champlain_map_source_get_max_zoom_level (priv->stack_top);
}
+
static guint
get_tile_size (ChamplainMapSource *map_source)
{
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (map_source);
+
g_return_val_if_fail (source_chain, 0);
ChamplainMapSourceChainPrivate *priv = source_chain->priv;
@@ -210,11 +230,13 @@ get_tile_size (ChamplainMapSource *map_source)
return champlain_map_source_get_tile_size (priv->stack_top);
}
+
static void
fill_tile (ChamplainMapSource *map_source,
ChamplainTile *tile)
{
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (map_source);
+
g_return_if_fail (source_chain);
ChamplainMapSourceChainPrivate *priv = source_chain->priv;
@@ -223,6 +245,7 @@ fill_tile (ChamplainMapSource *map_source,
champlain_map_source_fill_tile (priv->stack_top, tile);
}
+
static void
on_set_next_source (ChamplainMapSource *map_source,
G_GNUC_UNUSED ChamplainMapSource *old_next_source,
@@ -237,27 +260,28 @@ on_set_next_source (ChamplainMapSource *map_source,
champlain_map_source_set_next_source (priv->stack_bottom, new_next_source);
}
+
static void
assign_cache_of_next_source_sequence (ChamplainMapSourceChain *source_chain,
ChamplainMapSource *start_map_source,
ChamplainTileCache *tile_cache)
{
ChamplainMapSource *map_source = start_map_source;
- ChamplainMapSource *chain_next_source = champlain_map_source_get_next_source (CHAMPLAIN_MAP_SOURCE(source_chain));
+ ChamplainMapSource *chain_next_source = champlain_map_source_get_next_source (CHAMPLAIN_MAP_SOURCE (source_chain));
do
{
map_source = champlain_map_source_get_next_source (map_source);
- }
- while (CHAMPLAIN_IS_TILE_CACHE(map_source));
+ } while (CHAMPLAIN_IS_TILE_CACHE (map_source));
- while (CHAMPLAIN_IS_TILE_SOURCE(map_source) && map_source != chain_next_source)
+ while (CHAMPLAIN_IS_TILE_SOURCE (map_source) && map_source != chain_next_source)
{
- champlain_tile_source_set_cache (CHAMPLAIN_TILE_SOURCE(map_source), tile_cache);
+ champlain_tile_source_set_cache (CHAMPLAIN_TILE_SOURCE (map_source), tile_cache);
map_source = champlain_map_source_get_next_source (map_source);
}
}
+
static void
reload_tiles_cb (G_GNUC_UNUSED ChamplainMapSource *map_source,
ChamplainMapSourceChain *source_chain)
@@ -266,6 +290,7 @@ reload_tiles_cb (G_GNUC_UNUSED ChamplainMapSource *map_source,
g_signal_emit_by_name (source_chain, "reload-tiles", NULL);
}
+
/**
* champlain_map_source_chain_push:
* @source_chain: a #ChamplainMapSourceChain
@@ -282,16 +307,16 @@ champlain_map_source_chain_push (ChamplainMapSourceChain *source_chain,
ChamplainMapSourceChainPrivate *priv = source_chain->priv;
gboolean is_cache = FALSE;
- if (CHAMPLAIN_IS_TILE_CACHE(map_source))
+ if (CHAMPLAIN_IS_TILE_CACHE (map_source))
is_cache = TRUE;
else
- g_return_if_fail (CHAMPLAIN_IS_TILE_SOURCE(map_source));
+ g_return_if_fail (CHAMPLAIN_IS_TILE_SOURCE (map_source));
g_object_ref_sink (map_source);
if (!priv->stack_top)
{
- ChamplainMapSource *chain_next_source = champlain_map_source_get_next_source (CHAMPLAIN_MAP_SOURCE(source_chain));
+ ChamplainMapSource *chain_next_source = champlain_map_source_get_next_source (CHAMPLAIN_MAP_SOURCE (source_chain));
/* tile source has to be last */
g_return_if_fail (!is_cache);
@@ -311,15 +336,16 @@ champlain_map_source_chain_push (ChamplainMapSourceChain *source_chain,
if (is_cache)
{
- ChamplainTileCache *tile_cache = CHAMPLAIN_TILE_CACHE(map_source);
+ ChamplainTileCache *tile_cache = CHAMPLAIN_TILE_CACHE (map_source);
assign_cache_of_next_source_sequence (source_chain, priv->stack_top, tile_cache);
}
}
priv->sig_handler_id = g_signal_connect (priv->stack_top, "reload-tiles",
- G_CALLBACK (reload_tiles_cb), source_chain);
+ G_CALLBACK (reload_tiles_cb), source_chain);
}
+
/**
* champlain_map_source_chain_pop:
* @source_chain: a #ChamplainMapSourceChain
@@ -340,30 +366,30 @@ champlain_map_source_chain_pop (ChamplainMapSourceChain *source_chain)
if (g_signal_handler_is_connected (priv->stack_top, priv->sig_handler_id))
g_signal_handler_disconnect (priv->stack_top, priv->sig_handler_id);
- if (CHAMPLAIN_IS_TILE_CACHE(priv->stack_top))
+ if (CHAMPLAIN_IS_TILE_CACHE (priv->stack_top))
{
ChamplainTileCache *tile_cache = NULL;
- if (CHAMPLAIN_IS_TILE_CACHE(next_source))
- tile_cache = CHAMPLAIN_TILE_CACHE(next_source);
+ if (CHAMPLAIN_IS_TILE_CACHE (next_source))
+ tile_cache = CHAMPLAIN_TILE_CACHE (next_source);
/* _push() guarantees that the last source is tile_source so we can be
sure that the next map source is still within the chain */
assign_cache_of_next_source_sequence (source_chain, priv->stack_top, tile_cache);
}
- if (next_source == champlain_map_source_get_next_source (CHAMPLAIN_MAP_SOURCE(source_chain)))
- {
- priv->stack_top = NULL;
- priv->stack_bottom = NULL;
- }
+ if (next_source == champlain_map_source_get_next_source (CHAMPLAIN_MAP_SOURCE (source_chain)))
+ {
+ priv->stack_top = NULL;
+ priv->stack_bottom = NULL;
+ }
else
priv->stack_top = next_source;
if (priv->stack_top)
{
priv->sig_handler_id = g_signal_connect (priv->stack_top, "reload-tiles",
- G_CALLBACK (reload_tiles_cb), source_chain);
+ G_CALLBACK (reload_tiles_cb), source_chain);
}
g_object_unref (old_stack_top);
diff --git a/champlain/champlain-map-source-chain.h b/champlain/champlain-map-source-chain.h
index 5ad03c4..efbd28c 100644
--- a/champlain/champlain-map-source-chain.h
+++ b/champlain/champlain-map-source-chain.h
@@ -65,7 +65,7 @@ struct _ChamplainMapSourceChainClass
GType champlain_map_source_chain_get_type (void);
-ChamplainMapSourceChain* champlain_map_source_chain_new (void);
+ChamplainMapSourceChain *champlain_map_source_chain_new (void);
void champlain_map_source_chain_push (ChamplainMapSourceChain *source_chain,
ChamplainMapSource *map_source);
diff --git a/champlain/champlain-map-source-desc.c b/champlain/champlain-map-source-desc.c
index 99c9530..a52c4b2 100644
--- a/champlain/champlain-map-source-desc.c
+++ b/champlain/champlain-map-source-desc.c
@@ -44,6 +44,7 @@ champlain_map_source_desc_get_type (void)
return type;
}
+
/**
* champlain_map_source_desc_copy:
* @desc: a #ChamplainMapSourceDesc
@@ -60,6 +61,7 @@ ChamplainMapSourceDesc *
champlain_map_source_desc_copy (const ChamplainMapSourceDesc *desc)
{
ChamplainMapSourceDesc *dest = NULL;
+
if (G_UNLIKELY (desc == NULL))
return NULL;
@@ -79,12 +81,13 @@ champlain_map_source_desc_copy (const ChamplainMapSourceDesc *desc)
if (G_LIKELY (desc->uri_format != NULL))
dest->uri_format = g_strdup (desc->uri_format);
- // Can't make a copy of obscure pointer data
+ /* Can't make a copy of obscure pointer data */
dest->data = desc->data;
return dest;
}
+
/**
* champlain_map_source_desc_free:
* @desc: a #ChamplainMapSourceDesc
@@ -98,7 +101,6 @@ champlain_map_source_desc_copy (const ChamplainMapSourceDesc *desc)
void
champlain_map_source_desc_free (ChamplainMapSourceDesc *desc)
{
-
if (G_UNLIKELY (desc == NULL))
return;
@@ -120,6 +122,7 @@ champlain_map_source_desc_free (ChamplainMapSourceDesc *desc)
g_slice_free (ChamplainMapSourceDesc, desc);
}
+
/**
* champlain_map_source_desc_new:
*
diff --git a/champlain/champlain-map-source-desc.h b/champlain/champlain-map-source-desc.h
index 6c1fd61..d0b576c 100644
--- a/champlain/champlain-map-source-desc.h
+++ b/champlain/champlain-map-source-desc.h
@@ -44,11 +44,12 @@ typedef struct _ChamplainMapSourceDesc ChamplainMapSourceDesc;
*
* Since: 0.4
*/
-typedef ChamplainMapSource * (*ChamplainMapSourceConstructor) (
- ChamplainMapSourceDesc *desc, gpointer data);
+typedef ChamplainMapSource * (*ChamplainMapSourceConstructor)
+ (ChamplainMapSourceDesc *desc, gpointer data);
+
#define CHAMPLAIN_MAP_SOURCE_CONSTRUCTOR (f) ((ChamplainMapSourceConstructor) (f))
-#define CHAMPLAIN_MAP_SOURCE_DESC(obj) ((ChamplainMapSourceDesc *) (obj))
+#define CHAMPLAIN_MAP_SOURCE_DESC(obj) ((ChamplainMapSourceDesc *) (obj))
/**
* ChamplainMapSourceDesc:
@@ -67,7 +68,8 @@ typedef ChamplainMapSource * (*ChamplainMapSourceConstructor) (
*
* Since: 0.4
*/
-struct _ChamplainMapSourceDesc {
+struct _ChamplainMapSourceDesc
+{
gchar *id;
gchar *name;
gchar *license;
@@ -83,11 +85,11 @@ struct _ChamplainMapSourceDesc {
GType champlain_map_source_desc_get_type (void) G_GNUC_CONST;
#define CHAMPLAIN_TYPE_MAP_SOURCE_DESC (champlain_map_source_desc_get_type ())
-ChamplainMapSourceDesc * champlain_map_source_desc_copy (const ChamplainMapSourceDesc *desc);
+ChamplainMapSourceDesc *champlain_map_source_desc_copy (const ChamplainMapSourceDesc *desc);
void champlain_map_source_desc_free (ChamplainMapSourceDesc *desc);
-ChamplainMapSourceDesc * champlain_map_source_desc_new (void);
+ChamplainMapSourceDesc *champlain_map_source_desc_new (void);
G_END_DECLS
diff --git a/champlain/champlain-map-source-factory.c b/champlain/champlain-map-source-factory.c
index 047d881..6211d49 100644
--- a/champlain/champlain-map-source-factory.c
+++ b/champlain/champlain-map-source-factory.c
@@ -75,19 +75,21 @@ static ChamplainMapSourceFactory *instance = NULL;
G_DEFINE_TYPE (ChamplainMapSourceFactory, champlain_map_source_factory, G_TYPE_OBJECT);
#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY, ChamplainMapSourceFactoryPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY, ChamplainMapSourceFactoryPrivate))
struct _ChamplainMapSourceFactoryPrivate
{
GSList *registered_sources;
};
-static ChamplainMapSource * champlain_map_source_new_generic (
- ChamplainMapSourceDesc *desc, gpointer data);
+static ChamplainMapSource *champlain_map_source_new_generic (
+ ChamplainMapSourceDesc *desc,
+ gpointer data);
#ifdef CHAMPLAIN_HAS_MEMPHIS
-static ChamplainMapSource * champlain_map_source_new_memphis (
- ChamplainMapSourceDesc *desc, gpointer user_data);
+static ChamplainMapSource *champlain_map_source_new_memphis (
+ ChamplainMapSourceDesc *desc,
+ gpointer user_data);
#endif
@@ -101,6 +103,7 @@ champlain_map_source_factory_finalize (GObject *object)
G_OBJECT_CLASS (champlain_map_source_factory_parent_class)->finalize (object);
}
+
static GObject *
champlain_map_source_factory_constructor (GType type,
guint n_construct_params,
@@ -111,7 +114,7 @@ champlain_map_source_factory_constructor (GType type,
if (instance == NULL)
{
retval = G_OBJECT_CLASS (champlain_map_source_factory_parent_class)->constructor
- (type, n_construct_params, construct_params);
+ (type, n_construct_params, construct_params);
instance = CHAMPLAIN_MAP_SOURCE_FACTORY (retval);
g_object_add_weak_pointer (retval, (gpointer *) &instance);
@@ -124,6 +127,7 @@ champlain_map_source_factory_constructor (GType type,
return retval;
}
+
static void
champlain_map_source_factory_class_init (ChamplainMapSourceFactoryClass *klass)
{
@@ -135,129 +139,130 @@ champlain_map_source_factory_class_init (ChamplainMapSourceFactoryClass *klass)
object_class->finalize = champlain_map_source_factory_finalize;
}
+
static
ChamplainMapSourceDesc OSM_MAPNIK_DESC =
- {
- CHAMPLAIN_MAP_SOURCE_OSM_MAPNIK,
- "OpenStreetMap Mapnik",
- "Map data is CC-BY-SA 2.0 OpenStreetMap contributors",
- "http://creativecommons.org/licenses/by-sa/2.0/",
- 0,
- 18,
- CHAMPLAIN_MAP_PROJECTION_MERCATOR,
- champlain_map_source_new_generic,
- "http://tile.openstreetmap.org/#Z#/#X#/#Y#.png",
- NULL
- };
+{
+ CHAMPLAIN_MAP_SOURCE_OSM_MAPNIK,
+ "OpenStreetMap Mapnik",
+ "Map data is CC-BY-SA 2.0 OpenStreetMap contributors",
+ "http://creativecommons.org/licenses/by-sa/2.0/",
+ 0,
+ 18,
+ CHAMPLAIN_MAP_PROJECTION_MERCATOR,
+ champlain_map_source_new_generic,
+ "http://tile.openstreetmap.org/#Z#/#X#/#Y#.png",
+ NULL
+};
static
ChamplainMapSourceDesc OSM_OSMARENDER_DESC =
- {
- CHAMPLAIN_MAP_SOURCE_OSM_OSMARENDER,
- "OpenStreetMap Osmarender",
- "Map data is CC-BY-SA 2.0 OpenStreetMap contributors",
- "http://creativecommons.org/licenses/by-sa/2.0/",
- 0,
- 17,
- CHAMPLAIN_MAP_PROJECTION_MERCATOR,
- champlain_map_source_new_generic,
- "http://tah.openstreetmap.org/Tiles/tile/#Z#/#X#/#Y#.png",
- NULL
- };
+{
+ CHAMPLAIN_MAP_SOURCE_OSM_OSMARENDER,
+ "OpenStreetMap Osmarender",
+ "Map data is CC-BY-SA 2.0 OpenStreetMap contributors",
+ "http://creativecommons.org/licenses/by-sa/2.0/",
+ 0,
+ 17,
+ CHAMPLAIN_MAP_PROJECTION_MERCATOR,
+ champlain_map_source_new_generic,
+ "http://tah.openstreetmap.org/Tiles/tile/#Z#/#X#/#Y#.png",
+ NULL
+};
static
ChamplainMapSourceDesc OSM_CYCLEMAP_DESC =
- {
- CHAMPLAIN_MAP_SOURCE_OSM_CYCLE_MAP,
- "OpenStreetMap Cycle Map",
- "Map data is CC-BY-SA 2.0 OpenStreetMap contributors",
- "http://creativecommons.org/licenses/by-sa/2.0/",
- 0,
- 18,
- CHAMPLAIN_MAP_PROJECTION_MERCATOR,
- champlain_map_source_new_generic,
- "http://andy.sandbox.cloudmade.com/tiles/cycle/#Z#/#X#/#Y#.png",
- NULL
- };
+{
+ CHAMPLAIN_MAP_SOURCE_OSM_CYCLE_MAP,
+ "OpenStreetMap Cycle Map",
+ "Map data is CC-BY-SA 2.0 OpenStreetMap contributors",
+ "http://creativecommons.org/licenses/by-sa/2.0/",
+ 0,
+ 18,
+ CHAMPLAIN_MAP_PROJECTION_MERCATOR,
+ champlain_map_source_new_generic,
+ "http://andy.sandbox.cloudmade.com/tiles/cycle/#Z#/#X#/#Y#.png",
+ NULL
+};
static
ChamplainMapSourceDesc OSM_TRANSPORTMAP_DESC =
- {
- CHAMPLAIN_MAP_SOURCE_OSM_TRANSPORT_MAP,
- "OpenStreetMap Transport Map",
- "Map data is CC-BY-SA 2.0 OpenStreetMap contributors",
- "http://creativecommons.org/licenses/by-sa/2.0/",
- 0,
- 18,
- CHAMPLAIN_MAP_PROJECTION_MERCATOR,
- champlain_map_source_new_generic,
- "http://tile.xn--pnvkarte-m4a.de/tilegen/#Z#/#X#/#Y#.png",
- NULL
- };
+{
+ CHAMPLAIN_MAP_SOURCE_OSM_TRANSPORT_MAP,
+ "OpenStreetMap Transport Map",
+ "Map data is CC-BY-SA 2.0 OpenStreetMap contributors",
+ "http://creativecommons.org/licenses/by-sa/2.0/",
+ 0,
+ 18,
+ CHAMPLAIN_MAP_PROJECTION_MERCATOR,
+ champlain_map_source_new_generic,
+ "http://tile.xn--pnvkarte-m4a.de/tilegen/#Z#/#X#/#Y#.png",
+ NULL
+};
#if 0
/* Disabling until OpenArealMap works again */
static
ChamplainMapSourceDesc OAM_DESC =
- {
- CHAMPLAIN_MAP_SOURCE_OAM,
- "OpenAerialMap",
- "(CC) BY 3.0 OpenAerialMap contributors",
- "http://creativecommons.org/licenses/by/3.0/",
- 0,
- 17,
- CHAMPLAIN_MAP_PROJECTION_MERCATOR,
- champlain_map_source_new_generic,
- "http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/#Z#/#X#/#Y#.jpg",
- NULL
- };
+{
+ CHAMPLAIN_MAP_SOURCE_OAM,
+ "OpenAerialMap",
+ "(CC) BY 3.0 OpenAerialMap contributors",
+ "http://creativecommons.org/licenses/by/3.0/",
+ 0,
+ 17,
+ CHAMPLAIN_MAP_PROJECTION_MERCATOR,
+ champlain_map_source_new_generic,
+ "http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/#Z#/#X#/#Y#.jpg",
+ NULL
+};
#endif
static
ChamplainMapSourceDesc MFF_RELIEF_DESC =
- {
- CHAMPLAIN_MAP_SOURCE_MFF_RELIEF,
- "Maps for Free Relief",
- "Map data available under GNU Free Documentation license, Version 1.2 or later",
- "http://www.gnu.org/copyleft/fdl.html",
- 0,
- 11,
- CHAMPLAIN_MAP_PROJECTION_MERCATOR,
- champlain_map_source_new_generic,
- "http://maps-for-free.com/layer/relief/z#Z#/row#Y#/#Z#_#X#-#Y#.jpg",
- NULL
- };
+{
+ CHAMPLAIN_MAP_SOURCE_MFF_RELIEF,
+ "Maps for Free Relief",
+ "Map data available under GNU Free Documentation license, Version 1.2 or later",
+ "http://www.gnu.org/copyleft/fdl.html",
+ 0,
+ 11,
+ CHAMPLAIN_MAP_PROJECTION_MERCATOR,
+ champlain_map_source_new_generic,
+ "http://maps-for-free.com/layer/relief/z#Z#/row#Y#/#Z#_#X#-#Y#.jpg",
+ NULL
+};
#ifdef CHAMPLAIN_HAS_MEMPHIS
static
ChamplainMapSourceDesc MEMPHIS_LOCAL_DESC =
- {
- CHAMPLAIN_MAP_SOURCE_MEMPHIS_LOCAL,
- "OpenStreetMap Memphis Local Map",
- "(CC) BY 2.0 OpenStreetMap contributors",
- "http://creativecommons.org/licenses/by/2.0/",
- 12,
- 18,
- CHAMPLAIN_MAP_PROJECTION_MERCATOR,
- champlain_map_source_new_memphis,
- "",
- NULL
- };
+{
+ CHAMPLAIN_MAP_SOURCE_MEMPHIS_LOCAL,
+ "OpenStreetMap Memphis Local Map",
+ "(CC) BY 2.0 OpenStreetMap contributors",
+ "http://creativecommons.org/licenses/by/2.0/",
+ 12,
+ 18,
+ CHAMPLAIN_MAP_PROJECTION_MERCATOR,
+ champlain_map_source_new_memphis,
+ "",
+ NULL
+};
static
ChamplainMapSourceDesc MEMPHIS_NETWORK_DESC =
- {
- CHAMPLAIN_MAP_SOURCE_MEMPHIS_NETWORK,
- "OpenStreetMap Memphis Network Map",
- "(CC) BY 2.0 OpenStreetMap contributors",
- "http://creativecommons.org/licenses/by/2.0/",
- 12,
- 18,
- CHAMPLAIN_MAP_PROJECTION_MERCATOR,
- champlain_map_source_new_memphis,
- "",
- NULL
- };
+{
+ CHAMPLAIN_MAP_SOURCE_MEMPHIS_NETWORK,
+ "OpenStreetMap Memphis Network Map",
+ "(CC) BY 2.0 OpenStreetMap contributors",
+ "http://creativecommons.org/licenses/by/2.0/",
+ 12,
+ 18,
+ CHAMPLAIN_MAP_PROJECTION_MERCATOR,
+ champlain_map_source_new_memphis,
+ "",
+ NULL
+};
#endif
static void
@@ -291,6 +296,7 @@ champlain_map_source_factory_init (ChamplainMapSourceFactory *factory)
#endif
}
+
/**
* champlain_map_source_factory_dup_default:
*
@@ -307,6 +313,7 @@ champlain_map_source_factory_dup_default (void)
return g_object_new (CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY, NULL);
}
+
/**
* champlain_map_source_factory_dup_list:
* @factory: the Factory
@@ -324,6 +331,7 @@ champlain_map_source_factory_dup_list (ChamplainMapSourceFactory *factory)
return g_slist_copy (factory->priv->registered_sources);
}
+
/**
* champlain_map_source_factory_create:
* @factory: the Factory
@@ -356,6 +364,7 @@ champlain_map_source_factory_create (ChamplainMapSourceFactory *factory,
return NULL;
}
+
/**
* champlain_map_source_factory_create_cached_source:
* @factory: the Factory
@@ -386,14 +395,14 @@ champlain_map_source_factory_create_cached_source (ChamplainMapSourceFactory *fa
error_source = champlain_map_source_factory_create_error_source (factory, tile_size);
renderer = CHAMPLAIN_RENDERER (champlain_image_renderer_new ());
- file_cache = CHAMPLAIN_MAP_SOURCE(champlain_file_cache_new_full (100000000, NULL, renderer));
+ file_cache = CHAMPLAIN_MAP_SOURCE (champlain_file_cache_new_full (100000000, NULL, renderer));
source_chain = champlain_map_source_chain_new ();
champlain_map_source_chain_push (source_chain, error_source);
champlain_map_source_chain_push (source_chain, tile_source);
champlain_map_source_chain_push (source_chain, file_cache);
- return CHAMPLAIN_MAP_SOURCE(source_chain);
+ return CHAMPLAIN_MAP_SOURCE (source_chain);
}
@@ -434,7 +443,6 @@ champlain_map_source_factory_register (ChamplainMapSourceFactory *factory,
ChamplainMapSourceConstructor constructor,
gpointer data)
{
-
/* FIXME: check for existing factory with that name? */
desc->constructor = constructor;
desc->data = data;
@@ -442,6 +450,7 @@ champlain_map_source_factory_register (ChamplainMapSourceFactory *factory,
return TRUE;
}
+
static ChamplainMapSource *
champlain_map_source_new_generic (
ChamplainMapSourceDesc *desc, G_GNUC_UNUSED gpointer user_data)
@@ -451,20 +460,21 @@ champlain_map_source_new_generic (
renderer = CHAMPLAIN_RENDERER (champlain_image_renderer_new ());
map_source = CHAMPLAIN_MAP_SOURCE (champlain_network_tile_source_new_full (
- desc->id,
- desc->name,
- desc->license,
- desc->license_uri,
- desc->min_zoom_level,
- desc->max_zoom_level,
- 256,
- desc->projection,
- desc->uri_format,
- renderer));
+ desc->id,
+ desc->name,
+ desc->license,
+ desc->license_uri,
+ desc->min_zoom_level,
+ desc->max_zoom_level,
+ 256,
+ desc->projection,
+ desc->uri_format,
+ renderer));
return map_source;
}
+
#ifdef CHAMPLAIN_HAS_MEMPHIS
static ChamplainMapSource *
champlain_map_source_new_memphis (ChamplainMapSourceDesc *desc,
@@ -477,31 +487,32 @@ champlain_map_source_new_memphis (ChamplainMapSourceDesc *desc,
if (g_strcmp0 (desc->id, CHAMPLAIN_MAP_SOURCE_MEMPHIS_LOCAL) == 0)
{
map_source = CHAMPLAIN_MAP_SOURCE (champlain_file_tile_source_new_full (
- desc->id,
- desc->name,
- desc->license,
- desc->license_uri,
- desc->min_zoom_level,
- desc->max_zoom_level,
- 256,
- desc->projection,
- renderer));
+ desc->id,
+ desc->name,
+ desc->license,
+ desc->license_uri,
+ desc->min_zoom_level,
+ desc->max_zoom_level,
+ 256,
+ desc->projection,
+ renderer));
}
else
{
map_source = CHAMPLAIN_MAP_SOURCE (champlain_network_bbox_tile_source_new_full (
- desc->id,
- desc->name,
- desc->license,
- desc->license_uri,
- desc->min_zoom_level,
- desc->max_zoom_level,
- 256,
- desc->projection,
- renderer));
+ desc->id,
+ desc->name,
+ desc->license,
+ desc->license_uri,
+ desc->min_zoom_level,
+ desc->max_zoom_level,
+ 256,
+ desc->projection,
+ renderer));
}
return map_source;
}
-#endif
+
+#endif
diff --git a/champlain/champlain-map-source-factory.h b/champlain/champlain-map-source-factory.h
index 92b947b..5aef27b 100644
--- a/champlain/champlain-map-source-factory.h
+++ b/champlain/champlain-map-source-factory.h
@@ -33,22 +33,22 @@
G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY champlain_map_source_factory_get_type()
+#define CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY champlain_map_source_factory_get_type ()
#define CHAMPLAIN_MAP_SOURCE_FACTORY(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY, ChamplainMapSourceFactory))
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY, ChamplainMapSourceFactory))
#define CHAMPLAIN_MAP_SOURCE_FACTORY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY, ChamplainMapSourceFactoryClass))
+ (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY, ChamplainMapSourceFactoryClass))
#define CHAMPLAIN_IS_MAP_SOURCE_FACTORY(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY))
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY))
#define CHAMPLAIN_IS_MAP_SOURCE_FACTORY_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY))
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY))
#define CHAMPLAIN_MAP_SOURCE_FACTORY_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY, ChamplainMapSourceFactoryClass))
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY, ChamplainMapSourceFactoryClass))
typedef struct _ChamplainMapSourceFactory ChamplainMapSourceFactory;
typedef struct _ChamplainMapSourceFactoryClass ChamplainMapSourceFactoryClass;
@@ -67,20 +67,20 @@ struct _ChamplainMapSourceFactoryClass
GType champlain_map_source_factory_get_type (void);
-ChamplainMapSourceFactory * champlain_map_source_factory_dup_default (void);
+ChamplainMapSourceFactory *champlain_map_source_factory_dup_default (void);
-GSList * champlain_map_source_factory_dup_list (ChamplainMapSourceFactory *factory);
+GSList *champlain_map_source_factory_dup_list (ChamplainMapSourceFactory *factory);
-ChamplainMapSource * champlain_map_source_factory_create (ChamplainMapSourceFactory *factory,
+ChamplainMapSource *champlain_map_source_factory_create (ChamplainMapSourceFactory *factory,
const gchar *id);
-ChamplainMapSource * champlain_map_source_factory_create_cached_source (ChamplainMapSourceFactory *factory,
+ChamplainMapSource *champlain_map_source_factory_create_cached_source (ChamplainMapSourceFactory *factory,
const gchar *id);
-ChamplainMapSource * champlain_map_source_factory_create_error_source (ChamplainMapSourceFactory *factory,
+ChamplainMapSource *champlain_map_source_factory_create_error_source (ChamplainMapSourceFactory *factory,
guint tile_size);
-gboolean
-champlain_map_source_factory_register (ChamplainMapSourceFactory *factory,
- ChamplainMapSourceDesc *desc, ChamplainMapSourceConstructor constructor,
+gboolean champlain_map_source_factory_register (ChamplainMapSourceFactory *factory,
+ ChamplainMapSourceDesc *desc,
+ ChamplainMapSourceConstructor constructor,
gpointer data);
#ifndef CHAMPLAIN_HAS_MAEMO
diff --git a/champlain/champlain-map-source.c b/champlain/champlain-map-source.c
index e98dce2..c1783ea 100644
--- a/champlain/champlain-map-source.c
+++ b/champlain/champlain-map-source.c
@@ -57,7 +57,7 @@
G_DEFINE_TYPE (ChamplainMapSource, champlain_map_source, G_TYPE_INITIALLY_UNOWNED);
#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_MAP_SOURCE, ChamplainMapSourcePrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_MAP_SOURCE, ChamplainMapSourcePrivate))
enum
{
@@ -84,7 +84,8 @@ struct _ChamplainMapSourcePrivate
gulong renderer_sig_handler_id;
};
-static void reload_tiles_cb (ChamplainMapSource *orig, ChamplainMapSource *self);
+static void reload_tiles_cb (ChamplainMapSource *orig,
+ ChamplainMapSource *self);
static void on_set_next_source (ChamplainMapSource *map_source,
ChamplainMapSource *old_next_source,
ChamplainMapSource *new_next_source);
@@ -102,37 +103,43 @@ champlain_map_source_get_property (GObject *object,
case PROP_NEXT_SOURCE:
g_value_set_object (value, priv->next_source);
break;
+
case PROP_RENDERER:
g_value_set_object (value, priv->renderer);
break;
+
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
+
static void
champlain_map_source_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE(object);
+ ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE (object);
switch (prop_id)
{
case PROP_NEXT_SOURCE:
champlain_map_source_set_next_source (map_source,
- g_value_get_object (value));
+ g_value_get_object (value));
break;
+
case PROP_RENDERER:
champlain_map_source_set_renderer (map_source,
- g_value_get_object (value));
+ g_value_get_object (value));
break;
+
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
+
static void
champlain_map_source_dispose (GObject *object)
{
@@ -155,23 +162,26 @@ champlain_map_source_dispose (GObject *object)
G_OBJECT_CLASS (champlain_map_source_parent_class)->dispose (object);
}
+
static void
champlain_map_source_finalize (GObject *object)
{
G_OBJECT_CLASS (champlain_map_source_parent_class)->finalize (object);
}
+
static void
-champlain_map_source_constructed (GObject *object)
+champlain_map_source_constructed (GObject *object)
{
if (G_OBJECT_CLASS (champlain_map_source_parent_class)->constructed)
G_OBJECT_CLASS (champlain_map_source_parent_class)->constructed (object);
}
+
static void
champlain_map_source_class_init (ChamplainMapSourceClass *klass)
{
- GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (klass, sizeof (ChamplainMapSourcePrivate));
@@ -195,49 +205,50 @@ champlain_map_source_class_init (ChamplainMapSourceClass *klass)
klass->on_set_next_source = on_set_next_source;
/**
- * ChamplainMapSource:next-source:
- *
- * Next source in the loading chain.
- *
- * Since: 0.6
- */
+ * ChamplainMapSource:next-source:
+ *
+ * Next source in the loading chain.
+ *
+ * Since: 0.6
+ */
pspec = g_param_spec_object ("next-source",
- "Next Source",
- "Next source in the loading chain",
- CHAMPLAIN_TYPE_MAP_SOURCE,
- G_PARAM_READWRITE);
+ "Next Source",
+ "Next source in the loading chain",
+ CHAMPLAIN_TYPE_MAP_SOURCE,
+ G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_NEXT_SOURCE, pspec);
/**
- * ChamplainMapSource:renderer:
- *
- * Renderer used to render tiles.
- *
- * Since: 0.8
- */
+ * ChamplainMapSource:renderer:
+ *
+ * Renderer used to render tiles.
+ *
+ * Since: 0.8
+ */
pspec = g_param_spec_object ("renderer",
- "Tile renderer",
- "Tile renderer used to render tiles",
- CHAMPLAIN_TYPE_RENDERER,
- G_PARAM_READWRITE);
+ "Tile renderer",
+ "Tile renderer used to render tiles",
+ CHAMPLAIN_TYPE_RENDERER,
+ G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_RENDERER, pspec);
/**
- * ChamplainMapSource::reload-tiles:
- * @map_source: the #ChamplainMapSource that received the signal
- *
- * The ChamplainMapSource::reload-tiles signal is emitted when the map source
- * changed its style or data
- *
- * Since: 0.6
- */
+ * ChamplainMapSource::reload-tiles:
+ * @map_source: the #ChamplainMapSource that received the signal
+ *
+ * The ChamplainMapSource::reload-tiles signal is emitted when the map source
+ * changed its style or data
+ *
+ * Since: 0.6
+ */
champlain_map_source_signals[RELOAD_TILES] =
g_signal_new ("reload-tiles", G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID, G_TYPE_NONE,
- 0, NULL);
+ G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE,
+ 0, NULL);
}
+
static void
champlain_map_source_init (ChamplainMapSource *map_source)
{
@@ -251,6 +262,7 @@ champlain_map_source_init (ChamplainMapSource *map_source)
priv->renderer_sig_handler_id = 0;
}
+
/**
* champlain_map_source_get_next_source:
* @map_source: a #ChamplainMapSource
@@ -269,6 +281,7 @@ champlain_map_source_get_next_source (ChamplainMapSource *map_source)
return map_source->priv->next_source;
}
+
/**
* champlain_map_source_get_renderer:
* @map_source: a #ChamplainMapSource
@@ -287,19 +300,22 @@ champlain_map_source_get_renderer (ChamplainMapSource *map_source)
return map_source->priv->renderer;
}
-static
-void reload_tiles_cb (G_GNUC_UNUSED ChamplainMapSource *orig, ChamplainMapSource *self)
+
+static void
+reload_tiles_cb (G_GNUC_UNUSED ChamplainMapSource *orig, ChamplainMapSource *self)
{
/* propagate the signal up the chain */
g_signal_emit_by_name (self, "reload-tiles", NULL);
}
+
static void
on_set_next_source (ChamplainMapSource *map_source,
ChamplainMapSource *old_next_source,
ChamplainMapSource *new_next_source)
{
ChamplainMapSourcePrivate *priv = map_source->priv;
+
if (old_next_source)
{
if (g_signal_handler_is_connected (old_next_source, priv->sig_handler_id))
@@ -309,10 +325,11 @@ on_set_next_source (ChamplainMapSource *map_source,
if (new_next_source)
{
priv->sig_handler_id = g_signal_connect (new_next_source, "reload-tiles",
- G_CALLBACK (reload_tiles_cb), map_source);
+ G_CALLBACK (reload_tiles_cb), map_source);
}
}
+
/**
* champlain_map_source_set_next_source:
* @map_source: a #ChamplainMapSource
@@ -347,6 +364,7 @@ champlain_map_source_set_next_source (ChamplainMapSource *map_source,
g_object_notify (G_OBJECT (map_source), "next-source");
}
+
/**
* champlain_map_source_set_renderer:
* @map_source: a #ChamplainMapSource
@@ -382,6 +400,7 @@ champlain_map_source_set_renderer (ChamplainMapSource *map_source,
g_object_notify (G_OBJECT (map_source), "renderer");
}
+
/**
* champlain_map_source_get_id:
* @map_source: a #ChamplainMapSource
@@ -400,6 +419,7 @@ champlain_map_source_get_id (ChamplainMapSource *map_source)
return CHAMPLAIN_MAP_SOURCE_GET_CLASS (map_source)->get_id (map_source);
}
+
/**
* champlain_map_source_get_name:
* @map_source: a #ChamplainMapSource
@@ -418,6 +438,7 @@ champlain_map_source_get_name (ChamplainMapSource *map_source)
return CHAMPLAIN_MAP_SOURCE_GET_CLASS (map_source)->get_name (map_source);
}
+
/**
* champlain_map_source_get_license:
* @map_source: a #ChamplainMapSource
@@ -436,6 +457,7 @@ champlain_map_source_get_license (ChamplainMapSource *map_source)
return CHAMPLAIN_MAP_SOURCE_GET_CLASS (map_source)->get_license (map_source);
}
+
/**
* champlain_map_source_get_license_uri:
* @map_source: a #ChamplainMapSource
@@ -454,6 +476,7 @@ champlain_map_source_get_license_uri (ChamplainMapSource *map_source)
return CHAMPLAIN_MAP_SOURCE_GET_CLASS (map_source)->get_license_uri (map_source);
}
+
/**
* champlain_map_source_get_min_zoom_level:
* @map_source: a #ChamplainMapSource
@@ -472,6 +495,7 @@ champlain_map_source_get_min_zoom_level (ChamplainMapSource *map_source)
return CHAMPLAIN_MAP_SOURCE_GET_CLASS (map_source)->get_min_zoom_level (map_source);
}
+
/**
* champlain_map_source_get_max_zoom_level:
* @map_source: a #ChamplainMapSource
@@ -490,6 +514,7 @@ champlain_map_source_get_max_zoom_level (ChamplainMapSource *map_source)
return CHAMPLAIN_MAP_SOURCE_GET_CLASS (map_source)->get_max_zoom_level (map_source);
}
+
/**
* champlain_map_source_get_tile_size:
* @map_source: a #ChamplainMapSource
@@ -508,6 +533,7 @@ champlain_map_source_get_tile_size (ChamplainMapSource *map_source)
return CHAMPLAIN_MAP_SOURCE_GET_CLASS (map_source)->get_tile_size (map_source);
}
+
/**
* champlain_map_source_get_projection:
* @map_source: a #ChamplainMapSource
@@ -526,6 +552,7 @@ champlain_map_source_get_projection (ChamplainMapSource *map_source)
return CHAMPLAIN_MAP_SOURCE_GET_CLASS (map_source)->get_projection (map_source);
}
+
/**
* champlain_map_source_get_x:
* @map_source: a #ChamplainMapSource
@@ -546,10 +573,11 @@ champlain_map_source_get_x (ChamplainMapSource *map_source,
{
g_return_val_if_fail (CHAMPLAIN_IS_MAP_SOURCE (map_source), 0);
- // FIXME: support other projections
+ /* FIXME: support other projections */
return ((longitude + 180.0) / 360.0 * pow (2.0, zoom_level)) * champlain_map_source_get_tile_size (map_source);
}
+
/**
* champlain_map_source_get_y:
* @map_source: a #ChamplainMapSource
@@ -570,12 +598,12 @@ champlain_map_source_get_y (ChamplainMapSource *map_source,
{
g_return_val_if_fail (CHAMPLAIN_IS_MAP_SOURCE (map_source), 0);
- // FIXME: support other projections
- return ((1.0 - log (tan (latitude * M_PI / 180.0) + 1.0 /
- cos (latitude * M_PI / 180.0)) /
- M_PI) / 2.0 * pow (2.0, zoom_level)) * champlain_map_source_get_tile_size (map_source);
+ /* FIXME: support other projections */
+ return ((1.0 - log (tan (latitude * M_PI / 180.0) + 1.0 / cos (latitude * M_PI / 180.0)) / M_PI) /
+ 2.0 * pow (2.0, zoom_level)) * champlain_map_source_get_tile_size (map_source);
}
+
/**
* champlain_map_source_get_longitude:
* @map_source: a #ChamplainMapSource
@@ -595,12 +623,12 @@ champlain_map_source_get_longitude (ChamplainMapSource *map_source,
guint x)
{
g_return_val_if_fail (CHAMPLAIN_IS_MAP_SOURCE (map_source), 0);
- //ChamplainMapSourcePrivate *priv = map_source->priv;
- // FIXME: support other projections
- gdouble dx = (float)x / champlain_map_source_get_tile_size (map_source);
+ /* FIXME: support other projections */
+ gdouble dx = (float) x / champlain_map_source_get_tile_size (map_source);
return dx / pow (2.0, zoom_level) * 360.0 - 180;
}
+
/**
* champlain_map_source_get_latitude:
* @map_source: a #ChamplainMapSource
@@ -620,13 +648,13 @@ champlain_map_source_get_latitude (ChamplainMapSource *map_source,
guint y)
{
g_return_val_if_fail (CHAMPLAIN_IS_MAP_SOURCE (map_source), 0);
- //ChamplainMapSourcePrivate *priv = map_source->priv;
- // FIXME: support other projections
- gdouble dy = (float)y / champlain_map_source_get_tile_size (map_source);
+ /* FIXME: support other projections */
+ gdouble dy = (float) y / champlain_map_source_get_tile_size (map_source);
gdouble n = M_PI - 2.0 * M_PI * dy / pow (2.0, zoom_level);
return 180.0 / M_PI * atan (0.5 * (exp (n) - exp (-n)));
}
+
/**
* champlain_map_source_get_row_count:
* @map_source: a #ChamplainMapSource
@@ -643,12 +671,11 @@ champlain_map_source_get_row_count (ChamplainMapSource *map_source,
guint zoom_level)
{
g_return_val_if_fail (CHAMPLAIN_IS_MAP_SOURCE (map_source), 0);
-
- //ChamplainMapSourcePrivate *priv = map_source->priv;
- // FIXME: support other projections
+ /* FIXME: support other projections */
return (zoom_level != 0) ? 2 << (zoom_level - 1) : 1;
}
+
/**
* champlain_map_source_get_column_count:
* @map_source: a #ChamplainMapSource
@@ -666,12 +693,11 @@ champlain_map_source_get_column_count (ChamplainMapSource *map_source,
guint zoom_level)
{
g_return_val_if_fail (CHAMPLAIN_IS_MAP_SOURCE (map_source), 0);
-
- //ChamplainMapSourcePrivate *priv = map_source->priv;
- // FIXME: support other projections
+ /* FIXME: support other projections */
return (zoom_level != 0) ? 2 << (zoom_level - 1) : 1;
}
+
#define EARTH_RADIUS 6378137.0 /* meters, Equatorial radius */
/**
@@ -695,18 +721,20 @@ champlain_map_source_get_meters_per_pixel (ChamplainMapSource *map_source,
{
g_return_val_if_fail (CHAMPLAIN_IS_MAP_SOURCE (map_source), 0.0);
- /* Width is in pixels. (1 px)
- m/px = radius_at_latitude / width_in_pixels
- k = radius of earth = 6 378.1 km
- radius_at_latitude = 2pi * k * sin (pi/2-theta)
- */
+ /*
+ * Width is in pixels. (1 px)
+ * m/px = radius_at_latitude / width_in_pixels
+ * k = radius of earth = 6 378.1 km
+ * radius_at_latitude = 2pi * k * sin (pi/2-theta)
+ */
gdouble tile_size = champlain_map_source_get_tile_size (map_source);
- // FIXME: support other projections
- return 2.0 * M_PI * EARTH_RADIUS * sin (M_PI/2.0 - M_PI / 180.0 * latitude) /
+ /* FIXME: support other projections */
+ return 2.0 * M_PI *EARTH_RADIUS * sin (M_PI / 2.0 - M_PI / 180.0 * latitude) /
(tile_size * champlain_map_source_get_row_count (map_source, zoom_level));
}
+
/**
* champlain_map_source_fill_tile:
* @map_source: a #ChamplainMapSource
diff --git a/champlain/champlain-map-source.h b/champlain/champlain-map-source.h
index cfc6631..26cc10e 100644
--- a/champlain/champlain-map-source.h
+++ b/champlain/champlain-map-source.h
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
#define CHAMPLAIN_MAP_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_MAP_SOURCE, ChamplainMapSource))
-
+
#define CHAMPLAIN_MAP_SOURCE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_MAP_SOURCE, ChamplainMapSourceClass))
@@ -72,21 +72,21 @@ struct _ChamplainMapSourceClass
{
GInitiallyUnownedClass parent_class;
- const gchar * (*get_id) (ChamplainMapSource *map_source);
- const gchar * (*get_name) (ChamplainMapSource *map_source);
- const gchar * (*get_license) (ChamplainMapSource *map_source);
- const gchar * (*get_license_uri) (ChamplainMapSource *map_source);
- guint (*get_min_zoom_level) (ChamplainMapSource *map_source);
- guint (*get_max_zoom_level) (ChamplainMapSource *map_source);
- guint (*get_tile_size) (ChamplainMapSource *map_source);
- ChamplainMapProjection (*get_projection) (ChamplainMapSource *map_source);
-
- void (*fill_tile) (ChamplainMapSource *map_source,
- ChamplainTile *tile);
-
- void (*on_set_next_source) (ChamplainMapSource *map_source,
- ChamplainMapSource *next_source,
- ChamplainMapSource *new_next_source);
+ const gchar * (*get_id)(ChamplainMapSource *map_source);
+ const gchar * (*get_name)(ChamplainMapSource *map_source);
+ const gchar * (*get_license)(ChamplainMapSource *map_source);
+ const gchar * (*get_license_uri)(ChamplainMapSource *map_source);
+ guint (*get_min_zoom_level)(ChamplainMapSource *map_source);
+ guint (*get_max_zoom_level)(ChamplainMapSource *map_source);
+ guint (*get_tile_size)(ChamplainMapSource *map_source);
+ ChamplainMapProjection (*get_projection)(ChamplainMapSource *map_source);
+
+ void (*fill_tile)(ChamplainMapSource *map_source,
+ ChamplainTile *tile);
+
+ void (*on_set_next_source)(ChamplainMapSource *map_source,
+ ChamplainMapSource *next_source,
+ ChamplainMapSource *new_next_source);
};
GType champlain_map_source_get_type (void);
@@ -99,10 +99,10 @@ ChamplainRenderer *champlain_map_source_get_renderer (ChamplainMapSource *map_so
void champlain_map_source_set_renderer (ChamplainMapSource *map_source,
ChamplainRenderer *renderer);
-const gchar * champlain_map_source_get_id (ChamplainMapSource *map_source);
-const gchar * champlain_map_source_get_name (ChamplainMapSource *map_source);
-const gchar * champlain_map_source_get_license (ChamplainMapSource *map_source);
-const gchar * champlain_map_source_get_license_uri (ChamplainMapSource *map_source);
+const gchar *champlain_map_source_get_id (ChamplainMapSource *map_source);
+const gchar *champlain_map_source_get_name (ChamplainMapSource *map_source);
+const gchar *champlain_map_source_get_license (ChamplainMapSource *map_source);
+const gchar *champlain_map_source_get_license_uri (ChamplainMapSource *map_source);
guint champlain_map_source_get_min_zoom_level (ChamplainMapSource *map_source);
guint champlain_map_source_get_max_zoom_level (ChamplainMapSource *map_source);
guint champlain_map_source_get_tile_size (ChamplainMapSource *map_source);
@@ -135,4 +135,3 @@ void champlain_map_source_fill_tile (ChamplainMapSource *map_source,
G_END_DECLS
#endif /* _CHAMPLAIN_MAP_SOURCE_H_ */
-
diff --git a/champlain/champlain-marker.c b/champlain/champlain-marker.c
index 7db03eb..3d68e43 100644
--- a/champlain/champlain-marker.c
+++ b/champlain/champlain-marker.c
@@ -52,11 +52,11 @@
#define DEFAULT_FONT_NAME "Sans 11"
-static ClutterColor SELECTED_COLOR = {0x00, 0x33, 0xcc, 0xff};
-static ClutterColor SELECTED_TEXT_COLOR = {0xff, 0xff, 0xff, 0xff};
+static ClutterColor SELECTED_COLOR = { 0x00, 0x33, 0xcc, 0xff };
+static ClutterColor SELECTED_TEXT_COLOR = { 0xff, 0xff, 0xff, 0xff };
-static ClutterColor DEFAULT_COLOR = {0x33, 0x33, 0x33, 0xff};
-static ClutterColor DEFAULT_TEXT_COLOR = {0xee, 0xee, 0xee, 0xff};
+static ClutterColor DEFAULT_COLOR = { 0x33, 0x33, 0x33, 0xff };
+static ClutterColor DEFAULT_TEXT_COLOR = { 0xee, 0xee, 0xee, 0xff };
enum
{
@@ -82,7 +82,7 @@ enum
PROP_DRAW_BACKGROUND
};
-//static guint champlain_marker_signals[LAST_SIGNAL] = { 0, };
+/* static guint champlain_marker_signals[LAST_SIGNAL] = { 0, }; */
struct _ChamplainMarkerPrivate
{
@@ -109,7 +109,7 @@ struct _ChamplainMarkerPrivate
G_DEFINE_TYPE (ChamplainMarker, champlain_marker, CHAMPLAIN_TYPE_BASE_MARKER);
#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_MARKER, ChamplainMarkerPrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_MARKER, ChamplainMarkerPrivate))
static void draw_marker (ChamplainMarker *marker);
@@ -131,6 +131,7 @@ champlain_marker_set_highlight_color (ClutterColor *color)
SELECTED_COLOR.alpha = color->alpha;
}
+
/**
* champlain_marker_get_highlight_color:
*
@@ -146,6 +147,7 @@ champlain_marker_get_highlight_color ()
return &SELECTED_COLOR;
}
+
/**
* champlain_marker_set_highlight_text_color:
* @color: a #ClutterColor
@@ -164,6 +166,7 @@ champlain_marker_set_highlight_text_color (ClutterColor *color)
SELECTED_TEXT_COLOR.alpha = color->alpha;
}
+
/**
* champlain_marker_get_highlight_text_color:
*
@@ -179,108 +182,135 @@ champlain_marker_get_highlight_text_color ()
return &SELECTED_TEXT_COLOR;
}
+
static void
champlain_marker_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- ChamplainMarkerPrivate *priv = CHAMPLAIN_MARKER (object)->priv;
-
- switch (prop_id)
- {
- case PROP_TEXT:
- g_value_set_string (value, priv->text);
- break;
- case PROP_IMAGE:
- g_value_set_object (value, priv->image);
- break;
- case PROP_USE_MARKUP:
- g_value_set_boolean (value, priv->use_markup);
- break;
- case PROP_ALIGNMENT:
- g_value_set_enum (value, priv->alignment);
- break;
- case PROP_COLOR:
- clutter_value_set_color (value, priv->color);
- break;
- case PROP_TEXT_COLOR:
- clutter_value_set_color (value, priv->text_color);
- break;
- case PROP_FONT_NAME:
- g_value_set_string (value, priv->font_name);
- break;
- case PROP_WRAP:
- g_value_set_boolean (value, priv->wrap);
- break;
- case PROP_WRAP_MODE:
- g_value_set_enum (value, priv->wrap_mode);
- break;
- case PROP_DRAW_BACKGROUND:
- g_value_set_boolean (value, priv->draw_background);
- break;
- case PROP_ELLIPSIZE:
- g_value_set_enum (value, priv->ellipsize);
- break;
- case PROP_SINGLE_LINE_MODE:
- g_value_set_enum (value, priv->single_line_mode);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
+ ChamplainMarkerPrivate *priv = CHAMPLAIN_MARKER (object)->priv;
+
+ switch (prop_id)
+ {
+ case PROP_TEXT:
+ g_value_set_string (value, priv->text);
+ break;
+
+ case PROP_IMAGE:
+ g_value_set_object (value, priv->image);
+ break;
+
+ case PROP_USE_MARKUP:
+ g_value_set_boolean (value, priv->use_markup);
+ break;
+
+ case PROP_ALIGNMENT:
+ g_value_set_enum (value, priv->alignment);
+ break;
+
+ case PROP_COLOR:
+ clutter_value_set_color (value, priv->color);
+ break;
+
+ case PROP_TEXT_COLOR:
+ clutter_value_set_color (value, priv->text_color);
+ break;
+
+ case PROP_FONT_NAME:
+ g_value_set_string (value, priv->font_name);
+ break;
+
+ case PROP_WRAP:
+ g_value_set_boolean (value, priv->wrap);
+ break;
+
+ case PROP_WRAP_MODE:
+ g_value_set_enum (value, priv->wrap_mode);
+ break;
+
+ case PROP_DRAW_BACKGROUND:
+ g_value_set_boolean (value, priv->draw_background);
+ break;
+
+ case PROP_ELLIPSIZE:
+ g_value_set_enum (value, priv->ellipsize);
+ break;
+
+ case PROP_SINGLE_LINE_MODE:
+ g_value_set_enum (value, priv->single_line_mode);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
}
+
static void
champlain_marker_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- ChamplainMarker *marker = CHAMPLAIN_MARKER (object);
+ ChamplainMarker *marker = CHAMPLAIN_MARKER (object);
- switch (prop_id)
+ switch (prop_id)
{
- case PROP_TEXT:
- champlain_marker_set_text (marker, g_value_get_string (value));
- break;
- case PROP_IMAGE:
- champlain_marker_set_image (marker, g_value_get_object (value));
- break;
- case PROP_USE_MARKUP:
- champlain_marker_set_use_markup (marker, g_value_get_boolean (value));
- break;
- case PROP_ALIGNMENT:
- champlain_marker_set_alignment (marker, g_value_get_enum (value));
- break;
- case PROP_COLOR:
- champlain_marker_set_color (marker, clutter_value_get_color (value));
- break;
- case PROP_TEXT_COLOR:
- champlain_marker_set_text_color (marker, clutter_value_get_color (value));
- break;
- case PROP_FONT_NAME:
- champlain_marker_set_font_name (marker, g_value_get_string (value));
- break;
- case PROP_WRAP:
- champlain_marker_set_wrap (marker, g_value_get_boolean (value));
- break;
- case PROP_WRAP_MODE:
- champlain_marker_set_wrap_mode (marker, g_value_get_enum (value));
- break;
- case PROP_ELLIPSIZE:
- champlain_marker_set_ellipsize (marker, g_value_get_enum (value));
- break;
- case PROP_DRAW_BACKGROUND:
- champlain_marker_set_draw_background (marker, g_value_get_boolean (value));
- break;
- case PROP_SINGLE_LINE_MODE:
- champlain_marker_set_single_line_mode (marker, g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ case PROP_TEXT:
+ champlain_marker_set_text (marker, g_value_get_string (value));
+ break;
+
+ case PROP_IMAGE:
+ champlain_marker_set_image (marker, g_value_get_object (value));
+ break;
+
+ case PROP_USE_MARKUP:
+ champlain_marker_set_use_markup (marker, g_value_get_boolean (value));
+ break;
+
+ case PROP_ALIGNMENT:
+ champlain_marker_set_alignment (marker, g_value_get_enum (value));
+ break;
+
+ case PROP_COLOR:
+ champlain_marker_set_color (marker, clutter_value_get_color (value));
+ break;
+
+ case PROP_TEXT_COLOR:
+ champlain_marker_set_text_color (marker, clutter_value_get_color (value));
+ break;
+
+ case PROP_FONT_NAME:
+ champlain_marker_set_font_name (marker, g_value_get_string (value));
+ break;
+
+ case PROP_WRAP:
+ champlain_marker_set_wrap (marker, g_value_get_boolean (value));
+ break;
+
+ case PROP_WRAP_MODE:
+ champlain_marker_set_wrap_mode (marker, g_value_get_enum (value));
+ break;
+
+ case PROP_ELLIPSIZE:
+ champlain_marker_set_ellipsize (marker, g_value_get_enum (value));
+ break;
+
+ case PROP_DRAW_BACKGROUND:
+ champlain_marker_set_draw_background (marker, g_value_get_boolean (value));
+ break;
+
+ case PROP_SINGLE_LINE_MODE:
+ champlain_marker_set_single_line_mode (marker, g_value_get_boolean (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
+
static void
champlain_marker_dispose (GObject *object)
{
@@ -319,6 +349,7 @@ champlain_marker_dispose (GObject *object)
G_OBJECT_CLASS (champlain_marker_parent_class)->dispose (object);
}
+
static void
champlain_marker_finalize (GObject *object)
{
@@ -357,6 +388,7 @@ champlain_marker_finalize (GObject *object)
G_OBJECT_CLASS (champlain_marker_parent_class)->finalize (object);
}
+
static void
champlain_marker_class_init (ChamplainMarkerClass *markerClass)
{
@@ -370,148 +402,148 @@ champlain_marker_class_init (ChamplainMarkerClass *markerClass)
markerClass->draw_marker = draw_marker;
/**
- * ChamplainMarker:text:
- *
- * The text of the marker
- *
- * Since: 0.4
- */
+ * ChamplainMarker:text:
+ *
+ * The text of the marker
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_TEXT,
g_param_spec_string ("text", "Text", "The text of the marker",
"", CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainMarker:image:
- *
- * The image of the marker
- *
- * Since: 0.4
- */
+ * ChamplainMarker:image:
+ *
+ * The image of the marker
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_IMAGE,
g_param_spec_object ("image", "Image", "The image of the marker",
CLUTTER_TYPE_ACTOR, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainMarker:use-markup:
- *
- * If the marker's text uses markup
- *
- * Since: 0.4
- */
+ * ChamplainMarker:use-markup:
+ *
+ * If the marker's text uses markup
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_USE_MARKUP,
g_param_spec_boolean ("use-markup", "Use Markup", "The text uses markup",
FALSE, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainMarker:alignment:
- *
- * The marker's alignment
- *
- * Since: 0.4
- */
+ * ChamplainMarker:alignment:
+ *
+ * The marker's alignment
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_ALIGNMENT,
g_param_spec_enum ("alignment", "Alignment", "The marker's alignment",
PANGO_TYPE_ALIGNMENT, PANGO_ALIGN_LEFT, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainMarker:color:
- *
- * The marker's color
- *
- * Since: 0.4
- */
+ * ChamplainMarker:color:
+ *
+ * The marker's color
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_COLOR,
clutter_param_spec_color ("color", "Color", "The marker's color",
&DEFAULT_COLOR, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainMarker:text-color:
- *
- * The marker's text color
- *
- * Since: 0.4
- */
+ * ChamplainMarker:text-color:
+ *
+ * The marker's text color
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_TEXT_COLOR,
clutter_param_spec_color ("text-color", "Text Color", "The marker's text color",
&DEFAULT_TEXT_COLOR, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainMarker:font-name:
- *
- * The marker's text font name
- *
- * Since: 0.4
- */
+ * ChamplainMarker:font-name:
+ *
+ * The marker's text font name
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_FONT_NAME,
g_param_spec_string ("font-name", "Font Name", "The marker's text font name",
"Sans 11", CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainMarker:wrap:
- *
- * If the marker's text wrap is set
- *
- * Since: 0.4
- */
+ * ChamplainMarker:wrap:
+ *
+ * If the marker's text wrap is set
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_WRAP,
g_param_spec_boolean ("wrap", "Wrap", "The marker's text wrap",
FALSE, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainMarker:wrap-mode:
- *
- * The marker's text wrap mode
- *
- * Since: 0.4
- */
+ * ChamplainMarker:wrap-mode:
+ *
+ * The marker's text wrap mode
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_WRAP_MODE,
g_param_spec_enum ("wrap-mode", "Wrap Mode", "The marker's text wrap mode",
PANGO_TYPE_WRAP_MODE, PANGO_WRAP_WORD, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainMarker:ellipsize:
- *
- * The marker's ellipsize mode
- *
- * Since: 0.4
- */
+ * ChamplainMarker:ellipsize:
+ *
+ * The marker's ellipsize mode
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_ELLIPSIZE,
g_param_spec_enum ("ellipsize", "Ellipsize Mode", "The marker's text ellipsize mode",
PANGO_TYPE_ELLIPSIZE_MODE, PANGO_ELLIPSIZE_NONE, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainMarker:draw-background:
- *
- * If the marker has a background
- *
- * Since: 0.4
- */
+ * ChamplainMarker:draw-background:
+ *
+ * If the marker has a background
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_DRAW_BACKGROUND,
g_param_spec_boolean ("draw-background", "Draw Background", "The marker has a background",
TRUE, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainMarker:single-line-mode:
- *
- * If the marker is in single line mode
- *
- * Since: 0.4
- */
+ * ChamplainMarker:single-line-mode:
+ *
+ * If the marker is in single line mode
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class, PROP_SINGLE_LINE_MODE,
g_param_spec_boolean ("single-line-mode", "Single Line Mode", "The marker's single line mode",
TRUE, CHAMPLAIN_PARAM_READWRITE));
-
}
+
#define RADIUS 10
#define PADDING (RADIUS / 2)
static void
draw_box (cairo_t *cr,
- gint width,
- gint height,
- gint point,
- gboolean mirror)
+ gint width,
+ gint height,
+ gint point,
+ gboolean mirror)
{
if (mirror)
{
@@ -538,14 +570,14 @@ draw_box (cairo_t *cr,
cairo_arc (cr, RADIUS, RADIUS, RADIUS - 1, M_PI, 3 * M_PI / 2.0);
cairo_close_path (cr);
}
-
}
+
static void
draw_shadow (ChamplainMarker *marker,
- gint width,
- gint height,
- gint point)
+ gint width,
+ gint height,
+ gint point)
{
ChamplainMarkerPrivate *priv = marker->priv;
ClutterActor *shadow = NULL;
@@ -578,7 +610,7 @@ draw_shadow (ChamplainMarker *marker,
cairo_destroy (cr);
- clutter_actor_set_position (shadow, 0, height / 2.0 );
+ clutter_actor_set_position (shadow, 0, height / 2.0);
clutter_container_add_actor (CLUTTER_CONTAINER (marker), shadow);
@@ -648,6 +680,7 @@ draw_background (ChamplainMarker *marker,
priv->background = g_object_ref (bg);
}
+
static void
draw_marker (ChamplainMarker *marker)
{
@@ -720,21 +753,21 @@ draw_marker (ChamplainMarker *marker)
draw_background (marker, total_width, total_height, point);
}
else
- {
- if (priv->background != NULL)
- {
- clutter_container_remove_actor (CLUTTER_CONTAINER (marker), priv->background);
- g_object_unref (G_OBJECT (priv->background));
- priv->background = NULL;
- }
-
- if (priv->shadow != NULL)
- {
- clutter_container_remove_actor (CLUTTER_CONTAINER (marker), priv->shadow);
- g_object_unref (G_OBJECT (priv->shadow));
- priv->shadow = NULL;
- }
- }
+ {
+ if (priv->background != NULL)
+ {
+ clutter_container_remove_actor (CLUTTER_CONTAINER (marker), priv->background);
+ g_object_unref (G_OBJECT (priv->background));
+ priv->background = NULL;
+ }
+
+ if (priv->shadow != NULL)
+ {
+ clutter_container_remove_actor (CLUTTER_CONTAINER (marker), priv->shadow);
+ g_object_unref (G_OBJECT (priv->shadow));
+ priv->shadow = NULL;
+ }
+ }
if (priv->text_actor != NULL && priv->background != NULL)
clutter_actor_raise (priv->text_actor, priv->background);
@@ -742,12 +775,12 @@ draw_marker (ChamplainMarker *marker)
clutter_actor_raise (priv->image, priv->background);
if (priv->draw_background)
- {
- if (priv->alignment == PANGO_ALIGN_RIGHT)
- clutter_actor_set_anchor_point (CLUTTER_ACTOR (marker), total_width, total_height + point);
- else
- clutter_actor_set_anchor_point (CLUTTER_ACTOR (marker), 0, total_height + point);
- }
+ {
+ if (priv->alignment == PANGO_ALIGN_RIGHT)
+ clutter_actor_set_anchor_point (CLUTTER_ACTOR (marker), total_width, total_height + point);
+ else
+ clutter_actor_set_anchor_point (CLUTTER_ACTOR (marker), 0, total_height + point);
+ }
else if (priv->image != NULL)
clutter_actor_set_anchor_point (CLUTTER_ACTOR (marker),
clutter_actor_get_width (priv->image) / 2.0 + PADDING,
@@ -758,15 +791,18 @@ draw_marker (ChamplainMarker *marker)
clutter_actor_get_height (priv->text_actor) / 2.0);
}
+
static gboolean
redraw_on_idle (gpointer gobject)
{
ChamplainMarker *marker = CHAMPLAIN_MARKER (gobject);
+
CHAMPLAIN_MARKER_GET_CLASS (gobject)->draw_marker (marker);
marker->priv->redraw_id = 0;
return FALSE;
}
+
/**
* champlain_marker_queue_redraw:
* @marker: a #ChamplainMarker
@@ -786,13 +822,14 @@ champlain_marker_queue_redraw (ChamplainMarker *marker)
if (!priv->redraw_id)
{
priv->redraw_id =
- g_idle_add_full (G_PRIORITY_DEFAULT,
- (GSourceFunc)redraw_on_idle,
- g_object_ref (marker),
- (GDestroyNotify)g_object_unref);
+ g_idle_add_full (G_PRIORITY_DEFAULT,
+ (GSourceFunc) redraw_on_idle,
+ g_object_ref (marker),
+ (GDestroyNotify) g_object_unref);
}
}
+
static void
notify_highlighted (GObject *gobject,
G_GNUC_UNUSED GParamSpec *pspec,
@@ -801,6 +838,7 @@ notify_highlighted (GObject *gobject,
champlain_marker_queue_redraw (CHAMPLAIN_MARKER (gobject));
}
+
static void
champlain_marker_init (ChamplainMarker *marker)
{
@@ -829,6 +867,7 @@ champlain_marker_init (ChamplainMarker *marker)
g_signal_connect (marker, "notify::highlighted", G_CALLBACK (notify_highlighted), NULL);
}
+
/**
* champlain_marker_new:
*
@@ -844,6 +883,7 @@ champlain_marker_new (void)
return CLUTTER_ACTOR (g_object_new (CHAMPLAIN_TYPE_MARKER, NULL));
}
+
/**
* champlain_marker_new_with_text:
* @text: the text of the text
@@ -879,6 +919,7 @@ champlain_marker_new_with_text (const gchar *text,
return CLUTTER_ACTOR (marker);
}
+
/**
* champlain_marker_new_with_image:
* @actor: The actor of the image.
@@ -894,6 +935,7 @@ ClutterActor *
champlain_marker_new_with_image (ClutterActor *actor)
{
ChamplainMarker *marker = CHAMPLAIN_MARKER (champlain_marker_new ());
+
if (actor != NULL)
{
champlain_marker_set_image (marker, actor);
@@ -902,6 +944,7 @@ champlain_marker_new_with_image (ClutterActor *actor)
return CLUTTER_ACTOR (marker);
}
+
/**
* champlain_marker_new_from_file:
* @filename: The filename of the image.
@@ -932,6 +975,7 @@ champlain_marker_new_from_file (const gchar *filename,
return CLUTTER_ACTOR (marker);
}
+
/**
* champlain_marker_new_full:
* @text: The text
@@ -949,6 +993,7 @@ champlain_marker_new_full (const gchar *text,
ClutterActor *actor)
{
ChamplainMarker *marker = CHAMPLAIN_MARKER (champlain_marker_new ());
+
if (actor != NULL)
{
champlain_marker_set_image (marker, actor);
@@ -958,6 +1003,7 @@ champlain_marker_new_full (const gchar *text,
return CLUTTER_ACTOR (marker);
}
+
/**
* champlain_marker_set_text:
* @marker: The marker
@@ -982,6 +1028,7 @@ champlain_marker_set_text (ChamplainMarker *marker,
champlain_marker_queue_redraw (marker);
}
+
/**
* champlain_marker_set_image:
* @marker: The marker.
@@ -1014,6 +1061,7 @@ champlain_marker_set_image (ChamplainMarker *marker,
champlain_marker_queue_redraw (marker);
}
+
/**
* champlain_marker_set_use_markup:
* @marker: The marker
@@ -1034,6 +1082,7 @@ champlain_marker_set_use_markup (ChamplainMarker *marker,
champlain_marker_queue_redraw (marker);
}
+
/**
* champlain_marker_set_alignment:
* @marker: The marker
@@ -1054,6 +1103,7 @@ champlain_marker_set_alignment (ChamplainMarker *marker,
champlain_marker_queue_redraw (marker);
}
+
/**
* champlain_marker_set_color:
* @marker: The marker
@@ -1083,6 +1133,7 @@ champlain_marker_set_color (ChamplainMarker *marker,
champlain_marker_queue_redraw (marker);
}
+
/**
* champlain_marker_set_text_color:
* @marker: The marker
@@ -1112,6 +1163,7 @@ champlain_marker_set_text_color (ChamplainMarker *marker,
champlain_marker_queue_redraw (marker);
}
+
/**
* champlain_marker_set_font_name:
* @marker: The marker
@@ -1141,6 +1193,7 @@ champlain_marker_set_font_name (ChamplainMarker *marker,
champlain_marker_queue_redraw (marker);
}
+
/**
* champlain_marker_set_wrap:
* @marker: The marker
@@ -1161,6 +1214,7 @@ champlain_marker_set_wrap (ChamplainMarker *marker,
champlain_marker_queue_redraw (marker);
}
+
/**
* champlain_marker_set_wrap_mode:
* @marker: The marker
@@ -1181,6 +1235,7 @@ champlain_marker_set_wrap_mode (ChamplainMarker *marker,
champlain_marker_queue_redraw (marker);
}
+
/**
* champlain_marker_set_attributes:
* @marker: The marker
@@ -1210,6 +1265,7 @@ champlain_marker_set_attributes (ChamplainMarker *marker,
champlain_marker_queue_redraw (marker);
}
+
/**
* champlain_marker_set_ellipsize:
* @marker: The marker
@@ -1229,6 +1285,8 @@ champlain_marker_set_ellipsize (ChamplainMarker *marker,
g_object_notify (G_OBJECT (marker), "ellipsize");
champlain_marker_queue_redraw (marker);
}
+
+
/**
* champlain_marker_set_single_line_mode:
* @marker: The marker
@@ -1250,6 +1308,7 @@ champlain_marker_set_single_line_mode (ChamplainMarker *marker,
champlain_marker_queue_redraw (marker);
}
+
/**
* champlain_marker_set_draw_background:
* @marker: The marker
@@ -1270,6 +1329,7 @@ champlain_marker_set_draw_background (ChamplainMarker *marker,
champlain_marker_queue_redraw (marker);
}
+
/**
* champlain_marker_get_image:
* @marker: The marker
@@ -1288,6 +1348,7 @@ champlain_marker_get_image (ChamplainMarker *marker)
return marker->priv->image;
}
+
/**
* champlain_marker_get_use_markup:
* @marker: The marker
@@ -1306,6 +1367,7 @@ champlain_marker_get_use_markup (ChamplainMarker *marker)
return marker->priv->use_markup;
}
+
/**
* champlain_marker_get_text:
* @marker: The marker
@@ -1324,6 +1386,7 @@ champlain_marker_get_text (ChamplainMarker *marker)
return marker->priv->text;
}
+
/**
* champlain_marker_get_alignment:
* @marker: The marker
@@ -1342,6 +1405,7 @@ champlain_marker_get_alignment (ChamplainMarker *marker)
return marker->priv->alignment;
}
+
/**
* champlain_marker_get_color:
* @marker: The marker
@@ -1360,6 +1424,7 @@ champlain_marker_get_color (ChamplainMarker *marker)
return marker->priv->color;
}
+
/**
* champlain_marker_get_text_color:
* @marker: The marker
@@ -1378,6 +1443,7 @@ champlain_marker_get_text_color (ChamplainMarker *marker)
return marker->priv->text_color;
}
+
/**
* champlain_marker_get_font_name:
* @marker: The marker
@@ -1396,6 +1462,7 @@ champlain_marker_get_font_name (ChamplainMarker *marker)
return marker->priv->font_name;
}
+
/**
* champlain_marker_get_wrap:
* @marker: The marker
@@ -1414,6 +1481,7 @@ champlain_marker_get_wrap (ChamplainMarker *marker)
return marker->priv->wrap;
}
+
/**
* champlain_marker_get_wrap_mode:
* @marker: The marker
@@ -1432,6 +1500,7 @@ champlain_marker_get_wrap_mode (ChamplainMarker *marker)
return marker->priv->wrap_mode;
}
+
/**
* champlain_marker_get_ellipsize:
* @marker: The marker
@@ -1450,6 +1519,7 @@ champlain_marker_get_ellipsize (ChamplainMarker *marker)
return marker->priv->ellipsize;
}
+
/**
* champlain_marker_get_single_line_mode:
* @marker: The marker
@@ -1468,6 +1538,7 @@ champlain_marker_get_single_line_mode (ChamplainMarker *marker)
return marker->priv->single_line_mode;
}
+
/**
* champlain_marker_get_draw_background:
* @marker: The marker
@@ -1485,4 +1556,3 @@ champlain_marker_get_draw_background (ChamplainMarker *marker)
return marker->priv->draw_background;
}
-
diff --git a/champlain/champlain-marker.h b/champlain/champlain-marker.h
index 6a87b71..6aa5d00 100644
--- a/champlain/champlain-marker.h
+++ b/champlain/champlain-marker.h
@@ -30,22 +30,22 @@
G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_MARKER champlain_marker_get_type()
+#define CHAMPLAIN_TYPE_MARKER champlain_marker_get_type ()
#define CHAMPLAIN_MARKER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), CHAMPLAIN_TYPE_MARKER, ChamplainMarker))
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_MARKER, ChamplainMarker))
#define CHAMPLAIN_MARKER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), CHAMPLAIN_TYPE_MARKER, ChamplainMarkerClass))
+ (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_MARKER, ChamplainMarkerClass))
#define CHAMPLAIN_IS_MARKER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), CHAMPLAIN_TYPE_MARKER))
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_MARKER))
#define CHAMPLAIN_IS_MARKER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), CHAMPLAIN_TYPE_MARKER))
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_MARKER))
#define CHAMPLAIN_MARKER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), CHAMPLAIN_TYPE_MARKER, ChamplainMarkerClass))
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_MARKER, ChamplainMarkerClass))
typedef struct _ChamplainMarkerPrivate ChamplainMarkerPrivate;
@@ -63,7 +63,7 @@ struct _ChamplainMarkerClass
{
ChamplainBaseMarkerClass parent_class;
- void (* draw_marker) (ChamplainMarker *marker);
+ void (*draw_marker)(ChamplainMarker *marker);
};
GType champlain_marker_get_type (void);
@@ -71,7 +71,9 @@ GType champlain_marker_get_type (void);
ClutterActor *champlain_marker_new (void);
ClutterActor *champlain_marker_new_with_text (const gchar *text,
- const gchar *font, ClutterColor *text_color, ClutterColor *marker_color);
+ const gchar *font,
+ ClutterColor *text_color,
+ ClutterColor *marker_color);
ClutterActor *champlain_marker_new_with_image (ClutterActor *actor);
@@ -109,12 +111,12 @@ void champlain_marker_set_draw_background (ChamplainMarker *marker,
gboolean background);
gboolean champlain_marker_get_use_markup (ChamplainMarker *marker);
-const gchar * champlain_marker_get_text (ChamplainMarker *marker);
-ClutterActor * champlain_marker_get_image (ChamplainMarker *marker);
+const gchar *champlain_marker_get_text (ChamplainMarker *marker);
+ClutterActor *champlain_marker_get_image (ChamplainMarker *marker);
PangoAlignment champlain_marker_get_alignment (ChamplainMarker *marker);
-ClutterColor * champlain_marker_get_color (ChamplainMarker *marker);
-ClutterColor * champlain_marker_get_text_color (ChamplainMarker *marker);
-const gchar * champlain_marker_get_font_name (ChamplainMarker *marker);
+ClutterColor *champlain_marker_get_color (ChamplainMarker *marker);
+ClutterColor *champlain_marker_get_text_color (ChamplainMarker *marker);
+const gchar *champlain_marker_get_font_name (ChamplainMarker *marker);
gboolean champlain_marker_get_wrap (ChamplainMarker *marker);
PangoWrapMode champlain_marker_get_wrap_mode (ChamplainMarker *marker);
PangoEllipsizeMode champlain_marker_get_ellipsize (ChamplainMarker *marker);
@@ -122,10 +124,10 @@ gboolean champlain_marker_get_single_line_mode (ChamplainMarker *marker);
gboolean champlain_marker_get_draw_background (ChamplainMarker *marker);
void champlain_marker_set_highlight_color (ClutterColor *color);
-const ClutterColor * champlain_marker_get_highlight_color (void);
+const ClutterColor *champlain_marker_get_highlight_color (void);
void champlain_marker_set_highlight_text_color (ClutterColor *color);
-const ClutterColor * champlain_marker_get_highlight_text_color (void);
+const ClutterColor *champlain_marker_get_highlight_text_color (void);
void champlain_marker_queue_redraw (ChamplainMarker *marker);
diff --git a/champlain/champlain-memory-cache.h b/champlain/champlain-memory-cache.h
index 0a2e141..1f9f576 100644
--- a/champlain/champlain-memory-cache.h
+++ b/champlain/champlain-memory-cache.h
@@ -64,7 +64,8 @@ struct _ChamplainMemoryCacheClass
GType champlain_memory_cache_get_type (void);
-ChamplainMemoryCache *champlain_memory_cache_new_full (guint size_limit, ChamplainRenderer *renderer);
+ChamplainMemoryCache *champlain_memory_cache_new_full (guint size_limit,
+ ChamplainRenderer *renderer);
guint champlain_memory_cache_get_size_limit (ChamplainMemoryCache *memory_cache);
void champlain_memory_cache_set_size_limit (ChamplainMemoryCache *memory_cache,
diff --git a/champlain/champlain-memphis-renderer.c b/champlain/champlain-memphis-renderer.c
index d7dce19..2c6a69f 100644
--- a/champlain/champlain-memphis-renderer.c
+++ b/champlain/champlain-memphis-renderer.c
@@ -60,9 +60,9 @@
const gchar default_rules[] =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
"<rules version=\"0.1\" background=\"#ffffff\">"
- "<rule e=\"way\" k=\"highway\" v=\"*\">"
- "<line color=\"#000000\" width=\"1.0\"/>"
- "</rule>"
+ "<rule e=\"way\" k=\"highway\" v=\"*\">"
+ "<line color=\"#000000\" width=\"1.0\"/>"
+ "</rule>"
"</rules>";
enum
@@ -72,9 +72,13 @@ enum
PROP_BOUNDING_BOX
};
-static void render (ChamplainRenderer *renderer, ChamplainTile *tile);
-static void set_data (ChamplainRenderer *renderer, const gchar *data, guint size);
-static void set_bounding_box (ChamplainMemphisRenderer *renderer, ChamplainBoundingBox *bbox);
+static void render (ChamplainRenderer *renderer,
+ ChamplainTile *tile);
+static void set_data (ChamplainRenderer *renderer,
+ const gchar *data,
+ guint size);
+static void set_bounding_box (ChamplainMemphisRenderer *renderer,
+ ChamplainBoundingBox *bbox);
G_DEFINE_TYPE (ChamplainMemphisRenderer, champlain_memphis_renderer, CHAMPLAIN_TYPE_RENDERER)
@@ -109,9 +113,9 @@ struct _WorkerThreadData
GStaticRWLock MemphisLock = G_STATIC_RW_LOCK_INIT;
-static void memphis_worker_thread (gpointer data, gpointer user_data);
-void argb_to_rgba (guchar *data,
- guint size);
+static void memphis_worker_thread (gpointer data,
+ gpointer user_data);
+
static void
champlain_memphis_renderer_get_property (GObject *object,
@@ -123,17 +127,20 @@ champlain_memphis_renderer_get_property (GObject *object,
switch (property_id)
{
- case PROP_TILE_SIZE:
- g_value_set_uint (value, champlain_memphis_renderer_get_tile_size (renderer));
- break;
- case PROP_BOUNDING_BOX:
- g_value_set_boxed (value, champlain_memphis_renderer_get_bounding_box (renderer));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ case PROP_TILE_SIZE:
+ g_value_set_uint (value, champlain_memphis_renderer_get_tile_size (renderer));
+ break;
+
+ case PROP_BOUNDING_BOX:
+ g_value_set_boxed (value, champlain_memphis_renderer_get_bounding_box (renderer));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
+
static void
champlain_memphis_renderer_set_property (GObject *object,
guint property_id,
@@ -144,21 +151,24 @@ champlain_memphis_renderer_set_property (GObject *object,
switch (property_id)
{
- case PROP_TILE_SIZE:
- champlain_memphis_renderer_set_tile_size (renderer, g_value_get_uint (value));
- break;
- case PROP_BOUNDING_BOX:
- set_bounding_box (renderer, g_value_get_boxed (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ case PROP_TILE_SIZE:
+ champlain_memphis_renderer_set_tile_size (renderer, g_value_get_uint (value));
+ break;
+
+ case PROP_BOUNDING_BOX:
+ set_bounding_box (renderer, g_value_get_boxed (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
+
static void
champlain_memphis_renderer_dispose (GObject *object)
{
- ChamplainMemphisRenderer *renderer = CHAMPLAIN_MEMPHIS_RENDERER(object);
+ ChamplainMemphisRenderer *renderer = CHAMPLAIN_MEMPHIS_RENDERER (object);
ChamplainMemphisRendererPrivate *priv = renderer->priv;
if (priv->thpool)
@@ -180,10 +190,11 @@ champlain_memphis_renderer_dispose (GObject *object)
G_OBJECT_CLASS (champlain_memphis_renderer_parent_class)->dispose (object);
}
+
static void
champlain_memphis_renderer_finalize (GObject *object)
{
- ChamplainMemphisRenderer *renderer = CHAMPLAIN_MEMPHIS_RENDERER(object);
+ ChamplainMemphisRenderer *renderer = CHAMPLAIN_MEMPHIS_RENDERER (object);
ChamplainMemphisRendererPrivate *priv = renderer->priv;
champlain_bounding_box_free (priv->bbox);
@@ -219,26 +230,26 @@ champlain_memphis_renderer_class_init (ChamplainMemphisRendererClass *klass)
G_PARAM_READWRITE));
/*
- * ChamplainMapDataSource:bounding-box:
- *
- * The bounding box of the area that contains map data.
- *
- * Since: 0.6
- */
+ * ChamplainMapDataSource:bounding-box:
+ *
+ * The bounding box of the area that contains map data.
+ *
+ * Since: 0.6
+ */
g_object_class_install_property (object_class,
PROP_BOUNDING_BOX,
g_param_spec_boxed ("bounding-box",
- "Bounding Box",
- "The bounding box of the renderer",
- CHAMPLAIN_TYPE_BOUNDING_BOX,
- G_PARAM_READWRITE));
-
+ "Bounding Box",
+ "The bounding box of the renderer",
+ CHAMPLAIN_TYPE_BOUNDING_BOX,
+ G_PARAM_READWRITE));
}
+
static void
champlain_memphis_renderer_init (ChamplainMemphisRenderer *renderer)
{
- ChamplainMemphisRendererPrivate *priv = GET_PRIVATE(renderer);
+ ChamplainMemphisRendererPrivate *priv = GET_PRIVATE (renderer);
renderer->priv = priv;
@@ -254,43 +265,48 @@ champlain_memphis_renderer_init (ChamplainMemphisRenderer *renderer)
priv->bbox = NULL;
}
-ChamplainMemphisRenderer* champlain_memphis_renderer_new_full (guint tile_size)
+
+ChamplainMemphisRenderer *
+champlain_memphis_renderer_new_full (guint tile_size)
{
return g_object_new (CHAMPLAIN_TYPE_MEMPHIS_RENDERER, "tile-size", tile_size, NULL);
}
/*
-Transform ARGB (Cairo) to RGBA (GdkPixbuf). RGBA is actualy reversed in
-memory, so the transformation is ARGB -> ABGR (i.e. swapping B and R)
-*/
-void argb_to_rgba (guchar *data,
+ * Transform ARGB (Cairo) to RGBA (GdkPixbuf). RGBA is actualy reversed in
+ * memory, so the transformation is ARGB -> ABGR (i.e. swapping B and R)
+ */
+static void
+argb_to_rgba (guchar *data,
guint size)
{
guint32 *ptr;
- guint32 *endptr = (guint32 *)data + size / 4;
- for (ptr = (guint32 *)data; ptr < endptr; ptr++)
+ guint32 *endptr = (guint32 *) data + size / 4;
+
+ for (ptr = (guint32 *) data; ptr < endptr; ptr++)
*ptr = (*ptr & 0xFF00FF00) ^ ((*ptr & 0xFF0000) >> 16) ^ ((*ptr & 0xFF) << 16);
}
+
static gboolean
tile_loaded_cb (gpointer worker_data)
{
WorkerThreadData *data = (WorkerThreadData *) worker_data;
ChamplainTile *tile = data->tile;
cairo_surface_t *cst = data->cst;
- ChamplainRenderer *renderer = CHAMPLAIN_RENDERER(data->renderer);
+ ChamplainRenderer *renderer = CHAMPLAIN_RENDERER (data->renderer);
ChamplainRenderCallbackData callback_data;
cairo_t *cr_clutter;
ClutterActor *actor;
guint size = data->size;
GError *error = NULL;
- GdkPixbuf * pixbuf = NULL;
+ GdkPixbuf *pixbuf = NULL;
gchar *buffer = NULL;
gsize buffer_size;
if (tile)
- g_object_remove_weak_pointer (G_OBJECT (tile), (gpointer*)&data->tile);
+ g_object_remove_weak_pointer (G_OBJECT (tile), (gpointer *) &data->tile);
g_free (data);
@@ -317,8 +333,8 @@ tile_loaded_cb (gpointer worker_data)
cairo_image_surface_get_stride (cst) * cairo_image_surface_get_height (cst));
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (cst),
- GDK_COLORSPACE_RGB, TRUE, 8, size, size,
- cairo_image_surface_get_stride (cst), NULL, NULL);
+ GDK_COLORSPACE_RGB, TRUE, 8, size, size,
+ cairo_image_surface_get_stride (cst), NULL, NULL);
if (!gdk_pixbuf_save_to_buffer (pixbuf, &buffer, &buffer_size, "png", &error, NULL))
goto error;
@@ -348,20 +364,21 @@ finish:
return FALSE;
}
+
static void
memphis_worker_thread (gpointer worker_data,
G_GNUC_UNUSED gpointer user_data)
{
- WorkerThreadData *data = (WorkerThreadData *)worker_data;
+ WorkerThreadData *data = (WorkerThreadData *) worker_data;
ChamplainMemphisRenderer *renderer = CHAMPLAIN_MEMPHIS_RENDERER (data->renderer);
gboolean has_data = TRUE;
data->cst = NULL;
-// uncomment when libmemphis works correctly
-// g_static_rw_lock_reader_lock (&MemphisLock);
-// has_data = memphis_renderer_tile_has_data (renderer->priv->renderer, data->x, data->y, data->z);
-// g_static_rw_lock_reader_unlock (&MemphisLock);
+/* uncomment when libmemphis works correctly */
+/* g_static_rw_lock_reader_lock (&MemphisLock);
+ * has_data = memphis_renderer_tile_has_data (renderer->priv->renderer, data->x, data->y, data->z);
+ * g_static_rw_lock_reader_unlock (&MemphisLock); */
if (has_data)
{
@@ -383,9 +400,10 @@ memphis_worker_thread (gpointer worker_data,
clutter_threads_add_idle_full (G_PRIORITY_DEFAULT, tile_loaded_cb, data, NULL);
}
+
static void
render (ChamplainRenderer *renderer,
- ChamplainTile *tile)
+ ChamplainTile *tile)
{
g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_RENDERER (renderer));
@@ -394,8 +412,8 @@ render (ChamplainRenderer *renderer,
WorkerThreadData *data;
DEBUG ("Render tile (%u, %u, %u)", champlain_tile_get_x (tile),
- champlain_tile_get_y (tile),
- champlain_tile_get_zoom_level (tile));
+ champlain_tile_get_y (tile),
+ champlain_tile_get_zoom_level (tile));
data = g_new (WorkerThreadData, 1);
data->x = champlain_tile_get_x (tile);
@@ -405,7 +423,7 @@ render (ChamplainRenderer *renderer,
data->tile = tile;
data->renderer = renderer;
- g_object_add_weak_pointer (G_OBJECT (tile), (gpointer*)&data->tile);
+ g_object_add_weak_pointer (G_OBJECT (tile), (gpointer *) &data->tile);
g_object_ref (renderer);
g_thread_pool_push (priv->thpool, data, &error);
@@ -415,10 +433,11 @@ render (ChamplainRenderer *renderer,
g_error_free (error);
g_free (data);
g_object_unref (renderer);
- g_object_remove_weak_pointer (G_OBJECT (tile), (gpointer*)&data->tile);
+ g_object_remove_weak_pointer (G_OBJECT (tile), (gpointer *) &data->tile);
}
}
+
static void
set_data (ChamplainRenderer *renderer,
const gchar *data,
@@ -429,6 +448,7 @@ set_data (ChamplainRenderer *renderer,
GError *err = NULL;
MemphisMap *map = memphis_map_new ();
+
memphis_map_load_from_data (map, data, size, &err);
DEBUG ("BBox data received");
@@ -456,6 +476,7 @@ set_data (ChamplainRenderer *renderer,
"reload-tiles", NULL);
}
+
/*
* champlain_memphis_renderer_load_rules:
* @renderer: a #ChamplainMemphisRenderer
@@ -475,7 +496,7 @@ champlain_memphis_renderer_load_rules (
ChamplainMemphisRendererPrivate *priv = renderer->priv;
GError *err = NULL;
- // TODO: Remove test when memphis handles invalid paths properly
+ /* TODO: Remove test when memphis handles invalid paths properly */
if (!g_file_test (rules_path, G_FILE_TEST_EXISTS))
{
g_critical ("Error: \"%s\" does not exist.", rules_path);
@@ -487,18 +508,18 @@ champlain_memphis_renderer_load_rules (
{
memphis_rule_set_load_from_file (priv->rules, rules_path, &err);
if (err != NULL)
- {
+ {
g_critical ("Can't load rules file: \"%s\"", err->message);
memphis_rule_set_load_from_data (priv->rules, default_rules,
- strlen (default_rules), NULL);
+ strlen (default_rules), NULL);
g_static_rw_lock_writer_unlock (&MemphisLock);
g_error_free (err);
return;
- }
+ }
}
else
memphis_rule_set_load_from_data (priv->rules, default_rules,
- strlen (default_rules), NULL);
+ strlen (default_rules), NULL);
g_static_rw_lock_writer_unlock (&MemphisLock);
@@ -538,6 +559,7 @@ champlain_memphis_renderer_get_background_color (
return clutter_color_copy (&color);
}
+
/*
* champlain_memphis_renderer_set_background_color:
* @renderer: a #ChamplainMemphisRenderer
@@ -556,7 +578,7 @@ champlain_memphis_renderer_set_background_color (
g_static_rw_lock_writer_lock (&MemphisLock);
memphis_rule_set_set_bg_color (renderer->priv->rules, color->red,
- color->green, color->blue, color->alpha);
+ color->green, color->blue, color->alpha);
g_static_rw_lock_writer_unlock (&MemphisLock);
g_signal_emit_by_name (CHAMPLAIN_RENDERER (renderer),
@@ -579,16 +601,17 @@ champlain_memphis_renderer_set_rule (ChamplainMemphisRenderer *renderer,
ChamplainMemphisRule *rule)
{
g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_RENDERER (renderer) &&
- MEMPHIS_RULE (rule));
+ MEMPHIS_RULE (rule));
g_static_rw_lock_writer_lock (&MemphisLock);
- memphis_rule_set_set_rule (renderer->priv->rules, (MemphisRule *)rule);
+ memphis_rule_set_set_rule (renderer->priv->rules, (MemphisRule *) rule);
g_static_rw_lock_writer_unlock (&MemphisLock);
g_signal_emit_by_name (CHAMPLAIN_RENDERER (renderer),
"reload-tiles", NULL);
}
+
/*
* champlain_memphis_renderer_get_rule:
* @renderer: a #ChamplainMemphisRenderer
@@ -605,7 +628,7 @@ champlain_memphis_renderer_get_rule (ChamplainMemphisRenderer *renderer,
const gchar *id)
{
g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_RENDERER (renderer) &&
- id != NULL, NULL);
+ id != NULL, NULL);
MemphisRule *rule;
@@ -616,6 +639,7 @@ champlain_memphis_renderer_get_rule (ChamplainMemphisRenderer *renderer,
return (ChamplainMemphisRule *) rule;
}
+
/*
* champlain_memphis_renderer_get_rule_ids:
* @renderer: a #ChamplainMemphisRenderer
@@ -643,6 +667,7 @@ champlain_memphis_renderer_get_rule_ids (ChamplainMemphisRenderer *renderer)
return list;
}
+
/*
* champlain_memphis_renderer_remove_rule:
* @renderer: a #ChamplainMemphisRenderer
@@ -652,7 +677,8 @@ champlain_memphis_renderer_get_rule_ids (ChamplainMemphisRenderer *renderer)
*
* Since: 0.6
*/
-void champlain_memphis_renderer_remove_rule (
+void
+champlain_memphis_renderer_remove_rule (
ChamplainMemphisRenderer *renderer,
const gchar *id)
{
@@ -666,6 +692,7 @@ void champlain_memphis_renderer_remove_rule (
"reload-tiles", NULL);
}
+
void
champlain_memphis_renderer_set_tile_size (ChamplainMemphisRenderer *renderer,
guint size)
@@ -683,6 +710,7 @@ champlain_memphis_renderer_set_tile_size (ChamplainMemphisRenderer *renderer,
g_object_notify (G_OBJECT (renderer), "tile-size");
}
+
guint
champlain_memphis_renderer_get_tile_size (ChamplainMemphisRenderer *renderer)
{
@@ -691,6 +719,7 @@ champlain_memphis_renderer_get_tile_size (ChamplainMemphisRenderer *renderer)
return renderer->priv->tile_size;
}
+
ChamplainBoundingBox *
champlain_memphis_renderer_get_bounding_box (ChamplainMemphisRenderer *renderer)
{
@@ -701,6 +730,7 @@ champlain_memphis_renderer_get_bounding_box (ChamplainMemphisRenderer *renderer)
return priv->bbox;
}
+
static void
set_bounding_box (ChamplainMemphisRenderer *renderer, ChamplainBoundingBox *bbox)
{
@@ -711,5 +741,3 @@ set_bounding_box (ChamplainMemphisRenderer *renderer, ChamplainBoundingBox *bbox
champlain_bounding_box_free (priv->bbox);
priv->bbox = champlain_bounding_box_copy (bbox);
}
-
-
diff --git a/champlain/champlain-memphis-renderer.h b/champlain/champlain-memphis-renderer.h
index 59c8c90..614fb76 100644
--- a/champlain/champlain-memphis-renderer.h
+++ b/champlain/champlain-memphis-renderer.h
@@ -31,7 +31,7 @@
G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_MEMPHIS_RENDERER champlain_memphis_renderer_get_type()
+#define CHAMPLAIN_TYPE_MEMPHIS_RENDERER champlain_memphis_renderer_get_type ()
#define CHAMPLAIN_MEMPHIS_RENDERER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_MEMPHIS_RENDERER, ChamplainMemphisRenderer))
@@ -50,13 +50,15 @@ G_BEGIN_DECLS
typedef struct _ChamplainMemphisRendererPrivate ChamplainMemphisRendererPrivate;
-typedef struct {
+typedef struct
+{
ChamplainRenderer parent;
ChamplainMemphisRendererPrivate *priv;
} ChamplainMemphisRenderer;
-typedef struct {
+typedef struct
+{
ChamplainRendererClass parent_class;
} ChamplainMemphisRendererClass;
@@ -64,7 +66,8 @@ typedef struct {
typedef struct _ChamplainMemphisRule ChamplainMemphisRule;
typedef struct _ChamplainMemphisRuleAttr ChamplainMemphisRuleAttr;
-struct _ChamplainMemphisRuleAttr {
+struct _ChamplainMemphisRuleAttr
+{
guint8 z_min;
guint8 z_max;
guint8 color_red;
@@ -75,14 +78,16 @@ struct _ChamplainMemphisRuleAttr {
gdouble size;
};
-typedef enum {
+typedef enum
+{
CHAMPLAIN_MEMPHIS_RULE_TYPE_UNKNOWN,
CHAMPLAIN_MEMPHIS_RULE_TYPE_NODE,
CHAMPLAIN_MEMPHIS_RULE_TYPE_WAY,
CHAMPLAIN_MEMPHIS_RULE_TYPE_RELATION
} ChamplainMemphisRuleType;
-struct _ChamplainMemphisRule {
+struct _ChamplainMemphisRule
+{
gchar **keys;
gchar **values;
ChamplainMemphisRuleType type;
@@ -94,27 +99,27 @@ struct _ChamplainMemphisRule {
GType champlain_memphis_renderer_get_type (void);
-ChamplainMemphisRenderer* champlain_memphis_renderer_new_full (guint tile_size);
+ChamplainMemphisRenderer *champlain_memphis_renderer_new_full (guint tile_size);
void champlain_memphis_renderer_load_rules (
ChamplainMemphisRenderer *renderer,
const gchar *rules_path);
-ClutterColor * champlain_memphis_renderer_get_background_color (
+ClutterColor *champlain_memphis_renderer_get_background_color (
ChamplainMemphisRenderer *renderer);
void champlain_memphis_renderer_set_background_color (
ChamplainMemphisRenderer *renderer,
const ClutterColor *color);
-GList * champlain_memphis_renderer_get_rule_ids (
+GList *champlain_memphis_renderer_get_rule_ids (
ChamplainMemphisRenderer *renderer);
void champlain_memphis_renderer_set_rule (
ChamplainMemphisRenderer *renderer,
ChamplainMemphisRule *rule);
-ChamplainMemphisRule * champlain_memphis_renderer_get_rule (
+ChamplainMemphisRule *champlain_memphis_renderer_get_rule (
ChamplainMemphisRenderer *renderer,
const gchar *id);
@@ -124,12 +129,10 @@ void champlain_memphis_renderer_remove_rule (
ChamplainBoundingBox *champlain_memphis_renderer_get_bounding_box (ChamplainMemphisRenderer *renderer);
-void
-champlain_memphis_renderer_set_tile_size (ChamplainMemphisRenderer *self,
+void champlain_memphis_renderer_set_tile_size (ChamplainMemphisRenderer *self,
guint size);
-guint
-champlain_memphis_renderer_get_tile_size (ChamplainMemphisRenderer *self);
+guint champlain_memphis_renderer_get_tile_size (ChamplainMemphisRenderer *self);
#undef __CHAMPLAIN_CHAMPLAIN_H_INSIDE__
diff --git a/champlain/champlain-network-bbox-tile-source.c b/champlain/champlain-network-bbox-tile-source.c
index ab6dd8c..7371de4 100644
--- a/champlain/champlain-network-bbox-tile-source.c
+++ b/champlain/champlain-network-bbox-tile-source.c
@@ -63,10 +63,11 @@ enum
PROP_PROXY_URI
};
-struct _ChamplainNetworkBboxTileSourcePrivate {
+struct _ChamplainNetworkBboxTileSourcePrivate
+{
gchar *api_uri;
gchar *proxy_uri;
- SoupSession * soup_session;
+ SoupSession *soup_session;
};
static guint champlain_network_bbox_tile_source_signals[LAST_SIGNAL] = { 0, };
@@ -82,23 +83,26 @@ champlain_network_bbox_tile_source_get_property (GObject *object,
GParamSpec *pspec)
{
ChamplainNetworkBboxTileSource *self =
- CHAMPLAIN_NETWORK_BBOX_TILE_SOURCE (object);
+ CHAMPLAIN_NETWORK_BBOX_TILE_SOURCE (object);
ChamplainNetworkBboxTileSourcePrivate *priv = self->priv;
switch (property_id)
{
- case PROP_API_URI:
- g_value_set_string (value,
- champlain_network_bbox_tile_source_get_api_uri (self));
- break;
- case PROP_PROXY_URI:
- g_value_set_string (value, priv->proxy_uri);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ case PROP_API_URI:
+ g_value_set_string (value,
+ champlain_network_bbox_tile_source_get_api_uri (self));
+ break;
+
+ case PROP_PROXY_URI:
+ g_value_set_string (value, priv->proxy_uri);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
+
static void
champlain_network_bbox_tile_source_set_property (GObject *object,
guint property_id,
@@ -106,33 +110,36 @@ champlain_network_bbox_tile_source_set_property (GObject *object,
GParamSpec *pspec)
{
ChamplainNetworkBboxTileSource *self =
- CHAMPLAIN_NETWORK_BBOX_TILE_SOURCE (object);
+ CHAMPLAIN_NETWORK_BBOX_TILE_SOURCE (object);
ChamplainNetworkBboxTileSourcePrivate *priv = self->priv;
switch (property_id)
{
- case PROP_API_URI:
- champlain_network_bbox_tile_source_set_api_uri (self,
- g_value_get_string (value));
- break;
- case PROP_PROXY_URI:
- g_free (priv->proxy_uri);
-
- priv->proxy_uri = g_value_dup_string (value);
- if (priv->soup_session)
- g_object_set (G_OBJECT (priv->soup_session), "proxy-uri",
- soup_uri_new (priv->proxy_uri), NULL);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ case PROP_API_URI:
+ champlain_network_bbox_tile_source_set_api_uri (self,
+ g_value_get_string (value));
+ break;
+
+ case PROP_PROXY_URI:
+ g_free (priv->proxy_uri);
+
+ priv->proxy_uri = g_value_dup_string (value);
+ if (priv->soup_session)
+ g_object_set (G_OBJECT (priv->soup_session), "proxy-uri",
+ soup_uri_new (priv->proxy_uri), NULL);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
+
static void
champlain_network_bbox_tile_source_dispose (GObject *object)
{
ChamplainNetworkBboxTileSource *self =
- CHAMPLAIN_NETWORK_BBOX_TILE_SOURCE (object);
+ CHAMPLAIN_NETWORK_BBOX_TILE_SOURCE (object);
ChamplainNetworkBboxTileSourcePrivate *priv = self->priv;
if (priv->soup_session != NULL)
@@ -144,11 +151,12 @@ champlain_network_bbox_tile_source_dispose (GObject *object)
G_OBJECT_CLASS (champlain_network_bbox_tile_source_parent_class)->dispose (object);
}
+
static void
champlain_network_bbox_tile_source_finalize (GObject *object)
{
ChamplainNetworkBboxTileSource *self =
- CHAMPLAIN_NETWORK_BBOX_TILE_SOURCE (object);
+ CHAMPLAIN_NETWORK_BBOX_TILE_SOURCE (object);
ChamplainNetworkBboxTileSourcePrivate *priv = self->priv;
g_free (priv->api_uri);
@@ -157,6 +165,7 @@ champlain_network_bbox_tile_source_finalize (GObject *object)
G_OBJECT_CLASS (champlain_network_bbox_tile_source_parent_class)->finalize (object);
}
+
static void
champlain_network_bbox_tile_source_class_init (ChamplainNetworkBboxTileSourceClass *klass)
{
@@ -173,42 +182,43 @@ champlain_network_bbox_tile_source_class_init (ChamplainNetworkBboxTileSourceCla
map_source_class->fill_tile = fill_tile;
/*
- * ChamplainNetworkBboxTileSource:api-uri:
- *
- * The URI of an OpenStreetMap API server
- *
- * Since: 0.6
- */
+ * ChamplainNetworkBboxTileSource:api-uri:
+ *
+ * The URI of an OpenStreetMap API server
+ *
+ * Since: 0.6
+ */
g_object_class_install_property (object_class,
PROP_API_URI,
g_param_spec_string ("api_uri",
- "API URI",
- "The API URI of an OpenStreetMap server",
- "http://www.informationfreeway.org/api/0.6",
- G_PARAM_READWRITE));
+ "API URI",
+ "The API URI of an OpenStreetMap server",
+ "http://www.informationfreeway.org/api/0.6",
+ G_PARAM_READWRITE));
/*
- * ChamplainNetworkBboxTileSource:proxy-uri:
- *
- * The proxy URI to use to access network
- *
- * Since: 0.6
- */
+ * ChamplainNetworkBboxTileSource:proxy-uri:
+ *
+ * The proxy URI to use to access network
+ *
+ * Since: 0.6
+ */
g_object_class_install_property (object_class,
PROP_PROXY_URI,
g_param_spec_string ("proxy-uri",
- "Proxy URI",
- "The proxy URI to use to access network",
- "",
- G_PARAM_READWRITE));
+ "Proxy URI",
+ "The proxy URI to use to access network",
+ "",
+ G_PARAM_READWRITE));
champlain_network_bbox_tile_source_signals[DATA_LOADED] =
g_signal_new ("data-loaded", G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID, G_TYPE_NONE,
- 0, NULL);
+ G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE,
+ 0, NULL);
}
+
static void
champlain_network_bbox_tile_source_init (ChamplainNetworkBboxTileSource *self)
{
@@ -225,11 +235,12 @@ champlain_network_bbox_tile_source_init (ChamplainNetworkBboxTileSource *self)
SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_GNOME,
#endif
NULL);
- g_object_set (G_OBJECT (priv->soup_session),
- "user-agent", "libchamplain/" CHAMPLAIN_VERSION_S,
- "max-conns-per-host", 2, NULL);
+ g_object_set (G_OBJECT (priv->soup_session),
+ "user-agent", "libchamplain/" CHAMPLAIN_VERSION_S,
+ "max-conns-per-host", 2, NULL);
}
+
/*
* champlain_network_bbox_tile_source_new:
*
@@ -240,7 +251,7 @@ champlain_network_bbox_tile_source_init (ChamplainNetworkBboxTileSource *self)
* Since: 0.6
*/
-ChamplainNetworkBboxTileSource*
+ChamplainNetworkBboxTileSource *
champlain_network_bbox_tile_source_new_full (const gchar *id,
const gchar *name,
const gchar *license,
@@ -251,7 +262,8 @@ champlain_network_bbox_tile_source_new_full (const gchar *id,
ChamplainMapProjection projection,
ChamplainRenderer *renderer)
{
- ChamplainNetworkBboxTileSource * source;
+ ChamplainNetworkBboxTileSource *source;
+
source = g_object_new (CHAMPLAIN_TYPE_NETWORK_BBOX_TILE_SOURCE, "id", id,
"name", name,
"license", license,
@@ -265,12 +277,13 @@ champlain_network_bbox_tile_source_new_full (const gchar *id,
return source;
}
+
static void
load_map_data_cb (G_GNUC_UNUSED SoupSession *session, SoupMessage *msg,
gpointer user_data)
{
ChamplainNetworkBboxTileSource *self =
- CHAMPLAIN_NETWORK_BBOX_TILE_SOURCE (user_data);
+ CHAMPLAIN_NETWORK_BBOX_TILE_SOURCE (user_data);
ChamplainRenderer *renderer;
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code))
@@ -283,10 +296,11 @@ load_map_data_cb (G_GNUC_UNUSED SoupSession *session, SoupMessage *msg,
g_signal_emit_by_name (self, "data-loaded", NULL);
- renderer = champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (self));
+ renderer = champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (self));
champlain_renderer_set_data (renderer, msg->response_body->data, msg->response_body->length);
}
+
/*
* champlain_network_bbox_tile_source_load_map_data:
* @map_data_source: a #ChamplainNetworkBboxTileSource
@@ -334,12 +348,13 @@ champlain_network_bbox_tile_source_load_map_data (
soup_session_queue_message (priv->soup_session, msg, load_map_data_cb, self);
}
+
static void
tile_rendered_cb (ChamplainTile *tile,
ChamplainRenderCallbackData *data,
ChamplainMapSource *map_source)
{
- ChamplainTileSource *tile_source = CHAMPLAIN_TILE_SOURCE(map_source);
+ ChamplainTileSource *tile_source = CHAMPLAIN_TILE_SOURCE (map_source);
ChamplainTileCache *tile_cache = champlain_tile_source_get_cache (tile_source);
ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
@@ -359,6 +374,7 @@ tile_rendered_cb (ChamplainTile *tile,
g_signal_handlers_disconnect_by_func (tile, tile_rendered_cb, map_source);
}
+
static void
fill_tile (ChamplainMapSource *map_source,
ChamplainTile *tile)
@@ -379,6 +395,7 @@ fill_tile (ChamplainMapSource *map_source,
champlain_renderer_render (renderer, tile);
}
+
/*
* champlain_network_bbox_tile_source_get_api_uri:
* @map_data_source: a #ChamplainNetworkBboxTileSource
@@ -398,6 +415,7 @@ champlain_network_bbox_tile_source_get_api_uri (
return self->priv->api_uri;
}
+
/*
* champlain_network_bbox_tile_source_set_api_uri:
* @map_data_source: a #ChamplainNetworkBboxTileSource
diff --git a/champlain/champlain-network-bbox-tile-source.h b/champlain/champlain-network-bbox-tile-source.h
index c7d57f9..7f65cce 100644
--- a/champlain/champlain-network-bbox-tile-source.h
+++ b/champlain/champlain-network-bbox-tile-source.h
@@ -26,7 +26,7 @@
G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_NETWORK_BBOX_TILE_SOURCE champlain_network_bbox_tile_source_get_type()
+#define CHAMPLAIN_TYPE_NETWORK_BBOX_TILE_SOURCE champlain_network_bbox_tile_source_get_type ()
#define CHAMPLAIN_NETWORK_BBOX_TILE_SOURCE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_NETWORK_BBOX_TILE_SOURCE, ChamplainNetworkBboxTileSource))
@@ -45,19 +45,21 @@ G_BEGIN_DECLS
typedef struct _ChamplainNetworkBboxTileSourcePrivate ChamplainNetworkBboxTileSourcePrivate;
-typedef struct {
+typedef struct
+{
ChamplainTileSource parent;
ChamplainNetworkBboxTileSourcePrivate *priv;
} ChamplainNetworkBboxTileSource;
-typedef struct {
+typedef struct
+{
ChamplainTileSourceClass parent_class;
} ChamplainNetworkBboxTileSourceClass;
GType champlain_network_bbox_tile_source_get_type (void);
-ChamplainNetworkBboxTileSource* champlain_network_bbox_tile_source_new_full (const gchar *id,
+ChamplainNetworkBboxTileSource *champlain_network_bbox_tile_source_new_full (const gchar *id,
const gchar *name,
const gchar *license,
const gchar *license_uri,
@@ -74,7 +76,7 @@ void champlain_network_bbox_tile_source_load_map_data (
gdouble bound_right,
gdouble bound_top);
-const gchar * champlain_network_bbox_tile_source_get_api_uri (
+const gchar *champlain_network_bbox_tile_source_get_api_uri (
ChamplainNetworkBboxTileSource *map_data_source);
void champlain_network_bbox_tile_source_set_api_uri (
diff --git a/champlain/champlain-network-tile-source.c b/champlain/champlain-network-tile-source.c
index 0916933..72c8265 100644
--- a/champlain/champlain-network-tile-source.c
+++ b/champlain/champlain-network-tile-source.c
@@ -71,14 +71,14 @@ enum
G_DEFINE_TYPE (ChamplainNetworkTileSource, champlain_network_tile_source, CHAMPLAIN_TYPE_TILE_SOURCE);
#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_NETWORK_TILE_SOURCE, ChamplainNetworkTileSourcePrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_NETWORK_TILE_SOURCE, ChamplainNetworkTileSourcePrivate))
struct _ChamplainNetworkTileSourcePrivate
{
gboolean offline;
gchar *uri_format;
gchar *proxy_uri;
- SoupSession * soup_session;
+ SoupSession *soup_session;
};
typedef struct
@@ -100,10 +100,9 @@ typedef struct
} TileDestroyedCbData;
static void fill_tile (ChamplainMapSource *map_source,
- ChamplainTile *tile);
+ ChamplainTile *tile);
-static gchar *
-get_tile_uri (ChamplainNetworkTileSource *source,
+static gchar *get_tile_uri (ChamplainNetworkTileSource *source,
gint x,
gint y,
gint z);
@@ -121,38 +120,45 @@ champlain_network_tile_source_get_property (GObject *object,
case PROP_URI_FORMAT:
g_value_set_string (value, priv->uri_format);
break;
+
case PROP_OFFLINE:
g_value_set_boolean (value, priv->offline);
break;
+
case PROP_PROXY_URI:
g_value_set_string (value, priv->proxy_uri);
break;
+
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
+
static void
champlain_network_tile_source_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- ChamplainNetworkTileSource *tile_source = CHAMPLAIN_NETWORK_TILE_SOURCE(object);
+ ChamplainNetworkTileSource *tile_source = CHAMPLAIN_NETWORK_TILE_SOURCE (object);
switch (prop_id)
{
case PROP_URI_FORMAT:
champlain_network_tile_source_set_uri_format (tile_source, g_value_get_string (value));
break;
+
case PROP_OFFLINE:
champlain_network_tile_source_set_offline (tile_source, g_value_get_boolean (value));
break;
+
case PROP_PROXY_URI:
champlain_network_tile_source_set_proxy_uri (tile_source, g_value_get_string (value));
break;
+
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
@@ -163,18 +169,19 @@ champlain_network_tile_source_dispose (GObject *object)
ChamplainNetworkTileSourcePrivate *priv = CHAMPLAIN_NETWORK_TILE_SOURCE (object)->priv;
if (priv->soup_session)
- {
- soup_session_abort (priv->soup_session);
- priv->soup_session = NULL;
- }
+ {
+ soup_session_abort (priv->soup_session);
+ priv->soup_session = NULL;
+ }
G_OBJECT_CLASS (champlain_network_tile_source_parent_class)->dispose (object);
}
+
static void
champlain_network_tile_source_finalize (GObject *object)
{
- ChamplainNetworkTileSourcePrivate *priv = CHAMPLAIN_NETWORK_TILE_SOURCE(object)->priv;
+ ChamplainNetworkTileSourcePrivate *priv = CHAMPLAIN_NETWORK_TILE_SOURCE (object)->priv;
g_free (priv->uri_format);
g_free (priv->proxy_uri);
@@ -182,12 +189,14 @@ champlain_network_tile_source_finalize (GObject *object)
G_OBJECT_CLASS (champlain_network_tile_source_parent_class)->finalize (object);
}
+
static void
-champlain_network_tile_source_constructed (GObject *object)
+champlain_network_tile_source_constructed (GObject *object)
{
G_OBJECT_CLASS (champlain_network_tile_source_parent_class)->constructed (object);
}
+
static void
champlain_network_tile_source_class_init (ChamplainNetworkTileSourceClass *klass)
{
@@ -206,12 +215,12 @@ champlain_network_tile_source_class_init (ChamplainNetworkTileSourceClass *klass
map_source_class->fill_tile = fill_tile;
/**
- * ChamplainNetworkTileSource:uri-format
- *
- * The uri format of the tile source, see #champlain_network_tile_source_set_uri_format
- *
- * Since: 0.4
- */
+ * ChamplainNetworkTileSource:uri-format
+ *
+ * The uri format of the tile source, see #champlain_network_tile_source_set_uri_format
+ *
+ * Since: 0.4
+ */
pspec = g_param_spec_string ("uri-format",
"URI Format",
"The URI format",
@@ -220,12 +229,12 @@ champlain_network_tile_source_class_init (ChamplainNetworkTileSourceClass *klass
g_object_class_install_property (object_class, PROP_URI_FORMAT, pspec);
/**
- * ChamplainNetworkTileSource:offline
- *
- * Specifies whether the network tile source can access network
- *
- * Since: 0.4
- */
+ * ChamplainNetworkTileSource:offline
+ *
+ * Specifies whether the network tile source can access network
+ *
+ * Since: 0.4
+ */
pspec = g_param_spec_boolean ("offline",
"Offline",
"Offline",
@@ -234,12 +243,12 @@ champlain_network_tile_source_class_init (ChamplainNetworkTileSourceClass *klass
g_object_class_install_property (object_class, PROP_OFFLINE, pspec);
/**
- * ChamplainNetworkTileSource:proxy-uri
- *
- * The proxy uri used to access network
- *
- * Since: 0.4
- */
+ * ChamplainNetworkTileSource:proxy-uri
+ *
+ * The proxy uri used to access network
+ *
+ * Since: 0.4
+ */
pspec = g_param_spec_string ("proxy-uri",
"Proxy URI",
"The proxy URI to use to access network",
@@ -248,6 +257,7 @@ champlain_network_tile_source_class_init (ChamplainNetworkTileSourceClass *klass
g_object_class_install_property (object_class, PROP_PROXY_URI, pspec);
}
+
static void
champlain_network_tile_source_init (ChamplainNetworkTileSource *tile_source)
{
@@ -260,17 +270,17 @@ champlain_network_tile_source_init (ChamplainNetworkTileSource *tile_source)
priv->offline = FALSE;
priv->soup_session = soup_session_async_new_with_options (
- "proxy-uri", NULL,
+ "proxy-uri", NULL,
#ifdef HAVE_LIBSOUP_GNOME
- SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_GNOME,
+ SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_PROXY_RESOLVER_GNOME,
#endif
- NULL);
+ NULL);
g_object_set (G_OBJECT (priv->soup_session),
"user-agent", "libchamplain/" CHAMPLAIN_VERSION_S,
- "max-conns-per-host", 2, NULL); // This is as required by OSM
-
+ "max-conns-per-host", 2, NULL); /* This is as required by OSM */
}
+
/*
* champlain_network_tile_source_new_full:
* @id: the map source's id
@@ -289,7 +299,7 @@ champlain_network_tile_source_init (ChamplainNetworkTileSource *tile_source)
*
* Since: 0.4
*/
-ChamplainNetworkTileSource*
+ChamplainNetworkTileSource *
champlain_network_tile_source_new_full (const gchar *id,
const gchar *name,
const gchar *license,
@@ -301,22 +311,24 @@ champlain_network_tile_source_new_full (const gchar *id,
const gchar *uri_format,
ChamplainRenderer *renderer)
{
- ChamplainNetworkTileSource * source;
- source = g_object_new (CHAMPLAIN_TYPE_NETWORK_TILE_SOURCE,
+ ChamplainNetworkTileSource *source;
+
+ source = g_object_new (CHAMPLAIN_TYPE_NETWORK_TILE_SOURCE,
"id", id,
- "name", name,
- "license", license,
+ "name", name,
+ "license", license,
"license-uri", license_uri,
- "min-zoom-level", min_zoom,
+ "min-zoom-level", min_zoom,
"max-zoom-level", max_zoom,
- "tile-size", tile_size,
+ "tile-size", tile_size,
"projection", projection,
"uri-format", uri_format,
- "renderer", renderer,
+ "renderer", renderer,
NULL);
return source;
}
+
/**
* champlain_network_tile_source_get_uri_format:
* @tile_source: the #ChamplainNetworkTileSource
@@ -336,6 +348,7 @@ champlain_network_tile_source_get_uri_format (ChamplainNetworkTileSource *tile_s
return tile_source->priv->uri_format;
}
+
/**
* champlain_network_tile_source_set_uri_format:
* @tile_source: the #ChamplainNetworkTileSource
@@ -365,6 +378,7 @@ champlain_network_tile_source_set_uri_format (ChamplainNetworkTileSource *tile_s
g_object_notify (G_OBJECT (tile_source), "uri-format");
}
+
/**
* champlain_network_tile_source_get_proxy_uri:
* @tile_source: the #ChamplainNetworkTileSource
@@ -383,6 +397,7 @@ champlain_network_tile_source_get_proxy_uri (ChamplainNetworkTileSource *tile_so
return tile_source->priv->proxy_uri;
}
+
/**
* champlain_network_tile_source_set_proxy_uri:
* @tile_source: the #ChamplainNetworkTileSource
@@ -409,8 +424,8 @@ champlain_network_tile_source_set_proxy_uri (ChamplainNetworkTileSource *tile_so
if (priv->soup_session)
g_object_set (G_OBJECT (priv->soup_session),
- "proxy-uri", uri,
- NULL);
+ "proxy-uri", uri,
+ NULL);
if (uri)
soup_uri_free (uri);
@@ -418,6 +433,7 @@ champlain_network_tile_source_set_proxy_uri (ChamplainNetworkTileSource *tile_so
g_object_notify (G_OBJECT (tile_source), "proxy-uri");
}
+
/**
* champlain_network_tile_source_get_offline:
* @tile_source: the #ChamplainNetworkTileSource
@@ -436,6 +452,7 @@ champlain_network_tile_source_get_offline (ChamplainNetworkTileSource *tile_sour
return tile_source->priv->offline;
}
+
/**
* champlain_network_tile_source_set_offline:
* @tile_source: the #ChamplainNetworkTileSource
@@ -456,6 +473,7 @@ champlain_network_tile_source_set_offline (ChamplainNetworkTileSource *tile_sour
g_object_notify (G_OBJECT (tile_source), "offline");
}
+
#define SIZE 8
static gchar *
get_tile_uri (ChamplainNetworkTileSource *tile_source,
@@ -504,6 +522,7 @@ get_tile_uri (ChamplainNetworkTileSource *tile_source,
return token;
}
+
static void
tile_destroyed_cb (G_GNUC_UNUSED ChamplainTile *tile,
TileDestroyedCbData *data)
@@ -517,12 +536,13 @@ tile_destroyed_cb (G_GNUC_UNUSED ChamplainTile *tile,
}
}
+
static void
destroy_cb_data (TileDestroyedCbData *data,
G_GNUC_UNUSED GClosure *closure)
{
if (data->map_source)
- g_object_remove_weak_pointer(G_OBJECT (data->map_source), (gpointer*)&data->map_source);
+ g_object_remove_weak_pointer (G_OBJECT (data->map_source), (gpointer *) &data->map_source);
g_free (data);
}
@@ -532,7 +552,7 @@ static void
tile_rendered_cb (ChamplainTile *tile, ChamplainRenderCallbackData *data, TileRenderedCallbackData *user_data)
{
ChamplainMapSource *map_source = user_data->map_source;
- ChamplainTileSource *tile_source = CHAMPLAIN_TILE_SOURCE(map_source);
+ ChamplainTileSource *tile_source = CHAMPLAIN_TILE_SOURCE (map_source);
ChamplainTileCache *tile_cache = champlain_tile_source_get_cache (tile_source);
ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
gchar *etag = user_data->etag;
@@ -566,9 +586,9 @@ tile_loaded_cb (G_GNUC_UNUSED SoupSession *session,
SoupMessage *msg,
gpointer user_data)
{
- TileLoadedCallbackData *callback_data = (TileLoadedCallbackData *)user_data;
+ TileLoadedCallbackData *callback_data = (TileLoadedCallbackData *) user_data;
ChamplainMapSource *map_source = callback_data->map_source;
- ChamplainTileSource *tile_source = CHAMPLAIN_TILE_SOURCE(map_source);
+ ChamplainTileSource *tile_source = CHAMPLAIN_TILE_SOURCE (map_source);
ChamplainTileCache *tile_cache = champlain_tile_source_get_cache (tile_source);
ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
ChamplainTile *tile = callback_data->tile;
@@ -578,7 +598,7 @@ tile_loaded_cb (G_GNUC_UNUSED SoupSession *session,
if (tile)
- g_object_remove_weak_pointer (G_OBJECT (tile), (gpointer*)&callback_data->tile);
+ g_object_remove_weak_pointer (G_OBJECT (tile), (gpointer *) &callback_data->tile);
g_free (user_data);
@@ -590,7 +610,7 @@ tile_loaded_cb (G_GNUC_UNUSED SoupSession *session,
DEBUG ("Tile destroyed while loading");
else
DEBUG ("Download of tile %d, %d got cancelled",
- champlain_tile_get_x (tile), champlain_tile_get_y (tile));
+ champlain_tile_get_x (tile), champlain_tile_get_y (tile));
g_object_unref (map_source);
return;
@@ -606,9 +626,9 @@ tile_loaded_cb (G_GNUC_UNUSED SoupSession *session,
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code))
{
DEBUG ("Unable to download tile %d, %d: %s",
- champlain_tile_get_x (tile),
- champlain_tile_get_y (tile),
- soup_status_get_phrase (msg->status_code));
+ champlain_tile_get_x (tile),
+ champlain_tile_get_y (tile),
+ soup_status_get_phrase (msg->status_code));
goto load_next;
}
@@ -619,7 +639,7 @@ tile_loaded_cb (G_GNUC_UNUSED SoupSession *session,
data = g_new (TileRenderedCallbackData, 1);
data->map_source = map_source;
- data->etag = g_strdup(etag);
+ data->etag = g_strdup (etag);
renderer = champlain_map_source_get_renderer (map_source);
@@ -643,19 +663,21 @@ finish:
g_object_unref (map_source);
}
+
static gchar *
get_modified_time_string (ChamplainTile *tile)
{
const GTimeVal *time;
+
g_return_val_if_fail (CHAMPLAIN_TILE (tile), NULL);
- time = champlain_tile_get_modified_time(tile);
+ time = champlain_tile_get_modified_time (tile);
if (time == NULL)
return NULL;
struct tm *other_time = gmtime (&time->tv_sec);
- char value [100];
+ char value[100];
#ifdef G_OS_WIN32
strftime (value, 100, "%a, %d %b %Y %H:%M:%S %Z", other_time);
@@ -666,6 +688,7 @@ get_modified_time_string (ChamplainTile *tile)
return g_strdup (value);
}
+
static void
fill_tile (ChamplainMapSource *map_source,
ChamplainTile *tile)
@@ -683,9 +706,9 @@ fill_tile (ChamplainMapSource *map_source,
gchar *uri;
uri = get_tile_uri (tile_source,
- champlain_tile_get_x (tile),
- champlain_tile_get_y (tile),
- champlain_tile_get_zoom_level (tile));
+ champlain_tile_get_x (tile),
+ champlain_tile_get_y (tile),
+ champlain_tile_get_zoom_level (tile));
msg = soup_message_new (SOUP_METHOD_GET, uri);
@@ -702,13 +725,13 @@ fill_tile (ChamplainMapSource *map_source,
*/
if (etag)
{
- DEBUG("If-None-Match: %s", etag);
+ DEBUG ("If-None-Match: %s", etag);
soup_message_headers_append (msg->request_headers,
"If-None-Match", etag);
}
else if (date)
{
- DEBUG("If-Modified-Since %s", date);
+ DEBUG ("If-Modified-Since %s", date);
soup_message_headers_append (msg->request_headers,
"If-Modified-Since", date);
}
@@ -720,8 +743,8 @@ fill_tile (ChamplainMapSource *map_source,
tile_destroyed_cb_data->map_source = map_source;
tile_destroyed_cb_data->msg = msg;
- g_object_add_weak_pointer (G_OBJECT (msg), (gpointer*)&tile_destroyed_cb_data->msg);
- g_object_add_weak_pointer (G_OBJECT (map_source), (gpointer*)&tile_destroyed_cb_data->map_source);
+ g_object_add_weak_pointer (G_OBJECT (msg), (gpointer *) &tile_destroyed_cb_data->msg);
+ g_object_add_weak_pointer (G_OBJECT (map_source), (gpointer *) &tile_destroyed_cb_data->map_source);
g_signal_connect_data (tile, "destroy", G_CALLBACK (tile_destroyed_cb),
tile_destroyed_cb_data, (GClosureNotify) destroy_cb_data, 0);
@@ -730,7 +753,7 @@ fill_tile (ChamplainMapSource *map_source,
callback_data->tile = tile;
callback_data->map_source = map_source;
- g_object_add_weak_pointer (G_OBJECT (tile), (gpointer*)&callback_data->tile);
+ g_object_add_weak_pointer (G_OBJECT (tile), (gpointer *) &callback_data->tile);
g_object_ref (map_source);
soup_session_queue_message (priv->soup_session, msg,
@@ -741,7 +764,7 @@ fill_tile (ChamplainMapSource *map_source,
{
ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
- if (CHAMPLAIN_IS_MAP_SOURCE(next_source))
- champlain_map_source_fill_tile (next_source, tile);
+ if (CHAMPLAIN_IS_MAP_SOURCE (next_source))
+ champlain_map_source_fill_tile (next_source, tile);
}
}
diff --git a/champlain/champlain-network-tile-source.h b/champlain/champlain-network-tile-source.h
index 0dc58f2..51c3577 100644
--- a/champlain/champlain-network-tile-source.h
+++ b/champlain/champlain-network-tile-source.h
@@ -65,7 +65,7 @@ struct _ChamplainNetworkTileSourceClass
GType champlain_network_tile_source_get_type (void);
-ChamplainNetworkTileSource* champlain_network_tile_source_new_full (const gchar *id,
+ChamplainNetworkTileSource *champlain_network_tile_source_new_full (const gchar *id,
const gchar *name,
const gchar *license,
const gchar *license_uri,
@@ -76,7 +76,7 @@ ChamplainNetworkTileSource* champlain_network_tile_source_new_full (const gchar
const gchar *uri_format,
ChamplainRenderer *renderer);
-const gchar * champlain_network_tile_source_get_uri_format (ChamplainNetworkTileSource *tile_source);
+const gchar *champlain_network_tile_source_get_uri_format (ChamplainNetworkTileSource *tile_source);
void champlain_network_tile_source_set_uri_format (ChamplainNetworkTileSource *tile_source,
const gchar *uri_format);
@@ -84,7 +84,7 @@ gboolean champlain_network_tile_source_get_offline (ChamplainNetworkTileSource *
void champlain_network_tile_source_set_offline (ChamplainNetworkTileSource *tile_source,
gboolean offline);
-const gchar * champlain_network_tile_source_get_proxy_uri (ChamplainNetworkTileSource *tile_source);
+const gchar *champlain_network_tile_source_get_proxy_uri (ChamplainNetworkTileSource *tile_source);
void champlain_network_tile_source_set_proxy_uri (ChamplainNetworkTileSource *tile_source,
const gchar *proxy_uri);
diff --git a/champlain/champlain-null-tile-source.c b/champlain/champlain-null-tile-source.c
index 6e1ee4b..a5e3db9 100644
--- a/champlain/champlain-null-tile-source.c
+++ b/champlain/champlain-null-tile-source.c
@@ -68,7 +68,7 @@ champlain_null_tile_source_new_full (ChamplainRenderer *renderer)
{
ChamplainNullTileSource *source;
- source = g_object_new (CHAMPLAIN_TYPE_NULL_TILE_SOURCE,
+ source = g_object_new (CHAMPLAIN_TYPE_NULL_TILE_SOURCE,
"renderer", renderer,
NULL);
return source;
diff --git a/champlain/champlain-point.c b/champlain/champlain-point.c
index d918811..bcf7801 100644
--- a/champlain/champlain-point.c
+++ b/champlain/champlain-point.c
@@ -44,6 +44,7 @@ champlain_point_get_type (void)
return type;
}
+
/**
* champlain_point_copy:
* @point: a #ChamplainPoint
@@ -64,6 +65,7 @@ champlain_point_copy (const ChamplainPoint *point)
return NULL;
}
+
/**
* champlain_point_free:
* @point: a #ChamplainPoint
@@ -80,6 +82,7 @@ champlain_point_free (ChamplainPoint *point)
g_slice_free (ChamplainPoint, point);
}
+
/**
* champlain_point_new:
* @lat: the latitude
diff --git a/champlain/champlain-point.h b/champlain/champlain-point.h
index 92742e4..6e4b507 100644
--- a/champlain/champlain-point.h
+++ b/champlain/champlain-point.h
@@ -46,11 +46,11 @@ GType champlain_point_get_type (void) G_GNUC_CONST;
#define CHAMPLAIN_TYPE_POINT (champlain_point_get_type ())
#define CHAMPLAIN_POINT(x) ((ChamplainPoint *) (x))
-ChamplainPoint * champlain_point_copy (const ChamplainPoint *point);
+ChamplainPoint *champlain_point_copy (const ChamplainPoint *point);
void champlain_point_free (ChamplainPoint *point);
-ChamplainPoint * champlain_point_new (gdouble lat,
+ChamplainPoint *champlain_point_new (gdouble lat,
gdouble lon);
G_END_DECLS
diff --git a/champlain/champlain-polygon.c b/champlain/champlain-polygon.c
index 99c356c..379d78d 100644
--- a/champlain/champlain-polygon.c
+++ b/champlain/champlain-polygon.c
@@ -34,10 +34,11 @@
#include <glib.h>
#include <math.h>
-static ClutterColor DEFAULT_FILL_COLOR = {0xcc, 0x00, 0x00, 0xaa};
-static ClutterColor DEFAULT_STROKE_COLOR = {0xa4, 0x00, 0x00, 0xff};
+static ClutterColor DEFAULT_FILL_COLOR = { 0xcc, 0x00, 0x00, 0xaa };
+static ClutterColor DEFAULT_STROKE_COLOR = { 0xa4, 0x00, 0x00, 0xff };
-struct _ChamplainPolygonPrivate {
+struct _ChamplainPolygonPrivate
+{
GList *points;
gboolean closed_path;
ClutterColor *stroke_color;
@@ -77,35 +78,44 @@ champlain_polygon_get_property (GObject *object,
switch (property_id)
{
- case PROP_CLOSED_PATH:
- g_value_set_boolean (value, priv->closed_path);
- break;
- case PROP_FILL:
- g_value_set_boolean (value, priv->fill);
- break;
- case PROP_STROKE:
- g_value_set_boolean (value, priv->stroke);
- break;
- case PROP_FILL_COLOR:
- clutter_value_set_color (value, priv->fill_color);
- break;
- case PROP_STROKE_COLOR:
- clutter_value_set_color (value, priv->stroke_color);
- break;
- case PROP_STROKE_WIDTH:
- g_value_set_double (value, priv->stroke_width);
- break;
- case PROP_VISIBLE:
- g_value_set_boolean (value, priv->visible);
- break;
- case PROP_MARK_POINTS:
- g_value_set_boolean (value, priv->mark_points);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ case PROP_CLOSED_PATH:
+ g_value_set_boolean (value, priv->closed_path);
+ break;
+
+ case PROP_FILL:
+ g_value_set_boolean (value, priv->fill);
+ break;
+
+ case PROP_STROKE:
+ g_value_set_boolean (value, priv->stroke);
+ break;
+
+ case PROP_FILL_COLOR:
+ clutter_value_set_color (value, priv->fill_color);
+ break;
+
+ case PROP_STROKE_COLOR:
+ clutter_value_set_color (value, priv->stroke_color);
+ break;
+
+ case PROP_STROKE_WIDTH:
+ g_value_set_double (value, priv->stroke_width);
+ break;
+
+ case PROP_VISIBLE:
+ g_value_set_boolean (value, priv->visible);
+ break;
+
+ case PROP_MARK_POINTS:
+ g_value_set_boolean (value, priv->mark_points);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
+
static void
champlain_polygon_set_property (GObject *object,
guint property_id,
@@ -116,50 +126,60 @@ champlain_polygon_set_property (GObject *object,
switch (property_id)
{
- case PROP_CLOSED_PATH:
- priv->closed_path = g_value_get_boolean (value);
- break;
- case PROP_FILL:
- champlain_polygon_set_fill (CHAMPLAIN_POLYGON (object),
- g_value_get_boolean (value));
- break;
- case PROP_STROKE:
- champlain_polygon_set_stroke (CHAMPLAIN_POLYGON (object),
- g_value_get_boolean (value));
- break;
- case PROP_FILL_COLOR:
- champlain_polygon_set_fill_color (CHAMPLAIN_POLYGON (object),
- clutter_value_get_color (value));
- break;
- case PROP_STROKE_COLOR:
- champlain_polygon_set_stroke_color (CHAMPLAIN_POLYGON (object),
- clutter_value_get_color (value));
- break;
- case PROP_STROKE_WIDTH:
- champlain_polygon_set_stroke_width (CHAMPLAIN_POLYGON (object),
- g_value_get_double (value));
- break;
- case PROP_VISIBLE:
- if (g_value_get_boolean (value))
- champlain_polygon_show (CHAMPLAIN_POLYGON (object));
- else
- champlain_polygon_hide (CHAMPLAIN_POLYGON (object));
- break;
- case PROP_MARK_POINTS:
- champlain_polygon_set_mark_points (CHAMPLAIN_POLYGON (object),
- g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ case PROP_CLOSED_PATH:
+ priv->closed_path = g_value_get_boolean (value);
+ break;
+
+ case PROP_FILL:
+ champlain_polygon_set_fill (CHAMPLAIN_POLYGON (object),
+ g_value_get_boolean (value));
+ break;
+
+ case PROP_STROKE:
+ champlain_polygon_set_stroke (CHAMPLAIN_POLYGON (object),
+ g_value_get_boolean (value));
+ break;
+
+ case PROP_FILL_COLOR:
+ champlain_polygon_set_fill_color (CHAMPLAIN_POLYGON (object),
+ clutter_value_get_color (value));
+ break;
+
+ case PROP_STROKE_COLOR:
+ champlain_polygon_set_stroke_color (CHAMPLAIN_POLYGON (object),
+ clutter_value_get_color (value));
+ break;
+
+ case PROP_STROKE_WIDTH:
+ champlain_polygon_set_stroke_width (CHAMPLAIN_POLYGON (object),
+ g_value_get_double (value));
+ break;
+
+ case PROP_VISIBLE:
+ if (g_value_get_boolean (value))
+ champlain_polygon_show (CHAMPLAIN_POLYGON (object));
+ else
+ champlain_polygon_hide (CHAMPLAIN_POLYGON (object));
+ break;
+
+ case PROP_MARK_POINTS:
+ champlain_polygon_set_mark_points (CHAMPLAIN_POLYGON (object),
+ g_value_get_boolean (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
+
static void
champlain_polygon_dispose (GObject *object)
{
G_OBJECT_CLASS (champlain_polygon_parent_class)->dispose (object);
}
+
static void
champlain_polygon_finalize (GObject *object)
{
@@ -168,6 +188,7 @@ champlain_polygon_finalize (GObject *object)
G_OBJECT_CLASS (champlain_polygon_parent_class)->finalize (object);
}
+
static void
champlain_polygon_class_init (ChamplainPolygonClass *klass)
{
@@ -181,12 +202,12 @@ champlain_polygon_class_init (ChamplainPolygonClass *klass)
object_class->finalize = champlain_polygon_finalize;
/**
- * ChamplainPolygon:close-path:
- *
- * The shape is a closed path
- *
- * Since: 0.4
- */
+ * ChamplainPolygon:close-path:
+ *
+ * The shape is a closed path
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_CLOSED_PATH,
g_param_spec_boolean ("closed-path",
@@ -195,12 +216,12 @@ champlain_polygon_class_init (ChamplainPolygonClass *klass)
FALSE, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainPolygon:fill:
- *
- * The shape should be filled
- *
- * Since: 0.4
- */
+ * ChamplainPolygon:fill:
+ *
+ * The shape should be filled
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_FILL,
g_param_spec_boolean ("fill",
@@ -209,12 +230,12 @@ champlain_polygon_class_init (ChamplainPolygonClass *klass)
FALSE, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainPolygon:stroke:
- *
- * The shape should be stroked
- *
- * Since: 0.4
- */
+ * ChamplainPolygon:stroke:
+ *
+ * The shape should be stroked
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_STROKE,
g_param_spec_boolean ("stroke",
@@ -223,27 +244,27 @@ champlain_polygon_class_init (ChamplainPolygonClass *klass)
TRUE, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainPolygon:stroke-color:
- *
- * The polygon's stroke color
- *
- * Since: 0.4
- */
+ * ChamplainPolygon:stroke-color:
+ *
+ * The polygon's stroke color
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_STROKE_COLOR,
clutter_param_spec_color ("stroke-color",
- "Stroke Color",
- "The polygon's stroke color",
- &DEFAULT_STROKE_COLOR,
- CHAMPLAIN_PARAM_READWRITE));
+ "Stroke Color",
+ "The polygon's stroke color",
+ &DEFAULT_STROKE_COLOR,
+ CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainPolygon:text-color:
- *
- * The polygon's fill color
- *
- * Since: 0.4
- */
+ * ChamplainPolygon:text-color:
+ *
+ * The polygon's fill color
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_FILL_COLOR,
clutter_param_spec_color ("fill-color",
@@ -253,12 +274,12 @@ champlain_polygon_class_init (ChamplainPolygonClass *klass)
CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainPolygon:stroke-width:
- *
- * The polygon's stroke width (in pixels)
- *
- * Since: 0.4
- */
+ * ChamplainPolygon:stroke-width:
+ *
+ * The polygon's stroke width (in pixels)
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_STROKE_WIDTH,
g_param_spec_double ("stroke-width",
@@ -269,12 +290,12 @@ champlain_polygon_class_init (ChamplainPolygonClass *klass)
CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainPolygon:mark-points:
- *
- * Wether the polygons points should be marked for extra visibility.
- *
- * Since: 0.4.3
- */
+ * ChamplainPolygon:mark-points:
+ *
+ * Wether the polygons points should be marked for extra visibility.
+ *
+ * Since: 0.4.3
+ */
g_object_class_install_property (object_class,
PROP_MARK_POINTS,
g_param_spec_boolean ("mark-points",
@@ -284,12 +305,12 @@ champlain_polygon_class_init (ChamplainPolygonClass *klass)
CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainPolygon:visible:
- *
- * Wether the polygon is visible
- *
- * Since: 0.4
- */
+ * ChamplainPolygon:visible:
+ *
+ * Wether the polygon is visible
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_VISIBLE,
g_param_spec_boolean ("visible",
@@ -299,6 +320,7 @@ champlain_polygon_class_init (ChamplainPolygonClass *klass)
CHAMPLAIN_PARAM_READWRITE));
}
+
static void
champlain_polygon_init (ChamplainPolygon *polygon)
{
@@ -317,6 +339,7 @@ champlain_polygon_init (ChamplainPolygon *polygon)
priv->stroke_color = clutter_color_copy (&DEFAULT_STROKE_COLOR);
}
+
/**
* champlain_polygon_new:
*
@@ -332,6 +355,7 @@ champlain_polygon_new ()
return g_object_new (CHAMPLAIN_TYPE_POLYGON, NULL);
}
+
/**
* champlain_polygon_append_point:
* @polygon: The polygon
@@ -360,6 +384,7 @@ champlain_polygon_append_point (ChamplainPolygon *polygon,
return point;
}
+
/**
* champlain_polygon_insert_point:
* @polygon: The polygon
@@ -390,6 +415,7 @@ champlain_polygon_insert_point (ChamplainPolygon *polygon,
return point;
}
+
/**
* champlain_polygon_remove_point:
* @polygon: a #ChamplainPolygon
@@ -411,6 +437,7 @@ champlain_polygon_remove_point (ChamplainPolygon *polygon,
g_object_notify (G_OBJECT (polygon), "visible");
}
+
/**
* champlain_polygon_clear_points:
* @polygon: The polygon
@@ -428,15 +455,16 @@ champlain_polygon_clear_points (ChamplainPolygon *polygon)
GList *next = priv->points;
while (next != NULL)
- {
- champlain_point_free (next->data);
- next = g_list_next (next);
- }
+ {
+ champlain_point_free (next->data);
+ next = g_list_next (next);
+ }
g_list_free (priv->points);
priv->points = NULL;
g_object_notify (G_OBJECT (polygon), "visible");
}
+
/**
* champlain_polygon_get_points:
* @polygon: The polygon
@@ -455,6 +483,7 @@ champlain_polygon_get_points (ChamplainPolygon *polygon)
return polygon->priv->points;
}
+
/**
* champlain_polygon_set_fill_color:
* @polygon: The polygon
@@ -483,6 +512,7 @@ champlain_polygon_set_fill_color (ChamplainPolygon *polygon,
g_object_notify (G_OBJECT (polygon), "fill-color");
}
+
/**
* champlain_polygon_set_stroke_color:
* @polygon: The polygon
@@ -511,6 +541,7 @@ champlain_polygon_set_stroke_color (ChamplainPolygon *polygon,
g_object_notify (G_OBJECT (polygon), "stroke-color");
}
+
/**
* champlain_polygon_get_fill_color:
* @polygon: The polygon
@@ -529,6 +560,7 @@ champlain_polygon_get_fill_color (ChamplainPolygon *polygon)
return polygon->priv->fill_color;
}
+
/**
* champlain_polygon_get_stroke_color:
* @polygon: The polygon
@@ -547,6 +579,7 @@ champlain_polygon_get_stroke_color (ChamplainPolygon *polygon)
return polygon->priv->stroke_color;
}
+
/**
* champlain_polygon_set_stroke:
* @polygon: The polygon
@@ -566,6 +599,7 @@ champlain_polygon_set_stroke (ChamplainPolygon *polygon,
g_object_notify (G_OBJECT (polygon), "stroke");
}
+
/**
* champlain_polygon_get_stroke:
* @polygon: The polygon
@@ -584,6 +618,7 @@ champlain_polygon_get_stroke (ChamplainPolygon *polygon)
return polygon->priv->stroke;
}
+
/**
* champlain_polygon_set_fill:
* @polygon: The polygon
@@ -603,6 +638,7 @@ champlain_polygon_set_fill (ChamplainPolygon *polygon,
g_object_notify (G_OBJECT (polygon), "fill");
}
+
/**
* champlain_polygon_get_fill:
* @polygon: The polygon
@@ -621,6 +657,7 @@ champlain_polygon_get_fill (ChamplainPolygon *polygon)
return polygon->priv->fill;
}
+
/**
* champlain_polygon_set_stroke_width:
* @polygon: The polygon
@@ -640,6 +677,7 @@ champlain_polygon_set_stroke_width (ChamplainPolygon *polygon,
g_object_notify (G_OBJECT (polygon), "stroke-width");
}
+
/**
* champlain_polygon_get_stroke_width:
* @polygon: The polygon
@@ -658,6 +696,7 @@ champlain_polygon_get_stroke_width (ChamplainPolygon *polygon)
return polygon->priv->stroke_width;
}
+
/**
* champlain_polygon_set_mark_points:
* @polygon: The polygon
@@ -678,6 +717,7 @@ champlain_polygon_set_mark_points (ChamplainPolygon *polygon,
g_object_notify (G_OBJECT (polygon), "mark-points");
}
+
/**
* champlain_polygon_get_mark_points:
* @polygon: The polygon
@@ -696,6 +736,7 @@ champlain_polygon_get_mark_points (ChamplainPolygon *polygon)
return polygon->priv->mark_points;
}
+
/**
* champlain_polygon_show:
* @polygon: The polygon
@@ -714,6 +755,7 @@ champlain_polygon_show (ChamplainPolygon *polygon)
g_object_notify (G_OBJECT (polygon), "visible");
}
+
/**
* champlain_polygon_hide:
* @polygon: The polygon
@@ -732,6 +774,7 @@ champlain_polygon_hide (ChamplainPolygon *polygon)
g_object_notify (G_OBJECT (polygon), "visible");
}
+
void
champlain_polygon_draw_polygon (ChamplainPolygon *polygon,
ChamplainMapSource *map_source,
@@ -763,7 +806,7 @@ champlain_polygon_draw_polygon (ChamplainPolygon *polygon,
GList *list = g_list_first (priv->points);
while (list != NULL)
{
- ChamplainPoint *point = (ChamplainPoint*) list->data;
+ ChamplainPoint *point = (ChamplainPoint *) list->data;
gfloat x, y;
x = champlain_map_source_get_x (map_source, zoom_level, point->lon);
@@ -806,7 +849,7 @@ champlain_polygon_draw_polygon (ChamplainPolygon *polygon,
GList *list = g_list_first (priv->points);
while (list != NULL)
{
- ChamplainPoint *point = (ChamplainPoint*) list->data;
+ ChamplainPoint *point = (ChamplainPoint *) list->data;
gfloat x, y;
x = champlain_map_source_get_x (map_source, zoom_level, point->lon);
diff --git a/champlain/champlain-polygon.h b/champlain/champlain-polygon.h
index f8de71e..e991a72 100644
--- a/champlain/champlain-polygon.h
+++ b/champlain/champlain-polygon.h
@@ -31,7 +31,7 @@
G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_POLYGON champlain_polygon_get_type()
+#define CHAMPLAIN_TYPE_POLYGON champlain_polygon_get_type ()
#define CHAMPLAIN_POLYGON(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_POLYGON, ChamplainPolygon))
@@ -50,27 +50,29 @@ G_BEGIN_DECLS
typedef struct _ChamplainPolygonPrivate ChamplainPolygonPrivate;
-typedef struct _ChamplainPolygon ChamplainPolygon;
-typedef struct _ChamplainPolygonClass ChamplainPolygonClass;
+typedef struct _ChamplainPolygon ChamplainPolygon;
+typedef struct _ChamplainPolygonClass ChamplainPolygonClass;
-struct _ChamplainPolygon {
+struct _ChamplainPolygon
+{
ClutterGroup parent;
ChamplainPolygonPrivate *priv;
};
-struct _ChamplainPolygonClass {
+struct _ChamplainPolygonClass
+{
ClutterGroupClass parent_class;
};
GType champlain_polygon_get_type (void);
-ChamplainPolygon * champlain_polygon_new (void);
+ChamplainPolygon *champlain_polygon_new (void);
-ChamplainPoint * champlain_polygon_append_point (ChamplainPolygon *polygon,
+ChamplainPoint *champlain_polygon_append_point (ChamplainPolygon *polygon,
gdouble lat,
gdouble lon);
-ChamplainPoint * champlain_polygon_insert_point (ChamplainPolygon *polygon,
+ChamplainPoint *champlain_polygon_insert_point (ChamplainPolygon *polygon,
gdouble lat,
gdouble lon,
gint pos);
@@ -83,8 +85,8 @@ void champlain_polygon_set_fill_color (ChamplainPolygon *polygon,
const ClutterColor *color);
void champlain_polygon_set_stroke_color (ChamplainPolygon *polygon,
const ClutterColor *color);
-ClutterColor * champlain_polygon_get_fill_color (ChamplainPolygon *polygon);
-ClutterColor * champlain_polygon_get_stroke_color (ChamplainPolygon *polygon);
+ClutterColor *champlain_polygon_get_fill_color (ChamplainPolygon *polygon);
+ClutterColor *champlain_polygon_get_stroke_color (ChamplainPolygon *polygon);
gboolean champlain_polygon_get_fill (ChamplainPolygon *polygon);
void champlain_polygon_set_fill (ChamplainPolygon *polygon,
diff --git a/champlain/champlain-private.h b/champlain/champlain-private.h
index 5f2d317..5c6dd1d 100644
--- a/champlain/champlain-private.h
+++ b/champlain/champlain-private.h
@@ -43,11 +43,11 @@ typedef struct
} ChamplainRectangle;
#define CHAMPLAIN_PARAM_READABLE \
- (G_PARAM_READABLE | \
- G_PARAM_STATIC_NICK | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB)
+ (G_PARAM_READABLE | \
+ G_PARAM_STATIC_NICK | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB)
#define CHAMPLAIN_PARAM_READWRITE \
- (G_PARAM_READABLE | G_PARAM_WRITABLE | \
- G_PARAM_STATIC_NICK | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB)
+ (G_PARAM_READABLE | G_PARAM_WRITABLE | \
+ G_PARAM_STATIC_NICK | G_PARAM_STATIC_NAME | G_PARAM_STATIC_BLURB)
#endif
diff --git a/champlain/champlain-renderer.c b/champlain/champlain-renderer.c
index 9ac165f..9c2efe8 100644
--- a/champlain/champlain-renderer.c
+++ b/champlain/champlain-renderer.c
@@ -18,7 +18,7 @@
#include "champlain-renderer.h"
-G_DEFINE_TYPE(ChamplainRenderer, champlain_renderer, G_TYPE_OBJECT)
+G_DEFINE_TYPE (ChamplainRenderer, champlain_renderer, G_TYPE_OBJECT)
enum
{
@@ -35,6 +35,7 @@ champlain_renderer_dispose (GObject *object)
G_OBJECT_CLASS (champlain_renderer_parent_class)->dispose (object);
}
+
static void
champlain_renderer_finalize (GObject *object)
{
@@ -42,9 +43,10 @@ champlain_renderer_finalize (GObject *object)
}
-static void champlain_renderer_class_init(ChamplainRendererClass *klass)
+static void
+champlain_renderer_class_init (ChamplainRendererClass *klass)
{
- GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = champlain_renderer_finalize;
object_class->dispose = champlain_renderer_dispose;
@@ -53,14 +55,17 @@ static void champlain_renderer_class_init(ChamplainRendererClass *klass)
klass->render = NULL;
champlain_renderer_signals[RELOAD_TILES] =
- g_signal_new ("reload-tiles", G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID, G_TYPE_NONE,
- 0, NULL);
+ g_signal_new ("reload-tiles", G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE,
+ 0, NULL);
}
-void champlain_renderer_set_data (ChamplainRenderer *renderer, const gchar *data, guint size)
+void
+champlain_renderer_set_data (ChamplainRenderer *renderer,
+ const gchar *data,
+ guint size)
{
g_return_if_fail (CHAMPLAIN_IS_RENDERER (renderer));
@@ -68,7 +73,9 @@ void champlain_renderer_set_data (ChamplainRenderer *renderer, const gchar *data
}
-void champlain_renderer_render (ChamplainRenderer *renderer, ChamplainTile *tile)
+void
+champlain_renderer_render (ChamplainRenderer *renderer,
+ ChamplainTile *tile)
{
g_return_if_fail (CHAMPLAIN_IS_RENDERER (renderer));
@@ -76,8 +83,7 @@ void champlain_renderer_render (ChamplainRenderer *renderer, ChamplainTile *tile
}
-static void champlain_renderer_init(ChamplainRenderer *self)
+static void
+champlain_renderer_init (ChamplainRenderer *self)
{
}
-
-
diff --git a/champlain/champlain-renderer.h b/champlain/champlain-renderer.h
index 6624476..ef55299 100644
--- a/champlain/champlain-renderer.h
+++ b/champlain/champlain-renderer.h
@@ -27,25 +27,25 @@
G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_RENDERER champlain_renderer_get_type()
+#define CHAMPLAIN_TYPE_RENDERER champlain_renderer_get_type ()
#define CHAMPLAIN_RENDERER(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), CHAMPLAIN_TYPE_RENDERER, ChamplainRenderer))
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_RENDERER, ChamplainRenderer))
#define CHAMPLAIN_RENDERER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), CHAMPLAIN_TYPE_RENDERER, ChamplainRendererClass))
+ (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_RENDERER, ChamplainRendererClass))
#define CHAMPLAIN_IS_RENDERER(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), CHAMPLAIN_TYPE_RENDERER))
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_RENDERER))
#define CHAMPLAIN_IS_RENDERER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), CHAMPLAIN_TYPE_RENDERER))
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_RENDERER))
#define CHAMPLAIN_RENDERER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), CHAMPLAIN_TYPE_RENDERER, ChamplainRendererClass))
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_RENDERER, ChamplainRendererClass))
-typedef struct _ChamplainRenderer ChamplainRenderer;
-typedef struct _ChamplainRendererClass ChamplainRendererClass;
+typedef struct _ChamplainRenderer ChamplainRenderer;
+typedef struct _ChamplainRendererClass ChamplainRendererClass;
struct _ChamplainRenderer
{
@@ -56,14 +56,20 @@ struct _ChamplainRendererClass
{
GObjectClass parent_class;
- void (*set_data) (ChamplainRenderer *renderer, const gchar *data, guint size);
- void (*render) (ChamplainRenderer *renderer, ChamplainTile *tile);
+ void (*set_data)(ChamplainRenderer *renderer,
+ const gchar *data,
+ guint size);
+ void (*render)(ChamplainRenderer *renderer,
+ ChamplainTile *tile);
};
-GType champlain_renderer_get_type (void);
+GType champlain_renderer_get_type (void);
-void champlain_renderer_set_data (ChamplainRenderer *renderer, const gchar *data, guint size);
-void champlain_renderer_render (ChamplainRenderer *renderer, ChamplainTile *tile);
+void champlain_renderer_set_data (ChamplainRenderer *renderer,
+ const gchar *data,
+ guint size);
+void champlain_renderer_render (ChamplainRenderer *renderer,
+ ChamplainTile *tile);
G_END_DECLS
diff --git a/champlain/champlain-selection-layer.c b/champlain/champlain-selection-layer.c
index 41e3b93..67f7f4c 100644
--- a/champlain/champlain-selection-layer.c
+++ b/champlain/champlain-selection-layer.c
@@ -58,7 +58,8 @@ enum
static guint signals[LAST_SIGNAL] = { 0, };
-struct _ChamplainSelectionLayerPrivate {
+struct _ChamplainSelectionLayerPrivate
+{
ChamplainSelectionMode mode;
GList *selection;
};
@@ -74,14 +75,16 @@ champlain_selection_layer_get_property (GObject *object,
switch (property_id)
{
- case PROP_SELECTION_MODE:
- g_value_set_enum (value, priv->mode);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ case PROP_SELECTION_MODE:
+ g_value_set_enum (value, priv->mode);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
+
static void
champlain_selection_layer_set_property (GObject *object,
guint property_id,
@@ -92,26 +95,30 @@ champlain_selection_layer_set_property (GObject *object,
switch (property_id)
{
- case PROP_SELECTION_MODE:
- champlain_selection_layer_set_selection_mode (self, g_value_get_enum (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ case PROP_SELECTION_MODE:
+ champlain_selection_layer_set_selection_mode (self, g_value_get_enum (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
+
static void
champlain_selection_layer_dispose (GObject *object)
{
G_OBJECT_CLASS (champlain_selection_layer_parent_class)->dispose (object);
}
+
static void
champlain_selection_layer_finalize (GObject *object)
{
G_OBJECT_CLASS (champlain_selection_layer_parent_class)->finalize (object);
}
+
static void
champlain_selection_layer_class_init (ChamplainSelectionLayerClass *klass)
{
@@ -125,39 +132,39 @@ champlain_selection_layer_class_init (ChamplainSelectionLayerClass *klass)
object_class->set_property = champlain_selection_layer_set_property;
/**
- * ChamplainSelectionLayer:selection-mode:
- *
- * Determines the type of selection that will be performed.
- *
- * Since: 0.4
- */
+ * ChamplainSelectionLayer:selection-mode:
+ *
+ * Determines the type of selection that will be performed.
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_SELECTION_MODE,
g_param_spec_enum ("selection-mode",
- "Selection Mode",
- "Determines the type of selection that will be performed.",
- CHAMPLAIN_TYPE_SELECTION_MODE,
- CHAMPLAIN_SELECTION_SINGLE,
- CHAMPLAIN_PARAM_READWRITE));
+ "Selection Mode",
+ "Determines the type of selection that will be performed.",
+ CHAMPLAIN_TYPE_SELECTION_MODE,
+ CHAMPLAIN_SELECTION_SINGLE,
+ CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainSelectionLayer::changed
- *
- * The changed signal is emitted when the selected marker(s) change.
- *
- * Since: 0.4.1
- */
+ * ChamplainSelectionLayer::changed
+ *
+ * The changed signal is emitted when the selected marker(s) change.
+ *
+ * Since: 0.4.1
+ */
signals[CHANGED] =
- g_signal_new ("changed", G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+ g_signal_new ("changed", G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
}
+
static void
marker_select (ChamplainSelectionLayer *layer,
ChamplainBaseMarker *marker)
{
-
/* Add selection */
g_object_ref (marker);
g_object_set (marker, "highlighted", TRUE, NULL);
@@ -166,6 +173,7 @@ marker_select (ChamplainSelectionLayer *layer,
g_signal_emit_by_name (layer, "changed", NULL);
}
+
static void
api_select (ChamplainSelectionLayer *layer,
ChamplainBaseMarker *marker)
@@ -188,6 +196,7 @@ api_select (ChamplainSelectionLayer *layer,
marker_select (layer, marker);
}
+
static void
mouse_select (ChamplainSelectionLayer *layer,
ChamplainBaseMarker *marker,
@@ -219,12 +228,12 @@ mouse_select (ChamplainSelectionLayer *layer,
}
}
+
static gboolean
marker_clicked_cb (ClutterActor *actor,
ClutterButtonEvent *event,
gpointer user_data)
{
-
mouse_select (CHAMPLAIN_SELECTION_LAYER (user_data),
CHAMPLAIN_BASE_MARKER (actor),
(event->modifier_state & CLUTTER_CONTROL_MASK));
@@ -232,6 +241,7 @@ marker_clicked_cb (ClutterActor *actor,
return TRUE;
}
+
static void
layer_add_cb (ClutterGroup *layer,
ClutterActor *actor,
@@ -245,6 +255,7 @@ layer_add_cb (ClutterGroup *layer,
G_CALLBACK (marker_clicked_cb), layer);
}
+
static void
layer_remove_cb (ClutterGroup *layer,
ClutterActor *actor,
@@ -254,6 +265,7 @@ layer_remove_cb (ClutterGroup *layer,
G_CALLBACK (marker_clicked_cb), layer);
}
+
static void
champlain_selection_layer_init (ChamplainSelectionLayer *self)
{
@@ -267,6 +279,7 @@ champlain_selection_layer_init (ChamplainSelectionLayer *self)
G_CALLBACK (layer_remove_cb), NULL);
}
+
/**
* champlain_selection_layer_new:
*
@@ -282,6 +295,7 @@ champlain_selection_layer_new ()
return g_object_new (CHAMPLAIN_TYPE_SELECTION_LAYER, NULL);
}
+
/**
* champlain_selection_layer_get_selected:
* @layer: a #ChamplainSelectionLayer
@@ -304,6 +318,7 @@ champlain_selection_layer_get_selected (ChamplainSelectionLayer *layer)
return NULL;
}
+
/**
* champlain_selection_layer_get_selected_markers:
* @layer: a #ChamplainSelectionLayer
@@ -321,6 +336,7 @@ champlain_selection_layer_get_selected_markers (ChamplainSelectionLayer *layer)
return layer->priv->selection;
}
+
/**
* champlain_selection_layer_count_selected_markers:
* @layer: a #ChamplainSelectionLayer
@@ -339,6 +355,7 @@ champlain_selection_layer_count_selected_markers (ChamplainSelectionLayer *layer
return g_list_length (layer->priv->selection);
}
+
/**
* champlain_selection_layer_select:
* @layer: a #ChamplainSelectionLayer
@@ -358,6 +375,7 @@ champlain_selection_layer_select (ChamplainSelectionLayer *layer,
api_select (layer, marker);
}
+
/**
* champlain_selection_layer_unselect_all:
* @layer: a #ChamplainSelectionLayer
@@ -385,6 +403,7 @@ champlain_selection_layer_unselect_all (ChamplainSelectionLayer *layer)
g_signal_emit_by_name (layer, "changed", NULL);
}
+
/**
* champlain_selection_layer_select_all:
* @layer: a #ChamplainSelectionLayer
@@ -408,12 +427,12 @@ champlain_selection_layer_select_all (ChamplainSelectionLayer *layer)
if (layer->priv->mode == CHAMPLAIN_SELECTION_SINGLE)
return;
- n_children = clutter_group_get_n_children (CLUTTER_GROUP (layer) );
+ n_children = clutter_group_get_n_children (CLUTTER_GROUP (layer));
for (; i < n_children; ++i)
{
ClutterActor *actor = clutter_group_get_nth_child (
CLUTTER_GROUP (layer), i);
- if (CHAMPLAIN_IS_BASE_MARKER (actor) )
+ if (CHAMPLAIN_IS_BASE_MARKER (actor))
{
ChamplainBaseMarker *marker = CHAMPLAIN_BASE_MARKER (actor);
api_select (layer, marker);
@@ -421,6 +440,7 @@ champlain_selection_layer_select_all (ChamplainSelectionLayer *layer)
}
}
+
/**
* champlain_selection_layer_unselect:
* @layer: a #ChamplainSelectionLayer
@@ -451,6 +471,7 @@ champlain_selection_layer_unselect (ChamplainSelectionLayer *layer,
}
}
+
/**
* champlain_selection_layer_marker_is_selected:
* @layer: a #ChamplainSelectionLayer
@@ -475,6 +496,7 @@ champlain_selection_layer_marker_is_selected (ChamplainSelectionLayer *layer,
return selection != NULL;
}
+
/**
* champlain_selection_layer_set_selection_mode:
* @layer: a #ChamplainSelectionLayer
@@ -505,6 +527,7 @@ champlain_selection_layer_set_selection_mode (ChamplainSelectionLayer *layer,
g_object_notify (G_OBJECT (layer), "selection-mode");
}
+
/**
* champlain_selection_layer_get_selection_mode:
* @layer: a #ChamplainSelectionLayer
diff --git a/champlain/champlain-selection-layer.h b/champlain/champlain-selection-layer.h
index 89344e1..4e85616 100644
--- a/champlain/champlain-selection-layer.h
+++ b/champlain/champlain-selection-layer.h
@@ -32,7 +32,7 @@
G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_SELECTION_LAYER champlain_selection_layer_get_type()
+#define CHAMPLAIN_TYPE_SELECTION_LAYER champlain_selection_layer_get_type ()
#define CHAMPLAIN_SELECTION_LAYER(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_SELECTION_LAYER, ChamplainSelectionLayer))
@@ -59,30 +59,33 @@ typedef struct _ChamplainSelectionLayerPrivate ChamplainSelectionLayerPrivate;
*
* Selection mode
*/
-typedef enum {
+typedef enum
+{
CHAMPLAIN_SELECTION_NONE,
CHAMPLAIN_SELECTION_SINGLE,
CHAMPLAIN_SELECTION_MULTIPLE
} ChamplainSelectionMode;
-typedef struct _ChamplainSelectionLayer ChamplainSelectionLayer;
+typedef struct _ChamplainSelectionLayer ChamplainSelectionLayer;
typedef struct _ChamplainSelectionLayerClass ChamplainSelectionLayerClass;
-struct _ChamplainSelectionLayer {
+struct _ChamplainSelectionLayer
+{
ChamplainLayer parent;
ChamplainSelectionLayerPrivate *priv;
};
-struct _ChamplainSelectionLayerClass {
+struct _ChamplainSelectionLayerClass
+{
ChamplainLayerClass parent_class;
};
GType champlain_selection_layer_get_type (void);
-ChamplainLayer * champlain_selection_layer_new (void);
+ChamplainLayer *champlain_selection_layer_new (void);
-ChamplainBaseMarker * champlain_selection_layer_get_selected (ChamplainSelectionLayer *layer);
+ChamplainBaseMarker *champlain_selection_layer_get_selected (ChamplainSelectionLayer *layer);
const GList *champlain_selection_layer_get_selected_markers (ChamplainSelectionLayer *layer);
guint champlain_selection_layer_count_selected_markers (ChamplainSelectionLayer *layer);
diff --git a/champlain/champlain-tile-cache.c b/champlain/champlain-tile-cache.c
index 79706df..776a798 100644
--- a/champlain/champlain-tile-cache.c
+++ b/champlain/champlain-tile-cache.c
@@ -30,10 +30,10 @@
G_DEFINE_TYPE (ChamplainTileCache, champlain_tile_cache, CHAMPLAIN_TYPE_MAP_SOURCE)
#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_TILE_CACHE, ChamplainTileCachePrivate))
+ (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_TILE_CACHE, ChamplainTileCachePrivate))
-static const gchar *get_id (ChamplainMapSource *map_source);
+static const gchar *get_id (ChamplainMapSource * map_source);
static const gchar *get_name (ChamplainMapSource *map_source);
static const gchar *get_license (ChamplainMapSource *map_source);
static const gchar *get_license_uri (ChamplainMapSource *map_source);
@@ -49,22 +49,25 @@ champlain_tile_cache_dispose (GObject *object)
G_OBJECT_CLASS (champlain_tile_cache_parent_class)->dispose (object);
}
+
static void
champlain_tile_cache_finalize (GObject *object)
{
G_OBJECT_CLASS (champlain_tile_cache_parent_class)->finalize (object);
}
+
static void
-champlain_tile_cache_constructed (GObject *object)
+champlain_tile_cache_constructed (GObject *object)
{
G_OBJECT_CLASS (champlain_tile_cache_parent_class)->constructed (object);
}
+
static void
champlain_tile_cache_class_init (ChamplainTileCacheClass *klass)
{
- GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
ChamplainMapSourceClass *map_source_class = CHAMPLAIN_MAP_SOURCE_CLASS (klass);
ChamplainTileCacheClass *tile_cache_class = CHAMPLAIN_TILE_CACHE_CLASS (klass);
@@ -88,6 +91,7 @@ champlain_tile_cache_class_init (ChamplainTileCacheClass *klass)
tile_cache_class->store_tile = NULL;
}
+
static void
champlain_tile_cache_init (ChamplainTileCache *tile_cache)
{
@@ -116,6 +120,7 @@ champlain_tile_cache_store_tile (ChamplainTileCache *tile_cache,
CHAMPLAIN_TILE_CACHE_GET_CLASS (tile_cache)->store_tile (tile_cache, tile, contents, size);
}
+
/**
* champlain_tile_cache_refresh_tile_time:
* @tile_cache: a #ChamplainTileCache
@@ -134,6 +139,7 @@ champlain_tile_cache_refresh_tile_time (ChamplainTileCache *tile_cache,
CHAMPLAIN_TILE_CACHE_GET_CLASS (tile_cache)->refresh_tile_time (tile_cache, tile);
}
+
/**
* champlain_tile_cache_on_tile_filled:
* @tile_cache: a #ChamplainTileCache
@@ -158,6 +164,7 @@ champlain_tile_cache_on_tile_filled (ChamplainTileCache *tile_cache,
CHAMPLAIN_TILE_CACHE_GET_CLASS (tile_cache)->on_tile_filled (tile_cache, tile);
}
+
static const gchar *
get_id (ChamplainMapSource *map_source)
{
@@ -170,6 +177,7 @@ get_id (ChamplainMapSource *map_source)
return champlain_map_source_get_id (next_source);
}
+
static const gchar *
get_name (ChamplainMapSource *map_source)
{
@@ -182,6 +190,7 @@ get_name (ChamplainMapSource *map_source)
return champlain_map_source_get_name (next_source);
}
+
static const gchar *
get_license (ChamplainMapSource *map_source)
{
@@ -194,6 +203,7 @@ get_license (ChamplainMapSource *map_source)
return champlain_map_source_get_license (next_source);
}
+
static const gchar *
get_license_uri (ChamplainMapSource *map_source)
{
@@ -206,6 +216,7 @@ get_license_uri (ChamplainMapSource *map_source)
return champlain_map_source_get_license_uri (next_source);
}
+
static guint
get_min_zoom_level (ChamplainMapSource *map_source)
{
@@ -218,6 +229,7 @@ get_min_zoom_level (ChamplainMapSource *map_source)
return champlain_map_source_get_min_zoom_level (next_source);
}
+
static guint
get_max_zoom_level (ChamplainMapSource *map_source)
{
@@ -230,6 +242,7 @@ get_max_zoom_level (ChamplainMapSource *map_source)
return champlain_map_source_get_max_zoom_level (next_source);
}
+
static guint
get_tile_size (ChamplainMapSource *map_source)
{
@@ -242,6 +255,7 @@ get_tile_size (ChamplainMapSource *map_source)
return champlain_map_source_get_tile_size (next_source);
}
+
static ChamplainMapProjection
get_projection (ChamplainMapSource *map_source)
{
diff --git a/champlain/champlain-tile-cache.h b/champlain/champlain-tile-cache.h
index 50f7f86..dc61303 100644
--- a/champlain/champlain-tile-cache.h
+++ b/champlain/champlain-tile-cache.h
@@ -61,13 +61,13 @@ struct _ChamplainTileCacheClass
{
ChamplainMapSourceClass parent_class;
- void (*store_tile) (ChamplainTileCache *tile_cache,
+ void (*store_tile)(ChamplainTileCache *tile_cache,
ChamplainTile *tile,
const gchar *contents,
gsize size);
- void (*refresh_tile_time) (ChamplainTileCache *tile_cache,
+ void (*refresh_tile_time)(ChamplainTileCache *tile_cache,
ChamplainTile *tile);
- void (*on_tile_filled) (ChamplainTileCache *tile_cache,
+ void (*on_tile_filled)(ChamplainTileCache *tile_cache,
ChamplainTile *tile);
};
@@ -85,4 +85,3 @@ void champlain_tile_cache_on_tile_filled (ChamplainTileCache *tile_cache,
G_END_DECLS
#endif /* _CHAMPLAIN_TILE_CACHE_H_ */
-
diff --git a/champlain/champlain-tile-source.c b/champlain/champlain-tile-source.c
index 81e5c54..ab1630e 100644
--- a/champlain/champlain-tile-source.c
+++ b/champlain/champlain-tile-source.c
@@ -30,7 +30,7 @@
G_DEFINE_TYPE (ChamplainTileSource, champlain_tile_source, CHAMPLAIN_TYPE_MAP_SOURCE);
-#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_TILE_SOURCE, ChamplainTileSourcePrivate))
+#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_TILE_SOURCE, ChamplainTileSourcePrivate))
enum
{
@@ -81,35 +81,45 @@ champlain_tile_source_get_property (GObject *object,
case PROP_ID:
g_value_set_string (value, priv->id);
break;
+
case PROP_NAME:
g_value_set_string (value, priv->name);
break;
+
case PROP_LICENSE:
g_value_set_string (value, priv->license);
break;
+
case PROP_LICENSE_URI:
g_value_set_string (value, priv->license_uri);
break;
+
case PROP_MIN_ZOOM_LEVEL:
g_value_set_uint (value, priv->min_zoom_level);
break;
+
case PROP_MAX_ZOOM_LEVEL:
g_value_set_uint (value, priv->max_zoom_level);
break;
+
case PROP_TILE_SIZE:
g_value_set_uint (value, priv->tile_size);
break;
+
case PROP_MAP_PROJECTION:
g_value_set_enum (value, priv->map_projection);
break;
+
case PROP_CACHE:
g_value_set_object (value, priv->cache);
break;
+
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
+
static void
champlain_tile_source_set_property (GObject *object,
guint prop_id,
@@ -123,43 +133,53 @@ champlain_tile_source_set_property (GObject *object,
case PROP_ID:
champlain_tile_source_set_id (tile_source,
g_value_get_string (value));
+
case PROP_NAME:
champlain_tile_source_set_name (tile_source,
g_value_get_string (value));
break;
+
case PROP_LICENSE:
champlain_tile_source_set_license (tile_source,
g_value_get_string (value));
break;
+
case PROP_LICENSE_URI:
champlain_tile_source_set_license_uri (tile_source,
g_value_get_string (value));
break;
+
case PROP_MIN_ZOOM_LEVEL:
champlain_tile_source_set_min_zoom_level (tile_source,
g_value_get_uint (value));
break;
+
case PROP_MAX_ZOOM_LEVEL:
champlain_tile_source_set_max_zoom_level (tile_source,
g_value_get_uint (value));
break;
+
case PROP_TILE_SIZE:
champlain_tile_source_set_tile_size (tile_source,
g_value_get_uint (value));
break;
+
case PROP_MAP_PROJECTION:
champlain_tile_source_set_projection (tile_source,
g_value_get_enum (value));
break;
+
case PROP_CACHE:
champlain_tile_source_set_cache (tile_source,
g_value_get_object (value));
break;
+
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
+
static void
champlain_tile_source_dispose (GObject *object)
{
@@ -175,6 +195,7 @@ champlain_tile_source_dispose (GObject *object)
G_OBJECT_CLASS (champlain_tile_source_parent_class)->dispose (object);
}
+
static void
champlain_tile_source_finalize (GObject *object)
{
@@ -188,17 +209,19 @@ champlain_tile_source_finalize (GObject *object)
G_OBJECT_CLASS (champlain_tile_source_parent_class)->finalize (object);
}
+
static void
-champlain_tile_source_constructed (GObject *object)
+champlain_tile_source_constructed (GObject *object)
{
G_OBJECT_CLASS (champlain_tile_source_parent_class)->constructed (object);
}
+
static void
champlain_tile_source_class_init (ChamplainTileSourceClass *klass)
{
ChamplainMapSourceClass *map_source_class = CHAMPLAIN_MAP_SOURCE_CLASS (klass);
- GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (klass, sizeof (ChamplainTileSourcePrivate));
@@ -221,12 +244,12 @@ champlain_tile_source_class_init (ChamplainTileSourceClass *klass)
map_source_class->fill_tile = NULL;
/**
- * ChamplainTileSource:id:
- *
- * The name of the tile source
- *
- * Since: 0.4
- */
+ * ChamplainTileSource:id:
+ *
+ * The name of the tile source
+ *
+ * Since: 0.4
+ */
pspec = g_param_spec_string ("id",
"Id",
"The id of the tile source",
@@ -235,12 +258,12 @@ champlain_tile_source_class_init (ChamplainTileSourceClass *klass)
g_object_class_install_property (object_class, PROP_ID, pspec);
/**
- * ChamplainTileSource:name:
- *
- * The name of the tile source
- *
- * Since: 0.4
- */
+ * ChamplainTileSource:name:
+ *
+ * The name of the tile source
+ *
+ * Since: 0.4
+ */
pspec = g_param_spec_string ("name",
"Name",
"The name of the tile source",
@@ -249,12 +272,12 @@ champlain_tile_source_class_init (ChamplainTileSourceClass *klass)
g_object_class_install_property (object_class, PROP_NAME, pspec);
/**
- * ChamplainTileSource:license:
- *
- * The usage license of the tile source
- *
- * Since: 0.4
- */
+ * ChamplainTileSource:license:
+ *
+ * The usage license of the tile source
+ *
+ * Since: 0.4
+ */
pspec = g_param_spec_string ("license",
"License",
"The usage license of the tile source",
@@ -263,12 +286,12 @@ champlain_tile_source_class_init (ChamplainTileSourceClass *klass)
g_object_class_install_property (object_class, PROP_LICENSE, pspec);
/**
- * ChamplainTileSource:license-uri:
- *
- * The usage license's uri for more information
- *
- * Since: 0.4
- */
+ * ChamplainTileSource:license-uri:
+ *
+ * The usage license's uri for more information
+ *
+ * Since: 0.4
+ */
pspec = g_param_spec_string ("license-uri",
"License-uri",
"The usage license's uri for more information",
@@ -277,12 +300,12 @@ champlain_tile_source_class_init (ChamplainTileSourceClass *klass)
g_object_class_install_property (object_class, PROP_LICENSE_URI, pspec);
/**
- * ChamplainTileSource:min-zoom-level:
- *
- * The minimum zoom level
- *
- * Since: 0.4
- */
+ * ChamplainTileSource:min-zoom-level:
+ *
+ * The minimum zoom level
+ *
+ * Since: 0.4
+ */
pspec = g_param_spec_uint ("min-zoom-level",
"Minimum Zoom Level",
"The minimum zoom level",
@@ -293,12 +316,12 @@ champlain_tile_source_class_init (ChamplainTileSourceClass *klass)
g_object_class_install_property (object_class, PROP_MIN_ZOOM_LEVEL, pspec);
/**
- * ChamplainTileSource:max-zoom-level:
- *
- * The maximum zoom level
- *
- * Since: 0.4
- */
+ * ChamplainTileSource:max-zoom-level:
+ *
+ * The maximum zoom level
+ *
+ * Since: 0.4
+ */
pspec = g_param_spec_uint ("max-zoom-level",
"Maximum Zoom Level",
"The maximum zoom level",
@@ -309,12 +332,12 @@ champlain_tile_source_class_init (ChamplainTileSourceClass *klass)
g_object_class_install_property (object_class, PROP_MAX_ZOOM_LEVEL, pspec);
/**
- * ChamplainTileSource:tile-size:
- *
- * The tile size of the tile source
- *
- * Since: 0.4
- */
+ * ChamplainTileSource:tile-size:
+ *
+ * The tile size of the tile source
+ *
+ * Since: 0.4
+ */
pspec = g_param_spec_uint ("tile-size",
"Tile Size",
"The tile size",
@@ -325,12 +348,12 @@ champlain_tile_source_class_init (ChamplainTileSourceClass *klass)
g_object_class_install_property (object_class, PROP_TILE_SIZE, pspec);
/**
- * ChamplainTileSource:projection
- *
- * The map projection of the tile source
- *
- * Since: 0.4
- */
+ * ChamplainTileSource:projection
+ *
+ * The map projection of the tile source
+ *
+ * Since: 0.4
+ */
pspec = g_param_spec_enum ("projection",
"Projection",
"The map projection",
@@ -340,12 +363,12 @@ champlain_tile_source_class_init (ChamplainTileSourceClass *klass)
g_object_class_install_property (object_class, PROP_MAP_PROJECTION, pspec);
/**
- * ChamplainTileSource:cache
- *
- * The cache used for tile storage
- *
- * Since: 0.6
- */
+ * ChamplainTileSource:cache
+ *
+ * The cache used for tile storage
+ *
+ * Since: 0.6
+ */
pspec = g_param_spec_object ("cache",
"Cache",
"Cache used for tile sorage",
@@ -354,10 +377,11 @@ champlain_tile_source_class_init (ChamplainTileSourceClass *klass)
g_object_class_install_property (object_class, PROP_CACHE, pspec);
}
+
static void
champlain_tile_source_init (ChamplainTileSource *tile_source)
{
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(tile_source);
+ ChamplainTileSourcePrivate *priv = GET_PRIVATE (tile_source);
tile_source->priv = priv;
@@ -372,6 +396,7 @@ champlain_tile_source_init (ChamplainTileSource *tile_source)
priv->map_projection = CHAMPLAIN_MAP_PROJECTION_MERCATOR;
}
+
/**
* champlain_tile_source_get_cache:
* @tile_source: a #ChamplainTileSource
@@ -390,6 +415,7 @@ champlain_tile_source_get_cache (ChamplainTileSource *tile_source)
return tile_source->priv->cache;
}
+
/**
* champlain_tile_source_set_cache:
* @tile_source: a #ChamplainTileSource
@@ -422,6 +448,7 @@ champlain_tile_source_set_cache (ChamplainTileSource *tile_source,
g_object_notify (G_OBJECT (tile_source), "cache");
}
+
static const gchar *
get_id (ChamplainMapSource *map_source)
{
@@ -430,6 +457,7 @@ get_id (ChamplainMapSource *map_source)
return CHAMPLAIN_TILE_SOURCE (map_source)->priv->id;
}
+
static const gchar *
get_name (ChamplainMapSource *map_source)
{
@@ -438,6 +466,7 @@ get_name (ChamplainMapSource *map_source)
return CHAMPLAIN_TILE_SOURCE (map_source)->priv->name;
}
+
static const gchar *
get_license (ChamplainMapSource *map_source)
{
@@ -446,6 +475,7 @@ get_license (ChamplainMapSource *map_source)
return CHAMPLAIN_TILE_SOURCE (map_source)->priv->license;
}
+
static const gchar *
get_license_uri (ChamplainMapSource *map_source)
{
@@ -454,6 +484,7 @@ get_license_uri (ChamplainMapSource *map_source)
return CHAMPLAIN_TILE_SOURCE (map_source)->priv->license_uri;
}
+
static guint
get_min_zoom_level (ChamplainMapSource *map_source)
{
@@ -462,6 +493,7 @@ get_min_zoom_level (ChamplainMapSource *map_source)
return CHAMPLAIN_TILE_SOURCE (map_source)->priv->min_zoom_level;
}
+
static guint
get_max_zoom_level (ChamplainMapSource *map_source)
{
@@ -470,6 +502,7 @@ get_max_zoom_level (ChamplainMapSource *map_source)
return CHAMPLAIN_TILE_SOURCE (map_source)->priv->max_zoom_level;
}
+
static guint
get_tile_size (ChamplainMapSource *map_source)
{
@@ -478,6 +511,7 @@ get_tile_size (ChamplainMapSource *map_source)
return CHAMPLAIN_TILE_SOURCE (map_source)->priv->tile_size;
}
+
static ChamplainMapProjection
get_projection (ChamplainMapSource *map_source)
{
@@ -486,6 +520,7 @@ get_projection (ChamplainMapSource *map_source)
return CHAMPLAIN_TILE_SOURCE (map_source)->priv->map_projection;
}
+
/**
* champlain_tile_source_set_id:
* @tile_source: a #ChamplainTileSource
@@ -509,6 +544,7 @@ champlain_tile_source_set_id (ChamplainTileSource *tile_source,
g_object_notify (G_OBJECT (tile_source), "id");
}
+
/**
* champlain_tile_source_set_name:
* @tile_source: a #ChamplainTileSource
@@ -532,6 +568,7 @@ champlain_tile_source_set_name (ChamplainTileSource *tile_source,
g_object_notify (G_OBJECT (tile_source), "name");
}
+
/**
* champlain_tile_source_set_license:
* @tile_source: a #ChamplainTileSource
@@ -555,6 +592,7 @@ champlain_tile_source_set_license (ChamplainTileSource *tile_source,
g_object_notify (G_OBJECT (tile_source), "license");
}
+
/**
* champlain_tile_source_set_license_uri:
* @tile_source: a #ChamplainTileSource
@@ -578,6 +616,7 @@ champlain_tile_source_set_license_uri (ChamplainTileSource *tile_source,
g_object_notify (G_OBJECT (tile_source), "license-uri");
}
+
/**
* champlain_tile_source_set_min_zoom_level:
* @tile_source: a #ChamplainTileSource
@@ -598,6 +637,7 @@ champlain_tile_source_set_min_zoom_level (ChamplainTileSource *tile_source,
g_object_notify (G_OBJECT (tile_source), "min-zoom-level");
}
+
/**
* champlain_tile_source_set_max_zoom_level:
* @tile_source: a #ChamplainTileSource
@@ -618,6 +658,7 @@ champlain_tile_source_set_max_zoom_level (ChamplainTileSource *tile_source,
g_object_notify (G_OBJECT (tile_source), "max-zoom-level");
}
+
/**
* champlain_tile_source_set_tile_size:
* @tile_source: a #ChamplainTileSource
@@ -638,6 +679,7 @@ champlain_tile_source_set_tile_size (ChamplainTileSource *tile_source,
g_object_notify (G_OBJECT (tile_source), "tile-size");
}
+
/**
* champlain_tile_source_set_projection:
* @tile_source: a #ChamplainTileSource
diff --git a/champlain/champlain-tile.c b/champlain/champlain-tile.c
index 0846536..6ce39fa 100644
--- a/champlain/champlain-tile.c
+++ b/champlain/champlain-tile.c
@@ -62,7 +62,8 @@ enum
static guint champlain_tile_signals[LAST_SIGNAL] = { 0, };
-struct _ChamplainTilePrivate {
+struct _ChamplainTilePrivate
+{
gint x; /* The x position on the map (in pixels) */
gint y; /* The y position on the map (in pixels) */
gint size; /* The tile's width and height (only support square tiles */
@@ -73,7 +74,7 @@ struct _ChamplainTilePrivate {
gboolean fade_in;
GTimeVal *modified_time; /* The last modified time of the cache */
- gchar* etag; /* The HTTP ETag sent by the server */
+ gchar *etag; /* The HTTP ETag sent by the server */
};
static void
@@ -83,37 +84,47 @@ champlain_tile_get_property (GObject *object,
GParamSpec *pspec)
{
ChamplainTile *self = CHAMPLAIN_TILE (object);
+
switch (property_id)
{
- case PROP_X:
- g_value_set_int (value, champlain_tile_get_x (self));
- break;
- case PROP_Y:
- g_value_set_int (value, champlain_tile_get_y (self));
- break;
- case PROP_ZOOM_LEVEL:
- g_value_set_int (value, champlain_tile_get_zoom_level (self));
- break;
- case PROP_SIZE:
- g_value_set_uint (value, champlain_tile_get_size (self));
- break;
- case PROP_STATE:
- g_value_set_enum (value, champlain_tile_get_state (self));
- break;
- case PROP_CONTENT:
- g_value_set_object (value, champlain_tile_get_content (self));
- break;
- 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);
+ case PROP_X:
+ g_value_set_int (value, champlain_tile_get_x (self));
+ break;
+
+ case PROP_Y:
+ g_value_set_int (value, champlain_tile_get_y (self));
+ break;
+
+ case PROP_ZOOM_LEVEL:
+ g_value_set_int (value, champlain_tile_get_zoom_level (self));
+ break;
+
+ case PROP_SIZE:
+ g_value_set_uint (value, champlain_tile_get_size (self));
+ break;
+
+ case PROP_STATE:
+ g_value_set_enum (value, champlain_tile_get_state (self));
+ break;
+
+ case PROP_CONTENT:
+ g_value_set_object (value, champlain_tile_get_content (self));
+ break;
+
+ 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);
}
}
+
static void
champlain_tile_set_property (GObject *object,
guint property_id,
@@ -121,37 +132,47 @@ champlain_tile_set_property (GObject *object,
GParamSpec *pspec)
{
ChamplainTile *self = CHAMPLAIN_TILE (object);
+
switch (property_id)
{
- case PROP_X:
- champlain_tile_set_x (self, g_value_get_int (value));
- break;
- case PROP_Y:
- champlain_tile_set_y (self, g_value_get_int (value));
- break;
- case PROP_ZOOM_LEVEL:
- champlain_tile_set_zoom_level (self, g_value_get_int (value));
- break;
- case PROP_SIZE:
- champlain_tile_set_size (self, g_value_get_uint (value));
- break;
- case PROP_STATE:
- champlain_tile_set_state (self, g_value_get_enum (value));
- break;
- case PROP_CONTENT:
- 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);
+ case PROP_X:
+ champlain_tile_set_x (self, g_value_get_int (value));
+ break;
+
+ case PROP_Y:
+ champlain_tile_set_y (self, g_value_get_int (value));
+ break;
+
+ case PROP_ZOOM_LEVEL:
+ champlain_tile_set_zoom_level (self, g_value_get_int (value));
+ break;
+
+ case PROP_SIZE:
+ champlain_tile_set_size (self, g_value_get_uint (value));
+ break;
+
+ case PROP_STATE:
+ champlain_tile_set_state (self, g_value_get_enum (value));
+ break;
+
+ case PROP_CONTENT:
+ 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);
}
}
+
static void
champlain_tile_dispose (GObject *object)
{
@@ -166,6 +187,7 @@ champlain_tile_dispose (GObject *object)
G_OBJECT_CLASS (champlain_tile_parent_class)->dispose (object);
}
+
static void
champlain_tile_finalize (GObject *object)
{
@@ -177,6 +199,7 @@ champlain_tile_finalize (GObject *object)
G_OBJECT_CLASS (champlain_tile_parent_class)->finalize (object);
}
+
static void
champlain_tile_class_init (ChamplainTileClass *klass)
{
@@ -190,12 +213,12 @@ champlain_tile_class_init (ChamplainTileClass *klass)
object_class->finalize = champlain_tile_finalize;
/**
- * ChamplainTile:x:
- *
- * The x position of the tile
- *
- * Since: 0.4
- */
+ * ChamplainTile:x:
+ *
+ * The x position of the tile
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_X,
g_param_spec_int ("x",
@@ -207,12 +230,12 @@ champlain_tile_class_init (ChamplainTileClass *klass)
G_PARAM_READWRITE));
/**
- * ChamplainTile:y:
- *
- * The y position of the tile
- *
- * Since: 0.4
- */
+ * ChamplainTile:y:
+ *
+ * The y position of the tile
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_Y,
g_param_spec_int ("y",
@@ -224,12 +247,12 @@ champlain_tile_class_init (ChamplainTileClass *klass)
G_PARAM_READWRITE));
/**
- * ChamplainTile:zoom-level:
- *
- * The zoom level of the tile
- *
- * Since: 0.4
- */
+ * ChamplainTile:zoom-level:
+ *
+ * The zoom level of the tile
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_ZOOM_LEVEL,
g_param_spec_int ("zoom-level",
@@ -241,12 +264,12 @@ champlain_tile_class_init (ChamplainTileClass *klass)
G_PARAM_READWRITE));
/**
- * ChamplainTile:size:
- *
- * The size of the tile in pixels
- *
- * Since: 0.4
- */
+ * ChamplainTile:size:
+ *
+ * The size of the tile in pixels
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_SIZE,
g_param_spec_uint ("size",
@@ -258,12 +281,12 @@ champlain_tile_class_init (ChamplainTileClass *klass)
G_PARAM_READWRITE));
/**
- * ChamplainTile:state:
- *
- * The state of the tile
- *
- * Since: 0.4
- */
+ * ChamplainTile:state:
+ *
+ * The state of the tile
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_STATE,
g_param_spec_enum ("state",
@@ -274,13 +297,13 @@ champlain_tile_class_init (ChamplainTileClass *klass)
G_PARAM_READWRITE));
/**
- * ChamplainTile:content:
- *
- * The #ClutterActor with the specific image content. When changing this
- * property, the new actor will be faded in.
- *
- * Since: 0.4
- */
+ * ChamplainTile:content:
+ *
+ * The #ClutterActor with the specific image content. When changing this
+ * property, the new actor will be faded in.
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_CONTENT,
g_param_spec_object ("content",
@@ -290,14 +313,14 @@ champlain_tile_class_init (ChamplainTileClass *klass)
G_PARAM_READWRITE));
/**
- * ChamplainTile:etag:
- *
- * The tile's ETag. This information is sent by some web servers as a mean
- * to identify if a tile has changed. This information is saved in the cache
- * and sent in GET queries.
- *
- * Since: 0.4
- */
+ * ChamplainTile:etag:
+ *
+ * The tile's ETag. This information is sent by some web servers as a mean
+ * to identify if a tile has changed. This information is saved in the cache
+ * and sent in GET queries.
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_ETAG,
g_param_spec_string ("etag",
@@ -307,12 +330,12 @@ champlain_tile_class_init (ChamplainTileClass *klass)
G_PARAM_READWRITE));
/**
- * ChamplainTile:fade-in:
- *
- * Specifies whether the tile should fade in when loading
- *
- * Since: 0.6
- */
+ * 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",
@@ -323,11 +346,12 @@ champlain_tile_class_init (ChamplainTileClass *klass)
champlain_tile_signals[RENDER_COMPLETE] =
g_signal_new ("render-complete", G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE,
- 1, G_TYPE_POINTER);
+ G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE,
+ 1, G_TYPE_POINTER);
}
+
static void
champlain_tile_init (ChamplainTile *self)
{
@@ -347,6 +371,7 @@ champlain_tile_init (ChamplainTile *self)
priv->content_actor = NULL;
}
+
/**
* champlain_tile_new:
*
@@ -356,12 +381,13 @@ champlain_tile_init (ChamplainTile *self)
*
* Since: 0.4
*/
-ChamplainTile*
+ChamplainTile *
champlain_tile_new (void)
{
return g_object_new (CHAMPLAIN_TYPE_TILE, NULL);
}
+
/**
* champlain_tile_get_x:
* @self: the #ChamplainTile
@@ -380,6 +406,7 @@ champlain_tile_get_x (ChamplainTile *self)
return self->priv->x;
}
+
/**
* champlain_tile_get_y:
* @self: the #ChamplainTile
@@ -398,6 +425,7 @@ champlain_tile_get_y (ChamplainTile *self)
return self->priv->y;
}
+
/**
* champlain_tile_get_zoom_level:
* @self: the #ChamplainTile
@@ -416,6 +444,7 @@ champlain_tile_get_zoom_level (ChamplainTile *self)
return self->priv->zoom_level;
}
+
/**
* champlain_tile_get_size:
* @self: the #ChamplainTile
@@ -434,6 +463,7 @@ champlain_tile_get_size (ChamplainTile *self)
return self->priv->size;
}
+
/**
* champlain_tile_get_state:
* @self: the #ChamplainTile
@@ -452,6 +482,7 @@ champlain_tile_get_state (ChamplainTile *self)
return self->priv->state;
}
+
/**
* champlain_tile_set_x:
* @self: the #ChamplainTile
@@ -472,6 +503,7 @@ champlain_tile_set_x (ChamplainTile *self,
g_object_notify (G_OBJECT (self), "x");
}
+
/**
* champlain_tile_set_y:
* @self: the #ChamplainTile
@@ -492,6 +524,7 @@ champlain_tile_set_y (ChamplainTile *self,
g_object_notify (G_OBJECT (self), "y");
}
+
/**
* champlain_tile_set_zoom_level:
* @self: the #ChamplainTile
@@ -512,6 +545,7 @@ champlain_tile_set_zoom_level (ChamplainTile *self,
g_object_notify (G_OBJECT (self), "zoom-level");
}
+
/**
* champlain_tile_set_size:
* @self: the #ChamplainTile
@@ -532,6 +566,7 @@ champlain_tile_set_size (ChamplainTile *self,
g_object_notify (G_OBJECT (self), "size");
}
+
/**
* champlain_tile_set_state:
* @self: the #ChamplainTile
@@ -556,6 +591,7 @@ champlain_tile_set_state (ChamplainTile *self,
g_object_notify (G_OBJECT (self), "state");
}
+
/**
* champlain_tile_new_full:
* @x: the x position
@@ -569,7 +605,7 @@ champlain_tile_set_state (ChamplainTile *self,
*
* Since: 0.4
*/
-ChamplainTile*
+ChamplainTile *
champlain_tile_new_full (gint x,
gint y,
guint size,
@@ -579,6 +615,7 @@ champlain_tile_new_full (gint x,
zoom_level, "size", size, NULL);
}
+
/**
* champlain_tile_get_modified_time:
* @self: the #ChamplainTile
@@ -597,6 +634,7 @@ champlain_tile_get_modified_time (ChamplainTile *self)
return self->priv->modified_time;
}
+
/**
* champlain_tile_set_modified_time:
* @self: the #ChamplainTile
@@ -616,9 +654,10 @@ champlain_tile_set_modified_time (ChamplainTile *self,
ChamplainTilePrivate *priv = self->priv;
g_free (priv->modified_time);
- priv->modified_time = g_memdup(time_, sizeof (GTimeVal));
+ priv->modified_time = g_memdup (time_, sizeof (GTimeVal));
}
+
/**
* champlain_tile_get_etag:
* @self: the #ChamplainTile
@@ -637,6 +676,7 @@ champlain_tile_get_etag (ChamplainTile *self)
return self->priv->etag;
}
+
/**
* champlain_tile_set_etag:
* @self: the #ChamplainTile
@@ -659,6 +699,7 @@ champlain_tile_set_etag (ChamplainTile *self,
g_object_notify (G_OBJECT (self), "etag");
}
+
/**
* champlain_tile_set_content:
* @self: the #ChamplainTile
@@ -751,6 +792,7 @@ champlain_tile_get_content (ChamplainTile *self)
return self->priv->content_actor;
}
+
/**
* champlain_tile_get_fade_in:
* @self: the #ChamplainTile
@@ -769,6 +811,7 @@ champlain_tile_get_fade_in (ChamplainTile *self)
return self->priv->fade_in;
}
+
/**
* champlain_tile_set_fade_in:
* @self: the #ChamplainTile
diff --git a/champlain/champlain-tile.h b/champlain/champlain-tile.h
index d2cc66e..9a875aa 100644
--- a/champlain/champlain-tile.h
+++ b/champlain/champlain-tile.h
@@ -27,7 +27,7 @@
G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_TILE champlain_tile_get_type()
+#define CHAMPLAIN_TYPE_TILE champlain_tile_get_type ()
#define CHAMPLAIN_TILE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_TILE, ChamplainTile))
@@ -62,16 +62,18 @@ typedef enum
CHAMPLAIN_STATE_DONE
} ChamplainState;
-typedef struct _ChamplainTile ChamplainTile;
-typedef struct _ChamplainTileClass ChamplainTileClass;
+typedef struct _ChamplainTile ChamplainTile;
+typedef struct _ChamplainTileClass ChamplainTileClass;
-struct _ChamplainTile {
+struct _ChamplainTile
+{
ClutterGroup parent;
ChamplainTilePrivate *priv;
};
-struct _ChamplainTileClass {
+struct _ChamplainTileClass
+{
ClutterGroupClass parent_class;
};
@@ -88,8 +90,8 @@ struct _ChamplainRenderCallbackData
GType champlain_tile_get_type (void);
-ChamplainTile* champlain_tile_new (void);
-ChamplainTile* champlain_tile_new_full (gint x,
+ChamplainTile *champlain_tile_new (void);
+ChamplainTile *champlain_tile_new_full (gint x,
gint y,
guint size,
gint zoom_level);
@@ -99,9 +101,9 @@ gint champlain_tile_get_y (ChamplainTile *self);
gint champlain_tile_get_zoom_level (ChamplainTile *self);
guint champlain_tile_get_size (ChamplainTile *self);
ChamplainState champlain_tile_get_state (ChamplainTile *self);
-ClutterActor * champlain_tile_get_content (ChamplainTile *self);
-const GTimeVal * champlain_tile_get_modified_time (ChamplainTile *self);
-const gchar * champlain_tile_get_etag (ChamplainTile *self);
+ClutterActor *champlain_tile_get_content (ChamplainTile *self);
+const GTimeVal *champlain_tile_get_modified_time (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,
@@ -115,7 +117,7 @@ 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);
+ ClutterActor *actor);
void champlain_tile_set_etag (ChamplainTile *self,
const gchar *etag);
void champlain_tile_set_modified_time (ChamplainTile *self,
@@ -128,4 +130,3 @@ void champlain_tile_display_content (ChamplainTile *self);
G_END_DECLS
#endif /* CHAMPLAIN_MAP_TILE_H */
-
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 38c5f01..470ae52 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -72,9 +72,9 @@
#include <tidy-scrollable.h>
#include <tidy-viewport.h>
-//#define VIEW_LOG
+/* #define VIEW_LOG */
#ifdef VIEW_LOG
-#define DEBUG_LOG() g_print("%s\n", __FUNCTION__);
+#define DEBUG_LOG() g_print ("%s\n", __FUNCTION__);
#else
#define DEBUG_LOG()
#endif
@@ -124,7 +124,8 @@ static guint signals[LAST_SIGNAL] = { 0, };
#define CHAMPLAIN_MAX_LONG 180
/* Between state values for go_to */
-typedef struct {
+typedef struct
+{
ChamplainView *view;
ClutterAlpha *alpha;
ClutterTimeline *timeline;
@@ -134,12 +135,14 @@ typedef struct {
gdouble from_longitude;
} GoToContext;
-typedef struct {
+typedef struct
+{
ChamplainView *view;
ChamplainPolygon *polygon;
} PolygonRedrawContext;
-typedef struct {
+typedef struct
+{
ChamplainTile *tile;
ChamplainMapSource *map_source;
} FillTileCallbackData;
@@ -246,11 +249,12 @@ static gboolean finger_scroll_button_press_cb (ClutterActor *actor,
static void update_license (ChamplainView *view);
static void update_scale (ChamplainView *view);
static void view_load_visible_tiles (ChamplainView *view);
-static void view_position_tile (ChamplainView* view,
- ChamplainTile* tile);
+static void view_position_tile (ChamplainView *view,
+ ChamplainTile *tile);
static void view_reload_tiles_cb (ChamplainMapSource *map_source,
- ChamplainView* view);
-static void view_update_state (ChamplainView *view, ChamplainTile *tile);
+ ChamplainView *view);
+static void view_update_state (ChamplainView *view,
+ ChamplainTile *tile);
static void view_update_anchor (ChamplainView *view,
gint x,
gint y);
@@ -283,7 +287,7 @@ static gdouble
viewport_get_longitude_at (ChamplainViewPrivate *priv,
gint x)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
if (!priv->map_source)
return 0.0;
@@ -292,20 +296,22 @@ viewport_get_longitude_at (ChamplainViewPrivate *priv,
priv->zoom_level, x);
}
+
static gdouble
viewport_get_current_longitude (ChamplainViewPrivate *priv)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
return viewport_get_longitude_at (priv, priv->anchor.x +
priv->viewport_size.x + priv->viewport_size.width / 2.0);
}
+
static gdouble
viewport_get_latitude_at (ChamplainViewPrivate *priv,
gint y)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
if (!priv->map_source)
return 0.0;
@@ -314,23 +320,25 @@ viewport_get_latitude_at (ChamplainViewPrivate *priv,
priv->zoom_level, y);
}
+
static gdouble
viewport_get_current_latitude (ChamplainViewPrivate *priv)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
return viewport_get_latitude_at (priv,
priv->anchor.y + priv->viewport_size.y +
priv->viewport_size.height / 2.0);
}
+
/* Updates the internals after the viewport changed */
static void
update_viewport (ChamplainView *view,
gfloat x,
gfloat y)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
gfloat old_lat, old_lon;
@@ -353,13 +361,12 @@ update_viewport (ChamplainView *view,
diff.x = priv->anchor.x - old_anchor.x;
diff.y = priv->anchor.y - old_anchor.y;
- DEBUG("Relocating the viewport by %f, %f", diff.x, diff.y);
+ DEBUG ("Relocating the viewport by %f, %f", diff.x, diff.y);
g_signal_handlers_block_by_func (priv->viewport, G_CALLBACK (viewport_pos_changed_cb), view);
tidy_viewport_set_origin (TIDY_VIEWPORT (priv->viewport),
x - diff.x, y - diff.y, 0);
g_signal_handlers_unblock_by_func (priv->viewport, G_CALLBACK (viewport_pos_changed_cb), view);
- // return;
}
priv->viewport_size.x = x;
@@ -380,11 +387,12 @@ update_viewport (ChamplainView *view,
g_object_notify (G_OBJECT (view), "latitude");
}
+
static void
panning_completed (G_GNUC_UNUSED TidyFingerScroll *scroll,
ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
gfloat x, y;
@@ -394,12 +402,13 @@ panning_completed (G_GNUC_UNUSED TidyFingerScroll *scroll,
update_viewport (view, x, y);
}
+
static gboolean
scroll_event (G_GNUC_UNUSED ClutterActor *actor,
ClutterScrollEvent *event,
ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
@@ -413,11 +422,12 @@ scroll_event (G_GNUC_UNUSED ClutterActor *actor,
return view_set_zoom_level_at (view, zoom_level, event->x, event->y);
}
+
static void
marker_reposition_cb (ChamplainMarker *marker,
ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
ChamplainBaseMarker *base_marker = CHAMPLAIN_BASE_MARKER (marker);
@@ -425,65 +435,70 @@ marker_reposition_cb (ChamplainMarker *marker,
gint x, y;
x = champlain_map_source_get_x (priv->map_source, priv->zoom_level,
- champlain_base_marker_get_longitude (base_marker));
+ champlain_base_marker_get_longitude (base_marker));
y = champlain_map_source_get_y (priv->map_source, priv->zoom_level,
- champlain_base_marker_get_latitude (base_marker));
+ champlain_base_marker_get_latitude (base_marker));
clutter_actor_set_position (CLUTTER_ACTOR (marker),
- x - priv->anchor.x,
- y - priv->anchor.y);
+ x - priv->anchor.x,
+ y - priv->anchor.y);
}
+
static void
notify_marker_reposition_cb (ChamplainMarker *marker,
G_GNUC_UNUSED GParamSpec *arg1,
ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
marker_reposition_cb (marker, view);
}
+
static void
layer_add_marker_cb (G_GNUC_UNUSED ClutterGroup *layer,
ChamplainMarker *marker,
ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_signal_connect (marker, "notify::longitude",
G_CALLBACK (notify_marker_reposition_cb), view);
g_idle_add_full (G_PRIORITY_DEFAULT,
- (GSourceFunc)marker_reposition,
- g_object_ref (view),
- (GDestroyNotify)g_object_unref);
+ (GSourceFunc) marker_reposition,
+ g_object_ref (view),
+ (GDestroyNotify) g_object_unref);
}
+
static void
connect_marker_notify_cb (ChamplainMarker *marker,
ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_signal_connect (marker, "notify::longitude",
G_CALLBACK (notify_marker_reposition_cb), view);
}
+
static void
layer_reposition_cb (ClutterActor *layer,
ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
clutter_container_foreach (CLUTTER_CONTAINER (layer),
CLUTTER_CALLBACK (marker_reposition_cb), view);
}
+
static gboolean
marker_reposition (gpointer data)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainView *view = CHAMPLAIN_VIEW (data);
clutter_container_foreach (CLUTTER_CONTAINER (view->priv->user_layers),
@@ -491,10 +506,11 @@ marker_reposition (gpointer data)
return FALSE;
}
+
static gboolean
redraw_polygon_on_idle (PolygonRedrawContext *ctx)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = ctx->view->priv;
@@ -509,16 +525,17 @@ redraw_polygon_on_idle (PolygonRedrawContext *ctx)
g_object_unref (ctx->view);
g_object_unref (ctx->polygon);
- // ctx is freed by g_idle_add_full
+ /* ctx is freed by g_idle_add_full */
return FALSE;
}
+
static void
notify_polygon_cb (ChamplainPolygon *polygon,
G_GNUC_UNUSED GParamSpec *arg1,
ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
PolygonRedrawContext *ctx;
@@ -531,13 +548,14 @@ notify_polygon_cb (ChamplainPolygon *polygon,
ctx->polygon = g_object_ref (polygon);
priv->polygon_redraw_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
- (GSourceFunc) redraw_polygon_on_idle, ctx, g_free);
+ (GSourceFunc) redraw_polygon_on_idle, ctx, g_free);
}
+
static void
resize_viewport (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
gdouble lower, upper;
gint i;
@@ -552,8 +570,8 @@ resize_viewport (ChamplainView *view)
{
lower = -priv->viewport_size.width / 2.0;
upper = champlain_map_source_get_column_count (priv->map_source, priv->zoom_level) *
- champlain_map_source_get_tile_size (priv->map_source) -
- priv->viewport_size.width / 2.0;
+ champlain_map_source_get_tile_size (priv->map_source) -
+ priv->viewport_size.width / 2.0;
}
else
{
@@ -561,10 +579,12 @@ resize_viewport (ChamplainView *view)
upper = G_MAXINT16;
}
- /* block emmision of signal by priv->viewport with viewport_pos_changed_cb()
- callback - the signal can be emitted by updating TidyAdjustment, but
- calling the callback now would be a disaster since we don't have updated
- anchor yet*/
+ /*
+ * block emmision of signal by priv->viewport with viewport_pos_changed_cb()
+ * callback - the signal can be emitted by updating TidyAdjustment, but
+ * calling the callback now would be a disaster since we don't have updated
+ * anchor yet
+ */
g_signal_handlers_block_by_func (priv->viewport, G_CALLBACK (viewport_pos_changed_cb), view);
g_object_set (hadjust, "lower", lower, "upper", upper,
@@ -574,8 +594,8 @@ resize_viewport (ChamplainView *view)
{
lower = -priv->viewport_size.height / 2.0;
upper = champlain_map_source_get_row_count (priv->map_source, priv->zoom_level) *
- champlain_map_source_get_tile_size (priv->map_source) -
- priv->viewport_size.height / 2.0;
+ champlain_map_source_get_tile_size (priv->map_source) -
+ priv->viewport_size.height / 2.0;
}
else
{
@@ -599,152 +619,186 @@ resize_viewport (ChamplainView *view)
clutter_actor_set_position (CLUTTER_ACTOR (polygon), 0, 0);
champlain_polygon_draw_polygon (polygon, priv->map_source, priv->zoom_level,
- priv->viewport_size.width, priv->viewport_size.height,
- priv->viewport_size.x + priv->anchor.x, priv->viewport_size.y + priv->anchor.y);
+ priv->viewport_size.width, priv->viewport_size.height,
+ priv->viewport_size.x + priv->anchor.x, priv->viewport_size.y + priv->anchor.y);
}
}
+
static void
champlain_view_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainView *view = CHAMPLAIN_VIEW (object);
ChamplainViewPrivate *priv = view->priv;
switch (prop_id)
{
- case PROP_LONGITUDE:
- g_value_set_double (value,
- CLAMP (priv->longitude, CHAMPLAIN_MIN_LONG, CHAMPLAIN_MAX_LONG));
- break;
- case PROP_LATITUDE:
- g_value_set_double (value,
- CLAMP (priv->latitude, CHAMPLAIN_MIN_LAT, CHAMPLAIN_MAX_LAT));
- break;
- case PROP_ZOOM_LEVEL:
- g_value_set_int (value, priv->zoom_level);
- break;
- case PROP_MIN_ZOOM_LEVEL:
- g_value_set_int (value, priv->min_zoom_level);
- break;
- case PROP_MAX_ZOOM_LEVEL:
- g_value_set_int (value, priv->max_zoom_level);
- break;
- case PROP_MAP_SOURCE:
- g_value_set_object (value, priv->map_source);
- break;
- case PROP_SCROLL_MODE:
- g_value_set_enum (value, priv->scroll_mode);
- break;
- case PROP_SHOW_SCALE:
- g_value_set_boolean (value, priv->show_scale);
- break;
- case PROP_MAX_SCALE_WIDTH:
- g_value_set_uint (value, priv->max_scale_width);
- break;
- case PROP_SCALE_UNIT:
- g_value_set_enum (value, priv->scale_unit);
- break;
- case PROP_DECEL_RATE:
- {
- gdouble decel = 0.0;
- g_object_get (priv->finger_scroll, "decel-rate", &decel, NULL);
- g_value_set_double (value, decel);
- break;
- }
- case PROP_KEEP_CENTER_ON_RESIZE:
- g_value_set_boolean (value, priv->keep_center_on_resize);
- break;
- case PROP_SHOW_LICENSE:
- g_value_set_boolean (value, priv->show_license);
- break;
- case PROP_LICENSE_EXTRA:
- g_value_set_string (value, priv->license_text);
- break;
- case PROP_ZOOM_ON_DOUBLE_CLICK:
- g_value_set_boolean (value, priv->zoom_on_double_click);
- break;
- case PROP_STATE:
- g_value_set_enum (value, priv->state);
+ case PROP_LONGITUDE:
+ g_value_set_double (value,
+ CLAMP (priv->longitude, CHAMPLAIN_MIN_LONG, CHAMPLAIN_MAX_LONG));
+ break;
+
+ case PROP_LATITUDE:
+ g_value_set_double (value,
+ CLAMP (priv->latitude, CHAMPLAIN_MIN_LAT, CHAMPLAIN_MAX_LAT));
+ break;
+
+ case PROP_ZOOM_LEVEL:
+ g_value_set_int (value, priv->zoom_level);
+ break;
+
+ case PROP_MIN_ZOOM_LEVEL:
+ g_value_set_int (value, priv->min_zoom_level);
+ break;
+
+ case PROP_MAX_ZOOM_LEVEL:
+ g_value_set_int (value, priv->max_zoom_level);
+ break;
+
+ case PROP_MAP_SOURCE:
+ g_value_set_object (value, priv->map_source);
+ break;
+
+ case PROP_SCROLL_MODE:
+ g_value_set_enum (value, priv->scroll_mode);
+ break;
+
+ case PROP_SHOW_SCALE:
+ g_value_set_boolean (value, priv->show_scale);
+ break;
+
+ case PROP_MAX_SCALE_WIDTH:
+ g_value_set_uint (value, priv->max_scale_width);
+ break;
+
+ case PROP_SCALE_UNIT:
+ g_value_set_enum (value, priv->scale_unit);
+ break;
+
+ case PROP_DECEL_RATE:
+ {
+ gdouble decel = 0.0;
+ g_object_get (priv->finger_scroll, "decel-rate", &decel, NULL);
+ g_value_set_double (value, decel);
break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+
+ case PROP_KEEP_CENTER_ON_RESIZE:
+ g_value_set_boolean (value, priv->keep_center_on_resize);
+ break;
+
+ case PROP_SHOW_LICENSE:
+ g_value_set_boolean (value, priv->show_license);
+ break;
+
+ case PROP_LICENSE_EXTRA:
+ g_value_set_string (value, priv->license_text);
+ break;
+
+ case PROP_ZOOM_ON_DOUBLE_CLICK:
+ g_value_set_boolean (value, priv->zoom_on_double_click);
+ break;
+
+ case PROP_STATE:
+ g_value_set_enum (value, priv->state);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
+
static void
champlain_view_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainView *view = CHAMPLAIN_VIEW (object);
ChamplainViewPrivate *priv = view->priv;
switch (prop_id)
- {
+ {
case PROP_LONGITUDE:
champlain_view_center_on (view, priv->latitude,
g_value_get_double (value));
break;
+
case PROP_LATITUDE:
champlain_view_center_on (view, g_value_get_double (value),
priv->longitude);
break;
+
case PROP_ZOOM_LEVEL:
champlain_view_set_zoom_level (view, g_value_get_int (value));
break;
+
case PROP_MIN_ZOOM_LEVEL:
champlain_view_set_min_zoom_level (view, g_value_get_int (value));
break;
+
case PROP_MAX_ZOOM_LEVEL:
champlain_view_set_max_zoom_level (view, g_value_get_int (value));
break;
+
case PROP_MAP_SOURCE:
champlain_view_set_map_source (view, g_value_get_object (value));
break;
+
case PROP_SCROLL_MODE:
champlain_view_set_scroll_mode (view, g_value_get_enum (value));
break;
+
case PROP_SHOW_SCALE:
champlain_view_set_show_scale (view, g_value_get_boolean (value));
break;
+
case PROP_MAX_SCALE_WIDTH:
champlain_view_set_max_scale_width (view, g_value_get_uint (value));
break;
+
case PROP_SCALE_UNIT:
champlain_view_set_scale_unit (view, g_value_get_enum (value));
break;
+
case PROP_DECEL_RATE:
champlain_view_set_decel_rate (view, g_value_get_double (value));
break;
+
case PROP_KEEP_CENTER_ON_RESIZE:
champlain_view_set_keep_center_on_resize (view, g_value_get_boolean (value));
break;
+
case PROP_SHOW_LICENSE:
champlain_view_set_show_license (view, g_value_get_boolean (value));
break;
+
case PROP_LICENSE_EXTRA:
champlain_view_set_license_text (view, g_value_get_string (value));
break;
+
case PROP_ZOOM_ON_DOUBLE_CLICK:
champlain_view_set_zoom_on_double_click (view, g_value_get_boolean (value));
break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- }
+ }
}
+
static void
champlain_view_dispose (GObject *object)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainView *view = CHAMPLAIN_VIEW (object);
ChamplainViewPrivate *priv = view->priv;
@@ -819,24 +873,26 @@ champlain_view_dispose (GObject *object)
G_OBJECT_CLASS (champlain_view_parent_class)->dispose (object);
}
+
static void
champlain_view_finalize (GObject *object)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
G_OBJECT_CLASS (champlain_view_parent_class)->finalize (object);
}
+
static gboolean
_update_idle_cb (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
clutter_actor_set_size (priv->finger_scroll,
- priv->viewport_size.width,
- priv->viewport_size.height);
+ priv->viewport_size.width,
+ priv->viewport_size.height);
resize_viewport (view);
@@ -855,12 +911,13 @@ _update_idle_cb (ChamplainView *view)
return FALSE;
}
+
static void
champlain_view_allocate (ClutterActor *actor,
const ClutterActorBox *box,
ClutterAllocationFlags flags)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainView *view = CHAMPLAIN_VIEW (actor);
ChamplainViewPrivate *priv = view->priv;
@@ -879,28 +936,29 @@ champlain_view_allocate (ClutterActor *actor,
priv->viewport_size.height = height;
g_idle_add_full (G_PRIORITY_HIGH_IDLE,
- (GSourceFunc)_update_idle_cb,
- g_object_ref (view),
- (GDestroyNotify)g_object_unref);
+ (GSourceFunc) _update_idle_cb,
+ g_object_ref (view),
+ (GDestroyNotify) g_object_unref);
}
+
static void
champlain_view_realize (ClutterActor *actor)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainView *view = CHAMPLAIN_VIEW (actor);
ChamplainViewPrivate *priv = view->priv;
/*
- We should be calling this but it segfaults
- CLUTTER_ACTOR_CLASS (champlain_view_parent_class)->realize (actor);
- ClutterStage uses clutter_actor_realize.
+ * We should be calling this but it segfaults
+ * CLUTTER_ACTOR_CLASS (champlain_view_parent_class)->realize (actor);
+ * ClutterStage uses clutter_actor_realize.
*/
clutter_actor_realize (actor);
/* Setup the viewport according to the zoom level */
- //resize_viewport (view);
+ /* resize_viewport (view); */
g_object_notify (G_OBJECT (view), "zoom-level");
g_object_notify (G_OBJECT (view), "map-source");
@@ -912,6 +970,7 @@ champlain_view_realize (ClutterActor *actor)
update_license (view);
}
+
/* These return fixed sizes because either a.) We expect the user to size
* explicitly with clutter_actor_get_size or b.) place it in a container that
* allocates it whatever it wants.
@@ -922,7 +981,7 @@ champlain_view_get_preferred_width (ClutterActor *actor,
gfloat *min_width,
gfloat *nat_width)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainView *view = CHAMPLAIN_VIEW (actor);
gint width = champlain_map_source_get_tile_size (view->priv->map_source);
@@ -934,13 +993,14 @@ champlain_view_get_preferred_width (ClutterActor *actor,
*nat_width = width;
}
+
static void
champlain_view_get_preferred_height (ClutterActor *actor,
G_GNUC_UNUSED gfloat for_width,
gfloat *min_height,
gfloat *nat_height)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainView *view = CHAMPLAIN_VIEW (actor);
gint height = champlain_map_source_get_tile_size (view->priv->map_source);
@@ -952,10 +1012,11 @@ champlain_view_get_preferred_height (ClutterActor *actor,
*nat_height = height;
}
+
static void
champlain_view_class_init (ChamplainViewClass *champlainViewClass)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_type_class_add_private (champlainViewClass, sizeof (ChamplainViewPrivate));
@@ -972,270 +1033,270 @@ champlain_view_class_init (ChamplainViewClass *champlainViewClass)
actor_class->realize = champlain_view_realize;
/**
- * ChamplainView:longitude:
- *
- * The longitude coordonate of the map
- *
- * Since: 0.1
- */
+ * ChamplainView:longitude:
+ *
+ * The longitude coordonate of the map
+ *
+ * Since: 0.1
+ */
g_object_class_install_property (object_class,
PROP_LONGITUDE,
g_param_spec_double ("longitude",
- "Longitude",
- "The longitude coordonate of the map",
- -180.0f, 180.0f, 0.0f, CHAMPLAIN_PARAM_READWRITE));
+ "Longitude",
+ "The longitude coordonate of the map",
+ -180.0f, 180.0f, 0.0f, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainView:latitude:
- *
- * The latitude coordonate of the map
- *
- * Since: 0.1
- */
+ * ChamplainView:latitude:
+ *
+ * The latitude coordonate of the map
+ *
+ * Since: 0.1
+ */
g_object_class_install_property (object_class,
PROP_LATITUDE,
g_param_spec_double ("latitude",
- "Latitude",
- "The latitude coordonate of the map",
- -90.0f, 90.0f, 0.0f, CHAMPLAIN_PARAM_READWRITE));
+ "Latitude",
+ "The latitude coordonate of the map",
+ -90.0f, 90.0f, 0.0f, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainView:zoom-level:
- *
- * The level of zoom of the content.
- *
- * Since: 0.1
- */
+ * ChamplainView:zoom-level:
+ *
+ * The level of zoom of the content.
+ *
+ * Since: 0.1
+ */
g_object_class_install_property (object_class,
PROP_ZOOM_LEVEL,
g_param_spec_int ("zoom-level",
- "Zoom level",
- "The level of zoom of the map",
- 0, 20, 3, CHAMPLAIN_PARAM_READWRITE));
+ "Zoom level",
+ "The level of zoom of the map",
+ 0, 20, 3, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainView:min-zoom-level:
- *
- * The lowest allowed level of zoom of the content.
- *
- * Since: 0.4
- */
+ * ChamplainView:min-zoom-level:
+ *
+ * The lowest allowed level of zoom of the content.
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_MIN_ZOOM_LEVEL,
g_param_spec_int ("min-zoom-level",
- "Min zoom level",
- "The lowest allowed level of zoom",
- 0, 20, 0, CHAMPLAIN_PARAM_READWRITE));
+ "Min zoom level",
+ "The lowest allowed level of zoom",
+ 0, 20, 0, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainView:max-zoom-level:
- *
- * The highest allowed level of zoom of the content.
- *
- * Since: 0.4
- */
+ * ChamplainView:max-zoom-level:
+ *
+ * The highest allowed level of zoom of the content.
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_MAX_ZOOM_LEVEL,
g_param_spec_int ("max-zoom-level",
- "Max zoom level",
- "The highest allowed level of zoom",
- 0, 20, 20, CHAMPLAIN_PARAM_READWRITE));
+ "Max zoom level",
+ "The highest allowed level of zoom",
+ 0, 20, 20, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainView:map-source:
- *
- * The #ChamplainMapSource being displayed
- *
- * Since: 0.2
- */
+ * ChamplainView:map-source:
+ *
+ * The #ChamplainMapSource being displayed
+ *
+ * Since: 0.2
+ */
g_object_class_install_property (object_class,
PROP_MAP_SOURCE,
g_param_spec_object ("map-source",
- "Map source",
- "The map source being displayed",
- CHAMPLAIN_TYPE_MAP_SOURCE,
- CHAMPLAIN_PARAM_READWRITE));
+ "Map source",
+ "The map source being displayed",
+ CHAMPLAIN_TYPE_MAP_SOURCE,
+ CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainView:scroll-mode:
- *
- * Determines the way the view reacts to scroll events.
- *
- * Since: 0.4
- */
+ * ChamplainView:scroll-mode:
+ *
+ * Determines the way the view reacts to scroll events.
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
PROP_SCROLL_MODE,
g_param_spec_enum ("scroll-mode",
- "Scroll Mode",
- "Determines the way the view reacts to scroll events.",
- CHAMPLAIN_TYPE_SCROLL_MODE,
- CHAMPLAIN_SCROLL_MODE_KINETIC,
- CHAMPLAIN_PARAM_READWRITE));
+ "Scroll Mode",
+ "Determines the way the view reacts to scroll events.",
+ CHAMPLAIN_TYPE_SCROLL_MODE,
+ CHAMPLAIN_SCROLL_MODE_KINETIC,
+ CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainView:decel-rate:
- *
- * The deceleration rate for the kinetic mode. The default value is 1.1.
- *
- * Since: 0.2
- */
+ * ChamplainView:decel-rate:
+ *
+ * The deceleration rate for the kinetic mode. The default value is 1.1.
+ *
+ * Since: 0.2
+ */
g_object_class_install_property (object_class,
- PROP_DECEL_RATE,
- g_param_spec_double ("decel-rate",
- "Deceleration rate",
- "Rate at which the view will decelerate in kinetic mode.",
- 1.0001, 2.0, 1.1, CHAMPLAIN_PARAM_READWRITE));
+ PROP_DECEL_RATE,
+ g_param_spec_double ("decel-rate",
+ "Deceleration rate",
+ "Rate at which the view will decelerate in kinetic mode.",
+ 1.0001, 2.0, 1.1, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainView:keep-center-on-resize:
- *
- * Keep the current centered position when resizing the view.
- *
- * Since: 0.2.7
- */
+ * ChamplainView:keep-center-on-resize:
+ *
+ * Keep the current centered position when resizing the view.
+ *
+ * Since: 0.2.7
+ */
g_object_class_install_property (object_class,
- PROP_KEEP_CENTER_ON_RESIZE,
- g_param_spec_boolean ("keep-center-on-resize",
- "Keep center on resize",
- "Keep the current centered position "
- "upon resizing",
- TRUE, CHAMPLAIN_PARAM_READWRITE));
+ PROP_KEEP_CENTER_ON_RESIZE,
+ g_param_spec_boolean ("keep-center-on-resize",
+ "Keep center on resize",
+ "Keep the current centered position "
+ "upon resizing",
+ TRUE, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainView:show-license:
- *
- * Show the license on the map view. The license information should always be
- * available in a way or another in your application. You can have it in
- * About, or on the map.
- *
- * Since: 0.2.8
- */
+ * ChamplainView:show-license:
+ *
+ * Show the license on the map view. The license information should always be
+ * available in a way or another in your application. You can have it in
+ * About, or on the map.
+ *
+ * Since: 0.2.8
+ */
g_object_class_install_property (object_class,
- PROP_SHOW_LICENSE,
- g_param_spec_boolean ("show-license",
- "Show the map data license",
- "Show the map data license on the map view",
- TRUE, CHAMPLAIN_PARAM_READWRITE));
+ PROP_SHOW_LICENSE,
+ g_param_spec_boolean ("show-license",
+ "Show the map data license",
+ "Show the map data license on the map view",
+ TRUE, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainView:license-text:
- *
- * Sets additional text to be displayed in the license area. The map's
- * license will be added below it. Your text can have multiple line, just use
- * "\n" in between.
- *
- * Since: 0.4.3
- */
+ * ChamplainView:license-text:
+ *
+ * Sets additional text to be displayed in the license area. The map's
+ * license will be added below it. Your text can have multiple line, just use
+ * "\n" in between.
+ *
+ * Since: 0.4.3
+ */
g_object_class_install_property (object_class,
- PROP_LICENSE_EXTRA,
- g_param_spec_string ("license-text",
- "Additional license",
- "Additional license text",
- "",
- CHAMPLAIN_PARAM_READWRITE));
+ PROP_LICENSE_EXTRA,
+ g_param_spec_string ("license-text",
+ "Additional license",
+ "Additional license text",
+ "",
+ CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainView:zoom-on-double-click:
- *
- * Should the view zoom in and recenter when the user double click on the map.
- *
- * Since: 0.4
- */
+ * ChamplainView:zoom-on-double-click:
+ *
+ * Should the view zoom in and recenter when the user double click on the map.
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
- PROP_ZOOM_ON_DOUBLE_CLICK,
- g_param_spec_boolean ("zoom-on-double-click",
- "Zoom in on double click",
- "Zoom in and recenter on double click on the map",
- TRUE, CHAMPLAIN_PARAM_READWRITE));
+ PROP_ZOOM_ON_DOUBLE_CLICK,
+ g_param_spec_boolean ("zoom-on-double-click",
+ "Zoom in on double click",
+ "Zoom in and recenter on double click on the map",
+ TRUE, CHAMPLAIN_PARAM_READWRITE));
/**
- * ChamplainView:state
- *
- * The view's global state. Useful to inform using if the view is busy loading
- * tiles or not.
- *
- * Since: 0.4
- */
+ * ChamplainView:state
+ *
+ * The view's global state. Useful to inform using if the view is busy loading
+ * tiles or not.
+ *
+ * Since: 0.4
+ */
g_object_class_install_property (object_class,
- PROP_STATE,
- g_param_spec_enum ("state",
- "View's state",
- "View's global state",
- CHAMPLAIN_TYPE_STATE,
- CHAMPLAIN_STATE_NONE,
- G_PARAM_READABLE));
+ PROP_STATE,
+ g_param_spec_enum ("state",
+ "View's state",
+ "View's global state",
+ CHAMPLAIN_TYPE_STATE,
+ CHAMPLAIN_STATE_NONE,
+ G_PARAM_READABLE));
/**
- * ChamplainView:show-scale:
- *
- * Display the map scale.
- *
- * Since: 0.4.3
- */
+ * ChamplainView:show-scale:
+ *
+ * Display the map scale.
+ *
+ * Since: 0.4.3
+ */
g_object_class_install_property (object_class,
- PROP_SHOW_SCALE,
- g_param_spec_boolean ("show-scale",
- "Show the map scale",
- "Show the map scale "
- "on the screen",
- FALSE,
- G_PARAM_READWRITE));
+ PROP_SHOW_SCALE,
+ g_param_spec_boolean ("show-scale",
+ "Show the map scale",
+ "Show the map scale "
+ "on the screen",
+ FALSE,
+ G_PARAM_READWRITE));
/**
- * ChamplainView:max-scale-width:
- *
- * The size of the map scale on screen in pixels.
- *
- * Since: 0.4.3
- */
+ * ChamplainView:max-scale-width:
+ *
+ * The size of the map scale on screen in pixels.
+ *
+ * Since: 0.4.3
+ */
g_object_class_install_property (object_class,
- PROP_MAX_SCALE_WIDTH,
- g_param_spec_uint ("max-scale-width",
- "The width of the scale",
- "The max width of the scale"
- "on screen",
- 1,
- 2000,
- 100,
- G_PARAM_READWRITE));
+ PROP_MAX_SCALE_WIDTH,
+ g_param_spec_uint ("max-scale-width",
+ "The width of the scale",
+ "The max width of the scale"
+ "on screen",
+ 1,
+ 2000,
+ 100,
+ G_PARAM_READWRITE));
/**
- * ChamplainView:scale-unit:
- *
- * The scale's units.
- *
- * Since: 0.4.3
- */
+ * ChamplainView:scale-unit:
+ *
+ * The scale's units.
+ *
+ * Since: 0.4.3
+ */
g_object_class_install_property (object_class,
- PROP_SCALE_UNIT,
- g_param_spec_enum ("scale-unit",
- "The scale's unit",
- "The map scale's unit",
- CHAMPLAIN_TYPE_UNIT,
- CHAMPLAIN_UNIT_KM,
- G_PARAM_READWRITE));
+ PROP_SCALE_UNIT,
+ g_param_spec_enum ("scale-unit",
+ "The scale's unit",
+ "The map scale's unit",
+ CHAMPLAIN_TYPE_UNIT,
+ CHAMPLAIN_UNIT_KM,
+ G_PARAM_READWRITE));
/**
- * ChamplainView::animation-completed:
- *
- * The ::animation-completed signal is emitted when any animation in the view
- * ends. This is a detailed signal. For example, if you want to be signaled
- * only for go-to animation, you should connect to
- * "animation-completed::go-to".
- *
- * Since: 0.4
- */
+ * ChamplainView::animation-completed:
+ *
+ * The ::animation-completed signal is emitted when any animation in the view
+ * ends. This is a detailed signal. For example, if you want to be signaled
+ * only for go-to animation, you should connect to
+ * "animation-completed::go-to".
+ *
+ * Since: 0.4
+ */
signals[ANIMATION_COMPLETED] =
- g_signal_new ("animation-completed", G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 0);
-
+ g_signal_new ("animation-completed", G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, 0, NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 0);
}
+
static void
create_license (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
@@ -1255,12 +1316,13 @@ create_license (ChamplainView *view)
clutter_actor_raise_top (priv->license_actor);
}
+
static gboolean
button_release_cb (G_GNUC_UNUSED ClutterActor *actor,
ClutterEvent *event,
ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
guint i;
gboolean found = FALSE;
@@ -1287,10 +1349,11 @@ button_release_cb (G_GNUC_UNUSED ClutterActor *actor,
return found;
}
+
static void
update_scale (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
static gfloat previous_m_per_pixel = 0.0;
static gint previous_zoom_level = 0.0;
@@ -1318,7 +1381,7 @@ update_scale (ChamplainView *view)
}
m_per_pixel = champlain_map_source_get_meters_per_pixel (priv->map_source,
- priv->zoom_level, priv->latitude, priv->longitude);
+ priv->zoom_level, priv->latitude, priv->longitude);
/* Don't redraw too often, 1 meters difference is a good value
* since at low levels the value changes alot, and not at high levels */
@@ -1330,7 +1393,7 @@ update_scale (ChamplainView *view)
previous_zoom_level = priv->zoom_level;
if (priv->scale_unit == CHAMPLAIN_UNIT_MILES)
- m_per_pixel *= 3.28; /* m_per_pixel is now in ft */
+ m_per_pixel *= 3.28; /* m_per_pixel is now in ft */
/* This loop will find the pretty value to display on the scale.
* It will be run once for metric units, and twice for imperials
@@ -1371,8 +1434,7 @@ update_scale (ChamplainView *view)
else
final_unit = TRUE;
}
- }
- while (!final_unit);
+ } while (!final_unit);
text = clutter_container_find_child_by_name (CLUTTER_CONTAINER (priv->scale_actor), "scale-far-label");
label = g_strdup_printf ("%g", base);
@@ -1382,19 +1444,18 @@ update_scale (ChamplainView *view)
clutter_actor_get_size (text, &width, NULL);
/* actual label with unit */
label = g_strdup_printf ("%g %s", base,
- priv->scale_unit == CHAMPLAIN_UNIT_KM ?
- (is_small_unit ? "m": "km"):
- (is_small_unit ? "ft": "miles")
- );
+ priv->scale_unit == CHAMPLAIN_UNIT_KM ?
+ (is_small_unit ? "m" : "km") :
+ (is_small_unit ? "ft" : "miles"));
clutter_text_set_text (CLUTTER_TEXT (text), label);
g_free (label);
- clutter_actor_set_position (text, (scale_width - width / 2) + SCALE_INSIDE_PADDING, - SCALE_INSIDE_PADDING);
+ clutter_actor_set_position (text, (scale_width - width / 2) + SCALE_INSIDE_PADDING, -SCALE_INSIDE_PADDING);
text = clutter_container_find_child_by_name (CLUTTER_CONTAINER (priv->scale_actor), "scale-mid-label");
label = g_strdup_printf ("%g", base / 2.0);
clutter_text_set_text (CLUTTER_TEXT (text), label);
clutter_actor_get_size (text, &width, NULL);
- clutter_actor_set_position (text, (scale_width - width) / 2 + SCALE_INSIDE_PADDING, - SCALE_INSIDE_PADDING);
+ clutter_actor_set_position (text, (scale_width - width) / 2 + SCALE_INSIDE_PADDING, -SCALE_INSIDE_PADDING);
g_free (label);
/* Draw the line */
@@ -1408,7 +1469,7 @@ update_scale (ChamplainView *view)
/* First tick */
cairo_move_to (cr, SCALE_INSIDE_PADDING, SCALE_HEIGHT / 4);
- cairo_line_to (cr, SCALE_INSIDE_PADDING, SCALE_HEIGHT / 2 );
+ cairo_line_to (cr, SCALE_INSIDE_PADDING, SCALE_HEIGHT / 2);
cairo_stroke (cr);
/* Line */
@@ -1429,10 +1490,11 @@ update_scale (ChamplainView *view)
cairo_destroy (cr);
}
+
static void
create_scale (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ClutterActor *scale, *text;
gfloat width;
@@ -1444,7 +1506,7 @@ create_scale (ChamplainView *view)
clutter_container_remove_actor (CLUTTER_CONTAINER (priv->stage), priv->scale_actor);
}
- priv->scale_actor = g_object_ref (clutter_group_new());
+ priv->scale_actor = g_object_ref (clutter_group_new ());
clutter_container_add_actor (CLUTTER_CONTAINER (priv->stage), priv->scale_actor);
scale = clutter_cairo_texture_new (priv->max_scale_width + 2 * SCALE_INSIDE_PADDING, SCALE_HEIGHT + 2 * SCALE_INSIDE_PADDING);
@@ -1461,20 +1523,21 @@ create_scale (ChamplainView *view)
text = clutter_text_new_with_text ("Sans 9", "0");
clutter_container_add_actor (CLUTTER_CONTAINER (priv->scale_actor), text);
clutter_actor_get_size (text, &width, NULL);
- clutter_actor_set_position (text, SCALE_INSIDE_PADDING - width / 2, - SCALE_INSIDE_PADDING);
+ clutter_actor_set_position (text, SCALE_INSIDE_PADDING - width / 2, -SCALE_INSIDE_PADDING);
clutter_container_add_actor (CLUTTER_CONTAINER (priv->scale_actor), scale);
clutter_actor_set_position (priv->scale_actor, SCALE_PADDING - SCALE_INSIDE_PADDING,
- priv->viewport_size.height - SCALE_HEIGHT - SCALE_PADDING - SCALE_INSIDE_PADDING);
+ priv->viewport_size.height - SCALE_HEIGHT - SCALE_PADDING - SCALE_INSIDE_PADDING);
clutter_actor_set_opacity (priv->scale_actor, 200);
clutter_actor_raise_top (priv->scale_actor);
}
+
static void
champlain_view_init (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = GET_PRIVATE (view);
ChamplainMapSource *source;
@@ -1486,7 +1549,7 @@ champlain_view_init (ChamplainView *view)
priv->factory = champlain_map_source_factory_dup_default ();
source = champlain_map_source_factory_create_cached_source (priv->factory, CHAMPLAIN_MAP_SOURCE_OSM_MAPNIK);
- priv->map_source = CHAMPLAIN_MAP_SOURCE(source);
+ priv->map_source = CHAMPLAIN_MAP_SOURCE (source);
priv->zoom_level = 0;
priv->min_zoom_level = champlain_map_source_get_min_zoom_level (priv->map_source);
@@ -1559,7 +1622,7 @@ champlain_view_init (ChamplainView *view)
g_signal_connect_after (priv->finger_scroll, "button-release-event",
G_CALLBACK (button_release_cb), view);
- clutter_stage_set_key_focus (CLUTTER_STAGE (clutter_stage_get_default()),
+ clutter_stage_set_key_focus (CLUTTER_STAGE (clutter_stage_get_default ()),
priv->finger_scroll);
g_signal_connect (priv->finger_scroll, "key-press-event",
G_CALLBACK (finger_scroll_key_press_cb), view);
@@ -1589,23 +1652,25 @@ champlain_view_init (ChamplainView *view)
g_object_notify (G_OBJECT (view), "state");
g_signal_connect (priv->map_source, "reload-tiles",
- G_CALLBACK (view_reload_tiles_cb), view);
+ G_CALLBACK (view_reload_tiles_cb), view);
}
+
static gboolean
perform_update_cb (ChamplainView *view)
{
-// DEBUG_LOG()
+/* DEBUG_LOG() */
view->priv->perform_update = TRUE;
return TRUE;
}
+
static void
viewport_pos_changed_cb (G_GNUC_UNUSED GObject *gobject,
G_GNUC_UNUSED GParamSpec *arg1,
ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
@@ -1624,6 +1689,7 @@ viewport_pos_changed_cb (G_GNUC_UNUSED GObject *gobject,
}
}
+
/**
* champlain_view_set_size:
* @view: a #ChamplainView
@@ -1635,30 +1701,31 @@ viewport_pos_changed_cb (G_GNUC_UNUSED GObject *gobject,
*
* Since: 0.1
*/
-//FIXME: move to an handler of actor size change
+/* FIXME: move to an handler of actor size change */
void
champlain_view_set_size (ChamplainView *view,
guint width,
guint height)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
clutter_actor_set_size (CLUTTER_ACTOR (view), width, height);
}
+
static void
update_license (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
gchar *license;
if (priv->license_text)
license = g_strjoin ("\n",
- priv->license_text,
- champlain_map_source_get_license (priv->map_source),
- NULL);
+ priv->license_text,
+ champlain_map_source_get_license (priv->map_source),
+ NULL);
else
license = g_strdup (champlain_map_source_get_license (priv->map_source));
@@ -1672,12 +1739,13 @@ update_license (ChamplainView *view)
g_free (license);
}
+
static gboolean
finger_scroll_button_press_cb (G_GNUC_UNUSED ClutterActor *actor,
ClutterButtonEvent *event,
ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
@@ -1687,12 +1755,13 @@ finger_scroll_button_press_cb (G_GNUC_UNUSED ClutterActor *actor,
return FALSE; /* Propagate the event */
}
+
static void
scroll_to (ChamplainView *view,
gint x,
gint y)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
gfloat lat, lon;
@@ -1706,11 +1775,12 @@ scroll_to (ChamplainView *view,
champlain_view_center_on (view, lat, lon);
}
+
/* These functions should be exposed in the next API break */
static void
-champlain_view_scroll_left (ChamplainView* view)
+champlain_view_scroll_left (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -1725,10 +1795,11 @@ champlain_view_scroll_left (ChamplainView* view)
scroll_to (view, x, y);
}
+
static void
-champlain_view_scroll_right (ChamplainView* view)
+champlain_view_scroll_right (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -1743,10 +1814,11 @@ champlain_view_scroll_right (ChamplainView* view)
scroll_to (view, x, y);
}
+
static void
-champlain_view_scroll_up (ChamplainView* view)
+champlain_view_scroll_up (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -1761,10 +1833,11 @@ champlain_view_scroll_up (ChamplainView* view)
scroll_to (view, x, y);
}
+
static void
-champlain_view_scroll_down (ChamplainView* view)
+champlain_view_scroll_down (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -1785,38 +1858,43 @@ finger_scroll_key_press_cb (G_GNUC_UNUSED ClutterActor *actor,
ClutterKeyEvent *event,
ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
switch (event->keyval)
- {
- case 65361: // Left
+ {
+ case 65361: /* Left */
champlain_view_scroll_left (view);
return TRUE;
break;
- case 65362: // Up
+
+ case 65362: /* Up */
if (event->modifier_state & CLUTTER_CONTROL_MASK)
champlain_view_zoom_in (view);
else
champlain_view_scroll_up (view);
return TRUE;
break;
- case 65363: // Right
+
+ case 65363: /* Right */
champlain_view_scroll_right (view);
return TRUE;
break;
- case 65364: // Down
+
+ case 65364: /* Down */
if (event->modifier_state & CLUTTER_CONTROL_MASK)
champlain_view_zoom_out (view);
else
champlain_view_scroll_down (view);
return TRUE;
break;
+
default:
return FALSE; /* Propagate the event */
- }
+ }
return FALSE; /* Propagate the event */
}
+
/**
* champlain_view_new:
*
@@ -1829,17 +1907,18 @@ finger_scroll_key_press_cb (G_GNUC_UNUSED ClutterActor *actor,
ClutterActor *
champlain_view_new (void)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
return g_object_new (CHAMPLAIN_TYPE_VIEW, NULL);
}
+
static void
view_update_anchor (ChamplainView *view,
gint x, /* Absolute x */
gint y) /* Absolute y */
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
gboolean need_anchor = FALSE;
@@ -1853,7 +1932,7 @@ view_update_anchor (ChamplainView *view,
x - priv->anchor.x - priv->viewport_size.width / 2 >= G_MAXINT16 - 2 * priv->viewport_size.width ||
y - priv->anchor.y - priv->viewport_size.height / 2 >= G_MAXINT16 - 2 * priv->viewport_size.height ||
x - priv->anchor.x - priv->viewport_size.width / 2 <= 0 + priv->viewport_size.width ||
- y - priv->anchor.y - priv->viewport_size.height / 2 <= 0 + priv->viewport_size.height )
+ y - priv->anchor.y - priv->viewport_size.height / 2 <= 0 + priv->viewport_size.height)
need_update = TRUE;
if (need_anchor && need_update)
@@ -1863,14 +1942,14 @@ view_update_anchor (ChamplainView *view,
priv->anchor.x = x - G_MAXINT16 / 2;
priv->anchor.y = y - G_MAXINT16 / 2;
- if ( priv->anchor.x < 0 )
+ if (priv->anchor.x < 0)
priv->anchor.x = 0;
- if ( priv->anchor.y < 0 )
+ if (priv->anchor.y < 0)
priv->anchor.y = 0;
max = champlain_map_source_get_row_count (priv->map_source, priv->zoom_level) *
- champlain_map_source_get_tile_size (priv->map_source) -
- (G_MAXINT16 / 2);
+ champlain_map_source_get_tile_size (priv->map_source) -
+ (G_MAXINT16 / 2);
if (priv->anchor.x > max)
priv->anchor.x = max;
if (priv->anchor.y > max)
@@ -1889,6 +1968,7 @@ view_update_anchor (ChamplainView *view,
}
}
+
/**
* champlain_view_center_on:
* @view: a #ChamplainView
@@ -1904,7 +1984,7 @@ champlain_view_center_on (ChamplainView *view,
gdouble latitude,
gdouble longitude)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -1926,9 +2006,9 @@ champlain_view_center_on (ChamplainView *view,
g_signal_handlers_block_by_func (priv->viewport, G_CALLBACK (viewport_pos_changed_cb), view);
tidy_viewport_set_origin (TIDY_VIEWPORT (priv->viewport),
- priv->viewport_size.x,
- priv->viewport_size.y,
- 0);
+ priv->viewport_size.x,
+ priv->viewport_size.y,
+ 0);
g_signal_handlers_unblock_by_func (priv->viewport, G_CALLBACK (viewport_pos_changed_cb), view);
g_object_notify (G_OBJECT (view), "longitude");
@@ -1940,12 +2020,13 @@ champlain_view_center_on (ChamplainView *view,
marker_reposition (view);
}
+
static void
timeline_new_frame (G_GNUC_UNUSED ClutterTimeline *timeline,
G_GNUC_UNUSED gint frame_num,
GoToContext *ctx)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
gdouble alpha;
gdouble lat;
@@ -1960,15 +2041,17 @@ timeline_new_frame (G_GNUC_UNUSED ClutterTimeline *timeline,
ctx->from_longitude + alpha * lon);
}
+
static void
timeline_completed (G_GNUC_UNUSED ClutterTimeline *timeline,
- ChamplainView *view)
+ ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
champlain_view_stop_go_to (view);
}
+
/**
* champlain_view_stop_go_to:
* @view: a #ChamplainView
@@ -1981,7 +2064,7 @@ timeline_completed (G_GNUC_UNUSED ClutterTimeline *timeline,
void
champlain_view_stop_go_to (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -2001,6 +2084,7 @@ champlain_view_stop_go_to (ChamplainView *view)
priv->goto_context = NULL;
}
+
/**
* champlain_view_go_to:
* @view: a #ChamplainView
@@ -2017,7 +2101,7 @@ champlain_view_go_to (ChamplainView *view,
gdouble latitude,
gdouble longitude)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
guint duration;
@@ -2025,6 +2109,7 @@ champlain_view_go_to (ChamplainView *view,
champlain_view_go_to_with_duration (view, latitude, longitude, duration);
}
+
/* FIXME: make public after API freeze */
static void
champlain_view_go_to_with_duration (ChamplainView *view,
@@ -2032,7 +2117,7 @@ champlain_view_go_to_with_duration (ChamplainView *view,
gdouble longitude,
guint duration) /* In ms */
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -2077,6 +2162,7 @@ champlain_view_go_to_with_duration (ChamplainView *view,
clutter_timeline_start (ctx->timeline);
}
+
/**
* champlain_view_zoom_in:
* @view: a #ChamplainView
@@ -2088,13 +2174,14 @@ champlain_view_go_to_with_duration (ChamplainView *view,
void
champlain_view_zoom_in (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
champlain_view_set_zoom_level (view, view->priv->zoom_level + 1);
}
+
/**
* champlain_view_zoom_out:
* @view: a #ChamplainView
@@ -2106,13 +2193,14 @@ champlain_view_zoom_in (ChamplainView *view)
void
champlain_view_zoom_out (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
champlain_view_set_zoom_level (view, view->priv->zoom_level - 1);
}
+
/**
* champlain_view_set_zoom_level:
* @view: a #ChamplainView
@@ -2126,13 +2214,13 @@ void
champlain_view_set_zoom_level (ChamplainView *view,
gint zoom_level)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
ChamplainViewPrivate *priv = view->priv;
- if (zoom_level == priv->zoom_level || ZOOM_LEVEL_OUT_OF_RANGE(priv, zoom_level))
+ if (zoom_level == priv->zoom_level || ZOOM_LEVEL_OUT_OF_RANGE (priv, zoom_level))
return;
champlain_view_stop_go_to (view);
@@ -2148,6 +2236,7 @@ champlain_view_set_zoom_level (ChamplainView *view,
g_object_notify (G_OBJECT (view), "zoom-level");
}
+
/**
* champlain_view_set_min_zoom_level:
* @view: a #ChamplainView
@@ -2161,7 +2250,7 @@ void
champlain_view_set_min_zoom_level (ChamplainView *view,
gint min_zoom_level)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -2178,6 +2267,7 @@ champlain_view_set_min_zoom_level (ChamplainView *view,
champlain_view_set_zoom_level (view, min_zoom_level);
}
+
/**
* champlain_view_set_max_zoom_level:
* @view: a #ChamplainView
@@ -2191,7 +2281,7 @@ void
champlain_view_set_max_zoom_level (ChamplainView *view,
gint max_zoom_level)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -2208,6 +2298,7 @@ champlain_view_set_max_zoom_level (ChamplainView *view,
champlain_view_set_zoom_level (view, max_zoom_level);
}
+
/**
* champlain_view_add_layer:
* @view: a #ChamplainView
@@ -2221,7 +2312,7 @@ void
champlain_view_add_layer (ChamplainView *view,
ChamplainLayer *layer)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
g_return_if_fail (CHAMPLAIN_IS_LAYER (layer));
@@ -2231,9 +2322,9 @@ champlain_view_add_layer (ChamplainView *view,
clutter_actor_raise_top (CLUTTER_ACTOR (layer));
g_idle_add_full (G_PRIORITY_DEFAULT,
- (GSourceFunc)marker_reposition,
- g_object_ref (view),
- (GDestroyNotify)g_object_unref);
+ (GSourceFunc) marker_reposition,
+ g_object_ref (view),
+ (GDestroyNotify) g_object_unref);
g_signal_connect_after (layer, "actor-added",
G_CALLBACK (layer_add_marker_cb), view);
@@ -2242,6 +2333,7 @@ champlain_view_add_layer (ChamplainView *view,
CLUTTER_CALLBACK (connect_marker_notify_cb), view);
}
+
/**
* champlain_view_remove_layer:
* @view: a #ChamplainView
@@ -2255,7 +2347,7 @@ void
champlain_view_remove_layer (ChamplainView *view,
ChamplainLayer *layer)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
g_return_if_fail (CHAMPLAIN_IS_LAYER (layer));
@@ -2266,6 +2358,7 @@ champlain_view_remove_layer (ChamplainView *view,
CLUTTER_ACTOR (layer));
}
+
/**
* champlain_view_get_coords_from_event:
* @view: a #ChamplainView
@@ -2285,7 +2378,7 @@ champlain_view_get_coords_from_event (ChamplainView *view,
gdouble *latitude,
gdouble *longitude)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
/* Apparently there isn a more precise test */
@@ -2295,43 +2388,48 @@ champlain_view_get_coords_from_event (ChamplainView *view,
switch (clutter_event_type (event))
{
- case CLUTTER_BUTTON_PRESS:
- case CLUTTER_BUTTON_RELEASE:
- {
- ClutterButtonEvent *e = (ClutterButtonEvent*) event;
- x = e->x;
- y = e->y;
- }
- break;
- case CLUTTER_SCROLL:
- {
- ClutterScrollEvent *e = (ClutterScrollEvent*) event;
- x = e->x;
- y = e->y;
- }
- break;
- case CLUTTER_MOTION:
- {
- ClutterMotionEvent *e = (ClutterMotionEvent*) event;
- x = e->x;
- y = e->y;
- }
- break;
- case CLUTTER_ENTER:
- case CLUTTER_LEAVE:
- {
- ClutterCrossingEvent *e = (ClutterCrossingEvent*) event;
- x = e->x;
- y = e->y;
- }
- break;
- default:
- return FALSE;
+ case CLUTTER_BUTTON_PRESS:
+ case CLUTTER_BUTTON_RELEASE:
+ {
+ ClutterButtonEvent *e = (ClutterButtonEvent *) event;
+ x = e->x;
+ y = e->y;
+ }
+ break;
+
+ case CLUTTER_SCROLL:
+ {
+ ClutterScrollEvent *e = (ClutterScrollEvent *) event;
+ x = e->x;
+ y = e->y;
+ }
+ break;
+
+ case CLUTTER_MOTION:
+ {
+ ClutterMotionEvent *e = (ClutterMotionEvent *) event;
+ x = e->x;
+ y = e->y;
+ }
+ break;
+
+ case CLUTTER_ENTER:
+ case CLUTTER_LEAVE:
+ {
+ ClutterCrossingEvent *e = (ClutterCrossingEvent *) event;
+ x = e->x;
+ y = e->y;
+ }
+ break;
+
+ default:
+ return FALSE;
}
return champlain_view_get_coords_at (view, x, y, latitude, longitude);
}
+
/**
* champlain_view_get_coords_at:
* @view: a #ChamplainView
@@ -2347,13 +2445,14 @@ champlain_view_get_coords_from_event (ChamplainView *view,
*
* Since: 0.4
*/
-gboolean champlain_view_get_coords_at (ChamplainView *view,
+gboolean
+champlain_view_get_coords_at (ChamplainView *view,
guint x,
guint y,
gdouble *latitude,
gdouble *longitude)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
ChamplainViewPrivate *priv = view->priv;
@@ -2367,18 +2466,19 @@ gboolean champlain_view_get_coords_at (ChamplainView *view,
if (latitude)
*latitude = viewport_get_latitude_at (priv,
- priv->viewport_size.y + rel_y + priv->anchor.y);
+ priv->viewport_size.y + rel_y + priv->anchor.y);
if (longitude)
*longitude = viewport_get_longitude_at (priv,
- priv->viewport_size.x + rel_x + priv->anchor.x);
+ priv->viewport_size.x + rel_x + priv->anchor.x);
return TRUE;
}
+
static void
view_load_visible_tiles (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
ChamplainRectangle viewport = priv->viewport_size;
@@ -2387,7 +2487,7 @@ view_load_visible_tiles (ChamplainView *view)
gint x_count, y_count, x_first, y_first, x_end, y_end, max_x_end, max_y_end;
gboolean *tile_map;
gint arm_size, arm_max, turn;
- gint dirs[5] = {0, 1, 0, -1, 0};
+ gint dirs[5] = { 0, 1, 0, -1, 0 };
int i, x, y;
size = champlain_map_source_get_tile_size (priv->map_source);
@@ -2400,8 +2500,8 @@ view_load_visible_tiles (ChamplainView *view)
if (viewport.y < 0)
viewport.y = 0;
- x_count = ceil((float)viewport.width / size) + 1;
- y_count = ceil((float)viewport.height / size) + 1;
+ x_count = ceil ((float) viewport.width / size) + 1;
+ y_count = ceil ((float) viewport.height / size) + 1;
x_first = viewport.x / size;
y_first = viewport.y / size;
@@ -2428,9 +2528,9 @@ view_load_visible_tiles (ChamplainView *view)
tile_map = g_new0 (gboolean, x_count * y_count);
- // Get rid of old tiles first
+ /* Get rid of old tiles first */
children = clutter_container_get_children (CLUTTER_CONTAINER (priv->map_layer));
- for ( ; children != NULL; children = g_list_next (children))
+ for (; children != NULL; children = g_list_next (children))
{
ChamplainTile *tile = CHAMPLAIN_TILE (children->data);
@@ -2451,10 +2551,10 @@ view_load_visible_tiles (ChamplainView *view)
g_list_free (children);
- //Load new tiles if needed
+ /* Load new tiles if needed */
x = x_first + x_count / 2 - 1;
y = y_first + y_count / 2 - 1;
- arm_max = MAX(x_count, y_count) + 2;
+ arm_max = MAX (x_count, y_count) + 2;
arm_size = 1;
for (turn = 0; arm_size < arm_max; turn++)
@@ -2470,8 +2570,8 @@ view_load_visible_tiles (ChamplainView *view)
DEBUG ("Loading tile %d, %d, %d", priv->zoom_level, x, y);
tile = champlain_tile_new ();
g_object_set (G_OBJECT (tile), "x", x, "y", y,
- "zoom-level", priv->zoom_level,
- "size", size, NULL);
+ "zoom-level", priv->zoom_level,
+ "size", size, NULL);
g_signal_connect (tile, "notify::state", G_CALLBACK (tile_state_notify), view);
clutter_container_add_actor (CLUTTER_CONTAINER (priv->map_layer), CLUTTER_ACTOR (tile));
view_position_tile (view, tile);
@@ -2486,7 +2586,7 @@ view_load_visible_tiles (ChamplainView *view)
g_signal_connect (tile, "destroy", G_CALLBACK (tile_destroyed_cb), view);
- g_object_add_weak_pointer (G_OBJECT (tile), (gpointer*)&data->tile);
+ g_object_add_weak_pointer (G_OBJECT (tile), (gpointer *) &data->tile);
g_object_ref (priv->map_source);
/* set priority high, otherwise tiles will be loaded after panning is done */
@@ -2504,17 +2604,18 @@ view_load_visible_tiles (ChamplainView *view)
g_free (tile_map);
}
+
static gboolean
fill_tile_cb (FillTileCallbackData *data)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainTile *tile = data->tile;
ChamplainMapSource *map_source = data->map_source;
if (data->tile)
{
- g_object_remove_weak_pointer (G_OBJECT (data->tile), (gpointer*)&data->tile);
+ g_object_remove_weak_pointer (G_OBJECT (data->tile), (gpointer *) &data->tile);
champlain_map_source_fill_tile (map_source, tile);
}
@@ -2524,11 +2625,12 @@ fill_tile_cb (FillTileCallbackData *data)
return FALSE;
}
+
static void
-view_position_tile (ChamplainView* view,
- ChamplainTile* tile)
+view_position_tile (ChamplainView *view,
+ ChamplainTile *tile)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
@@ -2544,26 +2646,28 @@ view_position_tile (ChamplainView* view,
size = champlain_tile_get_size (tile);
clutter_actor_set_position (actor,
- (x * size) - priv->anchor.x,
- (y * size) - priv->anchor.y);
+ (x * size) - priv->anchor.x,
+ (y * size) - priv->anchor.y);
}
+
static void
view_reload_tiles_cb (G_GNUC_UNUSED ChamplainMapSource *map_source,
- ChamplainView* view)
+ ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
clutter_group_remove_all (CLUTTER_GROUP (view->priv->map_layer));
view_load_visible_tiles (view);
}
+
static void
tile_destroyed_cb (GObject *gobject,
gpointer data)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainView *view = CHAMPLAIN_VIEW (data);
ChamplainTile *tile = CHAMPLAIN_TILE (gobject);
@@ -2581,20 +2685,22 @@ tile_destroyed_cb (GObject *gobject,
}
}
+
static void
tile_state_notify (GObject *gobject,
G_GNUC_UNUSED GParamSpec *pspec,
gpointer data)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
view_update_state (CHAMPLAIN_VIEW (data), CHAMPLAIN_TILE (gobject));
}
+
static void
view_update_state (ChamplainView *view, ChamplainTile *tile)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainState tile_state = champlain_tile_get_state (tile);
ChamplainViewPrivate *priv = view->priv;
@@ -2619,6 +2725,7 @@ view_update_state (ChamplainView *view, ChamplainTile *tile)
}
}
+
/**
* champlain_view_set_map_source:
* @view: a #ChamplainView
@@ -2633,7 +2740,7 @@ void
champlain_view_set_map_source (ChamplainView *view,
ChamplainMapSource *source)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view) &&
CHAMPLAIN_IS_MAP_SOURCE (source));
@@ -2667,47 +2774,48 @@ champlain_view_set_map_source (ChamplainView *view,
champlain_view_center_on (view, priv->latitude, priv->longitude);
g_signal_connect (priv->map_source, "reload-tiles",
- G_CALLBACK (view_reload_tiles_cb), view);
+ G_CALLBACK (view_reload_tiles_cb), view);
g_object_notify (G_OBJECT (view), "map-source");
}
+
/**
-* champlain_view_set_decel_rate:
-* @view: a #ChamplainView
-* @rate: a #gdouble between 1.001 and 2.0
-*
-* The deceleration rate for the kinetic mode.
-*
-* Since: 0.4
-*/
+ * champlain_view_set_decel_rate:
+ * @view: a #ChamplainView
+ * @rate: a #gdouble between 1.001 and 2.0
+ *
+ * The deceleration rate for the kinetic mode.
+ *
+ * Since: 0.4
+ */
void
champlain_view_set_decel_rate (ChamplainView *view,
gdouble rate)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view) &&
- rate < 2.0 &&
- rate > 1.0001);
+ rate < 2.0 && rate > 1.0001);
g_object_set (view->priv->finger_scroll, "decel-rate", rate, NULL);
}
+
/**
-* champlain_view_set_scroll_mode:
-* @view: a #ChamplainView
-* @mode: a #ChamplainScrollMode value
-*
-* Determines the way the view reacts to scroll events.
-*
-* Since: 0.4
-*/
+ * champlain_view_set_scroll_mode:
+ * @view: a #ChamplainView
+ * @mode: a #ChamplainScrollMode value
+ *
+ * Determines the way the view reacts to scroll events.
+ *
+ * Since: 0.4
+ */
void
champlain_view_set_scroll_mode (ChamplainView *view,
ChamplainScrollMode mode)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -2719,41 +2827,43 @@ champlain_view_set_scroll_mode (ChamplainView *view,
priv->scroll_mode, NULL);
}
+
/**
-* champlain_view_set_keep_center_on_resize:
-* @view: a #ChamplainView
-* @value: a #gboolean
-*
-* Keep the current centered position when resizing the view.
-*
-* Since: 0.4
-*/
+ * champlain_view_set_keep_center_on_resize:
+ * @view: a #ChamplainView
+ * @value: a #gboolean
+ *
+ * Keep the current centered position when resizing the view.
+ *
+ * Since: 0.4
+ */
void
champlain_view_set_keep_center_on_resize (ChamplainView *view,
gboolean value)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
view->priv->keep_center_on_resize = value;
}
+
/**
-* champlain_view_set_license_text:
-* @view: a #ChamplainView
-* @text: a license
-*
-* Show the additional license text on the map view. The text will preceed the
-* map's licence when displayed. Use "\n" to separate the lines.
-*
-* Since: 0.4.3
-*/
+ * champlain_view_set_license_text:
+ * @view: a #ChamplainView
+ * @text: a license
+ *
+ * Show the additional license text on the map view. The text will preceed the
+ * map's licence when displayed. Use "\n" to separate the lines.
+ *
+ * Since: 0.4.3
+ */
void
champlain_view_set_license_text (ChamplainView *view,
const gchar *text)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -2766,22 +2876,23 @@ champlain_view_set_license_text (ChamplainView *view,
update_license (view);
}
+
/**
-* champlain_view_set_show_license:
-* @view: a #ChamplainView
-* @value: a #gboolean
-*
-* Show the license on the map view. The license information should always be
-* available in a way or another in your application. You can have it in
-* About, or on the map.
-*
-* Since: 0.4
-*/
+ * champlain_view_set_show_license:
+ * @view: a #ChamplainView
+ * @value: a #gboolean
+ *
+ * Show the license on the map view. The license information should always be
+ * available in a way or another in your application. You can have it in
+ * About, or on the map.
+ *
+ * Since: 0.4
+ */
void
champlain_view_set_show_license (ChamplainView *view,
gboolean value)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -2789,20 +2900,21 @@ champlain_view_set_show_license (ChamplainView *view,
update_license (view);
}
+
/**
-* champlain_view_set_show_scale:
-* @view: a #ChamplainView
-* @value: a #gboolean
-*
-* Show the scale on the map view.
-*
-* Since: 0.4.3
-*/
+ * champlain_view_set_show_scale:
+ * @view: a #ChamplainView
+ * @value: a #gboolean
+ *
+ * Show the scale on the map view.
+ *
+ * Since: 0.4.3
+ */
void
champlain_view_set_show_scale (ChamplainView *view,
gboolean value)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -2810,20 +2922,21 @@ champlain_view_set_show_scale (ChamplainView *view,
update_scale (view);
}
+
/**
-* champlain_view_set_max_scale_width:
-* @view: a #ChamplainView
-* @value: a #guint in pixels
-*
-* Sets the maximum width of the scale on the screen in pixels
-*
-* Since: 0.4.3
-*/
+ * champlain_view_set_max_scale_width:
+ * @view: a #ChamplainView
+ * @value: a #guint in pixels
+ *
+ * Sets the maximum width of the scale on the screen in pixels
+ *
+ * Since: 0.4.3
+ */
void
champlain_view_set_max_scale_width (ChamplainView *view,
guint value)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -2832,20 +2945,21 @@ champlain_view_set_max_scale_width (ChamplainView *view,
update_scale (view);
}
+
/**
-* champlain_view_set_scale_unit:
-* @view: a #ChamplainView
-* @unit: a #ChamplainUnit
-*
-* Sets the scales unit.
-*
-* Since: 0.4.3
-*/
+ * champlain_view_set_scale_unit:
+ * @view: a #ChamplainView
+ * @unit: a #ChamplainUnit
+ *
+ * Sets the scales unit.
+ *
+ * Since: 0.4.3
+ */
void
champlain_view_set_scale_unit (ChamplainView *view,
ChamplainUnit unit)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
@@ -2853,26 +2967,28 @@ champlain_view_set_scale_unit (ChamplainView *view,
update_scale (view);
}
+
/**
-* champlain_view_set_zoom_on_double_click:
-* @view: a #ChamplainView
-* @value: a #gboolean
-*
-* Should the view zoom in and recenter when the user double click on the map.
-*
-* Since: 0.4
-*/
+ * champlain_view_set_zoom_on_double_click:
+ * @view: a #ChamplainView
+ * @value: a #gboolean
+ *
+ * Should the view zoom in and recenter when the user double click on the map.
+ *
+ * Since: 0.4
+ */
void
champlain_view_set_zoom_on_double_click (ChamplainView *view,
gboolean value)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
view->priv->zoom_on_double_click = value;
}
+
/**
* champlain_view_ensure_visible:
* @view: a #ChamplainView
@@ -2895,12 +3011,12 @@ champlain_view_ensure_visible (ChamplainView *view,
gdouble lon2,
gboolean animate)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
gint zoom_level = priv->zoom_level;
gdouble width, height;
- gdouble min_lat,min_lon,max_lat,max_lon;
+ gdouble min_lat, min_lon, max_lat, max_lon;
gboolean good_size = FALSE;
/*We first sort the lat,lon in order to have min and max */
@@ -2931,7 +3047,7 @@ champlain_view_ensure_visible (ChamplainView *view,
width *= 1.1;
height *= 1.1;
- DEBUG("Zone to expose (%f, %f) to (%f, %f)", min_lat, min_lon, max_lat, max_lon);
+ DEBUG ("Zone to expose (%f, %f) to (%f, %f)", min_lat, min_lon, max_lat, max_lon);
do
{
gint min_x, min_y, max_x, max_y;
@@ -2953,8 +3069,7 @@ champlain_view_ensure_visible (ChamplainView *view,
min_lat = min_lon = width = height = 0;
break;
}
- }
- while (!good_size);
+ } while (!good_size);
DEBUG ("Ideal zoom level is %d", zoom_level);
champlain_view_set_zoom_level (view, zoom_level);
@@ -2964,6 +3079,7 @@ champlain_view_ensure_visible (ChamplainView *view,
champlain_view_center_on (view, min_lat + height / 2.0, min_lon + width / 2.0);
}
+
/**
* champlain_view_ensure_markers_visible:
* @view: a #ChamplainView
@@ -2982,7 +3098,7 @@ champlain_view_ensure_markers_visible (ChamplainView *view,
ChamplainBaseMarker *markers[],
gboolean animate)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
gdouble min_lat, min_lon, max_lat, max_lon;
ChamplainBaseMarker *marker = NULL;
@@ -3015,6 +3131,7 @@ champlain_view_ensure_markers_visible (ChamplainView *view,
champlain_view_ensure_visible (view, min_lat, min_lon, max_lat, max_lon, animate);
}
+
/* Sets the zoom level, leaving the (x, y) at the exact same point in the view */
static gboolean
view_set_zoom_level_at (ChamplainView *view,
@@ -3022,7 +3139,7 @@ view_set_zoom_level_at (ChamplainView *view,
gint x,
gint y)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
@@ -3033,7 +3150,7 @@ view_set_zoom_level_at (ChamplainView *view,
gfloat x2, y2;
gdouble lat2, lon2;
- if (zoom_level == priv->zoom_level || ZOOM_LEVEL_OUT_OF_RANGE(priv, zoom_level))
+ if (zoom_level == priv->zoom_level || ZOOM_LEVEL_OUT_OF_RANGE (priv, zoom_level))
return FALSE;
champlain_view_stop_go_to (view);
@@ -3060,9 +3177,9 @@ view_set_zoom_level_at (ChamplainView *view,
/* Get the new lon,lat of these new x,y minus the distance from the
* viewport center */
lon2 = champlain_map_source_get_longitude (priv->map_source,
- priv->zoom_level, x2 + x_diff);
+ priv->zoom_level, x2 + x_diff);
lat2 = champlain_map_source_get_latitude (priv->map_source,
- priv->zoom_level, y2 + y_diff);
+ priv->zoom_level, y2 + y_diff);
resize_viewport (view);
champlain_view_center_on (view, lat2, lon2);
@@ -3071,6 +3188,7 @@ view_set_zoom_level_at (ChamplainView *view,
return TRUE;
}
+
/**
* champlain_view_get_zoom_level:
* @view: The view
@@ -3084,13 +3202,14 @@ view_set_zoom_level_at (ChamplainView *view,
gint
champlain_view_get_zoom_level (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), 0);
return view->priv->zoom_level;
}
+
/**
* champlain_view_get_min_zoom_level:
* @view: The view
@@ -3104,13 +3223,14 @@ champlain_view_get_zoom_level (ChamplainView *view)
gint
champlain_view_get_min_zoom_level (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), 0);
return view->priv->min_zoom_level;
}
+
/**
* champlain_view_get_max_zoom_level:
* @view: The view
@@ -3124,13 +3244,14 @@ champlain_view_get_min_zoom_level (ChamplainView *view)
gint
champlain_view_get_max_zoom_level (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), 0);
return view->priv->max_zoom_level;
}
+
/**
* champlain_view_get_map_source:
* @view: The view
@@ -3142,16 +3263,17 @@ champlain_view_get_max_zoom_level (ChamplainView *view)
*
* Since: 0.4
*/
-ChamplainMapSource*
+ChamplainMapSource *
champlain_view_get_map_source (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), NULL);
return view->priv->map_source;
}
+
/**
* champlain_view_get_decel_rate:
* @view: The view
@@ -3165,7 +3287,7 @@ champlain_view_get_map_source (ChamplainView *view)
gdouble
champlain_view_get_decel_rate (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), 0.0);
@@ -3174,6 +3296,7 @@ champlain_view_get_decel_rate (ChamplainView *view)
return decel;
}
+
/**
* champlain_view_get_scroll_mode:
* @view: The view
@@ -3187,13 +3310,14 @@ champlain_view_get_decel_rate (ChamplainView *view)
ChamplainScrollMode
champlain_view_get_scroll_mode (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), CHAMPLAIN_SCROLL_MODE_PUSH);
return view->priv->scroll_mode;
}
+
/**
* champlain_view_get_keep_center_on_resize:
* @view: The view
@@ -3207,13 +3331,14 @@ champlain_view_get_scroll_mode (ChamplainView *view)
gboolean
champlain_view_get_keep_center_on_resize (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
return view->priv->keep_center_on_resize;
}
+
/**
* champlain_view_get_show_license:
* @view: The view
@@ -3227,13 +3352,14 @@ champlain_view_get_keep_center_on_resize (ChamplainView *view)
gboolean
champlain_view_get_show_license (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
return view->priv->show_license;
}
+
/**
* champlain_view_get_license_text:
* @view: The view
@@ -3247,7 +3373,7 @@ champlain_view_get_show_license (ChamplainView *view)
const gchar *
champlain_view_get_license_text (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
@@ -3268,13 +3394,14 @@ champlain_view_get_license_text (ChamplainView *view)
gboolean
champlain_view_get_show_scale (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
return view->priv->show_scale;
}
+
/**
* champlain_view_get_max_scale_width:
* @view: The view
@@ -3288,13 +3415,14 @@ champlain_view_get_show_scale (ChamplainView *view)
guint
champlain_view_get_max_scale_width (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
return view->priv->max_scale_width;
}
+
/**
* champlain_view_get_scale_unit:
* @view: The view
@@ -3308,13 +3436,14 @@ champlain_view_get_max_scale_width (ChamplainView *view)
ChamplainUnit
champlain_view_get_scale_unit (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
return view->priv->scale_unit;
}
+
/**
* champlain_view_get_zoom_on_double_click:
* @view: The view
@@ -3328,17 +3457,18 @@ champlain_view_get_scale_unit (ChamplainView *view)
gboolean
champlain_view_get_zoom_on_double_click (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
return view->priv->zoom_on_double_click;
}
+
static void
view_update_polygons (ChamplainView *view)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
ChamplainViewPrivate *priv = view->priv;
ClutterGroup *polygon_layer_group = CLUTTER_GROUP (priv->polygon_layer);
@@ -3355,8 +3485,8 @@ view_update_polygons (ChamplainView *view)
ChamplainPolygon *polygon = CHAMPLAIN_POLYGON (clutter_group_get_nth_child (polygon_layer_group, i));
champlain_polygon_draw_polygon (polygon, priv->map_source, priv->zoom_level,
- priv->viewport_size.width, priv->viewport_size.height,
- priv->viewport_size.x + priv->anchor.x, priv->viewport_size.y + priv->anchor.y);
+ priv->viewport_size.width, priv->viewport_size.height,
+ priv->viewport_size.x + priv->anchor.x, priv->viewport_size.y + priv->anchor.y);
}
/* Position the layer in the viewport */
@@ -3366,6 +3496,7 @@ view_update_polygons (ChamplainView *view)
clutter_actor_set_position (priv->polygon_layer, x, y);
}
+
/**
* champlain_view_add_polygon:
* @view: a #ChamplainView
@@ -3379,7 +3510,7 @@ void
champlain_view_add_polygon (ChamplainView *view,
ChamplainPolygon *polygon)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
@@ -3394,6 +3525,7 @@ champlain_view_add_polygon (ChamplainView *view,
CLUTTER_ACTOR (polygon));
}
+
/**
* champlain_view_remove_polygon:
* @view: a #ChamplainView
@@ -3407,7 +3539,7 @@ void
champlain_view_remove_polygon (ChamplainView *view,
ChamplainPolygon *polygon)
{
- DEBUG_LOG()
+ DEBUG_LOG ()
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
@@ -3415,4 +3547,3 @@ champlain_view_remove_polygon (ChamplainView *view,
clutter_container_remove_actor (CLUTTER_CONTAINER (view->priv->polygon_layer),
CLUTTER_ACTOR (polygon));
}
-
diff --git a/champlain/champlain-view.h b/champlain/champlain-view.h
index 4c35cdc..9f93795 100644
--- a/champlain/champlain-view.h
+++ b/champlain/champlain-view.h
@@ -36,22 +36,22 @@
G_BEGIN_DECLS
-#define CHAMPLAIN_TYPE_VIEW champlain_view_get_type()
+#define CHAMPLAIN_TYPE_VIEW champlain_view_get_type ()
#define CHAMPLAIN_VIEW(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj), CHAMPLAIN_TYPE_VIEW, ChamplainView))
-
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHAMPLAIN_TYPE_VIEW, ChamplainView))
+
#define CHAMPLAIN_VIEW_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass), CHAMPLAIN_TYPE_VIEW, ChamplainViewClass))
-
+ (G_TYPE_CHECK_CLASS_CAST ((klass), CHAMPLAIN_TYPE_VIEW, ChamplainViewClass))
+
#define CHAMPLAIN_IS_VIEW(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj), CHAMPLAIN_TYPE_VIEW))
-
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHAMPLAIN_TYPE_VIEW))
+
#define CHAMPLAIN_IS_VIEW_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass), CHAMPLAIN_TYPE_VIEW))
-
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_VIEW))
+
#define CHAMPLAIN_VIEW_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS((obj), CHAMPLAIN_TYPE_VIEW, ChamplainViewClass))
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_VIEW, ChamplainViewClass))
typedef struct _ChamplainViewPrivate ChamplainViewPrivate;
@@ -62,7 +62,8 @@ typedef struct _ChamplainViewPrivate ChamplainViewPrivate;
*
* Type of scrolling.
*/
-typedef enum {
+typedef enum
+{
CHAMPLAIN_SCROLL_MODE_PUSH,
CHAMPLAIN_SCROLL_MODE_KINETIC
} ChamplainScrollMode;
@@ -167,12 +168,12 @@ gboolean champlain_view_get_coords_at (ChamplainView *view,
gint champlain_view_get_zoom_level (ChamplainView *view);
gint champlain_view_get_min_zoom_level (ChamplainView *view);
gint champlain_view_get_max_zoom_level (ChamplainView *view);
-ChamplainMapSource* champlain_view_get_map_source (ChamplainView *view);
+ChamplainMapSource *champlain_view_get_map_source (ChamplainView *view);
gdouble champlain_view_get_decel_rate (ChamplainView *view);
ChamplainScrollMode champlain_view_get_scroll_mode (ChamplainView *view);
gboolean champlain_view_get_keep_center_on_resize (ChamplainView *view);
gboolean champlain_view_get_show_license (ChamplainView *view);
-const gchar * champlain_view_get_license_text (ChamplainView *view);
+const gchar *champlain_view_get_license_text (ChamplainView *view);
gboolean champlain_view_get_show_scale (ChamplainView *view);
guint champlain_view_get_max_scale_width (ChamplainView *view);
ChamplainUnit champlain_view_get_scale_unit (ChamplainView *view);
diff --git a/champlain/champlain.h b/champlain/champlain.h
index d1ec6f6..2e11284 100644
--- a/champlain/champlain.h
+++ b/champlain/champlain.h
@@ -25,29 +25,35 @@
#include <glib.h>
#include "champlain/champlain-features.h"
-
#include "champlain/champlain-defines.h"
+#include "champlain/champlain-enum-types.h"
+#include "champlain/champlain-version.h"
+
#include "champlain/champlain-layer.h"
#include "champlain/champlain-selection-layer.h"
+#include "champlain/champlain-point.h"
#include "champlain/champlain-base-marker.h"
#include "champlain/champlain-marker.h"
#include "champlain/champlain-view.h"
-#include "champlain/champlain-enum-types.h"
-#include "champlain/champlain-point.h"
+#include "champlain/champlain-bounding-box.h"
+
#include "champlain/champlain-map-source.h"
-#include "champlain/champlain-map-source-chain.h"
#include "champlain/champlain-tile-source.h"
#include "champlain/champlain-tile-cache.h"
-#include "champlain/champlain-memory-cache.h"
-#include "champlain/champlain-network-tile-source.h"
-#include "champlain/champlain-file-cache.h"
-#include "champlain/champlain-null-tile-source.h"
+#include "champlain/champlain-renderer.h"
+
#include "champlain/champlain-map-source-factory.h"
-#include "champlain/champlain-version.h"
-#include "champlain/champlain-bounding-box.h"
-#include "champlain/champlain-file-tile-source.h"
+
+#include "champlain/champlain-map-source-chain.h"
+
+#include "champlain/champlain-network-tile-source.h"
#include "champlain/champlain-network-bbox-tile-source.h"
-#include "champlain/champlain-renderer.h"
+#include "champlain/champlain-file-tile-source.h"
+#include "champlain/champlain-null-tile-source.h"
+
+#include "champlain/champlain-memory-cache.h"
+#include "champlain/champlain-file-cache.h"
+
#include "champlain/champlain-image-renderer.h"
#include "champlain/champlain-error-tile-renderer.h"
diff --git a/demos/animated-marker.c b/demos/animated-marker.c
index e94031c..ebcbe72 100644
--- a/demos/animated-marker.c
+++ b/demos/animated-marker.c
@@ -24,7 +24,7 @@
/* The marker is drawn with cairo. It is composed of 1 static filled circle
* and 1 stroked circle animated as an echo.
*/
-static ClutterActor*
+static ClutterActor *
create_marker ()
{
ClutterActor *marker;
@@ -95,6 +95,7 @@ create_marker ()
return marker;
}
+
double lat = 45.466;
double lon = -73.75;
@@ -114,10 +115,11 @@ gps_callback (GpsCallbackData *data)
return TRUE;
}
+
int
main (int argc, char *argv[])
{
- ClutterActor* actor, *marker, *stage;
+ ClutterActor *actor, *marker, *stage;
ChamplainLayer *layer;
GpsCallbackData callback_data;
diff --git a/demos/launcher-gtk.c b/demos/launcher-gtk.c
index f39ad46..c672784 100644
--- a/demos/launcher-gtk.c
+++ b/demos/launcher-gtk.c
@@ -41,13 +41,13 @@ on_destroy (GtkWidget *widget, gpointer data)
gtk_main_quit ();
}
+
static void
toggle_layer (GtkToggleButton *widget,
- ClutterActor *layer)
+ ClutterActor *layer)
{
- if(gtk_toggle_button_get_active(widget))
+ if (gtk_toggle_button_get_active (widget))
{
-
champlain_polygon_show (polygon);
champlain_layer_animate_in_all_markers (CHAMPLAIN_LAYER (layer));
}
@@ -58,22 +58,24 @@ toggle_layer (GtkToggleButton *widget,
}
}
+
gboolean
mouse_click_cb (ClutterActor *actor, ClutterEvent *event, gpointer data)
{
- gdouble lat, lon;
+ gdouble lat, lon;
- champlain_view_get_coords_from_event (CHAMPLAIN_VIEW (data), event, &lat, &lon);
- g_print ("Mouse click at: %f %f\n", lat, lon);
+ champlain_view_get_coords_from_event (CHAMPLAIN_VIEW (data), event, &lat, &lon);
+ g_print ("Mouse click at: %f %f\n", lat, lon);
- return TRUE;
+ return TRUE;
}
+
static void
map_source_changed (GtkWidget *widget,
- ChamplainView *view)
+ ChamplainView *view)
{
- gchar* id;
+ gchar *id;
ChamplainMapSource *source;
GtkTreeIter iter;
GtkTreeModel *model;
@@ -92,28 +94,33 @@ map_source_changed (GtkWidget *widget,
g_object_unref (factory);
}
+
static void
zoom_changed (GtkSpinButton *spinbutton,
- ChamplainView *view)
+ ChamplainView *view)
{
- gint zoom = gtk_spin_button_get_value_as_int(spinbutton);
- g_object_set(G_OBJECT(view), "zoom-level", zoom, NULL);
+ gint zoom = gtk_spin_button_get_value_as_int (spinbutton);
+
+ g_object_set (G_OBJECT (view), "zoom-level", zoom, NULL);
}
+
static void
map_zoom_changed (ChamplainView *view,
- GParamSpec *gobject,
- GtkSpinButton *spinbutton)
+ GParamSpec *gobject,
+ GtkSpinButton *spinbutton)
{
gint zoom;
- g_object_get(G_OBJECT(view), "zoom-level", &zoom, NULL);
- gtk_spin_button_set_value(spinbutton, zoom);
+
+ g_object_get (G_OBJECT (view), "zoom-level", &zoom, NULL);
+ gtk_spin_button_set_value (spinbutton, zoom);
}
+
static void
view_state_changed (ChamplainView *view,
- GParamSpec *gobject,
- GtkImage *image)
+ GParamSpec *gobject,
+ GtkImage *image)
{
ChamplainState state;
@@ -131,20 +138,23 @@ view_state_changed (ChamplainView *view,
}
}
+
static void
zoom_in (GtkWidget *widget,
- ChamplainView *view)
+ ChamplainView *view)
{
- champlain_view_zoom_in(view);
+ champlain_view_zoom_in (view);
}
+
static void
zoom_out (GtkWidget *widget,
- ChamplainView *view)
+ ChamplainView *view)
{
- champlain_view_zoom_out(view);
+ champlain_view_zoom_out (view);
}
+
static void
build_combo_box (GtkComboBox *box)
{
@@ -156,25 +166,25 @@ build_combo_box (GtkComboBox *box)
GtkCellRenderer *cell;
store = gtk_tree_store_new (N_COLS, G_TYPE_STRING, /* id */
- G_TYPE_STRING, /* name */
- -1);
+ G_TYPE_STRING, /* name */
+ -1);
factory = champlain_map_source_factory_dup_default ();
sources = champlain_map_source_factory_dup_list (factory);
iter = sources;
while (iter != NULL)
- {
- ChamplainMapSourceDesc *desc;
+ {
+ ChamplainMapSourceDesc *desc;
- desc = (ChamplainMapSourceDesc*) iter->data;
+ desc = (ChamplainMapSourceDesc *) iter->data;
- gtk_tree_store_append (store, &parent, NULL );
- gtk_tree_store_set (store, &parent, COL_ID, desc->id,
- COL_NAME, desc->name, -1);
+ gtk_tree_store_append (store, &parent, NULL);
+ gtk_tree_store_set (store, &parent, COL_ID, desc->id,
+ COL_NAME, desc->name, -1);
- iter = g_slist_next (iter);
- }
+ iter = g_slist_next (iter);
+ }
g_slist_free (sources);
g_object_unref (factory);
@@ -184,12 +194,13 @@ build_combo_box (GtkComboBox *box)
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (box), cell, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (box), cell,
- "text", COL_NAME, NULL );
+ "text", COL_NAME, NULL);
}
+
int
main (int argc,
- char *argv[])
+ char *argv[])
{
GtkWidget *window;
GtkWidget *widget, *vbox, *bbox, *button, *viewport;
@@ -215,7 +226,7 @@ main (int argc,
g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (on_destroy),
NULL);
- vbox = gtk_vbox_new(FALSE, 10);
+ vbox = gtk_vbox_new (FALSE, 10);
widget = gtk_champlain_embed_new ();
view = gtk_champlain_embed_get_view (GTK_CHAMPLAIN_EMBED (widget));
@@ -229,10 +240,10 @@ main (int argc,
"license-text", "Don't eat cereals with orange juice\nIt tastes bad",
"show-scale", TRUE,
NULL);
- champlain_view_center_on(CHAMPLAIN_VIEW(view), 45.466, -73.75);
+ champlain_view_center_on (CHAMPLAIN_VIEW (view), 45.466, -73.75);
layer = create_marker_layer (view);
- champlain_view_add_layer(view, layer);
+ champlain_view_add_layer (view, layer);
champlain_layer_hide_all_markers (CHAMPLAIN_LAYER (layer));
polygon = champlain_polygon_new ();
@@ -255,7 +266,7 @@ main (int argc,
gtk_widget_set_size_request (widget, 640, 480);
- bbox = gtk_hbox_new (FALSE, 10);
+ bbox = gtk_hbox_new (FALSE, 10);
button = gtk_button_new_from_stock (GTK_STOCK_ZOOM_IN);
g_signal_connect (button, "clicked", G_CALLBACK (zoom_in), view);
gtk_container_add (GTK_CONTAINER (bbox), button);
@@ -264,7 +275,7 @@ main (int argc,
g_signal_connect (button, "clicked", G_CALLBACK (zoom_out), view);
gtk_container_add (GTK_CONTAINER (bbox), button);
- button = gtk_toggle_button_new_with_label ("Markers");
+ button = gtk_toggle_button_new_with_label ("Markers");
g_signal_connect (button, "toggled", G_CALLBACK (toggle_layer), layer);
gtk_container_add (GTK_CONTAINER (bbox), button);
@@ -274,7 +285,7 @@ main (int argc,
g_signal_connect (button, "changed", G_CALLBACK (map_source_changed), view);
gtk_container_add (GTK_CONTAINER (bbox), button);
- button = gtk_spin_button_new_with_range(0, 20, 1);
+ button = gtk_spin_button_new_with_range (0, 20, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (button),
champlain_view_get_zoom_level (view));
g_signal_connect (button, "changed", G_CALLBACK (zoom_changed), view);
@@ -303,4 +314,3 @@ main (int argc,
return 0;
}
-
diff --git a/demos/launcher.c b/demos/launcher.c
index 32775ac..a7a5fd8 100644
--- a/demos/launcher.c
+++ b/demos/launcher.c
@@ -24,38 +24,41 @@
static gboolean
map_view_button_release_cb (G_GNUC_UNUSED ClutterActor *actor,
ClutterButtonEvent *event,
- ChamplainView * view)
+ ChamplainView *view)
{
gdouble lat, lon;
if (event->button != 1 || event->click_count > 1)
return FALSE;
- if (champlain_view_get_coords_from_event (view, (ClutterEvent*)event, &lat,
- &lon))
- g_print("Map clicked at %f, %f \n", lat, lon);
+ if (champlain_view_get_coords_from_event (view, (ClutterEvent *) event, &lat,
+ &lon))
+ g_print ("Map clicked at %f, %f \n", lat, lon);
return TRUE;
}
+
static gboolean
zoom_in (G_GNUC_UNUSED ClutterActor *actor,
G_GNUC_UNUSED ClutterButtonEvent *event,
- ChamplainView * view)
+ ChamplainView *view)
{
champlain_view_zoom_in (view);
return TRUE;
}
+
static gboolean
zoom_out (G_GNUC_UNUSED ClutterActor *actor,
G_GNUC_UNUSED ClutterButtonEvent *event,
- ChamplainView * view)
+ ChamplainView *view)
{
champlain_view_zoom_out (view);
return TRUE;
}
+
static ClutterActor *
make_button (char *text)
{
@@ -81,11 +84,12 @@ make_button (char *text)
return button;
}
+
int
main (int argc,
char *argv[])
{
- ClutterActor* actor, *stage, *buttons, *button;
+ ClutterActor *actor, *stage, *buttons, *button;
ChamplainLayer *layer;
gfloat width, total_width = 0;
@@ -137,7 +141,7 @@ main (int argc,
/* Finish initialising the map view */
g_object_set (G_OBJECT (actor), "zoom-level", 12,
"scroll-mode", CHAMPLAIN_SCROLL_MODE_KINETIC, NULL);
- champlain_view_center_on(CHAMPLAIN_VIEW(actor), 45.466, -73.75);
+ champlain_view_center_on (CHAMPLAIN_VIEW (actor), 45.466, -73.75);
clutter_actor_show (stage);
clutter_main ();
diff --git a/demos/local-rendering.c b/demos/local-rendering.c
index c114117..e6a1e35 100644
--- a/demos/local-rendering.c
+++ b/demos/local-rendering.c
@@ -58,8 +58,10 @@ on_destroy (GtkWidget *widget, gpointer data)
gtk_main_quit ();
}
-static void color_gdk_to_clutter (const GdkColor *gdk_color,
- ClutterColor *clutter_color)
+
+static void
+color_gdk_to_clutter (const GdkColor *gdk_color,
+ ClutterColor *clutter_color)
{
clutter_color->red = CLAMP (((gdk_color->red / 65535.0) * 255), 0, 255);
clutter_color->green = CLAMP (((gdk_color->green / 65535.0) * 255), 0, 255);
@@ -67,32 +69,36 @@ static void color_gdk_to_clutter (const GdkColor *gdk_color,
clutter_color->alpha = 255;
}
-static void color_clutter_to_gdk (const ClutterColor *clutter_color,
- GdkColor *gdk_color)
+
+static void
+color_clutter_to_gdk (const ClutterColor *clutter_color,
+ GdkColor *gdk_color)
{
gdk_color->red = ((guint16) clutter_color->red) << 8;
gdk_color->green = ((guint16) clutter_color->green) << 8;
gdk_color->blue = ((guint16) clutter_color->blue) << 8;
}
+
static void
data_source_state_changed (ChamplainNetworkBboxTileSource *source,
- GtkImage *image)
+ GtkImage *image)
{
gtk_image_clear (image);
g_print ("NET DATA SOURCE STATE: done\n");
g_signal_handlers_disconnect_by_func (source,
- data_source_state_changed,
- image);
+ data_source_state_changed,
+ image);
}
+
static void
load_network_map_data (ChamplainNetworkBboxTileSource *source, ChamplainView *view)
{
gdouble lat, lon;
g_signal_connect (source, "data-loaded", G_CALLBACK (data_source_state_changed),
- map_data_state_img);
+ map_data_state_img);
gtk_image_set_from_stock (GTK_IMAGE (map_data_state_img), GTK_STOCK_NETWORK, GTK_ICON_SIZE_BUTTON);
g_print ("NET DATA SOURCE STATE: loading\n");
@@ -102,17 +108,18 @@ load_network_map_data (ChamplainNetworkBboxTileSource *source, ChamplainView *vi
lon - 0.008, lat - 0.008, lon + 0.008, lat + 0.008);
}
+
static void
load_rules_into_gui (ChamplainView *view)
{
- GList* ids, *ptr;
+ GList *ids, *ptr;
GtkTreeModel *store;
GtkTreeIter iter;
GdkColor gdk_color;
ClutterColor *clutter_color;
ChamplainMemphisRenderer *renderer;
- renderer = CHAMPLAIN_MEMPHIS_RENDERER ( champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (tile_source)));
+ renderer = CHAMPLAIN_MEMPHIS_RENDERER (champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (tile_source)));
ids = champlain_memphis_renderer_get_rule_ids (renderer);
clutter_color = champlain_memphis_renderer_get_background_color (renderer);
@@ -136,6 +143,7 @@ load_rules_into_gui (ChamplainView *view)
g_list_free (ids);
}
+
static void
rule_window_close_cb (GtkWidget *widget, gpointer data)
{
@@ -145,6 +153,7 @@ rule_window_close_cb (GtkWidget *widget, gpointer data)
rule_edit_window = NULL;
}
+
static void
rule_apply_cb (GtkWidget *widget, ChamplainMemphisRenderer *renderer)
{
@@ -194,6 +203,7 @@ rule_apply_cb (GtkWidget *widget, ChamplainMemphisRenderer *renderer)
champlain_memphis_renderer_set_rule (renderer, rule);
}
+
GtkWidget *
gtk_memphis_prop_new (gint type, ChamplainMemphisRuleAttr *attr)
{
@@ -252,9 +262,10 @@ gtk_memphis_prop_new (gint type, ChamplainMemphisRuleAttr *attr)
return hbox;
}
+
static void
-create_rule_edit_window (ChamplainMemphisRule *rule, gchar* id,
- ChamplainMemphisRenderer *renderer)
+create_rule_edit_window (ChamplainMemphisRule *rule, gchar *id,
+ ChamplainMemphisRenderer *renderer)
{
GtkWidget *label, *table, *props, *button;
@@ -264,11 +275,11 @@ create_rule_edit_window (ChamplainMemphisRule *rule, gchar* id,
gtk_container_set_border_width (GTK_CONTAINER (rule_edit_window), 10);
gtk_window_set_title (GTK_WINDOW (rule_edit_window), id);
gtk_window_set_position (GTK_WINDOW (rule_edit_window),
- GTK_WIN_POS_CENTER_ON_PARENT);
+ GTK_WIN_POS_CENTER_ON_PARENT);
gtk_window_set_transient_for (GTK_WINDOW (rule_edit_window),
- GTK_WINDOW (window));
+ GTK_WINDOW (window));
g_signal_connect (G_OBJECT (rule_edit_window), "destroy",
- G_CALLBACK (rule_window_close_cb), NULL);
+ G_CALLBACK (rule_window_close_cb), NULL);
table = gtk_table_new (6, 2, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 8);
@@ -320,10 +331,10 @@ create_rule_edit_window (ChamplainMemphisRule *rule, gchar* id,
button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (button), "clicked",
- G_CALLBACK (rule_window_close_cb), NULL);
+ G_CALLBACK (rule_window_close_cb), NULL);
button = gtk_button_new_from_stock (GTK_STOCK_APPLY);
g_signal_connect (G_OBJECT (button), "clicked",
- G_CALLBACK (rule_apply_cb), renderer);
+ G_CALLBACK (rule_apply_cb), renderer);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
GtkWidget *mainbox = gtk_vbox_new (FALSE, 0);
@@ -334,6 +345,7 @@ create_rule_edit_window (ChamplainMemphisRule *rule, gchar* id,
gtk_widget_show_all (rule_edit_window);
}
+
static void
zoom_to_map_data (GtkWidget *widget, ChamplainView *view)
{
@@ -341,12 +353,12 @@ zoom_to_map_data (GtkWidget *widget, ChamplainView *view)
ChamplainBoundingBox *bbox;
gdouble lat, lon;
- renderer = CHAMPLAIN_MEMPHIS_RENDERER ( champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (tile_source)));
+ renderer = CHAMPLAIN_MEMPHIS_RENDERER (champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (tile_source)));
g_object_get (G_OBJECT (renderer), "bounding-box", &bbox, NULL);
champlain_bounding_box_get_center (bbox, &lat, &lon);
- champlain_view_center_on (CHAMPLAIN_VIEW(view), lat, lon);
- champlain_view_set_zoom_level (CHAMPLAIN_VIEW(view), 15);
+ champlain_view_center_on (CHAMPLAIN_VIEW (view), lat, lon);
+ champlain_view_set_zoom_level (CHAMPLAIN_VIEW (view), 15);
}
@@ -354,6 +366,7 @@ static void
request_osm_data_cb (GtkWidget *widget, ChamplainView *view)
{
gdouble lat, lon;
+
g_object_get (G_OBJECT (view), "latitude", &lat, "longitude", &lon, NULL);
if (g_strcmp0 (champlain_map_source_get_id (tile_source), "memphis-network") == 0)
@@ -363,6 +376,7 @@ request_osm_data_cb (GtkWidget *widget, ChamplainView *view)
}
}
+
void
bg_color_set_cb (GtkColorButton *widget, ChamplainView *view)
{
@@ -376,16 +390,17 @@ bg_color_set_cb (GtkColorButton *widget, ChamplainView *view)
ClutterColor clutter_color;
color_gdk_to_clutter (&gdk_color, &clutter_color);
- renderer = CHAMPLAIN_MEMPHIS_RENDERER ( champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (tile_source)));
+ renderer = CHAMPLAIN_MEMPHIS_RENDERER (champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (tile_source)));
champlain_memphis_renderer_set_background_color (renderer, &clutter_color);
}
}
+
static void
map_source_changed (GtkWidget *widget, ChamplainView *view)
{
- gchar* id;
+ gchar *id;
ChamplainMapSource *source;
GtkTreeIter iter;
GtkTreeModel *model;
@@ -400,7 +415,7 @@ map_source_changed (GtkWidget *widget, ChamplainView *view)
ChamplainMapSourceFactory *factory = champlain_map_source_factory_dup_default ();
source = champlain_map_source_factory_create (factory, id);
- renderer = CHAMPLAIN_MEMPHIS_RENDERER ( champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (source)));
+ renderer = CHAMPLAIN_MEMPHIS_RENDERER (champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (source)));
if (source != NULL)
{
@@ -434,7 +449,7 @@ map_source_changed (GtkWidget *widget, ChamplainView *view)
gtk_widget_set_no_show_all (memphis_box, TRUE);
}
- tile_source = CHAMPLAIN_MAP_SOURCE(source);
+ tile_source = CHAMPLAIN_MAP_SOURCE (source);
source_chain = champlain_map_source_chain_new ();
@@ -444,7 +459,7 @@ map_source_changed (GtkWidget *widget, ChamplainView *view)
champlain_map_source_chain_push (source_chain, src);
champlain_map_source_chain_push (source_chain, tile_source);
- src = CHAMPLAIN_MAP_SOURCE(champlain_memory_cache_new_full (100, CHAMPLAIN_RENDERER (champlain_image_renderer_new ())));
+ src = CHAMPLAIN_MAP_SOURCE (champlain_memory_cache_new_full (100, CHAMPLAIN_RENDERER (champlain_image_renderer_new ())));
champlain_map_source_set_renderer (src, CHAMPLAIN_RENDERER (champlain_image_renderer_new ()));
champlain_map_source_chain_push (source_chain, src);
@@ -457,6 +472,7 @@ map_source_changed (GtkWidget *widget, ChamplainView *view)
g_object_unref (factory);
}
+
static void
map_data_changed (GtkWidget *widget, ChamplainView *view)
{
@@ -476,10 +492,11 @@ map_data_changed (GtkWidget *widget, ChamplainView *view)
champlain_file_tile_source_load_map_data (CHAMPLAIN_FILE_TILE_SOURCE (tile_source), maps[map_index]);
}
+
static void
rules_changed (GtkWidget *widget, ChamplainView *view)
{
- gchar* file;
+ gchar *file;
GtkTreeIter iter;
GtkTreeModel *model;
@@ -493,44 +510,51 @@ rules_changed (GtkWidget *widget, ChamplainView *view)
{
ChamplainMemphisRenderer *renderer;
- renderer = CHAMPLAIN_MEMPHIS_RENDERER ( champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (tile_source)));
+ renderer = CHAMPLAIN_MEMPHIS_RENDERER (champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (tile_source)));
champlain_memphis_renderer_load_rules (renderer, file);
load_rules_into_gui (view);
}
}
+
static void
zoom_changed (GtkSpinButton *spinbutton,
- ChamplainView *view)
+ ChamplainView *view)
{
gint zoom = gtk_spin_button_get_value_as_int (spinbutton);
- g_object_set (G_OBJECT(view), "zoom-level", zoom, NULL);
+
+ g_object_set (G_OBJECT (view), "zoom-level", zoom, NULL);
}
+
static void
map_zoom_changed (ChamplainView *view,
- GParamSpec *gobject,
- GtkSpinButton *spinbutton)
+ GParamSpec *gobject,
+ GtkSpinButton *spinbutton)
{
gint zoom;
- g_object_get (G_OBJECT(view), "zoom-level", &zoom, NULL);
+
+ g_object_get (G_OBJECT (view), "zoom-level", &zoom, NULL);
gtk_spin_button_set_value (spinbutton, zoom);
}
+
static void
zoom_in (GtkWidget *widget,
- ChamplainView *view)
+ ChamplainView *view)
{
champlain_view_zoom_in (view);
}
+
static void
zoom_out (GtkWidget *widget,
- ChamplainView *view)
+ ChamplainView *view)
{
champlain_view_zoom_out (view);
}
+
static void
build_source_combo_box (GtkComboBox *box)
{
@@ -542,8 +566,8 @@ build_source_combo_box (GtkComboBox *box)
GtkCellRenderer *cell;
store = gtk_tree_store_new (N_COLS, G_TYPE_STRING, /* id */
- G_TYPE_STRING, /* name */
- -1);
+ G_TYPE_STRING, /* name */
+ -1);
factory = champlain_map_source_factory_dup_default ();
sources = champlain_map_source_factory_dup_list (factory);
@@ -553,11 +577,11 @@ build_source_combo_box (GtkComboBox *box)
{
ChamplainMapSourceDesc *desc;
- desc = (ChamplainMapSourceDesc*) iter->data;
+ desc = (ChamplainMapSourceDesc *) iter->data;
gtk_tree_store_append (store, &parent, NULL);
gtk_tree_store_set (store, &parent, COL_ID, desc->id,
- COL_NAME, desc->name, -1);
+ COL_NAME, desc->name, -1);
iter = g_slist_next (iter);
}
@@ -570,9 +594,10 @@ build_source_combo_box (GtkComboBox *box)
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (box), cell, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (box), cell,
- "text", COL_NAME, NULL);
+ "text", COL_NAME, NULL);
}
+
static void
build_data_combo_box (GtkComboBox *box)
{
@@ -581,24 +606,25 @@ build_data_combo_box (GtkComboBox *box)
GtkCellRenderer *cell;
store = gtk_tree_store_new (2, G_TYPE_STRING, /* file name */
- G_TYPE_INT, /* index */ -1);
+ G_TYPE_INT, /* index */ -1);
gtk_tree_store_append (store, &parent, NULL);
gtk_tree_store_set (store, &parent, 0, maps[0],
- 1, 0, -1);
+ 1, 0, -1);
gtk_tree_store_append (store, &parent, NULL);
gtk_tree_store_set (store, &parent, 0, maps[1],
- 1, 1, -1);
+ 1, 1, -1);
gtk_combo_box_set_model (box, GTK_TREE_MODEL (store));
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (box), cell, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (box), cell,
- "text", 0, NULL);
+ "text", 0, NULL);
}
+
static void
build_rules_combo_box (GtkComboBox *box)
{
@@ -618,13 +644,15 @@ build_rules_combo_box (GtkComboBox *box)
cell = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (box), cell, FALSE);
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (box), cell,
- "text", 0, NULL);
+ "text", 0, NULL);
}
-void list_item_selected_cb (GtkTreeView *tree_view,
- GtkTreePath *path,
- GtkTreeViewColumn *column,
- ChamplainView *view)
+
+void
+list_item_selected_cb (GtkTreeView *tree_view,
+ GtkTreePath *path,
+ GtkTreeViewColumn *column,
+ ChamplainView *view)
{
GtkTreeIter iter;
GtkTreeModel *model;
@@ -639,7 +667,7 @@ void list_item_selected_cb (GtkTreeView *tree_view,
{
ChamplainMemphisRenderer *renderer;
- renderer = CHAMPLAIN_MEMPHIS_RENDERER ( champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (tile_source)));
+ renderer = CHAMPLAIN_MEMPHIS_RENDERER (champlain_map_source_get_renderer (CHAMPLAIN_MAP_SOURCE (tile_source)));
gtk_tree_model_get (model, &iter, 0, &id, -1);
@@ -652,9 +680,10 @@ void list_item_selected_cb (GtkTreeView *tree_view,
}
}
+
int
main (int argc,
- char *argv[])
+ char *argv[])
{
GtkWidget *widget, *hbox, *bbox, *menubox, *button, *viewport, *label;
ChamplainView *view;
@@ -676,7 +705,7 @@ main (int argc,
* stop the main GTK loop
*/
g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (on_destroy),
- NULL);
+ NULL);
hbox = gtk_hbox_new (FALSE, 10);
menubox = gtk_vbox_new (FALSE, 10);
@@ -691,12 +720,12 @@ main (int argc,
view = gtk_champlain_embed_get_view (GTK_CHAMPLAIN_EMBED (widget));
g_object_set (G_OBJECT (view), "scroll-mode", CHAMPLAIN_SCROLL_MODE_KINETIC,
- "zoom-level", 9, NULL);
+ "zoom-level", 9, NULL);
gtk_widget_set_size_request (widget, 640, 480);
/* first line of buttons */
- bbox = gtk_hbox_new (FALSE, 10);
+ bbox = gtk_hbox_new (FALSE, 10);
button = gtk_button_new_from_stock (GTK_STOCK_ZOOM_IN);
g_signal_connect (button, "clicked", G_CALLBACK (zoom_in), view);
gtk_container_add (GTK_CONTAINER (bbox), button);
@@ -707,10 +736,10 @@ main (int argc,
button = gtk_spin_button_new_with_range (0, 20, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (button),
- champlain_view_get_zoom_level (view));
+ champlain_view_get_zoom_level (view));
g_signal_connect (button, "changed", G_CALLBACK (zoom_changed), view);
g_signal_connect (view, "notify::zoom-level", G_CALLBACK (map_zoom_changed),
- button);
+ button);
gtk_container_add (GTK_CONTAINER (bbox), button);
gtk_box_pack_start (GTK_BOX (menubox), bbox, FALSE, FALSE, 0);
@@ -758,7 +787,7 @@ main (int argc,
gtk_box_pack_start (GTK_BOX (memphis_box), button, FALSE, FALSE, 0);
/* bg chooser */
- bbox = gtk_hbox_new (FALSE, 10);
+ bbox = gtk_hbox_new (FALSE, 10);
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), "Background color");
@@ -773,7 +802,7 @@ main (int argc,
/* rules list */
label = gtk_label_new ("Rules");
- bbox = gtk_hbox_new (FALSE, 10);
+ bbox = gtk_hbox_new (FALSE, 10);
gtk_box_pack_start (GTK_BOX (bbox), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (memphis_box), bbox, FALSE, FALSE, 0);
@@ -784,7 +813,7 @@ main (int argc,
store = gtk_list_store_new (1, G_TYPE_STRING);
- tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(store));
+ tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
rules_tree_view = tree_view;
g_object_unref (store);
renderer = gtk_cell_renderer_text_new ();
@@ -793,13 +822,13 @@ main (int argc,
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);
- gtk_tree_view_get_selection (GTK_TREE_VIEW(tree_view));
- g_signal_connect (tree_view, "row-activated", G_CALLBACK(list_item_selected_cb), view);
+ gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
+ g_signal_connect (tree_view, "row-activated", G_CALLBACK (list_item_selected_cb), view);
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(scrolled), tree_view);
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled), tree_view);
gtk_box_pack_start (GTK_BOX (memphis_box), scrolled, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (menubox), memphis_box, TRUE, TRUE, 0);
@@ -816,10 +845,9 @@ main (int argc,
/* make sure that everything, window and label, are visible */
gtk_widget_show_all (window);
- champlain_view_center_on (CHAMPLAIN_VIEW(view), 28.13476, -15.43814);
+ champlain_view_center_on (CHAMPLAIN_VIEW (view), 28.13476, -15.43814);
/* start the main loop */
gtk_main ();
return 0;
}
-
diff --git a/demos/markers.c b/demos/markers.c
index 20ec3b3..b3e4932 100644
--- a/demos/markers.c
+++ b/demos/markers.c
@@ -28,8 +28,8 @@
/*
static gboolean
marker_button_release_cb (ClutterActor *actor,
- ClutterButtonEvent *event,
- ChamplainView * view)
+ ClutterButtonEvent *event,
+ ChamplainView * view)
{
if (event->button != 1 || event->click_count > 1)
return FALSE;
@@ -50,7 +50,7 @@ create_marker_layer (G_GNUC_UNUSED ChamplainView *view)
layer = champlain_selection_layer_new ();
marker = champlain_marker_new_with_text ("Montréal\n<span size=\"xx-small\">Québec</span>",
- "Serif 14", NULL, NULL);
+ "Serif 14", NULL, NULL);
champlain_marker_set_use_markup (CHAMPLAIN_MARKER (marker), TRUE);
champlain_marker_set_alignment (CHAMPLAIN_MARKER (marker), PANGO_ALIGN_RIGHT);
champlain_marker_set_color (CHAMPLAIN_MARKER (marker), &orange);
@@ -65,8 +65,8 @@ create_marker_layer (G_GNUC_UNUSED ChamplainView *view)
clutter_actor_set_reactive (marker, TRUE);
g_signal_connect_after (marker, "button-release-event",
- G_CALLBACK (marker_button_release_cb), view);
- */
+ G_CALLBACK (marker_button_release_cb), view);
+ */
marker = champlain_marker_new_from_file ("/usr/share/icons/gnome/24x24/emblems/emblem-generic.png", NULL);
champlain_marker_set_text (CHAMPLAIN_MARKER (marker), "New York");
diff --git a/demos/markers.h b/demos/markers.h
index 5d1e16f..8c97014 100644
--- a/demos/markers.h
+++ b/demos/markers.h
@@ -21,6 +21,6 @@
#ifndef MARKERS_H
#define MARKERS_H
-ChamplainLayer * create_marker_layer (ChamplainView *view);
+ChamplainLayer *create_marker_layer (ChamplainView *view);
#endif
diff --git a/demos/minimal-gtk.c b/demos/minimal-gtk.c
index c084732..386a1a6 100644
--- a/demos/minimal-gtk.c
+++ b/demos/minimal-gtk.c
@@ -43,8 +43,8 @@ main (int argc, char *argv[])
ChamplainView *view = gtk_champlain_embed_get_view (GTK_CHAMPLAIN_EMBED (widget));
g_object_set (G_OBJECT (view), "scroll-mode", CHAMPLAIN_SCROLL_MODE_KINETIC,
- "zoom-level", 5, NULL);
- champlain_view_center_on(CHAMPLAIN_VIEW(view), 45.466, -73.75);
+ "zoom-level", 5, NULL);
+ champlain_view_center_on (CHAMPLAIN_VIEW (view), 45.466, -73.75);
/* insert it into the widget you wish */
gtk_container_add (GTK_CONTAINER (window), widget);
diff --git a/demos/minimal.c b/demos/minimal.c
index 1578de9..4a66c6e 100644
--- a/demos/minimal.c
+++ b/demos/minimal.c
@@ -21,7 +21,7 @@
int
main (int argc, char *argv[])
{
- ClutterActor* actor, *stage;
+ ClutterActor *actor, *stage;
g_thread_init (NULL);
clutter_init (&argc, &argv);
@@ -38,6 +38,6 @@ main (int argc, char *argv[])
clutter_main ();
clutter_actor_destroy (actor);
-
+
return 0;
}
diff --git a/demos/polygons.c b/demos/polygons.c
index e4bda82..5d07bb3 100644
--- a/demos/polygons.c
+++ b/demos/polygons.c
@@ -23,21 +23,23 @@
static gboolean
zoom_in (G_GNUC_UNUSED ClutterActor *actor,
G_GNUC_UNUSED ClutterButtonEvent *event,
- ChamplainView * view)
+ ChamplainView *view)
{
champlain_view_zoom_in (view);
return TRUE;
}
+
static gboolean
zoom_out (G_GNUC_UNUSED ClutterActor *actor,
G_GNUC_UNUSED ClutterButtonEvent *event,
- ChamplainView * view)
+ ChamplainView *view)
{
champlain_view_zoom_out (view);
return TRUE;
}
+
static ClutterActor *
make_button (char *text)
{
@@ -63,11 +65,12 @@ make_button (char *text)
return button;
}
+
int
main (int argc,
char *argv[])
{
- ClutterActor* actor, *stage, *buttons, *button;
+ ClutterActor *actor, *stage, *buttons, *button;
ChamplainPolygon *polygon;
gfloat width, total_width = 0;;
diff --git a/demos/url-marker.c b/demos/url-marker.c
index 56af5d1..267f696 100644
--- a/demos/url-marker.c
+++ b/demos/url-marker.c
@@ -21,7 +21,8 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
/* The data needed for constructing a marker */
-typedef struct {
+typedef struct
+{
ChamplainLayer *layer;
gdouble latitude;
gdouble longitude;
@@ -35,7 +36,7 @@ typedef struct {
*
* The GdkPixbuf has to be freed with g_object_unref.
*/
-static GdkPixbuf*
+static GdkPixbuf *
pixbuf_new_from_message (SoupMessage *message,
GError **error)
{
@@ -48,9 +49,9 @@ pixbuf_new_from_message (SoupMessage *message,
/* Use a pixbuf loader that can load images of the same mime-type as the
message.
- */
+ */
mime_type = soup_message_headers_get (message->response_headers,
- "Content-Type");
+ "Content-Type");
loader = gdk_pixbuf_loader_new_with_mime_type (mime_type, error);
if (loader != NULL)
pixbuf_is_open = TRUE;
@@ -60,7 +61,7 @@ pixbuf_new_from_message (SoupMessage *message,
gdk_pixbuf_loader_write (
loader,
- (guchar *)message->response_body->data,
+ (guchar *) message->response_body->data,
message->response_body->length,
error);
if (*error != NULL)
@@ -78,14 +79,15 @@ pixbuf_new_from_message (SoupMessage *message,
cleanup:
if (pixbuf_is_open)
- gdk_pixbuf_loader_close (loader, NULL);
+ gdk_pixbuf_loader_close (loader, NULL);
if (loader != NULL)
- g_object_unref (G_OBJECT (loader));
+ g_object_unref (G_OBJECT (loader));
return pixbuf;
}
+
/**
* Transforms a GdkPixbuf into a ClutterTexture.
* If there's an error building the ClutterActor (the texture) the function
@@ -96,7 +98,7 @@ cleanup:
*
* The ClutterActor has to be freed with clutter_actor_destroy.
*/
-static ClutterActor*
+static ClutterActor *
texture_new_from_pixbuf (GdkPixbuf *pixbuf, GError **error)
{
ClutterActor *texture = NULL;
@@ -115,14 +117,14 @@ texture_new_from_pixbuf (GdkPixbuf *pixbuf, GError **error)
texture = clutter_texture_new ();
success = clutter_texture_set_from_rgb_data (CLUTTER_TEXTURE (texture),
- data,
- has_alpha,
- width,
- height,
- rowstride,
- (has_alpha ? 4 : 3),
- flags,
- error);
+ data,
+ has_alpha,
+ width,
+ height,
+ rowstride,
+ (has_alpha ? 4 : 3),
+ flags,
+ error);
if (!success)
{
@@ -133,6 +135,7 @@ texture_new_from_pixbuf (GdkPixbuf *pixbuf, GError **error)
return texture;
}
+
/**
* Called when an image has been downloaded. This callback will transform the
* image data (binary chunk sent by the remote web server) into a valid Clutter
@@ -161,7 +164,7 @@ image_downloaded_cb (SoupSession *session,
/* Deal only with finished messages */
uri = soup_message_get_uri (message);
url = soup_uri_to_string (uri, FALSE);
- if (! SOUP_STATUS_IS_SUCCESSFUL (message->status_code))
+ if (!SOUP_STATUS_IS_SUCCESSFUL (message->status_code))
{
g_print ("Download of %s failed with error code %d\n", url,
message->status_code);
@@ -180,7 +183,7 @@ image_downloaded_cb (SoupSession *session,
if (error != NULL)
{
g_print ("Failed to convert %s into a texture: %s\n", url,
- error->message);
+ error->message);
goto cleanup;
}
@@ -208,6 +211,7 @@ cleanup:
clutter_actor_destroy (CLUTTER_ACTOR (texture));
}
+
/**
* Creates a marker at the given position with an image that's downloaded from
* the given URL.
@@ -223,7 +227,7 @@ create_marker_from_url (ChamplainLayer *layer,
SoupMessage *message;
MarkerData *data;
- data = g_new0(MarkerData, 1);
+ data = g_new0 (MarkerData, 1);
data->layer = g_object_ref (layer);
data->latitude = latitude;
data->longitude = longitude;
@@ -232,6 +236,7 @@ create_marker_from_url (ChamplainLayer *layer,
soup_session_queue_message (session, message, image_downloaded_cb, data);
}
+
int
main (int argc, char *argv[])
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]