229 |
cache_t *result = NULL; |
cache_t *result = NULL; |
230 |
float distance = NAN; |
float distance = NAN; |
231 |
|
|
|
#ifdef USE_MAEMO |
|
232 |
if(!context->appdata->cur_gpx && !context->appdata->cur_cache) { |
if(!context->appdata->cur_gpx && !context->appdata->cur_cache) { |
|
#endif |
|
233 |
/* search all geocaches */ |
/* search all geocaches */ |
234 |
gpx_t *gpx = context->appdata->gpx; |
gpx_t *gpx = context->appdata->gpx; |
235 |
while(gpx) { |
while(gpx) { |
236 |
map_cachelist_nearest(gpx->cache, pos, &result, &distance); |
map_cachelist_nearest(gpx->cache, pos, &result, &distance); |
237 |
gpx = gpx->next; |
gpx = gpx->next; |
238 |
} |
} |
|
#ifdef USE_MAEMO |
|
239 |
} else if(context->appdata->cur_gpx) { |
} else if(context->appdata->cur_gpx) { |
240 |
map_cachelist_nearest(context->appdata->cur_gpx->cache, |
map_cachelist_nearest(context->appdata->cur_gpx->cache, |
241 |
pos, &result, &distance); |
pos, &result, &distance); |
242 |
} else |
} else |
243 |
result = context->appdata->cur_gpx->cache; |
result = context->appdata->cur_gpx->cache; |
|
#endif |
|
244 |
|
|
245 |
return result; |
return result; |
246 |
} |
} |
528 |
/* clear all existing ccahe images */ |
/* clear all existing ccahe images */ |
529 |
osm_gps_map_clear_images (OSM_GPS_MAP(context->widget)); |
osm_gps_map_clear_images (OSM_GPS_MAP(context->widget)); |
530 |
|
|
|
#ifdef USE_MAEMO |
|
531 |
if(!context->appdata->cur_gpx && !context->appdata->cur_cache) { |
if(!context->appdata->cur_gpx && !context->appdata->cur_cache) { |
|
#endif |
|
532 |
/* draw all geocaches */ |
/* draw all geocaches */ |
533 |
gpx_t *gpx = context->appdata->gpx; |
gpx_t *gpx = context->appdata->gpx; |
534 |
while(gpx) { |
while(gpx) { |
536 |
gpx = gpx->next; |
gpx = gpx->next; |
537 |
} |
} |
538 |
name = g_strdup(_("all")); |
name = g_strdup(_("all")); |
539 |
#ifdef USE_MAEMO |
context->state = MAP_ALL; |
540 |
|
context->gpx = context->appdata->gpx; |
541 |
} else if(!context->appdata->cur_cache) { |
} else if(!context->appdata->cur_cache) { |
542 |
map_draw_gpx(context->appdata, context->widget, context->appdata->cur_gpx); |
map_draw_gpx(context->appdata, context->widget, context->appdata->cur_gpx); |
543 |
name = g_strdup(context->appdata->cur_gpx->name); |
name = g_strdup(context->appdata->cur_gpx->name); |
544 |
|
context->state = MAP_GPX; |
545 |
|
context->gpx = context->appdata->cur_gpx; |
546 |
} else { |
} else { |
547 |
map_draw_cache(context->widget, context->appdata->cur_cache); |
map_draw_cache(context->widget, context->appdata->cur_cache); |
548 |
name = g_strdup(context->appdata->cur_cache->name); |
name = g_strdup(context->appdata->cur_cache->name); |
549 |
|
context->state = MAP_CACHE; |
550 |
|
context->cache = context->appdata->cur_cache; |
551 |
} |
} |
|
#endif |
|
552 |
|
|
553 |
char *title = g_strdup_printf(_("Map - %s"), name); |
char *title = g_strdup_printf(_("Map - %s"), name); |
554 |
g_free(name); |
g_free(name); |
558 |
g_free(title); |
g_free(title); |
559 |
} |
} |
560 |
|
|
561 |
|
/* on maemo a window is either on top or completely invisible. this means that */ |
562 |
|
/* we only need to update the map window if its raised. on ordinary desktops this */ |
563 |
|
/* is different and we always update */ |
564 |
|
static gboolean on_focus_in(GtkWidget *widget, GdkEventFocus *event, |
565 |
|
gpointer data) { |
566 |
|
map_context_t *context = (map_context_t*)data; |
567 |
|
|
568 |
|
printf("map focus in!\n"); |
569 |
|
|
570 |
|
return FALSE; |
571 |
|
} |
572 |
|
|
573 |
|
void map_update(appdata_t *appdata) { |
574 |
|
if(appdata->map.context) { |
575 |
|
printf("map update\n"); |
576 |
|
} |
577 |
|
} |
578 |
|
|
579 |
void map(appdata_t *appdata) { |
void map(appdata_t *appdata) { |
580 |
map_context_t *context = NULL; |
map_context_t *context = NULL; |
581 |
|
|
654 |
gtk_window_set_default_size(GTK_WINDOW(context->window), 640, 480); |
gtk_window_set_default_size(GTK_WINDOW(context->window), 640, 480); |
655 |
#endif |
#endif |
656 |
|
|
657 |
|
g_signal_connect(G_OBJECT(context->widget), "focus-in-event", |
658 |
|
G_CALLBACK(on_focus_in), context); |
659 |
|
|
660 |
g_signal_connect(G_OBJECT(context->widget), "configure-event", |
g_signal_connect(G_OBJECT(context->widget), "configure-event", |
661 |
G_CALLBACK(on_map_configure), context); |
G_CALLBACK(on_map_configure), context); |
662 |
|
|