80 |
{ "cachelist_hide_found", STORE_BOOL, OFFSET(cachelist_hide_found) }, |
{ "cachelist_hide_found", STORE_BOOL, OFFSET(cachelist_hide_found) }, |
81 |
{ "cachelist_update", STORE_BOOL, OFFSET(cachelist_update) }, |
{ "cachelist_update", STORE_BOOL, OFFSET(cachelist_update) }, |
82 |
{ "disable_gcvote", STORE_BOOL, OFFSET(disable_gcvote) }, |
{ "disable_gcvote", STORE_BOOL, OFFSET(disable_gcvote) }, |
83 |
|
{ "username", STORE_STRING, OFFSET(username) }, |
84 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
85 |
{ "mmpoi_dontlaunch", STORE_BOOL, OFFSET(mmpoi_dontlaunch) }, |
{ "mmpoi_dontlaunch", STORE_BOOL, OFFSET(mmpoi_dontlaunch) }, |
86 |
{ "cachelist_dss", STORE_BOOL, OFFSET(cachelist_disable_screensaver) }, |
{ "cachelist_dss", STORE_BOOL, OFFSET(cachelist_disable_screensaver) }, |
93 |
{ "map_source", STORE_INT, OFFSET(map.source) }, |
{ "map_source", STORE_INT, OFFSET(map.source) }, |
94 |
#endif |
#endif |
95 |
|
|
96 |
{ "gt_username", STORE_STRING, OFFSET(gt.username) }, |
{ "geotoad/password", STORE_STRING, OFFSET(gt.password) }, |
97 |
{ "gt_password", STORE_STRING, OFFSET(gt.password) }, |
{ "geotoad/filename", STORE_STRING, OFFSET(gt.filename) }, |
98 |
{ "gt_filename", STORE_STRING, OFFSET(gt.filename) }, |
{ "geotoad/distance", STORE_FLOAT, OFFSET(gt.distance) }, |
99 |
{ "gt_distance", STORE_FLOAT, OFFSET(gt.distance) }, |
{ "geotoad/lat", STORE_FLOAT, OFFSET(gt.lat) }, |
100 |
{ "gt_lat", STORE_FLOAT, OFFSET(gt.lat) }, |
{ "geotoad/lon", STORE_FLOAT, OFFSET(gt.lon) }, |
101 |
{ "gt_lon", STORE_FLOAT, OFFSET(gt.lon) }, |
{ "geotoad/flags", STORE_INT, OFFSET(gt.flags) }, |
|
{ "gt_flags", STORE_INT, OFFSET(gt.flags) }, |
|
102 |
|
|
103 |
{ NULL, -1, -1 } |
{ NULL, -1, -1 } |
104 |
}; |
}; |
121 |
} |
} |
122 |
|
|
123 |
void gconf_remove_closed_name(appdata_t *appdata, char *filename) { |
void gconf_remove_closed_name(appdata_t *appdata, char *filename) { |
124 |
|
if(!filename || !strlen(filename)) return; |
125 |
|
|
126 |
char *key = g_strdup_printf(GCONF_KEY_CLOSED, get_basename(filename)); |
char *key = g_strdup_printf(GCONF_KEY_CLOSED, get_basename(filename)); |
127 |
gconf_client_unset(appdata->gconf_client, key, NULL); |
gconf_client_unset(appdata->gconf_client, key, NULL); |
128 |
g_free(key); |
g_free(key); |
129 |
} |
} |
130 |
|
|
131 |
void gconf_save_closed_name(appdata_t *appdata, char *filename, char *name) { |
void gconf_save_closed_name(appdata_t *appdata, char *filename, char *name) { |
132 |
|
if(!filename || !strlen(filename)) return; |
133 |
|
|
134 |
char *key = g_strdup_printf(GCONF_KEY_CLOSED, get_basename(filename)); |
char *key = g_strdup_printf(GCONF_KEY_CLOSED, get_basename(filename)); |
135 |
gconf_client_set_string(appdata->gconf_client, key, name, NULL); |
gconf_client_set_string(appdata->gconf_client, key, name, NULL); |
136 |
g_free(key); |
g_free(key); |
137 |
} |
} |
138 |
|
|
139 |
char *gconf_restore_closed_name(appdata_t *appdata, char *filename) { |
char *gconf_restore_closed_name(appdata_t *appdata, char *filename) { |
140 |
|
if(!filename || !strlen(filename)) return NULL; |
141 |
|
|
142 |
char *key = g_strdup_printf(GCONF_KEY_CLOSED, get_basename(filename)); |
char *key = g_strdup_printf(GCONF_KEY_CLOSED, get_basename(filename)); |
143 |
char *ret = gconf_client_get_string(appdata->gconf_client, key, NULL); |
char *ret = gconf_client_get_string(appdata->gconf_client, key, NULL); |
144 |
g_free(key); |
g_free(key); |
239 |
appdata->gps.lat = appdata->gps.lon = NAN; |
appdata->gps.lat = appdata->gps.lon = NAN; |
240 |
|
|
241 |
appdata->gt.lat = appdata->gt.lon = NAN; |
appdata->gt.lat = appdata->gt.lon = NAN; |
242 |
|
appdata->gt.distance = 1.0; // in km/mil |
243 |
|
|
244 |
/* ------------- get proxy settings -------------------- */ |
/* ------------- get proxy settings -------------------- */ |
245 |
if(gconf_client_get_bool(appdata->gconf_client, |
if(gconf_client_get_bool(appdata->gconf_client, |
270 |
} |
} |
271 |
} |
} |
272 |
|
|
273 |
|
/* restore everything listed in the store table */ |
274 |
|
store_t *st = store; |
275 |
|
while(st->key) { |
276 |
|
void **ptr = ((void*)appdata) + st->offset; |
277 |
|
char *key = g_strdup_printf(GCONF_PATH "%s", st->key); |
278 |
|
|
279 |
|
/* check if key is present */ |
280 |
|
GConfValue *value = gconf_client_get(appdata->gconf_client, key, NULL); |
281 |
|
if(value) { |
282 |
|
gconf_value_free(value); |
283 |
|
|
284 |
|
switch(st->type) { |
285 |
|
case STORE_STRING: { |
286 |
|
char **str = (char**)ptr; |
287 |
|
*str = gconf_client_get_string(appdata->gconf_client, key, NULL); |
288 |
|
} break; |
289 |
|
|
290 |
|
case STORE_BOOL: |
291 |
|
*((int*)ptr) = gconf_client_get_bool(appdata->gconf_client, key, NULL); |
292 |
|
break; |
293 |
|
|
294 |
|
case STORE_INT: |
295 |
|
*((int*)ptr) = gconf_client_get_int(appdata->gconf_client, key, NULL); |
296 |
|
break; |
297 |
|
|
298 |
|
case STORE_FLOAT: |
299 |
|
*((float*)ptr) = gconf_client_get_float(appdata->gconf_client, key, NULL); |
300 |
|
break; |
301 |
|
|
302 |
|
default: |
303 |
|
printf("Unsupported type %d\n", st->type); |
304 |
|
break; |
305 |
|
} |
306 |
|
} |
307 |
|
g_free(key); |
308 |
|
st++; |
309 |
|
} |
310 |
|
|
311 |
int i, entries = gconf_client_get_int(appdata->gconf_client, |
int i, entries = gconf_client_get_int(appdata->gconf_client, |
312 |
GCONF_KEY_CNT, NULL); |
GCONF_KEY_CNT, NULL); |
313 |
|
|
329 |
(*gpx)->closed = TRUE; |
(*gpx)->closed = TRUE; |
330 |
} else { |
} else { |
331 |
if(g_file_test(fname, G_FILE_TEST_IS_DIR)) |
if(g_file_test(fname, G_FILE_TEST_IS_DIR)) |
332 |
*gpx = gpx_parse_dir(dialog, fname); |
*gpx = gpx_parse_dir(dialog, fname, appdata->username); |
333 |
else |
else |
334 |
*gpx = gpx_parse(dialog, fname); |
*gpx = gpx_parse(dialog, fname, appdata->username); |
335 |
|
|
336 |
if(!*gpx) { |
if(!*gpx) { |
337 |
/* restoring the gpx file failed, mark it as unusable, but save */ |
/* restoring the gpx file failed, mark it as unusable, but save */ |
376 |
} |
} |
377 |
} |
} |
378 |
|
|
|
/* restore everything listed in the store table */ |
|
|
store_t *st = store; |
|
|
while(st->key) { |
|
|
void **ptr = ((void*)appdata) + st->offset; |
|
|
char *key = g_strdup_printf(GCONF_PATH "%s", st->key); |
|
|
|
|
|
/* check if key is present */ |
|
|
GConfValue *value = gconf_client_get(appdata->gconf_client, key, NULL); |
|
|
if(value) { |
|
|
gconf_value_free(value); |
|
|
|
|
|
switch(st->type) { |
|
|
case STORE_STRING: { |
|
|
char **str = (char**)ptr; |
|
|
*str = gconf_client_get_string(appdata->gconf_client, key, NULL); |
|
|
} break; |
|
|
|
|
|
case STORE_BOOL: |
|
|
*((int*)ptr) = gconf_client_get_bool(appdata->gconf_client, key, NULL); |
|
|
break; |
|
|
|
|
|
case STORE_INT: |
|
|
*((int*)ptr) = gconf_client_get_int(appdata->gconf_client, key, NULL); |
|
|
break; |
|
|
|
|
|
case STORE_FLOAT: |
|
|
*((float*)ptr) = gconf_client_get_float(appdata->gconf_client, key, NULL); |
|
|
break; |
|
|
|
|
|
default: |
|
|
printf("Unsupported type %d\n", st->type); |
|
|
break; |
|
|
} |
|
|
} |
|
|
g_free(key); |
|
|
st++; |
|
|
} |
|
|
|
|
379 |
/* ----- set all kinds of defaults ------- */ |
/* ----- set all kinds of defaults ------- */ |
380 |
|
|
381 |
if(!appdata->compass_damping) appdata->compass_damping = 1; |
if(!appdata->compass_damping) appdata->compass_damping = 1; |
492 |
char *name = g_strdup(ICONPATH "welcome.gpx"); |
char *name = g_strdup(ICONPATH "welcome.gpx"); |
493 |
dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window)); |
dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window)); |
494 |
printf("No GPX file loaded, trying to load demo\n"); |
printf("No GPX file loaded, trying to load demo\n"); |
495 |
appdata->gpx = gpx_parse(dialog, name); |
appdata->gpx = gpx_parse(dialog, name, appdata->username); |
496 |
gpx_busy_dialog_destroy(dialog); |
gpx_busy_dialog_destroy(dialog); |
497 |
g_free(name); |
g_free(name); |
498 |
} |
} |