]> git.street.me.uk Git - andy/viking.git/blobdiff - src/vikmapsourcedefault.c
Fix <GTK 2.24 combo box usage.
[andy/viking.git] / src / vikmapsourcedefault.c
index 43d10ea5c6c7e45c84e4f8e84ae5cb7c2a73423d..208123fde6585c7384c8fc10431162452f327a4a 100644 (file)
 #include "vikenumtypes.h"
 #include "download.h"
 
 #include "vikenumtypes.h"
 #include "download.h"
 
-static const gchar *map_source_get_copyright (VikMapSource *self);
+static void map_source_get_copyright (VikMapSource *self, LatLonBBox bbox, gdouble zoom, void (*fct)(VikViewport*,const gchar*), void *data);
 static const gchar *map_source_get_license (VikMapSource *self);
 static const gchar *map_source_get_license_url (VikMapSource *self);
 static const gchar *map_source_get_license (VikMapSource *self);
 static const gchar *map_source_get_license_url (VikMapSource *self);
+static const GdkPixbuf *map_source_get_logo (VikMapSource *self);
 
 static guint8 map_source_get_uniq_id (VikMapSource *self);
 static const gchar *map_source_get_label (VikMapSource *self);
 
 static guint8 map_source_get_uniq_id (VikMapSource *self);
 static const gchar *map_source_get_label (VikMapSource *self);
@@ -51,7 +52,8 @@ struct _VikMapSourceDefaultPrivate
        gchar *copyright;
        gchar *license;
        gchar *license_url;
        gchar *copyright;
        gchar *license;
        gchar *license_url;
-       
+       GdkPixbuf *logo;
+
        guint8 uniq_id;
        gchar *label;
        guint16 tilesize_x;
        guint8 uniq_id;
        gchar *label;
        guint16 tilesize_x;
@@ -88,6 +90,7 @@ vik_map_source_default_init (VikMapSourceDefault *object)
   priv->copyright = NULL;
   priv->license = NULL;
   priv->license_url = NULL;
   priv->copyright = NULL;
   priv->license = NULL;
   priv->license_url = NULL;
+  priv->logo = NULL;
 }
 
 static void
 }
 
 static void
@@ -104,6 +107,8 @@ vik_map_source_default_finalize (GObject *object)
   priv->license = NULL;
   g_free (priv->license_url);
   priv->license_url = NULL;
   priv->license = NULL;
   g_free (priv->license_url);
   priv->license_url = NULL;
+  g_free (priv->logo);
+  priv->license_url = NULL;
        
   G_OBJECT_CLASS (vik_map_source_default_parent_class)->finalize (object);
 }
        
   G_OBJECT_CLASS (vik_map_source_default_parent_class)->finalize (object);
 }
@@ -123,7 +128,7 @@ vik_map_source_default_set_property (GObject      *object,
       priv->uniq_id = g_value_get_uint (value);
       break;
 
       priv->uniq_id = g_value_get_uint (value);
       break;
 
-       case PROP_LABEL:
+    case PROP_LABEL:
       g_free (priv->label);
       priv->label = g_strdup(g_value_get_string (value));
       break;
       g_free (priv->label);
       priv->label = g_strdup(g_value_get_string (value));
       break;
@@ -226,6 +231,7 @@ vik_map_source_default_class_init (VikMapSourceDefaultClass *klass)
        parent_class->get_copyright =   map_source_get_copyright;
        parent_class->get_license =     map_source_get_license;
        parent_class->get_license_url = map_source_get_license_url;
        parent_class->get_copyright =   map_source_get_copyright;
        parent_class->get_license =     map_source_get_license;
        parent_class->get_license_url = map_source_get_license_url;
+       parent_class->get_logo =        map_source_get_logo;
        parent_class->get_uniq_id =    map_source_get_uniq_id;
        parent_class->get_label =      map_source_get_label;
        parent_class->get_tilesize_x = map_source_get_tilesize_x;
        parent_class->get_uniq_id =    map_source_get_uniq_id;
        parent_class->get_label =      map_source_get_label;
        parent_class->get_tilesize_x = map_source_get_tilesize_x;
@@ -262,7 +268,7 @@ vik_map_source_default_class_init (VikMapSourceDefaultClass *klass)
                                0  /* minimum value */,
                                G_MAXUINT16 /* maximum value */,
                                0  /* default value */,
                                0  /* minimum value */,
                                G_MAXUINT16 /* maximum value */,
                                0  /* default value */,
-                               G_PARAM_READWRITE);
+                               G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
        g_object_class_install_property (object_class, PROP_TILESIZE_X, pspec);
 
        pspec = g_param_spec_uint ("tilesize-y",
        g_object_class_install_property (object_class, PROP_TILESIZE_X, pspec);
 
        pspec = g_param_spec_uint ("tilesize-y",
@@ -271,7 +277,7 @@ vik_map_source_default_class_init (VikMapSourceDefaultClass *klass)
                                0  /* minimum value */,
                                G_MAXUINT16 /* maximum value */,
                                0  /* default value */,
                                0  /* minimum value */,
                                G_MAXUINT16 /* maximum value */,
                                0  /* default value */,
-                               G_PARAM_READWRITE);
+                               G_PARAM_CONSTRUCT | G_PARAM_READWRITE);
        g_object_class_install_property (object_class, PROP_TILESIZE_Y, pspec);
 
        pspec = g_param_spec_enum("drawmode",
        g_object_class_install_property (object_class, PROP_TILESIZE_Y, pspec);
 
        pspec = g_param_spec_enum("drawmode",
@@ -286,7 +292,7 @@ vik_map_source_default_class_init (VikMapSourceDefaultClass *klass)
                                     "Copyright",
                                     "The copyright of the map source",
                                     NULL,
                                     "Copyright",
                                     "The copyright of the map source",
                                     NULL,
-                                    G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
+                                    G_PARAM_READWRITE);
        g_object_class_install_property (object_class, PROP_COPYRIGHT, pspec);
 
        pspec = g_param_spec_string ("license",
        g_object_class_install_property (object_class, PROP_COPYRIGHT, pspec);
 
        pspec = g_param_spec_string ("license",
@@ -308,14 +314,19 @@ vik_map_source_default_class_init (VikMapSourceDefaultClass *klass)
        object_class->finalize = vik_map_source_default_finalize;
 }
 
        object_class->finalize = vik_map_source_default_finalize;
 }
 
-static const gchar *
-map_source_get_copyright (VikMapSource *self)
+static void
+map_source_get_copyright (VikMapSource *self, LatLonBBox bbox, gdouble zoom, void (*fct)(VikViewport*,const gchar*), void *data)
 {
 {
-       g_return_val_if_fail (VIK_IS_MAP_SOURCE_DEFAULT(self), NULL);
+       /* Just ignore bbox and zoom level */
+       g_return_if_fail (VIK_IS_MAP_SOURCE_DEFAULT(self));
+
+       g_debug ("%s: %g %g %g %g %g", __FUNCTION__,
+               bbox.south, bbox.north, bbox.east, bbox.west,
+               zoom);
        
        VikMapSourceDefaultPrivate *priv = VIK_MAP_SOURCE_DEFAULT_PRIVATE(self);
 
        
        VikMapSourceDefaultPrivate *priv = VIK_MAP_SOURCE_DEFAULT_PRIVATE(self);
 
-       return priv->copyright;
+       (*fct) (data, priv->copyright);
 }
 
 static const gchar *
 }
 
 static const gchar *
@@ -338,6 +349,16 @@ map_source_get_license_url (VikMapSource *self)
        return priv->license_url;
 }
 
        return priv->license_url;
 }
 
+static const GdkPixbuf *
+map_source_get_logo (VikMapSource *self)
+{
+       g_return_val_if_fail (VIK_IS_MAP_SOURCE_DEFAULT(self), NULL);
+
+       VikMapSourceDefaultPrivate *priv = VIK_MAP_SOURCE_DEFAULT_PRIVATE(self);
+
+       return priv->logo;
+}
+
 static guint8
 map_source_get_uniq_id (VikMapSource *self)
 {
 static guint8
 map_source_get_uniq_id (VikMapSource *self)
 {