CSV import

Josh Sled jsled at asynchronous.org
Tue May 29 12:57:54 EDT 2007


"Benjamin Sperisen" <lasindi at gmail.com> writes:

>> goffice is already a dependency, for the graphing/charting of Gnome Office
>> Graphing (GOG).  Do you need a particular version?
>
> I don't think I need a particular version, though I haven't tested it
> (I am using 0.3.7). Below are the goffice includes the code makes, in
> case any of those headers might cause version-specific problems.

Did you build 0.3.7 from source?  I thought there was a 0.4.0 release that's
in at least a couple of distributions.  I see my up-to-date Gentoo box only
has 0.2.1.

Our dependency policy is outlined in $toplevel/README.dependencies, but it's
roughly: only library versions that have been released (in major
distributions) for at least 6 months.


Looking at my 0.2.1 install:

> #include <goffice/utils/datetime.h>

Present.

> #include <goffice/utils/go-glib-extras.h>

Present.

> #include <goffice/utils/go-locale.h>

Not present.

> #include <goffice/utils/go-format.h>

Present.

Of course, the particular API is more relevant.


> Yes, I asked a Gnumeric developer about it who pointed me to two files
> (stf-parse.c and stf-parse.h). I snapshotted the files from the source
> code in the Ubuntu 7.04 repository, which is version 1.7.8.

Our general method of handling stuff like this is to keep it as intact as
possible, and copy the sources into lib/«whatever»/.  The hope would be it's
more fully factored out (say into goffice), and we can migrate to using the
real version rather than our copy.


> Now that I have code that can load CSV files, I think I can move to
> the next phase: loading the files into GnuCash. I've been looking
> through the code trying to figure out how to write an importer plugin,
> but I'm a bit lost. Is there some documentation you could point me to
> that explains how to write a plugin? All I really need is code that
> adds a menu item for the importer and calls an event handler that I
> can write; then I'll have the "glue" between the code I've got and the
> rest of GnuCash.

I suggest looking at:

- src/gnome/gnc-plugin-basic-commands.c, which is similar, being the core
  "plugin" for the basic commands/menu items.

- src/import-export/ofx/gnc-plugin-ofx.c, which is even more similar, as it's
  basically the same thing. :)

Note that most plugins will register themselves with the plugin manager,
which means they need to be called during application init.  In the case of
the core plugins (basic-commands, account-tree, &c.) that's straightforward:
just call it from the startup code.  I the case of optional modules
(OFX/HBCI, &c.), the module init function needs to make the call.  I'm not
sure that there's a compelling case to make a CSV importer optional, but it's
good to be somewhat isolated, regardless.

-- 
...jsled
http://asynchronous.org/ - a=jsled; b=asynchronous.org; echo ${a}@${b}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20070529/1661e547/attachment.bin 


More information about the gnucash-devel mailing list