[Gnucash-changes] Fix function name.

David Hampton hampton-gnucash at rainbolthampton.net
Wed Sep 14 10:01:58 EDT 2005

On Wed, 2005-09-14 at 08:01 +0100, Neil Williams wrote:
> On Wednesday 14 September 2005 7:11 am, David Hampton wrote:
> >  Globals: dateFormat
> >  */
> > -const gchar *qof_date_format_get_format(QofDateFormat df)
> > +const gchar *qof_date_text_format_get_string(QofDateFormat df)
> >  {
> >    switch(df) {
> >     case QOF_DATE_FORMAT_US:
> Should we just be changing the API like that?? This isn't a static.
> http://qof.sourceforge.net/doxy/group__Date.html#ga22
> (QOF is now on pre-release and I'd rather not change the API just now.)
> :-(

Given that I was restoring the function to its original name, I thought
it was appropriate.  Somewhere along the line the code was broken in the
g2 branch.

> Can you use a #define, David, and deprecate the old version so that we don't 
> break the build of a program using the current API? 

Did I break CashUtils?  I doubt it.  I doubt that there was any code
used this function, given that its sole existing documentation was the
string "DOCUMENT ME!".  Its also a pretty esoteric function that was
originially implemented specifically for the GncDateFormat widget and
was never used anywhere else in GnuCash.

> Or, it might be better to put the qof_date_text_format_get_string function in 
> the GUI code (maybe as gnc_...), deprecate qof_date_format_get_format in 
> gnc-date.c and I'll look at actioning this hack alert from gnc-date.c in the 
> next release:

Got any suggestions?  I have more non-gui date handling functions that I
was going to stick into gnc-date.c.  I.E. A bunch of gnc_timet_get_xxx_
{start|end} functions where xxx is month, prev_month, quarter, year,

> HACK ALERT: the scan and print routines should probably be moved to somewhere 
> else. The engine really isn't involved with things like printing formats. 
> This is needed mostly by the GUI and so on. If a file-io backend needs date 
> handling, it should do it itself, instead of depending on the routines here.

If a file-io backend needs date handling, and the UI needs date
handling, shouldn't they share a common set of functions?  Isn't gnc-
date.c the appropriate existing shared file?

> Book_Merge and QSF already follow this advice by using strftime and 
> http://qof.sourceforge.net/doxy/group__Date.html#ga57

That's one ugly time string and I would love to be able to hide it from
the user.  Unfortunately the QOF_UTC_DATE_FORMAT value was shoved into
the middle of an existing enum instead of added at the end, so in fixing
the gnc-date-format widget I had to expose it to the user.  I don't
really have a clean method of hiding it at this point without adding a
bunch of hack code to gnc-date-format.c to strip out the middle value of
an enum.

> It's on my TODO list to overhaul the QOF date handling but not immediately 
> (i.e. not in the current 0.6) - probably for 0.7. As the file states, it's in 
> quite a mess but I haven't had time to do anything other than tweaks so far.

When you do, please make sure to check the date widgets in src/gnome-
utils to make sure they continue to work.


More information about the gnucash-devel mailing list