From 285084df44564068c54a7c0997af4d60fabe1376 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Fri, 16 Jul 2004 13:01:17 +0000 Subject: Now uses the settings_parseline() function git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4890 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/euroconverter.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'apps/plugins/euroconverter.c') 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) To do: - The Irish currency needs 6 digits after the . to have sufficient precision on big number -- Improve the config save format to be like rockbox setting - (use of settings_parseline(...) of setting.c ? must be extern and export in the config.h) */ /* Name and path of the config file*/ @@ -272,7 +270,6 @@ static void display(long long euro, long long home, bool pos) /* Show country Abbreviation */ static void show_abbrev(void) { -// rb->lcd_remove_cursor(); rb->lcd_puts(2,1,abbrev_str[country]); rb->sleep(HZ*3/4); } @@ -287,13 +284,12 @@ static void save_config(void) if (fd < 0) { rb->lcd_clear_display(); - rb->lcd_puts(0,0,"Impossible"); - rb->lcd_puts(0,1,"to save cfg"); + rb->splash(HZ, false, "Failed to save config"); rb->sleep(HZ); } else { - rb->fprintf(fd, "%c", country+0x30); + rb->fprintf(fd, "last currency: %d\n", country); rb->close(fd); } return; @@ -305,13 +301,17 @@ static void load_config(void) { int fd; char line[128]; + char *name, *value; fd = rb->open(CFGFILE, O_RDONLY); if (fd < 0) return; - rb->read(fd, line,1); - country=line[0]-0x30; + rb->read_line(fd, line, 128); + rb->settings_parseline(line, &name, &value); + + if(!rb->strcmp("last currency", name)) + country = rb->atoi(value); if ((country>11)|| (country<0)) country=0; -- cgit v1.2.3