Commit 41390efe authored by Jiří Techet's avatar Jiří Techet

Use G_ADD_PRIVATE() and friends instead of g_type_class_add_private()

parent e8cbcfa4
......@@ -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
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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));
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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)
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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;
......
......@@ -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))