]> git.street.me.uk Git - andy/viking.git/blobdiff - src/viklayer.c
Enable i18n on 'Routing' preferences tab name.
[andy/viking.git] / src / viklayer.c
index dd1ce92805d4651da543f27413693048e516797a..880c7394553c5b7140a2ee2e1fa759b1c2683249 100644 (file)
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2005, Alex Foobarian <foobarian@gmail.com>
  * Copyright (C) 2003-2007, Evan Battaglia <gtoevan@gmx.net>
  *
  * Copyright (C) 2005, Alex Foobarian <foobarian@gmail.com>
  * Copyright (C) 2003-2007, Evan Battaglia <gtoevan@gmx.net>
+ * Copyright (C) 2013, Rob Norris <rw_norris@hotmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -202,7 +203,7 @@ const gchar *vik_layer_get_name ( VikLayer *l )
   return l->name;
 }
 
   return l->name;
 }
 
-VikLayer *vik_layer_create ( VikLayerTypeEnum type, gpointer vp, GtkWindow *w, gboolean interactive )
+VikLayer *vik_layer_create ( VikLayerTypeEnum type, VikViewport *vp, gboolean interactive )
 {
   VikLayer *new_layer = NULL;
   g_assert ( type < VIK_LAYER_NUM_TYPES );
 {
   VikLayer *new_layer = NULL;
   g_assert ( type < VIK_LAYER_NUM_TYPES );
@@ -227,7 +228,7 @@ VikLayer *vik_layer_create ( VikLayerTypeEnum type, gpointer vp, GtkWindow *w, g
 }
 
 /* returns TRUE if OK was pressed */
 }
 
 /* returns TRUE if OK was pressed */
-gboolean vik_layer_properties ( VikLayer *layer, gpointer vp )
+gboolean vik_layer_properties ( VikLayer *layer, VikViewport *vp )
 {
   if ( vik_layer_interfaces[layer->type]->properties )
     return vik_layer_interfaces[layer->type]->properties ( layer, vp );
 {
   if ( vik_layer_interfaces[layer->type]->properties )
     return vik_layer_interfaces[layer->type]->properties ( layer, vp );
@@ -296,10 +297,16 @@ void vik_layer_marshall_params ( VikLayer *vl, guint8 **data, gint *datalen )
       d = get_param(vl, i, FALSE);
       switch ( params[i].type )
       {
       d = get_param(vl, i, FALSE);
       switch ( params[i].type )
       {
-      case VIK_LAYER_PARAM_STRING: 
-       vlm_append(d.s, strlen(d.s));
-       break;
-
+      case VIK_LAYER_PARAM_STRING:
+        // Remember need braces as these are macro calls, not single statement functions!
+        if ( d.s ) {
+          vlm_append(d.s, strlen(d.s));
+        }
+        else {
+          // Need to insert empty string otherwise the unmarshall will get confused
+          vlm_append("", 0);
+        }
+        break;
       /* print out the string list in the array */
       case VIK_LAYER_PARAM_STRING_LIST: {
         GList *list = d.sl;
       /* print out the string list in the array */
       case VIK_LAYER_PARAM_STRING_LIST: {
         GList *list = d.sl;
@@ -625,6 +632,8 @@ VikLayerTypedParamData *vik_layer_data_typed_param_copy_from_string ( VikLayerPa
  */
 void vik_layer_set_defaults ( VikLayer *vl, VikViewport *vvp )
 {
  */
 void vik_layer_set_defaults ( VikLayer *vl, VikViewport *vvp )
 {
+  // Sneaky initialize of the viewport value here
+  vl->vvp = vvp;
   VikLayerInterface *vli = vik_layer_get_interface ( vl->type );
   const gchar *layer_name = vli->fixed_layer_name;
   VikLayerParamData data;
   VikLayerInterface *vli = vik_layer_get_interface ( vl->type );
   const gchar *layer_name = vli->fixed_layer_name;
   VikLayerParamData data;