r18842 - gnucash/trunk - Use a normalized uri format internally to refer to data stores.

Geert Janssens gjanssens at code.gnucash.org
Fri Mar 5 15:15:32 EST 2010


Author: gjanssens
Date: 2010-03-05 15:15:31 -0500 (Fri, 05 Mar 2010)
New Revision: 18842
Trac: http://svn.gnucash.org/trac/changeset/18842

Added:
   gnucash/trunk/src/core-utils/gnc-uri-utils.c
   gnucash/trunk/src/core-utils/gnc-uri-utils.h
   gnucash/trunk/src/gnome-utils/gnc-keyring.c
   gnucash/trunk/src/gnome-utils/gnc-keyring.h
Modified:
   gnucash/trunk/configure.in
   gnucash/trunk/po/POTFILES.in
   gnucash/trunk/src/backend/dbi/gnc-backend-dbi.c
   gnucash/trunk/src/backend/xml/gnc-backend-xml.c
   gnucash/trunk/src/core-utils/Makefile.am
   gnucash/trunk/src/core-utils/gnc-filepath-utils.c
   gnucash/trunk/src/core-utils/gnc-filepath-utils.h
   gnucash/trunk/src/gnome-utils/Makefile.am
   gnucash/trunk/src/gnome-utils/dialog-file-access.c
   gnucash/trunk/src/gnome-utils/druid-gnc-xml-import.c
   gnucash/trunk/src/gnome-utils/gnc-file.c
   gnucash/trunk/src/gnome-utils/gnc-main-window.c
   gnucash/trunk/src/gnome-utils/gnc-plugin-file-history.c
   gnucash/trunk/src/gnome/top-level.c
   gnucash/trunk/src/libqof/qof/qofsession.c
Log:
Use a normalized uri format internally to refer to data stores.

Data stores for GC can be a file (xml or sqlite3) or a database
one some server (mysql or postgres).
Wherever it makes sense internally, data stores will be referred to
via a normalized uri:
protocol://user:password@host:port/path
Depending on the context and story type some of these parts are optional or unused.

To achieve this, a new utility interface has been setup:
gnc_uri_<xxx>_<yyy>
that can be used to manipulate the uris or convert from non-normalized
formats to normalized and back.
For example, when the user selects a file in the Open or Save As dialog,
gnc_uri_get_normalized_uri will convert the file into a normalized uri.
Or when the actual filename is needed this can be extracted with
gnc_uri_get_path.
You can also test if a uri defines a file or something else with
gnc_uri_is_file_uri.

For the complete documentation, see src/core-utils/gnc-uri-uitls.h

This commit installs gnc-uri-utils and modifies the source where it makes
sense to use its convenience functions. This concerns all functions that
had to deal with file access in some way or another, the history module
and the functions that generate the history menu list and the window titles.

Note that gnc-uri-utils replaces xaccResolveFilePath and xaccResolveUrl in all cases.
xaccResolveUrl has been removed, because gnc-uri-utils fully replaces its functionality.
xaccResolveFilePath is used internally in gnc-uri-utils to ensure an absolute path
is always returned (in case of a file uri, not for db uris). But it has been renamed to
gnc_resolve_file_path to be more consistent with the other functions.

Lastly, this commit also adds a first implementation to work with a keyring to
store and retrieve passwords, althoug



More information about the gnucash-patches mailing list