+++ /dev/null
-%headertop{
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "vikmapsource.h"
-#include "vikmapslayer_compat.h"
-%}
-
-class Old:Vik:Map:Type from Vik:Map:Source {
-
- private VikMapsLayer_MapType map_type;
-
- public GObject *
- new_with_id (VikMapsLayer_MapType map_type) {
- OldVikMapType *ret = GET_NEW;
- ret->_priv->map_type = map_type;
- return G_OBJECT (ret);
- }
-
- override (Vik:Map:Source) gboolean
- coord_to_mapcoord ( Vik:Map:Source *self, const VikCoord *src, gdouble xzoom, gdouble yzoom, MapCoord *dest )
- {
- return SELF(self)->_priv->map_type.coord_to_mapcoord (src, xzoom, yzoom, dest);
- }
-
- override (Vik:Map:Source) void
- mapcoord_to_center_coord ( Vik:Map:Source *self, MapCoord *src, VikCoord *dest )
- {
- SELF(self)->_priv->map_type.mapcoord_to_center_coord (src, dest);
- }
-
- override (Vik:Map:Source) int
- download ( Vik:Map:Source *self, MapCoord *src, const gchar *dest_fn )
- {
- return SELF(self)->_priv->map_type.download(src, dest_fn);
- }
-
-}
-
--- /dev/null
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * viking
+ * Copyright (C) Guilhem Bonnefille 2009 <guilhem.bonnefille@gmail.com>
+ *
+ * viking is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * viking is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "vikmaptype.h"
+#include "vikmapslayer_compat.h"
+
+static gboolean map_type_coord_to_mapcoord (VikMapSource *self, const VikCoord *src, gdouble xzoom, gdouble yzoom, MapCoord *dest );
+static void map_type_mapcoord_to_center_coord (VikMapSource *self, MapCoord *src, VikCoord *dest);
+static int map_type_download (VikMapSource * self, MapCoord * src, const gchar * dest_fn);
+
+typedef struct _VikMapTypePrivate VikMapTypePrivate;
+struct _VikMapTypePrivate
+{
+ VikMapsLayer_MapType map_type;
+};
+
+#define VIK_MAP_TYPE_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), VIK_TYPE_MAP_TYPE, VikMapTypePrivate))
+
+
+G_DEFINE_TYPE (VikMapType, vik_map_type, VIK_TYPE_MAP_SOURCE);
+
+static void
+vik_map_type_init (VikMapType *object)
+{
+ /* TODO: Add initialization code here */
+}
+
+VikMapType *
+vik_map_type_new_with_id (VikMapsLayer_MapType map_type)
+{
+ VikMapType *ret = (VikMapType *)g_object_new(vik_map_type_get_type(), NULL);
+ VikMapTypePrivate *priv = VIK_MAP_TYPE_PRIVATE(ret);
+ priv->map_type = map_type;
+ return ret;
+}
+
+static void
+vik_map_type_finalize (GObject *object)
+{
+ /* TODO: Add deinitalization code here */
+
+ G_OBJECT_CLASS (vik_map_type_parent_class)->finalize (object);
+}
+
+static void
+vik_map_type_class_init (VikMapTypeClass *klass)
+{
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ VikMapSourceClass* parent_class = VIK_MAP_SOURCE_CLASS (klass);
+
+ /* Overiding methods */
+ parent_class->coord_to_mapcoord = map_type_coord_to_mapcoord;
+ parent_class->mapcoord_to_center_coord = map_type_mapcoord_to_center_coord;
+ parent_class->download = map_type_download;
+
+ g_type_class_add_private (klass, sizeof (VikMapTypePrivate));
+
+ object_class->finalize = vik_map_type_finalize;
+}
+
+static gboolean
+map_type_coord_to_mapcoord (VikMapSource *self, const VikCoord *src, gdouble xzoom, gdouble yzoom, MapCoord *dest )
+{
+ VikMapTypePrivate *priv = VIK_MAP_TYPE_PRIVATE(self);
+ g_return_val_if_fail (priv != NULL, FALSE);
+
+ return (priv->map_type.coord_to_mapcoord)(src, xzoom, yzoom, dest);
+}
+
+static void
+map_type_mapcoord_to_center_coord (VikMapSource *self, MapCoord *src, VikCoord *dest)
+{
+ VikMapTypePrivate *priv = VIK_MAP_TYPE_PRIVATE(self);
+ g_return_if_fail (self != NULL);
+
+ return (priv->map_type.mapcoord_to_center_coord)(src, dest);
+}
+
+static int
+map_type_download (VikMapSource * self, MapCoord * src, const gchar * dest_fn)
+{
+ VikMapTypePrivate *priv = VIK_MAP_TYPE_PRIVATE(self);
+ g_return_val_if_fail (priv != NULL, 0);
+
+ return (priv->map_type.download)(src, dest_fn);
+}
+
--- /dev/null
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * viking
+ * Copyright (C) Guilhem Bonnefille 2009 <guilhem.bonnefille@gmail.com>
+ *
+ * viking is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * viking is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _VIK_MAP_TYPE_H_
+#define _VIK_MAP_TYPE_H_
+
+#include <glib-object.h>
+
+#include "vikmapsource.h"
+#include "vikmapslayer_compat.h"
+
+G_BEGIN_DECLS
+
+#define VIK_TYPE_MAP_TYPE (vik_map_type_get_type ())
+#define VIK_MAP_TYPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIK_TYPE_MAP_TYPE, VikMapType))
+#define VIK_MAP_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIK_TYPE_MAP_TYPE, VikMapTypeClass))
+#define VIK_IS_MAP_TYPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIK_TYPE_MAP_TYPE))
+#define VIK_IS_MAP_TYPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIK_TYPE_MAP_TYPE))
+#define VIK_MAP_TYPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIK_TYPE_MAP_TYPE, VikMapTypeClass))
+
+typedef struct _VikMapTypeClass VikMapTypeClass;
+typedef struct _VikMapType VikMapType;
+
+struct _VikMapTypeClass
+{
+ VikMapSourceClass parent_class;
+};
+
+struct _VikMapType
+{
+ VikMapSource parent_instance;
+};
+
+GType vik_map_type_get_type (void) G_GNUC_CONST;
+VikMapType *vik_map_type_new_with_id (VikMapsLayer_MapType map_type);
+
+G_END_DECLS
+
+#endif /* _VIK_MAP_TYPE_H_ */