--- trunk/src/map-tool.c 2009/09/27 19:11:37 125 +++ trunk/src/map-tool.c 2009/09/29 14:30:16 129 @@ -229,22 +229,18 @@ cache_t *result = NULL; float distance = NAN; -#ifdef USE_MAEMO if(!context->appdata->cur_gpx && !context->appdata->cur_cache) { -#endif /* search all geocaches */ gpx_t *gpx = context->appdata->gpx; while(gpx) { map_cachelist_nearest(gpx->cache, pos, &result, &distance); gpx = gpx->next; } -#ifdef USE_MAEMO } else if(context->appdata->cur_gpx) { map_cachelist_nearest(context->appdata->cur_gpx->cache, pos, &result, &distance); } else result = context->appdata->cur_gpx->cache; -#endif return result; } @@ -532,9 +528,7 @@ /* clear all existing ccahe images */ osm_gps_map_clear_images (OSM_GPS_MAP(context->widget)); -#ifdef USE_MAEMO if(!context->appdata->cur_gpx && !context->appdata->cur_cache) { -#endif /* draw all geocaches */ gpx_t *gpx = context->appdata->gpx; while(gpx) { @@ -542,15 +536,19 @@ gpx = gpx->next; } name = g_strdup(_("all")); -#ifdef USE_MAEMO + context->state = MAP_ALL; + context->gpx = context->appdata->gpx; } else if(!context->appdata->cur_cache) { map_draw_gpx(context->appdata, context->widget, context->appdata->cur_gpx); name = g_strdup(context->appdata->cur_gpx->name); + context->state = MAP_GPX; + context->gpx = context->appdata->cur_gpx; } else { map_draw_cache(context->widget, context->appdata->cur_cache); name = g_strdup(context->appdata->cur_cache->name); + context->state = MAP_CACHE; + context->cache = context->appdata->cur_cache; } -#endif char *title = g_strdup_printf(_("Map - %s"), name); g_free(name); @@ -560,6 +558,24 @@ g_free(title); } +/* on maemo a window is either on top or completely invisible. this means that */ +/* we only need to update the map window if its raised. on ordinary desktops this */ +/* is different and we always update */ +static gboolean on_focus_in(GtkWidget *widget, GdkEventFocus *event, + gpointer data) { + map_context_t *context = (map_context_t*)data; + + printf("map focus in!\n"); + + return FALSE; +} + +void map_update(appdata_t *appdata) { + if(appdata->map.context) { + printf("map update\n"); + } +} + void map(appdata_t *appdata) { map_context_t *context = NULL; @@ -638,6 +654,9 @@ gtk_window_set_default_size(GTK_WINDOW(context->window), 640, 480); #endif + g_signal_connect(G_OBJECT(context->widget), "focus-in-event", + G_CALLBACK(on_focus_in), context); + g_signal_connect(G_OBJECT(context->widget), "configure-event", G_CALLBACK(on_map_configure), context);