]> git.street.me.uk Git - andy/viking.git/blob - src/vikmapsourcedefault.c
Remove dependencies to gob2
[andy/viking.git] / src / vikmapsourcedefault.c
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /*
3  * viking
4  * Copyright (C) Guilhem Bonnefille 2009 <guilhem.bonnefille@gmail.com>
5  * 
6  * viking is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  * 
11  * viking is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along
17  * with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #include "vikmapsourcedefault.h"
21
22 static guint8 map_source_get_uniq_id (VikMapSource *self);
23 static guint16 map_source_get_tilesize_x (VikMapSource *self);
24 static guint16 map_source_get_tilesize_y (VikMapSource *self);
25 static VikViewportDrawMode map_source_get_drawmode (VikMapSource *self);
26
27 typedef struct _VikMapSourceDefaultPrivate VikMapSourceDefaultPrivate;
28 struct _VikMapSourceDefaultPrivate
29 {
30         guint8 uniq_id;
31         guint16 tilesize_x;
32         guint16 tilesize_y;
33         VikViewportDrawMode drawmode;
34 };
35
36 #define VIK_MAP_SOURCE_DEFAULT_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), VIK_TYPE_MAP_SOURCE_DEFAULT, VikMapSourceDefaultPrivate))
37
38
39 G_DEFINE_TYPE_EXTENDED (VikMapSourceDefault, vik_map_source_default, VIK_TYPE_MAP_SOURCE, (GTypeFlags)G_TYPE_FLAG_ABSTRACT,);
40
41 static void
42 vik_map_source_default_init (VikMapSourceDefault *object)
43 {
44         /* TODO: Add initialization code here */
45 }
46
47 static void
48 vik_map_source_default_finalize (GObject *object)
49 {
50         /* TODO: Add deinitalization code here */
51
52         G_OBJECT_CLASS (vik_map_source_default_parent_class)->finalize (object);
53 }
54
55 static void
56 vik_map_source_default_class_init (VikMapSourceDefaultClass *klass)
57 {
58         GObjectClass* object_class = G_OBJECT_CLASS (klass);
59         VikMapSourceClass* parent_class = VIK_MAP_SOURCE_CLASS (klass);
60
61         /* Overiding methods */
62         parent_class->get_uniq_id =    map_source_get_uniq_id;
63         parent_class->get_tilesize_x = map_source_get_tilesize_x;
64         parent_class->get_tilesize_y = map_source_get_tilesize_y;
65         parent_class->get_drawmode =   map_source_get_drawmode;
66
67         g_type_class_add_private (klass, sizeof (VikMapSourceDefaultPrivate));
68
69         object_class->finalize = vik_map_source_default_finalize;
70 }
71
72 static guint8
73 map_source_get_uniq_id (VikMapSource *self)
74 {
75     VikMapSourceDefaultPrivate *priv = VIK_MAP_SOURCE_DEFAULT_PRIVATE(self);
76         g_return_val_if_fail (priv != NULL, (guint8 )0);
77
78         return priv->uniq_id;
79 }
80
81 static guint16
82 map_source_get_tilesize_x (VikMapSource *self)
83 {
84     VikMapSourceDefaultPrivate *priv = VIK_MAP_SOURCE_DEFAULT_PRIVATE(self);
85         g_return_val_if_fail (self != NULL, (guint16 )0);
86
87         return priv->tilesize_x;
88 }
89
90 static guint16
91 map_source_get_tilesize_y (VikMapSource *self)
92 {
93     VikMapSourceDefaultPrivate *priv = VIK_MAP_SOURCE_DEFAULT_PRIVATE(self);
94         g_return_val_if_fail (self != NULL, (guint16 )0);
95
96         return priv->tilesize_y;
97 }
98
99 static VikViewportDrawMode
100 map_source_get_drawmode (VikMapSource *self)
101 {
102     VikMapSourceDefaultPrivate *priv = VIK_MAP_SOURCE_DEFAULT_PRIVATE(self);
103         g_return_val_if_fail (self != NULL, (VikViewportDrawMode )0);
104
105         return priv->drawmode;
106 }