Diff of /trunk/src/cache.c

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

revision 226 by harbaum, Wed Dec 2 20:05:52 2009 UTC revision 259 by harbaum, Sat May 15 12:27:40 2010 UTC
# Line 51  void bearing_fill_hbox(GtkWidget *hbox, Line 51  void bearing_fill_hbox(GtkWidget *hbox,
51    
52    if(!isnan(pos.lat) && !isnan(pos.lon)) {    if(!isnan(pos.lat) && !isnan(pos.lon)) {
53      gtk_box_pack_start(GTK_BOX(hbox), gtk_image_new_from_pixbuf(      gtk_box_pack_start(GTK_BOX(hbox), gtk_image_new_from_pixbuf(
54                                          icon_bearing(refpos, pos)),TRUE,FALSE,0);                          icon_bearing(refpos, pos)),TRUE,FALSE,0);
55    
56      if(!isnan(refpos.lat) && !isnan(refpos.lon)) {      if(!isnan(refpos.lat) && !isnan(refpos.lon)) {
       gtk_box_pack_start_defaults(GTK_BOX(hbox),  
                    GTK_LABEL_SMALL((char*)pos_get_bearing_str(refpos, pos)));  
       gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL("  "));  
57        snprintf(str, sizeof(str), _("%.1f°"),        snprintf(str, sizeof(str), _("%.1f°"),
58                 gpx_pos_get_bearing(refpos, pos));                 gpx_pos_get_bearing(refpos, pos));
59        gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL(str));        gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL(str));
# Line 64  void bearing_fill_hbox(GtkWidget *hbox, Line 61  void bearing_fill_hbox(GtkWidget *hbox,
61                               refpos, pos, appdata->imperial);                               refpos, pos, appdata->imperial);
62        gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL("  "));        gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL("  "));
63        gtk_box_pack_start(GTK_BOX(hbox),        gtk_box_pack_start(GTK_BOX(hbox),
64               gtk_label_attrib(str, SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0);            gtk_label_attrib(str, SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0);
65      } else      } else
66        gtk_box_pack_start(GTK_BOX(hbox),        gtk_box_pack_start(GTK_BOX(hbox),
67                           gtk_label_attrib(_("(no position)"),                   gtk_label_attrib(_("(no position)"),
68                                            SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0);                   SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0);
69    } else    } else
70      gtk_box_pack_start(GTK_BOX(hbox),      gtk_box_pack_start(GTK_BOX(hbox),
71                         gtk_label_attrib(_("(invalid position in notes)"),                         gtk_label_attrib(_("(invalid position in notes)"),
72                                          SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0);                  SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0);
73  }  }
74    
75  /* this function sets everything related to the coordinate. used to */  /* this function sets everything related to the coordinate. used to */
# Line 601  static GtkWidget *cache_logs(appdata_t * Line 598  static GtkWidget *cache_logs(appdata_t *
598    if(gc_link) {    if(gc_link) {
599      GtkWidget *but =      GtkWidget *but =
600        gtk_button_new_with_label(_("Post a new log entry for this geocache"));        gtk_button_new_with_label(_("Post a new log entry for this geocache"));
 #if 0  
     gtk_button_set_image(GTK_BUTTON(but),  
         gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON));  
     gtk_button_set_image_position(GTK_BUTTON(but), GTK_POS_LEFT);  
 #endif  
601  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5)  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5)
602    hildon_gtk_widget_set_theme_size(but,    hildon_gtk_widget_set_theme_size(but,
603             (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));             (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));
# Line 766  static void on_notebook_destroy(GtkWidge Line 758  static void on_notebook_destroy(GtkWidge
758      gtk_timeout_remove(context->handler_id);      gtk_timeout_remove(context->handler_id);
759  #endif  #endif
760    
761    #ifdef USE_STACKABLE_WINDOW
762      if(context->notes_have_been_changed) {
763        printf("notes changed -> cachelist redraw\n");
764    
765        /* now the cachelist is visible again. so redraw it since it may */
766        /* have changed */
767        cachelist_redraw(context->appdata);
768      }
769    #endif
770    
771    printf("freeing cache context\n");    printf("freeing cache context\n");
772      context->appdata->cache_context = NULL;
773    g_free(context);    g_free(context);
774  }  }
775    
# Line 868  GtkWidget *cache_view(appdata_t *appdata Line 871  GtkWidget *cache_view(appdata_t *appdata
871    GtkWidget *notebook;    GtkWidget *notebook;
872    
873    cache_context_t *cache_context = g_new0(cache_context_t, 1);    cache_context_t *cache_context = g_new0(cache_context_t, 1);
874      appdata->cache_context = cache_context;
875    cache_context->appdata = appdata;    cache_context->appdata = appdata;
876    cache_context->cache = cache;    cache_context->cache = cache;
877    
# Line 892  GtkWidget *cache_view(appdata_t *appdata Line 896  GtkWidget *cache_view(appdata_t *appdata
896      notebook_append_page(notebook,      notebook_append_page(notebook,
897             cache_hint(appdata, cache), _("Hint"));             cache_hint(appdata, cache), _("Hint"));
898    
899    if(cache->log)    // always display log page to allow user to post a new log
900      if(cache->log
901    #ifdef ENABLE_BROWSER_INTERFACE
902         || (strncmp(cache->id, "GC", 2) == 0)
903    #endif
904         )
905      notebook_append_page(notebook,      notebook_append_page(notebook,
906       cache_logs(appdata, cache_context, cache->log, cache->logs_are_html),       cache_logs(appdata, cache_context, cache->log, cache->logs_are_html),
907             _("Logs"));             _("Logs"));
# Line 905  GtkWidget *cache_view(appdata_t *appdata Line 914  GtkWidget *cache_view(appdata_t *appdata
914      notebook_append_page(notebook,      notebook_append_page(notebook,
915               cache_tbs(appdata, cache->tb), _("TBs"));               cache_tbs(appdata, cache->tb), _("TBs"));
916    
917    notebook_append_page(notebook,    /* the demo caches don't have coordinates, so avoid */
918             cache_notes(cache_context), _("Notes"));    /* having to deal with them */
919      if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) {
920        notebook_append_page(notebook,
921                             cache_notes(cache_context), _("Notes"));
922    
923    notebook_append_page(notebook,      notebook_append_page(notebook,
924             goto_cache(cache_context), _("Goto"));                           goto_cache(cache_context), _("Goto"));
925      }
926    
927    g_signal_connect(notebook_object(notebook), "switch-page",    g_signal_connect(notebook_object(notebook), "switch-page",
928             G_CALLBACK(on_notebook_page_change), cache_context);             G_CALLBACK(on_notebook_page_change), cache_context);
# Line 960  void cache_dialog(appdata_t *appdata, ca Line 973  void cache_dialog(appdata_t *appdata, ca
973    g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view);    g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view);
974    
975    appdata->cur_cache = cache;    appdata->cur_cache = cache;
976    char *title = g_strdup_printf("%s - GPXView", cache->name);    gtk_window_set_title(GTK_WINDOW(window), cache->name);
   gtk_window_set_title(GTK_WINDOW(window), title);  
   g_free(title);  
977    
978    /* create cache visualization widget */    /* create cache visualization widget */
979    appdata->cur_view = cache_view(appdata, cache);    appdata->cur_view = cache_view(appdata, cache);

Legend:
Removed from v.226  
changed lines
  Added in v.259