Diff of /trunk/src/cache.c

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

revision 178 by harbaum, Thu Nov 12 19:58:26 2009 UTC revision 214 by harbaum, Thu Nov 26 10:05:23 2009 UTC
# Line 42  static const char *cache_size_tip[] = { Line 42  static const char *cache_size_tip[] = {
42  #endif  #endif
43    
44  static const char *cache_size_name[] = {  static const char *cache_size_name[] = {
45    "Regular", "Small", "Micro", "Other",    "Regular", "Small", "Micro", "Other", "Not chosen", "Large", "Virtual"
   "Not chosen", "Large", "Virtual"  
46  };  };
47    
48  void bearing_fill_hbox(GtkWidget *hbox,  void bearing_fill_hbox(GtkWidget *hbox,
# Line 52  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)),1,0,0);                                          icon_bearing(refpos, pos)),TRUE,FALSE,0);
55    
56      if(!isnan(refpos.lat) && !isnan(refpos.lon)) {      if(!isnan(refpos.lat) && !isnan(refpos.lon)) {
57        gtk_box_pack_start_defaults(GTK_BOX(hbox),        gtk_box_pack_start_defaults(GTK_BOX(hbox),
58                     GTK_LABEL_SMALL((char*)pos_get_bearing_str(refpos, pos)));                     GTK_LABEL_SMALL((char*)pos_get_bearing_str(refpos, pos)));
59          gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL("  "));
60        snprintf(str, sizeof(str), _("%.1f°"),        snprintf(str, sizeof(str), _("%.1f°"),
61                 gpx_pos_get_bearing(refpos, pos));                 gpx_pos_get_bearing(refpos, pos));
62        gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL(str));        gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL(str));
63        gpx_pos_get_distance_str(str, sizeof(str),        gpx_pos_get_distance_str(str, sizeof(str),
64                               refpos, pos, appdata->imperial);                               refpos, pos, appdata->imperial);
65          gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL("  "));
66        gtk_box_pack_start(GTK_BOX(hbox),        gtk_box_pack_start(GTK_BOX(hbox),
67               gtk_label_attrib(str, SIZE_SMALL, STRIKETHROUGH_NONE),1,0,0);               gtk_label_attrib(str, SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0);
68      } else      } else
69        gtk_box_pack_start(GTK_BOX(hbox),        gtk_box_pack_start(GTK_BOX(hbox),
70                           gtk_label_attrib(_("(no position)"),                           gtk_label_attrib(_("(no position)"),
71                           SIZE_SMALL, STRIKETHROUGH_NONE),1,0,0);                                            SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0);
72    } else    } else
73      gtk_box_pack_start(GTK_BOX(hbox),      gtk_box_pack_start(GTK_BOX(hbox),
74             gtk_label_attrib(_("(invalid position in notes)"),                         gtk_label_attrib(_("(invalid position in notes)"),
75                              SIZE_SMALL, STRIKETHROUGH_NONE),1,0,0);                                          SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0);
76  }  }
77    
78  /* this function sets everthing related to the coordinate. used to */  /* this function sets everything related to the coordinate. used to */
79  /* cope with the user setting a new "note coordinate" */  /* cope with the user setting a new "note coordinate" */
80  void overview_coordinate_update(cache_context_t *context) {  void overview_coordinate_update(cache_context_t *context) {
81    if(!context->notes.modified)    if(!context->notes.modified)
82      return;      return;
83    
84    /* update position labels */    /* update position labels */
85    int strike = notes_get_override(context)?STRIKETHROUGH:STRIKETHROUGH_NONE;    int strike = notes_get_override(context)?STRIKETHROUGH:STRIKETHROUGH_NONE;
86    char str[32];    char str[32];
# Line 87  void overview_coordinate_update(cache_co Line 88  void overview_coordinate_update(cache_co
88    gtk_label_attrib_set(context->pos_lat_label, str, SIZE_BIG, strike);    gtk_label_attrib_set(context->pos_lat_label, str, SIZE_BIG, strike);
89    pos_lon_str(str, sizeof(str), context->cache->pos.lon);    pos_lon_str(str, sizeof(str), context->cache->pos.lon);
90    gtk_label_attrib_set(context->pos_lon_label, str, SIZE_BIG, strike);    gtk_label_attrib_set(context->pos_lon_label, str, SIZE_BIG, strike);
91    
92    /* remove enire hbox and build a new one */    /* remove enire hbox and build a new one */
93    gtk_container_foreach(GTK_CONTAINER(context->bearing_hbox),    gtk_container_foreach(GTK_CONTAINER(context->bearing_hbox),
94                          (GtkCallback)gtk_widget_destroy, NULL);                          (GtkCallback)gtk_widget_destroy, NULL);
95    
96    /* update distance/etc */    /* update distance/etc */
97    if(!isnan(context->cache->pos.lat) &&    if(!isnan(context->cache->pos.lat) &&
98       !isnan(context->cache->pos.lon))       !isnan(context->cache->pos.lon))
99      bearing_fill_hbox(context->bearing_hbox, context->appdata,      bearing_fill_hbox(context->bearing_hbox, context->appdata,
100                        *get_pos(context->appdata), notes_get_pos(context));                        *get_pos(context->appdata), notes_get_pos(context));
101    
102    gtk_widget_show_all(context->bearing_hbox);    gtk_widget_show_all(context->bearing_hbox);
103  }  }
104    
105  static void gcvote_set(cache_context_t *context, vote_t *vote) {  static void gcvote_set(cache_context_t *context, vote_t *vote) {
106    if(!vote) return;    if(!vote) return;
107    
108    if(context->quality) {    if(context->quality) {
109      gtk_widget_destroy(context->quality);      gtk_widget_destroy(context->quality);
110      context->quality = NULL;      context->quality = NULL;
111    }    }
112    
113    if(context->votes) {    if(context->votes) {
114      gtk_widget_destroy(context->votes);      gtk_widget_destroy(context->votes);
115      context->votes = NULL;      context->votes = NULL;
116    }    }
117    
118    /* update/draw the voting */    /* update/draw the voting */
119  #ifndef USE_MAEMO  #ifndef USE_MAEMO
120    GtkTooltips *tips = gtk_tooltips_new();    GtkTooltips *tips = gtk_tooltips_new();
121  #endif  #endif
122    
123    char *votes_str = g_strdup_printf(_("Quality (%d %s):"), vote->votes,    char *votes_str = g_strdup_printf(_("Quality (%d %s):"), vote->votes,
124                                        (vote->votes == 1)?_("vote"):_("votes"));                                      (vote->votes == 1)?_("vote"):_("votes"));
125    context->votes = GTK_LABEL_SMALL(votes_str);    context->votes = GTK_LABEL_SMALL(votes_str);
126    gtk_box_pack_start(GTK_BOX(context->votebox),    gtk_box_pack_start(GTK_BOX(context->votebox),
127                       context->votes, FALSE, FALSE, 0);                       context->votes, FALSE, FALSE, 0);
# Line 128  static void gcvote_set(cache_context_t * Line 129  static void gcvote_set(cache_context_t *
129    context->quality = icon_get_widget(ICON_STARS, (int)(vote->quality*2-2));    context->quality = icon_get_widget(ICON_STARS, (int)(vote->quality*2-2));
130    gtk_box_pack_start(GTK_BOX(context->votebox), context->quality,    gtk_box_pack_start(GTK_BOX(context->votebox), context->quality,
131                       FALSE, FALSE, 0);                       FALSE, FALSE, 0);
132    
133  #ifndef USE_MAEMO  #ifndef USE_MAEMO
134    char *str = g_strdup_printf(_("Quality: %d"), vote->quality);    char *str = g_strdup_printf(_("Quality: %d"), vote->quality);
135    gtk_tooltips_set_tip(tips, context->votebox, str, NULL);    gtk_tooltips_set_tip(tips, context->votebox, str, NULL);
# Line 142  static void gcvote_set(cache_context_t * Line 143  static void gcvote_set(cache_context_t *
143    
144  static void gcvote_callback(vote_t *vote, gpointer data) {  static void gcvote_callback(vote_t *vote, gpointer data) {
145    cache_context_t *context = (cache_context_t*)data;    cache_context_t *context = (cache_context_t*)data;
146    
147    /* no vote returned: request failed, just cleanup */    /* no vote returned: request failed, just cleanup */
148    if(!vote) {    if(!vote) {
149      printf("gcvote: callback for failed request\n");      printf("gcvote: callback for failed request\n");
150    
151      gcvote_request_free(context->gcvote_request);      gcvote_request_free(context->gcvote_request);
152      context->gcvote_request = NULL;      context->gcvote_request = NULL;
153      return;      return;
# Line 156  static void gcvote_callback(vote_t *vote Line 157  static void gcvote_callback(vote_t *vote
157           vote->quality, vote->votes);           vote->quality, vote->votes);
158    
159    gcvote_set(context, vote);    gcvote_set(context, vote);
160    
161    gcvote_save(context->appdata, context->cache, &context->gcvote_request->mem);    gcvote_save(context->appdata, context->cache, &context->gcvote_request->mem);
162    
163    gcvote_request_free(context->gcvote_request);    gcvote_request_free(context->gcvote_request);
164    context->gcvote_request = NULL;    context->gcvote_request = NULL;
165  }  }
166    
167    static void pack_vcentered(GtkWidget *vbox, GtkWidget *child) {
168      GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
169      gtk_container_add(GTK_CONTAINER(align), child);
170      gtk_box_pack_start_defaults(GTK_BOX(vbox), align);
171    }
172    
173    #ifdef FREMANTLE
174    #define ICON_SIZE  ICON_CACHE_TYPE_2X
175    #else
176    #define ICON_SIZE  ICON_CACHE_TYPE_1_5X
177    #endif
178    
179  static GtkWidget *cache_overview(cache_context_t *context) {  static GtkWidget *cache_overview(cache_context_t *context) {
180    GtkWidget *vbox, *ivbox;    GtkWidget *vbox, *ivbox;
181    GtkWidget *table, *tip;    GtkWidget *colbox, *tip;
182    char str[64];    char str[64];
183  #ifndef USE_MAEMO  #ifndef USE_MAEMO
184    GtkTooltips *tips = gtk_tooltips_new();    GtkTooltips *tips = gtk_tooltips_new();
185  #endif  #endif
186    appdata_t *appdata = context->appdata;    appdata_t *appdata = context->appdata;
187    cache_t *cache = context->cache;    cache_t *cache = context->cache;
188    
189    vbox = gtk_vbox_new(FALSE, 0);    vbox = gtk_vbox_new(FALSE, 4);
190    
191    table =  gtk_table_new(3,4, FALSE);    /* hbox containing the four columns of cache details */
192      GtkWidget *ihbox = gtk_hbox_new(FALSE, 0);
193    
194      /* vbox containing leftmost column (icon and container) */
195      colbox = gtk_vbox_new(FALSE, 0);
196    
197    if(cache->type != CACHE_TYPE_UNKNOWN) {    if(cache->type != CACHE_TYPE_UNKNOWN) {
198      gtk_table_attach(GTK_TABLE(table),      gtk_box_pack_start_defaults(GTK_BOX(colbox),
199  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)          tip = icon_get_widget(ICON_SIZE, cache->type));
200               tip = icon_get_widget(ICON_CACHE_TYPE_2X, cache->type),  
 #else  
              tip = icon_get_widget(ICON_CACHE_TYPE_1_5X, cache->type),  
 #endif  
                      0,1,0,1, GTK_FILL, 0, GTK_FILL, 0);  
201  #ifndef USE_MAEMO  #ifndef USE_MAEMO
202      gtk_tooltips_set_tip(tips, tip, _(cache_type_tip[cache->type]), NULL);      gtk_tooltips_set_tip(tips, tip, _(cache_type_tip[cache->type]), NULL);
203  #endif  #endif
204    }    }
205    
206    /* ------------ box containing container info ------------ */    /* ------------ box containing container info ------------ */
207    if(cache->container != CACHE_CONT_UNKNOWN) {    if(cache->container != CACHE_CONT_UNKNOWN) {
208      ivbox = gtk_vbox_new(FALSE, 0);      ivbox = gtk_vbox_new(FALSE, 0);
# Line 199  static GtkWidget *cache_overview(cache_c Line 212  static GtkWidget *cache_overview(cache_c
212      gtk_box_pack_start(GTK_BOX(ivbox),      gtk_box_pack_start(GTK_BOX(ivbox),
213                         icon_get_widget(ICON_CACHE_SIZE, cache->container),                         icon_get_widget(ICON_CACHE_SIZE, cache->container),
214                         FALSE, FALSE, 0);                         FALSE, FALSE, 0);
215      gtk_table_attach(GTK_TABLE(table), ivbox, 0,1,1,2,  
216                       GTK_EXPAND | GTK_FILL, 0, GTK_FILL, 0);      pack_vcentered(colbox, ivbox);
217  #ifndef USE_MAEMO  #ifndef USE_MAEMO
218      gtk_tooltips_set_tip(tips, ivbox, _(cache_size_tip[cache->container]), NULL);      gtk_tooltips_set_tip(tips, ivbox, _(cache_size_tip[cache->container]), NULL);
219  #endif  #endif
220    }    }
221    
222      gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox);
223      colbox = gtk_vbox_new(FALSE, 0);
224    
225    /* ----------------------- id ---------------------------- */    /* ----------------------- id ---------------------------- */
226    if(cache->id) {    if(cache->id) {
227      int strike = cache->archived?STRIKETHROUGH_RED:      int strike = cache->archived?STRIKETHROUGH_RED:
# Line 213  static GtkWidget *cache_overview(cache_c Line 229  static GtkWidget *cache_overview(cache_c
229      GtkWidget *lbl = link_button_attrib(context->appdata,      GtkWidget *lbl = link_button_attrib(context->appdata,
230                                          cache->id, context->cache->url,                                          cache->id, context->cache->url,
231                                          SIZE_BIG, strike);                                          SIZE_BIG, strike);
232      gtk_table_attach(GTK_TABLE(table), lbl, 1,2,0,1, FALSE, FALSE, 0, 0);      pack_vcentered(colbox, lbl);
233    }    }
234    
235    /* --------------- box containing owner info ------------- */    /* --------------- box containing owner info ------------- */
236    if(cache->owner) {    if(cache->owner) {
237      ivbox = gtk_vbox_new(FALSE, 0);      gtk_box_pack_start_defaults(GTK_BOX(colbox), GTK_LABEL_SMALL(_("by")));
     gtk_box_pack_start_defaults(GTK_BOX(ivbox), GTK_LABEL_SMALL(_("by")));  
238    
239      static const char *owner_type = "profile/";      static const char *owner_type = "profile/";
240      gtk_box_pack_start_defaults(GTK_BOX(ivbox),      pack_vcentered(colbox,
241                  link_button_by_id(appdata, cache->owner->name,                  link_button_by_id(appdata, cache->owner->name,
242                                    owner_type, cache->owner->id));                                    owner_type, cache->owner->id));
     gtk_table_attach(GTK_TABLE(table), ivbox, 1,2,1,2, FALSE,FALSE,0,0);  
243    }    }
244    
245      gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox);
246    
247    /* ----------- vbox containing all ratings ---------- */    /* ----------- vbox containing all ratings ---------- */
248    GtkWidget *ratebox = gtk_vbox_new(FALSE, 0);    colbox = gtk_vbox_new(FALSE, 0);
249    
250    /* ----------- box containing difficulty rating ---------- */    /* ----------- box containing difficulty rating ---------- */
251    if(cache->difficulty != 0) {    if(cache->difficulty != 0) {
# Line 241  static GtkWidget *cache_overview(cache_c Line 257  static GtkWidget *cache_overview(cache_c
257                    icon_get_widget(ICON_STARS, (int)(cache->difficulty*2-2)),                    icon_get_widget(ICON_STARS, (int)(cache->difficulty*2-2)),
258                         FALSE, FALSE, 0);                         FALSE, FALSE, 0);
259    
260      GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);      pack_vcentered(colbox, ivbox);
     gtk_container_add(GTK_CONTAINER(align), ivbox);  
     gtk_box_pack_start_defaults(GTK_BOX(ratebox), align);  
261  #ifndef USE_MAEMO  #ifndef USE_MAEMO
262      sprintf(str, _("Difficulty: %.1f"), cache->difficulty);      sprintf(str, _("Difficulty: %.1f"), cache->difficulty);
263      gtk_tooltips_set_tip(tips, ivbox, str, NULL);      gtk_tooltips_set_tip(tips, ivbox, str, NULL);
# Line 258  static GtkWidget *cache_overview(cache_c Line 272  static GtkWidget *cache_overview(cache_c
272      gtk_box_pack_start(GTK_BOX(ivbox),      gtk_box_pack_start(GTK_BOX(ivbox),
273                         icon_get_widget(ICON_STARS, (int)(cache->terrain*2-2)),                         icon_get_widget(ICON_STARS, (int)(cache->terrain*2-2)),
274                         FALSE, FALSE, 0);                         FALSE, FALSE, 0);
275      GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);      pack_vcentered(colbox, ivbox);
     gtk_container_add(GTK_CONTAINER(align), ivbox);  
     gtk_box_pack_start_defaults(GTK_BOX(ratebox), align);  
276  #ifndef USE_MAEMO  #ifndef USE_MAEMO
277      sprintf(str, _("Terrain: %.1f"), cache->terrain);      sprintf(str, _("Terrain: %.1f"), cache->terrain);
278      gtk_tooltips_set_tip(tips, ivbox, str, NULL);      gtk_tooltips_set_tip(tips, ivbox, str, NULL);
# Line 275  static GtkWidget *cache_overview(cache_c Line 287  static GtkWidget *cache_overview(cache_c
287        gcvote_request(appdata, gcvote_callback, cache->url, context);        gcvote_request(appdata, gcvote_callback, cache->url, context);
288    
289      context->votebox = gtk_vbox_new(FALSE, 0);      context->votebox = gtk_vbox_new(FALSE, 0);
290      GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);      pack_vcentered(colbox, context->votebox);
     gtk_container_add(GTK_CONTAINER(align), context->votebox);  
     gtk_box_pack_start_defaults(GTK_BOX(ratebox), align);  
291    
292      /* fill with vote if present on disk (will also free vote) */      /* fill with vote if present on disk (will also free vote) */
293      if(vote)      if(vote)
294        gcvote_set(context, vote);        gcvote_set(context, vote);
   
     gtk_table_attach_defaults(GTK_TABLE(table), ratebox, 2,3,0,2);  
295    }    }
296    
297      gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox);
298    
299    /* ----------------------------------------------------- */    /* ----------------------------------------------------- */
300    
301    
302    /* ----------------- the two coordinates ----------------- */    /* ----------------- the two coordinates ----------------- */
303    /* ----------------- and the heading/distance ------------ */    /* ----------------- and the heading/distance ------------ */
304      colbox = gtk_vbox_new(FALSE, 0);
305    
306    pos_t *refpos = get_pos(appdata);    pos_t *refpos = get_pos(appdata);
307    
308    ivbox = gtk_vbox_new(FALSE, 0);    ivbox = gtk_vbox_new(FALSE, 0);
# Line 298  static GtkWidget *cache_overview(cache_c Line 310  static GtkWidget *cache_overview(cache_c
310                    STRIKETHROUGH:STRIKETHROUGH_NONE;                    STRIKETHROUGH:STRIKETHROUGH_NONE;
311    
312    /* the original coordinate is being displayed */    /* the original coordinate is being displayed */
313    gtk_box_pack_start_defaults(GTK_BOX(ivbox),    gtk_box_pack_start(GTK_BOX(ivbox),
314         context->pos_lat_label = pos_lat(cache->pos.lat, SIZE_BIG, strike));         context->pos_lat_label = pos_lat(cache->pos.lat, SIZE_BIG, strike), FALSE, FALSE, 0);
315    gtk_box_pack_start_defaults(GTK_BOX(ivbox),    gtk_box_pack_start(GTK_BOX(ivbox),
316         context->pos_lon_label = pos_lon(cache->pos.lon, SIZE_BIG, strike));         context->pos_lon_label = pos_lon(cache->pos.lon, SIZE_BIG, strike), FALSE, FALSE, 0);
317    
318      pack_vcentered(colbox, ivbox);
319    
320    /* but calculations may be done with respect to the overriden one */    /* but calculations may be done with respect to the overriden one */
321    if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) {    if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) {
322      context->bearing_hbox = gtk_hbox_new(FALSE, 0);      context->bearing_hbox = gtk_hbox_new(FALSE, 0);
323      bearing_fill_hbox(context->bearing_hbox, appdata, *refpos,      bearing_fill_hbox(context->bearing_hbox, appdata, *refpos,
324                        gpx_cache_pos(cache));                        gpx_cache_pos(cache));
325      gtk_box_pack_start_defaults(GTK_BOX(ivbox), context->bearing_hbox);      pack_vcentered(colbox, context->bearing_hbox);
326    }    }
327    
328    gtk_table_attach_defaults(GTK_TABLE(table), ivbox, 3,4,0,2);    gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox);
329    
330    /* ----------------------------------------------------- */    /* ----------------------------------------------------- */
331    
332    gtk_box_pack_start(GTK_BOX(vbox), table, 0,0,0);    gtk_box_pack_start(GTK_BOX(vbox), ihbox, FALSE, FALSE, 0);
333    gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(),FALSE,FALSE,0);    gtk_box_pack_start(GTK_BOX(vbox), gtk_hseparator_new(), FALSE, FALSE, 0);
334    
335    /* ----------------------------------------------------- */    /* ----------------------------------------------------- */
336    
# Line 438  static GtkWidget *cache_wpts(appdata_t * Line 452  static GtkWidget *cache_wpts(appdata_t *
452                        pos_lon(wpt->pos.lon, SIZE_BIG, STRIKETHROUGH_NONE),                        pos_lon(wpt->pos.lon, SIZE_BIG, STRIKETHROUGH_NONE),
453                        2,3, wpt_row, wpt_row+1);                        2,3, wpt_row, wpt_row+1);
454    
455      ihbox = gtk_hbox_new(FALSE, 0);      if(refpos && !isnan(refpos->lat) && !isnan(refpos->lon)) {
456      gtk_box_pack_start(GTK_BOX(ihbox), gtk_image_new_from_pixbuf(        ihbox = gtk_hbox_new(FALSE, 0);
457          gtk_box_pack_start(GTK_BOX(ihbox), gtk_image_new_from_pixbuf(
458                             icon_bearing(*refpos, wpt->pos)),1,0,0);                             icon_bearing(*refpos, wpt->pos)),1,0,0);
459      gtk_box_pack_start_defaults(GTK_BOX(ihbox),        snprintf(str, sizeof(str), _("%.1f°"),
460            GTK_LABEL_SMALL((char*)pos_get_bearing_str(*refpos, wpt->pos)));                 gpx_pos_get_bearing(*refpos, wpt->pos));
461      snprintf(str, sizeof(str), _("%.1f°"),        gtk_box_pack_start_defaults(GTK_BOX(ihbox), GTK_LABEL_SMALL(str));
462             gpx_pos_get_bearing(*refpos, wpt->pos));  
463      gtk_box_pack_start_defaults(GTK_BOX(ihbox), GTK_LABEL_SMALL(str));        gpx_pos_get_distance_str(str, sizeof(str),
464      gpx_pos_get_distance_str(str, sizeof(str),                                 *refpos, wpt->pos, appdata->imperial);
465                               *refpos, wpt->pos, appdata->imperial);        gtk_box_pack_start(GTK_BOX(ihbox), GTK_LABEL_SMALL(str),1,0,0);
466      gtk_box_pack_start(GTK_BOX(ihbox), GTK_LABEL_SMALL(str),1,0,0);  
467          gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 3,4,
468                                    wpt_row+0, wpt_row+1);
469        }
470    
     gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 3,4,  
                               wpt_row+0, wpt_row+1);  
   
471      /* ------------------ description ------------------------- */      /* ------------------ description ------------------------- */
472      if(wpt->desc)      if(wpt->desc)
473        gtk_table_attach_defaults(GTK_TABLE(table),        gtk_table_attach_defaults(GTK_TABLE(table),
# Line 514  static GtkWidget *cache_tbs(appdata_t *a Line 529  static GtkWidget *cache_tbs(appdata_t *a
529    
530      /* --------------------- icon/ref/name -------------------------*/      /* --------------------- icon/ref/name -------------------------*/
531      GtkWidget *icon = NULL;      GtkWidget *icon = NULL;
532      if(strcasestr(tb->name, "coin") != 0)      if((strcasestr(tb->name, "coin") != 0) ||
533           (strcasestr(tb->name, "muenze") != 0) ||
534           (strcasestr(tb->name, "münze") != 0))
535        icon = icon_get_widget(ICON_TB, 1);   /* coin icon */        icon = icon_get_widget(ICON_TB, 1);   /* coin icon */
536      else      else
537        icon = icon_get_widget(ICON_TB, 0);   /* tb icon */        icon = icon_get_widget(ICON_TB, 0);   /* tb icon */
# Line 583  static GtkWidget *cache_logs(appdata_t * Line 600  static GtkWidget *cache_logs(appdata_t *
600    
601  #ifdef ENABLE_BROWSER_INTERFACE  #ifdef ENABLE_BROWSER_INTERFACE
602    if(gc_link) {    if(gc_link) {
603      GtkWidget *but =      GtkWidget *but =
604        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"));
605    #if 0
606        gtk_button_set_image(GTK_BUTTON(but),
607            gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON));
608        gtk_button_set_image_position(GTK_BUTTON(but), GTK_POS_LEFT);
609    #endif
610  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5)  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5)
611    hildon_gtk_widget_set_theme_size(but,    hildon_gtk_widget_set_theme_size(but,
612             (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));             (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));
# Line 592  static GtkWidget *cache_logs(appdata_t * Line 614  static GtkWidget *cache_logs(appdata_t *
614      gtk_signal_connect(GTK_OBJECT(but), "clicked",      gtk_signal_connect(GTK_OBJECT(but), "clicked",
615                         GTK_SIGNAL_FUNC(on_gclink_clicked), context);                         GTK_SIGNAL_FUNC(on_gclink_clicked), context);
616    
617      gtk_box_pack_start_defaults(GTK_BOX(vbox), but);      gtk_box_pack_start(GTK_BOX(vbox), but, FALSE, FALSE, 0);
618    }    }
619  #endif  #endif
620    
# Line 619  static GtkWidget *cache_logs(appdata_t * Line 641  static GtkWidget *cache_logs(appdata_t *
641                     (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));                     (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));
642  #endif  #endif
643    
644        gtk_label_set_ellipsize(GTK_LABEL(gtk_bin_get_child(GTK_BIN(finder))),      gtk_label_set_ellipsize(GTK_LABEL(gtk_bin_get_child(GTK_BIN(finder))),
645                                PANGO_ELLIPSIZE_END);                                PANGO_ELLIPSIZE_END);
646      } else      } else
647        gtk_label_set_ellipsize(GTK_LABEL(finder), PANGO_ELLIPSIZE_END);        gtk_label_set_ellipsize(GTK_LABEL(finder), PANGO_ELLIPSIZE_END);
# Line 641  static GtkWidget *cache_logs(appdata_t * Line 663  static GtkWidget *cache_logs(appdata_t *
663    
664      gtk_box_pack_start(GTK_BOX(ivbox), ihbox, FALSE, FALSE, 0);      gtk_box_pack_start(GTK_BOX(ivbox), ihbox, FALSE, FALSE, 0);
665    
666      gtk_table_attach_defaults(GTK_TABLE(table), ivbox, 0, 1,      gtk_table_attach(GTK_TABLE(table), ivbox, 0, 1,
667                                2*log_cnt, 2*log_cnt+1);                       2*log_cnt, 2*log_cnt+1, 0, GTK_EXPAND | GTK_FILL, 0, 0);
668    
669      if(log->text) {      if(log->text) {
670        gtk_table_attach_defaults(GTK_TABLE(table),        gtk_table_attach_defaults(GTK_TABLE(table),
671          html_view(appdata, log->text,          html_view(appdata, log->text,
# Line 664  static GtkWidget *cache_logs(appdata_t * Line 686  static GtkWidget *cache_logs(appdata_t *
686      log_cnt++;      log_cnt++;
687    }    }
688    
689    gtk_box_pack_start_defaults(GTK_BOX(vbox), table);    gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
690    
691  #ifndef  USE_PANNABLE_AREA  #ifndef  USE_PANNABLE_AREA
692    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window),    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window),
# Line 710  static void on_notebook_page_change(GtkN Line 732  static void on_notebook_page_change(GtkN
732    /* seems to work ... */    /* seems to work ... */
733    if(strcasecmp(name, _("Logs")) == 0) {    if(strcasecmp(name, _("Logs")) == 0) {
734      gtk_widget_queue_resize(w);      gtk_widget_queue_resize(w);
   } else if(strcasecmp(name, _("TBs")) == 0) {  
     gtk_widget_queue_resize(w);  
735    } else if(strcasecmp(name, _("Goto")) == 0) {    } else if(strcasecmp(name, _("Goto")) == 0) {
736  #ifdef USE_MAEMO  #ifdef USE_MAEMO
737      context->handler_id = gtk_timeout_add(1000, screensaver_update,      context->handler_id = gtk_timeout_add(1000, screensaver_update,
738                                            context->appdata);                                            context->appdata);
739  #endif  #endif
740    
741      goto_coordinate_update(context);      goto_coordinate_update(context);
742    }    }
743    
# Line 785  static GtkWidget *notebook_new(void) { Line 806  static GtkWidget *notebook_new(void) {
806  #endif  #endif
807  }  }
808    
809    #ifdef CUSTOM_NOTEBOOK
810  static void on_notebook_button_clicked(GtkWidget *button, gpointer data) {  static void on_notebook_button_clicked(GtkWidget *button, gpointer data) {
811    GtkNotebook *nb =    GtkNotebook *nb =
812      GTK_NOTEBOOK(g_object_get_data(G_OBJECT(data), "notebook"));      GTK_NOTEBOOK(g_object_get_data(G_OBJECT(data), "notebook"));
# Line 792  static void on_notebook_button_clicked(G Line 814  static void on_notebook_button_clicked(G
814    gint page = (gint)g_object_get_data(G_OBJECT(button), "page");    gint page = (gint)g_object_get_data(G_OBJECT(button), "page");
815    gtk_notebook_set_current_page(nb, page);    gtk_notebook_set_current_page(nb, page);
816  }  }
817    #endif
818    
819  static void notebook_append_page(GtkWidget *notebook,  static void notebook_append_page(GtkWidget *notebook,
820                                   GtkWidget *page, char *label) {                                   GtkWidget *page, char *label) {

Legend:
Removed from v.178  
changed lines
  Added in v.214