summaryrefslogtreecommitdiffstats
path: root/apps/plugins/euroconverter.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-07-16 13:01:17 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-07-16 13:01:17 +0000
commit285084df44564068c54a7c0997af4d60fabe1376 (patch)
tree12b78f270d13abca089b61cfca6f882e8c68934c /apps/plugins/euroconverter.c
parent06a2ffd962fe4971ce9b2b1845f1c62d1927fadd (diff)
downloadrockbox-285084df44564068c54a7c0997af4d60fabe1376.tar.gz
rockbox-285084df44564068c54a7c0997af4d60fabe1376.tar.bz2
rockbox-285084df44564068c54a7c0997af4d60fabe1376.zip
Now uses the settings_parseline() function
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4890 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/euroconverter.c')
-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)
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;