summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/euroconverter.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/apps/plugins/euroconverter.c b/apps/plugins/euroconverter.c
index e604521034..107f36e776 100644
--- a/apps/plugins/euroconverter.c
+++ b/apps/plugins/euroconverter.c
@@ -40,8 +40,6 @@ A value have 5 digits after the . (123.45 = 12345000)
40 40
41To do: 41To do:
42- The Irish currency needs 6 digits after the . to have sufficient precision on big number 42- The Irish currency needs 6 digits after the . to have sufficient precision on big number
43- Improve the config save format to be like rockbox setting
44 (use of settings_parseline(...) of setting.c ? must be extern and export in the config.h)
45*/ 43*/
46 44
47/* Name and path of the config file*/ 45/* Name and path of the config file*/
@@ -272,7 +270,6 @@ static void display(long long euro, long long home, bool pos)
272/* Show country Abbreviation */ 270/* Show country Abbreviation */
273static void show_abbrev(void) 271static void show_abbrev(void)
274{ 272{
275// rb->lcd_remove_cursor();
276 rb->lcd_puts(2,1,abbrev_str[country]); 273 rb->lcd_puts(2,1,abbrev_str[country]);
277 rb->sleep(HZ*3/4); 274 rb->sleep(HZ*3/4);
278} 275}
@@ -287,13 +284,12 @@ static void save_config(void)
287 if (fd < 0) 284 if (fd < 0)
288 { 285 {
289 rb->lcd_clear_display(); 286 rb->lcd_clear_display();
290 rb->lcd_puts(0,0,"Impossible"); 287 rb->splash(HZ, false, "Failed to save config");
291 rb->lcd_puts(0,1,"to save cfg");
292 rb->sleep(HZ); 288 rb->sleep(HZ);
293 } 289 }
294 else 290 else
295 { 291 {
296 rb->fprintf(fd, "%c", country+0x30); 292 rb->fprintf(fd, "last currency: %d\n", country);
297 rb->close(fd); 293 rb->close(fd);
298 } 294 }
299 return; 295 return;
@@ -305,13 +301,17 @@ static void load_config(void)
305{ 301{
306 int fd; 302 int fd;
307 char line[128]; 303 char line[128];
304 char *name, *value;
308 305
309 fd = rb->open(CFGFILE, O_RDONLY); 306 fd = rb->open(CFGFILE, O_RDONLY);
310 if (fd < 0) 307 if (fd < 0)
311 return; 308 return;
312 309
313 rb->read(fd, line,1); 310 rb->read_line(fd, line, 128);
314 country=line[0]-0x30; 311 rb->settings_parseline(line, &name, &value);
312
313 if(!rb->strcmp("last currency", name))
314 country = rb->atoi(value);
315 315
316 if ((country>11)|| (country<0)) 316 if ((country>11)|| (country<0))
317 country=0; 317 country=0;