X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/114d6588f3247634991cdf28a1246e92ac393c45..e8bab170981ff0e1cd572107ca4de122d4aafe8c:/src/vikmapslayer.c diff --git a/src/vikmapslayer.c b/src/vikmapslayer.c index 1812cf47..213f06fc 100644 --- a/src/vikmapslayer.c +++ b/src/vikmapslayer.c @@ -1046,7 +1046,7 @@ static GdkPixbuf *pixbuf_apply_settings ( GdkPixbuf *pixbuf, VikMapsLayer *vml, pixbuf = pixbuf_shrink ( pixbuf, xshrinkfactor, yshrinkfactor ); if ( pixbuf ) - a_mapcache_add ( pixbuf, mapcoord->x, mapcoord->y, + a_mapcache_add ( pixbuf, (mapcache_extra_t) {0.0}, mapcoord->x, mapcoord->y, mapcoord->z, vik_map_source_get_uniq_id(MAPS_LAYER_NTH_TYPE(vml->maptype)), mapcoord->scale, vml->alpha, xshrinkfactor, yshrinkfactor, vml->filename ); @@ -1633,7 +1633,7 @@ static int map_download_thread ( MapDownloadInfo *mdi, gpointer threaddata ) g_mutex_lock(mdi->mutex); if (remove_mem_cache) - a_mapcache_remove_all_shrinkfactors ( x, y, mdi->mapcoord.z, vik_map_source_get_uniq_id(MAPS_LAYER_NTH_TYPE(mdi->maptype)), mdi->mapcoord.scale ); + a_mapcache_remove_all_shrinkfactors ( x, y, mdi->mapcoord.z, vik_map_source_get_uniq_id(MAPS_LAYER_NTH_TYPE(mdi->maptype)), mdi->mapcoord.scale, mdi->vml->filename ); if (mdi->refresh_display && mdi->map_layer_alive) { /* TODO: check if it's on visible area */ vik_layer_emit_update ( VIK_LAYER(mdi->vml) ); // NB update display from background @@ -1756,7 +1756,8 @@ static void start_download_thread ( VikMapsLayer *vml, VikViewport *vvp, const V g_object_weak_ref(G_OBJECT(mdi->vml), weak_ref_cb, mdi); /* launch the thread */ - a_background_thread ( VIK_GTK_WINDOW_FROM_LAYER(vml), /* parent window */ + a_background_thread ( BACKGROUND_POOL_REMOTE, + VIK_GTK_WINDOW_FROM_LAYER(vml), /* parent window */ tmp, /* description string */ (vik_thr_func) map_download_thread, /* function to call within thread */ mdi, /* pass along data */ @@ -1840,14 +1841,16 @@ static void maps_layer_download_section ( VikMapsLayer *vml, VikViewport *vvp, V tmp = g_strdup_printf ( fmt, mdi->mapstoget, MAPS_LAYER_NTH_LABEL(vml->maptype) ); g_object_weak_ref(G_OBJECT(mdi->vml), weak_ref_cb, mdi); - /* launch the thread */ - a_background_thread ( VIK_GTK_WINDOW_FROM_LAYER(vml), /* parent window */ - tmp, /* description string */ - (vik_thr_func) map_download_thread, /* function to call within thread */ - mdi, /* pass along data */ - (vik_thr_free_func) mdi_free, /* function to free pass along data */ - (vik_thr_free_func) mdi_cancel_cleanup, - mdi->mapstoget ); + + // launch the thread + a_background_thread ( BACKGROUND_POOL_REMOTE, + VIK_GTK_WINDOW_FROM_LAYER(vml), /* parent window */ + tmp, /* description string */ + (vik_thr_func) map_download_thread, /* function to call within thread */ + mdi, /* pass along data */ + (vik_thr_free_func) mdi_free, /* function to free pass along data */ + (vik_thr_free_func) mdi_cancel_cleanup, + mdi->mapstoget ); g_free ( tmp ); } else @@ -2405,6 +2408,15 @@ static void maps_layer_download_all ( menu_array_values values ) } } +/** + * + */ +static void maps_layer_flush ( menu_array_values values ) +{ + VikMapsLayer *vml = VIK_MAPS_LAYER(values[MA_VML]); + a_mapcache_flush_type ( vik_map_source_get_uniq_id(MAPS_LAYER_NTH_TYPE(vml->maptype)) ); +} + static void maps_layer_add_menu_items ( VikMapsLayer *vml, GtkMenu *menu, VikLayersPanel *vlp ) { GtkWidget *item; @@ -2447,6 +2459,15 @@ static void maps_layer_add_menu_items ( VikMapsLayer *vml, GtkMenu *menu, VikLay g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(maps_layer_about), values ); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); gtk_widget_show ( item ); + + // Typical users shouldn't need to use this functionality - so debug only ATM + if ( vik_debug ) { + item = gtk_image_menu_item_new_with_mnemonic ( _("Flush Map Cache") ); + gtk_image_menu_item_set_image ( (GtkImageMenuItem*)item, gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU) ); + g_signal_connect_swapped ( G_OBJECT(item), "activate", G_CALLBACK(maps_layer_flush), values ); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); + gtk_widget_show ( item ); + } } /**