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

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

revision 123 by harbaum, Wed Sep 23 11:23:45 2009 UTC revision 125 by harbaum, Sun Sep 27 19:11:37 2009 UTC
# Line 525  on_window_realize(GtkWidget *widget, gpo Line 525  on_window_realize(GtkWidget *widget, gpo
525  }  }
526  #endif  #endif
527    
528    /* draw geocaches and set window title */
529    static void map_setup(map_context_t *context) {
530      char *name = NULL;
531    
532      /* clear all existing ccahe images */
533      osm_gps_map_clear_images (OSM_GPS_MAP(context->widget));
534    
535    #ifdef USE_MAEMO
536      if(!context->appdata->cur_gpx && !context->appdata->cur_cache) {
537    #endif
538        /* draw all geocaches */
539        gpx_t *gpx = context->appdata->gpx;
540        while(gpx) {
541          map_draw_gpx(context->appdata, context->widget, gpx);
542          gpx = gpx->next;
543        }
544        name = g_strdup(_("all"));
545    #ifdef USE_MAEMO
546      } else if(!context->appdata->cur_cache) {
547        map_draw_gpx(context->appdata, context->widget, context->appdata->cur_gpx);
548        name = g_strdup(context->appdata->cur_gpx->name);
549      } else {
550        map_draw_cache(context->widget, context->appdata->cur_cache);
551        name = g_strdup(context->appdata->cur_cache->name);
552      }
553    #endif
554    
555      char *title = g_strdup_printf(_("Map - %s"), name);
556      g_free(name);
557    
558      gtk_window_set_title(GTK_WINDOW(context->window), title);
559    
560      g_free(title);
561    }
562    
563  void map(appdata_t *appdata) {  void map(appdata_t *appdata) {
564    map_context_t *context = NULL;    map_context_t *context = NULL;
565    
566    /* if the map window already exists, just raise it */    /* if the map window already exists, just raise it */
567    if(appdata->map.context) {    if(appdata->map.context) {
568        printf("using existing map!\n");
569      gtk_window_present(GTK_WINDOW(appdata->map.context->window));      gtk_window_present(GTK_WINDOW(appdata->map.context->window));
570        map_setup(appdata->map.context);
571      return;      return;
572    }    }
573    
# Line 579  void map(appdata_t *appdata) { Line 616  void map(appdata_t *appdata) {
616    g_free(path);    g_free(path);
617    
618    osm_gps_map_osd_classic_init(OSM_GPS_MAP(context->widget));    osm_gps_map_osd_classic_init(OSM_GPS_MAP(context->widget));
   
   char *name = NULL;  
 #ifdef USE_MAEMO  
   if(!appdata->cur_gpx && !appdata->cur_cache) {  
 #endif  
     /* draw all geocaches */  
     gpx_t *gpx = appdata->gpx;  
     while(gpx) {  
       map_draw_gpx(appdata, context->widget, gpx);  
       gpx = gpx->next;  
     }  
     name = g_strdup(_("all"));  
 #ifdef USE_MAEMO  
   } else if(!appdata->cur_cache) {  
     map_draw_gpx(appdata, context->widget, appdata->cur_gpx);  
     name = g_strdup(appdata->cur_gpx->name);  
   } else {  
     map_draw_cache(context->widget, appdata->cur_cache);  
     name = g_strdup(appdata->cur_cache->name);  
   }  
 #endif  
   
   char *title = g_strdup_printf(_("Map - %s"), name);  
   g_free(name);  
619    
620  #ifdef USE_MAEMO  #ifdef USE_MAEMO
621  #ifdef USE_STACKABLE_WINDOW    /* we don't use a stackable window here on fremantle, since */
622    context->window = hildon_stackable_window_new();    /* this leaves the main window independent from the map and */
623    /* try to enable the zoom buttons. don't do this on x86 as it breaks */    /* the user can e.g. still navigate the main menu */
624    /* at runtime with cygwin x */    context->window = hildon_window_new();
625  #ifndef __i386__  
626    #if (MAEMO_VERSION_MAJOR == 5) && !defined(__i386__)
627    g_signal_connect(G_OBJECT(context->window), "realize",    g_signal_connect(G_OBJECT(context->window), "realize",
628                     G_CALLBACK(on_window_realize), NULL);                     G_CALLBACK(on_window_realize), NULL);
629  #endif // MAEMO_VERSION  #endif // MAEMO_VERSION
630  #else  #else
   context->window = hildon_window_new();  
 #endif  
 #else  
631    context->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);    context->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
632  #endif  #endif
633    
634    gtk_window_set_title(GTK_WINDOW(context->window), title);    /* setup cache state */
635      map_setup(context);
636    
637  #ifndef USE_MAEMO  #ifndef USE_MAEMO
638    gtk_window_set_default_size(GTK_WINDOW(context->window), 640, 480);    gtk_window_set_default_size(GTK_WINDOW(context->window), 640, 480);
639  #endif  #endif
640    
   g_free(title);  
   
641    g_signal_connect(G_OBJECT(context->widget), "configure-event",    g_signal_connect(G_OBJECT(context->widget), "configure-event",
642                     G_CALLBACK(on_map_configure), context);                     G_CALLBACK(on_map_configure), context);
643    

Legend:
Removed from v.123  
changed lines
  Added in v.125