--- trunk/src/map-tool.c 2009/08/07 07:57:33 48 +++ trunk/src/map-tool.c 2009/08/12 12:16:05 51 @@ -123,11 +123,10 @@ } static GtkWidget -*map_add_button(const gchar *icon, GCallback cb, gpointer data, +*map_add_button(int icon, GCallback cb, gpointer data, char *tooltip) { GtkWidget *button = gtk_button_new(); - gtk_button_set_image(GTK_BUTTON(button), - gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON)); + gtk_button_set_image(GTK_BUTTON(button), icon_get_widget(ICON_MISC, icon)); g_signal_connect(button, "clicked", cb, data); #ifndef USE_MAEMO gtk_widget_set_tooltip_text(button, tooltip); @@ -138,12 +137,22 @@ static gboolean map_gps_update(gpointer data) { map_context_t *context = (map_context_t*)data; + /* get reference position ... */ pos_t *refpos = get_pos(context->appdata); gboolean ok = (refpos!= NULL) && !isnan(refpos->lat) && !isnan(refpos->lon); - /* get reference position and go there */ + /* ... and enable "goto" button if it's valid */ gtk_widget_set_sensitive(context->gps, ok); + if(ok) { + float heading = context->appdata->use_gps? + gps_get_heading(context->appdata):NAN; + + osm_gps_map_draw_gps(OSM_GPS_MAP(context->widget), + refpos->lat, refpos->lon, heading); + } else + osm_gps_map_clear_gps(OSM_GPS_MAP(context->widget)); + return TRUE; } @@ -650,11 +659,17 @@ const char *proxy = get_proxy_uri(appdata); context->widget = g_object_new(OSM_TYPE_GPS_MAP, - "repo-uri", MAP_SOURCE_OPENSTREETMAP, - "tile-cache", path, - proxy?"proxy-uri":NULL, proxy, + "repo-uri", MAP_SOURCE_OPENSTREETMAP, + "tile-cache", path, + "auto-center", FALSE, + "record-trip-history", FALSE, + "show-trip-history", FALSE, NULL); + if(proxy) + g_object_set(OSM_GPS_MAP(context->widget), + "proxy-uri", proxy, NULL); + g_free(path); char *name = NULL; @@ -711,17 +726,17 @@ GtkWidget *vbox = gtk_vbox_new(FALSE,0); context->zoomin = - map_add_button(GTK_STOCK_ZOOM_IN, G_CALLBACK(cb_map_zoomin), + map_add_button(10, G_CALLBACK(cb_map_zoomin), context, _("Zoom in")); gtk_box_pack_start(GTK_BOX(vbox), context->zoomin, FALSE, FALSE, 0); context->zoomout = - map_add_button(GTK_STOCK_ZOOM_OUT, G_CALLBACK(cb_map_zoomout), + map_add_button(11, G_CALLBACK(cb_map_zoomout), context, _("Zoom out")); gtk_box_pack_start(GTK_BOX(vbox), context->zoomout, FALSE, FALSE, 0); context->gps = - map_add_button(GTK_STOCK_HOME, G_CALLBACK(cb_map_gps), + map_add_button(9, G_CALLBACK(cb_map_gps), context, _("Jump to GPS position")); gtk_widget_set_sensitive(context->gps, FALSE); /* install handler for timed updates of the gps button */