Diff of /trunk/src/cache.c

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

revision 158 by harbaum, Wed Nov 4 14:54:52 2009 UTC revision 221 by harbaum, Mon Nov 30 21:28:04 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,
# 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];    lat_label_attrib_set(context->pos_lat_label,
87    pos_lat_str(str, sizeof(str), context->cache->pos.lat);                         context->cache->pos.lat, SIZE_BIG, strike);
88    gtk_label_attrib_set(context->pos_lat_label, str, SIZE_BIG, strike);    lon_label_attrib_set(context->pos_lon_label,
89    pos_lon_str(str, sizeof(str), context->cache->pos.lon);                         context->cache->pos.lon, SIZE_BIG, strike);
90    gtk_label_attrib_set(context->pos_lon_label, str, SIZE_BIG, strike);  
   
91    /* remove enire hbox and build a new one */    /* remove enire hbox and build a new one */
92    gtk_container_foreach(GTK_CONTAINER(context->bearing_hbox),    gtk_container_foreach(GTK_CONTAINER(context->bearing_hbox),
93                          (GtkCallback)gtk_widget_destroy, NULL);                          (GtkCallback)gtk_widget_destroy, NULL);
94    
95    /* update distance/etc */    /* update distance/etc */
96    if(!isnan(context->cache->pos.lat) &&    if(!isnan(context->cache->pos.lat) &&
97       !isnan(context->cache->pos.lon))       !isnan(context->cache->pos.lon))
98      bearing_fill_hbox(context->bearing_hbox, context->appdata,      bearing_fill_hbox(context->bearing_hbox, context->appdata,
99                        *get_pos(context->appdata), notes_get_pos(context));                        *get_pos(context->appdata), notes_get_pos(context));
100    
101    gtk_widget_show_all(context->bearing_hbox);    gtk_widget_show_all(context->bearing_hbox);
102  }  }
103    
104  static void gcvote_callback(vote_t *vote, gpointer data) {  static void gcvote_set(cache_context_t *context, vote_t *vote) {
105    cache_context_t *context = (cache_context_t*)data;    if(!vote) return;
106    
107    /* no vote returned: request failed, just cleanup */    if(context->quality) {
108    if(!vote) {      gtk_widget_destroy(context->quality);
109      printf("gcvote callback for failed request\n");      context->quality = NULL;
110      }
111      gcvote_request_free(context->gcvote_request);  
112      context->gcvote_request = NULL;    if(context->votes) {
113      return FALSE;      gtk_widget_destroy(context->votes);
114    }      context->votes = NULL;
115      }
116    printf("gcvote callback is being called with a %d/%d\n",  
          vote->quality, vote->votes);  
   
117    /* update/draw the voting */    /* update/draw the voting */
   if(!context->quality) {  
118  #ifndef USE_MAEMO  #ifndef USE_MAEMO
119      GtkTooltips *tips = gtk_tooltips_new();    GtkTooltips *tips = gtk_tooltips_new();
120  #endif  #endif
121    
122      GtkWidget *ivbox = gtk_vbox_new(FALSE, 0);    char *votes_str = g_strdup_printf(_("Quality (%d %s):"), vote->votes,
123                                        (vote->votes == 1)?_("vote"):_("votes"));
124      char *votes_str = g_strdup_printf(_("Quality (%d %s):"), vote->votes,    context->votes = GTK_LABEL_SMALL(votes_str);
125                                        (vote->votes == 1)?_("vote"):_("votes"));    gtk_box_pack_start(GTK_BOX(context->votebox),
126      context->votes = GTK_LABEL_SMALL(votes_str);                       context->votes, FALSE, FALSE, 0);
127      gtk_box_pack_start(GTK_BOX(ivbox), context->votes, FALSE, FALSE, 0);    g_free(votes_str);
128      g_free(votes_str);    context->quality = icon_get_widget(ICON_STARS, (int)(vote->quality*2-2));
129      context->quality = icon_get_widget(ICON_STARS, (int)(vote->quality*2-2));    gtk_box_pack_start(GTK_BOX(context->votebox), context->quality,
130      gtk_box_pack_start(GTK_BOX(ivbox), context->quality,                       FALSE, FALSE, 0);
131                                 FALSE, FALSE, 0);  
   
     GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);  
     gtk_container_add(GTK_CONTAINER(align), ivbox);  
     gtk_box_pack_start_defaults(GTK_BOX(context->ratebox), align);  
132  #ifndef USE_MAEMO  #ifndef USE_MAEMO
133      char *str = g_strdup_printf(_("Quality: %d"), vote->quality);    char *str = g_strdup_printf(_("Quality: %d"), vote->quality);
134      gtk_tooltips_set_tip(tips, ivbox, str, NULL);    gtk_tooltips_set_tip(tips, context->votebox, str, NULL);
135      g_free(str);    g_free(str);
136  #endif  #endif
137    
138      gtk_widget_show_all(context->votebox);
139    
140      gtk_widget_show_all(context->ratebox);    g_free(vote);
141    }
142    
143    static void gcvote_callback(vote_t *vote, gpointer data) {
144      cache_context_t *context = (cache_context_t*)data;
145    
146      /* no vote returned: request failed, just cleanup */
147      if(!vote) {
148        printf("gcvote: callback for failed request\n");
149    
150      gcvote_request_free(context->gcvote_request);      gcvote_request_free(context->gcvote_request);
151      context->gcvote_request = NULL;      context->gcvote_request = NULL;
152        return;
153    }    }
154    
155      printf("gcvote: callback is being called with a %d/%d\n",
156             vote->quality, vote->votes);
157    
158      gcvote_set(context, vote);
159    
160      gcvote_save(context->appdata, context->cache, &context->gcvote_request->mem);
161    
162      gcvote_request_free(context->gcvote_request);
163      context->gcvote_request = NULL;
164  }  }
165    
166    static void pack_vcentered(GtkWidget *vbox, GtkWidget *child) {
167      GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
168      gtk_container_add(GTK_CONTAINER(align), child);
169      gtk_box_pack_start_defaults(GTK_BOX(vbox), align);
170    }
171    
172    #ifdef FREMANTLE
173    #define ICON_SIZE  ICON_CACHE_TYPE_2X
174    #else
175    #define ICON_SIZE  ICON_CACHE_TYPE_1_5X
176    #endif
177    
178  static GtkWidget *cache_overview(cache_context_t *context) {  static GtkWidget *cache_overview(cache_context_t *context) {
179    GtkWidget *vbox, *ivbox;    GtkWidget *vbox, *ivbox;
180    GtkWidget *table, *tip;    GtkWidget *colbox, *tip;
181    char str[64];    char str[64];
182  #ifndef USE_MAEMO  #ifndef USE_MAEMO
183    GtkTooltips *tips = gtk_tooltips_new();    GtkTooltips *tips = gtk_tooltips_new();
184  #endif  #endif
185    appdata_t *appdata = context->appdata;    appdata_t *appdata = context->appdata;
186    cache_t *cache = context->cache;    cache_t *cache = context->cache;
187    
188    vbox = gtk_vbox_new(FALSE, 0);    vbox = gtk_vbox_new(FALSE, 4);
189    
190    table =  gtk_table_new(3,4, FALSE);    /* hbox containing the four columns of cache details */
191      GtkWidget *ihbox = gtk_hbox_new(FALSE, 0);
192    
193      /* vbox containing leftmost column (icon and container) */
194      colbox = gtk_vbox_new(FALSE, 0);
195    
196    if(cache->type != CACHE_TYPE_UNKNOWN) {    if(cache->type != CACHE_TYPE_UNKNOWN) {
197      gtk_table_attach(GTK_TABLE(table),      gtk_box_pack_start_defaults(GTK_BOX(colbox),
198               tip = icon_get_widget(ICON_CACHE_TYPE, cache->type), 0,1,0,1,          tip = icon_get_widget(ICON_SIZE, cache->type));
199               GTK_FILL, 0, GTK_FILL, 0);  
200  #ifndef USE_MAEMO  #ifndef USE_MAEMO
201      gtk_tooltips_set_tip(tips, tip, _(cache_type_tip[cache->type]), NULL);      gtk_tooltips_set_tip(tips, tip, _(cache_type_tip[cache->type]), NULL);
202  #endif  #endif
203    }    }
204    
205    /* ------------ box containing container info ------------ */    /* ------------ box containing container info ------------ */
206    if(cache->container != CACHE_CONT_UNKNOWN) {    if(cache->container != CACHE_CONT_UNKNOWN) {
207      ivbox = gtk_vbox_new(FALSE, 0);      ivbox = gtk_vbox_new(FALSE, 0);
# Line 180  static GtkWidget *cache_overview(cache_c Line 211  static GtkWidget *cache_overview(cache_c
211      gtk_box_pack_start(GTK_BOX(ivbox),      gtk_box_pack_start(GTK_BOX(ivbox),
212                         icon_get_widget(ICON_CACHE_SIZE, cache->container),                         icon_get_widget(ICON_CACHE_SIZE, cache->container),
213                         FALSE, FALSE, 0);                         FALSE, FALSE, 0);
214      gtk_table_attach(GTK_TABLE(table), ivbox, 0,1,1,2,  
215                       GTK_EXPAND | GTK_FILL, 0, GTK_FILL, 0);      pack_vcentered(colbox, ivbox);
216  #ifndef USE_MAEMO  #ifndef USE_MAEMO
217      gtk_tooltips_set_tip(tips, ivbox, _(cache_size_tip[cache->container]), NULL);      gtk_tooltips_set_tip(tips, ivbox, _(cache_size_tip[cache->container]), NULL);
218  #endif  #endif
219    }    }
220    
221      gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox);
222      colbox = gtk_vbox_new(FALSE, 0);
223    
224    /* ----------------------- id ---------------------------- */    /* ----------------------- id ---------------------------- */
225    if(cache->id) {    if(cache->id) {
226      int strike = cache->archived?STRIKETHROUGH_RED:      int strike = cache->archived?STRIKETHROUGH_RED:
# Line 194  static GtkWidget *cache_overview(cache_c Line 228  static GtkWidget *cache_overview(cache_c
228      GtkWidget *lbl = link_button_attrib(context->appdata,      GtkWidget *lbl = link_button_attrib(context->appdata,
229                                          cache->id, context->cache->url,                                          cache->id, context->cache->url,
230                                          SIZE_BIG, strike);                                          SIZE_BIG, strike);
231      gtk_table_attach(GTK_TABLE(table), lbl, 1,2,0,1, FALSE, FALSE, 0, 0);      pack_vcentered(colbox, lbl);
232    }    }
233    
234    /* --------------- box containing owner info ------------- */    /* --------------- box containing owner info ------------- */
235    if(cache->owner) {    if(cache->owner) {
236      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")));  
237    
238      static const char *owner_type = "profile/";      static const char *owner_type = "profile/";
239      gtk_box_pack_start_defaults(GTK_BOX(ivbox),      pack_vcentered(colbox,
240                  link_button_by_id(appdata, cache->owner->name,                  link_button_by_id(appdata, cache->owner->name,
241                                    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);  
242    }    }
243    
244      gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox);
245    
246    /* ----------- vbox containing all ratings ---------- */    /* ----------- vbox containing all ratings ---------- */
247    GtkWidget *ratebox = context->ratebox = gtk_vbox_new(FALSE, 0);    colbox = gtk_vbox_new(FALSE, 0);
248    
249    /* ----------- box containing difficulty rating ---------- */    /* ----------- box containing difficulty rating ---------- */
250    if(cache->difficulty != 0) {    if(cache->difficulty != 0) {
# Line 222  static GtkWidget *cache_overview(cache_c Line 256  static GtkWidget *cache_overview(cache_c
256                    icon_get_widget(ICON_STARS, (int)(cache->difficulty*2-2)),                    icon_get_widget(ICON_STARS, (int)(cache->difficulty*2-2)),
257                         FALSE, FALSE, 0);                         FALSE, FALSE, 0);
258    
259      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);  
260  #ifndef USE_MAEMO  #ifndef USE_MAEMO
261      sprintf(str, _("Difficulty: %.1f"), cache->difficulty);      sprintf(str, _("Difficulty: %.1f"), cache->difficulty);
262      gtk_tooltips_set_tip(tips, ivbox, str, NULL);      gtk_tooltips_set_tip(tips, ivbox, str, NULL);
# Line 239  static GtkWidget *cache_overview(cache_c Line 271  static GtkWidget *cache_overview(cache_c
271      gtk_box_pack_start(GTK_BOX(ivbox),      gtk_box_pack_start(GTK_BOX(ivbox),
272                         icon_get_widget(ICON_STARS, (int)(cache->terrain*2-2)),                         icon_get_widget(ICON_STARS, (int)(cache->terrain*2-2)),
273                         FALSE, FALSE, 0);                         FALSE, FALSE, 0);
274      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);  
275  #ifndef USE_MAEMO  #ifndef USE_MAEMO
276      sprintf(str, _("Terrain: %.1f"), cache->terrain);      sprintf(str, _("Terrain: %.1f"), cache->terrain);
277      gtk_tooltips_set_tip(tips, ivbox, str, NULL);      gtk_tooltips_set_tip(tips, ivbox, str, NULL);
# Line 249  static GtkWidget *cache_overview(cache_c Line 279  static GtkWidget *cache_overview(cache_c
279    }    }
280    
281    /* --------------------- GCVote ------------------------ */    /* --------------------- GCVote ------------------------ */
282    /* gcvote if present and possible */    if(!appdata->disable_gcvote) {
283        vote_t *vote = gcvote_restore(appdata, cache);
   context->gcvote_request =  
     gcvote_request(appdata, gcvote_callback, cache->url, context);  
284    
285  #if 0      context->gcvote_request =
286    vote_t *vote = gcvote_get(appdata, cache->url);        gcvote_request(appdata, gcvote_callback, cache->url, context);
   if(vote) {  
     ivbox = gtk_vbox_new(FALSE, 0);  
   
     char *votes_str = g_strdup_printf(_("Quality (%d %s):"), vote->votes,  
                                       (vote->votes == 1)?_("vote"):_("votes"));  
     gtk_box_pack_start(GTK_BOX(ivbox), GTK_LABEL_SMALL(votes_str),  
                        FALSE, FALSE, 0);  
     g_free(votes_str);  
     gtk_box_pack_start(GTK_BOX(ivbox),  
          icon_get_widget(ICON_STARS, (int)(vote->quality*2-2)), FALSE, FALSE, 0);  
287    
288      GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);      context->votebox = gtk_vbox_new(FALSE, 0);
289      gtk_container_add(GTK_CONTAINER(align), ivbox);      pack_vcentered(colbox, context->votebox);
     gtk_box_pack_start_defaults(GTK_BOX(ratebox), align);  
 #ifndef USE_MAEMO  
     sprintf(str, _("Quality: %d"), vote->quality);  
     gtk_tooltips_set_tip(tips, ivbox, str, NULL);  
 #endif  
290    
291      gcvote_free(vote);      /* fill with vote if present on disk (will also free vote) */
292        if(vote)
293          gcvote_set(context, vote);
294    }    }
 #endif  
295    
296    gtk_table_attach_defaults(GTK_TABLE(table), ratebox, 2,3,0,2);    gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox);
297    
298    /* ----------------------------------------------------- */    /* ----------------------------------------------------- */
299    
300    
301    /* ----------------- the two coordinates ----------------- */    /* ----------------- the two coordinates ----------------- */
302    /* ----------------- and the heading/distance ------------ */    /* ----------------- and the heading/distance ------------ */
303      colbox = gtk_vbox_new(FALSE, 0);
304    
305    pos_t *refpos = get_pos(appdata);    pos_t *refpos = get_pos(appdata);
306    
307    ivbox = gtk_vbox_new(FALSE, 0);    ivbox = gtk_vbox_new(FALSE, 0);
# Line 293  static GtkWidget *cache_overview(cache_c Line 309  static GtkWidget *cache_overview(cache_c
309                    STRIKETHROUGH:STRIKETHROUGH_NONE;                    STRIKETHROUGH:STRIKETHROUGH_NONE;
310    
311    /* the original coordinate is being displayed */    /* the original coordinate is being displayed */
312    gtk_box_pack_start_defaults(GTK_BOX(ivbox),    gtk_box_pack_start(GTK_BOX(ivbox),
313         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);
314    gtk_box_pack_start_defaults(GTK_BOX(ivbox),    gtk_box_pack_start(GTK_BOX(ivbox),
315         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);
316    
317      pack_vcentered(colbox, ivbox);
318    
319    /* but calculations may be done with respect to the overriden one */    /* but calculations may be done with respect to the overriden one */
320    if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) {    if(!isnan(cache->pos.lat) && !isnan(cache->pos.lon)) {
321      context->bearing_hbox = gtk_hbox_new(FALSE, 0);      context->bearing_hbox = gtk_hbox_new(FALSE, 0);
322      bearing_fill_hbox(context->bearing_hbox, appdata, *refpos,      bearing_fill_hbox(context->bearing_hbox, appdata, *refpos,
323                        gpx_cache_pos(cache));                        gpx_cache_pos(cache));
324      gtk_box_pack_start_defaults(GTK_BOX(ivbox), context->bearing_hbox);      pack_vcentered(colbox, context->bearing_hbox);
325    }    }
326    
327    gtk_table_attach_defaults(GTK_TABLE(table), ivbox, 3,4,0,2);    gtk_box_pack_start_defaults(GTK_BOX(ihbox), colbox);
328    
329    /* ----------------------------------------------------- */    /* ----------------------------------------------------- */
330    
331    gtk_box_pack_start(GTK_BOX(vbox), table, 0,0,0);    gtk_box_pack_start(GTK_BOX(vbox), ihbox, FALSE, FALSE, 0);
332    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);
333    
334    /* ----------------------------------------------------- */    /* ----------------------------------------------------- */
335    
# Line 433  static GtkWidget *cache_wpts(appdata_t * Line 451  static GtkWidget *cache_wpts(appdata_t *
451                        pos_lon(wpt->pos.lon, SIZE_BIG, STRIKETHROUGH_NONE),                        pos_lon(wpt->pos.lon, SIZE_BIG, STRIKETHROUGH_NONE),
452                        2,3, wpt_row, wpt_row+1);                        2,3, wpt_row, wpt_row+1);
453    
454      ihbox = gtk_hbox_new(FALSE, 0);      if(refpos && !isnan(refpos->lat) && !isnan(refpos->lon)) {
455      gtk_box_pack_start(GTK_BOX(ihbox), gtk_image_new_from_pixbuf(        ihbox = gtk_hbox_new(FALSE, 0);
456          gtk_box_pack_start(GTK_BOX(ihbox), gtk_image_new_from_pixbuf(
457                             icon_bearing(*refpos, wpt->pos)),1,0,0);                             icon_bearing(*refpos, wpt->pos)),1,0,0);
458      gtk_box_pack_start_defaults(GTK_BOX(ihbox),        snprintf(str, sizeof(str), _("%.1f°"),
459            GTK_LABEL_SMALL((char*)pos_get_bearing_str(*refpos, wpt->pos)));                 gpx_pos_get_bearing(*refpos, wpt->pos));
460      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  
461    
462        gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), GTK_WRAP_WORD);        gpx_pos_get_distance_str(str, sizeof(str),
463        gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE);                                 *refpos, wpt->pos, appdata->imperial);
464        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);
465    
466          gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 3,4,
467                                    wpt_row+0, wpt_row+1);
468        }
469    
470        gtk_table_attach_defaults(GTK_TABLE(table), textview, 0,4,      /* ------------------ description ------------------------- */
471        if(wpt->desc)
472          gtk_table_attach_defaults(GTK_TABLE(table),
473                                    simple_text_widget(wpt->desc), 0,4,
474                                  wpt_row+1, wpt_row+2);                                  wpt_row+1, wpt_row+2);
     }  
475    
476      /* ------------------ comment ------------------------- */      /* ------------------ comment ------------------------- */
477      if(wpt->cmt) {      if(wpt->cmt)
478        GtkTextBuffer *buffer = gtk_text_buffer_new(NULL);        gtk_table_attach_defaults(GTK_TABLE(table),
479        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,  
480                                  wpt_row+2, wpt_row+3);                                  wpt_row+2, wpt_row+3);
     }  
481    
482      /* --------------------- seperator -------------------------*/      /* --------------------- seperator -------------------------*/
483      if(wpt->next)      if(wpt->next) {
484          gtk_table_set_row_spacing(GTK_TABLE(table), wpt_row+2, 8);
485        gtk_table_attach_defaults(GTK_TABLE(table), gtk_hseparator_new(), 0,4,        gtk_table_attach_defaults(GTK_TABLE(table), gtk_hseparator_new(), 0,4,
486                                  wpt_row+3, wpt_row+4);                                  wpt_row+3, wpt_row+4);
487          gtk_table_set_row_spacing(GTK_TABLE(table), wpt_row+3, 8);
488        }
489    
490      wpt_row+=4;      wpt_row+=4;
491      wpt = wpt->next;      wpt = wpt->next;
# Line 532  static GtkWidget *cache_tbs(appdata_t *a Line 527  static GtkWidget *cache_tbs(appdata_t *a
527      static const char *tb_type = "track/details.aspx";      static const char *tb_type = "track/details.aspx";
528    
529      /* --------------------- icon/ref/name -------------------------*/      /* --------------------- icon/ref/name -------------------------*/
530      gtk_table_attach_defaults(GTK_TABLE(table), icon_get_widget(ICON_TB, 0),      GtkWidget *icon = NULL;
531                                0, 1, tb_row+0, tb_row+1);      if((strcasestr(tb->name, "coin") != 0) ||
532           (strcasestr(tb->name, "muenze") != 0) ||
533           (strcasestr(tb->name, "münze") != 0))
534          icon = icon_get_widget(ICON_TB, 1);   /* coin icon */
535        else
536          icon = icon_get_widget(ICON_TB, 0);   /* tb icon */
537    
538        gtk_table_attach_defaults(GTK_TABLE(table), icon,
539                                  0, 1, tb_row+0, tb_row+1);
540    
541      if(tb->ref) {      if(tb->ref) {
542        GtkWidget *ref = link_button_by_id(appdata, tb->ref, tb_type, tb->id);        GtkWidget *ref = link_button_by_id(appdata, tb->ref, tb_type, tb->id);
# Line 576  static void on_gclink_clicked(GtkButton Line 578  static void on_gclink_clicked(GtkButton
578  }  }
579  #endif  #endif
580    
581  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,
582                                 log_t *log, int is_html) {
583  #ifndef  USE_PANNABLE_AREA  #ifndef  USE_PANNABLE_AREA
584    /* put this inside a scrolled view */    /* put this inside a scrolled view */
585    GtkWidget *scrolled_window = gtk_scrolled_window_new(NULL, NULL);    GtkWidget *scrolled_window = gtk_scrolled_window_new(NULL, NULL);
# Line 592  static GtkWidget *cache_logs(appdata_t * Line 595  static GtkWidget *cache_logs(appdata_t *
595  #define gc_link (FALSE)  #define gc_link (FALSE)
596  #endif  #endif
597    
598    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;  
599    
600  #ifdef ENABLE_BROWSER_INTERFACE  #ifdef ENABLE_BROWSER_INTERFACE
601    if(gc_link) {    if(gc_link) {
602      GtkWidget *but = gtk_button_new_with_label(_("Post a new log entry for this geocache"));      GtkWidget *but =
603          gtk_button_new_with_label(_("Post a new log entry for this geocache"));
604    #if 0
605        gtk_button_set_image(GTK_BUTTON(but),
606            gtk_image_new_from_stock(GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON));
607        gtk_button_set_image_position(GTK_BUTTON(but), GTK_POS_LEFT);
608    #endif
609  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5)  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5)
610    hildon_gtk_widget_set_theme_size(but,    hildon_gtk_widget_set_theme_size(but,
611             (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));             (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));
# Line 605  static GtkWidget *cache_logs(appdata_t * Line 613  static GtkWidget *cache_logs(appdata_t *
613      gtk_signal_connect(GTK_OBJECT(but), "clicked",      gtk_signal_connect(GTK_OBJECT(but), "clicked",
614                         GTK_SIGNAL_FUNC(on_gclink_clicked), context);                         GTK_SIGNAL_FUNC(on_gclink_clicked), context);
615    
616      gtk_table_attach_defaults(GTK_TABLE(table), but, 0, 3, 0, 1);      gtk_box_pack_start(GTK_BOX(vbox), but, FALSE, FALSE, 0);
     cnt++;  
617    }    }
618  #endif  #endif
619    
620      int logs = gpx_number_of_logs(log);
621      GtkWidget *table = gtk_table_new(2*logs-1, 2,FALSE);
622      int log_cnt = 0;
623    
624      gtk_table_set_col_spacing(GTK_TABLE(table), 0, 8);
625    
626    /* add all logs to the vbox */    /* add all logs to the vbox */
627    while(log) {    while(log) {
628      gtk_table_attach_defaults(GTK_TABLE(table), gtk_hseparator_new(),      GtkWidget *ivbox = gtk_vbox_new(FALSE, 2);
629                                0, 3, cnt+0, cnt+1);      GtkWidget *ihbox = gtk_hbox_new(FALSE, 2);
630  #if 0  
631      static const char *log_type = "seek/log.aspx";      static const char *finder_type = "profile/";
632      GtkWidget *log_but =      GtkWidget *finder = link_button_by_id(appdata, log->finder->name,
633        link_icon_button_by_id(appdata, icon_get_widget(ICON_LOG, log->type),                                            finder_type, log->finder->id);
634                               log_type, log->id);  
635      gtk_table_attach(GTK_TABLE(table), log_but,      /* if the finder is a button make sure it's the right size and */
636                       0, 1, cnt+1, cnt+2, FALSE, FALSE, 0, 0);      /* does not exceed the size limits */
637  #else      if(GTK_WIDGET_TYPE(finder) == GTK_TYPE_BUTTON) {
638      gtk_table_attach_defaults(GTK_TABLE(table),  #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5)
639                icon_get_widget(ICON_LOG, log->type), 0, 1, cnt+1, cnt+2);        hildon_gtk_widget_set_theme_size(finder,
640  #endif                     (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));
641    #endif
642    
643        gtk_label_set_ellipsize(GTK_LABEL(gtk_bin_get_child(GTK_BIN(finder))),
644                                  PANGO_ELLIPSIZE_END);
645        } else
646          gtk_label_set_ellipsize(GTK_LABEL(finder), PANGO_ELLIPSIZE_END);
647    
648        gtk_box_pack_start(GTK_BOX(ivbox), finder, FALSE, FALSE, 0);
649    
650        gtk_box_pack_start_defaults(GTK_BOX(ihbox),
651                  icon_get_widget(ICON_LOG, log->type));
652    
653      char date_str[32];      char date_str[32];
654      if(log->day && log->month && log->year) {      if(log->day && log->month && log->year) {
# Line 634  static GtkWidget *cache_logs(appdata_t * Line 658  static GtkWidget *cache_logs(appdata_t *
658      } else      } else
659        strcpy(date_str, "---");        strcpy(date_str, "---");
660    
661      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));
                               1, 2, cnt+1, cnt+2);  
662    
663      static const char *finder_type = "profile/";      gtk_box_pack_start(GTK_BOX(ivbox), ihbox, FALSE, FALSE, 0);
     GtkWidget *finder = link_button_by_id(appdata, log->finder->name,  
                                           finder_type, log->finder->id);  
   
     gtk_table_attach(GTK_TABLE(table), finder,  
                      2, 3, cnt+1, cnt+2, FALSE, FALSE, 0, 0);  
664    
665      gtk_table_attach_defaults(GTK_TABLE(table), gtk_hseparator_new(),      gtk_table_attach(GTK_TABLE(table), ivbox, 0, 1,
666                                0, 3, cnt+2, cnt+3);                       2*log_cnt, 2*log_cnt+1, 0, GTK_EXPAND | GTK_FILL, 0, 0);
667    
668      if(log->text) {      if(log->text) {
669        gtk_table_attach_defaults(GTK_TABLE(table),        gtk_table_attach_defaults(GTK_TABLE(table),
670          html_view(appdata, log->text,          html_view(appdata, log->text,
671                    is_html?HTML_HTML:HTML_CUSTOM_MARKUP, FALSE, NULL, NULL),                    is_html?HTML_HTML:HTML_CUSTOM_MARKUP, FALSE, NULL, NULL),
672                                  0, 3, cnt+3, cnt+4);                                  1, 2, 2*log_cnt, 2*log_cnt+1);
673      }      }
674    
675        if(log_cnt < logs-1) {
676          gtk_table_set_row_spacing(GTK_TABLE(table), 2*log_cnt, 8);
677    
678          gtk_table_attach_defaults(GTK_TABLE(table), gtk_hseparator_new(),
679                                    0, 2, 2*log_cnt+1, 2*log_cnt+2);
680    
681          gtk_table_set_row_spacing(GTK_TABLE(table), 2*log_cnt+1, 8);
682        }
683    
684      log = log->next;      log = log->next;
685      cnt+=4;      log_cnt++;
686    }    }
687    
688      gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
689    
690  #ifndef  USE_PANNABLE_AREA  #ifndef  USE_PANNABLE_AREA
691    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window),    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolled_window),
692                                          table);                                          vbox);
693    return scrolled_window;    return scrolled_window;
694  #else  #else
695    hildon_pannable_area_add_with_viewport(HILDON_PANNABLE_AREA(pannable_area),    hildon_pannable_area_add_with_viewport(HILDON_PANNABLE_AREA(pannable_area),
696                                           table);                                           vbox);
697    return pannable_area;    return pannable_area;
698  #endif  #endif
699  }  }
# Line 702  static void on_notebook_page_change(GtkN Line 731  static void on_notebook_page_change(GtkN
731    /* seems to work ... */    /* seems to work ... */
732    if(strcasecmp(name, _("Logs")) == 0) {    if(strcasecmp(name, _("Logs")) == 0) {
733      gtk_widget_queue_resize(w);      gtk_widget_queue_resize(w);
   } else if(strcasecmp(name, _("TBs")) == 0) {  
     gtk_widget_queue_resize(w);  
734    } else if(strcasecmp(name, _("Goto")) == 0) {    } else if(strcasecmp(name, _("Goto")) == 0) {
735  #ifdef USE_MAEMO  #ifdef USE_MAEMO
736      context->handler_id = gtk_timeout_add(1000, screensaver_update,      context->handler_id = gtk_timeout_add(1000, screensaver_update,
737                                            context->appdata);                                            context->appdata);
738  #endif  #endif
739    
740      goto_coordinate_update(context);      goto_coordinate_update(context);
741    }    }
742    
# Line 717  static void on_notebook_page_change(GtkN Line 745  static void on_notebook_page_change(GtkN
745      /* striked out coordinate may need update */      /* striked out coordinate may need update */
746      overview_coordinate_update(context);      overview_coordinate_update(context);
747    }    }
748    
749      if(strcasecmp(name, _("Goto")) == 0) {
750        /* redo coo_button since state of overwritten coordinate may have changed */
751        preset_coordinate_picker_update(context->appdata, context->gotoc.coo_popup);
752      }
753  }  }
754    
755  static void on_notebook_destroy(GtkWidget *widget, gpointer user_data ) {  static void on_notebook_destroy(GtkWidget *widget, gpointer user_data ) {
# Line 724  static void on_notebook_destroy(GtkWidge Line 757  static void on_notebook_destroy(GtkWidge
757    
758    printf("destroying notebook\n");    printf("destroying notebook\n");
759    
760      /* cancel a pending gcvote request */
761      if(context->gcvote_request) {
762        gcvote_request_free(context->gcvote_request);
763        context->gcvote_request = NULL;
764      }
765    
766    notes_destroy_event(NULL, context);    notes_destroy_event(NULL, context);
767    goto_destroy_event(NULL, context);    goto_destroy_event(NULL, context);
768    
# Line 732  static void on_notebook_destroy(GtkWidge Line 771  static void on_notebook_destroy(GtkWidge
771      gtk_timeout_remove(context->handler_id);      gtk_timeout_remove(context->handler_id);
772  #endif  #endif
773    
774    free(user_data);    printf("freeing cache context\n");
775      g_free(context);
776    }
777    
778    #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5)
779    #define CUSTOM_NOTEBOOK
780    #endif
781    
782    static GtkWidget *notebook_new(void) {
783    #ifdef CUSTOM_NOTEBOOK
784      GtkWidget *vbox = gtk_vbox_new(FALSE, 0);
785    
786      GtkWidget *notebook =  gtk_notebook_new();
787    
788      /* prevents user from accidentially touching the breadcrumb trail */
789      /* (looks ugly on fremantle as it isn't themed) */
790      //  gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_BOTTOM);
791    
792      /* solution for fremantle: we use a row of ordinary buttons instead */
793      /* of regular tabs */
794    
795      /* hide the regular tabs */
796      gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
797    
798      gtk_box_pack_start_defaults(GTK_BOX(vbox), notebook);
799    
800      /* store a reference to the notebook in the vbox */
801      g_object_set_data(G_OBJECT(vbox), "notebook", (gpointer)notebook);
802    
803      /* create a hbox for the buttons */
804      GtkWidget *hbox = gtk_hbox_new(TRUE, 0);
805      gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
806      g_object_set_data(G_OBJECT(vbox), "hbox", (gpointer)hbox);
807    
808      return vbox;
809    #else
810      return gtk_notebook_new();
811    #endif
812    }
813    
814    #ifdef CUSTOM_NOTEBOOK
815    static void on_notebook_button_clicked(GtkWidget *button, gpointer data) {
816      GtkNotebook *nb =
817        GTK_NOTEBOOK(g_object_get_data(G_OBJECT(data), "notebook"));
818    
819      gint page = (gint)g_object_get_data(G_OBJECT(button), "page");
820      gtk_notebook_set_current_page(nb, page);
821    }
822    #endif
823    
824    static void notebook_append_page(GtkWidget *notebook,
825                                     GtkWidget *page, char *label) {
826    #ifdef CUSTOM_NOTEBOOK
827      GtkNotebook *nb =
828        GTK_NOTEBOOK(g_object_get_data(G_OBJECT(notebook), "notebook"));
829    
830      gint page_num = gtk_notebook_append_page(nb, page, gtk_label_new(label));
831      GtkWidget *button = NULL;
832    
833      /* select button for page 0 by default */
834      if(!page_num) {
835        button = gtk_radio_button_new_with_label(NULL, label);
836        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), TRUE);
837        g_object_set_data(G_OBJECT(notebook), "group_master", (gpointer)button);
838      } else {
839        GtkWidget *master = g_object_get_data(G_OBJECT(notebook), "group_master");
840        button = gtk_radio_button_new_with_label_from_widget(
841                                     GTK_RADIO_BUTTON(master), label);
842      }
843    
844      gtk_toggle_button_set_mode(GTK_TOGGLE_BUTTON(button), FALSE);
845      g_object_set_data(G_OBJECT(button), "page", (gpointer)page_num);
846    
847      gtk_signal_connect(GTK_OBJECT(button), "clicked",
848               GTK_SIGNAL_FUNC(on_notebook_button_clicked), notebook);
849    
850    #if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR == 5)
851      hildon_gtk_widget_set_theme_size(button,
852               (HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH));
853    #endif
854    
855      gtk_box_pack_start_defaults(
856         GTK_BOX(g_object_get_data(G_OBJECT(notebook), "hbox")),
857         button);
858    
859    #else
860      gtk_notebook_append_page(GTK_NOTEBOOK(notebook), page, gtk_label_new(label));
861    #endif
862    }
863    
864    static GObject *notebook_object(GtkWidget *notebook) {
865    #ifdef CUSTOM_NOTEBOOK
866      return G_OBJECT(g_object_get_data(G_OBJECT(notebook), "notebook"));
867    #else
868      return G_OBJECT(notebook);
869    #endif
870  }  }
871    
872  GtkWidget *cache_view(appdata_t *appdata, cache_t *cache) {  GtkWidget *cache_view(appdata_t *appdata, cache_t *cache) {
873    GtkWidget *notebook;    GtkWidget *notebook;
874    
875    cache_context_t *cache_context = malloc(sizeof(cache_context_t));    cache_context_t *cache_context = g_new0(cache_context_t, 1);
   memset(cache_context, 0, sizeof(cache_context_t));  
876    cache_context->appdata = appdata;    cache_context->appdata = appdata;
877    cache_context->cache = cache;    cache_context->cache = cache;
878    
# Line 751  GtkWidget *cache_view(appdata_t *appdata Line 884  GtkWidget *cache_view(appdata_t *appdata
884  #define TAB_WPTS   _("Waypoints")  #define TAB_WPTS   _("Waypoints")
885  #endif  #endif
886    
887    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  
888    
889    gtk_notebook_append_page(GTK_NOTEBOOK(notebook),    notebook_append_page(notebook,
890         cache_overview(cache_context), gtk_label_new(_("Main")));         cache_overview(cache_context), _("Main"));
891    
892    if(cache->long_description)    if(cache->long_description)
893      gtk_notebook_append_page(GTK_NOTEBOOK(notebook),      notebook_append_page(notebook,
894             cache_description(appdata, cache), gtk_label_new(TAB_DESC));             cache_description(appdata, cache), TAB_DESC);
895    
896    if(cache->hint)    if(cache->hint)
897      gtk_notebook_append_page(GTK_NOTEBOOK(notebook),      notebook_append_page(notebook,
898             cache_hint(appdata, cache), gtk_label_new(_("Hint")));             cache_hint(appdata, cache), _("Hint"));
899    
900    if(cache->log)    if(cache->log)
901      gtk_notebook_append_page(GTK_NOTEBOOK(notebook),      notebook_append_page(notebook,
902       cache_logs(appdata, cache_context, cache->log, cache->logs_are_html),       cache_logs(appdata, cache_context, cache->log, cache->logs_are_html),
903             gtk_label_new(_("Logs")));             _("Logs"));
904    
905    if(cache->wpt)    if(cache->wpt)
906      gtk_notebook_append_page(GTK_NOTEBOOK(notebook),      notebook_append_page(notebook,
907               cache_wpts(appdata, cache->wpt), gtk_label_new(TAB_WPTS));               cache_wpts(appdata, cache->wpt), TAB_WPTS);
908    
909    if(cache->tb)    if(cache->tb)
910      gtk_notebook_append_page(GTK_NOTEBOOK(notebook),      notebook_append_page(notebook,
911               cache_tbs(appdata, cache->tb), gtk_label_new(_("TBs")));               cache_tbs(appdata, cache->tb), _("TBs"));
912    
913    gtk_notebook_append_page(GTK_NOTEBOOK(notebook),    notebook_append_page(notebook,
914             cache_notes(cache_context), gtk_label_new(_("Notes")));             cache_notes(cache_context), _("Notes"));
915    
916    gtk_notebook_append_page(GTK_NOTEBOOK(notebook),    notebook_append_page(notebook,
917             goto_cache(cache_context), gtk_label_new(_("Goto")));             goto_cache(cache_context), _("Goto"));
918    
919    g_signal_connect(G_OBJECT(notebook), "switch-page",    g_signal_connect(notebook_object(notebook), "switch-page",
920             G_CALLBACK(on_notebook_page_change), cache_context);             G_CALLBACK(on_notebook_page_change), cache_context);
921    
922    g_signal_connect(G_OBJECT(notebook), "destroy",    g_signal_connect(notebook_object(notebook), "destroy",
923             G_CALLBACK(on_notebook_destroy), cache_context);             G_CALLBACK(on_notebook_destroy), cache_context);
924    
925    return notebook;    return notebook;

Legend:
Removed from v.158  
changed lines
  Added in v.221