[libchamplain] Use G_ADD_PRIVATE() and friends instead of g_type_class_add_private()
- From: Jiří Techet <jiritechet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libchamplain] Use G_ADD_PRIVATE() and friends instead of g_type_class_add_private()
- Date: Wed, 6 Feb 2019 13:36:56 +0000 (UTC)
commit 41390efe9791534cc56d28a48e5ba27bf0fe949c
Author: Jiří Techet <techet gmail com>
Date: Tue Feb 5 23:56:43 2019 +0100
Use G_ADD_PRIVATE() and friends instead of g_type_class_add_private()
README | 3 +-
champlain-gtk/gtk-champlain-embed.c | 9 +---
champlain/champlain-adjustment.c | 11 ++---
champlain/champlain-coordinate.c | 14 ++----
champlain/champlain-custom-marker.c | 18 +------
champlain/champlain-error-tile-renderer.c | 11 ++---
champlain/champlain-file-cache.c | 26 +++++-----
champlain/champlain-image-renderer.c | 17 +++----
champlain/champlain-kinetic-scroll-view.c | 28 +++++------
champlain/champlain-label.c | 11 ++---
champlain/champlain-license.c | 9 +---
champlain/champlain-map-source-chain.c | 11 ++---
champlain/champlain-map-source-desc.c | 9 +---
champlain/champlain-map-source-factory.c | 12 ++---
champlain/champlain-map-source.c | 19 +++-----
champlain/champlain-marker-layer.c | 25 ++++------
champlain/champlain-marker.c | 14 ++----
champlain/champlain-memory-cache.c | 21 ++++----
champlain/champlain-memphis-renderer.c | 13 ++---
champlain/champlain-network-bbox-tile-source.c | 23 ++++-----
champlain/champlain-network-tile-source.c | 21 ++++----
champlain/champlain-path-layer.c | 66 ++++++++++++--------------
champlain/champlain-point.c | 12 ++---
champlain/champlain-scale.c | 11 +----
champlain/champlain-tile-cache.c | 3 --
champlain/champlain-tile-source.c | 33 ++++++-------
champlain/champlain-tile.c | 44 ++++++++---------
champlain/champlain-view.c | 21 +++-----
champlain/champlain-viewport.c | 11 ++---
configure.ac | 2 +-
meson.build | 4 +-
31 files changed, 192 insertions(+), 340 deletions(-)
---
diff --git a/README b/README
index ae00736..4b1666c 100644
--- a/README
+++ b/README
@@ -6,8 +6,7 @@ interactive maps.
libchamplain requires:
- * glib >= 2.10
- * gio >= 2.16
+ * glib >= 2.38
* gdk >= 3.0
* clutter >= 1.24
* cairo >= 1.4
diff --git a/champlain-gtk/gtk-champlain-embed.c b/champlain-gtk/gtk-champlain-embed.c
index f2eab19..fa2b76e 100644
--- a/champlain-gtk/gtk-champlain-embed.c
+++ b/champlain-gtk/gtk-champlain-embed.c
@@ -53,9 +53,6 @@ enum
/* static guint gtk_champlain_embed_embed_signals[LAST_SIGNAL] = { 0, }; */
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_CHAMPLAIN_TYPE_EMBED, GtkChamplainEmbedPrivate))
-
struct _GtkChamplainEmbedPrivate
{
GtkWidget *clutter_embed;
@@ -98,7 +95,7 @@ static gboolean stage_key_press_cb (ClutterActor *actor,
ClutterEvent *event,
GtkChamplainEmbed *embed);
-G_DEFINE_TYPE (GtkChamplainEmbed, gtk_champlain_embed, GTK_TYPE_ALIGNMENT);
+G_DEFINE_TYPE_WITH_PRIVATE (GtkChamplainEmbed, gtk_champlain_embed, GTK_TYPE_ALIGNMENT)
static void
gtk_champlain_embed_get_property (GObject *object,
@@ -175,8 +172,6 @@ gtk_champlain_embed_finalize (GObject *object)
static void
gtk_champlain_embed_class_init (GtkChamplainEmbedClass *klass)
{
- g_type_class_add_private (klass, sizeof (GtkChamplainEmbedPrivate));
-
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gtk_champlain_embed_finalize;
object_class->dispose = gtk_champlain_embed_dispose;
@@ -222,7 +217,7 @@ set_view (GtkChamplainEmbed *embed,
static void
gtk_champlain_embed_init (GtkChamplainEmbed *embed)
{
- GtkChamplainEmbedPrivate *priv = GET_PRIVATE (embed);
+ GtkChamplainEmbedPrivate *priv = gtk_champlain_embed_get_instance_private (embed);
ClutterActor *stage;
GdkDisplay *display;
diff --git a/champlain/champlain-adjustment.c b/champlain/champlain-adjustment.c
index 1dcf777..0105529 100644
--- a/champlain/champlain-adjustment.c
+++ b/champlain/champlain-adjustment.c
@@ -29,11 +29,6 @@
#include "champlain-marshal.h"
#include "champlain-private.h"
-G_DEFINE_TYPE (ChamplainAdjustment, champlain_adjustment, G_TYPE_OBJECT)
-
-#define ADJUSTMENT_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_ADJUSTMENT, ChamplainAdjustmentPrivate))
-
struct _ChamplainAdjustmentPrivate
{
gdouble lower;
@@ -48,6 +43,8 @@ struct _ChamplainAdjustmentPrivate
gdouble new_position;
};
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainAdjustment, champlain_adjustment, G_TYPE_OBJECT)
+
enum
{
PROP_0,
@@ -175,8 +172,6 @@ champlain_adjustment_class_init (ChamplainAdjustmentClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainAdjustmentPrivate));
-
object_class->get_property = champlain_adjustment_get_property;
object_class->set_property = champlain_adjustment_set_property;
object_class->dispose = champlain_adjustment_dispose;
@@ -232,7 +227,7 @@ champlain_adjustment_class_init (ChamplainAdjustmentClass *klass)
static void
champlain_adjustment_init (ChamplainAdjustment *self)
{
- self->priv = ADJUSTMENT_PRIVATE (self);
+ self->priv = champlain_adjustment_get_instance_private (self);
}
diff --git a/champlain/champlain-coordinate.c b/champlain/champlain-coordinate.c
index c968ca7..4e419c8 100644
--- a/champlain/champlain-coordinate.c
+++ b/champlain/champlain-coordinate.c
@@ -46,18 +46,16 @@ static gdouble get_longitude (ChamplainLocation *location);
static void location_interface_init (ChamplainLocationIface *iface);
-G_DEFINE_TYPE_WITH_CODE (ChamplainCoordinate, champlain_coordinate, G_TYPE_INITIALLY_UNOWNED,
- G_IMPLEMENT_INTERFACE (CHAMPLAIN_TYPE_LOCATION, location_interface_init));
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_COORDINATE, ChamplainCoordinatePrivate))
-
struct _ChamplainCoordinatePrivate
{
gdouble longitude;
gdouble latitude;
};
+G_DEFINE_TYPE_WITH_CODE (ChamplainCoordinate, champlain_coordinate, G_TYPE_INITIALLY_UNOWNED,
+ G_ADD_PRIVATE (ChamplainCoordinate)
+ G_IMPLEMENT_INTERFACE (CHAMPLAIN_TYPE_LOCATION, location_interface_init))
+
static void
champlain_coordinate_get_property (GObject *object,
guint prop_id,
@@ -179,8 +177,6 @@ champlain_coordinate_finalize (GObject *object)
static void
champlain_coordinate_class_init (ChamplainCoordinateClass *coordinate_class)
{
- g_type_class_add_private (coordinate_class, sizeof (ChamplainCoordinatePrivate));
-
GObjectClass *object_class = G_OBJECT_CLASS (coordinate_class);
object_class->finalize = champlain_coordinate_finalize;
object_class->dispose = champlain_coordinate_dispose;
@@ -200,7 +196,7 @@ champlain_coordinate_class_init (ChamplainCoordinateClass *coordinate_class)
static void
champlain_coordinate_init (ChamplainCoordinate *coordinate)
{
- ChamplainCoordinatePrivate *priv = GET_PRIVATE (coordinate);
+ ChamplainCoordinatePrivate *priv = champlain_coordinate_get_instance_private (coordinate);
coordinate->priv = priv;
diff --git a/champlain/champlain-custom-marker.c b/champlain/champlain-custom-marker.c
index 99943f9..d5afb5f 100644
--- a/champlain/champlain-custom-marker.c
+++ b/champlain/champlain-custom-marker.c
@@ -37,33 +37,17 @@
#include <glib.h>
#include <glib-object.h>
-
-enum
-{
- /* normal signals */
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0,
-};
-
struct _ChamplainCustomMarkerPrivate
{
ClutterContainer *dummy;
};
-G_DEFINE_TYPE (ChamplainCustomMarker, champlain_custom_marker, CHAMPLAIN_TYPE_MARKER)
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_CUSTOM_MARKER, ChamplainCustomMarkerPrivate))
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainCustomMarker, champlain_custom_marker, CHAMPLAIN_TYPE_MARKER)
static void
champlain_custom_marker_class_init (ChamplainCustomMarkerClass *klass)
{
- g_type_class_add_private (klass, sizeof (ChamplainCustomMarkerPrivate));
}
diff --git a/champlain/champlain-error-tile-renderer.c b/champlain/champlain-error-tile-renderer.c
index b70d38d..2b74730 100644
--- a/champlain/champlain-error-tile-renderer.c
+++ b/champlain/champlain-error-tile-renderer.c
@@ -27,17 +27,14 @@
#include "champlain-error-tile-renderer.h"
#include <gdk/gdk.h>
-G_DEFINE_TYPE (ChamplainErrorTileRenderer, champlain_error_tile_renderer, CHAMPLAIN_TYPE_RENDERER)
-
-#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_ERROR_TILE_RENDERER, ChamplainErrorTileRendererPrivate))
-
struct _ChamplainErrorTileRendererPrivate
{
ClutterContent *error_canvas;
guint tile_size;
};
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainErrorTileRenderer, champlain_error_tile_renderer,
CHAMPLAIN_TYPE_RENDERER)
+
enum
{
PROP_0,
@@ -120,8 +117,6 @@ champlain_error_tile_renderer_class_init (ChamplainErrorTileRendererClass *klass
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ChamplainRendererClass *renderer_class = CHAMPLAIN_RENDERER_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainErrorTileRendererPrivate));
-
object_class->get_property = champlain_error_tile_renderer_get_property;
object_class->set_property = champlain_error_tile_renderer_set_property;
object_class->finalize = champlain_error_tile_renderer_finalize;
@@ -152,7 +147,7 @@ champlain_error_tile_renderer_class_init (ChamplainErrorTileRendererClass *klass
static void
champlain_error_tile_renderer_init (ChamplainErrorTileRenderer *self)
{
- ChamplainErrorTileRendererPrivate *priv = GET_PRIVATE (self);
+ ChamplainErrorTileRendererPrivate *priv = champlain_error_tile_renderer_get_instance_private (self);
self->priv = priv;
diff --git a/champlain/champlain-file-cache.c b/champlain/champlain-file-cache.c
index 6e7ff27..c1322f4 100644
--- a/champlain/champlain-file-cache.c
+++ b/champlain/champlain-file-cache.c
@@ -38,18 +38,6 @@
#include <string.h>
#include <stdlib.h>
-G_DEFINE_TYPE (ChamplainFileCache, champlain_file_cache, CHAMPLAIN_TYPE_TILE_CACHE);
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_FILE_CACHE, ChamplainFileCachePrivate))
-
-enum
-{
- PROP_0,
- PROP_SIZE_LIMIT,
- PROP_CACHE_DIR
-};
-
struct _ChamplainFileCachePrivate
{
guint size_limit;
@@ -60,6 +48,16 @@ struct _ChamplainFileCachePrivate
sqlite3_stmt *stmt_update;
};
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainFileCache, champlain_file_cache, CHAMPLAIN_TYPE_TILE_CACHE)
+
+enum
+{
+ PROP_0,
+ PROP_SIZE_LIMIT,
+ PROP_CACHE_DIR
+};
+
+
static void finalize_sql (ChamplainFileCache *file_cache);
static void init_cache (ChamplainFileCache *file_cache);
static gchar *get_filename (ChamplainFileCache *file_cache,
@@ -300,8 +298,6 @@ champlain_file_cache_class_init (ChamplainFileCacheClass *klass)
GParamSpec *pspec;
gchar *cache_dir = NULL;
- g_type_class_add_private (klass, sizeof (ChamplainFileCachePrivate));
-
object_class->finalize = champlain_file_cache_finalize;
object_class->dispose = champlain_file_cache_dispose;
object_class->get_property = champlain_file_cache_get_property;
@@ -351,7 +347,7 @@ champlain_file_cache_class_init (ChamplainFileCacheClass *klass)
static void
champlain_file_cache_init (ChamplainFileCache *file_cache)
{
- ChamplainFileCachePrivate *priv = GET_PRIVATE (file_cache);
+ ChamplainFileCachePrivate *priv = champlain_file_cache_get_instance_private (file_cache);
file_cache->priv = priv;
diff --git a/champlain/champlain-image-renderer.c b/champlain/champlain-image-renderer.c
index 9a59dce..e0d9f65 100644
--- a/champlain/champlain-image-renderer.c
+++ b/champlain/champlain-image-renderer.c
@@ -28,17 +28,14 @@
#include "champlain-image-renderer.h"
#include <gdk/gdk.h>
-G_DEFINE_TYPE (ChamplainImageRenderer, champlain_image_renderer, CHAMPLAIN_TYPE_RENDERER)
-
-#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_IMAGE_RENDERER, ChamplainImageRendererPrivate))
-
struct _ChamplainImageRendererPrivate
{
gchar *data;
guint size;
};
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainImageRenderer, champlain_image_renderer, CHAMPLAIN_TYPE_RENDERER)
+
typedef struct _RendererData RendererData;
struct _RendererData
@@ -66,7 +63,7 @@ champlain_image_renderer_dispose (GObject *object)
static void
champlain_image_renderer_finalize (GObject *object)
{
- ChamplainImageRendererPrivate *priv = GET_PRIVATE (object);
+ ChamplainImageRendererPrivate *priv = CHAMPLAIN_IMAGE_RENDERER (object)->priv;
g_free (priv->data);
@@ -80,8 +77,6 @@ champlain_image_renderer_class_init (ChamplainImageRendererClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ChamplainRendererClass *renderer_class = CHAMPLAIN_RENDERER_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainImageRendererPrivate));
-
object_class->finalize = champlain_image_renderer_finalize;
object_class->dispose = champlain_image_renderer_dispose;
@@ -93,7 +88,7 @@ champlain_image_renderer_class_init (ChamplainImageRendererClass *klass)
static void
champlain_image_renderer_init (ChamplainImageRenderer *self)
{
- ChamplainImageRendererPrivate *priv = GET_PRIVATE (self);
+ ChamplainImageRendererPrivate *priv = champlain_image_renderer_get_instance_private (self);
self->priv = priv;
@@ -120,7 +115,7 @@ champlain_image_renderer_new (void)
static void
set_data (ChamplainRenderer *renderer, const guint8 *data, guint size)
{
- ChamplainImageRendererPrivate *priv = GET_PRIVATE (renderer);
+ ChamplainImageRendererPrivate *priv = CHAMPLAIN_IMAGE_RENDERER (renderer)->priv;
if (priv->data)
g_free (priv->data);
@@ -228,7 +223,7 @@ finish:
static void
render (ChamplainRenderer *renderer, ChamplainTile *tile)
{
- ChamplainImageRendererPrivate *priv = GET_PRIVATE (renderer);
+ ChamplainImageRendererPrivate *priv = CHAMPLAIN_IMAGE_RENDERER (renderer)->priv;
GInputStream *stream;
if (!priv->data || priv->size == 0)
diff --git a/champlain/champlain-kinetic-scroll-view.c b/champlain/champlain-kinetic-scroll-view.c
index 79bccb1..1f0ddac 100644
--- a/champlain/champlain-kinetic-scroll-view.c
+++ b/champlain/champlain-kinetic-scroll-view.c
@@ -29,19 +29,6 @@
#include <clutter/clutter.h>
#include <math.h>
-G_DEFINE_TYPE (ChamplainKineticScrollView, champlain_kinetic_scroll_view, CLUTTER_TYPE_ACTOR)
-
-#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_KINETIC_SCROLL_VIEW, ChamplainKineticScrollViewPrivate))
-
-typedef struct
-{
- /* Units to store the origin of a click when scrolling */
- gfloat x;
- gfloat y;
- GTimeVal time;
-} ChamplainKineticScrollViewMotion;
-
struct _ChamplainKineticScrollViewPrivate
{
/* Scroll mode */
@@ -60,6 +47,16 @@ struct _ChamplainKineticScrollViewPrivate
ClutterEventSequence *sequence;
};
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainKineticScrollView, champlain_kinetic_scroll_view, CLUTTER_TYPE_ACTOR)
+
+typedef struct
+{
+ /* Units to store the origin of a click when scrolling */
+ gfloat x;
+ gfloat y;
+ GTimeVal time;
+} ChamplainKineticScrollViewMotion;
+
enum
{
PROP_MODE = 1,
@@ -174,8 +171,6 @@ champlain_kinetic_scroll_view_class_init (ChamplainKineticScrollViewClass *klass
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainKineticScrollViewPrivate));
-
object_class->get_property = champlain_kinetic_scroll_view_get_property;
object_class->set_property = champlain_kinetic_scroll_view_set_property;
object_class->dispose = champlain_kinetic_scroll_view_dispose;
@@ -662,8 +657,9 @@ button_press_event_cb (ClutterActor *actor,
static void
champlain_kinetic_scroll_view_init (ChamplainKineticScrollView *self)
{
- ChamplainKineticScrollViewPrivate *priv = self->priv = GET_PRIVATE (self);
+ ChamplainKineticScrollViewPrivate *priv = champlain_kinetic_scroll_view_get_instance_private (self);
+ self->priv = priv;
priv->motion_buffer = g_array_sized_new (FALSE, TRUE,
sizeof (ChamplainKineticScrollViewMotion), 3);
g_array_set_size (priv->motion_buffer, 3);
diff --git a/champlain/champlain-label.c b/champlain/champlain-label.c
index 4deeb75..1947fe4 100644
--- a/champlain/champlain-label.c
+++ b/champlain/champlain-label.c
@@ -108,10 +108,7 @@ struct _ChamplainLabelPrivate
gint point;
};
-G_DEFINE_TYPE (ChamplainLabel, champlain_label, CHAMPLAIN_TYPE_MARKER);
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_LABEL, ChamplainLabelPrivate))
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainLabel, champlain_label, CHAMPLAIN_TYPE_MARKER)
static void draw_label (ChamplainLabel *label);
@@ -259,7 +256,7 @@ static void
pick (ClutterActor *self,
const ClutterColor *color)
{
- ChamplainLabelPrivate *priv = GET_PRIVATE (self);
+ ChamplainLabelPrivate *priv = CHAMPLAIN_LABEL (self)->priv;
gfloat width, height;
if (!clutter_actor_should_pick_paint (self))
@@ -355,8 +352,6 @@ champlain_label_class_init (ChamplainLabelClass *klass)
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainLabelPrivate));
-
object_class->finalize = champlain_label_finalize;
object_class->dispose = champlain_label_dispose;
object_class->get_property = champlain_label_get_property;
@@ -847,7 +842,7 @@ notify_selected (GObject *gobject,
static void
champlain_label_init (ChamplainLabel *label)
{
- ChamplainLabelPrivate *priv = GET_PRIVATE (label);
+ ChamplainLabelPrivate *priv = champlain_label_get_instance_private (label);
label->priv = priv;
diff --git a/champlain/champlain-license.c b/champlain/champlain-license.c
index eb81f03..6b35a80 100644
--- a/champlain/champlain-license.c
+++ b/champlain/champlain-license.c
@@ -64,10 +64,7 @@ struct _ChamplainLicensePrivate
ChamplainView *view;
};
-G_DEFINE_TYPE (ChamplainLicense, champlain_license, CLUTTER_TYPE_ACTOR);
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_LICENSE, ChamplainLicensePrivate))
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainLicense, champlain_license, CLUTTER_TYPE_ACTOR)
#define WIDTH_PADDING 10
#define HEIGHT_PADDING 7
@@ -215,8 +212,6 @@ champlain_license_class_init (ChamplainLicenseClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainLicensePrivate));
-
object_class->finalize = champlain_license_finalize;
object_class->dispose = champlain_license_dispose;
object_class->get_property = champlain_license_get_property;
@@ -260,7 +255,7 @@ champlain_license_class_init (ChamplainLicenseClass *klass)
static void
champlain_license_init (ChamplainLicense *license)
{
- ChamplainLicensePrivate *priv = GET_PRIVATE (license);
+ ChamplainLicensePrivate *priv = champlain_license_get_instance_private (license);
license->priv = priv;
priv->extra_text = NULL;
diff --git a/champlain/champlain-map-source-chain.c b/champlain/champlain-map-source-chain.c
index ca408b7..333d0cc 100644
--- a/champlain/champlain-map-source-chain.c
+++ b/champlain/champlain-map-source-chain.c
@@ -34,17 +34,14 @@
#include "champlain-tile-cache.h"
#include "champlain-tile-source.h"
-G_DEFINE_TYPE (ChamplainMapSourceChain, champlain_map_source_chain, CHAMPLAIN_TYPE_MAP_SOURCE);
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_MAP_SOURCE_CHAIN, ChamplainMapSourceChainPrivate))
-
struct _ChamplainMapSourceChainPrivate
{
ChamplainMapSource *stack_top;
ChamplainMapSource *stack_bottom;
};
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainMapSourceChain, champlain_map_source_chain, CHAMPLAIN_TYPE_MAP_SOURCE)
+
static const gchar *get_id (ChamplainMapSource *map_source);
static const gchar *get_name (ChamplainMapSource *map_source);
static const gchar *get_license (ChamplainMapSource *map_source);
@@ -83,8 +80,6 @@ champlain_map_source_chain_class_init (ChamplainMapSourceChainClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainMapSourceChainPrivate));
-
object_class->finalize = champlain_map_source_chain_finalize;
object_class->dispose = champlain_map_source_chain_dispose;
@@ -105,7 +100,7 @@ champlain_map_source_chain_class_init (ChamplainMapSourceChainClass *klass)
static void
champlain_map_source_chain_init (ChamplainMapSourceChain *source_chain)
{
- ChamplainMapSourceChainPrivate *priv = GET_PRIVATE (source_chain);
+ ChamplainMapSourceChainPrivate *priv = champlain_map_source_chain_get_instance_private (source_chain);
source_chain->priv = priv;
diff --git a/champlain/champlain-map-source-desc.c b/champlain/champlain-map-source-desc.c
index a286758..95a3066 100644
--- a/champlain/champlain-map-source-desc.c
+++ b/champlain/champlain-map-source-desc.c
@@ -59,10 +59,7 @@ struct _ChamplainMapSourceDescPrivate
gpointer data;
};
-G_DEFINE_TYPE (ChamplainMapSourceDesc, champlain_map_source_desc, G_TYPE_OBJECT);
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_MAP_SOURCE_DESC, ChamplainMapSourceDescPrivate))
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainMapSourceDesc, champlain_map_source_desc, G_TYPE_OBJECT)
static void set_id (ChamplainMapSourceDesc *desc,
@@ -237,8 +234,6 @@ champlain_map_source_desc_class_init (ChamplainMapSourceDescClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainMapSourceDescPrivate));
-
object_class->finalize = champlain_map_source_desc_finalize;
object_class->dispose = champlain_map_source_desc_dispose;
object_class->get_property = champlain_map_source_desc_get_property;
@@ -419,7 +414,7 @@ champlain_map_source_desc_class_init (ChamplainMapSourceDescClass *klass)
static void
champlain_map_source_desc_init (ChamplainMapSourceDesc *desc)
{
- ChamplainMapSourceDescPrivate *priv = GET_PRIVATE (desc);
+ ChamplainMapSourceDescPrivate *priv = champlain_map_source_desc_get_instance_private (desc);
desc->priv = priv;
diff --git a/champlain/champlain-map-source-factory.c b/champlain/champlain-map-source-factory.c
index 48825a9..2580c2c 100644
--- a/champlain/champlain-map-source-factory.c
+++ b/champlain/champlain-map-source-factory.c
@@ -72,16 +72,14 @@ enum
/* static guint champlain_map_source_factory_signals[LAST_SIGNAL] = { 0, }; */
static ChamplainMapSourceFactory *instance = NULL;
-G_DEFINE_TYPE (ChamplainMapSourceFactory, champlain_map_source_factory, G_TYPE_OBJECT);
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_MAP_SOURCE_FACTORY, ChamplainMapSourceFactoryPrivate))
-
struct _ChamplainMapSourceFactoryPrivate
{
GSList *registered_sources;
};
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainMapSourceFactory, champlain_map_source_factory, G_TYPE_OBJECT)
+
+
static ChamplainMapSource *champlain_map_source_new_generic (
ChamplainMapSourceDesc *desc);
@@ -129,8 +127,6 @@ champlain_map_source_factory_constructor (GType type,
static void
champlain_map_source_factory_class_init (ChamplainMapSourceFactoryClass *klass)
{
- g_type_class_add_private (klass, sizeof (ChamplainMapSourceFactoryPrivate));
-
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructor = champlain_map_source_factory_constructor;
@@ -141,7 +137,7 @@ champlain_map_source_factory_class_init (ChamplainMapSourceFactoryClass *klass)
static void
champlain_map_source_factory_init (ChamplainMapSourceFactory *factory)
{
- ChamplainMapSourceFactoryPrivate *priv = GET_PRIVATE (factory);
+ ChamplainMapSourceFactoryPrivate *priv = champlain_map_source_factory_get_instance_private (factory);
ChamplainMapSourceDesc *desc;
factory->priv = priv;
diff --git a/champlain/champlain-map-source.c b/champlain/champlain-map-source.c
index 2715363..3793d7c 100644
--- a/champlain/champlain-map-source.c
+++ b/champlain/champlain-map-source.c
@@ -55,10 +55,13 @@
#include <math.h>
-G_DEFINE_ABSTRACT_TYPE (ChamplainMapSource, champlain_map_source, G_TYPE_INITIALLY_UNOWNED);
+struct _ChamplainMapSourcePrivate
+{
+ ChamplainMapSource *next_source;
+ ChamplainRenderer *renderer;
+};
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_MAP_SOURCE, ChamplainMapSourcePrivate))
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ChamplainMapSource, champlain_map_source, G_TYPE_INITIALLY_UNOWNED)
enum
{
@@ -67,12 +70,6 @@ enum
PROP_RENDERER,
};
-struct _ChamplainMapSourcePrivate
-{
- ChamplainMapSource *next_source;
- ChamplainRenderer *renderer;
-};
-
static void
champlain_map_source_get_property (GObject *object,
guint prop_id,
@@ -167,8 +164,6 @@ champlain_map_source_class_init (ChamplainMapSourceClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
- g_type_class_add_private (klass, sizeof (ChamplainMapSourcePrivate));
-
object_class->finalize = champlain_map_source_finalize;
object_class->dispose = champlain_map_source_dispose;
object_class->get_property = champlain_map_source_get_property;
@@ -219,7 +214,7 @@ champlain_map_source_class_init (ChamplainMapSourceClass *klass)
static void
champlain_map_source_init (ChamplainMapSource *map_source)
{
- ChamplainMapSourcePrivate *priv = GET_PRIVATE (map_source);
+ ChamplainMapSourcePrivate *priv = champlain_map_source_get_instance_private (map_source);
map_source->priv = priv;
diff --git a/champlain/champlain-marker-layer.c b/champlain/champlain-marker-layer.c
index 5df4902..48909a4 100644
--- a/champlain/champlain-marker-layer.c
+++ b/champlain/champlain-marker-layer.c
@@ -39,11 +39,15 @@
static void exportable_interface_init (ChamplainExportableIface *iface);
-G_DEFINE_TYPE_WITH_CODE (ChamplainMarkerLayer, champlain_marker_layer, CHAMPLAIN_TYPE_LAYER,
- G_IMPLEMENT_INTERFACE (CHAMPLAIN_TYPE_EXPORTABLE, exportable_interface_init));
+struct _ChamplainMarkerLayerPrivate
+{
+ ChamplainSelectionMode mode;
+ ChamplainView *view;
+};
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_MARKER_LAYER, ChamplainMarkerLayerPrivate))
+G_DEFINE_TYPE_WITH_CODE (ChamplainMarkerLayer, champlain_marker_layer, CHAMPLAIN_TYPE_LAYER,
+ G_ADD_PRIVATE (ChamplainMarkerLayer)
+ G_IMPLEMENT_INTERFACE (CHAMPLAIN_TYPE_EXPORTABLE, exportable_interface_init))
enum
{
@@ -59,12 +63,6 @@ enum
};
-struct _ChamplainMarkerLayerPrivate
-{
- ChamplainSelectionMode mode;
- ChamplainView *view;
-};
-
static void set_surface (ChamplainExportable *exportable,
cairo_surface_t *surface);
static cairo_surface_t *get_surface (ChamplainExportable *exportable);
@@ -154,8 +152,6 @@ champlain_marker_layer_class_init (ChamplainMarkerLayerClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ChamplainLayerClass *layer_class = CHAMPLAIN_LAYER_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainMarkerLayerPrivate));
-
object_class->finalize = champlain_marker_layer_finalize;
object_class->dispose = champlain_marker_layer_dispose;
object_class->get_property = champlain_marker_layer_get_property;
@@ -189,10 +185,9 @@ champlain_marker_layer_class_init (ChamplainMarkerLayerClass *klass)
static void
champlain_marker_layer_init (ChamplainMarkerLayer *self)
{
- ChamplainMarkerLayerPrivate *priv;
+ ChamplainMarkerLayerPrivate *priv = champlain_marker_layer_get_instance_private (self);
- self->priv = GET_PRIVATE (self);
- priv = self->priv;
+ self->priv = priv;
priv->mode = CHAMPLAIN_SELECTION_NONE;
priv->view = NULL;
}
diff --git a/champlain/champlain-marker.c b/champlain/champlain-marker.c
index 861fd68..f2cd4ce 100644
--- a/champlain/champlain-marker.c
+++ b/champlain/champlain-marker.c
@@ -85,12 +85,6 @@ static gdouble get_longitude (ChamplainLocation *location);
static void location_interface_init (ChamplainLocationIface *iface);
-G_DEFINE_TYPE_WITH_CODE (ChamplainMarker, champlain_marker, CLUTTER_TYPE_ACTOR,
- G_IMPLEMENT_INTERFACE (CHAMPLAIN_TYPE_LOCATION, location_interface_init));
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_MARKER, ChamplainMarkerPrivate))
-
struct _ChamplainMarkerPrivate
{
gdouble lon;
@@ -104,6 +98,10 @@ struct _ChamplainMarkerPrivate
gboolean moved;
};
+G_DEFINE_TYPE_WITH_CODE (ChamplainMarker, champlain_marker, CLUTTER_TYPE_ACTOR,
+ G_ADD_PRIVATE (ChamplainMarker)
+ G_IMPLEMENT_INTERFACE (CHAMPLAIN_TYPE_LOCATION, location_interface_init))
+
/**
* champlain_marker_set_selection_color:
@@ -329,8 +327,6 @@ champlain_marker_finalize (GObject *object)
static void
champlain_marker_class_init (ChamplainMarkerClass *marker_class)
{
- g_type_class_add_private (marker_class, sizeof (ChamplainMarkerPrivate));
-
GObjectClass *object_class = G_OBJECT_CLASS (marker_class);
object_class->finalize = champlain_marker_finalize;
object_class->dispose = champlain_marker_dispose;
@@ -618,7 +614,7 @@ button_press_event_cb (ClutterActor *actor,
static void
champlain_marker_init (ChamplainMarker *marker)
{
- ChamplainMarkerPrivate *priv = GET_PRIVATE (marker);
+ ChamplainMarkerPrivate *priv = champlain_marker_get_instance_private (marker);
marker->priv = priv;
diff --git a/champlain/champlain-memory-cache.c b/champlain/champlain-memory-cache.c
index 754a730..4fc43ea 100644
--- a/champlain/champlain-memory-cache.c
+++ b/champlain/champlain-memory-cache.c
@@ -34,10 +34,14 @@
#include <glib.h>
#include <string.h>
-G_DEFINE_TYPE (ChamplainMemoryCache, champlain_memory_cache, CHAMPLAIN_TYPE_TILE_CACHE);
+struct _ChamplainMemoryCachePrivate
+{
+ guint size_limit;
+ GQueue *queue;
+ GHashTable *hash_table;
+};
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_MEMORY_CACHE, ChamplainMemoryCachePrivate))
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainMemoryCache, champlain_memory_cache, CHAMPLAIN_TYPE_TILE_CACHE)
enum
{
@@ -45,13 +49,6 @@ enum
PROP_SIZE_LIMIT
};
-struct _ChamplainMemoryCachePrivate
-{
- guint size_limit;
- GQueue *queue;
- GHashTable *hash_table;
-};
-
typedef struct
{
gchar *key;
@@ -141,8 +138,6 @@ champlain_memory_cache_class_init (ChamplainMemoryCacheClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
- g_type_class_add_private (klass, sizeof (ChamplainMemoryCachePrivate));
-
object_class->finalize = champlain_memory_cache_finalize;
object_class->dispose = champlain_memory_cache_dispose;
object_class->get_property = champlain_memory_cache_get_property;
@@ -201,7 +196,7 @@ champlain_memory_cache_new_full (guint size_limit,
static void
champlain_memory_cache_init (ChamplainMemoryCache *memory_cache)
{
- ChamplainMemoryCachePrivate *priv = GET_PRIVATE (memory_cache);
+ ChamplainMemoryCachePrivate *priv = champlain_memory_cache_get_instance_private (memory_cache);
memory_cache->priv = priv;
diff --git a/champlain/champlain-memphis-renderer.c b/champlain/champlain-memphis-renderer.c
index 8b95c16..e012e70 100644
--- a/champlain/champlain-memphis-renderer.c
+++ b/champlain/champlain-memphis-renderer.c
@@ -77,11 +77,6 @@ static void set_bounding_box (ChamplainMemphisRenderer *renderer,
ChamplainBoundingBox *bbox);
-G_DEFINE_TYPE (ChamplainMemphisRenderer, champlain_memphis_renderer, CHAMPLAIN_TYPE_RENDERER)
-
-#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_MEMPHIS_RENDERER, ChamplainMemphisRendererPrivate))
-
struct _ChamplainMemphisRendererPrivate
{
MemphisRuleSet *rules;
@@ -91,6 +86,8 @@ struct _ChamplainMemphisRendererPrivate
ChamplainBoundingBox *bbox;
};
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainMemphisRenderer, champlain_memphis_renderer, CHAMPLAIN_TYPE_RENDERER)
+
typedef struct _WorkerThreadData WorkerThreadData;
struct _WorkerThreadData
@@ -212,8 +209,6 @@ champlain_memphis_renderer_class_init (ChamplainMemphisRendererClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ChamplainRendererClass *renderer_class = CHAMPLAIN_RENDERER_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainMemphisRendererPrivate));
-
object_class->get_property = champlain_memphis_renderer_get_property;
object_class->set_property = champlain_memphis_renderer_set_property;
object_class->dispose = champlain_memphis_renderer_dispose;
@@ -252,7 +247,7 @@ champlain_memphis_renderer_class_init (ChamplainMemphisRendererClass *klass)
static void
champlain_memphis_renderer_init (ChamplainMemphisRenderer *renderer)
{
- ChamplainMemphisRendererPrivate *priv = GET_PRIVATE (renderer);
+ ChamplainMemphisRendererPrivate *priv = champlain_memphis_renderer_get_instance_private (renderer);
renderer->priv = priv;
@@ -462,7 +457,7 @@ set_data (ChamplainRenderer *renderer,
const guint8 *data,
guint size)
{
- ChamplainMemphisRendererPrivate *priv = GET_PRIVATE (renderer);
+ ChamplainMemphisRendererPrivate *priv = CHAMPLAIN_MEMPHIS_RENDERER (renderer)->priv;
ChamplainBoundingBox *bbox;
GError *err = NULL;
diff --git a/champlain/champlain-network-bbox-tile-source.c b/champlain/champlain-network-bbox-tile-source.c
index 7726cf3..c2670f0 100644
--- a/champlain/champlain-network-bbox-tile-source.c
+++ b/champlain/champlain-network-bbox-tile-source.c
@@ -40,10 +40,15 @@
#include <libsoup/soup.h>
-G_DEFINE_TYPE (ChamplainNetworkBboxTileSource, champlain_network_bbox_tile_source,
CHAMPLAIN_TYPE_TILE_SOURCE)
+struct _ChamplainNetworkBboxTileSourcePrivate
+{
+ gchar *api_uri;
+ gchar *proxy_uri;
+ SoupSession *soup_session;
+ ChamplainState state;
+};
-#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_NETWORK_BBOX_TILE_SOURCE,
ChamplainNetworkBboxTileSourcePrivate))
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainNetworkBboxTileSource, champlain_network_bbox_tile_source,
CHAMPLAIN_TYPE_TILE_SOURCE)
enum
{
@@ -54,14 +59,6 @@ enum
PROP_USER_AGENT
};
-struct _ChamplainNetworkBboxTileSourcePrivate
-{
- gchar *api_uri;
- gchar *proxy_uri;
- SoupSession *soup_session;
- ChamplainState state;
-};
-
static void fill_tile (ChamplainMapSource *map_source,
ChamplainTile *tile);
@@ -175,8 +172,6 @@ champlain_network_bbox_tile_source_class_init (ChamplainNetworkBboxTileSourceCla
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainNetworkBboxTileSourcePrivate));
-
object_class->get_property = champlain_network_bbox_tile_source_get_property;
object_class->set_property = champlain_network_bbox_tile_source_set_property;
object_class->dispose = champlain_network_bbox_tile_source_dispose;
@@ -252,7 +247,7 @@ champlain_network_bbox_tile_source_class_init (ChamplainNetworkBboxTileSourceCla
static void
champlain_network_bbox_tile_source_init (ChamplainNetworkBboxTileSource *self)
{
- ChamplainNetworkBboxTileSourcePrivate *priv = GET_PRIVATE (self);
+ ChamplainNetworkBboxTileSourcePrivate *priv = champlain_network_bbox_tile_source_get_instance_private
(self);
self->priv = priv;
diff --git a/champlain/champlain-network-tile-source.c b/champlain/champlain-network-tile-source.c
index b3d35d0..acb4794 100644
--- a/champlain/champlain-network-tile-source.c
+++ b/champlain/champlain-network-tile-source.c
@@ -66,16 +66,6 @@ enum
PROP_USER_AGENT
};
-G_DEFINE_TYPE (ChamplainNetworkTileSource, champlain_network_tile_source, CHAMPLAIN_TYPE_TILE_SOURCE);
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_NETWORK_TILE_SOURCE,
ChamplainNetworkTileSourcePrivate))
-
-/* The osm.org tile set require us to use no more than 2 simultaneous
- * connections so let that be the default.
- */
-#define MAX_CONNS_DEFAULT 2
-
struct _ChamplainNetworkTileSourcePrivate
{
gboolean offline;
@@ -85,6 +75,13 @@ struct _ChamplainNetworkTileSourcePrivate
gint max_conns;
};
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainNetworkTileSource, champlain_network_tile_source,
CHAMPLAIN_TYPE_TILE_SOURCE)
+
+/* The osm.org tile set require us to use no more than 2 simultaneous
+ * connections so let that be the default.
+ */
+#define MAX_CONNS_DEFAULT 2
+
typedef struct
{
ChamplainMapSource *map_source;
@@ -226,8 +223,6 @@ champlain_network_tile_source_class_init (ChamplainNetworkTileSourceClass *klass
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
- g_type_class_add_private (klass, sizeof (ChamplainNetworkTileSourcePrivate));
-
object_class->finalize = champlain_network_tile_source_finalize;
object_class->dispose = champlain_network_tile_source_dispose;
object_class->get_property = champlain_network_tile_source_get_property;
@@ -320,7 +315,7 @@ champlain_network_tile_source_class_init (ChamplainNetworkTileSourceClass *klass
static void
champlain_network_tile_source_init (ChamplainNetworkTileSource *tile_source)
{
- ChamplainNetworkTileSourcePrivate *priv = GET_PRIVATE (tile_source);
+ ChamplainNetworkTileSourcePrivate *priv = champlain_network_tile_source_get_instance_private (tile_source);
tile_source->priv = priv;
diff --git a/champlain/champlain-path-layer.c b/champlain/champlain-path-layer.c
index 7b2baa8..321c230 100644
--- a/champlain/champlain-path-layer.c
+++ b/champlain/champlain-path-layer.c
@@ -43,36 +43,6 @@
static void exportable_interface_init (ChamplainExportableIface *iface);
-G_DEFINE_TYPE_WITH_CODE (ChamplainPathLayer, champlain_path_layer, CHAMPLAIN_TYPE_LAYER,
- G_IMPLEMENT_INTERFACE (CHAMPLAIN_TYPE_EXPORTABLE, exportable_interface_init));
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_PATH_LAYER, ChamplainPathLayerPrivate))
-
-enum
-{
- /* normal signals */
- LAST_SIGNAL
-};
-
-enum
-{
- PROP_0,
- PROP_CLOSED_PATH,
- PROP_STROKE_WIDTH,
- PROP_STROKE_COLOR,
- PROP_FILL,
- PROP_FILL_COLOR,
- PROP_STROKE,
- PROP_VISIBLE,
- PROP_SURFACE,
-};
-
-static ClutterColor DEFAULT_FILL_COLOR = { 0xcc, 0x00, 0x00, 0xaa };
-static ClutterColor DEFAULT_STROKE_COLOR = { 0xa4, 0x00, 0x00, 0xff };
-
-/* static guint signals[LAST_SIGNAL] = { 0, }; */
-
struct _ChamplainPathLayerPrivate
{
ChamplainView *view;
@@ -120,6 +90,33 @@ struct _ChamplainPathLayerPrivate
gboolean redraw_scheduled;
};
+G_DEFINE_TYPE_WITH_CODE (ChamplainPathLayer, champlain_path_layer, CHAMPLAIN_TYPE_LAYER,
+ G_ADD_PRIVATE (ChamplainPathLayer)
+ G_IMPLEMENT_INTERFACE (CHAMPLAIN_TYPE_EXPORTABLE, exportable_interface_init))
+
+enum
+{
+ /* normal signals */
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_CLOSED_PATH,
+ PROP_STROKE_WIDTH,
+ PROP_STROKE_COLOR,
+ PROP_FILL,
+ PROP_FILL_COLOR,
+ PROP_STROKE,
+ PROP_VISIBLE,
+ PROP_SURFACE,
+};
+
+static ClutterColor DEFAULT_FILL_COLOR = { 0xcc, 0x00, 0x00, 0xaa };
+static ClutterColor DEFAULT_STROKE_COLOR = { 0xa4, 0x00, 0x00, 0xff };
+
+/* static guint signals[LAST_SIGNAL] = { 0, }; */
static void set_surface (ChamplainExportable *exportable,
cairo_surface_t *surface);
@@ -287,8 +284,6 @@ champlain_path_layer_class_init (ChamplainPathLayerClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
ChamplainLayerClass *layer_class = CHAMPLAIN_LAYER_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainPathLayerPrivate));
-
object_class->finalize = champlain_path_layer_finalize;
object_class->dispose = champlain_path_layer_dispose;
object_class->get_property = champlain_path_layer_get_property;
@@ -425,10 +420,9 @@ initialize_child_actor (ChamplainPathLayer *self,
static void
champlain_path_layer_init (ChamplainPathLayer *self)
{
- ChamplainPathLayerPrivate *priv;
+ ChamplainPathLayerPrivate *priv = champlain_path_layer_get_instance_private (self);
- self->priv = GET_PRIVATE (self);
- priv = self->priv;
+ self->priv = priv;
priv->view = NULL;
priv->visible = TRUE;
@@ -992,7 +986,7 @@ set_view (ChamplainLayer *layer,
static ChamplainBoundingBox *
get_bounding_box (ChamplainLayer *layer)
{
- ChamplainPathLayerPrivate *priv = GET_PRIVATE (layer);
+ ChamplainPathLayerPrivate *priv = CHAMPLAIN_PATH_LAYER (layer)->priv;
GList *elem;
ChamplainBoundingBox *bbox;
diff --git a/champlain/champlain-point.c b/champlain/champlain-point.c
index c878724..4ad61c6 100644
--- a/champlain/champlain-point.c
+++ b/champlain/champlain-point.c
@@ -77,10 +77,8 @@ static cairo_surface_t *get_surface (ChamplainExportable *exportable);
static void exportable_interface_init (ChamplainExportableIface *iface);
G_DEFINE_TYPE_WITH_CODE (ChamplainPoint, champlain_point, CHAMPLAIN_TYPE_MARKER,
- G_IMPLEMENT_INTERFACE (CHAMPLAIN_TYPE_EXPORTABLE, exportable_interface_init));
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_POINT, ChamplainPointPrivate))
+ G_ADD_PRIVATE (ChamplainPoint)
+ G_IMPLEMENT_INTERFACE (CHAMPLAIN_TYPE_EXPORTABLE, exportable_interface_init))
static void
@@ -143,7 +141,7 @@ static void
pick (ClutterActor *self,
const ClutterColor *color)
{
- ChamplainPointPrivate *priv = GET_PRIVATE (self);
+ ChamplainPointPrivate *priv = CHAMPLAIN_POINT (self)->priv;
gdouble radius = priv->size / 2.0;
cogl_path_new ();
@@ -198,8 +196,6 @@ champlain_point_class_init (ChamplainPointClass *klass)
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainPointPrivate));
-
object_class->finalize = champlain_point_finalize;
object_class->dispose = champlain_point_dispose;
object_class->get_property = champlain_point_get_property;
@@ -280,7 +276,7 @@ notify_selected (GObject *gobject,
static void
champlain_point_init (ChamplainPoint *point)
{
- ChamplainPointPrivate *priv = GET_PRIVATE (point);
+ ChamplainPointPrivate *priv = champlain_point_get_instance_private (point);
point->priv = priv;
diff --git a/champlain/champlain-scale.c b/champlain/champlain-scale.c
index 5f84fe4..f3b2c72 100644
--- a/champlain/champlain-scale.c
+++ b/champlain/champlain-scale.c
@@ -66,10 +66,7 @@ struct _ChamplainScalePrivate
gboolean redraw_scheduled;
};
-G_DEFINE_TYPE (ChamplainScale, champlain_scale, CLUTTER_TYPE_ACTOR);
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_SCALE, ChamplainScalePrivate))
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainScale, champlain_scale, CLUTTER_TYPE_ACTOR)
#define SCALE_HEIGHT 5
@@ -150,8 +147,6 @@ champlain_scale_dispose (GObject *object)
static void
champlain_scale_finalize (GObject *object)
{
-/* ChamplainScalePrivate *priv = CHAMPLAIN_SCALE (object)->priv; */
-
G_OBJECT_CLASS (champlain_scale_parent_class)->finalize (object);
}
@@ -161,8 +156,6 @@ champlain_scale_class_init (ChamplainScaleClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainScalePrivate));
-
object_class->finalize = champlain_scale_finalize;
object_class->dispose = champlain_scale_dispose;
object_class->get_property = champlain_scale_get_property;
@@ -406,7 +399,7 @@ create_scale (ChamplainScale *scale)
static void
champlain_scale_init (ChamplainScale *scale)
{
- ChamplainScalePrivate *priv = GET_PRIVATE (scale);
+ ChamplainScalePrivate *priv = champlain_scale_get_instance_private (scale);
scale->priv = priv;
diff --git a/champlain/champlain-tile-cache.c b/champlain/champlain-tile-cache.c
index ad2c4f1..a31f5d5 100644
--- a/champlain/champlain-tile-cache.c
+++ b/champlain/champlain-tile-cache.c
@@ -29,9 +29,6 @@
G_DEFINE_ABSTRACT_TYPE (ChamplainTileCache, champlain_tile_cache, CHAMPLAIN_TYPE_MAP_SOURCE)
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_TILE_CACHE, ChamplainTileCachePrivate))
-
static const gchar *get_id (ChamplainMapSource * map_source);
static const gchar *get_name (ChamplainMapSource *map_source);
diff --git a/champlain/champlain-tile-source.c b/champlain/champlain-tile-source.c
index d51e1d2..1f34e5b 100644
--- a/champlain/champlain-tile-source.c
+++ b/champlain/champlain-tile-source.c
@@ -28,10 +28,20 @@
#include "champlain-tile-source.h"
#include "champlain-enum-types.h"
-G_DEFINE_ABSTRACT_TYPE (ChamplainTileSource, champlain_tile_source, CHAMPLAIN_TYPE_MAP_SOURCE);
+struct _ChamplainTileSourcePrivate
+{
+ gchar *id;
+ gchar *name;
+ gchar *license;
+ gchar *license_uri;
+ guint min_zoom_level;
+ guint max_zoom_level;
+ guint tile_size;
+ ChamplainMapProjection map_projection;
+ ChamplainTileCache *cache;
+};
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_TILE_SOURCE, ChamplainTileSourcePrivate))
+G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ChamplainTileSource, champlain_tile_source, CHAMPLAIN_TYPE_MAP_SOURCE);
enum
{
@@ -47,19 +57,6 @@ enum
PROP_CACHE
};
-struct _ChamplainTileSourcePrivate
-{
- gchar *id;
- gchar *name;
- gchar *license;
- gchar *license_uri;
- guint min_zoom_level;
- guint max_zoom_level;
- guint tile_size;
- ChamplainMapProjection map_projection;
- ChamplainTileCache *cache;
-};
-
static const gchar *get_id (ChamplainMapSource *map_source);
static const gchar *get_name (ChamplainMapSource *map_source);
static const gchar *get_license (ChamplainMapSource *map_source);
@@ -225,8 +222,6 @@ champlain_tile_source_class_init (ChamplainTileSourceClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
- g_type_class_add_private (klass, sizeof (ChamplainTileSourcePrivate));
-
object_class->finalize = champlain_tile_source_finalize;
object_class->dispose = champlain_tile_source_dispose;
object_class->get_property = champlain_tile_source_get_property;
@@ -382,7 +377,7 @@ champlain_tile_source_class_init (ChamplainTileSourceClass *klass)
static void
champlain_tile_source_init (ChamplainTileSource *tile_source)
{
- ChamplainTileSourcePrivate *priv = GET_PRIVATE (tile_source);
+ ChamplainTileSourcePrivate *priv = champlain_tile_source_get_instance_private (tile_source);
tile_source->priv = priv;
diff --git a/champlain/champlain-tile.c b/champlain/champlain-tile.c
index 9ce9fd5..cace7d3 100644
--- a/champlain/champlain-tile.c
+++ b/champlain/champlain-tile.c
@@ -42,12 +42,27 @@ static void set_surface (ChamplainExportable *exportable,
static cairo_surface_t *get_surface (ChamplainExportable *exportable);
static void exportable_interface_init (ChamplainExportableIface *iface);
-G_DEFINE_TYPE_WITH_CODE (ChamplainTile, champlain_tile, CLUTTER_TYPE_ACTOR,
- G_IMPLEMENT_INTERFACE (CHAMPLAIN_TYPE_EXPORTABLE, exportable_interface_init));
+struct _ChamplainTilePrivate
+{
+ guint x; /* The x position on the map (in pixels) */
+ guint y; /* The y position on the map (in pixels) */
+ guint size; /* The tile's width and height (only support square tiles */
+ guint zoom_level; /* The tile's zoom level */
+
+ ChamplainState state; /* The tile state: loading, validation, done */
+ /* The tile actor that will be displayed after champlain_tile_display_content () */
+ ClutterActor *content_actor;
+ gboolean fade_in;
-#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_TILE, ChamplainTilePrivate))
+ GTimeVal *modified_time; /* The last modified time of the cache */
+ gchar *etag; /* The HTTP ETag sent by the server */
+ gboolean content_displayed;
+ cairo_surface_t *surface;
+};
+G_DEFINE_TYPE_WITH_CODE (ChamplainTile, champlain_tile, CLUTTER_TYPE_ACTOR,
+ G_ADD_PRIVATE (ChamplainTile)
+ G_IMPLEMENT_INTERFACE (CHAMPLAIN_TYPE_EXPORTABLE, exportable_interface_init))
enum
{
@@ -72,23 +87,6 @@ enum
static guint champlain_tile_signals[LAST_SIGNAL] = { 0, };
-struct _ChamplainTilePrivate
-{
- guint x; /* The x position on the map (in pixels) */
- guint y; /* The y position on the map (in pixels) */
- guint size; /* The tile's width and height (only support square tiles */
- guint zoom_level; /* The tile's zoom level */
-
- ChamplainState state; /* The tile state: loading, validation, done */
- /* The tile actor that will be displayed after champlain_tile_display_content () */
- ClutterActor *content_actor;
- gboolean fade_in;
-
- GTimeVal *modified_time; /* The last modified time of the cache */
- gchar *etag; /* The HTTP ETag sent by the server */
- gboolean content_displayed;
- cairo_surface_t *surface;
-};
static void
champlain_tile_get_property (GObject *object,
@@ -227,8 +225,6 @@ champlain_tile_class_init (ChamplainTileClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainTilePrivate));
-
object_class->get_property = champlain_tile_get_property;
object_class->set_property = champlain_tile_set_property;
object_class->dispose = champlain_tile_dispose;
@@ -399,7 +395,7 @@ champlain_tile_class_init (ChamplainTileClass *klass)
static void
champlain_tile_init (ChamplainTile *self)
{
- ChamplainTilePrivate *priv = GET_PRIVATE (self);
+ ChamplainTilePrivate *priv = champlain_tile_get_instance_private (self);
self->priv = priv;
diff --git a/champlain/champlain-view.c b/champlain/champlain-view.c
index e707aae..d903556 100644
--- a/champlain/champlain-view.c
+++ b/champlain/champlain-view.c
@@ -110,9 +110,6 @@ enum
#define PADDING 10
static guint signals[LAST_SIGNAL] = { 0, };
-
-#define GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CHAMPLAIN_TYPE_VIEW, ChamplainViewPrivate))
#define ZOOM_LEVEL_OUT_OF_RANGE(priv, level) \
(level < priv->min_zoom_level || \
@@ -236,7 +233,7 @@ struct _ChamplainViewPrivate
GHashTable *visible_tiles;
};
-G_DEFINE_TYPE (ChamplainView, champlain_view, CLUTTER_TYPE_ACTOR);
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainView, champlain_view, CLUTTER_TYPE_ACTOR)
static void exclusive_destroy_clone (ClutterActor *clone);
static void update_clones (ChamplainView *view);
@@ -865,8 +862,6 @@ champlain_view_finalize (GObject *object)
{
DEBUG_LOG ()
-/* ChamplainViewPrivate *priv = CHAMPLAIN_VIEW (object)->priv; */
-
G_OBJECT_CLASS (champlain_view_parent_class)->finalize (object);
}
@@ -918,8 +913,6 @@ champlain_view_class_init (ChamplainViewClass *champlainViewClass)
{
DEBUG_LOG ()
- g_type_class_add_private (champlainViewClass, sizeof (ChamplainViewPrivate));
-
GObjectClass *object_class = G_OBJECT_CLASS (champlainViewClass);
object_class->dispose = champlain_view_dispose;
object_class->finalize = champlain_view_finalize;
@@ -1307,7 +1300,7 @@ static void
view_size_changed_cb (ChamplainView *view,
G_GNUC_UNUSED GParamSpec *pspec)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gint width, height;
width = clutter_actor_get_width (CLUTTER_ACTOR (view));
@@ -1408,7 +1401,7 @@ static guint
view_find_suitable_zoom (ChamplainView *view,
gdouble factor)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
guint zoom_level = priv->initial_gesture_zoom;
while (factor > 2 && zoom_level <= priv->max_zoom_level)
@@ -1435,7 +1428,7 @@ zoom_gesture_zoom_cb (ClutterZoomAction *gesture,
gpointer user_data)
{
ChamplainView *view = user_data;
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = view->priv;
gdouble dx, dy, lat, lon;
ClutterPoint focus;
@@ -1489,7 +1482,7 @@ zoom_gesture_finish_cb (ClutterGestureAction *gesture,
G_GNUC_UNUSED ClutterActor *actor,
gpointer user_data)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (user_data);
+ ChamplainViewPrivate *priv = CHAMPLAIN_VIEW (user_data)->priv;
priv->zoom_started = FALSE;
}
@@ -1500,7 +1493,7 @@ zoom_gesture_cancel_cb (ClutterGestureAction *gesture,
G_GNUC_UNUSED ClutterActor *actor,
gpointer user_data)
{
- ChamplainViewPrivate *priv = GET_PRIVATE (user_data);
+ ChamplainViewPrivate *priv = CHAMPLAIN_VIEW (user_data)->priv;
priv->zoom_started = FALSE;
g_signal_stop_emission_by_name (gesture, "gesture-cancel");
@@ -1512,7 +1505,7 @@ champlain_view_init (ChamplainView *view)
{
DEBUG_LOG ()
- ChamplainViewPrivate *priv = GET_PRIVATE (view);
+ ChamplainViewPrivate *priv = champlain_view_get_instance_private (view);
ChamplainMapSourceFactory *factory;
ChamplainMapSource *source;
ClutterLayoutManager *layout;
diff --git a/champlain/champlain-viewport.c b/champlain/champlain-viewport.c
index 4c7f107..780df3f 100644
--- a/champlain/champlain-viewport.c
+++ b/champlain/champlain-viewport.c
@@ -28,11 +28,6 @@
#include "champlain-viewport.h"
#include "champlain-private.h"
-G_DEFINE_TYPE (ChamplainViewport, champlain_viewport, CLUTTER_TYPE_ACTOR)
-
-#define GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_VIEWPORT, ChamplainViewportPrivate))
-
struct _ChamplainViewportPrivate
{
gdouble x;
@@ -47,6 +42,8 @@ struct _ChamplainViewportPrivate
ClutterActor *child;
};
+G_DEFINE_TYPE_WITH_PRIVATE (ChamplainViewport, champlain_viewport, CLUTTER_TYPE_ACTOR)
+
enum
{
PROP_0,
@@ -187,8 +184,6 @@ champlain_viewport_class_init (ChamplainViewportClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (klass, sizeof (ChamplainViewportPrivate));
-
gobject_class->get_property = champlain_viewport_get_property;
gobject_class->set_property = champlain_viewport_set_property;
gobject_class->dispose = champlain_viewport_dispose;
@@ -378,7 +373,7 @@ champlain_viewport_get_adjustments (ChamplainViewport *viewport,
static void
champlain_viewport_init (ChamplainViewport *self)
{
- self->priv = GET_PRIVATE (self);
+ self->priv = champlain_viewport_get_instance_private (self);
self->priv->anchor_x = 0;
self->priv->anchor_y = 0;
diff --git a/configure.ac b/configure.ac
index 20ec2ca..d1ef7ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,7 +60,7 @@ AC_CHECK_LIBM
AC_SUBST(LIBM)
PKG_CHECK_MODULES(DEPS,
- [ glib-2.0 >= 2.16
+ [ glib-2.0 >= 2.38
gobject-2.0 >= 2.10
gdk-3.0 >= 2.90
clutter-1.0 >= 1.24
diff --git a/meson.build b/meson.build
index 730e8d2..bd4cf45 100644
--- a/meson.build
+++ b/meson.build
@@ -55,14 +55,14 @@ cc = meson.get_compiler('c')
libm_dep = cc.find_library('m', required: true)
-glib_req = '>= 2.16.0'
+glib_req = '>= 2.38.0'
gtk_req = '>= 2.90.0'
clutter_req = '>= 1.24'
clutter_gtk_req = '>= 0.90'
cairo_req = '>= 1.4'
sqlite_req = '>= 3.0'
libsoup_req = '>= 2.42'
-memphis_req = '>=0.2.1'
+memphis_req = '>= 0.2.1'
introspection_req = '>= 0.6.3'
vala_req = '>= 0.11.0'
gtk_doc_req = '>= 1.9'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]