194 |
static void map_setup(map_context_t *context) { |
static void map_setup(map_context_t *context) { |
195 |
char *name = NULL; |
char *name = NULL; |
196 |
|
|
197 |
|
int cache_num = gpx_total_caches_global(context->appdata->gpx); |
198 |
|
|
199 |
|
if(context->caches_displayed && (cache_num != context->cache_list_len)) { |
200 |
|
g_free(context->caches_displayed); |
201 |
|
context->caches_displayed = NULL; |
202 |
|
context->cache_list_len = 0; |
203 |
|
} |
204 |
|
|
205 |
|
/* allocate buffer */ |
206 |
|
if(cache_num) { |
207 |
|
context->cache_list_len = cache_num; |
208 |
|
context->caches_displayed = g_new0(cache_display_t, cache_num); |
209 |
|
printf("allocated space to handle %d map icons\n", cache_num); |
210 |
|
} |
211 |
|
|
212 |
if(!context->appdata->cur_gpx && !context->appdata->cur_cache) { |
if(!context->appdata->cur_gpx && !context->appdata->cur_cache) { |
213 |
if(context->state != MAP_ALL) { |
if(context->state != MAP_ALL) { |
214 |
printf("map_setup(ALL)\n"); |
printf("map_setup(ALL)\n"); |
447 |
gdk_pixbuf_get_height(buf)); |
gdk_pixbuf_get_height(buf)); |
448 |
|
|
449 |
// Create the new Context for the ImageSurface |
// Create the new Context for the ImageSurface |
450 |
|
g_assert(image_surface); |
451 |
cairo_t *context = cairo_create(image_surface); |
cairo_t *context = cairo_create(image_surface); |
452 |
|
|
453 |
// Draw the image on the new Context |
// Draw the image on the new Context |
712 |
gtk_timeout_remove(context->handler_id); |
gtk_timeout_remove(context->handler_id); |
713 |
gps_unregister_callback(appdata, context->cb_id); |
gps_unregister_callback(appdata, context->cb_id); |
714 |
|
|
715 |
|
if(context->caches_displayed) { |
716 |
|
g_free(context->caches_displayed); |
717 |
|
context->caches_displayed = NULL; |
718 |
|
} |
719 |
|
|
720 |
g_free(context); |
g_free(context); |
721 |
appdata->map.context = NULL; |
appdata->map.context = NULL; |
722 |
} |
} |