[libchamplain] Access private members through priv member of the class. Everywhere.
- From: Pierre-Luc Beaudoin <plbeaudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] Access private members through priv member of the class. Everywhere.
- Date: Tue, 23 Mar 2010 14:43:31 +0000 (UTC)
commit b92ec98dd84f50b05f4e7f80f76a15d7fa65bb61
Author: JiÅ?Ã Techet <techet gmail com>
Date: Sat Mar 20 14:30:28 2010 +0100
Access private members through priv member of the class. Everywhere.
Signed-off-by: JiÅ?Ã Techet <techet gmail com>
champlain/champlain-base-marker.c | 20 +--
champlain/champlain-error-tile-source.c | 7 +-
champlain/champlain-error-tile-source.h | 4 +
champlain/champlain-file-cache.c | 40 +++---
champlain/champlain-file-cache.h | 4 +
champlain/champlain-local-map-data-source.c | 12 +-
champlain/champlain-local-map-data-source.h | 4 +
champlain/champlain-map-data-source.c | 10 +-
champlain/champlain-map-data-source.h | 4 +
champlain/champlain-map-source-chain.c | 30 ++--
champlain/champlain-map-source-chain.h | 4 +
champlain/champlain-map-source.c | 18 +-
champlain/champlain-map-source.h | 4 +
champlain/champlain-marker.c | 111 +++++---------
champlain/champlain-marker.h | 2 +
champlain/champlain-memphis-tile-source.c | 48 +++----
champlain/champlain-memphis-tile-source.h | 4 +
champlain/champlain-network-map-data-source.c | 26 ++--
champlain/champlain-network-map-data-source.h | 4 +
champlain/champlain-network-tile-source.c | 35 ++---
champlain/champlain-network-tile-source.h | 4 +
champlain/champlain-polygon.c | 72 +++------
champlain/champlain-polygon.h | 2 +
champlain/champlain-tile-cache.c | 9 +-
champlain/champlain-tile-cache.h | 4 +
champlain/champlain-tile-source.c | 66 +++-----
champlain/champlain-tile-source.h | 4 +
champlain/champlain-tile.c | 42 +++---
champlain/champlain-tile.h | 2 +
champlain/champlain-view.c | 204 ++++++++++---------------
champlain/champlain-view.h | 2 +
31 files changed, 352 insertions(+), 450 deletions(-)
---
diff --git a/champlain/champlain-base-marker.c b/champlain/champlain-base-marker.c
index 97725db..69f86d7 100644
--- a/champlain/champlain-base-marker.c
+++ b/champlain/champlain-base-marker.c
@@ -76,7 +76,7 @@ champlain_base_marker_get_property (GObject *object,
GParamSpec *pspec)
{
ChamplainBaseMarker *base_marker = CHAMPLAIN_BASE_MARKER (object);
- ChamplainBaseMarkerPrivate *priv = CHAMPLAIN_BASE_MARKER_GET_PRIVATE (base_marker);
+ ChamplainBaseMarkerPrivate *priv = base_marker->priv;
switch (prop_id)
{
@@ -101,7 +101,7 @@ champlain_base_marker_set_property (GObject *object,
GParamSpec *pspec)
{
ChamplainBaseMarker *base_marker = CHAMPLAIN_BASE_MARKER (object);
- ChamplainBaseMarkerPrivate *priv = CHAMPLAIN_BASE_MARKER_GET_PRIVATE (base_marker);
+ ChamplainBaseMarkerPrivate *priv = base_marker->priv;
switch (prop_id)
{
@@ -131,9 +131,6 @@ champlain_base_marker_set_property (GObject *object,
static void
champlain_base_marker_finalize (GObject *object)
{
- //ChamplainBaseMarker *base_marker = CHAMPLAIN_BASE_MARKER (object);
- //ChamplainBaseMarkerPrivate *priv = CHAMPLAIN_BASE_MARKER_GET_PRIVATE (base_marker);
-
G_OBJECT_CLASS (champlain_base_marker_parent_class)->finalize (object);
}
@@ -188,7 +185,9 @@ static void
champlain_base_marker_init (ChamplainBaseMarker *marker)
{
ChamplainBaseMarkerPrivate *priv = CHAMPLAIN_BASE_MARKER_GET_PRIVATE (marker);
+
marker->priv = priv;
+
priv->lat = 0;
priv->lon = 0;
priv->highlighted = FALSE;
@@ -208,7 +207,6 @@ champlain_base_marker_new (void)
ChamplainBaseMarker *base_marker;
base_marker = CHAMPLAIN_BASE_MARKER (g_object_new (CHAMPLAIN_TYPE_BASE_MARKER, NULL));
- //ChamplainBaseMarkerPrivate *priv = CHAMPLAIN_BASE_MARKER_GET_PRIVATE (base_marker);
return CLUTTER_ACTOR (base_marker);
}
@@ -230,7 +228,7 @@ champlain_base_marker_set_position (ChamplainBaseMarker *champlainBaseMarker,
{
g_return_if_fail (CHAMPLAIN_IS_BASE_MARKER (champlainBaseMarker));
- ChamplainBaseMarkerPrivate *priv = CHAMPLAIN_BASE_MARKER_GET_PRIVATE (champlainBaseMarker);
+ ChamplainBaseMarkerPrivate *priv = champlainBaseMarker->priv;
priv->lon = longitude;
priv->lat = latitude;
@@ -255,9 +253,7 @@ champlain_base_marker_set_highlighted (ChamplainBaseMarker *champlainBaseMarker,
{
g_return_if_fail (CHAMPLAIN_IS_BASE_MARKER (champlainBaseMarker));
- ChamplainBaseMarkerPrivate *priv = CHAMPLAIN_BASE_MARKER_GET_PRIVATE (champlainBaseMarker);
-
- priv->highlighted = value;
+ champlainBaseMarker->priv->highlighted = value;
g_object_notify (G_OBJECT (champlainBaseMarker), "highlighted");
}
@@ -275,9 +271,7 @@ champlain_base_marker_get_highlighted (ChamplainBaseMarker *champlainBaseMarker)
{
g_return_val_if_fail (CHAMPLAIN_IS_BASE_MARKER (champlainBaseMarker), FALSE);
- ChamplainBaseMarkerPrivate *priv = CHAMPLAIN_BASE_MARKER_GET_PRIVATE (champlainBaseMarker);
-
- return priv->highlighted;
+ return champlainBaseMarker->priv->highlighted;
}
/**
diff --git a/champlain/champlain-error-tile-source.c b/champlain/champlain-error-tile-source.c
index f5561af..f2946b7 100644
--- a/champlain/champlain-error-tile-source.c
+++ b/champlain/champlain-error-tile-source.c
@@ -32,8 +32,6 @@ G_DEFINE_TYPE (ChamplainErrorTileSource, champlain_error_tile_source, CHAMPLAIN_
#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_ERROR_TILE_SOURCE, ChamplainErrorTileSourcePrivate))
-typedef struct _ChamplainErrorTileSourcePrivate ChamplainErrorTileSourcePrivate;
-
struct _ChamplainErrorTileSourcePrivate
{
ClutterActor *error_actor;
@@ -72,6 +70,9 @@ static void
champlain_error_tile_source_init (ChamplainErrorTileSource *error_source)
{
ChamplainErrorTileSourcePrivate *priv = GET_PRIVATE(error_source);
+
+ error_source->priv = priv;
+
priv->error_actor = NULL;
}
@@ -97,7 +98,7 @@ fill_tile (ChamplainMapSource *map_source,
g_return_if_fail (CHAMPLAIN_IS_ERROR_TILE_SOURCE (map_source));
g_return_if_fail (CHAMPLAIN_IS_TILE (tile));
- ChamplainErrorTileSourcePrivate *priv = GET_PRIVATE(map_source);
+ ChamplainErrorTileSourcePrivate *priv = CHAMPLAIN_ERROR_TILE_SOURCE (map_source)->priv;
ClutterActor *clone;
guint size;
diff --git a/champlain/champlain-error-tile-source.h b/champlain/champlain-error-tile-source.h
index aaea565..adb0783 100644
--- a/champlain/champlain-error-tile-source.h
+++ b/champlain/champlain-error-tile-source.h
@@ -35,12 +35,16 @@ G_BEGIN_DECLS
#define CHAMPLAIN_IS_ERROR_TILE_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_ERROR_TILE_SOURCE))
#define CHAMPLAIN_ERROR_TILE_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_ERROR_TILE_SOURCE, ChamplainErrorTileSourceClass))
+typedef struct _ChamplainErrorTileSourcePrivate ChamplainErrorTileSourcePrivate;
+
typedef struct _ChamplainErrorTileSource ChamplainErrorTileSource;
typedef struct _ChamplainErrorTileSourceClass ChamplainErrorTileSourceClass;
struct _ChamplainErrorTileSource
{
ChamplainTileSource parent_instance;
+
+ ChamplainErrorTileSourcePrivate *priv;
};
struct _ChamplainErrorTileSourceClass
diff --git a/champlain/champlain-file-cache.c b/champlain/champlain-file-cache.c
index 6c3f5a0..b7a7de2 100644
--- a/champlain/champlain-file-cache.c
+++ b/champlain/champlain-file-cache.c
@@ -50,8 +50,6 @@ enum
PROP_CACHE_DIR
};
-typedef struct _ChamplainFileCachePrivate ChamplainFileCachePrivate;
-
struct _ChamplainFileCachePrivate
{
guint size_limit;
@@ -116,7 +114,7 @@ champlain_file_cache_set_property (GObject *object,
GParamSpec *pspec)
{
ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE (object);
- ChamplainFileCachePrivate *priv = GET_PRIVATE (object);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
switch (property_id)
{
@@ -142,7 +140,7 @@ champlain_file_cache_dispose (GObject *object)
static void
finalize_sql (ChamplainFileCache *file_cache)
{
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
gint error;
if (priv->stmt_select)
@@ -170,7 +168,7 @@ static void
delete_temp_cache (ChamplainFileCache *file_cache)
{
ChamplainTileCache *tile_cache = CHAMPLAIN_TILE_CACHE(file_cache);
- ChamplainFileCachePrivate *priv = GET_PRIVATE(file_cache);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
if (!champlain_tile_cache_get_persistent (tile_cache) && priv->real_cache_dir)
{
@@ -193,7 +191,7 @@ champlain_file_cache_finalize (GObject *object)
{
ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE(object);
ChamplainTileCache *tile_cache = CHAMPLAIN_TILE_CACHE(file_cache);
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
finalize_sql (file_cache);
@@ -226,7 +224,7 @@ static void
init_cache (ChamplainFileCache *file_cache)
{
ChamplainTileCache *tile_cache = CHAMPLAIN_TILE_CACHE(file_cache);
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
gchar *filename = NULL;
gchar *error_msg = NULL;
gint error;
@@ -249,7 +247,7 @@ init_cache (ChamplainFileCache *file_cache)
if (!priv->real_cache_dir)
{
- g_warning ("Filed to create filename for temporary cache");
+ g_warning ("Failed to create filename for temporary cache: template '%s'", tmplate);
g_free (tmplate);
return;
}
@@ -322,7 +320,7 @@ champlain_file_cache_constructed (GObject *object)
{
ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE(object);
ChamplainTileCache *tile_cache = CHAMPLAIN_TILE_CACHE(file_cache);
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
if (!priv->cache_dir)
{
@@ -407,6 +405,8 @@ champlain_file_cache_init (ChamplainFileCache *file_cache)
{
ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ file_cache->priv = priv;
+
priv->cache_dir = NULL;
priv->size_limit = 100000000;
priv->real_cache_dir = NULL;
@@ -471,8 +471,7 @@ champlain_file_cache_get_size_limit (ChamplainFileCache *file_cache)
{
g_return_val_if_fail (CHAMPLAIN_IS_FILE_CACHE (file_cache), 0);
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
- return priv->size_limit;
+ return file_cache->priv->size_limit;
}
/**
@@ -490,8 +489,7 @@ champlain_file_cache_get_cache_dir (ChamplainFileCache *file_cache)
{
g_return_val_if_fail (CHAMPLAIN_IS_FILE_CACHE (file_cache), NULL);
- ChamplainFileCachePrivate *priv = GET_PRIVATE(file_cache);
- return priv->cache_dir;
+ return file_cache->priv->cache_dir;
}
/**
@@ -509,7 +507,7 @@ champlain_file_cache_set_size_limit (ChamplainFileCache *file_cache,
{
g_return_if_fail (CHAMPLAIN_IS_FILE_CACHE (file_cache));
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
priv->size_limit = size_limit;
g_object_notify (G_OBJECT (file_cache), "size-limit");
@@ -519,7 +517,7 @@ static gchar *
get_filename (ChamplainFileCache *file_cache,
ChamplainTile *tile)
{
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
g_return_val_if_fail (CHAMPLAIN_IS_FILE_CACHE (file_cache), NULL);
g_return_val_if_fail (CHAMPLAIN_IS_TILE (tile), NULL);
@@ -580,7 +578,7 @@ tile_loaded_cb (ClutterTexture *texture,
ChamplainTile *tile = user_data->tile;
ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE(map_source);
ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
GFileInfo *info = NULL;
GFile *file = NULL;
ClutterActor *actor = CLUTTER_ACTOR(texture);
@@ -774,7 +772,7 @@ store_tile (ChamplainTileCache *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);
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
gchar *query = NULL;
gchar *error = NULL;
gchar *path = NULL;
@@ -854,7 +852,7 @@ on_tile_filled (ChamplainTileCache *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);
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
int sql_rc = SQLITE_OK;
gchar *filename = NULL;
@@ -888,7 +886,7 @@ clean (ChamplainTileCache *tile_cache)
g_return_if_fail (CHAMPLAIN_IS_FILE_CACHE (tile_cache));
ChamplainFileCache *file_cache = CHAMPLAIN_FILE_CACHE(tile_cache);
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
g_return_if_fail (!champlain_tile_cache_get_persistent (tile_cache));
@@ -909,7 +907,7 @@ delete_tile (ChamplainFileCache *file_cache, const gchar *filename)
GError *gerror = NULL;
GFile *file;
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
query = sqlite3_mprintf ("DELETE FROM tiles WHERE filename = %Q", filename);
sqlite3_exec (priv->db, query, NULL, NULL, &error);
@@ -965,7 +963,7 @@ champlain_file_cache_purge (ChamplainFileCache *file_cache)
{
g_return_if_fail (CHAMPLAIN_IS_FILE_CACHE (file_cache));
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ ChamplainFileCachePrivate *priv = file_cache->priv;
gchar *query;
sqlite3_stmt *stmt;
int rc = 0;
diff --git a/champlain/champlain-file-cache.h b/champlain/champlain-file-cache.h
index d15d681..e3a5d9d 100644
--- a/champlain/champlain-file-cache.h
+++ b/champlain/champlain-file-cache.h
@@ -36,12 +36,16 @@ G_BEGIN_DECLS
#define CHAMPLAIN_IS_FILE_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_FILE_CACHE))
#define CHAMPLAIN_FILE_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_FILE_CACHE, ChamplainFileCacheClass))
+typedef struct _ChamplainFileCachePrivate ChamplainFileCachePrivate;
+
typedef struct _ChamplainFileCache ChamplainFileCache;
typedef struct _ChamplainFileCacheClass ChamplainFileCacheClass;
struct _ChamplainFileCache
{
ChamplainTileCache parent_instance;
+
+ ChamplainFileCachePrivate *priv;
};
struct _ChamplainFileCacheClass
diff --git a/champlain/champlain-local-map-data-source.c b/champlain/champlain-local-map-data-source.c
index c1fe61d..23c1f8e 100644
--- a/champlain/champlain-local-map-data-source.c
+++ b/champlain/champlain-local-map-data-source.c
@@ -40,8 +40,6 @@ G_DEFINE_TYPE (ChamplainLocalMapDataSource, champlain_local_map_data_source, CHA
#define GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_LOCAL_MAP_DATA_SOURCE, ChamplainLocalMapDataSourcePrivate))
-typedef struct _ChamplainLocalMapDataSourcePrivate ChamplainLocalMapDataSourcePrivate;
-
struct _ChamplainLocalMapDataSourcePrivate {
MemphisMap* map;
};
@@ -76,7 +74,7 @@ static void
champlain_local_map_data_source_dispose (GObject *object)
{
ChamplainLocalMapDataSource *self = (ChamplainLocalMapDataSource *) object;
- ChamplainLocalMapDataSourcePrivate *priv = GET_PRIVATE(self);
+ ChamplainLocalMapDataSourcePrivate *priv = self->priv;
if (priv->map)
{
@@ -96,7 +94,7 @@ champlain_local_map_data_source_finalize (GObject *object)
static MemphisMap *
get_map_data (ChamplainMapDataSource *self)
{
- ChamplainLocalMapDataSourcePrivate *priv = GET_PRIVATE(self);
+ ChamplainLocalMapDataSourcePrivate *priv = CHAMPLAIN_LOCAL_MAP_DATA_SOURCE (self)->priv;
return priv->map;
}
@@ -121,7 +119,9 @@ static void
champlain_local_map_data_source_init (ChamplainLocalMapDataSource *self)
{
ChamplainLocalMapDataSourcePrivate *priv = GET_PRIVATE(self);
-
+
+ self->priv = priv;
+
priv->map = memphis_map_new ();
}
@@ -161,7 +161,7 @@ champlain_local_map_data_source_load_map_data (ChamplainLocalMapDataSource *self
return;
}
- ChamplainLocalMapDataSourcePrivate *priv = GET_PRIVATE(self);
+ ChamplainLocalMapDataSourcePrivate *priv = self->priv;
ChamplainBoundingBox *bbox;
MemphisMap *map = memphis_map_new ();
diff --git a/champlain/champlain-local-map-data-source.h b/champlain/champlain-local-map-data-source.h
index 12f1e69..c308cd1 100644
--- a/champlain/champlain-local-map-data-source.h
+++ b/champlain/champlain-local-map-data-source.h
@@ -42,8 +42,12 @@ G_BEGIN_DECLS
#define CHAMPLAIN_LOCAL_MAP_DATA_SOURCE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_LOCAL_MAP_DATA_SOURCE, ChamplainLocalMapDataSourceClass))
+typedef struct _ChamplainLocalMapDataSourcePrivate ChamplainLocalMapDataSourcePrivate;
+
typedef struct {
ChamplainMapDataSource parent;
+
+ ChamplainLocalMapDataSourcePrivate *priv;
} ChamplainLocalMapDataSource;
typedef struct {
diff --git a/champlain/champlain-map-data-source.c b/champlain/champlain-map-data-source.c
index 6132454..63d8fbe 100644
--- a/champlain/champlain-map-data-source.c
+++ b/champlain/champlain-map-data-source.c
@@ -49,8 +49,6 @@ enum
PROP_STATE
};
-typedef struct _ChamplainMapDataSourcePrivate ChamplainMapDataSourcePrivate;
-
struct _ChamplainMapDataSourcePrivate {
ChamplainBoundingBox *bounding_box;
/* the area that is covered by this data source */
@@ -65,7 +63,7 @@ champlain_map_data_source_get_property (GObject *object,
GParamSpec *pspec)
{
ChamplainMapDataSource *self = CHAMPLAIN_MAP_DATA_SOURCE (object);
- ChamplainMapDataSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainMapDataSourcePrivate *priv = self->priv;
switch (property_id)
{
@@ -87,7 +85,7 @@ champlain_map_data_source_set_property (GObject *object,
GParamSpec *pspec)
{
ChamplainMapDataSource *self = CHAMPLAIN_MAP_DATA_SOURCE (object);
- ChamplainMapDataSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainMapDataSourcePrivate *priv = self->priv;
switch (property_id)
{
@@ -114,7 +112,7 @@ static void
champlain_map_data_source_finalize (GObject *object)
{
ChamplainMapDataSource *self = CHAMPLAIN_MAP_DATA_SOURCE (object);
- ChamplainMapDataSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainMapDataSourcePrivate *priv = self->priv;
champlain_bounding_box_free (priv->bounding_box);
@@ -180,6 +178,8 @@ champlain_map_data_source_init (ChamplainMapDataSource *self)
{
ChamplainMapDataSourcePrivate *priv = GET_PRIVATE (self);
+ self->priv = priv;
+
priv->bounding_box = champlain_bounding_box_new ();
priv->bounding_box->left = 0.0;
priv->bounding_box->bottom = 0.0;
diff --git a/champlain/champlain-map-data-source.h b/champlain/champlain-map-data-source.h
index 6be4a5b..1942fb5 100644
--- a/champlain/champlain-map-data-source.h
+++ b/champlain/champlain-map-data-source.h
@@ -41,8 +41,12 @@ G_BEGIN_DECLS
#define CHAMPLAIN_MAP_DATA_SOURCE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_MAP_DATA_SOURCE, ChamplainMapDataSourceClass))
+typedef struct _ChamplainMapDataSourcePrivate ChamplainMapDataSourcePrivate;
+
typedef struct {
GInitiallyUnowned parent;
+
+ ChamplainMapDataSourcePrivate *priv;
} ChamplainMapDataSource;
typedef struct {
diff --git a/champlain/champlain-map-source-chain.c b/champlain/champlain-map-source-chain.c
index dcae9ea..70a5fb3 100644
--- a/champlain/champlain-map-source-chain.c
+++ b/champlain/champlain-map-source-chain.c
@@ -38,8 +38,6 @@ G_DEFINE_TYPE (ChamplainMapSourceChain, champlain_map_source_chain, CHAMPLAIN_TY
#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_MAP_SOURCE_CHAIN, ChamplainMapSourceChainPrivate))
-typedef struct _ChamplainMapSourceChainPrivate ChamplainMapSourceChainPrivate;
-
struct _ChamplainMapSourceChainPrivate
{
ChamplainMapSource *stack_top;
@@ -64,9 +62,8 @@ static void
champlain_map_source_chain_dispose (GObject *object)
{
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN(object);
- ChamplainMapSourceChainPrivate *priv = GET_PRIVATE(object);
- while (priv->stack_top)
+ while (source_chain->priv->stack_top)
champlain_map_source_chain_pop (source_chain);
G_OBJECT_CLASS (champlain_map_source_chain_parent_class)->dispose (object);
@@ -106,6 +103,9 @@ static void
champlain_map_source_chain_init (ChamplainMapSourceChain *source_chain)
{
ChamplainMapSourceChainPrivate *priv = GET_PRIVATE(source_chain);
+
+ source_chain->priv = priv;
+
priv->stack_top = NULL;
priv->stack_bottom = NULL;
}
@@ -131,7 +131,7 @@ get_id (ChamplainMapSource *map_source)
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (map_source);
g_return_val_if_fail (source_chain, NULL);
- ChamplainMapSourceChainPrivate *priv = GET_PRIVATE(source_chain);
+ ChamplainMapSourceChainPrivate *priv = source_chain->priv;
g_return_val_if_fail (priv->stack_top, NULL);
return champlain_map_source_get_id (priv->stack_top);
@@ -143,7 +143,7 @@ get_name (ChamplainMapSource *map_source)
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (map_source);
g_return_val_if_fail (source_chain, NULL);
- ChamplainMapSourceChainPrivate *priv = GET_PRIVATE(source_chain);
+ ChamplainMapSourceChainPrivate *priv = source_chain->priv;
g_return_val_if_fail (priv->stack_top, NULL);
return champlain_map_source_get_name (priv->stack_top);
@@ -155,7 +155,7 @@ get_license (ChamplainMapSource *map_source)
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (map_source);
g_return_val_if_fail (source_chain, NULL);
- ChamplainMapSourceChainPrivate *priv = GET_PRIVATE(source_chain);
+ ChamplainMapSourceChainPrivate *priv = source_chain->priv;
g_return_val_if_fail (priv->stack_top, NULL);
return champlain_map_source_get_license (priv->stack_top);
@@ -167,7 +167,7 @@ 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 = GET_PRIVATE(source_chain);
+ ChamplainMapSourceChainPrivate *priv = source_chain->priv;
g_return_val_if_fail (priv->stack_top, NULL);
return champlain_map_source_get_license_uri (priv->stack_top);
@@ -179,7 +179,7 @@ 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 = GET_PRIVATE(source_chain);
+ ChamplainMapSourceChainPrivate *priv = source_chain->priv;
g_return_val_if_fail (priv->stack_top, 0);
return champlain_map_source_get_min_zoom_level (priv->stack_top);
@@ -191,7 +191,7 @@ 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 = GET_PRIVATE(source_chain);
+ ChamplainMapSourceChainPrivate *priv = source_chain->priv;
g_return_val_if_fail (priv->stack_top, 0);
return champlain_map_source_get_max_zoom_level (priv->stack_top);
@@ -203,7 +203,7 @@ 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 = GET_PRIVATE(source_chain);
+ ChamplainMapSourceChainPrivate *priv = source_chain->priv;
g_return_val_if_fail (priv->stack_top, 0);
return champlain_map_source_get_tile_size (priv->stack_top);
@@ -216,7 +216,7 @@ fill_tile (ChamplainMapSource *map_source,
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (map_source);
g_return_if_fail (source_chain);
- ChamplainMapSourceChainPrivate *priv = GET_PRIVATE(source_chain);
+ ChamplainMapSourceChainPrivate *priv = source_chain->priv;
g_return_if_fail (priv->stack_top);
champlain_map_source_fill_tile (priv->stack_top, tile);
@@ -228,7 +228,7 @@ on_set_next_source (ChamplainMapSource *map_source,
ChamplainMapSource *new_next_source)
{
ChamplainMapSourceChain *source_chain = CHAMPLAIN_MAP_SOURCE_CHAIN (map_source);
- ChamplainMapSourceChainPrivate *priv = GET_PRIVATE(source_chain);
+ ChamplainMapSourceChainPrivate *priv = source_chain->priv;
g_return_if_fail (source_chain);
@@ -278,7 +278,7 @@ void
champlain_map_source_chain_push (ChamplainMapSourceChain *source_chain,
ChamplainMapSource *map_source)
{
- ChamplainMapSourceChainPrivate *priv = GET_PRIVATE(source_chain);
+ ChamplainMapSourceChainPrivate *priv = source_chain->priv;
gboolean is_cache = FALSE;
if (CHAMPLAIN_IS_TILE_CACHE(map_source))
@@ -330,7 +330,7 @@ champlain_map_source_chain_push (ChamplainMapSourceChain *source_chain,
void
champlain_map_source_chain_pop (ChamplainMapSourceChain *source_chain)
{
- ChamplainMapSourceChainPrivate *priv = GET_PRIVATE(source_chain);
+ ChamplainMapSourceChainPrivate *priv = source_chain->priv;
ChamplainMapSource *old_stack_top = priv->stack_top;
ChamplainMapSource *next_source = champlain_map_source_get_next_source (priv->stack_top);
diff --git a/champlain/champlain-map-source-chain.h b/champlain/champlain-map-source-chain.h
index 1af6476..3c5ae1e 100644
--- a/champlain/champlain-map-source-chain.h
+++ b/champlain/champlain-map-source-chain.h
@@ -36,12 +36,16 @@ G_BEGIN_DECLS
#define CHAMPLAIN_IS_MAP_SOURCE_CHAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_MAP_SOURCE_CHAIN))
#define CHAMPLAIN_MAP_SOURCE_CHAIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_MAP_SOURCE_CHAIN, ChamplainMapSourceChainClass))
+typedef struct _ChamplainMapSourceChainPrivate ChamplainMapSourceChainPrivate;
+
typedef struct _ChamplainMapSourceChain ChamplainMapSourceChain;
typedef struct _ChamplainMapSourceChainClass ChamplainMapSourceChainClass;
struct _ChamplainMapSourceChain
{
ChamplainMapSource parent_instance;
+
+ ChamplainMapSourceChainPrivate *priv;
};
struct _ChamplainMapSourceChainClass
diff --git a/champlain/champlain-map-source.c b/champlain/champlain-map-source.c
index e52717b..6320750 100644
--- a/champlain/champlain-map-source.c
+++ b/champlain/champlain-map-source.c
@@ -73,8 +73,6 @@ enum
static guint champlain_map_source_signals[LAST_SIGNAL] = { 0, };
-typedef struct _ChamplainMapSourcePrivate ChamplainMapSourcePrivate;
-
struct _ChamplainMapSourcePrivate
{
ChamplainMapSource *next_source;
@@ -93,7 +91,7 @@ champlain_map_source_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE(object);
+ ChamplainMapSourcePrivate *priv = CHAMPLAIN_MAP_SOURCE (object)->priv;
switch (prop_id)
{
@@ -127,7 +125,7 @@ champlain_map_source_set_property (GObject *object,
static void
champlain_map_source_dispose (GObject *object)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE(object);
+ ChamplainMapSourcePrivate *priv = CHAMPLAIN_MAP_SOURCE (object)->priv;
if (priv->next_source)
{
@@ -211,7 +209,10 @@ champlain_map_source_class_init (ChamplainMapSourceClass *klass)
static void
champlain_map_source_init (ChamplainMapSource *map_source)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE(map_source);
+ ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+
+ map_source->priv = priv;
+
priv->next_source = NULL;
priv->sig_handler_id = 0;
}
@@ -231,8 +232,7 @@ champlain_map_source_get_next_source (ChamplainMapSource *map_source)
{
g_return_val_if_fail (CHAMPLAIN_IS_MAP_SOURCE (map_source), NULL);
- ChamplainMapSourcePrivate *priv = GET_PRIVATE(map_source);
- return priv->next_source;
+ return map_source->priv->next_source;
}
static
@@ -247,7 +247,7 @@ on_set_next_source (ChamplainMapSource *map_source,
ChamplainMapSource *old_next_source,
ChamplainMapSource *new_next_source)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE(map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
if (old_next_source)
{
if (g_signal_handler_is_connected (old_next_source, priv->sig_handler_id))
@@ -276,7 +276,7 @@ champlain_map_source_set_next_source (ChamplainMapSource *map_source,
{
g_return_if_fail (CHAMPLAIN_IS_MAP_SOURCE (map_source));
- ChamplainMapSourcePrivate *priv = GET_PRIVATE(map_source);
+ ChamplainMapSourcePrivate *priv = map_source->priv;
CHAMPLAIN_MAP_SOURCE_GET_CLASS (map_source)->on_set_next_source (map_source, priv->next_source, next_source);
diff --git a/champlain/champlain-map-source.h b/champlain/champlain-map-source.h
index ab5bc3a..62ca090 100644
--- a/champlain/champlain-map-source.h
+++ b/champlain/champlain-map-source.h
@@ -35,6 +35,8 @@ G_BEGIN_DECLS
#define CHAMPLAIN_IS_MAP_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_MAP_SOURCE))
#define CHAMPLAIN_MAP_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_MAP_SOURCE, ChamplainMapSourceClass))
+typedef struct _ChamplainMapSourcePrivate ChamplainMapSourcePrivate;
+
typedef struct _ChamplainMapSourceClass ChamplainMapSourceClass;
typedef enum
@@ -45,6 +47,8 @@ typedef enum
struct _ChamplainMapSource
{
GInitiallyUnowned parent_instance;
+
+ ChamplainMapSourcePrivate *priv;
};
struct _ChamplainMapSourceClass
diff --git a/champlain/champlain-marker.c b/champlain/champlain-marker.c
index 88c9b83..533e3f6 100644
--- a/champlain/champlain-marker.c
+++ b/champlain/champlain-marker.c
@@ -182,7 +182,7 @@ champlain_marker_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- ChamplainMarkerPrivate *priv = GET_PRIVATE (object);
+ ChamplainMarkerPrivate *priv = CHAMPLAIN_MARKER (object)->priv;
switch (prop_id)
{
@@ -234,7 +234,6 @@ champlain_marker_set_property (GObject *object,
GParamSpec *pspec)
{
ChamplainMarker *marker = CHAMPLAIN_MARKER (object);
- //ChamplainMarkerPrivate *priv = marker->priv;
switch (prop_id)
{
@@ -282,7 +281,7 @@ champlain_marker_set_property (GObject *object,
static void
champlain_marker_dispose (GObject *object)
{
- ChamplainMarkerPrivate *priv = GET_PRIVATE (object);
+ ChamplainMarkerPrivate *priv = CHAMPLAIN_MARKER (object)->priv;
if (priv->background)
{
@@ -320,7 +319,7 @@ champlain_marker_dispose (GObject *object)
static void
champlain_marker_finalize (GObject *object)
{
- ChamplainMarkerPrivate *priv = GET_PRIVATE (object);
+ ChamplainMarkerPrivate *priv = CHAMPLAIN_MARKER (object)->priv;
if (priv->text)
{
@@ -545,7 +544,7 @@ draw_shadow (ChamplainMarker *marker,
gint height,
gint point)
{
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
+ ChamplainMarkerPrivate *priv = marker->priv;
ClutterActor *shadow = NULL;
cairo_t *cr;
gdouble slope;
@@ -597,7 +596,7 @@ draw_background (ChamplainMarker *marker,
gint height,
gint point)
{
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
+ ChamplainMarkerPrivate *priv = marker->priv;
ChamplainBaseMarkerPrivate *base_priv = CHAMPLAIN_BASE_MARKER (marker)->priv;
ClutterActor *bg = NULL;
ClutterColor *color;
@@ -649,7 +648,7 @@ draw_background (ChamplainMarker *marker,
static void
draw_marker (ChamplainMarker *marker)
{
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
+ ChamplainMarkerPrivate *priv = marker->priv;
ChamplainBaseMarkerPrivate *base_priv = CHAMPLAIN_BASE_MARKER (marker)->priv;
guint height = 0, point = 0;
guint total_width = 0, total_height = 0;
@@ -760,9 +759,8 @@ static gboolean
redraw_on_idle (gpointer gobject)
{
ChamplainMarker *marker = CHAMPLAIN_MARKER (gobject);
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
CHAMPLAIN_MARKER_GET_CLASS (gobject)->draw_marker (marker);
- priv->redraw_id = 0;
+ marker->priv->redraw_id = 0;
return FALSE;
}
@@ -780,7 +778,8 @@ redraw_on_idle (gpointer gobject)
void
champlain_marker_queue_redraw (ChamplainMarker *marker)
{
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
+ ChamplainMarkerPrivate *priv = marker->priv;
+
if (!priv->redraw_id)
priv->redraw_id = g_idle_add (redraw_on_idle, marker);
}
@@ -798,6 +797,8 @@ champlain_marker_init (ChamplainMarker *marker)
{
ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
+ marker->priv = priv;
+
priv->text = NULL;
priv->image = NULL;
priv->background = NULL;
@@ -951,7 +952,7 @@ champlain_marker_set_text (ChamplainMarker *marker,
{
g_return_if_fail (CHAMPLAIN_IS_MARKER (marker));
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
+ ChamplainMarkerPrivate *priv = marker->priv;
if (priv->text != NULL)
g_free (priv->text);
@@ -975,7 +976,7 @@ champlain_marker_set_image (ChamplainMarker *marker,
{
g_return_if_fail (CHAMPLAIN_IS_MARKER (marker));
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
+ ChamplainMarkerPrivate *priv = marker->priv;
if (priv->image != NULL)
{
@@ -1010,9 +1011,7 @@ champlain_marker_set_use_markup (ChamplainMarker *marker,
{
g_return_if_fail (CHAMPLAIN_IS_MARKER (marker));
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- priv->use_markup = markup;
+ marker->priv->use_markup = markup;
g_object_notify (G_OBJECT (marker), "use-markup");
champlain_marker_queue_redraw (marker);
}
@@ -1032,9 +1031,7 @@ champlain_marker_set_alignment (ChamplainMarker *marker,
{
g_return_if_fail (CHAMPLAIN_IS_MARKER (marker));
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- priv->alignment = alignment;
+ marker->priv->alignment = alignment;
g_object_notify (G_OBJECT (marker), "alignment");
champlain_marker_queue_redraw (marker);
}
@@ -1055,7 +1052,7 @@ champlain_marker_set_color (ChamplainMarker *marker,
{
g_return_if_fail (CHAMPLAIN_IS_MARKER (marker));
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
+ ChamplainMarkerPrivate *priv = marker->priv;
if (priv->color != NULL)
clutter_color_free (priv->color);
@@ -1084,13 +1081,13 @@ champlain_marker_set_text_color (ChamplainMarker *marker,
{
g_return_if_fail (CHAMPLAIN_IS_MARKER (marker));
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
+ ChamplainMarkerPrivate *priv = marker->priv;
if (priv->text_color != NULL)
clutter_color_free (priv->text_color);
if (color == NULL)
- color = &DEFAULT_TEXT_COLOR;
+ color = &DEFAULT_TEXT_COLOR;
priv->text_color = clutter_color_copy (color);
g_object_notify (G_OBJECT (marker), "text-color");
@@ -1113,7 +1110,7 @@ champlain_marker_set_font_name (ChamplainMarker *marker,
{
g_return_if_fail (CHAMPLAIN_IS_MARKER (marker));
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
+ ChamplainMarkerPrivate *priv = marker->priv;
if (priv->font_name != NULL)
g_free (priv->font_name);
@@ -1141,9 +1138,7 @@ champlain_marker_set_wrap (ChamplainMarker *marker,
{
g_return_if_fail (CHAMPLAIN_IS_MARKER (marker));
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- priv->wrap = wrap;
+ marker->priv->wrap = wrap;
g_object_notify (G_OBJECT (marker), "wrap");
champlain_marker_queue_redraw (marker);
}
@@ -1163,9 +1158,7 @@ champlain_marker_set_wrap_mode (ChamplainMarker *marker,
{
g_return_if_fail (CHAMPLAIN_IS_MARKER (marker));
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- priv->wrap_mode = wrap_mode;
+ marker->priv->wrap_mode = wrap_mode;
g_object_notify (G_OBJECT (marker), "wrap");
champlain_marker_queue_redraw (marker);
}
@@ -1185,7 +1178,7 @@ champlain_marker_set_attributes (ChamplainMarker *marker,
{
g_return_if_fail (CHAMPLAIN_IS_MARKER (marker));
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
+ ChamplainMarkerPrivate *priv = marker->priv;
if (attributes)
pango_attr_list_ref (attributes);
@@ -1214,9 +1207,7 @@ champlain_marker_set_ellipsize (ChamplainMarker *marker,
{
g_return_if_fail (CHAMPLAIN_IS_MARKER (marker));
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- priv->ellipsize = ellipsize;
+ marker->priv->ellipsize = ellipsize;
g_object_notify (G_OBJECT (marker), "ellipsize");
champlain_marker_queue_redraw (marker);
}
@@ -1235,9 +1226,7 @@ champlain_marker_set_single_line_mode (ChamplainMarker *marker,
{
g_return_if_fail (CHAMPLAIN_IS_MARKER (marker));
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- priv->single_line_mode = mode;
+ marker->priv->single_line_mode = mode;
g_object_notify (G_OBJECT (marker), "single-line-mode");
champlain_marker_queue_redraw (marker);
@@ -1258,9 +1247,7 @@ champlain_marker_set_draw_background (ChamplainMarker *marker,
{
g_return_if_fail (CHAMPLAIN_IS_MARKER (marker));
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- priv->draw_background = background;
+ marker->priv->draw_background = background;
g_object_notify (G_OBJECT (marker), "draw-background");
champlain_marker_queue_redraw (marker);
}
@@ -1278,9 +1265,7 @@ champlain_marker_get_image (ChamplainMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_MARKER (marker), NULL);
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- return priv->image;
+ return marker->priv->image;
}
/**
@@ -1296,9 +1281,7 @@ champlain_marker_get_use_markup (ChamplainMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_MARKER (marker), FALSE);
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- return priv->use_markup;
+ return marker->priv->use_markup;
}
/**
@@ -1314,9 +1297,7 @@ champlain_marker_get_text (ChamplainMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_MARKER (marker), FALSE);
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- return priv->text;
+ return marker->priv->text;
}
/**
@@ -1332,9 +1313,7 @@ champlain_marker_get_alignment (ChamplainMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_MARKER (marker), FALSE);
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- return priv->alignment;
+ return marker->priv->alignment;
}
/**
@@ -1350,9 +1329,7 @@ champlain_marker_get_color (ChamplainMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_MARKER (marker), NULL);
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- return priv->color;
+ return marker->priv->color;
}
/**
@@ -1368,9 +1345,7 @@ champlain_marker_get_text_color (ChamplainMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_MARKER (marker), NULL);
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- return priv->text_color;
+ return marker->priv->text_color;
}
/**
@@ -1386,9 +1361,7 @@ champlain_marker_get_font_name (ChamplainMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_MARKER (marker), FALSE);
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- return priv->font_name;
+ return marker->priv->font_name;
}
/**
@@ -1404,9 +1377,7 @@ champlain_marker_get_wrap (ChamplainMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_MARKER (marker), FALSE);
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- return priv->wrap;
+ return marker->priv->wrap;
}
/**
@@ -1422,9 +1393,7 @@ champlain_marker_get_wrap_mode (ChamplainMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_MARKER (marker), FALSE);
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- return priv->wrap_mode;
+ return marker->priv->wrap_mode;
}
/**
@@ -1440,9 +1409,7 @@ champlain_marker_get_ellipsize (ChamplainMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_MARKER (marker), FALSE);
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- return priv->ellipsize;
+ return marker->priv->ellipsize;
}
/**
@@ -1458,9 +1425,7 @@ champlain_marker_get_single_line_mode (ChamplainMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_MARKER (marker), FALSE);
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- return priv->single_line_mode;
+ return marker->priv->single_line_mode;
}
/**
@@ -1476,8 +1441,6 @@ champlain_marker_get_draw_background (ChamplainMarker *marker)
{
g_return_val_if_fail (CHAMPLAIN_IS_MARKER (marker), FALSE);
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
-
- return priv->draw_background;
+ return marker->priv->draw_background;
}
diff --git a/champlain/champlain-marker.h b/champlain/champlain-marker.h
index 09f46d3..dfbfbe9 100644
--- a/champlain/champlain-marker.h
+++ b/champlain/champlain-marker.h
@@ -45,6 +45,8 @@ typedef struct _ChamplainMarkerClass ChamplainMarkerClass;
struct _ChamplainMarker
{
ChamplainBaseMarker base;
+
+ ChamplainMarkerPrivate *priv;
};
struct _ChamplainMarkerClass
diff --git a/champlain/champlain-memphis-tile-source.c b/champlain/champlain-memphis-tile-source.c
index b52f5f8..eb0fb98 100644
--- a/champlain/champlain-memphis-tile-source.c
+++ b/champlain/champlain-memphis-tile-source.c
@@ -73,8 +73,6 @@ G_DEFINE_TYPE (ChamplainMemphisTileSource, champlain_memphis_tile_source, CHAMPL
#define GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_MEMPHIS_TILE_SOURCE, ChamplainMemphisTileSourcePrivate))
-typedef struct _ChamplainMemphisTileSourcePrivate ChamplainMemphisTileSourcePrivate;
-
struct _ChamplainMemphisTileSourcePrivate
{
ChamplainMapDataSource *map_data_source;
@@ -119,7 +117,7 @@ champlain_memphis_tile_source_get_property (GObject *object,
GParamSpec *pspec)
{
ChamplainMemphisTileSource *tile_source = CHAMPLAIN_MEMPHIS_TILE_SOURCE (object);
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
+ ChamplainMemphisTileSourcePrivate *priv = tile_source->priv;
switch (property_id)
{
@@ -154,7 +152,7 @@ static void
champlain_memphis_tile_source_dispose (GObject *object)
{
ChamplainMemphisTileSource *tile_source = CHAMPLAIN_MEMPHIS_TILE_SOURCE(object);
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE(tile_source);
+ ChamplainMemphisTileSourcePrivate *priv = tile_source->priv;
if (priv->thpool)
{
@@ -190,7 +188,7 @@ static void
champlain_memphis_tile_source_constructed (GObject *object)
{
ChamplainMapSource *map_source = CHAMPLAIN_MAP_SOURCE(object);
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE(object);
+ ChamplainMemphisTileSourcePrivate *priv = CHAMPLAIN_MEMPHIS_TILE_SOURCE (object)->priv;
memphis_renderer_set_resolution (priv->renderer, champlain_map_source_get_tile_size (map_source));
@@ -234,6 +232,8 @@ champlain_memphis_tile_source_init (ChamplainMemphisTileSource *tile_source)
{
ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE(tile_source);
+ tile_source->priv = priv;
+
priv->map_data_source = NULL;
priv->rules = NULL;
priv->renderer = NULL;
@@ -299,7 +299,7 @@ map_data_changed_cb (ChamplainMapDataSource *map_data_source,
CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source));
MemphisMap *map;
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE(tile_source);
+ ChamplainMemphisTileSourcePrivate *priv = tile_source->priv;
ChamplainState state;
g_object_get (G_OBJECT (map_data_source), "state", &state, NULL);
@@ -418,14 +418,14 @@ memphis_worker_thread (gpointer worker_data,
gpointer user_data)
{
WorkerThreadData *data = (WorkerThreadData *)worker_data;
- ChamplainMapSource *map_source = data->map_source;
+ ChamplainMemphisTileSource *tile_source = CHAMPLAIN_MEMPHIS_TILE_SOURCE (data->map_source);
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 (GET_PRIVATE(map_source)->renderer, data->x, data->y, data->z);
+// has_data = memphis_renderer_tile_has_data (tile_source->priv->renderer, data->x, data->y, data->z);
// g_static_rw_lock_reader_unlock (&MemphisLock);
if (has_data)
@@ -439,7 +439,7 @@ memphis_worker_thread (gpointer worker_data,
DEBUG ("Draw Tile (%d, %d, %d)", data->x, data->y, data->z);
g_static_rw_lock_reader_lock (&MemphisLock);
- memphis_renderer_draw_tile (GET_PRIVATE(map_source)->renderer, cr, data->x, data->y, data->z);
+ memphis_renderer_draw_tile (tile_source->priv->renderer, cr, data->x, data->y, data->z);
g_static_rw_lock_reader_unlock (&MemphisLock);
cairo_destroy (cr);
@@ -454,7 +454,7 @@ fill_tile (ChamplainMapSource *map_source,
{
g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (map_source));
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE(map_source);
+ ChamplainMemphisTileSourcePrivate *priv = CHAMPLAIN_MEMPHIS_TILE_SOURCE (map_source)->priv;
DEBUG ("Render tile (%u, %u, %u)", champlain_tile_get_x (tile),
champlain_tile_get_y (tile),
@@ -537,7 +537,7 @@ champlain_memphis_tile_source_load_rules (
return;
}
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
+ ChamplainMemphisTileSourcePrivate *priv = tile_source->priv;
g_static_rw_lock_writer_lock (&MemphisLock);
if (rules_path)
@@ -567,7 +567,7 @@ champlain_memphis_tile_source_set_map_data_source (
g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source) &&
CHAMPLAIN_IS_MAP_DATA_SOURCE (map_data_source));
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
+ ChamplainMemphisTileSourcePrivate *priv = tile_source->priv;
MemphisMap *map;
if (priv->map_data_source)
@@ -606,8 +606,7 @@ champlain_memphis_tile_source_get_map_data_source (
{
g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source), NULL);
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
- return priv->map_data_source;
+ return tile_source->priv->map_data_source;
}
/**
@@ -625,12 +624,11 @@ champlain_memphis_tile_source_get_background_color (
{
g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source), NULL);
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
ClutterColor color;
guint8 r, b, g, a;
g_static_rw_lock_reader_lock (&MemphisLock);
- memphis_rule_set_get_bg_color (priv->rules, &r, &g, &b, &a);
+ memphis_rule_set_get_bg_color (tile_source->priv->rules, &r, &g, &b, &a);
g_static_rw_lock_reader_unlock (&MemphisLock);
color.red = r;
@@ -656,10 +654,8 @@ champlain_memphis_tile_source_set_background_color (
{
g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source));
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
-
g_static_rw_lock_writer_lock (&MemphisLock);
- memphis_rule_set_set_bg_color (priv->rules, color->red,
+ memphis_rule_set_set_bg_color (tile_source->priv->rules, color->red,
color->green, color->blue, color->alpha);
g_static_rw_lock_writer_unlock (&MemphisLock);
@@ -683,10 +679,8 @@ champlain_memphis_tile_source_set_rule (ChamplainMemphisTileSource *tile_source,
g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source) &&
MEMPHIS_RULE (rule));
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
-
g_static_rw_lock_writer_lock (&MemphisLock);
- memphis_rule_set_set_rule (priv->rules, rule);
+ memphis_rule_set_set_rule (tile_source->priv->rules, rule);
g_static_rw_lock_writer_unlock (&MemphisLock);
reload_tiles (tile_source);
@@ -708,11 +702,10 @@ champlain_memphis_tile_source_get_rule (ChamplainMemphisTileSource *tile_source,
g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source) &&
id != NULL, NULL);
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
MemphisRule *rule;
g_static_rw_lock_reader_lock (&MemphisLock);
- rule = memphis_rule_set_get_rule (priv->rules, id);
+ rule = memphis_rule_set_get_rule (tile_source->priv->rules, id);
g_static_rw_lock_reader_unlock (&MemphisLock);
return rule;
@@ -734,11 +727,10 @@ champlain_memphis_tile_source_get_rule_ids (ChamplainMemphisTileSource *tile_sou
{
g_return_val_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source), NULL);
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
GList *list;
g_static_rw_lock_reader_lock (&MemphisLock);
- list = memphis_rule_set_get_rule_ids (priv->rules);
+ list = memphis_rule_set_get_rule_ids (tile_source->priv->rules);
g_static_rw_lock_reader_unlock (&MemphisLock);
return list;
@@ -759,10 +751,8 @@ void champlain_memphis_tile_source_remove_rule (
{
g_return_if_fail (CHAMPLAIN_IS_MEMPHIS_TILE_SOURCE (tile_source));
- ChamplainMemphisTileSourcePrivate *priv = GET_PRIVATE (tile_source);
-
g_static_rw_lock_writer_lock (&MemphisLock);
- memphis_rule_set_remove_rule (priv->rules, id);
+ memphis_rule_set_remove_rule (tile_source->priv->rules, id);
g_static_rw_lock_writer_unlock (&MemphisLock);
reload_tiles (tile_source);
diff --git a/champlain/champlain-memphis-tile-source.h b/champlain/champlain-memphis-tile-source.h
index ee037c9..b9efeeb 100644
--- a/champlain/champlain-memphis-tile-source.h
+++ b/champlain/champlain-memphis-tile-source.h
@@ -45,8 +45,12 @@ G_BEGIN_DECLS
#define CHAMPLAIN_MEMPHIS_TILE_SOURCE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_MEMPHIS_TILE_SOURCE, ChamplainMemphisTileSourceClass))
+typedef struct _ChamplainMemphisTileSourcePrivate ChamplainMemphisTileSourcePrivate;
+
typedef struct {
ChamplainTileSource parent;
+
+ ChamplainMemphisTileSourcePrivate *priv;
} ChamplainMemphisTileSource;
typedef struct {
diff --git a/champlain/champlain-network-map-data-source.c b/champlain/champlain-network-map-data-source.c
index ac94ae7..5e3758d 100644
--- a/champlain/champlain-network-map-data-source.c
+++ b/champlain/champlain-network-map-data-source.c
@@ -57,8 +57,6 @@ enum
PROP_PROXY_URI
};
-typedef struct _ChamplainNetworkMapDataSourcePrivate ChamplainNetworkMapDataSourcePrivate;
-
struct _ChamplainNetworkMapDataSourcePrivate {
MemphisMap *map;
gchar *api_uri;
@@ -73,7 +71,7 @@ champlain_network_map_data_source_get_property (GObject *object,
{
ChamplainNetworkMapDataSource *self =
CHAMPLAIN_NETWORK_MAP_DATA_SOURCE (object);
- ChamplainNetworkMapDataSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainNetworkMapDataSourcePrivate *priv = self->priv;
switch (property_id)
{
@@ -97,7 +95,7 @@ champlain_network_map_data_source_set_property (GObject *object,
{
ChamplainNetworkMapDataSource *self =
CHAMPLAIN_NETWORK_MAP_DATA_SOURCE (object);
- ChamplainNetworkMapDataSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainNetworkMapDataSourcePrivate *priv = self->priv;
switch (property_id)
{
@@ -123,7 +121,7 @@ champlain_network_map_data_source_dispose (GObject *object)
{
ChamplainNetworkMapDataSource *self =
CHAMPLAIN_NETWORK_MAP_DATA_SOURCE (object);
- ChamplainNetworkMapDataSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainNetworkMapDataSourcePrivate *priv = self->priv;
if (priv->map)
{
@@ -145,7 +143,7 @@ champlain_network_map_data_source_finalize (GObject *object)
{
ChamplainNetworkMapDataSource *self =
CHAMPLAIN_NETWORK_MAP_DATA_SOURCE (object);
- ChamplainNetworkMapDataSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainNetworkMapDataSourcePrivate *priv = self->priv;
g_free (priv->api_uri);
g_free (priv->proxy_uri);
@@ -156,9 +154,7 @@ champlain_network_map_data_source_finalize (GObject *object)
static MemphisMap *
get_map_data (ChamplainMapDataSource *self)
{
- ChamplainNetworkMapDataSourcePrivate *priv = GET_PRIVATE (self);
-
- return priv->map;
+ return CHAMPLAIN_NETWORK_MAP_DATA_SOURCE (self)->priv->map;
}
static void
@@ -212,6 +208,8 @@ champlain_network_map_data_source_init (ChamplainNetworkMapDataSource *self)
{
ChamplainNetworkMapDataSourcePrivate *priv = GET_PRIVATE (self);
+ self->priv = priv;
+
priv->map = NULL;
priv->api_uri = g_strdup ("http://www.informationfreeway.org/api/0.6");
/* informationfreeway.org is a load-balancer for different api server */
@@ -237,7 +235,7 @@ load_map_data_cb (SoupSession *session, SoupMessage *msg,
{
ChamplainNetworkMapDataSource *self =
CHAMPLAIN_NETWORK_MAP_DATA_SOURCE (user_data);
- ChamplainNetworkMapDataSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainNetworkMapDataSourcePrivate *priv = self->priv;
ChamplainBoundingBox *bbox;
if (!SOUP_STATUS_IS_SUCCESSFUL (msg->status_code))
@@ -303,7 +301,7 @@ champlain_network_map_data_source_load_map_data (
g_return_if_fail (bound_right - bound_left < 0.25 &&
bound_top - bound_bottom < 0.25);
- ChamplainNetworkMapDataSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainNetworkMapDataSourcePrivate *priv = self->priv;
SoupMessage *msg;
gchar *url;
@@ -350,9 +348,7 @@ champlain_network_map_data_source_get_api_uri (
{
g_return_val_if_fail (CHAMPLAIN_IS_NETWORK_MAP_DATA_SOURCE (self), NULL);
- ChamplainNetworkMapDataSourcePrivate *priv = GET_PRIVATE (self);
-
- return priv->api_uri;
+ return self->priv->api_uri;
}
/**
@@ -372,7 +368,7 @@ champlain_network_map_data_source_set_api_uri (
g_return_if_fail (CHAMPLAIN_IS_NETWORK_MAP_DATA_SOURCE (self)
&& api_uri != NULL);
- ChamplainNetworkMapDataSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainNetworkMapDataSourcePrivate *priv = self->priv;
g_free (priv->api_uri);
priv->api_uri = g_strdup (api_uri);
diff --git a/champlain/champlain-network-map-data-source.h b/champlain/champlain-network-map-data-source.h
index 8b18b20..6143a6d 100644
--- a/champlain/champlain-network-map-data-source.h
+++ b/champlain/champlain-network-map-data-source.h
@@ -42,8 +42,12 @@ G_BEGIN_DECLS
#define CHAMPLAIN_NETWORK_MAP_DATA_SOURCE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_NETWORK_MAP_DATA_SOURCE, ChamplainNetworkMapDataSourceClass))
+typedef struct _ChamplainNetworkMapDataSourcePrivate ChamplainNetworkMapDataSourcePrivate;
+
typedef struct {
ChamplainMapDataSource parent;
+
+ ChamplainNetworkMapDataSourcePrivate *priv;
} ChamplainNetworkMapDataSource;
typedef struct {
diff --git a/champlain/champlain-network-tile-source.c b/champlain/champlain-network-tile-source.c
index dd9c415..5da533c 100644
--- a/champlain/champlain-network-tile-source.c
+++ b/champlain/champlain-network-tile-source.c
@@ -72,8 +72,6 @@ G_DEFINE_TYPE (ChamplainNetworkTileSource, champlain_network_tile_source, CHAMPL
#define GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), CHAMPLAIN_TYPE_NETWORK_TILE_SOURCE, ChamplainNetworkTileSourcePrivate))
-typedef struct _ChamplainNetworkTileSourcePrivate ChamplainNetworkTileSourcePrivate;
-
struct _ChamplainNetworkTileSourcePrivate
{
gboolean offline;
@@ -109,7 +107,7 @@ champlain_network_tile_source_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE(object);
+ ChamplainNetworkTileSourcePrivate *priv = CHAMPLAIN_NETWORK_TILE_SOURCE (object)->priv;
switch (prop_id)
{
@@ -155,7 +153,7 @@ champlain_network_tile_source_set_property (GObject *object,
static void
champlain_network_tile_source_dispose (GObject *object)
{
- ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE(object);
+ ChamplainNetworkTileSourcePrivate *priv = CHAMPLAIN_NETWORK_TILE_SOURCE (object)->priv;
if (priv->soup_session)
{
@@ -169,7 +167,7 @@ champlain_network_tile_source_dispose (GObject *object)
static void
champlain_network_tile_source_finalize (GObject *object)
{
- ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE(object);
+ ChamplainNetworkTileSourcePrivate *priv = CHAMPLAIN_NETWORK_TILE_SOURCE(object)->priv;
g_free (priv->uri_format);
g_free (priv->proxy_uri);
@@ -248,6 +246,8 @@ champlain_network_tile_source_init (ChamplainNetworkTileSource *tile_source)
{
ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE (tile_source);
+ tile_source->priv = priv;
+
priv->proxy_uri = NULL;
priv->uri_format = NULL;
priv->offline = FALSE;
@@ -318,8 +318,7 @@ champlain_network_tile_source_get_uri_format (ChamplainNetworkTileSource *tile_s
{
g_return_val_if_fail (CHAMPLAIN_IS_NETWORK_TILE_SOURCE (tile_source), NULL);
- ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE(tile_source);
- return priv->uri_format;
+ return tile_source->priv->uri_format;
}
/**
@@ -343,7 +342,7 @@ champlain_network_tile_source_set_uri_format (ChamplainNetworkTileSource *tile_s
{
g_return_if_fail (CHAMPLAIN_IS_NETWORK_TILE_SOURCE (tile_source));
- ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE(tile_source);
+ ChamplainNetworkTileSourcePrivate *priv = tile_source->priv;
g_free (priv->uri_format);
priv->uri_format = g_strdup (uri_format);
@@ -366,8 +365,7 @@ champlain_network_tile_source_get_proxy_uri (ChamplainNetworkTileSource *tile_so
{
g_return_val_if_fail (CHAMPLAIN_IS_NETWORK_TILE_SOURCE (tile_source), NULL);
- ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE(tile_source);
- return priv->proxy_uri;
+ return tile_source->priv->proxy_uri;
}
/**
@@ -385,7 +383,7 @@ champlain_network_tile_source_set_proxy_uri (ChamplainNetworkTileSource *tile_so
{
g_return_if_fail (CHAMPLAIN_IS_NETWORK_TILE_SOURCE (tile_source));
- ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE(tile_source);
+ ChamplainNetworkTileSourcePrivate *priv = tile_source->priv;
SoupURI *uri = NULL;
g_free (priv->proxy_uri);
@@ -420,8 +418,7 @@ champlain_network_tile_source_get_offline (ChamplainNetworkTileSource *tile_sour
{
g_return_val_if_fail (CHAMPLAIN_IS_NETWORK_TILE_SOURCE (tile_source), FALSE);
- ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE(tile_source);
- return priv->offline;
+ return tile_source->priv->offline;
}
/**
@@ -439,21 +436,19 @@ champlain_network_tile_source_set_offline (ChamplainNetworkTileSource *tile_sour
{
g_return_if_fail (CHAMPLAIN_IS_NETWORK_TILE_SOURCE (tile_source));
- ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE(tile_source);
-
- priv->offline = offline;
+ tile_source->priv->offline = offline;
g_object_notify (G_OBJECT (tile_source), "offline");
}
#define SIZE 8
static gchar *
-get_tile_uri (ChamplainNetworkTileSource *source,
+get_tile_uri (ChamplainNetworkTileSource *tile_source,
gint x,
gint y,
gint z)
{
- ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE(source);
+ ChamplainNetworkTileSourcePrivate *priv = tile_source->priv;
gchar **tokens;
gchar *token;
@@ -501,7 +496,7 @@ tile_destroyed_cb (ChamplainTile *tile,
if (data->map_source && data->msg)
{
DEBUG ("Canceling tile download");
- ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE(data->map_source);
+ ChamplainNetworkTileSourcePrivate *priv = CHAMPLAIN_NETWORK_TILE_SOURCE (data->map_source)->priv;
soup_session_cancel_message (priv->soup_session, data->msg, SOUP_STATUS_CANCELLED);
}
@@ -653,7 +648,7 @@ fill_tile (ChamplainMapSource *map_source,
g_return_if_fail (CHAMPLAIN_IS_TILE (tile));
ChamplainNetworkTileSource *tile_source = CHAMPLAIN_NETWORK_TILE_SOURCE (map_source);
- ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE(tile_source);
+ ChamplainNetworkTileSourcePrivate *priv = tile_source->priv;
if (!priv->offline)
{
diff --git a/champlain/champlain-network-tile-source.h b/champlain/champlain-network-tile-source.h
index b73640d..1c1a4b3 100644
--- a/champlain/champlain-network-tile-source.h
+++ b/champlain/champlain-network-tile-source.h
@@ -36,12 +36,16 @@ G_BEGIN_DECLS
#define CHAMPLAIN_IS_NETWORK_TILE_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_NETWORK_TILE_SOURCE))
#define CHAMPLAIN_NETWORK_TILE_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_NETWORK_TILE_SOURCE, ChamplainNetworkTileSourceClass))
+typedef struct _ChamplainNetworkTileSourcePrivate ChamplainNetworkTileSourcePrivate;
+
typedef struct _ChamplainNetworkTileSource ChamplainNetworkTileSource;
typedef struct _ChamplainNetworkTileSourceClass ChamplainNetworkTileSourceClass;
struct _ChamplainNetworkTileSource
{
ChamplainTileSource parent_instance;
+
+ ChamplainNetworkTileSourcePrivate *priv;
};
struct _ChamplainNetworkTileSourceClass
diff --git a/champlain/champlain-polygon.c b/champlain/champlain-polygon.c
index 907ab17..f2c4a69 100644
--- a/champlain/champlain-polygon.c
+++ b/champlain/champlain-polygon.c
@@ -73,7 +73,7 @@ champlain_polygon_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- ChamplainPolygonPrivate *priv = GET_PRIVATE (object);
+ ChamplainPolygonPrivate *priv = CHAMPLAIN_POLYGON (object)->priv;
switch (property_id)
{
@@ -112,7 +112,7 @@ champlain_polygon_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- ChamplainPolygonPrivate *priv = GET_PRIVATE (object);
+ ChamplainPolygonPrivate *priv = CHAMPLAIN_POLYGON (object)->priv;
switch (property_id)
{
@@ -304,6 +304,8 @@ champlain_polygon_init (ChamplainPolygon *polygon)
{
ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
+ polygon->priv = priv;
+
priv->visible = TRUE;
priv->points = NULL;
priv->fill = FALSE;
@@ -347,7 +349,7 @@ champlain_polygon_append_point (ChamplainPolygon *polygon,
{
g_return_val_if_fail (CHAMPLAIN_IS_POLYGON (polygon), NULL);
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
+ ChamplainPolygonPrivate *priv = polygon->priv;
ChamplainPoint *point = champlain_point_new (lat, lon);
@@ -377,7 +379,7 @@ champlain_polygon_insert_point (ChamplainPolygon *polygon,
{
g_return_val_if_fail (CHAMPLAIN_IS_POLYGON (polygon), NULL);
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
+ ChamplainPolygonPrivate *priv = polygon->priv;
ChamplainPoint *point = champlain_point_new (lat, lon);
@@ -401,7 +403,7 @@ champlain_polygon_remove_point (ChamplainPolygon *polygon,
{
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
+ ChamplainPolygonPrivate *priv = polygon->priv;
priv->points = g_list_remove (priv->points, point);
g_object_notify (G_OBJECT (polygon), "visible");
@@ -420,7 +422,7 @@ champlain_polygon_clear_points (ChamplainPolygon *polygon)
{
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
+ ChamplainPolygonPrivate *priv = polygon->priv;
GList *next = priv->points;
while (next != NULL)
@@ -446,9 +448,7 @@ champlain_polygon_get_points (ChamplainPolygon *polygon)
{
g_return_val_if_fail (CHAMPLAIN_IS_POLYGON (polygon), NULL);
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
-
- return priv->points;
+ return polygon->priv->points;
}
/**
@@ -467,7 +467,7 @@ champlain_polygon_set_fill_color (ChamplainPolygon *polygon,
{
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
+ ChamplainPolygonPrivate *priv = polygon->priv;
if (priv->fill_color != NULL)
clutter_color_free (priv->fill_color);
@@ -495,7 +495,7 @@ champlain_polygon_set_stroke_color (ChamplainPolygon *polygon,
{
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
+ ChamplainPolygonPrivate *priv = polygon->priv;
if (priv->stroke_color != NULL)
clutter_color_free (priv->stroke_color);
@@ -520,9 +520,7 @@ champlain_polygon_get_fill_color (ChamplainPolygon *polygon)
{
g_return_val_if_fail (CHAMPLAIN_IS_POLYGON (polygon), NULL);
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
-
- return priv->fill_color;
+ return polygon->priv->fill_color;
}
/**
@@ -538,9 +536,7 @@ champlain_polygon_get_stroke_color (ChamplainPolygon *polygon)
{
g_return_val_if_fail (CHAMPLAIN_IS_POLYGON (polygon), NULL);
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
-
- return priv->stroke_color;
+ return polygon->priv->stroke_color;
}
/**
@@ -558,9 +554,7 @@ champlain_polygon_set_stroke (ChamplainPolygon *polygon,
{
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
-
- priv->stroke = value;
+ polygon->priv->stroke = value;
g_object_notify (G_OBJECT (polygon), "stroke");
}
@@ -577,9 +571,7 @@ champlain_polygon_get_stroke (ChamplainPolygon *polygon)
{
g_return_val_if_fail (CHAMPLAIN_IS_POLYGON (polygon), FALSE);
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
-
- return priv->stroke;
+ return polygon->priv->stroke;
}
/**
@@ -597,9 +589,7 @@ champlain_polygon_set_fill (ChamplainPolygon *polygon,
{
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
-
- priv->fill = value;
+ polygon->priv->fill = value;
g_object_notify (G_OBJECT (polygon), "fill");
}
@@ -616,9 +606,7 @@ champlain_polygon_get_fill (ChamplainPolygon *polygon)
{
g_return_val_if_fail (CHAMPLAIN_IS_POLYGON (polygon), FALSE);
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
-
- return priv->fill;
+ return polygon->priv->fill;
}
/**
@@ -636,9 +624,7 @@ champlain_polygon_set_stroke_width (ChamplainPolygon *polygon,
{
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
-
- priv->stroke_width = value;
+ polygon->priv->stroke_width = value;
g_object_notify (G_OBJECT (polygon), "stroke-width");
}
@@ -655,9 +641,7 @@ champlain_polygon_get_stroke_width (ChamplainPolygon *polygon)
{
g_return_val_if_fail (CHAMPLAIN_IS_POLYGON (polygon), 0);
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
-
- return priv->stroke_width;
+ return polygon->priv->stroke_width;
}
/**
@@ -676,9 +660,7 @@ champlain_polygon_set_mark_points (ChamplainPolygon *polygon,
{
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
-
- priv->mark_points = value;
+ polygon->priv->mark_points = value;
g_object_notify (G_OBJECT (polygon), "mark-points");
}
@@ -695,9 +677,7 @@ champlain_polygon_get_mark_points (ChamplainPolygon *polygon)
{
g_return_val_if_fail (CHAMPLAIN_IS_POLYGON (polygon), FALSE);
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
-
- return priv->mark_points;
+ return polygon->priv->mark_points;
}
/**
@@ -713,9 +693,7 @@ champlain_polygon_show (ChamplainPolygon *polygon)
{
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
-
- priv->visible = TRUE;
+ polygon->priv->visible = TRUE;
clutter_actor_show (CLUTTER_ACTOR (polygon));
g_object_notify (G_OBJECT (polygon), "visible");
}
@@ -733,9 +711,7 @@ champlain_polygon_hide (ChamplainPolygon *polygon)
{
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
-
- priv->visible = FALSE;
+ polygon->priv->visible = FALSE;
clutter_actor_hide (CLUTTER_ACTOR (polygon));
g_object_notify (G_OBJECT (polygon), "visible");
}
@@ -749,7 +725,7 @@ champlain_polygon_draw_polygon (ChamplainPolygon *polygon,
gfloat shift_x,
gfloat shift_y)
{
- ChamplainPolygonPrivate *priv = GET_PRIVATE (polygon);
+ ChamplainPolygonPrivate *priv = polygon->priv;
ClutterActor *cairo_texture;
cairo_t *cr;
diff --git a/champlain/champlain-polygon.h b/champlain/champlain-polygon.h
index 9f9422a..f8de71e 100644
--- a/champlain/champlain-polygon.h
+++ b/champlain/champlain-polygon.h
@@ -55,6 +55,8 @@ typedef struct _ChamplainPolygonClass ChamplainPolygonClass;
struct _ChamplainPolygon {
ClutterGroup parent;
+
+ ChamplainPolygonPrivate *priv;
};
struct _ChamplainPolygonClass {
diff --git a/champlain/champlain-tile-cache.c b/champlain/champlain-tile-cache.c
index 68698b4..c3a394c 100644
--- a/champlain/champlain-tile-cache.c
+++ b/champlain/champlain-tile-cache.c
@@ -37,8 +37,6 @@ enum
PROP_PERSISTENT_CACHE
};
-typedef struct _ChamplainTileCachePrivate ChamplainTileCachePrivate;
-
struct _ChamplainTileCachePrivate
{
gboolean persistent;
@@ -77,7 +75,7 @@ champlain_tile_cache_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- ChamplainTileCachePrivate *priv = GET_PRIVATE (object);
+ ChamplainTileCachePrivate *priv = CHAMPLAIN_TILE_CACHE (object)->priv;
switch (property_id)
{
@@ -160,6 +158,8 @@ champlain_tile_cache_init (ChamplainTileCache *tile_cache)
{
ChamplainTileCachePrivate *priv = GET_PRIVATE (tile_cache);
+ tile_cache->priv = priv;
+
priv->persistent = TRUE;
}
@@ -178,8 +178,7 @@ champlain_tile_cache_get_persistent (ChamplainTileCache *tile_cache)
{
g_return_val_if_fail (CHAMPLAIN_IS_TILE_CACHE (tile_cache), FALSE);
- ChamplainTileCachePrivate *priv = GET_PRIVATE(tile_cache);
- return priv->persistent;
+ return tile_cache->priv->persistent;
}
/**
diff --git a/champlain/champlain-tile-cache.h b/champlain/champlain-tile-cache.h
index 6dac00f..d8aa0b6 100644
--- a/champlain/champlain-tile-cache.h
+++ b/champlain/champlain-tile-cache.h
@@ -35,12 +35,16 @@ G_BEGIN_DECLS
#define CHAMPLAIN_IS_TILE_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_TILE_CACHE))
#define CHAMPLAIN_TILE_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_TILE_CACHE, ChamplainTileCacheClass))
+typedef struct _ChamplainTileCachePrivate ChamplainTileCachePrivate;
+
typedef struct _ChamplainTileCache ChamplainTileCache;
typedef struct _ChamplainTileCacheClass ChamplainTileCacheClass;
struct _ChamplainTileCache
{
ChamplainMapSource parent_instance;
+
+ ChamplainTileCachePrivate *priv;
};
struct _ChamplainTileCacheClass
diff --git a/champlain/champlain-tile-source.c b/champlain/champlain-tile-source.c
index 871c369..81e5c54 100644
--- a/champlain/champlain-tile-source.c
+++ b/champlain/champlain-tile-source.c
@@ -46,8 +46,6 @@ enum
PROP_CACHE
};
-typedef struct _ChamplainTileSourcePrivate ChamplainTileSourcePrivate;
-
struct _ChamplainTileSourcePrivate
{
gchar *id;
@@ -76,7 +74,7 @@ champlain_tile_source_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(object);
+ ChamplainTileSourcePrivate *priv = CHAMPLAIN_TILE_SOURCE (object)->priv;
switch (prop_id)
{
@@ -118,7 +116,7 @@ champlain_tile_source_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- ChamplainTileSource *tile_source = CHAMPLAIN_TILE_SOURCE(object);
+ ChamplainTileSource *tile_source = CHAMPLAIN_TILE_SOURCE (object);
switch (prop_id)
{
@@ -165,7 +163,7 @@ champlain_tile_source_set_property (GObject *object,
static void
champlain_tile_source_dispose (GObject *object)
{
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(object);
+ ChamplainTileSourcePrivate *priv = CHAMPLAIN_TILE_SOURCE (object)->priv;
if (priv->cache)
{
@@ -180,7 +178,7 @@ champlain_tile_source_dispose (GObject *object)
static void
champlain_tile_source_finalize (GObject *object)
{
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(object);
+ ChamplainTileSourcePrivate *priv = CHAMPLAIN_TILE_SOURCE (object)->priv;
g_free (priv->id);
g_free (priv->name);
@@ -360,6 +358,9 @@ static void
champlain_tile_source_init (ChamplainTileSource *tile_source)
{
ChamplainTileSourcePrivate *priv = GET_PRIVATE(tile_source);
+
+ tile_source->priv = priv;
+
priv->cache = NULL;
priv->id = NULL;
priv->name = NULL;
@@ -386,8 +387,7 @@ champlain_tile_source_get_cache (ChamplainTileSource *tile_source)
{
g_return_val_if_fail (CHAMPLAIN_IS_TILE_SOURCE (tile_source), NULL);
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(tile_source);
- return priv->cache;
+ return tile_source->priv->cache;
}
/**
@@ -405,7 +405,7 @@ champlain_tile_source_set_cache (ChamplainTileSource *tile_source,
{
g_return_if_fail (CHAMPLAIN_IS_TILE_SOURCE (tile_source));
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(tile_source);
+ ChamplainTileSourcePrivate *priv = tile_source->priv;
if (priv->cache != NULL)
g_object_unref (priv->cache);
@@ -427,8 +427,7 @@ get_id (ChamplainMapSource *map_source)
{
g_return_val_if_fail (CHAMPLAIN_IS_TILE_SOURCE (map_source), NULL);
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(map_source);
- return priv->id;
+ return CHAMPLAIN_TILE_SOURCE (map_source)->priv->id;
}
static const gchar *
@@ -436,8 +435,7 @@ get_name (ChamplainMapSource *map_source)
{
g_return_val_if_fail (CHAMPLAIN_IS_TILE_SOURCE (map_source), NULL);
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(map_source);
- return priv->name;
+ return CHAMPLAIN_TILE_SOURCE (map_source)->priv->name;
}
static const gchar *
@@ -445,8 +443,7 @@ get_license (ChamplainMapSource *map_source)
{
g_return_val_if_fail (CHAMPLAIN_IS_TILE_SOURCE (map_source), NULL);
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(map_source);
- return priv->license;
+ return CHAMPLAIN_TILE_SOURCE (map_source)->priv->license;
}
static const gchar *
@@ -454,8 +451,7 @@ get_license_uri (ChamplainMapSource *map_source)
{
g_return_val_if_fail (CHAMPLAIN_IS_TILE_SOURCE (map_source), NULL);
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(map_source);
- return priv->license_uri;
+ return CHAMPLAIN_TILE_SOURCE (map_source)->priv->license_uri;
}
static guint
@@ -463,8 +459,7 @@ get_min_zoom_level (ChamplainMapSource *map_source)
{
g_return_val_if_fail (CHAMPLAIN_IS_TILE_SOURCE (map_source), 0);
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(map_source);
- return priv->min_zoom_level;
+ return CHAMPLAIN_TILE_SOURCE (map_source)->priv->min_zoom_level;
}
static guint
@@ -472,8 +467,7 @@ get_max_zoom_level (ChamplainMapSource *map_source)
{
g_return_val_if_fail (CHAMPLAIN_IS_TILE_SOURCE (map_source), 0);
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(map_source);
- return priv->max_zoom_level;
+ return CHAMPLAIN_TILE_SOURCE (map_source)->priv->max_zoom_level;
}
static guint
@@ -481,8 +475,7 @@ get_tile_size (ChamplainMapSource *map_source)
{
g_return_val_if_fail (CHAMPLAIN_IS_TILE_SOURCE (map_source), 0);
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(map_source);
- return priv->tile_size;
+ return CHAMPLAIN_TILE_SOURCE (map_source)->priv->tile_size;
}
static ChamplainMapProjection
@@ -490,8 +483,7 @@ get_projection (ChamplainMapSource *map_source)
{
g_return_val_if_fail (CHAMPLAIN_IS_TILE_SOURCE (map_source), 0);
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(map_source);
- return priv->map_projection;
+ return CHAMPLAIN_TILE_SOURCE (map_source)->priv->map_projection;
}
/**
@@ -509,7 +501,7 @@ champlain_tile_source_set_id (ChamplainTileSource *tile_source,
{
g_return_if_fail (CHAMPLAIN_IS_TILE_SOURCE (tile_source));
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(tile_source);
+ ChamplainTileSourcePrivate *priv = tile_source->priv;
g_free (priv->id);
priv->id = g_strdup (id);
@@ -532,7 +524,7 @@ champlain_tile_source_set_name (ChamplainTileSource *tile_source,
{
g_return_if_fail (CHAMPLAIN_IS_TILE_SOURCE (tile_source));
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(tile_source);
+ ChamplainTileSourcePrivate *priv = tile_source->priv;
g_free (priv->name);
priv->name = g_strdup (name);
@@ -555,7 +547,7 @@ champlain_tile_source_set_license (ChamplainTileSource *tile_source,
{
g_return_if_fail (CHAMPLAIN_IS_TILE_SOURCE (tile_source));
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(tile_source);
+ ChamplainTileSourcePrivate *priv = tile_source->priv;
g_free (priv->license);
priv->license = g_strdup (license);
@@ -578,7 +570,7 @@ champlain_tile_source_set_license_uri (ChamplainTileSource *tile_source,
{
g_return_if_fail (CHAMPLAIN_IS_TILE_SOURCE (tile_source));
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(tile_source);
+ ChamplainTileSourcePrivate *priv = tile_source->priv;
g_free (priv->license_uri);
priv->license_uri = g_strdup (license_uri);
@@ -601,9 +593,7 @@ champlain_tile_source_set_min_zoom_level (ChamplainTileSource *tile_source,
{
g_return_if_fail (CHAMPLAIN_IS_TILE_SOURCE (tile_source));
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(tile_source);
-
- priv->min_zoom_level = zoom_level;
+ tile_source->priv->min_zoom_level = zoom_level;
g_object_notify (G_OBJECT (tile_source), "min-zoom-level");
}
@@ -623,9 +613,7 @@ champlain_tile_source_set_max_zoom_level (ChamplainTileSource *tile_source,
{
g_return_if_fail (CHAMPLAIN_IS_TILE_SOURCE (tile_source));
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(tile_source);
-
- priv->max_zoom_level = zoom_level;
+ tile_source->priv->max_zoom_level = zoom_level;
g_object_notify (G_OBJECT (tile_source), "max-zoom-level");
}
@@ -645,9 +633,7 @@ champlain_tile_source_set_tile_size (ChamplainTileSource *tile_source,
{
g_return_if_fail (CHAMPLAIN_IS_TILE_SOURCE (tile_source));
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(tile_source);
-
- priv->tile_size = tile_size;
+ tile_source->priv->tile_size = tile_size;
g_object_notify (G_OBJECT (tile_source), "tile-size");
}
@@ -667,9 +653,7 @@ champlain_tile_source_set_projection (ChamplainTileSource *tile_source,
{
g_return_if_fail (CHAMPLAIN_IS_TILE_SOURCE (tile_source));
- ChamplainTileSourcePrivate *priv = GET_PRIVATE(tile_source);
-
- priv->map_projection = projection;
+ tile_source->priv->map_projection = projection;
g_object_notify (G_OBJECT (tile_source), "projection");
}
diff --git a/champlain/champlain-tile-source.h b/champlain/champlain-tile-source.h
index 99d8234..9daf9e2 100644
--- a/champlain/champlain-tile-source.h
+++ b/champlain/champlain-tile-source.h
@@ -37,12 +37,16 @@ G_BEGIN_DECLS
#define CHAMPLAIN_IS_TILE_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHAMPLAIN_TYPE_TILE_SOURCE))
#define CHAMPLAIN_TILE_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHAMPLAIN_TYPE_TILE_SOURCE, ChamplainTileSourceClass))
+typedef struct _ChamplainTileSourcePrivate ChamplainTileSourcePrivate;
+
typedef struct _ChamplainTileSource ChamplainTileSource;
typedef struct _ChamplainTileSourceClass ChamplainTileSourceClass;
struct _ChamplainTileSource
{
ChamplainMapSource parent_instance;
+
+ ChamplainTileSourcePrivate *priv;
};
struct _ChamplainTileSourceClass
diff --git a/champlain/champlain-tile.c b/champlain/champlain-tile.c
index c2dcd94..b72c0b3 100644
--- a/champlain/champlain-tile.c
+++ b/champlain/champlain-tile.c
@@ -151,7 +151,7 @@ champlain_tile_dispose (GObject *object)
static void
champlain_tile_finalize (GObject *object)
{
- ChamplainTilePrivate *priv = GET_PRIVATE (object);
+ ChamplainTilePrivate *priv = CHAMPLAIN_TILE (object)->priv;
g_free (priv->modified_time);
g_free (priv->etag);
@@ -309,6 +309,8 @@ champlain_tile_init (ChamplainTile *self)
{
ChamplainTilePrivate *priv = GET_PRIVATE (self);
+ self->priv = priv;
+
priv->state = CHAMPLAIN_STATE_NONE;
priv->x = 0;
priv->y = 0;
@@ -347,7 +349,7 @@ champlain_tile_get_x (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), 0);
- return GET_PRIVATE (self)->x;
+ return self->priv->x;
}
/**
@@ -363,7 +365,7 @@ champlain_tile_get_y (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), 0);
- return GET_PRIVATE (self)->y;
+ return self->priv->y;
}
/**
@@ -379,7 +381,7 @@ champlain_tile_get_zoom_level (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), 0);
- return GET_PRIVATE (self)->zoom_level;
+ return self->priv->zoom_level;
}
/**
@@ -395,7 +397,7 @@ champlain_tile_get_size (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), 0);
- return GET_PRIVATE (self)->size;
+ return self->priv->size;
}
/**
@@ -411,7 +413,7 @@ champlain_tile_get_state (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), CHAMPLAIN_STATE_NONE);
- return GET_PRIVATE (self)->state;
+ return self->priv->state;
}
/**
@@ -429,7 +431,7 @@ champlain_tile_set_x (ChamplainTile *self,
{
g_return_if_fail (CHAMPLAIN_TILE (self));
- GET_PRIVATE (self)->x = x;
+ self->priv->x = x;
g_object_notify (G_OBJECT (self), "x");
}
@@ -449,7 +451,7 @@ champlain_tile_set_y (ChamplainTile *self,
{
g_return_if_fail (CHAMPLAIN_TILE (self));
- GET_PRIVATE (self)->y = y;
+ self->priv->y = y;
g_object_notify (G_OBJECT (self), "y");
}
@@ -469,7 +471,7 @@ champlain_tile_set_zoom_level (ChamplainTile *self,
{
g_return_if_fail (CHAMPLAIN_TILE (self));
- GET_PRIVATE (self)->zoom_level = zoom_level;
+ self->priv->zoom_level = zoom_level;
g_object_notify (G_OBJECT (self), "zoom-level");
}
@@ -489,7 +491,7 @@ champlain_tile_set_size (ChamplainTile *self,
{
g_return_if_fail (CHAMPLAIN_TILE (self));
- GET_PRIVATE (self)->size = size;
+ self->priv->size = size;
g_object_notify (G_OBJECT (self), "size");
}
@@ -518,7 +520,7 @@ champlain_tile_set_state (ChamplainTile *self,
{
g_return_if_fail (CHAMPLAIN_TILE (self));
- ChamplainTilePrivate *priv = GET_PRIVATE (self);
+ ChamplainTilePrivate *priv = self->priv;
if (state == priv->state)
return;
@@ -591,7 +593,7 @@ champlain_tile_get_modified_time (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), NULL);
- return GET_PRIVATE (self)->modified_time;
+ return self->priv->modified_time;
}
/**
@@ -610,7 +612,7 @@ champlain_tile_set_modified_time (ChamplainTile *self,
g_return_if_fail (CHAMPLAIN_TILE (self));
g_return_if_fail (time != NULL);
- ChamplainTilePrivate *priv = GET_PRIVATE (self);
+ ChamplainTilePrivate *priv = self->priv;
g_free (priv->modified_time);
priv->modified_time = g_memdup(time_, sizeof (GTimeVal));
@@ -629,7 +631,7 @@ champlain_tile_get_modified_time_string (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), NULL);
- ChamplainTilePrivate *priv = GET_PRIVATE (self);
+ ChamplainTilePrivate *priv = self->priv;
if (priv->modified_time == NULL)
return NULL;
@@ -655,7 +657,7 @@ champlain_tile_get_etag (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), "");
- return GET_PRIVATE (self)->etag;
+ return self->priv->etag;
}
/**
@@ -673,7 +675,7 @@ champlain_tile_set_etag (ChamplainTile *self,
{
g_return_if_fail (CHAMPLAIN_TILE (self));
- ChamplainTilePrivate *priv = GET_PRIVATE (self);
+ ChamplainTilePrivate *priv = self->priv;
g_free (priv->etag);
priv->etag = g_strdup (etag);
@@ -696,7 +698,7 @@ champlain_tile_set_content (ChamplainTile *self,
g_return_if_fail (CHAMPLAIN_TILE (self));
g_return_if_fail (CLUTTER_ACTOR (actor));
- ChamplainTilePrivate *priv = GET_PRIVATE (self);
+ ChamplainTilePrivate *priv = self->priv;
if (priv->content_actor &&
clutter_actor_get_parent (priv->content_actor) != CLUTTER_ACTOR (self))
@@ -721,7 +723,7 @@ champlain_tile_get_content (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), NULL);
- return GET_PRIVATE (self)->content_actor;
+ return self->priv->content_actor;
}
/**
@@ -737,7 +739,7 @@ champlain_tile_get_fade_in (ChamplainTile *self)
{
g_return_val_if_fail (CHAMPLAIN_TILE (self), FALSE);
- return GET_PRIVATE (self)->fade_in;
+ return self->priv->fade_in;
}
/**
@@ -755,7 +757,7 @@ champlain_tile_set_fade_in (ChamplainTile *self,
{
g_return_if_fail (CHAMPLAIN_TILE (self));
- GET_PRIVATE (self)->fade_in = fade_in;
+ self->priv->fade_in = fade_in;
g_object_notify (G_OBJECT (self), "fade-in");
}
diff --git a/champlain/champlain-tile.h b/champlain/champlain-tile.h
index d6fe1b3..23e1f2b 100644
--- a/champlain/champlain-tile.h
+++ b/champlain/champlain-tile.h
@@ -50,6 +50,8 @@ typedef struct _ChamplainTileClass ChamplainTileClass;
struct _ChamplainTile {
ClutterGroup parent;
+
+ ChamplainTilePrivate *priv;
};
struct _ChamplainTileClass {
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index 4cb94fd..7ec2b9c 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -304,7 +304,7 @@ update_viewport (ChamplainView *view,
gfloat x,
gfloat y)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gfloat lat, lon;
ChamplainFloatPoint old_anchor;
@@ -357,10 +357,9 @@ static void
panning_completed (TidyFingerScroll *scroll,
ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
gfloat x, y;
- tidy_viewport_get_origin (TIDY_VIEWPORT (priv->viewport), &x, &y,
+ tidy_viewport_get_origin (TIDY_VIEWPORT (view->priv->viewport), &x, &y,
NULL);
update_viewport (view, x, y);
@@ -371,7 +370,7 @@ scroll_event (ClutterActor *actor,
ClutterScrollEvent *event,
ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gint zoom_level = priv->zoom_level;
@@ -387,7 +386,7 @@ static void
marker_reposition_cb (ChamplainMarker *marker,
ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
ChamplainBaseMarkerPrivate *marker_priv = CHAMPLAIN_BASE_MARKER(marker)->priv;
gint x, y;
@@ -439,8 +438,7 @@ static gboolean
marker_reposition (gpointer data)
{
ChamplainView *view = CHAMPLAIN_VIEW (data);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
- clutter_container_foreach (CLUTTER_CONTAINER (priv->user_layers),
+ clutter_container_foreach (CLUTTER_CONTAINER (view->priv->user_layers),
CLUTTER_CALLBACK (layer_reposition_cb), view);
return FALSE;
}
@@ -448,7 +446,7 @@ marker_reposition (gpointer data)
static gboolean
redraw_polygon_on_idle (PolygonRedrawContext *ctx)
{
- ChamplainViewPrivate *priv = GET_PRIVATE(ctx->view);
+ ChamplainViewPrivate *priv = ctx->view->priv;
if (ctx->polygon)
champlain_polygon_draw_polygon (ctx->polygon,
@@ -467,7 +465,7 @@ notify_polygon_cb (ChamplainPolygon *polygon,
GParamSpec *arg1,
ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
PolygonRedrawContext *ctx;
if (priv->polygon_redraw_id != 0)
@@ -489,7 +487,7 @@ resize_viewport (ChamplainView *view)
gint i;
TidyAdjustment *hadjust, *vadjust;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
tidy_scrollable_get_adjustments (TIDY_SCROLLABLE (priv->viewport), &hadjust,
&vadjust);
@@ -557,7 +555,7 @@ champlain_view_get_property (GObject *object,
GParamSpec *pspec)
{
ChamplainView *view = CHAMPLAIN_VIEW (object);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
switch (prop_id)
{
@@ -627,7 +625,7 @@ champlain_view_set_property (GObject *object,
GParamSpec *pspec)
{
ChamplainView *view = CHAMPLAIN_VIEW (object);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
switch (prop_id)
{
@@ -687,7 +685,7 @@ static void
champlain_view_dispose (GObject *object)
{
ChamplainView *view = CHAMPLAIN_VIEW (object);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
g_source_remove (priv->update_cb_id);
@@ -762,7 +760,7 @@ champlain_view_dispose (GObject *object)
static gboolean
_update_idle_cb (ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
clutter_actor_set_size (priv->finger_scroll,
priv->viewport_size.width,
@@ -791,7 +789,7 @@ champlain_view_allocate (ClutterActor *actor,
ClutterAllocationFlags flags)
{
ChamplainView *view = CHAMPLAIN_VIEW (actor);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
guint width, height;
/* Chain up */
@@ -816,7 +814,7 @@ static void
champlain_view_realize (ClutterActor *actor)
{
ChamplainView *view = CHAMPLAIN_VIEW (actor);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
/*
We should be calling this but it segfaults
@@ -849,8 +847,7 @@ champlain_view_get_preferred_width (ClutterActor *actor,
gfloat *nat_width)
{
ChamplainView *view = CHAMPLAIN_VIEW (actor);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
- gint width = champlain_map_source_get_tile_size (priv->map_source);
+ gint width = champlain_map_source_get_tile_size (view->priv->map_source);
if (min_width)
*min_width = 1;
@@ -866,8 +863,7 @@ champlain_view_get_preferred_height (ClutterActor *actor,
gfloat *nat_height)
{
ChamplainView *view = CHAMPLAIN_VIEW (actor);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
- gint height = champlain_map_source_get_tile_size (priv->map_source);
+ gint height = champlain_map_source_get_tile_size (view->priv->map_source);
if (min_height)
*min_height = 1;
@@ -1156,7 +1152,7 @@ champlain_view_class_init (ChamplainViewClass *champlainViewClass)
static void
create_license (ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->license_actor)
{
@@ -1181,7 +1177,7 @@ button_release_cb (ClutterActor *actor,
{
guint i;
gboolean found = FALSE;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (clutter_event_get_button (event) != 1)
return FALSE;
@@ -1209,7 +1205,7 @@ update_scale (ChamplainView *view)
gboolean is_small_unit = TRUE; /* indicates if using meters */
ClutterActor *text, *line;
gfloat width;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gfloat m_per_pixel;
gfloat scale_width = priv->max_scale_width;
gchar *label;
@@ -1345,7 +1341,7 @@ create_scale (ChamplainView *view)
{
ClutterActor *scale, *text;
gfloat width;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->scale_actor)
{
@@ -1388,6 +1384,8 @@ champlain_view_init (ChamplainView *view)
champlain_debug_set_flags (g_getenv ("CHAMPLAIN_DEBUG"));
+ view->priv = priv;
+
priv->factory = champlain_map_source_factory_dup_default ();
source = champlain_map_source_factory_create_cached_source (priv->factory, CHAMPLAIN_MAP_SOURCE_OSM_MAPNIK);
@@ -1499,9 +1497,7 @@ champlain_view_init (ChamplainView *view)
static gboolean
perform_update_cb (ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- priv->perform_update = TRUE;
+ view->priv->perform_update = TRUE;
return TRUE;
}
@@ -1510,7 +1506,7 @@ viewport_pos_changed_cb (GObject *gobject,
GParamSpec *arg1,
ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gfloat x, y;
@@ -1550,7 +1546,7 @@ champlain_view_set_size (ChamplainView *view,
static void
update_license (ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gchar *license;
if (priv->license_text)
@@ -1576,12 +1572,11 @@ finger_scroll_button_press_cb (ClutterActor *actor,
ClutterButtonEvent *event,
ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->zoom_on_double_click && event->button == 1 && event->click_count == 2)
- {
- return view_set_zoom_level_at (view, priv->zoom_level + 1, event->x, event->y);
- }
+ return view_set_zoom_level_at (view, priv->zoom_level + 1, event->x, event->y);
+
return FALSE; /* Propagate the event */
}
@@ -1590,7 +1585,7 @@ scroll_to (ChamplainView *view,
gint x,
gint y)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gfloat lat, lon;
lat = champlain_map_source_get_latitude (priv->map_source, priv->zoom_level, y);
@@ -1609,7 +1604,7 @@ champlain_view_scroll_left (ChamplainView* view)
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
gint x, y;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
x = champlain_map_source_get_x (priv->map_source, priv->zoom_level, priv->longitude);
y = champlain_map_source_get_y (priv->map_source, priv->zoom_level, priv->latitude);
@@ -1625,7 +1620,7 @@ champlain_view_scroll_right (ChamplainView* view)
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
gint x, y;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
x = champlain_map_source_get_x (priv->map_source, priv->zoom_level, priv->longitude);
y = champlain_map_source_get_y (priv->map_source, priv->zoom_level, priv->latitude);
@@ -1641,7 +1636,7 @@ champlain_view_scroll_up (ChamplainView* view)
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
gint x, y;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
x = champlain_map_source_get_x (priv->map_source, priv->zoom_level, priv->longitude);
y = champlain_map_source_get_y (priv->map_source, priv->zoom_level, priv->latitude);
@@ -1657,7 +1652,7 @@ champlain_view_scroll_down (ChamplainView* view)
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
gint x, y;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
x = champlain_map_source_get_x (priv->map_source, priv->zoom_level, priv->longitude);
y = champlain_map_source_get_y (priv->map_source, priv->zoom_level, priv->latitude);
@@ -1721,7 +1716,7 @@ view_update_anchor (ChamplainView *view,
gint x, /* Absolute x */
gint y) /* Absolute y */
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gboolean need_anchor = FALSE;
gboolean need_update = FALSE;
@@ -1787,7 +1782,7 @@ champlain_view_center_on (ChamplainView *view,
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
gint x, y;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
priv->longitude = CLAMP (longitude, CHAMPLAIN_MIN_LONG, CHAMPLAIN_MAX_LONG);
priv->latitude = CLAMP (latitude, CHAMPLAIN_MIN_LAT, CHAMPLAIN_MAX_LAT);
@@ -1857,7 +1852,7 @@ champlain_view_stop_go_to (ChamplainView *view)
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->goto_context == NULL)
return;
@@ -1889,10 +1884,9 @@ champlain_view_go_to (ChamplainView *view,
gdouble latitude,
gdouble longitude)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
guint duration;
- duration = 500 * priv->zoom_level / 2.0;
+ duration = 500 * view->priv->zoom_level / 2.0;
champlain_view_go_to_with_duration (view, latitude, longitude, duration);
}
@@ -1913,7 +1907,7 @@ champlain_view_go_to_with_duration (ChamplainView *view,
GoToContext *ctx;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
champlain_view_stop_go_to (view);
@@ -1959,9 +1953,7 @@ champlain_view_zoom_in (ChamplainView *view)
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- champlain_view_set_zoom_level (view, priv->zoom_level + 1);
+ champlain_view_set_zoom_level (view, view->priv->zoom_level + 1);
}
/**
@@ -1977,9 +1969,7 @@ champlain_view_zoom_out (ChamplainView *view)
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- champlain_view_set_zoom_level (view, priv->zoom_level - 1);
+ champlain_view_set_zoom_level (view, view->priv->zoom_level - 1);
}
/**
@@ -1997,7 +1987,7 @@ champlain_view_set_zoom_level (ChamplainView *view,
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (zoom_level == priv->zoom_level || ZOOM_LEVEL_OUT_OF_RANGE(priv, zoom_level))
return;
@@ -2030,7 +2020,7 @@ champlain_view_set_min_zoom_level (ChamplainView *view,
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->min_zoom_level == min_zoom_level ||
min_zoom_level > priv->max_zoom_level ||
@@ -2058,7 +2048,7 @@ champlain_view_set_max_zoom_level (ChamplainView *view,
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->max_zoom_level == max_zoom_level ||
max_zoom_level < priv->min_zoom_level ||
@@ -2087,8 +2077,7 @@ champlain_view_add_layer (ChamplainView *view,
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
g_return_if_fail (CHAMPLAIN_IS_LAYER (layer));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
- clutter_container_add_actor (CLUTTER_CONTAINER (priv->user_layers),
+ clutter_container_add_actor (CLUTTER_CONTAINER (view->priv->user_layers),
CLUTTER_ACTOR (layer));
clutter_actor_raise_top (CLUTTER_ACTOR (layer));
@@ -2117,11 +2106,9 @@ champlain_view_remove_layer (ChamplainView *view,
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
g_return_if_fail (CHAMPLAIN_IS_LAYER (layer));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
g_signal_handlers_disconnect_by_func (layer,
G_CALLBACK (layer_add_marker_cb), view);
- clutter_container_remove_actor (CLUTTER_CONTAINER (priv->user_layers),
+ clutter_container_remove_actor (CLUTTER_CONTAINER (view->priv->user_layers),
CLUTTER_ACTOR (layer));
}
@@ -2207,7 +2194,7 @@ gboolean champlain_view_get_coords_at (ChamplainView *view,
gdouble *longitude)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gfloat actor_x, actor_y;
gdouble rel_x, rel_y;
@@ -2229,7 +2216,7 @@ gboolean champlain_view_get_coords_at (ChamplainView *view,
static void
view_load_visible_tiles (ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
ChamplainRectangle viewport = priv->viewport_size;
gint size;
GList *children;
@@ -2371,7 +2358,7 @@ static void
view_position_tile (ChamplainView* view,
ChamplainTile* tile)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
ClutterActor *actor;
gint x;
@@ -2393,9 +2380,7 @@ static void
view_reload_tiles_cb (ChamplainMapSource *map_source,
ChamplainView* view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- clutter_group_remove_all (CLUTTER_GROUP (priv->map_layer));
+ clutter_group_remove_all (CLUTTER_GROUP (view->priv->map_layer));
view_load_visible_tiles (view);
}
@@ -2411,7 +2396,7 @@ tile_state_notify (GObject *gobject,
static void
view_update_state (ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
ChamplainState new_state = CHAMPLAIN_STATE_DONE;
gint i;
@@ -2450,7 +2435,7 @@ champlain_view_set_map_source (ChamplainView *view,
g_return_if_fail (CHAMPLAIN_IS_VIEW (view) &&
CHAMPLAIN_IS_MAP_SOURCE (source));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->map_source == source)
return;
@@ -2501,9 +2486,7 @@ champlain_view_set_decel_rate (ChamplainView *view,
rate < 2.0 &&
rate > 1.0001);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- g_object_set (priv->finger_scroll, "decel-rate", rate, NULL);
+ g_object_set (view->priv->finger_scroll, "decel-rate", rate, NULL);
}
/**
@@ -2521,7 +2504,7 @@ champlain_view_set_scroll_mode (ChamplainView *view,
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
priv->scroll_mode = mode;
@@ -2544,9 +2527,7 @@ champlain_view_set_keep_center_on_resize (ChamplainView *view,
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- priv->keep_center_on_resize = value;
+ view->priv->keep_center_on_resize = value;
}
/**
@@ -2565,7 +2546,7 @@ champlain_view_set_license_text (ChamplainView *view,
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
if (priv->license_text)
g_free (priv->license_text);
@@ -2591,9 +2572,7 @@ champlain_view_set_show_license (ChamplainView *view,
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- priv->show_license = value;
+ view->priv->show_license = value;
update_license (view);
}
@@ -2612,9 +2591,7 @@ champlain_view_set_show_scale (ChamplainView *view,
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- priv->show_scale = value;
+ view->priv->show_scale = value;
update_scale (view);
}
@@ -2633,9 +2610,7 @@ champlain_view_set_max_scale_width (ChamplainView *view,
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- priv->max_scale_width = value;
+ view->priv->max_scale_width = value;
create_scale (view);
update_scale (view);
}
@@ -2655,9 +2630,7 @@ champlain_view_set_scale_unit (ChamplainView *view,
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- priv->scale_unit = unit;
+ view->priv->scale_unit = unit;
update_scale (view);
}
@@ -2676,9 +2649,7 @@ champlain_view_set_zoom_on_double_click (ChamplainView *view,
{
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- priv->zoom_on_double_click = value;
+ view->priv->zoom_on_double_click = value;
}
/**
@@ -2703,7 +2674,7 @@ champlain_view_ensure_visible (ChamplainView *view,
gdouble lon2,
gboolean animate)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gint zoom_level = priv->zoom_level;
gdouble width, height;
gdouble min_lat,min_lon,max_lat,max_lon;
@@ -2826,7 +2797,7 @@ view_set_zoom_level_at (ChamplainView *view,
gint x,
gint y)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gdouble lon, lat;
gint x_diff, y_diff;
@@ -2886,9 +2857,7 @@ champlain_view_get_zoom_level (ChamplainView *view)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), 0);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- return priv->zoom_level;
+ return view->priv->zoom_level;
}
/**
@@ -2904,9 +2873,7 @@ champlain_view_get_min_zoom_level (ChamplainView *view)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), 0);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- return priv->min_zoom_level;
+ return view->priv->min_zoom_level;
}
/**
@@ -2922,9 +2889,7 @@ champlain_view_get_max_zoom_level (ChamplainView *view)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), 0);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- return priv->max_zoom_level;
+ return view->priv->max_zoom_level;
}
/**
@@ -2941,9 +2906,7 @@ champlain_view_get_map_source (ChamplainView *view)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), NULL);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- return priv->map_source;
+ return view->priv->map_source;
}
/**
@@ -2959,9 +2922,8 @@ champlain_view_get_decel_rate (ChamplainView *view)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), 0.0);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
gdouble decel = 0.0;
- g_object_get (priv->finger_scroll, "decel-rate", &decel, NULL);
+ g_object_get (view->priv->finger_scroll, "decel-rate", &decel, NULL);
return decel;
}
@@ -2978,8 +2940,7 @@ champlain_view_get_scroll_mode (ChamplainView *view)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), CHAMPLAIN_SCROLL_MODE_PUSH);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
- return priv->scroll_mode;
+ return view->priv->scroll_mode;
}
/**
@@ -2995,8 +2956,7 @@ champlain_view_get_keep_center_on_resize (ChamplainView *view)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
- return priv->keep_center_on_resize;
+ return view->priv->keep_center_on_resize;
}
/**
@@ -3012,8 +2972,7 @@ champlain_view_get_show_license (ChamplainView *view)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
- return priv->show_license;
+ return view->priv->show_license;
}
/**
@@ -3029,8 +2988,7 @@ champlain_view_get_license_text (ChamplainView *view)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
- return priv->license_text;
+ return view->priv->license_text;
}
@@ -3047,8 +3005,7 @@ champlain_view_get_show_scale (ChamplainView *view)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
- return priv->show_scale;
+ return view->priv->show_scale;
}
/**
@@ -3064,8 +3021,7 @@ champlain_view_get_max_scale_width (ChamplainView *view)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
- return priv->max_scale_width;
+ return view->priv->max_scale_width;
}
/**
@@ -3081,8 +3037,7 @@ champlain_view_get_scale_unit (ChamplainView *view)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
- return priv->scale_unit;
+ return view->priv->scale_unit;
}
/**
@@ -3098,14 +3053,13 @@ champlain_view_get_zoom_on_double_click (ChamplainView *view)
{
g_return_val_if_fail (CHAMPLAIN_IS_VIEW (view), FALSE);
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
- return priv->zoom_on_double_click;
+ return view->priv->zoom_on_double_click;
}
static void
view_update_polygons (ChamplainView *view)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
ClutterGroup *polygon_layer_group = CLUTTER_GROUP (priv->polygon_layer);
guint polygon_num, i;
gfloat x, y;
@@ -3147,7 +3101,7 @@ champlain_view_add_polygon (ChamplainView *view,
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
g_signal_connect (polygon, "notify",
G_CALLBACK (notify_polygon_cb), view);
@@ -3177,9 +3131,7 @@ champlain_view_remove_polygon (ChamplainView *view,
g_return_if_fail (CHAMPLAIN_IS_VIEW (view));
g_return_if_fail (CHAMPLAIN_IS_POLYGON (polygon));
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
-
- clutter_container_remove_actor (CLUTTER_CONTAINER (priv->polygon_layer),
+ 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 d00789c..f0f5348 100644
--- a/champlain/champlain-view.h
+++ b/champlain/champlain-view.h
@@ -59,6 +59,8 @@ typedef enum {
struct _ChamplainView
{
ClutterGroup group;
+
+ ChamplainViewPrivate *priv;
};
struct _ChamplainViewClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]