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, |
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_set(cache_context_t *context, vote_t *vote) { |
static void gcvote_set(cache_context_t *context, vote_t *vote) { |
105 |
if(!vote) return; |
if(!vote) return; |
106 |
|
|
107 |
if(context->quality) { |
if(context->quality) { |
108 |
gtk_widget_destroy(context->quality); |
gtk_widget_destroy(context->quality); |
109 |
context->quality = NULL; |
context->quality = NULL; |
110 |
} |
} |
111 |
|
|
112 |
if(context->votes) { |
if(context->votes) { |
113 |
gtk_widget_destroy(context->votes); |
gtk_widget_destroy(context->votes); |
114 |
context->votes = NULL; |
context->votes = NULL; |
115 |
} |
} |
116 |
|
|
117 |
/* update/draw the voting */ |
/* update/draw the voting */ |
118 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
119 |
GtkTooltips *tips = gtk_tooltips_new(); |
GtkTooltips *tips = gtk_tooltips_new(); |
120 |
#endif |
#endif |
121 |
|
|
122 |
char *votes_str = g_strdup_printf(_("Quality (%d %s):"), vote->votes, |
char *votes_str = g_strdup_printf(_("Quality (%d %s):"), vote->votes, |
123 |
(vote->votes == 1)?_("vote"):_("votes")); |
(vote->votes == 1)?_("vote"):_("votes")); |
124 |
context->votes = GTK_LABEL_SMALL(votes_str); |
context->votes = GTK_LABEL_SMALL(votes_str); |
125 |
gtk_box_pack_start(GTK_BOX(context->votebox), |
gtk_box_pack_start(GTK_BOX(context->votebox), |
126 |
context->votes, FALSE, FALSE, 0); |
context->votes, FALSE, FALSE, 0); |
128 |
context->quality = icon_get_widget(ICON_STARS, (int)(vote->quality*2-2)); |
context->quality = icon_get_widget(ICON_STARS, (int)(vote->quality*2-2)); |
129 |
gtk_box_pack_start(GTK_BOX(context->votebox), context->quality, |
gtk_box_pack_start(GTK_BOX(context->votebox), context->quality, |
130 |
FALSE, FALSE, 0); |
FALSE, FALSE, 0); |
131 |
|
|
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, context->votebox, str, NULL); |
gtk_tooltips_set_tip(tips, context->votebox, str, NULL); |
142 |
|
|
143 |
static void gcvote_callback(vote_t *vote, gpointer data) { |
static void gcvote_callback(vote_t *vote, gpointer data) { |
144 |
cache_context_t *context = (cache_context_t*)data; |
cache_context_t *context = (cache_context_t*)data; |
145 |
|
|
146 |
/* no vote returned: request failed, just cleanup */ |
/* no vote returned: request failed, just cleanup */ |
147 |
if(!vote) { |
if(!vote) { |
148 |
printf("gcvote: callback for failed request\n"); |
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; |
return; |
156 |
vote->quality, vote->votes); |
vote->quality, vote->votes); |
157 |
|
|
158 |
gcvote_set(context, vote); |
gcvote_set(context, vote); |
159 |
|
|
160 |
gcvote_save(context->appdata, context->cache, &context->gcvote_request->mem); |
gcvote_save(context->appdata, context->cache, &context->gcvote_request->mem); |
161 |
|
|
162 |
gcvote_request_free(context->gcvote_request); |
gcvote_request_free(context->gcvote_request); |
163 |
context->gcvote_request = NULL; |
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_SIZE, cache->type)); |
199 |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
|
|
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); |
|
|
|
|
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); |
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: |
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 = 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) { |
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); |
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); |
286 |
gcvote_request(appdata, gcvote_callback, cache->url, context); |
gcvote_request(appdata, gcvote_callback, cache->url, context); |
287 |
|
|
288 |
context->votebox = gtk_vbox_new(FALSE, 0); |
context->votebox = gtk_vbox_new(FALSE, 0); |
289 |
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); |
|
290 |
|
|
291 |
/* fill with vote if present on disk (will also free vote) */ |
/* fill with vote if present on disk (will also free vote) */ |
292 |
if(vote) |
if(vote) |
293 |
gcvote_set(context, vote); |
gcvote_set(context, vote); |
294 |
} |
} |
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); |
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 |
|
|
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)); |
461 |
gpx_pos_get_bearing(*refpos, wpt->pos)); |
|
462 |
gtk_box_pack_start_defaults(GTK_BOX(ihbox), GTK_LABEL_SMALL(str)); |
gpx_pos_get_distance_str(str, sizeof(str), |
463 |
gpx_pos_get_distance_str(str, sizeof(str), |
*refpos, wpt->pos, appdata->imperial); |
464 |
*refpos, wpt->pos, appdata->imperial); |
gtk_box_pack_start(GTK_BOX(ihbox), GTK_LABEL_SMALL(str),1,0,0); |
465 |
gtk_box_pack_start(GTK_BOX(ihbox), GTK_LABEL_SMALL(str),1,0,0); |
|
466 |
|
gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 3,4, |
467 |
|
wpt_row+0, wpt_row+1); |
468 |
|
} |
469 |
|
|
|
gtk_table_attach_defaults(GTK_TABLE(table), ihbox, 3,4, |
|
|
wpt_row+0, wpt_row+1); |
|
|
|
|
470 |
/* ------------------ description ------------------------- */ |
/* ------------------ description ------------------------- */ |
471 |
if(wpt->desc) |
if(wpt->desc) |
472 |
gtk_table_attach_defaults(GTK_TABLE(table), |
gtk_table_attach_defaults(GTK_TABLE(table), |
599 |
|
|
600 |
#ifdef ENABLE_BROWSER_INTERFACE |
#ifdef ENABLE_BROWSER_INTERFACE |
601 |
if(gc_link) { |
if(gc_link) { |
602 |
GtkWidget *but = |
GtkWidget *but = |
603 |
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")); |
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)); |
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_box_pack_start_defaults(GTK_BOX(vbox), but); |
gtk_box_pack_start(GTK_BOX(vbox), but, FALSE, FALSE, 0); |
617 |
} |
} |
618 |
#endif |
#endif |
619 |
|
|
640 |
(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH)); |
(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH)); |
641 |
#endif |
#endif |
642 |
|
|
643 |
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))), |
644 |
PANGO_ELLIPSIZE_END); |
PANGO_ELLIPSIZE_END); |
645 |
} else |
} else |
646 |
gtk_label_set_ellipsize(GTK_LABEL(finder), PANGO_ELLIPSIZE_END); |
gtk_label_set_ellipsize(GTK_LABEL(finder), PANGO_ELLIPSIZE_END); |
662 |
|
|
663 |
gtk_box_pack_start(GTK_BOX(ivbox), ihbox, FALSE, FALSE, 0); |
gtk_box_pack_start(GTK_BOX(ivbox), ihbox, FALSE, FALSE, 0); |
664 |
|
|
665 |
gtk_table_attach_defaults(GTK_TABLE(table), ivbox, 0, 1, |
gtk_table_attach(GTK_TABLE(table), ivbox, 0, 1, |
666 |
2*log_cnt, 2*log_cnt+1); |
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, |
685 |
log_cnt++; |
log_cnt++; |
686 |
} |
} |
687 |
|
|
688 |
gtk_box_pack_start_defaults(GTK_BOX(vbox), table); |
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), |
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 |
|
|
766 |
gtk_timeout_remove(context->handler_id); |
gtk_timeout_remove(context->handler_id); |
767 |
#endif |
#endif |
768 |
|
|
769 |
free(user_data); |
printf("freeing cache context\n"); |
770 |
|
g_free(context); |
771 |
} |
} |
772 |
|
|
773 |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >= 5) |
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 |
|
|
870 |
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)); |
|
871 |
cache_context->appdata = appdata; |
cache_context->appdata = appdata; |
872 |
cache_context->cache = cache; |
cache_context->cache = cache; |
873 |
|
|
945 |
static void on_cache_destroy (GtkWidget *widget, appdata_t *appdata) { |
static void on_cache_destroy (GtkWidget *widget, appdata_t *appdata) { |
946 |
appdata->cur_cache = NULL; |
appdata->cur_cache = NULL; |
947 |
|
|
948 |
|
HildonWindowStack *stack = hildon_window_stack_get_default(); |
949 |
|
appdata->window = HILDON_WINDOW(hildon_window_stack_peek(stack)); |
950 |
|
|
951 |
/* restore cur_view */ |
/* restore cur_view */ |
952 |
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
953 |
} |
} |
954 |
|
|
955 |
void cache_dialog(appdata_t *appdata, cache_t *cache) { |
void cache_dialog(appdata_t *appdata, cache_t *cache) { |
956 |
GtkWidget *window = hildon_stackable_window_new(); |
GtkWidget *window = hildon_stackable_window_new(); |
957 |
|
appdata->window = HILDON_WINDOW(window); |
958 |
|
|
959 |
/* store last "cur_view" in window */ |
/* store last "cur_view" in window */ |
960 |
g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view); |
g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view); |