Diff of /trunk/src/map-tool.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 50 by harbaum, Fri Aug 7 07:57:33 2009 UTC revision 51 by harbaum, Wed Aug 12 12:16:05 2009 UTC
# Line 123  cb_map_gps(GtkButton *button, map_contex Line 123  cb_map_gps(GtkButton *button, map_contex
123  }  }
124    
125  static GtkWidget  static GtkWidget
126  *map_add_button(const gchar *icon, GCallback cb, gpointer data,  *map_add_button(int icon, GCallback cb, gpointer data,
127                  char *tooltip) {                  char *tooltip) {
128    GtkWidget *button = gtk_button_new();    GtkWidget *button = gtk_button_new();
129    gtk_button_set_image(GTK_BUTTON(button),    gtk_button_set_image(GTK_BUTTON(button), icon_get_widget(ICON_MISC, icon));
                        gtk_image_new_from_stock(icon, GTK_ICON_SIZE_BUTTON));  
130    g_signal_connect(button, "clicked", cb, data);    g_signal_connect(button, "clicked", cb, data);
131  #ifndef USE_MAEMO  #ifndef USE_MAEMO
132    gtk_widget_set_tooltip_text(button, tooltip);    gtk_widget_set_tooltip_text(button, tooltip);
# Line 138  static GtkWidget Line 137  static GtkWidget
137  static gboolean map_gps_update(gpointer data) {  static gboolean map_gps_update(gpointer data) {
138    map_context_t *context = (map_context_t*)data;    map_context_t *context = (map_context_t*)data;
139    
140      /* get reference position ... */
141    pos_t *refpos = get_pos(context->appdata);    pos_t *refpos = get_pos(context->appdata);
142    gboolean ok = (refpos!= NULL) && !isnan(refpos->lat) && !isnan(refpos->lon);    gboolean ok = (refpos!= NULL) && !isnan(refpos->lat) && !isnan(refpos->lon);
143    
144    /* get reference position and go there */    /* ... and enable "goto" button if it's valid */
145    gtk_widget_set_sensitive(context->gps, ok);    gtk_widget_set_sensitive(context->gps, ok);
146    
147      if(ok) {
148        float heading = context->appdata->use_gps?
149          gps_get_heading(context->appdata):NAN;
150    
151       osm_gps_map_draw_gps(OSM_GPS_MAP(context->widget),
152                             refpos->lat, refpos->lon, heading);
153      } else
154        osm_gps_map_clear_gps(OSM_GPS_MAP(context->widget));
155    
156    return TRUE;    return TRUE;
157  }  }
158    
# Line 650  void map(appdata_t *appdata) { Line 659  void map(appdata_t *appdata) {
659    const char *proxy = get_proxy_uri(appdata);    const char *proxy = get_proxy_uri(appdata);
660    
661    context->widget = g_object_new(OSM_TYPE_GPS_MAP,    context->widget = g_object_new(OSM_TYPE_GPS_MAP,
662                  "repo-uri", MAP_SOURCE_OPENSTREETMAP,                   "repo-uri",             MAP_SOURCE_OPENSTREETMAP,
663                  "tile-cache", path,                   "tile-cache",           path,
664                  proxy?"proxy-uri":NULL, proxy,                   "auto-center",          FALSE,
665                     "record-trip-history",  FALSE,
666                     "show-trip-history",    FALSE,
667                   NULL);                   NULL);
668    
669      if(proxy)
670        g_object_set(OSM_GPS_MAP(context->widget),
671                     "proxy-uri", proxy, NULL);
672    
673    g_free(path);    g_free(path);
674    
675    char *name = NULL;    char *name = NULL;
# Line 711  void map(appdata_t *appdata) { Line 726  void map(appdata_t *appdata) {
726    GtkWidget *vbox = gtk_vbox_new(FALSE,0);    GtkWidget *vbox = gtk_vbox_new(FALSE,0);
727    
728    context->zoomin =    context->zoomin =
729      map_add_button(GTK_STOCK_ZOOM_IN, G_CALLBACK(cb_map_zoomin),      map_add_button(10, G_CALLBACK(cb_map_zoomin),
730                     context, _("Zoom in"));                     context, _("Zoom in"));
731    gtk_box_pack_start(GTK_BOX(vbox), context->zoomin, FALSE, FALSE, 0);    gtk_box_pack_start(GTK_BOX(vbox), context->zoomin, FALSE, FALSE, 0);
732    
733    context->zoomout =    context->zoomout =
734      map_add_button(GTK_STOCK_ZOOM_OUT, G_CALLBACK(cb_map_zoomout),      map_add_button(11, G_CALLBACK(cb_map_zoomout),
735                     context, _("Zoom out"));                     context, _("Zoom out"));
736    gtk_box_pack_start(GTK_BOX(vbox), context->zoomout, FALSE, FALSE, 0);    gtk_box_pack_start(GTK_BOX(vbox), context->zoomout, FALSE, FALSE, 0);
737    
738    context->gps =    context->gps =
739      map_add_button(GTK_STOCK_HOME, G_CALLBACK(cb_map_gps),      map_add_button(9, G_CALLBACK(cb_map_gps),
740                     context, _("Jump to GPS position"));                     context, _("Jump to GPS position"));
741    gtk_widget_set_sensitive(context->gps, FALSE);    gtk_widget_set_sensitive(context->gps, FALSE);
742    /* install handler for timed updates of the gps button */    /* install handler for timed updates of the gps button */

Legend:
Removed from v.50  
changed lines
  Added in v.51