Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Loading settings in CFG
From: Christian D (QInter_at_gmx.net)
Date: 2003-02-13


> I don't know if you're french (your name sound like that), if so just
                                            Really?;)
> aswer
> me in french ;))
I'm sorry, but I'm german and unfortunately I don't speak french.

> I tried to add the bookmarking and fading patch settings this way (code
> added at line 1069, after else if (!strcasecmp(name, "poweroff"))) :
That's OK.

>
> else if (!strcasecmp(name, "fade"))
> {
> if( !test_int(value, 0, 0, 1,

I think that's the point. Because of global_settings.fade_on_stop is a bool
var, you should use bool test_bool(char* string, bool* variable) instead.
If _string_ is '1' or '0' then the function returns true (otherwise it's
false) and _variable_ is _true_ or _false_. I had implemented in this way to make
sure we don't load invalid values from cfg file to the global_setting
variables. If the test_bool or test_int function returns false, the value should be
set to it's default.

> &global_settings.fade_on_stop))
> global_settings.fade_on_stop=1;
> }
> else if (!strcasecmp(name, "autobookmark"))
> {
> if( !test_int(value, 0, 0, 1,
> &global_settings.autocreatebookmark))
global_settings.autocreatebookmark has a range of 0 to 2? So if you change
the max parameter to 2 it should work. The test_int function returns true if
value is withhin the range thats given through the min and max parameters. The
step is optional (0 is the same as 1) . This is used e.g. to test the
_bidir_limit_ setting. In case the function returns true, you can do what you wan't
with _variable_.

> {
> if (global_settings.autocreatebookmark == 0)
> global_settings.autocreatebookmark = AUTOCREATEBOOKMARK_NO;
> else
> global_settings.autocreatebookmark = AUTOCREATEBOOKMARK_YES;
> }
> else global_settings.autocreatebookmark = AUTOCREATEBOOKMARK_NO;
> }
>
> But it didn't worked ... can you help me correcting the code so that it
> would load the right settings ?
I hope that was helpful for you. Are you planning to merge
autobookmark&fading&loading_cfg?
If you do so, please release a patch. Thank you:)

Christian



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa