Diff of /trunk/src/cache.c

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

revision 66 by harbaum, Wed Aug 19 20:03:28 2009 UTC revision 214 by harbaum, Thu Nov 26 10:05:23 2009 UTC
# Line 19  Line 19 
19    
20  #include "gpxview.h"  #include "gpxview.h"
21  #include <math.h>  #include <math.h>
22    #include <string.h>
23    
24  static GtkWidget *cache_description(appdata_t *appdata, cache_t *cache) {  static GtkWidget *cache_description(appdata_t *appdata, cache_t *cache) {
25    return html_view(appdata, cache->long_description,    return html_view(appdata, cache->long_description,
26                     cache->long_is_html, TRUE, cache, NULL);             cache->long_is_html?HTML_HTML:HTML_PLAIN_TEXT, TRUE, cache, NULL);
27  }  }
28    
29  #ifndef USE_MAEMO  // maemos touchscreen doesn't support tooltips  #ifndef USE_MAEMO  // maemos touchscreen doesn't support tooltips
# Line 41  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 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)),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 86  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  #ifdef ENABLE_BROWSER_INTERFACE  static void gcvote_set(cache_context_t *context, vote_t *vote) {
106  static void on_www_clicked(GtkButton *button, gpointer data) {    if(!vote) return;
107    
108      if(context->quality) {
109        gtk_widget_destroy(context->quality);
110        context->quality = NULL;
111      }
112    
113      if(context->votes) {
114        gtk_widget_destroy(context->votes);
115        context->votes = NULL;
116      }
117    
118      /* update/draw the voting */
119    #ifndef USE_MAEMO
120      GtkTooltips *tips = gtk_tooltips_new();
121    #endif
122    
123      char *votes_str = g_strdup_printf(_("Quality (%d %s):"), vote->votes,
124                                        (vote->votes == 1)?_("vote"):_("votes"));
125      context->votes = GTK_LABEL_SMALL(votes_str);
126      gtk_box_pack_start(GTK_BOX(context->votebox),
127                         context->votes, FALSE, FALSE, 0);
128      g_free(votes_str);
129      context->quality = icon_get_widget(ICON_STARS, (int)(vote->quality*2-2));
130      gtk_box_pack_start(GTK_BOX(context->votebox), context->quality,
131                         FALSE, FALSE, 0);
132    
133    #ifndef USE_MAEMO
134      char *str = g_strdup_printf(_("Quality: %d"), vote->quality);
135      gtk_tooltips_set_tip(tips, context->votebox, str, NULL);
136      g_free(str);
137    #endif
138    
139      gtk_widget_show_all(context->votebox);
140    
141      g_free(vote);
142    }
143    
144    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    browser_url(context->appdata, context->cache->url);  
147      /* no vote returned: request failed, just cleanup */
148      if(!vote) {
149        printf("gcvote: callback for failed request\n");
150    
151        gcvote_request_free(context->gcvote_request);
152        context->gcvote_request = NULL;
153        return;
154      }
155    
156      printf("gcvote: callback is being called with a %d/%d\n",
157             vote->quality, vote->votes);
158    
159      gcvote_set(context, vote);
160    
161      gcvote_save(context->appdata, context->cache, &context->gcvote_request->mem);
162    
163      gcvote_request_free(context->gcvote_request);
164      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  #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_defaults(GTK_TABLE(table),      gtk_box_pack_start_defaults(GTK_BOX(colbox),
199        tip = icon_get_widget(ICON_CACHE_TYPE, cache->type), 0,1,0,1);          tip = icon_get_widget(ICON_SIZE, cache->type));
200    
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);
209      sprintf(str, _("Size: %s"), _(cache_size_name[cache->container]));      sprintf(str, _("Size: %s"), _(cache_size_name[cache->container]));
210      gtk_box_pack_start_defaults(GTK_BOX(ivbox), GTK_LABEL_SMALL(str));      gtk_box_pack_start(GTK_BOX(ivbox), GTK_LABEL_SMALL(str),
211      gtk_box_pack_start_defaults(GTK_BOX(ivbox),                         FALSE, FALSE, 0);
212          icon_get_widget(ICON_CACHE_SIZE, cache->container));      gtk_box_pack_start(GTK_BOX(ivbox),
213      gtk_table_attach_defaults(GTK_TABLE(table), ivbox, 0,1,1,2);                         icon_get_widget(ICON_CACHE_SIZE, cache->container),
214                           FALSE, FALSE, 0);
215    
216        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:
228        (!cache->available?STRIKETHROUGH:STRIKETHROUGH_NONE);        (!cache->available?STRIKETHROUGH:STRIKETHROUGH_NONE);
229      GtkWidget *lbl = NULL;      GtkWidget *lbl = link_button_attrib(context->appdata,
230                                            cache->id, context->cache->url,
231  #ifdef ENABLE_BROWSER_INTERFACE                                          SIZE_BIG, strike);
232      if(!cache->url)      pack_vcentered(colbox, lbl);
 #endif  
       lbl = gtk_label_attrib(cache->id, SIZE_BIG, strike);  
 #ifdef ENABLE_BROWSER_INTERFACE  
     else {  
       /* add Go button */  
       lbl = gtk_button_attrib(cache->id, SIZE_BIG, strike);  
       //      gtk_button_set_relief(GTK_BUTTON(button),GTK_RELIEF_NONE);  
       gtk_signal_connect(GTK_OBJECT(lbl), "clicked",  
                          (GtkSignalFunc)on_www_clicked, context);  
     }  
 #endif  
   
     gtk_table_attach(GTK_TABLE(table), lbl, 1,2,0,1, FALSE, FALSE, 0, 0);  
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")));
238      gtk_box_pack_start_defaults(GTK_BOX(ivbox), GTK_LABEL_SMALL(_("by")));  
239      gtk_box_pack_start_defaults(GTK_BOX(ivbox), GTK_LABEL_SMALL(cache->owner));      static const char *owner_type = "profile/";
240      gtk_table_attach_defaults(GTK_TABLE(table), ivbox, 1,2,1,2);      pack_vcentered(colbox,
241                    link_button_by_id(appdata, cache->owner->name,
242                                      owner_type, cache->owner->id));
243    }    }
244    
245      gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox);
246    
247      /* ----------- vbox containing all ratings ---------- */
248      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) {
252      ivbox = gtk_vbox_new(FALSE, 0);      ivbox = gtk_vbox_new(FALSE, 0);
253      gtk_box_pack_start_defaults(GTK_BOX(ivbox),      gtk_box_pack_start(GTK_BOX(ivbox),
254                                  GTK_LABEL_SMALL(_("Difficulty:")));                         GTK_LABEL_SMALL(_("Difficulty:")),
255      gtk_box_pack_start_defaults(GTK_BOX(ivbox),                         FALSE, FALSE, 0);
256         icon_get_widget(ICON_STARS, (int)(cache->difficulty*2-2)));      gtk_box_pack_start(GTK_BOX(ivbox),
257      gtk_table_attach_defaults(GTK_TABLE(table), ivbox, 2,3,0,1);                    icon_get_widget(ICON_STARS, (int)(cache->difficulty*2-2)),
258                           FALSE, FALSE, 0);
259    
260        pack_vcentered(colbox, ivbox);
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 190  static GtkWidget *cache_overview(cache_c Line 267  static GtkWidget *cache_overview(cache_c
267    /* ------------ box containing terrain rating ------------ */    /* ------------ box containing terrain rating ------------ */
268    if(cache->terrain != 0) {    if(cache->terrain != 0) {
269      ivbox = gtk_vbox_new(FALSE, 0);      ivbox = gtk_vbox_new(FALSE, 0);
270      gtk_box_pack_start_defaults(GTK_BOX(ivbox), GTK_LABEL_SMALL(_("Terrain:")));      gtk_box_pack_start(GTK_BOX(ivbox), GTK_LABEL_SMALL(_("Terrain:")),
271      gtk_box_pack_start_defaults(GTK_BOX(ivbox),                         FALSE, FALSE, 0);
272        icon_get_widget(ICON_STARS, (int)(cache->terrain*2-2)));      gtk_box_pack_start(GTK_BOX(ivbox),
273      gtk_table_attach_defaults(GTK_TABLE(table), ivbox, 2,3,1,2);                         icon_get_widget(ICON_STARS, (int)(cache->terrain*2-2)),
274                           FALSE, FALSE, 0);
275        pack_vcentered(colbox, ivbox);
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);
279  #endif  #endif
280    }    }
281    
282      /* --------------------- GCVote ------------------------ */
283      if(!appdata->disable_gcvote) {
284        vote_t *vote = gcvote_restore(appdata, cache);
285    
286        context->gcvote_request =
287          gcvote_request(appdata, gcvote_callback, cache->url, context);
288    
289        context->votebox = gtk_vbox_new(FALSE, 0);
290        pack_vcentered(colbox, context->votebox);
291    
292        /* fill with vote if present on disk (will also free vote) */
293        if(vote)
294          gcvote_set(context, vote);
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 209  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    
337    if(cache->short_description)    if(cache->short_description)
338      gtk_box_pack_start_defaults(GTK_BOX(vbox),      gtk_box_pack_start_defaults(GTK_BOX(vbox),
339          html_view(appdata, cache->short_description,          html_view(appdata, cache->short_description,
340                    cache->short_is_html, TRUE, cache, NULL));            cache->short_is_html?HTML_HTML:HTML_PLAIN_TEXT, TRUE, cache, NULL));
341    
342    return vbox;    return vbox;
343  }  }
# Line 278  static void on_decrypt(GtkWidget *widget Line 383  static void on_decrypt(GtkWidget *widget
383  static GtkWidget *cache_hint(appdata_t *appdata, cache_t *cache) {  static GtkWidget *cache_hint(appdata_t *appdata, cache_t *cache) {
384    /* encrypting/decrypting html is nothing we want to do */    /* encrypting/decrypting html is nothing we want to do */
385    if(cache->hint_is_html)    if(cache->hint_is_html)
386      return html_view(appdata, cache->hint, TRUE, TRUE, NULL, NULL);      return html_view(appdata, cache->hint, HTML_HTML, TRUE, NULL, NULL);
387    
388    /* we can now be sure that we are talking about pain text */    /* we can now be sure that we are talking about pain text */
389    GtkWidget *vbox = gtk_vbox_new(FALSE, 0);    GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
390    
391    char *hint = strdup(cache->hint);    char *hint = strdup(cache->hint);
392    rot13(hint);    rot13(hint);
393    GtkWidget *view = html_view(appdata, hint, FALSE, TRUE, NULL, NULL);    GtkWidget *view =
394        html_view(appdata, hint, HTML_PLAIN_TEXT, TRUE, NULL, NULL);
395    gtk_box_pack_start_defaults(GTK_BOX(vbox), view);    gtk_box_pack_start_defaults(GTK_BOX(vbox), view);
396    free(hint);    free(hint);
397    
# Line 346  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));
            gpx_pos_get_bearing(*refpos, wpt->pos));  
     gtk_box_pack_start_defaults(GTK_BOX(ihbox), GTK_LABEL_SMALL(str));  
     gpx_pos_get_distance_str(str, sizeof(str),  
                              *refpos, wpt->pos, appdata->imperial);  
     gtk_box_pack_start(GTK_BOX(ihbox), GTK_LABEL_SMALL(str),1,0,0);  
   
     gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 3,4,  
                               wpt_row+0, wpt_row+1);  
   
     /* ------------------ description ------------------------- */  
     if(wpt->desc) {  
       GtkTextBuffer *buffer = gtk_text_buffer_new(NULL);  
       gtk_text_buffer_set_text(buffer, wpt->desc, strlen(wpt->desc));  
   
 #ifndef USE_HILDON_TEXT_VIEW  
       GtkWidget *textview = gtk_text_view_new_with_buffer(buffer);  
 #else  
       GtkWidget *textview = hildon_text_view_new();  
       hildon_text_view_set_buffer(HILDON_TEXT_VIEW(textview), buffer);  
 #endif  
462    
463        gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_WORD);        gpx_pos_get_distance_str(str, sizeof(str),
464        gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE);                                 *refpos, wpt->pos, appdata->imperial);
465        gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textview), FALSE);        gtk_box_pack_start(GTK_BOX(ihbox), GTK_LABEL_SMALL(str),1,0,0);
466    
467          gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 3,4,
468                                    wpt_row+0, wpt_row+1);
469        }
470    
471        gtk_table_attach_defaults(GTK_TABLE(table), textview, 0,4,      /* ------------------ description ------------------------- */
472        if(wpt->desc)
473          gtk_table_attach_defaults(GTK_TABLE(table),
474                                    simple_text_widget(wpt->desc), 0,4,
475                                  wpt_row+1, wpt_row+2);                                  wpt_row+1, wpt_row+2);
     }  
476    
477      /* ------------------ comment ------------------------- */      /* ------------------ comment ------------------------- */
478      if(wpt->cmt) {      if(wpt->cmt)
479        GtkTextBuffer *buffer = gtk_text_buffer_new(NULL);        gtk_table_attach_defaults(GTK_TABLE(table),
480        gtk_text_buffer_set_text(buffer, wpt->cmt, strlen(wpt->cmt));                                  simple_text_widget(wpt->cmt), 0,4,
 #ifndef USE_HILDON_TEXT_VIEW  
       GtkWidget *textview = gtk_text_view_new_with_buffer(buffer);  
 #else  
       GtkWidget *textview = hildon_text_view_new();  
       hildon_text_view_set_buffer(HILDON_TEXT_VIEW(textview), buffer);  
 #endif  
       gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_WORD);  
       gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE);  
       gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textview), FALSE);  
   
       gtk_table_attach_defaults(GTK_TABLE(table), textview, 0,4,  
481                                  wpt_row+2, wpt_row+3);                                  wpt_row+2, wpt_row+3);
     }  
482    
483      /* --------------------- seperator -------------------------*/      /* --------------------- seperator -------------------------*/
484      if(wpt->next)      if(wpt->next) {
485          gtk_table_set_row_spacing(GTK_TABLE(table), wpt_row+2, 8);
486        gtk_table_attach_defaults(GTK_TABLE(table), gtk_hseparator_new(), 0,4,        gtk_table_attach_defaults(GTK_TABLE(table), gtk_hseparator_new(), 0,4,
487                                  wpt_row+3, wpt_row+4);                                  wpt_row+3, wpt_row+4);
488          gtk_table_set_row_spacing(GTK_TABLE(table), wpt_row+3, 8);
489        }
490    
491      wpt_row+=4;      wpt_row+=4;
492      wpt = wpt->next;      wpt = wpt->next;
# Line 442  static GtkWidget *cache_tbs(appdata_t *a Line 525  static GtkWidget *cache_tbs(appdata_t *a
525    
526    int tb_row=0;    int tb_row=0;
527    while(tb) {    while(tb) {
528        static const char *tb_type = "track/details.aspx";
529    
530      /* --------------------- icon/ref/name -------------------------*/      /* --------------------- icon/ref/name -------------------------*/
531      gtk_table_attach_defaults(GTK_TABLE(table), icon_get_widget(ICON_TB, 0),      GtkWidget *icon = NULL;
532        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 */
536        else
537          icon = icon_get_widget(ICON_TB, 0);   /* tb icon */
538    
539        gtk_table_attach_defaults(GTK_TABLE(table), icon,
540                                0, 1, tb_row+0, tb_row+1);                                0, 1, tb_row+0, tb_row+1);
541      if(tb->ref)  
542        gtk_table_attach_defaults(GTK_TABLE(table), GTK_LABEL_BIG(tb->ref),      if(tb->ref) {
543          GtkWidget *ref = link_button_by_id(appdata, tb->ref, tb_type, tb->id);
544          gtk_table_attach_defaults(GTK_TABLE(table), ref,
545                                  1, 2, tb_row+0, tb_row+1);                                  1, 2, tb_row+0, tb_row+1);
546        }
547    
548      if(tb->name)      if(tb->name)
549        gtk_table_attach_defaults(GTK_TABLE(table), GTK_LABEL_BIG(tb->name),        gtk_table_attach_defaults(GTK_TABLE(table), GTK_LABEL_BIG(tb->name),
550                                  2, 3, tb_row+0, tb_row+1);                                  2, 3, tb_row+0, tb_row+1);
# Line 482  static void on_gclink_clicked(GtkButton Line 579  static void on_gclink_clicked(GtkButton
579  }  }
580  #endif  #endif
581    
582  static GtkWidget *cache_logs(appdata_t *appdata, cache_context_t *context, log_t *log, int is_html) {  static GtkWidget *cache_logs(appdata_t *appdata, cache_context_t *context,
583                                 log_t *log, int is_html) {
584  #ifndef  USE_PANNABLE_AREA  #ifndef  USE_PANNABLE_AREA
585    /* put this inside a scrolled view */    /* put this inside a scrolled view */
586    GtkWidget *scrolled_window = gtk_scrolled_window_new(NULL, NULL);    GtkWidget *scrolled_window = gtk_scrolled_window_new(NULL, NULL);
# Line 498  static GtkWidget *cache_logs(appdata_t * Line 596  static GtkWidget *cache_logs(appdata_t *
596  #define gc_link (FALSE)  #define gc_link (FALSE)
597  #endif  #endif
598    
599    GtkWidget *table = gtk_table_new(4*gpx_number_of_logs(log)+(gc_link?1:0), 3, FALSE);    GtkWidget *vbox = gtk_vbox_new(FALSE, 6);
   int cnt = 0;  
600    
601  #ifdef ENABLE_BROWSER_INTERFACE  #ifdef ENABLE_BROWSER_INTERFACE
602    if(gc_link) {    if(gc_link) {
603      GtkWidget *but = gtk_button_new_with_label(_("Post a new log entry for this geocache"));      GtkWidget *but =
604          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 511  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_table_attach_defaults(GTK_TABLE(table), but, 0, 3, 0, 1);      gtk_box_pack_start(GTK_BOX(vbox), but, FALSE, FALSE, 0);
     cnt++;  
618    }    }
619  #endif  #endif
620    
621      int logs = gpx_number_of_logs(log);
622      GtkWidget *table = gtk_table_new(2*logs-1, 2,FALSE);
623      int log_cnt = 0;
624    
625      gtk_table_set_col_spacing(GTK_TABLE(table), 0, 8);
626    
627    /* add all logs to the vbox */    /* add all logs to the vbox */
628    while(log) {    while(log) {
629      gtk_table_attach_defaults(GTK_TABLE(table), gtk_hseparator_new(),      GtkWidget *ivbox = gtk_vbox_new(FALSE, 2);
630                                0, 3, cnt+0, cnt+1);      GtkWidget *ihbox = gtk_hbox_new(FALSE, 2);
631      gtk_table_attach_defaults(GTK_TABLE(table),  
632                                icon_get_widget(ICON_LOG, log->type),      static const char *finder_type = "profile/";
633                                0, 1, cnt+1, cnt+2);      GtkWidget *finder = link_button_by_id(appdata, log->finder->name,
634                                              finder_type, log->finder->id);
635    
636        /* if the finder is a button make sure it's the right size and */
637        /* does not exceed the size limits */
638        if(GTK_WIDGET_TYPE(finder) == GTK_TYPE_BUTTON) {
639    #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5)
640          hildon_gtk_widget_set_theme_size(finder,
641                       (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));
642    #endif
643    
644        gtk_label_set_ellipsize(GTK_LABEL(gtk_bin_get_child(GTK_BIN(finder))),
645                                  PANGO_ELLIPSIZE_END);
646        } else
647          gtk_label_set_ellipsize(GTK_LABEL(finder), PANGO_ELLIPSIZE_END);
648    
649        gtk_box_pack_start(GTK_BOX(ivbox), finder, FALSE, FALSE, 0);
650    
651        gtk_box_pack_start_defaults(GTK_BOX(ihbox),
652                  icon_get_widget(ICON_LOG, log->type));
653    
654      char date_str[32];      char date_str[32];
655      if(log->day && log->month && log->year) {      if(log->day && log->month && log->year) {
# Line 532  static GtkWidget *cache_logs(appdata_t * Line 659  static GtkWidget *cache_logs(appdata_t *
659      } else      } else
660        strcpy(date_str, "---");        strcpy(date_str, "---");
661    
662      gtk_table_attach_defaults(GTK_TABLE(table), gtk_label_new(date_str),      gtk_box_pack_start_defaults(GTK_BOX(ihbox), gtk_label_new(date_str));
663                                1, 2, cnt+1, cnt+2);  
664        gtk_box_pack_start(GTK_BOX(ivbox), ihbox, FALSE, FALSE, 0);
665    
666      gtk_table_attach_defaults(GTK_TABLE(table), gtk_label_new(log->finder),      gtk_table_attach(GTK_TABLE(table), ivbox, 0, 1,
667                                2, 3, cnt+1, cnt+2);                       2*log_cnt, 2*log_cnt+1, 0, GTK_EXPAND | GTK_FILL, 0, 0);
     gtk_table_attach_defaults(GTK_TABLE(table), gtk_hseparator_new(),  
                               0, 3, cnt+2, cnt+3);  
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, is_html, FALSE, NULL, NULL),          html_view(appdata, log->text,
672                  0, 3, cnt+3, cnt+4);                    is_html?HTML_HTML:HTML_CUSTOM_MARKUP, FALSE, NULL, NULL),
673                                    1, 2, 2*log_cnt, 2*log_cnt+1);
674        }
675    
676        if(log_cnt < logs-1) {
677          gtk_table_set_row_spacing(GTK_TABLE(table), 2*log_cnt, 8);
678    
679          gtk_table_attach_defaults(GTK_TABLE(table), gtk_hseparator_new(),
680                                    0, 2, 2*log_cnt+1, 2*log_cnt+2);
681    
682          gtk_table_set_row_spacing(GTK_TABLE(table), 2*log_cnt+1, 8);
683      }      }
684    
685      log = log->next;      log = log->next;
686      cnt+=4;      log_cnt++;
687    }    }
688    
689      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),
693                                          table);                                          vbox);
694    return scrolled_window;    return scrolled_window;
695  #else  #else
696    hildon_pannable_area_add_with_viewport(HILDON_PANNABLE_AREA(pannable_area),    hildon_pannable_area_add_with_viewport(HILDON_PANNABLE_AREA(pannable_area),
697                                           table);                                           vbox);
698    return pannable_area;    return pannable_area;
699  #endif  #endif
700  }  }
# Line 590  static void on_notebook_page_change(GtkN Line 728  static void on_notebook_page_change(GtkN
728    
729    /* this is a workaround, around some bug in the gtktextwidget or so ... */    /* this is a workaround, around some bug in the gtktextwidget or so ... */
730    /* i tried to get info on this and everybody agreed that this is a bug */    /* i tried to get info on this and everybody agreed that this is a bug */
731    /* in gtk but noone had a read fix. so i came up with this. */    /* in gtk but noone had a fix ready. so i came up with this. */
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);
735    }    } else if(strcasecmp(name, _("Goto")) == 0) {
   
   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 616  static void on_notebook_destroy(GtkWidge Line 753  static void on_notebook_destroy(GtkWidge
753    
754    printf("destroying notebook\n");    printf("destroying notebook\n");
755    
756      /* cancel a pending gcvote request */
757      if(context->gcvote_request) {
758        gcvote_request_free(context->gcvote_request);
759        context->gcvote_request = NULL;
760      }
761    
762    notes_destroy_event(NULL, context);    notes_destroy_event(NULL, context);
763    goto_destroy_event(NULL, context);    goto_destroy_event(NULL, context);
764    
# Line 627  static void on_notebook_destroy(GtkWidge Line 770  static void on_notebook_destroy(GtkWidge
770    free(user_data);    free(user_data);
771  }  }
772    
773    #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)
774    #define CUSTOM_NOTEBOOK
775    #endif
776    
777    static GtkWidget *notebook_new(void) {
778    #ifdef CUSTOM_NOTEBOOK
779      GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
780    
781      GtkWidget *notebook =  gtk_notebook_new();
782    
783      /* prevents user from accidentially touching the breadcrumb trail */
784      /* (looks ugly on fremantle as it isn't themed) */
785      //  gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_BOTTOM);
786    
787      /* solution for fremantle: we use a row of ordinary buttons instead */
788      /* of regular tabs */
789    
790      /* hide the regular tabs */
791      gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
792    
793      gtk_box_pack_start_defaults(GTK_BOX(vbox), notebook);
794    
795      /* store a reference to the notebook in the vbox */
796      g_object_set_data(G_OBJECT(vbox), "notebook", (gpointer)notebook);
797    
798      /* create a hbox for the buttons */
799      GtkWidget *hbox = gtk_hbox_new(TRUE, 0);
800      gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
801      g_object_set_data(G_OBJECT(vbox), "hbox", (gpointer)hbox);
802    
803      return vbox;
804    #else
805      return gtk_notebook_new();
806    #endif
807    }
808    
809    #ifdef CUSTOM_NOTEBOOK
810    static void on_notebook_button_clicked(GtkWidget *button, gpointer data) {
811      GtkNotebook *nb =
812        GTK_NOTEBOOK(g_object_get_data(G_OBJECT(data), "notebook"));
813    
814      gint page = (gint)g_object_get_data(G_OBJECT(button), "page");
815      gtk_notebook_set_current_page(nb, page);
816    }
817    #endif
818    
819    static void notebook_append_page(GtkWidget *notebook,
820                                     GtkWidget *page, char *label) {
821    #ifdef CUSTOM_NOTEBOOK
822      GtkNotebook *nb =
823        GTK_NOTEBOOK(g_object_get_data(G_OBJECT(notebook), "notebook"));
824    
825      gint page_num = gtk_notebook_append_page(nb, page, gtk_label_new(label));
826      GtkWidget *button = NULL;
827    
828      /* select button for page 0 by default */
829      if(!page_num) {
830        button = gtk_radio_button_new_with_label(NULL, label);
831        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
832        g_object_set_data(G_OBJECT(notebook), "group_master", (gpointer)button);
833      } else {
834        GtkWidget *master = g_object_get_data(G_OBJECT(notebook), "group_master");
835        button = gtk_radio_button_new_with_label_from_widget(
836                                     GTK_RADIO_BUTTON(master), label);
837      }
838    
839      gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button), FALSE);
840      g_object_set_data(G_OBJECT(button), "page", (gpointer)page_num);
841    
842      gtk_signal_connect(GTK_OBJECT(button), "clicked",
843               GTK_SIGNAL_FUNC(on_notebook_button_clicked), notebook);
844    
845    #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5)
846      hildon_gtk_widget_set_theme_size(button,
847               (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));
848    #endif
849    
850      gtk_box_pack_start_defaults(
851         GTK_BOX(g_object_get_data(G_OBJECT(notebook), "hbox")),
852         button);
853    
854    #else
855      gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page, gtk_label_new(label));
856    #endif
857    }
858    
859    static GObject *notebook_object(GtkWidget *notebook) {
860    #ifdef CUSTOM_NOTEBOOK
861      return G_OBJECT(g_object_get_data(G_OBJECT(notebook), "notebook"));
862    #else
863      return G_OBJECT(notebook);
864    #endif
865    }
866    
867  GtkWidget *cache_view(appdata_t *appdata, cache_t *cache) {  GtkWidget *cache_view(appdata_t *appdata, cache_t *cache) {
868    GtkWidget *notebook;    GtkWidget *notebook;
869    
# Line 643  GtkWidget *cache_view(appdata_t *appdata Line 880  GtkWidget *cache_view(appdata_t *appdata
880  #define TAB_WPTS   _("Waypoints")  #define TAB_WPTS   _("Waypoints")
881  #endif  #endif
882    
883    notebook =  gtk_notebook_new();    notebook = notebook_new();
 #ifdef USE_MAEMO  
 #if MAEMO_VERSION_MAJOR >= 5  
   /* prevents user from accidentially touching the breadcrumb trail */  
   gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_BOTTOM);  
 #endif  
 #endif  
884    
885    gtk_notebook_append_page(GTK_NOTEBOOK(notebook),    notebook_append_page(notebook,
886         cache_overview(cache_context), gtk_label_new(_("Main")));         cache_overview(cache_context), _("Main"));
887    
888    if(cache->long_description)    if(cache->long_description)
889      gtk_notebook_append_page(GTK_NOTEBOOK(notebook),      notebook_append_page(notebook,
890             cache_description(appdata, cache), gtk_label_new(TAB_DESC));             cache_description(appdata, cache), TAB_DESC);
891    
892    if(cache->hint)    if(cache->hint)
893      gtk_notebook_append_page(GTK_NOTEBOOK(notebook),      notebook_append_page(notebook,
894             cache_hint(appdata, cache), gtk_label_new(_("Hint")));             cache_hint(appdata, cache), _("Hint"));
895    
896    if(cache->log)    if(cache->log)
897      gtk_notebook_append_page(GTK_NOTEBOOK(notebook),      notebook_append_page(notebook,
898       cache_logs(appdata, cache_context, cache->log, cache->logs_are_html),       cache_logs(appdata, cache_context, cache->log, cache->logs_are_html),
899             gtk_label_new(_("Logs")));             _("Logs"));
900    
901    if(cache->wpt)    if(cache->wpt)
902      gtk_notebook_append_page(GTK_NOTEBOOK(notebook),      notebook_append_page(notebook,
903               cache_wpts(appdata, cache->wpt), gtk_label_new(TAB_WPTS));               cache_wpts(appdata, cache->wpt), TAB_WPTS);
904    
905    if(cache->tb)    if(cache->tb)
906      gtk_notebook_append_page(GTK_NOTEBOOK(notebook),      notebook_append_page(notebook,
907               cache_tbs(appdata, cache->tb), gtk_label_new(_("TBs")));               cache_tbs(appdata, cache->tb), _("TBs"));
908    
909    gtk_notebook_append_page(GTK_NOTEBOOK(notebook),    notebook_append_page(notebook,
910             cache_notes(cache_context), gtk_label_new(_("Notes")));             cache_notes(cache_context), _("Notes"));
911    
912    gtk_notebook_append_page(GTK_NOTEBOOK(notebook),    notebook_append_page(notebook,
913             goto_cache(cache_context), gtk_label_new(_("Goto")));             goto_cache(cache_context), _("Goto"));
914    
915    g_signal_connect(G_OBJECT(notebook), "switch-page",    g_signal_connect(notebook_object(notebook), "switch-page",
916             G_CALLBACK(on_notebook_page_change), cache_context);             G_CALLBACK(on_notebook_page_change), cache_context);
917    
918    g_signal_connect(G_OBJECT(notebook), "destroy",    g_signal_connect(notebook_object(notebook), "destroy",
919             G_CALLBACK(on_notebook_destroy), cache_context);             G_CALLBACK(on_notebook_destroy), cache_context);
920    
921    return notebook;    return notebook;

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