156 |
int type = semi?ICON_CACHE_TYPE_SEMI:ICON_CACHE_TYPE; |
int type = semi?ICON_CACHE_TYPE_SEMI:ICON_CACHE_TYPE; |
157 |
|
|
158 |
GdkPixbuf *icon = icon_get(type, cache->type); |
GdkPixbuf *icon = icon_get(type, cache->type); |
159 |
|
GdkPixbuf *over = NULL; |
160 |
|
|
161 |
|
if(cache->mine) over = icon_get(type, 14); |
162 |
|
else if(cache->found) over = icon_get(type, 12); |
163 |
|
else if(cache->notes) { |
164 |
|
if(cache->notes->found) over = icon_get(type, 12); |
165 |
|
else if(cache->notes->override) over = icon_get(type, 11); |
166 |
|
else over = icon_get(type, 13); |
167 |
|
} |
168 |
|
|
169 |
|
pos_t *pos = &cache->pos; |
170 |
/* check if there's also an overwritten coordinate */ |
/* check if there's also an overwritten coordinate */ |
171 |
if(cache->notes && cache->notes->override) { |
if(cache->notes && cache->notes->override) |
172 |
GdkPixbuf *over = icon_get(type, 11); |
pos = &cache->notes->pos; |
173 |
|
|
174 |
|
if(!isnan(pos->lat) && !isnan(pos->lon)) { |
175 |
osm_gps_map_add_image(OSM_GPS_MAP(map), |
osm_gps_map_add_image(OSM_GPS_MAP(map), |
176 |
cache->notes->pos.lat, cache->notes->pos.lon, icon); |
pos->lat, pos->lon, icon); |
177 |
|
if(over) |
178 |
osm_gps_map_add_image(OSM_GPS_MAP(map), |
osm_gps_map_add_image(OSM_GPS_MAP(map), |
179 |
cache->notes->pos.lat, cache->notes->pos.lon, over); |
pos->lat, pos->lon, over); |
|
} else { |
|
|
if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) |
|
|
osm_gps_map_add_image(OSM_GPS_MAP(map), |
|
|
cache->pos.lat, cache->pos.lon, icon); |
|
180 |
} |
} |
181 |
} |
} |
182 |
|
|
825 |
return FALSE; |
return FALSE; |
826 |
} |
} |
827 |
|
|
|
#ifdef USE_MAEMO |
|
828 |
static gboolean on_focus_out(GtkWidget *widget, GdkEventFocus *event, |
static gboolean on_focus_out(GtkWidget *widget, GdkEventFocus *event, |
829 |
gpointer data) { |
gpointer data) { |
830 |
map_context_t *context = (map_context_t*)data; |
map_context_t *context = (map_context_t*)data; |
831 |
|
|
832 |
printf("map lost focus\n"); |
printf("map lost focus\n"); |
833 |
|
|
834 |
|
/* save new map position */ |
835 |
|
gfloat lat, lon; |
836 |
|
g_object_get(widget, "latitude", &lat, "longitude", &lon, NULL); |
837 |
|
|
838 |
|
context->appdata->map.pos.lat = lat; |
839 |
|
context->appdata->map.pos.lon = lon; |
840 |
|
|
841 |
|
#ifdef USE_MAEMO |
842 |
gtk_timeout_remove(context->handler_id); |
gtk_timeout_remove(context->handler_id); |
843 |
context->handler_id = 0; |
context->handler_id = 0; |
844 |
|
#endif |
845 |
|
|
846 |
return FALSE; |
return FALSE; |
847 |
} |
} |
|
#endif |
|
848 |
|
|
849 |
void map_update(appdata_t *appdata) { |
void map_update(appdata_t *appdata) { |
850 |
printf("map_update\n"); |
printf("map_update\n"); |
939 |
g_signal_connect(G_OBJECT(context->widget), "focus-in-event", |
g_signal_connect(G_OBJECT(context->widget), "focus-in-event", |
940 |
G_CALLBACK(on_focus_in), context); |
G_CALLBACK(on_focus_in), context); |
941 |
|
|
|
#ifdef USE_MAEMO |
|
942 |
g_signal_connect(G_OBJECT(context->widget), "focus-out-event", |
g_signal_connect(G_OBJECT(context->widget), "focus-out-event", |
943 |
G_CALLBACK(on_focus_out), context); |
G_CALLBACK(on_focus_out), context); |
|
#endif |
|
944 |
|
|
945 |
g_signal_connect(G_OBJECT(context->widget), "configure-event", |
g_signal_connect(G_OBJECT(context->widget), "configure-event", |
946 |
G_CALLBACK(on_map_configure), context); |
G_CALLBACK(on_map_configure), context); |