Allowing the user to select the currency symbol

Derek Atkins warlord at MIT.EDU
Thu Sep 26 11:21:30 EDT 2013


Frédéric Perrin <fred at fperrin.net> writes:

> Le mercredi 25 à 19:25, Geert Janssens a écrit :
>> On Wednesday 25 September 2013 11:11:21 David Carlson wrote:
>>> As another user I would suggest per data file. One user may want
>>> different settings in another file.
>>
>> I would rather see it per data file as well.
>
> Okay, I guess I can try and see how to store that info in the data file
> then. Can't promise a timeframe, as even though that's conceptually
> pretty simple, this is my first dabbling in Gnucash code...
>
>> And if you are going to do a GUI to edit this, how about making it a
>> currency editor, something like the commodity editor now, but then for
>> currencies ? 
>
> The way I see it (and what would be sufficient for my own use), the
> interface to set the user symbol would look like :
>
> foreach (currency in book->used_currencies)
>         r = create_row()
>         r.col1 = label(currency.code)
>         r.col2 = label(currency.description)
>         r.col3 = editable_text(currency.user_symbol
>                 if currency.user_symbol else currency.code)
>         r.col3.on_update = lambda: new_user_symbol -> currency.set_user_symbol(new_user_symbol)
>
> Well, the equivalent GTK code, but you get the idea.

Pretty much, yes.  Basically you would need to extend the existing
Commodity objects to include a currency_symbol, put default symbols into
the iso-4217-currencies table, and create a Gtk Dialog that lets you
edit those currencies and make sure the modified versions get saved in
the datafile.

>>              The iso-4217-currencies can serve as preset currencies,
>> which the user can edit, or even add custom currencies (think Bitcoin
>> and friends). Perhaps that's too wide a scope though... 
>
> Isn't user-defined currencies something that's been asked a couple of
> times ? I mean, googling for "gnucash bitcoin site:lists.gnucash.org"
> reveals quite a few past discussions (without, evidently, happy
> conclusions or we would have BTC by now).

Yes, it's been asked for.

> And the complexity of "I'll store in (GConf|the data file) one
> user-defined field per currency" seems much lower than "I'll store
> enough data to recreate the entire currency at data-file load time" ; I
> don't think I can acheive the second.

Actually, the second is already there.  You just need to extend the data
object and extend the existing UI.

Internally GnuCash treats a Currency like a special-case of of a
Commodity.  So you can leverage all the Commodity editing tools to add a
Currency Editing tool.  Et Voila.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available



More information about the gnucash-devel mailing list