AG_BindFoo() is more often used for widget bindings, but this usage
is correct and it should work. Are you sure AG_ObjectSave(agConfig)
is being invoked at program termination (or whenever you want to save
the changes)?
AG_Destroy() will not internally save the configuration, because you
might want to display a confirmation dialog on exit, for instance.
On Thu, Aug 20, 2009 at 05:43:02PM +0000, Olexandr Sydorchuk wrote:
> How to use AG_Bind and make possible to save (and load in future
> session) variable? For example I have variable 'value' that can be
> changed not by AG_Set. I suggest to use AG_Bind and hope that when
> program terminated this value will be saved. But 'value' will saved only
> after using AG_Set :(.
>
> --8<---------------cut here---------------start------------->8---
> // map variable to 'value'
> AG_BindUint32(agConfig, "cel.flags.r", &value);
> if (!AG_GetBool(agConfig, "cel.flags.init")){
> // here some default value computation
> set_default_value(&value);
> }
> // just mark that value already setuped
> AG_SetBool(agConfig, "cel.flags.init", 1);
> --8<---------------cut here---------------end--------------->8---
>
> Sure I can use AG_Set at program's termination, but what profit of
> AG_Bind than?
>
> _______________________________________________
> Agar mailing list
> [email protected]
> http://libagar.org/lists.html
_______________________________________________
Agar mailing list
[email protected]
http://libagar.org/lists.html