Diff of /trunk/src/osm-gps-map.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 77 by harbaum, Tue Aug 25 12:49:03 2009 UTC revision 82 by harbaum, Thu Aug 27 08:29:48 2009 UTC
# Line 96  struct _OsmGpsMapPrivate Line 96  struct _OsmGpsMapPrivate
96    
97      //where downloaded tiles are cached      //where downloaded tiles are cached
98      char *cache_dir;      char *cache_dir;
     gboolean cache_dir_is_full_path;  
99    
100      //contains flags indicating the various special characters      //contains flags indicating the various special characters
101      //the uri string contains, that will be replaced when calculating      //the uri string contains, that will be replaced when calculating
# Line 189  enum Line 188  enum
188      PROP_REPO_URI,      PROP_REPO_URI,
189      PROP_PROXY_URI,      PROP_PROXY_URI,
190      PROP_TILE_CACHE_DIR,      PROP_TILE_CACHE_DIR,
     PROP_TILE_CACHE_DIR_IS_FULL_PATH,  
191      PROP_ZOOM,      PROP_ZOOM,
192      PROP_MAX_ZOOM,      PROP_MAX_ZOOM,
193      PROP_MIN_ZOOM,      PROP_MIN_ZOOM,
# Line 1691  osm_gps_map_constructor (GType gtype, gu Line 1689  osm_gps_map_constructor (GType gtype, gu
1689          }          }
1690      }      }
1691    
1692      if (!priv->cache_dir_is_full_path) {      const char *fname = osm_gps_map_source_get_friendly_name(priv->map_source);
1693          const char *fname = osm_gps_map_source_get_friendly_name(priv->map_source);      if(!fname) fname = "_unknown_";
1694          if(!fname) fname = "_unknown_";  
1695        if (priv->cache_dir) {
1696          if (priv->cache_dir) {          char *old = priv->cache_dir;
1697              char *old = priv->cache_dir;          //the new cachedir is the given cache dir + the md5 of the repo_uri
1698              //the new cachedir is the given cache dir + the md5 of the repo_uri          priv->cache_dir = g_strdup_printf("%s%c%s", old, G_DIR_SEPARATOR, fname);
1699              priv->cache_dir = g_strdup_printf("%s%c%s", old, G_DIR_SEPARATOR, fname);          g_debug("Adjusting cache dir %s -> %s", old, priv->cache_dir);
1700              g_debug("Adjusting cache dir %s -> %s", old, priv->cache_dir);          g_free(old);
             g_free(old);  
         } else {  
             //the new cachedir is the current dir + the md5 of the repo_uri  
             priv->cache_dir = g_strdup(fname);  
         }  
1701      }      }
1702    
1703      inspect_map_uri(map);      inspect_map_uri(map);
# Line 1828  osm_gps_map_set_property (GObject *objec Line 1821  osm_gps_map_set_property (GObject *objec
1821              if ( g_value_get_string(value) )              if ( g_value_get_string(value) )
1822                  priv->cache_dir = g_value_dup_string (value);                  priv->cache_dir = g_value_dup_string (value);
1823              break;              break;
         case PROP_TILE_CACHE_DIR_IS_FULL_PATH:  
             priv->cache_dir_is_full_path = g_value_get_boolean (value);  
             break;  
1824          case PROP_ZOOM:          case PROP_ZOOM:
1825              priv->map_zoom = g_value_get_int (value);              priv->map_zoom = g_value_get_int (value);
1826              break;              break;
# Line 1900  osm_gps_map_get_property (GObject *objec Line 1890  osm_gps_map_get_property (GObject *objec
1890          case PROP_TILE_CACHE_DIR:          case PROP_TILE_CACHE_DIR:
1891              g_value_set_string(value, priv->cache_dir);              g_value_set_string(value, priv->cache_dir);
1892              break;              break;
         case PROP_TILE_CACHE_DIR_IS_FULL_PATH:  
             g_value_set_boolean(value, priv->cache_dir_is_full_path);  
             break;  
1893          case PROP_ZOOM:          case PROP_ZOOM:
1894              g_value_set_int(value, priv->map_zoom);              g_value_set_int(value, priv->map_zoom);
1895              break;              break;
# Line 2337  osm_gps_map_class_init (OsmGpsMapClass * Line 2324  osm_gps_map_class_init (OsmGpsMapClass *
2324                                                            G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));                                                            G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
2325    
2326      g_object_class_install_property (object_class,      g_object_class_install_property (object_class,
                                      PROP_TILE_CACHE_DIR_IS_FULL_PATH,  
                                      g_param_spec_boolean ("tile-cache-is-full-path",  
                                                            "tile cache is full path",  
                                                            "if true, the path passed to tile-cache is interpreted as the full cache path",  
                                                            FALSE,  
                                                            G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));  
   
     g_object_class_install_property (object_class,  
2327                                       PROP_ZOOM,                                       PROP_ZOOM,
2328                                       g_param_spec_int ("zoom",                                       g_param_spec_int ("zoom",
2329                                                         "zoom",                                                         "zoom",

Legend:
Removed from v.77  
changed lines
  Added in v.82