[libchamplain] implement ChamplainMapDataSource



commit d6fcc018c7ded9dd9f1c2ab4cfdfea80d9a7ad7f
Author: Simon Wenner <simon wenner ch>
Date:   Fri Jun 19 19:00:47 2009 +0200

    implement ChamplainMapDataSource

 champlain/champlain-map-data-source.c |   27 ++++++++++++++++++++++-----
 champlain/champlain-map-data-source.h |    3 +--
 2 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/champlain/champlain-map-data-source.c b/champlain/champlain-map-data-source.c
index 2110142..d7406ba 100644
--- a/champlain/champlain-map-data-source.c
+++ b/champlain/champlain-map-data-source.c
@@ -23,6 +23,12 @@ G_DEFINE_TYPE (ChamplainMapDataSource, champlain_map_data_source, G_TYPE_OBJECT)
 #define GET_PRIVATE(o) \
   (G_TYPE_INSTANCE_GET_PRIVATE ((o), CHAMPLAIN_TYPE_MAP_DATA_SOURCE, ChamplainMapDataSourcePrivate))
 
+enum
+{
+  PROP_0,
+  PROP_MAP_DATA
+};
+
 typedef struct _ChamplainMapDataSourcePrivate ChamplainMapDataSourcePrivate;
 
 struct _ChamplainMapDataSourcePrivate {
@@ -52,6 +58,12 @@ champlain_map_data_source_set_property (GObject *object, guint property_id,
 static void
 champlain_map_data_source_dispose (GObject *object)
 {
+  ChamplainMapDataSource *self = (ChamplainMapDataSource *) object;
+  ChamplainMapDataSourcePrivate *priv =  GET_PRIVATE(self);
+
+  if (priv->map_data)
+    memphis_map_free (priv->map_data);
+
   G_OBJECT_CLASS (champlain_map_data_source_parent_class)->dispose (object);
 }
 
@@ -61,9 +73,8 @@ champlain_map_data_source_finalize (GObject *object)
   G_OBJECT_CLASS (champlain_map_data_source_parent_class)->finalize (object);
 }
 
-static void
-champlain_map_data_source_real_get_map_data (ChamplainMapDataSource *data_source,
-      osmFile *map_data)
+static MemphisMap*
+champlain_map_data_source_real_get_map_data (ChamplainMapDataSource *self)
 {
   g_error ("Should not be reached");
 }
@@ -86,7 +97,9 @@ champlain_map_data_source_class_init (ChamplainMapDataSourceClass *klass)
 static void
 champlain_map_data_source_init (ChamplainMapDataSource *self)
 {
+  ChamplainMapDataSourcePrivate *priv =  GET_PRIVATE(self);
 
+  priv->map_data = NULL;
 }
 
 ChamplainMapDataSource*
@@ -96,8 +109,12 @@ champlain_map_data_source_new (void)
 }
 
 MemphisMap*
-champlain_map_data_get_map_data (ChamplainMapDataSource *data_source)
+champlain_map_data_get_map_data (ChamplainMapDataSource *self)
 {
+  ChamplainMapDataSourcePrivate *priv =  GET_PRIVATE(self);
+
+  priv->map_data = CHAMPLAIN_MAP_DATA_SOURCE_GET_CLASS (self)
+      ->get_map_data (self);
 
-  return NULL;
+  return priv->map_data;
 }
diff --git a/champlain/champlain-map-data-source.h b/champlain/champlain-map-data-source.h
index a42328e..d9ea232 100644
--- a/champlain/champlain-map-data-source.h
+++ b/champlain/champlain-map-data-source.h
@@ -47,8 +47,7 @@ typedef struct {
 
 typedef struct {
   GObjectClass parent_class;
-  void (*get_map_data) (ChamplainMapDataSource *data_source,
-      osmFile *map_data);
+  MemphisMap* (*get_map_data) (ChamplainMapDataSource *data_source);
 } ChamplainMapDataSourceClass;
 
 GType champlain_map_data_source_get_type (void);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]