r16701 - gnucash/branches/gda-dev2 - Merge in other changes from old gda-dev branch
Phil Longstaff
plongstaff at cvs.gnucash.org
Sun Dec 23 15:56:53 EST 2007
Author: plongstaff
Date: 2007-12-23 15:56:51 -0500 (Sun, 23 Dec 2007)
New Revision: 16701
Trac: http://svn.gnucash.org/trac/changeset/16701
Added:
gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-xml.c
gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-xml.h
gnucash/branches/gda-dev2/src/backend/xml/gncmod-backend-xml.c
gnucash/branches/gda-dev2/src/business/business-core/xml/gncmod-business-backend-xml.c
Removed:
gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-file.c
gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-file.h
gnucash/branches/gda-dev2/src/backend/xml/gncmod-backend-file.c
gnucash/branches/gda-dev2/src/business/business-core/xml/gncmod-business-backend-file.c
Modified:
gnucash/branches/gda-dev2/configure.in
gnucash/branches/gda-dev2/src/backend/Makefile.am
gnucash/branches/gda-dev2/src/backend/postgres/test/Makefile.am
gnucash/branches/gda-dev2/src/backend/xml/Makefile.am
gnucash/branches/gda-dev2/src/backend/xml/io-gncxml-v2.h
gnucash/branches/gda-dev2/src/backend/xml/test/Makefile.am
gnucash/branches/gda-dev2/src/backend/xml/test/test-load-backend.c
gnucash/branches/gda-dev2/src/backend/xml/test/test-load-xml2.c
gnucash/branches/gda-dev2/src/business/business-core/Makefile.am
gnucash/branches/gda-dev2/src/business/business-core/gncEntry.c
gnucash/branches/gda-dev2/src/business/business-core/gncEntry.h
gnucash/branches/gda-dev2/src/business/business-core/xml/Makefile.am
gnucash/branches/gda-dev2/src/business/business-gnome/business-gnome.scm
gnucash/branches/gda-dev2/src/engine/Account.c
gnucash/branches/gda-dev2/src/engine/SX-book.c
gnucash/branches/gda-dev2/src/engine/SX-book.h
gnucash/branches/gda-dev2/src/engine/SchedXaction.c
gnucash/branches/gda-dev2/src/engine/gnc-book.h
gnucash/branches/gda-dev2/src/engine/gnc-engine.c
gnucash/branches/gda-dev2/src/engine/gnc-filepath-utils.c
gnucash/branches/gda-dev2/src/experimental/cgi-bin/Makefile.am
gnucash/branches/gda-dev2/src/gnome-utils/Makefile.am
gnucash/branches/gda-dev2/src/gnome-utils/druid-gnc-xml-import.c
gnucash/branches/gda-dev2/src/gnome-utils/gnc-file.c
gnucash/branches/gda-dev2/src/gnome-utils/gnc-file.h
gnucash/branches/gda-dev2/src/gnome-utils/test/Makefile.am
gnucash/branches/gda-dev2/src/gnome/Makefile.am
gnucash/branches/gda-dev2/src/gnome/dialog-sx-editor.c
gnucash/branches/gda-dev2/src/import-export/qif-io-core/test/Makefile.am
gnucash/branches/gda-dev2/src/import-export/test/Makefile.am
gnucash/branches/gda-dev2/src/report/report-gnome/test/Makefile.am
gnucash/branches/gda-dev2/src/report/stylesheets/test/Makefile.am
Log:
Merge in other changes from old gda-dev branch
Modified: gnucash/branches/gda-dev2/configure.in
===================================================================
--- gnucash/branches/gda-dev2/configure.in 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/configure.in 2007-12-23 20:56:51 UTC (rev 16701)
@@ -1462,10 +1462,12 @@
src/app-utils/Makefile
src/app-utils/test/Makefile
src/backend/Makefile
- src/backend/file/Makefile
- src/backend/file/test/Makefile
- src/backend/file/test/test-files/Makefile
- src/backend/file/test/test-files/xml2/Makefile
+ src/backend/xml/Makefile
+ src/backend/xml/test/Makefile
+ src/backend/xml/test/test-files/Makefile
+ src/backend/xml/test/test-files/xml2/Makefile
+ src/backend/gda/Makefile
+ src/backend/gda/test/Makefile
src/backend/postgres/Makefile
src/backend/postgres/test/Makefile
src/bin/Makefile
@@ -1547,8 +1549,9 @@
src/test-core/Makefile
src/business/Makefile
src/business/business-core/Makefile
+ src/business/business-core/gda/Makefile
src/business/business-core/test/Makefile
- src/business/business-core/file/Makefile
+ src/business/business-core/xml/Makefile
src/business/business-utils/Makefile
src/business/dialog-tax-table/Makefile
src/business/business-gnome/Makefile
@@ -1571,6 +1574,9 @@
output_qof_lib_dir=`eval eval eval echo $QOF_LIB_DIR`
output_qof_xml_dir=`eval eval eval echo $QOF_XML_DIR`
+if test x${GDA_DIR} != x; then
+components="$components gda"
+fi
if test x${SQL_DIR} != x; then
components="$components sql"
fi
Modified: gnucash/branches/gda-dev2/src/backend/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/backend/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/backend/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -1,3 +1,3 @@
-SUBDIRS = file ${SQL_DIR}
-DIST_SUBDIRS = file postgres
+SUBDIRS = xml ${SQL_DIR} ${GDA_DIR}
+DIST_SUBDIRS = xml postgres gda
Modified: gnucash/branches/gda-dev2/src/backend/postgres/test/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/backend/postgres/test/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/backend/postgres/test/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -7,7 +7,7 @@
--gnc-module-dir ${top_builddir}/src/gnc-module \
--gnc-module-dir ${top_builddir}/src/engine \
--guile-load-dir ${top_srcdir}/src/engine \
- --gnc-module-dir ${top_builddir}/src/backend/file \
+ --gnc-module-dir ${top_builddir}/src/backend/xml \
--gnc-module-dir ${top_builddir}/src/backend/postgres
TESTS_ENVIRONMENT := \
Modified: gnucash/branches/gda-dev2/src/backend/xml/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/backend/xml/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/backend/xml/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -1,8 +1,8 @@
SUBDIRS = . test
# Now a shared library AND a GModule
-lib_LTLIBRARIES = libgnc-backend-file-utils.la
-pkglib_LTLIBRARIES = libgncmod-backend-file.la
+lib_LTLIBRARIES = libgnc-backend-xml-utils.la
+pkglib_LTLIBRARIES = libgncmod-backend-xml.la
AM_CFLAGS = \
-I.. -I../.. \
@@ -16,7 +16,7 @@
${GLIB_CFLAGS} \
${GCONF_CFLAGS}
-libgnc_backend_file_utils_la_SOURCES = \
+libgnc_backend_xml_utils_la_SOURCES = \
gnc-account-xml-v2.c \
gnc-book-xml-v2.c \
gnc-budget-xml-v2.c \
@@ -39,11 +39,11 @@
sixtp-utils.c \
sixtp.c
-libgncmod_backend_file_la_SOURCES = \
- gnc-backend-file.c
+libgncmod_backend_xml_la_SOURCES = \
+ gnc-backend-xml.c
noinst_HEADERS = \
- gnc-backend-file.h \
+ gnc-backend-xml.h \
gnc-xml.h \
gnc-xml-helper.h \
io-example-account.h \
@@ -58,18 +58,18 @@
sixtp-stack.h \
sixtp-utils.h
-libgnc_backend_file_utils_la_LIBADD = \
+libgnc_backend_xml_utils_la_LIBADD = \
${GLIB_LIBS} ${GCONF_LIBS} ${LIBXML2_LIBS} \
${top_builddir}/src/engine/libgncmod-engine.la \
${top_builddir}/src/core-utils/libgnc-core-utils.la \
${QOF_LIBS}
-libgncmod_backend_file_la_LDFLAGS = -module -avoid-version
-libgncmod_backend_file_la_LIBADD = \
+libgncmod_backend_xml_la_LDFLAGS = -module -avoid-version
+libgncmod_backend_xml_la_LIBADD = \
${GLIB_LIBS} ${GCONF_LIBS} ${LIBXML2_LIBS} \
${top_builddir}/src/engine/libgncmod-engine.la \
${top_builddir}/src/core-utils/libgnc-core-utils.la \
- libgnc-backend-file-utils.la \
+ libgnc-backend-xml-utils.la \
${QOF_LIBS}
-INCLUDES = -DG_LOG_DOMAIN=\"gnc.backend.file\"
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.backend.xml\"
Deleted: gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-file.c
===================================================================
--- gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-file.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-file.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -1,1074 +0,0 @@
-/********************************************************************
- * gnc-backend-file.c: load and save data to files *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU General Public License as *
- * published by the Free Software Foundation; either version 2 of *
- * the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License*
- * along with this program; if not, contact: *
- * *
- * Free Software Foundation Voice: +1-617-542-5942 *
- * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
- * Boston, MA 02110-1301, USA gnu at gnu.org *
-\********************************************************************/
-/** @file gnc-backend-file.c
- * @brief load and save data to files
- * @author Copyright (c) 2000 Gnumatic Inc.
- * @author Copyright (c) 2002 Derek Atkins <warlord at MIT.EDU>
- * @author Copyright (c) 2003 Linas Vepstas <linas at linas.org>
- *
- * This file implements the top-level QofBackend API for saving/
- * restoring data to/from an ordinary Unix filesystem file.
- */
-
-#include "config.h"
-
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glib/gstdio.h>
-#ifndef HAVE_GLIB_2_8
-#include <gstdio-2.8.h>
-#endif
-#include <libintl.h>
-#include <locale.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <dirent.h>
-#include <time.h>
-
-#include "qof.h"
-#include "TransLog.h"
-#include "gnc-engine.h"
-
-#include "gnc-filepath-utils.h"
-
-#include "io-gncxml.h"
-#include "io-gncxml-v2.h"
-#include "gnc-backend-file.h"
-#include "gnc-gconf-utils.h"
-
-#ifndef HAVE_STRPTIME
-# include "strptime.h"
-#endif
-
-#define GNC_BE_DAYS "file_retention_days"
-#define GNC_BE_ZIP "file_compression"
-
-static QofLogModule log_module = GNC_MOD_BACKEND;
-
-typedef enum
-{
- GNC_BOOK_NOT_OURS,
- GNC_BOOK_BIN_FILE,
- GNC_BOOK_XML1_FILE,
- GNC_BOOK_XML2_FILE,
- GNC_BOOK_XML2_FILE_NO_ENCODING,
- QSF_GNC_OBJECT,
- QSF_OBJECT,
- QSF_MAP,
-} QofBookFileType;
-
-/* ================================================================= */
-
-static gboolean
-gnc_file_be_get_file_lock (FileBackend *be)
-{
- struct stat statbuf;
-#ifndef G_OS_WIN32
- char pathbuf[PATH_MAX];
- char *path = NULL;
-#endif
- int rc;
- QofBackendError be_err;
-
- rc = g_stat (be->lockfile, &statbuf);
- if (!rc)
- {
- /* oops .. file is locked by another user .. */
- qof_backend_set_error ((QofBackend*)be, ERR_BACKEND_LOCKED);
- return FALSE;
- }
-
- be->lockfd = g_open (be->lockfile, O_RDWR | O_CREAT | O_EXCL , 0);
- if (be->lockfd < 0)
- {
- /* oops .. we can't create the lockfile .. */
- switch (errno) {
- case EACCES:
- case EROFS:
- case ENOSPC:
- be_err = ERR_BACKEND_READONLY;
- break;
- default:
- be_err = ERR_BACKEND_LOCKED;
- break;
- }
- qof_backend_set_error ((QofBackend*)be, be_err);
- return FALSE;
- }
-
- /* OK, now work around some NFS atomic lock race condition
- * mumbo-jumbo. We do this by linking a unique file, and
- * then examing the link count. At least that's what the
- * NFS programmers guide suggests.
- * Note: the "unique filename" must be unique for the
- * triplet filename-host-process, otherwise accidental
- * aliases can occur.
- */
-
- /* apparently, even this code may not work for some NFS
- * implementations. In the long run, I am told that
- * ftp.debian.org
- * /pub/debian/dists/unstable/main/source/libs/liblockfile_0.1-6.tar.gz
- * provides a better long-term solution.
- */
-
-#ifndef G_OS_WIN32
- strcpy (pathbuf, be->lockfile);
- path = strrchr (pathbuf, '.');
- sprintf (path, ".%lx.%d.LNK", gethostid(), getpid());
-
- rc = link (be->lockfile, pathbuf);
- if (rc)
- {
- /* If hard links aren't supported, just allow the lock. */
- if (errno == EPERM
-# ifdef EOPNOTSUPP
- || errno == EOPNOTSUPP
-# endif
- )
- {
- be->linkfile = NULL;
- return TRUE;
- }
-
- /* Otherwise, something else is wrong. */
- qof_backend_set_error ((QofBackend*)be, ERR_BACKEND_LOCKED);
- g_unlink (pathbuf);
- close (be->lockfd);
- g_unlink (be->lockfile);
- return FALSE;
- }
-
- rc = g_stat (be->lockfile, &statbuf);
- if (rc)
- {
- /* oops .. stat failed! This can't happen! */
- qof_backend_set_error ((QofBackend*)be, ERR_BACKEND_LOCKED);
- g_unlink (pathbuf);
- close (be->lockfd);
- g_unlink (be->lockfile);
- return FALSE;
- }
-
- if (statbuf.st_nlink != 2)
- {
- qof_backend_set_error ((QofBackend*)be, ERR_BACKEND_LOCKED);
- g_unlink (pathbuf);
- close (be->lockfd);
- g_unlink (be->lockfile);
- return FALSE;
- }
-
- be->linkfile = g_strdup (pathbuf);
-
- return TRUE;
-
-#else /* ifndef G_OS_WIN32 */
- /* On windows, there is no NFS and the open(,O_CREAT | O_EXCL)
- is sufficient for locking. */
- be->linkfile = NULL;
- return TRUE;
-#endif /* ifndef G_OS_WIN32 */
-}
-
-/* ================================================================= */
-
-static void
-file_session_begin(QofBackend *be_start, QofSession *session,
- const char *book_id,
- gboolean ignore_lock, gboolean create_if_nonexistent)
-{
- FileBackend *be = (FileBackend*) be_start;
-
- ENTER (" ");
-
- /* Make sure the directory is there */
- be->fullpath = xaccResolveFilePath(book_id);
- if (NULL == be->fullpath)
- {
- qof_backend_set_error (be_start, ERR_FILEIO_FILE_NOT_FOUND);
- LEAVE("");
- return;
- }
- be->be.fullpath = be->fullpath;
- be->dirname = g_path_get_dirname (be->fullpath);
-
- {
- struct stat statbuf;
- int rc;
-
- /* Again check whether the directory can be accessed */
- rc = g_stat (be->dirname, &statbuf);
- if (rc != 0 || !S_ISDIR(statbuf.st_mode))
- {
- /* Error on stat or if it isn't a directory means we
- cannot find this filename */
- qof_backend_set_error (be_start, ERR_FILEIO_FILE_NOT_FOUND);
- g_free (be->fullpath); be->fullpath = NULL;
- g_free (be->dirname); be->dirname = NULL;
- LEAVE("");
- return;
- }
-
- /* Now check whether we can g_stat the file itself */
- rc = g_stat (be->fullpath, &statbuf);
- if ((rc != 0) && (!create_if_nonexistent))
- {
- /* Error on stat means the file doesn't exist */
- qof_backend_set_error (be_start, ERR_FILEIO_FILE_NOT_FOUND);
- g_free (be->fullpath); be->fullpath = NULL;
- g_free (be->dirname); be->dirname = NULL;
- LEAVE("");
- return;
- }
- if (rc == 0 && S_ISDIR(statbuf.st_mode))
- {
- /* FIXME: What is actually checked here? Whether the
- fullpath erroneously points to a directory or what?
- Then the error message should be changed into something
- much more clear! */
- qof_backend_set_error (be_start, ERR_FILEIO_UNKNOWN_FILE_TYPE);
- g_free (be->fullpath); be->fullpath = NULL;
- g_free (be->dirname); be->dirname = NULL;
- LEAVE("");
- return;
- }
- }
-
- /* ---------------------------------------------------- */
- /* We should now have a fully resolved path name.
- * Lets see if we can get a lock on it. */
-
- be->lockfile = g_strconcat(be->fullpath, ".LCK", NULL);
-
- if (!ignore_lock && !gnc_file_be_get_file_lock (be))
- {
- g_free (be->lockfile); be->lockfile = NULL;
- LEAVE("");
- return;
- }
-
- LEAVE (" ");
- return;
-}
-
-/* ================================================================= */
-
-static void
-file_session_end(QofBackend *be_start)
-{
- FileBackend *be = (FileBackend*)be_start;
- ENTER (" ");
-
- if (be->linkfile)
- g_unlink (be->linkfile);
-
- if (be->lockfd > 0)
- close (be->lockfd);
-
- if (be->lockfile) {
- int rv;
-#ifdef G_OS_WIN32
- /* On windows, we need to allow write-access before
- g_unlink() can succeed */
- rv = g_chmod (be->lockfile, S_IWRITE | S_IREAD);
-#endif
- rv = g_unlink (be->lockfile);
- if (rv) {
- PWARN("Error on g_unlink(%s): %d: %s", be->lockfile,
- errno, strerror(errno) ? strerror(errno) : "");
- }
- }
-
- g_free (be->dirname);
- be->dirname = NULL;
-
- g_free (be->fullpath);
- be->fullpath = NULL;
-
- g_free (be->lockfile);
- be->lockfile = NULL;
-
- g_free (be->linkfile);
- be->linkfile = NULL;
- LEAVE (" ");
-}
-
-static void
-file_destroy_backend(QofBackend *be)
-{
- g_free(be);
-}
-
-/* ================================================================= */
-/* Write the financial data in a book to a file, returning FALSE on
- error and setting the error_result to indicate what went wrong if
- it's not NULL. This function does not manage file locks in any
- way.
-
- If make_backup is true, write out a time-stamped copy of the file
- into the same directory as the indicated file, with a filename of
- "file.YYYYMMDDHHMMSS.xac" where YYYYMMDDHHMMSS is replaced with the
- current year/month/day/hour/minute/second. */
-
-static gboolean
-copy_file(const char *orig, const char *bkup)
-{
- static int buf_size = 1024;
- char buf[buf_size];
- int orig_fd;
- int bkup_fd;
- int flags=0;
- ssize_t count_write;
- ssize_t count_read;
-
-#ifdef G_OS_WIN32
- flags = O_BINARY;
-#endif
-
- orig_fd = g_open(orig, O_RDONLY | flags, 0);
- if(orig_fd == -1)
- {
- return FALSE;
- }
- bkup_fd = g_open(bkup, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL | flags, 0600);
- if(bkup_fd == -1)
- {
- close(orig_fd);
- return FALSE;
- }
-
- do
- {
- count_read = read(orig_fd, buf, buf_size);
- if(count_read == -1 && errno != EINTR)
- {
- close(orig_fd);
- close(bkup_fd);
- return FALSE;
- }
-
- if(count_read > 0)
- {
- count_write = write(bkup_fd, buf, count_read);
- if(count_write == -1)
- {
- close(orig_fd);
- close(bkup_fd);
- return FALSE;
- }
- }
- } while(count_read > 0);
-
- close(orig_fd);
- close(bkup_fd);
-
- return TRUE;
-}
-
-/* ================================================================= */
-
-static gboolean
-gnc_int_link_or_make_backup(FileBackend *be, const char *orig, const char *bkup)
-{
- int err_ret =
-#ifdef HAVE_LINK
- link (orig, bkup)
-#else
- -1
-#endif
- ;
- if(err_ret != 0)
- {
-#ifdef HAVE_LINK
- if(errno == EPERM
-# ifdef EOPNOTSUPP
- || errno == EOPNOTSUPP
-# endif
- )
-#endif
- {
- err_ret = copy_file(orig, bkup);
- }
-
- if(!err_ret)
- {
- qof_backend_set_error((QofBackend*)be, ERR_FILEIO_BACKUP_ERROR);
- PWARN ("unable to make file backup from %s to %s: %s",
- orig, bkup, strerror(errno) ? strerror(errno) : "");
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/* ================================================================= */
-
-static QofBookFileType
-gnc_file_be_determine_file_type(const char *path)
-{
- gboolean with_encoding;
- if (gnc_is_xml_data_file_v2(path, &with_encoding)) {
- if (with_encoding) {
- return GNC_BOOK_XML2_FILE;
- } else {
- return GNC_BOOK_XML2_FILE_NO_ENCODING;
- }
- } else if (gnc_is_xml_data_file(path)) {
- return GNC_BOOK_XML1_FILE;
- }
- return GNC_BOOK_NOT_OURS;
-}
-
-static gboolean
-gnc_determine_file_type (const char *path)
-{
- struct stat sbuf;
- int rc;
- FILE *t;
-
- if (!path) { return FALSE; }
- if (0 == safe_strcmp(path, QOF_STDOUT)) { return FALSE; }
- t = g_fopen(path, "r");
- if(!t) { PINFO (" new file"); return TRUE; }
- fclose(t);
- rc = g_stat(path, &sbuf);
- if(rc < 0) { return FALSE; }
- if (sbuf.st_size == 0) { PINFO (" empty file"); return TRUE; }
- if(gnc_is_xml_data_file_v2(path, NULL)) { return TRUE; }
- else if(gnc_is_xml_data_file(path)) { return TRUE; }
- PINFO (" %s is not a gnc file", path);
- return FALSE;
-}
-
-static gboolean
-gnc_file_be_backup_file(FileBackend *be)
-{
- gboolean bkup_ret;
- char *timestamp;
- char *backup;
- const char *datafile;
- struct stat statbuf;
- int rc;
-
- datafile = be->fullpath;
-
- rc = g_stat (datafile, &statbuf);
- if (rc)
- return (errno == ENOENT);
-
- if(gnc_file_be_determine_file_type(datafile) == GNC_BOOK_BIN_FILE)
- {
- /* make a more permament safer backup */
- const char *back = "-binfmt.bkup";
- char *bin_bkup = g_new(char, strlen(datafile) + strlen(back) + 1);
- strcpy(bin_bkup, datafile);
- strcat(bin_bkup, back);
- bkup_ret = gnc_int_link_or_make_backup(be, datafile, bin_bkup);
- g_free(bin_bkup);
- if(!bkup_ret)
- {
- return FALSE;
- }
- }
-
- timestamp = xaccDateUtilGetStampNow ();
- backup = g_new (char, strlen (datafile) + strlen (timestamp) + 6);
- strcpy (backup, datafile);
- strcat (backup, ".");
- strcat (backup, timestamp);
- strcat (backup, ".xac");
- g_free (timestamp);
-
- bkup_ret = gnc_int_link_or_make_backup(be, datafile, backup);
- g_free(backup);
-
- return bkup_ret;
-}
-
-/* ================================================================= */
-
-static gboolean
-gnc_file_be_write_to_file(FileBackend *fbe,
- QofBook *book,
- const gchar *datafile,
- gboolean make_backup)
-{
- QofBackend *be = &fbe->be;
- char *tmp_name;
- struct stat statbuf;
- int rc;
- QofBackendError be_err;
-
- ENTER (" book=%p file=%s", book, datafile);
-
- /* If the book is 'clean', recently saved, then don't save again. */
- /* XXX this is currently broken due to faulty 'Save As' logic. */
- /* if (FALSE == qof_book_not_saved (book)) return FALSE; */
-
- tmp_name = g_new(char, strlen(datafile) + 12);
- strcpy(tmp_name, datafile);
- strcat(tmp_name, ".tmp-XXXXXX");
-
- if(!mktemp(tmp_name))
- {
- qof_backend_set_error(be, ERR_BACKEND_MISC);
- LEAVE("");
- return FALSE;
- }
-
- if(make_backup)
- {
- if(!gnc_file_be_backup_file(fbe))
- {
- LEAVE("");
- return FALSE;
- }
- }
-
- if (gnc_book_write_to_xml_file_v2(book, tmp_name, fbe->file_compression))
- {
- /* Record the file's permissions before g_unlinking it */
- rc = g_stat(datafile, &statbuf);
- if(rc == 0)
- {
- /* Use the permissions from the original data file */
- if(g_chmod(tmp_name, statbuf.st_mode) != 0)
- {
- /* qof_backend_set_error(be, ERR_BACKEND_PERM); */
- /* Even if the chmod did fail, the save
- nevertheless completed successfully. It is
- therefore wrong to signal the ERR_BACKEND_PERM
- error here which implies that the saving itself
- failed. Instead, we simply ignore this. */
- PWARN("unable to chmod filename %s: %s",
- tmp_name ? tmp_name : "(null)",
- strerror(errno) ? strerror(errno) : "");
-#if VFAT_DOESNT_SUCK /* chmod always fails on vfat/samba fs */
- /* g_free(tmp_name); */
- /* return FALSE; */
-#endif
- }
-#ifdef HAVE_CHOWN
- /* Don't try to change the owner. Only root can do
- that. */
- if(chown(tmp_name, -1, statbuf.st_gid) != 0)
- {
- /* qof_backend_set_error(be, ERR_BACKEND_PERM); */
- /* A failed chown doesn't mean that the saving itself
- failed. So don't abort with an error here! */
- PWARN("unable to chown filename %s: %s",
- tmp_name ? tmp_name : "(null)",
- strerror(errno) ? strerror(errno) : "");
-#if VFAT_DOESNT_SUCK /* chown always fails on vfat fs */
- /* g_free(tmp_name);
- return FALSE; */
-#endif
- }
-#endif
- }
- if(g_unlink(datafile) != 0 && errno != ENOENT)
- {
- qof_backend_set_error(be, ERR_BACKEND_READONLY);
- PWARN("unable to unlink filename %s: %s",
- datafile ? datafile : "(null)",
- strerror(errno) ? strerror(errno) : "");
- g_free(tmp_name);
- LEAVE("");
- return FALSE;
- }
- if(!gnc_int_link_or_make_backup(fbe, tmp_name, datafile))
- {
- qof_backend_set_error(be, ERR_FILEIO_BACKUP_ERROR);
- g_free(tmp_name);
- LEAVE("");
- return FALSE;
- }
- if(g_unlink(tmp_name) != 0)
- {
- qof_backend_set_error(be, ERR_BACKEND_PERM);
- PWARN("unable to unlink temp filename %s: %s",
- tmp_name ? tmp_name : "(null)",
- strerror(errno) ? strerror(errno) : "");
- g_free(tmp_name);
- LEAVE("");
- return FALSE;
- }
- g_free(tmp_name);
-
- /* Since we successfully saved the book,
- * we should mark it clean. */
- qof_book_mark_saved (book);
- LEAVE (" sucessful save of book=%p to file=%s", book, datafile);
- return TRUE;
- }
- else
- {
- if(g_unlink(tmp_name) != 0)
- {
- switch (errno) {
- case ENOENT: /* tmp_name doesn't exist? Assume "RO" error */
- case EACCES:
- case EPERM:
- case EROFS:
- be_err = ERR_BACKEND_READONLY;
- break;
- default:
- be_err = ERR_BACKEND_MISC;
- }
- qof_backend_set_error(be, be_err);
- PWARN("unable to unlink temp_filename %s: %s",
- tmp_name ? tmp_name : "(null)",
- strerror(errno) ? strerror(errno) : "");
- /* already in an error just flow on through */
- }
- g_free(tmp_name);
- LEAVE("");
- return FALSE;
- }
- LEAVE("");
- return TRUE;
-}
-
-/* ================================================================= */
-
-static int
-gnc_file_be_select_files (const gchar *d)
-{
- return (g_str_has_suffix(d, ".LNK") ||
- g_str_has_suffix(d, ".xac") ||
- g_str_has_suffix(d, ".log"));
-}
-
-static void
-gnc_file_be_remove_old_files(FileBackend *be)
-{
- const gchar *dent;
- GDir *dir;
- struct stat lockstatbuf, statbuf;
- int pathlen;
- time_t now;
-
- if (g_stat (be->lockfile, &lockstatbuf) != 0)
- return;
- pathlen = strlen(be->fullpath);
-
- /*
- * Clean up any lockfiles from prior crashes, and clean up old
- * data and log files. Scandir will do a fist pass on the
- * filenames and cull the directory down to just files with the
- * appropriate extensions. Pity you can't pass user data into
- * scandir...
- */
-
- /*
- * Unfortunately scandir() is not portable, so re-write this
- * function without it. Note that this version will be even a bit
- * faster because it does not have to sort, malloc, or anything
- * else that scandir did, and it only performs a single pass
- * through the directory rather than one pass through the
- * directory and then one pass over the 'matching' files. --
- * warlord at MIT.EDU 2002-05-06
- */
-
- dir = g_dir_open (be->dirname, 0, NULL);
- if (!dir)
- return;
-
- now = time(NULL);
- while((dent = g_dir_read_name(dir)) != NULL) {
- char *name;
- int len;
-
- if (gnc_file_be_select_files (dent) == 0)
- continue;
-
- name = g_build_filename(be->dirname, dent, (gchar*)NULL);
- len = strlen(name) - 4;
-
- /* Is this file associated with the current data file */
- if (strncmp(name, be->fullpath, pathlen) == 0)
- {
- if ((safe_strcmp(name + len, ".LNK") == 0) &&
- /* Is a lock file. Skip the active lock file */
- (safe_strcmp(name, be->linkfile) != 0) &&
- /* Only delete lock files older than the active one */
- (g_stat(name, &statbuf) == 0) &&
- (statbuf.st_mtime <lockstatbuf.st_mtime))
- {
- PINFO ("unlink lock file: %s", name);
- g_unlink(name);
- }
- else if (be->file_retention_days > 0)
- {
- time_t file_time;
- struct tm file_tm;
- int days;
- const char* res;
-
- PINFO ("file retention = %d days", be->file_retention_days);
-
- /* Is the backup file old enough to delete */
- memset(&file_tm, 0, sizeof(file_tm));
- res = strptime(name+pathlen+1, "%Y%m%d%H%M%S", &file_tm);
- file_time = mktime(&file_tm);
- days = (int)(difftime(now, file_time) / 86400);
-
-
- if (res
- && res != name+pathlen+1
- && (strcmp(res, ".xac") == 0
- || strcmp(res, ".log") == 0)
- && file_time > 0
- && days > be->file_retention_days)
- {
- PINFO ("g_unlink stale (%d days old) file: %s", days, name);
- g_unlink(name);
- }
- }
- }
- g_free(name);
- }
- g_dir_close (dir);
-}
-
-static void
-file_sync_all(QofBackend* be, QofBook *book)
-{
- FileBackend *fbe = (FileBackend *) be;
- ENTER ("book=%p, primary=%p", book, fbe->primary_book);
-
- /* We make an important assumption here, that we might want to change
- * in the future: when the user says 'save', we really save the one,
- * the only, the current open book, and nothing else. We do this
- * because we assume that any other books that we are dealing with
- * are 'read-only', non-editable, because they are closed books.
- * If we ever want to have more than one book open read-write,
- * this will have to change.
- */
- if (NULL == fbe->primary_book) fbe->primary_book = book;
- if (book != fbe->primary_book) return;
-
- gnc_file_be_write_to_file (fbe, book, fbe->fullpath, TRUE);
- gnc_file_be_remove_old_files (fbe);
- LEAVE ("book=%p", book);
-}
-
-/* ================================================================= */
-/* Routines to deal with the creation of multiple books.
- * The core design assumption here is that the book
- * begin-edit/commit-edit routines are used solely to write out
- * closed accounting periods to files. They're not currently
- * designed to do anything other than this. (Although they could be).
- */
-
-static char *
-build_period_filepath (FileBackend *fbe, QofBook *book)
-{
- int len;
- char *str, *p, *q;
-
- len = strlen (fbe->fullpath) + GUID_ENCODING_LENGTH + 14;
- str = g_new (char, len);
- strcpy (str, fbe->fullpath);
-
- /* XXX it would be nice for the user if we made the book
- * closing date and/or title part of the file-name. */
- p = strrchr (str, G_DIR_SEPARATOR);
- p++;
- p = stpcpy (p, "book-");
- p = guid_to_string_buff (qof_book_get_guid(book), p);
- p = stpcpy (p, "-");
- q = strrchr (fbe->fullpath, G_DIR_SEPARATOR);
- q++;
- p = stpcpy (p, q);
- p = stpcpy (p, ".gml");
-
- return str;
-}
-
-static void
-file_begin_edit (QofBackend *be, QofInstance *inst)
-{
- if (0) build_period_filepath(0, 0);
-#if BORKEN_FOR_NOW
- FileBackend *fbe = (FileBackend *) be;
- QofBook *book = gp;
- const char * filepath;
-
- QofIdTypeConst typ = QOF_INSTANCE(inst)->e_type;
- if (strcmp (GNC_ID_PERIOD, typ)) return;
- filepath = build_period_filepath(fbe, book);
- PINFO (" ====================== book=%p filepath=%s\n", book, filepath);
-
- if (NULL == fbe->primary_book)
- {
- PERR ("You should have saved the data "
- "at least once before closing the books!\n");
- }
- /* XXX To be anal about it, we should really be checking to see
- * if there already is a file with this book GUID, and disallowing
- * further progress. This is because we are not allowed to
- * modify books that are closed (They should be treated as
- * 'read-only').
- */
-#endif
-}
-
-static void
-file_rollback_edit (QofBackend *be, QofInstance *inst)
-{
-#if BORKEN_FOR_NOW
- QofBook *book = gp;
-
- if (strcmp (GNC_ID_PERIOD, typ)) return;
- PINFO ("book=%p", book);
-#endif
-}
-
-static void
-file_commit_edit (QofBackend *be, QofInstance *inst)
-{
-#if BORKEN_FOR_NOW
- FileBackend *fbe = (FileBackend *) be;
- QofBook *book = gp;
- const char * filepath;
-
- if (strcmp (GNC_ID_PERIOD, typ)) return;
- filepath = build_period_filepath(fbe, book);
- PINFO (" ====================== book=%p filepath=%s\n", book, filepath);
- gnc_file_be_write_to_file(fbe, book, filepath, FALSE);
-
- /* We want to force a save of the current book at this point,
- * because if we don't, and the user forgets to do so, then
- * there'll be the same transactions in the closed book,
- * and also in the current book. */
- gnc_file_be_write_to_file (fbe, fbe->primary_book, fbe->fullpath, TRUE);
-#endif
-}
-
-/* ---------------------------------------------------------------------- */
-
-
-/* Load financial data from a file into the book, automatically
- detecting the format of the file, if possible. Return FALSE on
- error, and set the error parameter to indicate what went wrong if
- it's not NULL. This function does not manage file locks in any
- way. */
-
-static void
-gnc_file_be_load_from_file (QofBackend *bend, QofBook *book)
-{
- QofBackendError error;
- gboolean rc;
- FileBackend *be = (FileBackend *) bend;
-
- error = ERR_BACKEND_NO_ERR;
- be->primary_book = book;
-
- switch (gnc_file_be_determine_file_type(be->fullpath))
- {
- case GNC_BOOK_XML2_FILE:
- rc = qof_session_load_from_xml_file_v2 (be, book);
- if (FALSE == rc) error = ERR_FILEIO_PARSE_ERROR;
- break;
-
- case GNC_BOOK_XML2_FILE_NO_ENCODING:
- error = ERR_FILEIO_NO_ENCODING;
- break;
- case GNC_BOOK_XML1_FILE:
- rc = qof_session_load_from_xml_file (book, be->fullpath);
- if (FALSE == rc) error = ERR_FILEIO_PARSE_ERROR;
- break;
- default:
- /* If file type wasn't known, check errno again to give the
- user some more useful feedback for some particular error
- conditions. */
- switch (errno)
- {
- case EACCES: /* No read permission */
- PWARN("No read permission to file");
- error = ERR_FILEIO_FILE_EACCES;
- break;
- case EISDIR: /* File is a directory - but on this error we don't arrive here */
- PWARN("Filename is a directory");
- error = ERR_FILEIO_FILE_NOT_FOUND;
- break;
- default:
- PWARN("File not any known type");
- error = ERR_FILEIO_UNKNOWN_FILE_TYPE;
- break;
- }
- break;
- }
-
- if(error != ERR_BACKEND_NO_ERR)
- {
- qof_backend_set_error(bend, error);
- }
-
- /* We just got done loading, it can't possibly be dirty !! */
- qof_book_mark_saved (book);
-}
-
-/* ---------------------------------------------------------------------- */
-
-static gboolean
-gnc_file_be_save_may_clobber_data (QofBackend *bend)
-{
- struct stat statbuf;
- if (!bend->fullpath) return FALSE;
-
- /* FIXME: Make sure this doesn't need more sophisticated semantics
- * in the face of special file, devices, pipes, symlinks, etc. */
- if (g_stat(bend->fullpath, &statbuf) == 0) return TRUE;
- return FALSE;
-}
-
-
-static void
-gnc_file_be_write_accounts_to_file(QofBackend *be, QofBook *book)
-{
- const gchar *datafile;
-
- datafile = ((FileBackend *)be)->fullpath;
- gnc_book_write_accounts_to_xml_file_v2(be, book, datafile);
-}
-
-/* ================================================================= */
-#if 0 //def GNUCASH_MAJOR_VERSION
-QofBackend *
-libgncmod_backend_file_LTX_gnc_backend_new(void)
-{
-
- fbe->dirname = NULL;
- fbe->fullpath = NULL;
- fbe->lockfile = NULL;
- fbe->linkfile = NULL;
- fbe->lockfd = -1;
-
- fbe->primary_book = NULL;
-
- return be;
-}
-#endif
-
-static void
-retain_changed_cb(GConfEntry *entry, gpointer user_data)
-{
- FileBackend *be = (FileBackend*)user_data;
- g_return_if_fail(be != NULL);
- be->file_retention_days = (int)gnc_gconf_get_float("general", "retain_days", NULL);
-}
-
-static void
-compression_changed_cb(GConfEntry *entry, gpointer user_data)
-{
- FileBackend *be = (FileBackend*)user_data;
- g_return_if_fail(be != NULL);
- be->file_compression = gnc_gconf_get_bool("general", "file_compression", NULL);
-}
-
-static QofBackend*
-gnc_backend_new(void)
-{
- FileBackend *gnc_be;
- QofBackend *be;
-
- gnc_be = g_new0(FileBackend, 1);
- be = (QofBackend*) gnc_be;
- qof_backend_init(be);
-
- be->session_begin = file_session_begin;
- be->session_end = file_session_end;
- be->destroy_backend = file_destroy_backend;
-
- be->load = gnc_file_be_load_from_file;
- be->save_may_clobber_data = gnc_file_be_save_may_clobber_data;
-
- /* The file backend treats accounting periods transactionally. */
- be->begin = file_begin_edit;
- be->commit = file_commit_edit;
- be->rollback = file_rollback_edit;
-
- /* The file backend always loads all data ... */
- be->compile_query = NULL;
- be->free_query = NULL;
- be->run_query = NULL;
-
- be->counter = NULL;
-
- /* The file backend will never be multi-user... */
- be->events_pending = NULL;
- be->process_events = NULL;
-
- be->sync = file_sync_all;
- be->load_config = NULL;
- be->get_config = NULL;
-
- be->export = gnc_file_be_write_accounts_to_file;
-
- gnc_be->dirname = NULL;
- gnc_be->fullpath = NULL;
- gnc_be->lockfile = NULL;
- gnc_be->linkfile = NULL;
- gnc_be->lockfd = -1;
-
- gnc_be->primary_book = NULL;
-
- gnc_be->file_retention_days = (int)gnc_gconf_get_float("general", "retain_days", NULL);
- gnc_be->file_compression = gnc_gconf_get_bool("general", "file_compression", NULL);
-
- gnc_gconf_general_register_cb("retain_days", retain_changed_cb, be);
- gnc_gconf_general_register_cb("file_compression", compression_changed_cb, be);
-
- return be;
-}
-
-static void
-gnc_provider_free (QofBackendProvider *prov)
-{
- prov->provider_name = NULL;
- prov->access_method = NULL;
- g_free (prov);
-}
-
-G_MODULE_EXPORT void
-qof_backend_module_init(void)
-{
- QofBackendProvider *prov;
- prov = g_new0 (QofBackendProvider, 1);
- prov->provider_name = "GnuCash File Backend Version 2";
- prov->access_method = "file";
- prov->partial_book_supported = FALSE;
- prov->backend_new = gnc_backend_new;
- prov->provider_free = gnc_provider_free;
- prov->check_data_type = gnc_determine_file_type;
- qof_backend_register_provider (prov);
-}
-
-/* ========================== END OF FILE ===================== */
Deleted: gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-file.h
===================================================================
--- gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-file.h 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-file.h 2007-12-23 20:56:51 UTC (rev 16701)
@@ -1,62 +0,0 @@
-/********************************************************************
- * gnc-backend-file.h: load and save data to files *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU General Public License as *
- * published by the Free Software Foundation; either version 2 of *
- * the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License*
- * along with this program; if not, contact: *
- * *
- * Free Software Foundation Voice: +1-617-542-5942 *
- * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
- * Boston, MA 02110-1301, USA gnu at gnu.org *
-\********************************************************************/
-/** @file gnc-backend-file.h
- * @brief load and save data to files
- * @author Copyright (c) 2000 Gnumatic Inc.
- * @author Copyright (c) 2002 Derek Atkins <warlord at MIT.EDU>
- * @author Copyright (c) 2003 Linas Vepstas <linas at linas.org>
- *
- * This file implements the top-level QofBackend API for saving/
- * restoring data to/from an ordinary Unix filesystem file.
- */
-
-#ifndef GNC_BACKEND_FILE_H_
-#define GNC_BACKEND_FILE_H_
-
-#include "qof.h"
-#include <gmodule.h>
-
-#include "qofbackend-p.h"
-struct FileBackend_struct
-{
- QofBackend be;
-
- char *dirname;
- char *fullpath; /* Fully qualified path to book */
- char *lockfile;
- char *linkfile;
- int lockfd;
-
- QofBook *primary_book; /* The primary, main open book */
-
- int file_retention_days;
- gboolean file_compression;
-};
-
-typedef struct FileBackend_struct FileBackend;
-
-// This is now a static inside the module
-//QofBackend * libgncmod_backend_file_LTX_gnc_backend_new(void);
-
-G_MODULE_EXPORT void
-qof_backend_module_init(void);
-
-#endif /* GNC_BACKEND_FILE_H_ */
Copied: gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-xml.c (from rev 16700, gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-file.c)
===================================================================
--- gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-xml.c (rev 0)
+++ gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-xml.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -0,0 +1,1089 @@
+/********************************************************************
+ * gnc-backend-xml.c: load and save data to XML files *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation; either version 2 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact: *
+ * *
+ * Free Software Foundation Voice: +1-617-542-5942 *
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
+ * Boston, MA 02110-1301, USA gnu at gnu.org *
+\********************************************************************/
+/** @file gnc-backend-xml.c
+ * @brief load and save data to XML files
+ * @author Copyright (c) 2000 Gnumatic Inc.
+ * @author Copyright (c) 2002 Derek Atkins <warlord at MIT.EDU>
+ * @author Copyright (c) 2003 Linas Vepstas <linas at linas.org>
+ *
+ * This file implements the top-level QofBackend API for saving/
+ * restoring data to/from an ordinary Unix filesystem file.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <glib/gstdio.h>
+#ifndef HAVE_GLIB_2_8
+#include <gstdio-2.8.h>
+#endif
+#include <libintl.h>
+#include <locale.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <dirent.h>
+#include <time.h>
+
+#include "qof.h"
+#include "TransLog.h"
+#include "gnc-engine.h"
+
+#include "gnc-filepath-utils.h"
+
+#include "io-gncxml.h"
+#include "io-gncxml-v2.h"
+#include "gnc-backend-xml.h"
+#include "gnc-gconf-utils.h"
+
+#ifndef HAVE_STRPTIME
+# include "strptime.h"
+#endif
+
+#define GNC_BE_DAYS "file_retention_days"
+#define GNC_BE_ZIP "file_compression"
+
+static QofLogModule log_module = GNC_MOD_BACKEND;
+
+typedef enum
+{
+ GNC_BOOK_NOT_OURS,
+ GNC_BOOK_BIN_FILE,
+ GNC_BOOK_XML1_FILE,
+ GNC_BOOK_XML2_FILE,
+ GNC_BOOK_XML2_FILE_NO_ENCODING,
+ QSF_GNC_OBJECT,
+ QSF_OBJECT,
+ QSF_MAP,
+} QofBookFileType;
+
+/* ================================================================= */
+
+static gboolean
+gnc_file_be_get_file_lock (FileBackend *be)
+{
+ struct stat statbuf;
+#ifndef G_OS_WIN32
+ char pathbuf[PATH_MAX];
+ char *path = NULL;
+#endif
+ int rc;
+ QofBackendError be_err;
+
+ rc = g_stat (be->lockfile, &statbuf);
+ if (!rc)
+ {
+ /* oops .. file is locked by another user .. */
+ qof_backend_set_error ((QofBackend*)be, ERR_BACKEND_LOCKED);
+ return FALSE;
+ }
+
+ be->lockfd = g_open (be->lockfile, O_RDWR | O_CREAT | O_EXCL , 0);
+ if (be->lockfd < 0)
+ {
+ /* oops .. we can't create the lockfile .. */
+ switch (errno) {
+ case EACCES:
+ case EROFS:
+ case ENOSPC:
+ be_err = ERR_BACKEND_READONLY;
+ break;
+ default:
+ be_err = ERR_BACKEND_LOCKED;
+ break;
+ }
+ qof_backend_set_error ((QofBackend*)be, be_err);
+ return FALSE;
+ }
+
+ /* OK, now work around some NFS atomic lock race condition
+ * mumbo-jumbo. We do this by linking a unique file, and
+ * then examing the link count. At least that's what the
+ * NFS programmers guide suggests.
+ * Note: the "unique filename" must be unique for the
+ * triplet filename-host-process, otherwise accidental
+ * aliases can occur.
+ */
+
+ /* apparently, even this code may not work for some NFS
+ * implementations. In the long run, I am told that
+ * ftp.debian.org
+ * /pub/debian/dists/unstable/main/source/libs/liblockfile_0.1-6.tar.gz
+ * provides a better long-term solution.
+ */
+
+#ifndef G_OS_WIN32
+ strcpy (pathbuf, be->lockfile);
+ path = strrchr (pathbuf, '.');
+ sprintf (path, ".%lx.%d.LNK", gethostid(), getpid());
+
+ rc = link (be->lockfile, pathbuf);
+ if (rc)
+ {
+ /* If hard links aren't supported, just allow the lock. */
+ if (errno == EPERM
+# ifdef EOPNOTSUPP
+ || errno == EOPNOTSUPP
+# endif
+ )
+ {
+ be->linkfile = NULL;
+ return TRUE;
+ }
+
+ /* Otherwise, something else is wrong. */
+ qof_backend_set_error ((QofBackend*)be, ERR_BACKEND_LOCKED);
+ g_unlink (pathbuf);
+ close (be->lockfd);
+ g_unlink (be->lockfile);
+ return FALSE;
+ }
+
+ rc = g_stat (be->lockfile, &statbuf);
+ if (rc)
+ {
+ /* oops .. stat failed! This can't happen! */
+ qof_backend_set_error ((QofBackend*)be, ERR_BACKEND_LOCKED);
+ g_unlink (pathbuf);
+ close (be->lockfd);
+ g_unlink (be->lockfile);
+ return FALSE;
+ }
+
+ if (statbuf.st_nlink != 2)
+ {
+ qof_backend_set_error ((QofBackend*)be, ERR_BACKEND_LOCKED);
+ g_unlink (pathbuf);
+ close (be->lockfd);
+ g_unlink (be->lockfile);
+ return FALSE;
+ }
+
+ be->linkfile = g_strdup (pathbuf);
+
+ return TRUE;
+
+#else /* ifndef G_OS_WIN32 */
+ /* On windows, there is no NFS and the open(,O_CREAT | O_EXCL)
+ is sufficient for locking. */
+ be->linkfile = NULL;
+ return TRUE;
+#endif /* ifndef G_OS_WIN32 */
+}
+
+/* ================================================================= */
+
+static void
+file_session_begin(QofBackend *be_start, QofSession *session,
+ const char *book_id,
+ gboolean ignore_lock, gboolean create_if_nonexistent)
+{
+ FileBackend *be = (FileBackend*) be_start;
+
+ ENTER (" ");
+
+ /* Make sure the directory is there */
+ be->fullpath = xaccResolveFilePath(book_id);
+ if (NULL == be->fullpath)
+ {
+ qof_backend_set_error (be_start, ERR_FILEIO_FILE_NOT_FOUND);
+ LEAVE("");
+ return;
+ }
+ be->be.fullpath = be->fullpath;
+ be->dirname = g_path_get_dirname (be->fullpath);
+
+ {
+ struct stat statbuf;
+ int rc;
+
+ /* Again check whether the directory can be accessed */
+ rc = g_stat (be->dirname, &statbuf);
+ if (rc != 0 || !S_ISDIR(statbuf.st_mode))
+ {
+ /* Error on stat or if it isn't a directory means we
+ cannot find this filename */
+ qof_backend_set_error (be_start, ERR_FILEIO_FILE_NOT_FOUND);
+ g_free (be->fullpath); be->fullpath = NULL;
+ g_free (be->dirname); be->dirname = NULL;
+ LEAVE("");
+ return;
+ }
+
+ /* Now check whether we can g_stat the file itself */
+ rc = g_stat (be->fullpath, &statbuf);
+ if ((rc != 0) && (!create_if_nonexistent))
+ {
+ /* Error on stat means the file doesn't exist */
+ qof_backend_set_error (be_start, ERR_FILEIO_FILE_NOT_FOUND);
+ g_free (be->fullpath); be->fullpath = NULL;
+ g_free (be->dirname); be->dirname = NULL;
+ LEAVE("");
+ return;
+ }
+ if (rc == 0 && S_ISDIR(statbuf.st_mode))
+ {
+ /* FIXME: What is actually checked here? Whether the
+ fullpath erroneously points to a directory or what?
+ Then the error message should be changed into something
+ much more clear! */
+ qof_backend_set_error (be_start, ERR_FILEIO_UNKNOWN_FILE_TYPE);
+ g_free (be->fullpath); be->fullpath = NULL;
+ g_free (be->dirname); be->dirname = NULL;
+ LEAVE("");
+ return;
+ }
+ }
+
+ /* ---------------------------------------------------- */
+ /* We should now have a fully resolved path name.
+ * Lets see if we can get a lock on it. */
+
+ be->lockfile = g_strconcat(be->fullpath, ".LCK", NULL);
+
+ if (!ignore_lock && !gnc_file_be_get_file_lock (be))
+ {
+ g_free (be->lockfile); be->lockfile = NULL;
+ LEAVE("");
+ return;
+ }
+
+ LEAVE (" ");
+ return;
+}
+
+/* ================================================================= */
+
+static void
+file_session_end(QofBackend *be_start)
+{
+ FileBackend *be = (FileBackend*)be_start;
+ ENTER (" ");
+
+ if (be->linkfile)
+ g_unlink (be->linkfile);
+
+ if (be->lockfd > 0)
+ close (be->lockfd);
+
+ if (be->lockfile) {
+ int rv;
+#ifdef G_OS_WIN32
+ /* On windows, we need to allow write-access before
+ g_unlink() can succeed */
+ rv = g_chmod (be->lockfile, S_IWRITE | S_IREAD);
+#endif
+ rv = g_unlink (be->lockfile);
+ if (rv) {
+ PWARN("Error on g_unlink(%s): %d: %s", be->lockfile,
+ errno, strerror(errno) ? strerror(errno) : "");
+ }
+ }
+
+ g_free (be->dirname);
+ be->dirname = NULL;
+
+ g_free (be->fullpath);
+ be->fullpath = NULL;
+
+ g_free (be->lockfile);
+ be->lockfile = NULL;
+
+ g_free (be->linkfile);
+ be->linkfile = NULL;
+ LEAVE (" ");
+}
+
+static void
+file_destroy_backend(QofBackend *be)
+{
+ g_free(be);
+}
+
+/* ================================================================= */
+/* Write the financial data in a book to a file, returning FALSE on
+ error and setting the error_result to indicate what went wrong if
+ it's not NULL. This function does not manage file locks in any
+ way.
+
+ If make_backup is true, write out a time-stamped copy of the file
+ into the same directory as the indicated file, with a filename of
+ "file.YYYYMMDDHHMMSS.xac" where YYYYMMDDHHMMSS is replaced with the
+ current year/month/day/hour/minute/second. */
+
+static gboolean
+copy_file(const char *orig, const char *bkup)
+{
+ static int buf_size = 1024;
+ char buf[buf_size];
+ int orig_fd;
+ int bkup_fd;
+ int flags=0;
+ ssize_t count_write;
+ ssize_t count_read;
+
+#ifdef G_OS_WIN32
+ flags = O_BINARY;
+#endif
+
+ orig_fd = g_open(orig, O_RDONLY | flags, 0);
+ if(orig_fd == -1)
+ {
+ return FALSE;
+ }
+ bkup_fd = g_open(bkup, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL | flags, 0600);
+ if(bkup_fd == -1)
+ {
+ close(orig_fd);
+ return FALSE;
+ }
+
+ do
+ {
+ count_read = read(orig_fd, buf, buf_size);
+ if(count_read == -1 && errno != EINTR)
+ {
+ close(orig_fd);
+ close(bkup_fd);
+ return FALSE;
+ }
+
+ if(count_read > 0)
+ {
+ count_write = write(bkup_fd, buf, count_read);
+ if(count_write == -1)
+ {
+ close(orig_fd);
+ close(bkup_fd);
+ return FALSE;
+ }
+ }
+ } while(count_read > 0);
+
+ close(orig_fd);
+ close(bkup_fd);
+
+ return TRUE;
+}
+
+/* ================================================================= */
+
+static gboolean
+gnc_int_link_or_make_backup(FileBackend *be, const char *orig, const char *bkup)
+{
+ int err_ret =
+#ifdef HAVE_LINK
+ link (orig, bkup)
+#else
+ -1
+#endif
+ ;
+ if(err_ret != 0)
+ {
+#ifdef HAVE_LINK
+ if(errno == EPERM
+# ifdef EOPNOTSUPP
+ || errno == EOPNOTSUPP
+# endif
+ )
+#endif
+ {
+ err_ret = copy_file(orig, bkup);
+ }
+
+ if(!err_ret)
+ {
+ qof_backend_set_error((QofBackend*)be, ERR_FILEIO_BACKUP_ERROR);
+ PWARN ("unable to make file backup from %s to %s: %s",
+ orig, bkup, strerror(errno) ? strerror(errno) : "");
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+/* ================================================================= */
+
+static QofBookFileType
+gnc_file_be_determine_file_type(const char *path)
+{
+ gboolean with_encoding;
+ if (gnc_is_xml_data_file_v2(path, &with_encoding)) {
+ if (with_encoding) {
+ return GNC_BOOK_XML2_FILE;
+ } else {
+ return GNC_BOOK_XML2_FILE_NO_ENCODING;
+ }
+ } else if (gnc_is_xml_data_file(path)) {
+ return GNC_BOOK_XML1_FILE;
+ }
+ return GNC_BOOK_NOT_OURS;
+}
+
+static gboolean
+gnc_determine_file_type (const char *path)
+{
+ struct stat sbuf;
+ int rc;
+ FILE *t;
+
+ if (!path) { return FALSE; }
+
+ // Since this can be called with "xml:" as a prefix, remove it if it exists
+ if( g_str_has_prefix( path, "xml:" ) ) {
+ path += 4;
+ }
+
+ if (0 == safe_strcmp(path, QOF_STDOUT)) { return FALSE; }
+ t = g_fopen(path, "r");
+ if(!t) { PINFO (" new file"); return TRUE; }
+ fclose(t);
+ rc = g_stat(path, &sbuf);
+ if(rc < 0) { return FALSE; }
+ if (sbuf.st_size == 0) { PINFO (" empty file"); return TRUE; }
+ if(gnc_is_xml_data_file_v2(path, NULL)) { return TRUE; }
+ else if(gnc_is_xml_data_file(path)) { return TRUE; }
+ PINFO (" %s is not a gnc XML file", path);
+ return FALSE;
+}
+
+static gboolean
+gnc_file_be_backup_file(FileBackend *be)
+{
+ gboolean bkup_ret;
+ char *timestamp;
+ char *backup;
+ const char *datafile;
+ struct stat statbuf;
+ int rc;
+
+ datafile = be->fullpath;
+
+ rc = g_stat (datafile, &statbuf);
+ if (rc)
+ return (errno == ENOENT);
+
+ if(gnc_file_be_determine_file_type(datafile) == GNC_BOOK_BIN_FILE)
+ {
+ /* make a more permament safer backup */
+ const char *back = "-binfmt.bkup";
+ char *bin_bkup = g_new(char, strlen(datafile) + strlen(back) + 1);
+ strcpy(bin_bkup, datafile);
+ strcat(bin_bkup, back);
+ bkup_ret = gnc_int_link_or_make_backup(be, datafile, bin_bkup);
+ g_free(bin_bkup);
+ if(!bkup_ret)
+ {
+ return FALSE;
+ }
+ }
+
+ timestamp = xaccDateUtilGetStampNow ();
+ backup = g_new (char, strlen (datafile) + strlen (timestamp) + 6);
+ strcpy (backup, datafile);
+ strcat (backup, ".");
+ strcat (backup, timestamp);
+ strcat (backup, ".xac");
+ g_free (timestamp);
+
+ bkup_ret = gnc_int_link_or_make_backup(be, datafile, backup);
+ g_free(backup);
+
+ return bkup_ret;
+}
+
+/* ================================================================= */
+
+static gboolean
+gnc_file_be_write_to_file(FileBackend *fbe,
+ QofBook *book,
+ const gchar *datafile,
+ gboolean make_backup)
+{
+ QofBackend *be = &fbe->be;
+ char *tmp_name;
+ struct stat statbuf;
+ int rc;
+ QofBackendError be_err;
+
+ ENTER (" book=%p file=%s", book, datafile);
+
+ /* If the book is 'clean', recently saved, then don't save again. */
+ /* XXX this is currently broken due to faulty 'Save As' logic. */
+ /* if (FALSE == qof_book_not_saved (book)) return FALSE; */
+
+ tmp_name = g_new(char, strlen(datafile) + 12);
+ strcpy(tmp_name, datafile);
+ strcat(tmp_name, ".tmp-XXXXXX");
+
+ if(!mktemp(tmp_name))
+ {
+ qof_backend_set_error(be, ERR_BACKEND_MISC);
+ LEAVE("");
+ return FALSE;
+ }
+
+ if(make_backup)
+ {
+ if(!gnc_file_be_backup_file(fbe))
+ {
+ LEAVE("");
+ return FALSE;
+ }
+ }
+
+ if (gnc_book_write_to_xml_file_v2(book, tmp_name, fbe->file_compression))
+ {
+ /* Record the file's permissions before g_unlinking it */
+ rc = g_stat(datafile, &statbuf);
+ if(rc == 0)
+ {
+ /* Use the permissions from the original data file */
+ if(g_chmod(tmp_name, statbuf.st_mode) != 0)
+ {
+ /* qof_backend_set_error(be, ERR_BACKEND_PERM); */
+ /* Even if the chmod did fail, the save
+ nevertheless completed successfully. It is
+ therefore wrong to signal the ERR_BACKEND_PERM
+ error here which implies that the saving itself
+ failed. Instead, we simply ignore this. */
+ PWARN("unable to chmod filename %s: %s",
+ tmp_name ? tmp_name : "(null)",
+ strerror(errno) ? strerror(errno) : "");
+#if VFAT_DOESNT_SUCK /* chmod always fails on vfat/samba fs */
+ /* g_free(tmp_name); */
+ /* return FALSE; */
+#endif
+ }
+#ifdef HAVE_CHOWN
+ /* Don't try to change the owner. Only root can do
+ that. */
+ if(chown(tmp_name, -1, statbuf.st_gid) != 0)
+ {
+ /* qof_backend_set_error(be, ERR_BACKEND_PERM); */
+ /* A failed chown doesn't mean that the saving itself
+ failed. So don't abort with an error here! */
+ PWARN("unable to chown filename %s: %s",
+ tmp_name ? tmp_name : "(null)",
+ strerror(errno) ? strerror(errno) : "");
+#if VFAT_DOESNT_SUCK /* chown always fails on vfat fs */
+ /* g_free(tmp_name);
+ return FALSE; */
+#endif
+ }
+#endif
+ }
+ if(g_unlink(datafile) != 0 && errno != ENOENT)
+ {
+ qof_backend_set_error(be, ERR_BACKEND_READONLY);
+ PWARN("unable to unlink filename %s: %s",
+ datafile ? datafile : "(null)",
+ strerror(errno) ? strerror(errno) : "");
+ g_free(tmp_name);
+ LEAVE("");
+ return FALSE;
+ }
+ if(!gnc_int_link_or_make_backup(fbe, tmp_name, datafile))
+ {
+ qof_backend_set_error(be, ERR_FILEIO_BACKUP_ERROR);
+ g_free(tmp_name);
+ LEAVE("");
+ return FALSE;
+ }
+ if(g_unlink(tmp_name) != 0)
+ {
+ qof_backend_set_error(be, ERR_BACKEND_PERM);
+ PWARN("unable to unlink temp filename %s: %s",
+ tmp_name ? tmp_name : "(null)",
+ strerror(errno) ? strerror(errno) : "");
+ g_free(tmp_name);
+ LEAVE("");
+ return FALSE;
+ }
+ g_free(tmp_name);
+
+ /* Since we successfully saved the book,
+ * we should mark it clean. */
+ qof_book_mark_saved (book);
+ LEAVE (" sucessful save of book=%p to file=%s", book, datafile);
+ return TRUE;
+ }
+ else
+ {
+ if(g_unlink(tmp_name) != 0)
+ {
+ switch (errno) {
+ case ENOENT: /* tmp_name doesn't exist? Assume "RO" error */
+ case EACCES:
+ case EPERM:
+ case EROFS:
+ be_err = ERR_BACKEND_READONLY;
+ break;
+ default:
+ be_err = ERR_BACKEND_MISC;
+ }
+ qof_backend_set_error(be, be_err);
+ PWARN("unable to unlink temp_filename %s: %s",
+ tmp_name ? tmp_name : "(null)",
+ strerror(errno) ? strerror(errno) : "");
+ /* already in an error just flow on through */
+ }
+ g_free(tmp_name);
+ LEAVE("");
+ return FALSE;
+ }
+ LEAVE("");
+ return TRUE;
+}
+
+/* ================================================================= */
+
+static int
+gnc_file_be_select_files (const gchar *d)
+{
+ return (g_str_has_suffix(d, ".LNK") ||
+ g_str_has_suffix(d, ".xac") ||
+ g_str_has_suffix(d, ".log"));
+}
+
+static void
+gnc_file_be_remove_old_files(FileBackend *be)
+{
+ const gchar *dent;
+ GDir *dir;
+ struct stat lockstatbuf, statbuf;
+ int pathlen;
+ time_t now;
+
+ if (g_stat (be->lockfile, &lockstatbuf) != 0)
+ return;
+ pathlen = strlen(be->fullpath);
+
+ /*
+ * Clean up any lockfiles from prior crashes, and clean up old
+ * data and log files. Scandir will do a fist pass on the
+ * filenames and cull the directory down to just files with the
+ * appropriate extensions. Pity you can't pass user data into
+ * scandir...
+ */
+
+ /*
+ * Unfortunately scandir() is not portable, so re-write this
+ * function without it. Note that this version will be even a bit
+ * faster because it does not have to sort, malloc, or anything
+ * else that scandir did, and it only performs a single pass
+ * through the directory rather than one pass through the
+ * directory and then one pass over the 'matching' files. --
+ * warlord at MIT.EDU 2002-05-06
+ */
+
+ dir = g_dir_open (be->dirname, 0, NULL);
+ if (!dir)
+ return;
+
+ now = time(NULL);
+ while((dent = g_dir_read_name(dir)) != NULL) {
+ char *name;
+ int len;
+
+ if (gnc_file_be_select_files (dent) == 0)
+ continue;
+
+ name = g_build_filename(be->dirname, dent, (gchar*)NULL);
+ len = strlen(name) - 4;
+
+ /* Is this file associated with the current data file */
+ if (strncmp(name, be->fullpath, pathlen) == 0)
+ {
+ if ((safe_strcmp(name + len, ".LNK") == 0) &&
+ /* Is a lock file. Skip the active lock file */
+ (safe_strcmp(name, be->linkfile) != 0) &&
+ /* Only delete lock files older than the active one */
+ (g_stat(name, &statbuf) == 0) &&
+ (statbuf.st_mtime <lockstatbuf.st_mtime))
+ {
+ PINFO ("unlink lock file: %s", name);
+ g_unlink(name);
+ }
+ else if (be->file_retention_days > 0)
+ {
+ time_t file_time;
+ struct tm file_tm;
+ int days;
+ const char* res;
+
+ PINFO ("file retention = %d days", be->file_retention_days);
+
+ /* Is the backup file old enough to delete */
+ memset(&file_tm, 0, sizeof(file_tm));
+ res = strptime(name+pathlen+1, "%Y%m%d%H%M%S", &file_tm);
+ file_time = mktime(&file_tm);
+ days = (int)(difftime(now, file_time) / 86400);
+
+
+ if (res
+ && res != name+pathlen+1
+ && (strcmp(res, ".xac") == 0
+ || strcmp(res, ".log") == 0)
+ && file_time > 0
+ && days > be->file_retention_days)
+ {
+ PINFO ("g_unlink stale (%d days old) file: %s", days, name);
+ g_unlink(name);
+ }
+ }
+ }
+ g_free(name);
+ }
+ g_dir_close (dir);
+}
+
+static void
+file_sync_all(QofBackend* be, QofBook *book)
+{
+ FileBackend *fbe = (FileBackend *) be;
+ ENTER ("book=%p, primary=%p", book, fbe->primary_book);
+
+ /* We make an important assumption here, that we might want to change
+ * in the future: when the user says 'save', we really save the one,
+ * the only, the current open book, and nothing else. We do this
+ * because we assume that any other books that we are dealing with
+ * are 'read-only', non-editable, because they are closed books.
+ * If we ever want to have more than one book open read-write,
+ * this will have to change.
+ */
+ if (NULL == fbe->primary_book) fbe->primary_book = book;
+ if (book != fbe->primary_book) return;
+
+ gnc_file_be_write_to_file (fbe, book, fbe->fullpath, TRUE);
+ gnc_file_be_remove_old_files (fbe);
+ LEAVE ("book=%p", book);
+}
+
+/* ================================================================= */
+/* Routines to deal with the creation of multiple books.
+ * The core design assumption here is that the book
+ * begin-edit/commit-edit routines are used solely to write out
+ * closed accounting periods to files. They're not currently
+ * designed to do anything other than this. (Although they could be).
+ */
+
+static char *
+build_period_filepath (FileBackend *fbe, QofBook *book)
+{
+ int len;
+ char *str, *p, *q;
+
+ len = strlen (fbe->fullpath) + GUID_ENCODING_LENGTH + 14;
+ str = g_new (char, len);
+ strcpy (str, fbe->fullpath);
+
+ /* XXX it would be nice for the user if we made the book
+ * closing date and/or title part of the file-name. */
+ p = strrchr (str, G_DIR_SEPARATOR);
+ p++;
+ p = stpcpy (p, "book-");
+ p = guid_to_string_buff (qof_book_get_guid(book), p);
+ p = stpcpy (p, "-");
+ q = strrchr (fbe->fullpath, G_DIR_SEPARATOR);
+ q++;
+ p = stpcpy (p, q);
+ p = stpcpy (p, ".gml");
+
+ return str;
+}
+
+static void
+file_begin_edit (QofBackend *be, QofInstance *inst)
+{
+ if (0) build_period_filepath(0, 0);
+#if BORKEN_FOR_NOW
+ FileBackend *fbe = (FileBackend *) be;
+ QofBook *book = gp;
+ const char * filepath;
+
+ QofIdTypeConst typ = QOF_INSTANCE(inst)->e_type;
+ if (strcmp (GNC_ID_PERIOD, typ)) return;
+ filepath = build_period_filepath(fbe, book);
+ PINFO (" ====================== book=%p filepath=%s\n", book, filepath);
+
+ if (NULL == fbe->primary_book)
+ {
+ PERR ("You should have saved the data "
+ "at least once before closing the books!\n");
+ }
+ /* XXX To be anal about it, we should really be checking to see
+ * if there already is a file with this book GUID, and disallowing
+ * further progress. This is because we are not allowed to
+ * modify books that are closed (They should be treated as
+ * 'read-only').
+ */
+#endif
+}
+
+static void
+file_rollback_edit (QofBackend *be, QofInstance *inst)
+{
+#if BORKEN_FOR_NOW
+ QofBook *book = gp;
+
+ if (strcmp (GNC_ID_PERIOD, typ)) return;
+ PINFO ("book=%p", book);
+#endif
+}
+
+static void
+file_commit_edit (QofBackend *be, QofInstance *inst)
+{
+#if BORKEN_FOR_NOW
+ FileBackend *fbe = (FileBackend *) be;
+ QofBook *book = gp;
+ const char * filepath;
+
+ if (strcmp (GNC_ID_PERIOD, typ)) return;
+ filepath = build_period_filepath(fbe, book);
+ PINFO (" ====================== book=%p filepath=%s\n", book, filepath);
+ gnc_file_be_write_to_file(fbe, book, filepath, FALSE);
+
+ /* We want to force a save of the current book at this point,
+ * because if we don't, and the user forgets to do so, then
+ * there'll be the same transactions in the closed book,
+ * and also in the current book. */
+ gnc_file_be_write_to_file (fbe, fbe->primary_book, fbe->fullpath, TRUE);
+#endif
+}
+
+/* ---------------------------------------------------------------------- */
+
+
+/* Load financial data from a file into the book, automatically
+ detecting the format of the file, if possible. Return FALSE on
+ error, and set the error parameter to indicate what went wrong if
+ it's not NULL. This function does not manage file locks in any
+ way. */
+
+static void
+gnc_file_be_load_from_file (QofBackend *bend, QofBook *book)
+{
+ QofBackendError error;
+ gboolean rc;
+ FileBackend *be = (FileBackend *) bend;
+
+ error = ERR_BACKEND_NO_ERR;
+ be->primary_book = book;
+
+ switch (gnc_file_be_determine_file_type(be->fullpath))
+ {
+ case GNC_BOOK_XML2_FILE:
+ rc = qof_session_load_from_xml_file_v2 (be, book);
+ if (FALSE == rc) error = ERR_FILEIO_PARSE_ERROR;
+ break;
+
+ case GNC_BOOK_XML2_FILE_NO_ENCODING:
+ error = ERR_FILEIO_NO_ENCODING;
+ break;
+ case GNC_BOOK_XML1_FILE:
+ rc = qof_session_load_from_xml_file (book, be->fullpath);
+ if (FALSE == rc) error = ERR_FILEIO_PARSE_ERROR;
+ break;
+ default:
+ /* If file type wasn't known, check errno again to give the
+ user some more useful feedback for some particular error
+ conditions. */
+ switch (errno)
+ {
+ case EACCES: /* No read permission */
+ PWARN("No read permission to file");
+ error = ERR_FILEIO_FILE_EACCES;
+ break;
+ case EISDIR: /* File is a directory - but on this error we don't arrive here */
+ PWARN("Filename is a directory");
+ error = ERR_FILEIO_FILE_NOT_FOUND;
+ break;
+ default:
+ PWARN("File not any known type");
+ error = ERR_FILEIO_UNKNOWN_FILE_TYPE;
+ break;
+ }
+ break;
+ }
+
+ if(error != ERR_BACKEND_NO_ERR)
+ {
+ qof_backend_set_error(bend, error);
+ }
+
+ /* We just got done loading, it can't possibly be dirty !! */
+ qof_book_mark_saved (book);
+}
+
+/* ---------------------------------------------------------------------- */
+
+static gboolean
+gnc_file_be_save_may_clobber_data (QofBackend *bend)
+{
+ struct stat statbuf;
+ if (!bend->fullpath) return FALSE;
+
+ /* FIXME: Make sure this doesn't need more sophisticated semantics
+ * in the face of special file, devices, pipes, symlinks, etc. */
+ if (g_stat(bend->fullpath, &statbuf) == 0) return TRUE;
+ return FALSE;
+}
+
+
+static void
+gnc_file_be_write_accounts_to_file(QofBackend *be, QofBook *book)
+{
+ const gchar *datafile;
+
+ datafile = ((FileBackend *)be)->fullpath;
+ gnc_book_write_accounts_to_xml_file_v2(be, book, datafile);
+}
+
+/* ================================================================= */
+#if 0 //def GNUCASH_MAJOR_VERSION
+QofBackend *
+libgncmod_backend_file_LTX_gnc_backend_new(void)
+{
+
+ fbe->dirname = NULL;
+ fbe->fullpath = NULL;
+ fbe->lockfile = NULL;
+ fbe->linkfile = NULL;
+ fbe->lockfd = -1;
+
+ fbe->primary_book = NULL;
+
+ return be;
+}
+#endif
+
+static void
+retain_changed_cb(GConfEntry *entry, gpointer user_data)
+{
+ FileBackend *be = (FileBackend*)user_data;
+ g_return_if_fail(be != NULL);
+ be->file_retention_days = (int)gnc_gconf_get_float("general", "retain_days", NULL);
+}
+
+static void
+compression_changed_cb(GConfEntry *entry, gpointer user_data)
+{
+ FileBackend *be = (FileBackend*)user_data;
+ g_return_if_fail(be != NULL);
+ be->file_compression = gnc_gconf_get_bool("general", "file_compression", NULL);
+}
+
+static QofBackend*
+gnc_backend_new(void)
+{
+ FileBackend *gnc_be;
+ QofBackend *be;
+
+ gnc_be = g_new0(FileBackend, 1);
+ be = (QofBackend*) gnc_be;
+ qof_backend_init(be);
+
+ be->session_begin = file_session_begin;
+ be->session_end = file_session_end;
+ be->destroy_backend = file_destroy_backend;
+
+ be->load = gnc_file_be_load_from_file;
+ be->save_may_clobber_data = gnc_file_be_save_may_clobber_data;
+
+ /* The file backend treats accounting periods transactionally. */
+ be->begin = file_begin_edit;
+ be->commit = file_commit_edit;
+ be->rollback = file_rollback_edit;
+
+ /* The file backend always loads all data ... */
+ be->compile_query = NULL;
+ be->free_query = NULL;
+ be->run_query = NULL;
+
+ be->counter = NULL;
+
+ /* The file backend will never be multi-user... */
+ be->events_pending = NULL;
+ be->process_events = NULL;
+
+ be->sync = file_sync_all;
+ be->load_config = NULL;
+ be->get_config = NULL;
+
+ be->export = gnc_file_be_write_accounts_to_file;
+
+ gnc_be->dirname = NULL;
+ gnc_be->fullpath = NULL;
+ gnc_be->lockfile = NULL;
+ gnc_be->linkfile = NULL;
+ gnc_be->lockfd = -1;
+
+ gnc_be->primary_book = NULL;
+
+ gnc_be->file_retention_days = (int)gnc_gconf_get_float("general", "retain_days", NULL);
+ gnc_be->file_compression = gnc_gconf_get_bool("general", "file_compression", NULL);
+
+ gnc_gconf_general_register_cb("retain_days", retain_changed_cb, be);
+ gnc_gconf_general_register_cb("file_compression", compression_changed_cb, be);
+
+ return be;
+}
+
+static void
+gnc_provider_free (QofBackendProvider *prov)
+{
+ prov->provider_name = NULL;
+ prov->access_method = NULL;
+ g_free (prov);
+}
+
+G_MODULE_EXPORT void
+qof_backend_module_init(void)
+{
+ QofBackendProvider *prov;
+ prov = g_new0 (QofBackendProvider, 1);
+ prov->provider_name = "GnuCash File Backend Version 2";
+ prov->access_method = "file";
+ prov->partial_book_supported = FALSE;
+ prov->backend_new = gnc_backend_new;
+ prov->provider_free = gnc_provider_free;
+ prov->check_data_type = gnc_determine_file_type;
+ qof_backend_register_provider (prov);
+
+ prov = g_new0 (QofBackendProvider, 1);
+ prov->provider_name = "GnuCash File Backend Version 2";
+ prov->access_method = "xml";
+ prov->partial_book_supported = FALSE;
+ prov->backend_new = gnc_backend_new;
+ prov->provider_free = gnc_provider_free;
+ prov->check_data_type = gnc_determine_file_type;
+ qof_backend_register_provider (prov);
+}
+
+/* ========================== END OF FILE ===================== */
Copied: gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-xml.h (from rev 16700, gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-file.h)
===================================================================
--- gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-xml.h (rev 0)
+++ gnucash/branches/gda-dev2/src/backend/xml/gnc-backend-xml.h 2007-12-23 20:56:51 UTC (rev 16701)
@@ -0,0 +1,62 @@
+/********************************************************************
+ * gnc-backend-xml.h: load and save data to XML files *
+ * *
+ * This program is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU General Public License as *
+ * published by the Free Software Foundation; either version 2 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License*
+ * along with this program; if not, contact: *
+ * *
+ * Free Software Foundation Voice: +1-617-542-5942 *
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
+ * Boston, MA 02110-1301, USA gnu at gnu.org *
+\********************************************************************/
+/** @file gnc-backend-file.h
+ * @brief load and save data to files
+ * @author Copyright (c) 2000 Gnumatic Inc.
+ * @author Copyright (c) 2002 Derek Atkins <warlord at MIT.EDU>
+ * @author Copyright (c) 2003 Linas Vepstas <linas at linas.org>
+ *
+ * This file implements the top-level QofBackend API for saving/
+ * restoring data to/from an ordinary Unix filesystem file.
+ */
+
+#ifndef GNC_BACKEND_XML_H_
+#define GNC_BACKEND_XML_H_
+
+#include "qof.h"
+#include <gmodule.h>
+
+#include "qofbackend-p.h"
+struct FileBackend_struct
+{
+ QofBackend be;
+
+ char *dirname;
+ char *fullpath; /* Fully qualified path to book */
+ char *lockfile;
+ char *linkfile;
+ int lockfd;
+
+ QofBook *primary_book; /* The primary, main open book */
+
+ int file_retention_days;
+ gboolean file_compression;
+};
+
+typedef struct FileBackend_struct FileBackend;
+
+// This is now a static inside the module
+//QofBackend * libgncmod_backend_file_LTX_gnc_backend_new(void);
+
+G_MODULE_EXPORT void
+qof_backend_module_init(void);
+
+#endif /* GNC_BACKEND_XML_H_ */
Deleted: gnucash/branches/gda-dev2/src/backend/xml/gncmod-backend-file.c
===================================================================
--- gnucash/branches/gda-dev2/src/backend/xml/gncmod-backend-file.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/backend/xml/gncmod-backend-file.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -1,65 +0,0 @@
-/*********************************************************************
- * gncmod-file-backend.c
- * module definition/initialization for the file backend module
- *
- * Copyright (c) 2001 Linux Developers Group, Inc.
- *********************************************************************/
-
-#include <stdio.h>
-#include <gmodule.h>
-/* #include <glib-gobject.h> */
-
-#include "gnc-module.h"
-#include "gnc-module-api.h"
-
-GNC_MODULE_API_DECL(libgncmod_backend_file)
-
-/* version of the gnc module system interface we require */
-int libgnc_backend_file_utils_gnc_module_system_interface = 0;
-
-/* module versioning uses libtool semantics. */
-int libgncmod_backend_file_gnc_module_current = 0;
-int libgncmod_backend_file_gnc_module_revision = 0;
-int libgncmod_backend_file_gnc_module_age = 0;
-
-static GNCModule engine;
-
-
-char *
-libgncmod_backend_file_gnc_module_path(void)
-{
- return g_strdup("gnucash/backend/file");
-}
-
-char *
-libgncmod_backend_file_gnc_module_description(void)
-{
- return g_strdup("The binary and XML (v1 and v2) backends for GnuCash");
-}
-
-int
-libgncmod_backend_file_gnc_module_init(int refcount)
-{
- engine = gnc_module_load("gnucash/engine", 0);
- if(!engine) return FALSE;
-
- /* Need to initialize g-type engine for gconf */
- if (refcount == 0)
- g_type_init();
-
- return TRUE;
-}
-
-int
-libgncmod_backend_file_gnc_module_end(int refcount)
-{
- int unload = TRUE;
-
- if (engine)
- unload = libgnc_backend_file_utils_gnc_module_unload(engine);
-
- if (refcount == 0)
- engine = NULL;
-
- return unload;
-}
Copied: gnucash/branches/gda-dev2/src/backend/xml/gncmod-backend-xml.c (from rev 16700, gnucash/branches/gda-dev2/src/backend/xml/gncmod-backend-file.c)
===================================================================
--- gnucash/branches/gda-dev2/src/backend/xml/gncmod-backend-xml.c (rev 0)
+++ gnucash/branches/gda-dev2/src/backend/xml/gncmod-backend-xml.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -0,0 +1,65 @@
+/*********************************************************************
+ * gncmod-file-backend.c
+ * module definition/initialization for the file backend module
+ *
+ * Copyright (c) 2001 Linux Developers Group, Inc.
+ *********************************************************************/
+
+#include <stdio.h>
+#include <gmodule.h>
+/* #include <glib-gobject.h> */
+
+#include "gnc-module.h"
+#include "gnc-module-api.h"
+
+GNC_MODULE_API_DECL(libgncmod_backend_file)
+
+/* version of the gnc module system interface we require */
+int libgnc_backend_file_utils_gnc_module_system_interface = 0;
+
+/* module versioning uses libtool semantics. */
+int libgncmod_backend_file_gnc_module_current = 0;
+int libgncmod_backend_file_gnc_module_revision = 0;
+int libgncmod_backend_file_gnc_module_age = 0;
+
+static GNCModule engine;
+
+
+char *
+libgncmod_backend_file_gnc_module_path(void)
+{
+ return g_strdup("gnucash/backend/file");
+}
+
+char *
+libgncmod_backend_file_gnc_module_description(void)
+{
+ return g_strdup("The binary and XML (v1 and v2) backends for GnuCash");
+}
+
+int
+libgncmod_backend_file_gnc_module_init(int refcount)
+{
+ engine = gnc_module_load("gnucash/engine", 0);
+ if(!engine) return FALSE;
+
+ /* Need to initialize g-type engine for gconf */
+ if (refcount == 0)
+ g_type_init();
+
+ return TRUE;
+}
+
+int
+libgncmod_backend_file_gnc_module_end(int refcount)
+{
+ int unload = TRUE;
+
+ if (engine)
+ unload = libgnc_backend_file_utils_gnc_module_unload(engine);
+
+ if (refcount == 0)
+ engine = NULL;
+
+ return unload;
+}
Modified: gnucash/branches/gda-dev2/src/backend/xml/io-gncxml-v2.h
===================================================================
--- gnucash/branches/gda-dev2/src/backend/xml/io-gncxml-v2.h 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/backend/xml/io-gncxml-v2.h 2007-12-23 20:56:51 UTC (rev 16701)
@@ -34,7 +34,7 @@
#include <glib.h>
#include "gnc-engine.h"
-#include "gnc-backend-file.h"
+#include "gnc-backend-xml.h"
#include "sixtp.h"
Modified: gnucash/branches/gda-dev2/src/backend/xml/test/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/backend/xml/test/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/backend/xml/test/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -1,167 +1,167 @@
SUBDIRS = test-files
test_date_converting_SOURCES = \
- ${top_srcdir}/src/backend/file/sixtp-dom-parsers.c \
- ${top_srcdir}/src/backend/file/sixtp-dom-generators.c \
- ${top_srcdir}/src/backend/file/sixtp-utils.c \
- ${top_srcdir}/src/backend/file/sixtp.c \
- ${top_srcdir}/src/backend/file/sixtp-stack.c \
- ${top_srcdir}/src/backend/file/sixtp-to-dom-parser.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-generators.c \
+ ${top_srcdir}/src/backend/xml/sixtp-utils.c \
+ ${top_srcdir}/src/backend/xml/sixtp.c \
+ ${top_srcdir}/src/backend/xml/sixtp-stack.c \
+ ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.c \
test-date-converting.c
test_dom_converters1_SOURCES = \
- ${top_srcdir}/src/backend/file/sixtp-dom-parsers.c \
- ${top_srcdir}/src/backend/file/sixtp-dom-generators.c \
- ${top_srcdir}/src/backend/file/sixtp-utils.c \
- ${top_srcdir}/src/backend/file/sixtp.c \
- ${top_srcdir}/src/backend/file/sixtp-stack.c \
- ${top_srcdir}/src/backend/file/sixtp-to-dom-parser.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-generators.c \
+ ${top_srcdir}/src/backend/xml/sixtp-utils.c \
+ ${top_srcdir}/src/backend/xml/sixtp.c \
+ ${top_srcdir}/src/backend/xml/sixtp-stack.c \
+ ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.c \
test-dom-converters1.c
test_kvp_frames_SOURCES = \
- ${top_srcdir}/src/backend/file/sixtp-dom-parsers.c \
- ${top_srcdir}/src/backend/file/sixtp-dom-generators.c \
- ${top_srcdir}/src/backend/file/sixtp-utils.c \
- ${top_srcdir}/src/backend/file/sixtp.c \
- ${top_srcdir}/src/backend/file/sixtp-stack.c \
- ${top_srcdir}/src/backend/file/sixtp-to-dom-parser.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-generators.c \
+ ${top_srcdir}/src/backend/xml/sixtp-utils.c \
+ ${top_srcdir}/src/backend/xml/sixtp.c \
+ ${top_srcdir}/src/backend/xml/sixtp-stack.c \
+ ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.c \
test-kvp-frames.c
-# the file backend is now a GModule - this test does
+# the xml backend is now a GModule - this test does
# not load it as a module and cannot link to it
# and remain portable.
test_load_example_account_SOURCES = \
- ${top_srcdir}/src/backend/file/sixtp-dom-parsers.c \
- ${top_srcdir}/src/backend/file/sixtp-dom-generators.c \
- ${top_srcdir}/src/backend/file/sixtp-utils.c \
- ${top_srcdir}/src/backend/file/sixtp.c \
- ${top_srcdir}/src/backend/file/sixtp-stack.c \
- ${top_srcdir}/src/backend/file/sixtp-to-dom-parser.c \
- ${top_srcdir}/src/backend/file/io-example-account.c \
- ${top_srcdir}/src/backend/file/io-gncxml-gen.c \
- ${top_srcdir}/src/backend/file/io-gncxml-v2.c \
- ${top_srcdir}/src/backend/file/io-utils.c \
- ${top_srcdir}/src/backend/file/gnc-account-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-budget-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-lot-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-recurrence-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-schedxaction-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-freqspec-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-transaction-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-commodity-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-book-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-pricedb-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-generators.c \
+ ${top_srcdir}/src/backend/xml/sixtp-utils.c \
+ ${top_srcdir}/src/backend/xml/sixtp.c \
+ ${top_srcdir}/src/backend/xml/sixtp-stack.c \
+ ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.c \
+ ${top_srcdir}/src/backend/xml/io-example-account.c \
+ ${top_srcdir}/src/backend/xml/io-gncxml-gen.c \
+ ${top_srcdir}/src/backend/xml/io-gncxml-v2.c \
+ ${top_srcdir}/src/backend/xml/io-utils.c \
+ ${top_srcdir}/src/backend/xml/gnc-account-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-budget-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-lot-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-recurrence-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-schedxaction-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-freqspec-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-transaction-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-commodity-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-book-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-pricedb-xml-v2.c \
test-load-example-account.c
test_string_converters_SOURCES = \
- ${top_srcdir}/src/backend/file/sixtp-dom-parsers.c \
- ${top_srcdir}/src/backend/file/sixtp-dom-generators.c \
- ${top_srcdir}/src/backend/file/sixtp-utils.c \
- ${top_srcdir}/src/backend/file/sixtp.c \
- ${top_srcdir}/src/backend/file/sixtp-stack.c \
- ${top_srcdir}/src/backend/file/sixtp-to-dom-parser.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-generators.c \
+ ${top_srcdir}/src/backend/xml/sixtp-utils.c \
+ ${top_srcdir}/src/backend/xml/sixtp.c \
+ ${top_srcdir}/src/backend/xml/sixtp-stack.c \
+ ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.c \
test-string-converters.c
test_xml_account_SOURCES = \
- ${top_srcdir}/src/backend/file/sixtp-dom-parsers.c \
- ${top_srcdir}/src/backend/file/sixtp-dom-generators.c \
- ${top_srcdir}/src/backend/file/sixtp-utils.c \
- ${top_srcdir}/src/backend/file/sixtp.c \
- ${top_srcdir}/src/backend/file/sixtp-stack.c \
- ${top_srcdir}/src/backend/file/sixtp-to-dom-parser.c \
- ${top_srcdir}/src/backend/file/io-gncxml-gen.c \
- ${top_srcdir}/src/backend/file/gnc-account-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-lot-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-schedxaction-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-recurrence-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-freqspec-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-transaction-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-commodity-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-book-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-pricedb-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-generators.c \
+ ${top_srcdir}/src/backend/xml/sixtp-utils.c \
+ ${top_srcdir}/src/backend/xml/sixtp.c \
+ ${top_srcdir}/src/backend/xml/sixtp-stack.c \
+ ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.c \
+ ${top_srcdir}/src/backend/xml/io-gncxml-gen.c \
+ ${top_srcdir}/src/backend/xml/gnc-account-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-lot-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-schedxaction-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-recurrence-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-freqspec-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-transaction-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-commodity-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-book-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-pricedb-xml-v2.c \
test-xml-account.c
test_xml_commodity_SOURCES = \
- ${top_srcdir}/src/backend/file/sixtp-dom-parsers.c \
- ${top_srcdir}/src/backend/file/sixtp-dom-generators.c \
- ${top_srcdir}/src/backend/file/sixtp-utils.c \
- ${top_srcdir}/src/backend/file/sixtp.c \
- ${top_srcdir}/src/backend/file/sixtp-stack.c \
- ${top_srcdir}/src/backend/file/sixtp-to-dom-parser.c \
- ${top_srcdir}/src/backend/file/io-gncxml-gen.c \
- ${top_srcdir}/src/backend/file/gnc-account-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-lot-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-schedxaction-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-recurrence-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-freqspec-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-transaction-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-commodity-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-book-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-pricedb-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-generators.c \
+ ${top_srcdir}/src/backend/xml/sixtp-utils.c \
+ ${top_srcdir}/src/backend/xml/sixtp.c \
+ ${top_srcdir}/src/backend/xml/sixtp-stack.c \
+ ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.c \
+ ${top_srcdir}/src/backend/xml/io-gncxml-gen.c \
+ ${top_srcdir}/src/backend/xml/gnc-account-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-lot-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-schedxaction-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-recurrence-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-freqspec-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-transaction-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-commodity-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-book-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-pricedb-xml-v2.c \
test-xml-commodity.c
test_xml_pricedb_SOURCES = \
- ${top_srcdir}/src/backend/file/sixtp-dom-parsers.c \
- ${top_srcdir}/src/backend/file/sixtp-dom-generators.c \
- ${top_srcdir}/src/backend/file/sixtp-utils.c \
- ${top_srcdir}/src/backend/file/sixtp.c \
- ${top_srcdir}/src/backend/file/sixtp-stack.c \
- ${top_srcdir}/src/backend/file/sixtp-to-dom-parser.c \
- ${top_srcdir}/src/backend/file/io-gncxml-gen.c \
- ${top_srcdir}/src/backend/file/gnc-account-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-lot-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-schedxaction-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-recurrence-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-freqspec-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-transaction-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-commodity-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-book-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-pricedb-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-generators.c \
+ ${top_srcdir}/src/backend/xml/sixtp-utils.c \
+ ${top_srcdir}/src/backend/xml/sixtp.c \
+ ${top_srcdir}/src/backend/xml/sixtp-stack.c \
+ ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.c \
+ ${top_srcdir}/src/backend/xml/io-gncxml-gen.c \
+ ${top_srcdir}/src/backend/xml/gnc-account-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-lot-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-schedxaction-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-recurrence-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-freqspec-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-transaction-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-commodity-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-book-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-pricedb-xml-v2.c \
test-xml-pricedb.c
test_xml_transaction_SOURCES = \
- ${top_srcdir}/src/backend/file/sixtp-dom-parsers.c \
- ${top_srcdir}/src/backend/file/sixtp-dom-generators.c \
- ${top_srcdir}/src/backend/file/sixtp-utils.c \
- ${top_srcdir}/src/backend/file/sixtp.c \
- ${top_srcdir}/src/backend/file/sixtp-stack.c \
- ${top_srcdir}/src/backend/file/sixtp-to-dom-parser.c \
- ${top_srcdir}/src/backend/file/io-gncxml-gen.c \
- ${top_srcdir}/src/backend/file/gnc-account-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-budget-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-lot-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-schedxaction-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-freqspec-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-recurrence-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-transaction-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-commodity-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-book-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-pricedb-xml-v2.c \
- ${top_srcdir}/src/backend/file/io-gncxml-v2.c \
- ${top_srcdir}/src/backend/file/io-utils.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-generators.c \
+ ${top_srcdir}/src/backend/xml/sixtp-utils.c \
+ ${top_srcdir}/src/backend/xml/sixtp.c \
+ ${top_srcdir}/src/backend/xml/sixtp-stack.c \
+ ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.c \
+ ${top_srcdir}/src/backend/xml/io-gncxml-gen.c \
+ ${top_srcdir}/src/backend/xml/gnc-account-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-budget-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-lot-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-schedxaction-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-freqspec-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-recurrence-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-transaction-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-commodity-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-book-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-pricedb-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/io-gncxml-v2.c \
+ ${top_srcdir}/src/backend/xml/io-utils.c \
test-xml-transaction.c
test_xml2_is_file_SOURCES = \
- ${top_srcdir}/src/backend/file/sixtp-dom-parsers.c \
- ${top_srcdir}/src/backend/file/sixtp-dom-generators.c \
- ${top_srcdir}/src/backend/file/sixtp-utils.c \
- ${top_srcdir}/src/backend/file/sixtp.c \
- ${top_srcdir}/src/backend/file/sixtp-stack.c \
- ${top_srcdir}/src/backend/file/sixtp-to-dom-parser.c \
- ${top_srcdir}/src/backend/file/gnc-account-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-budget-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-lot-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-recurrence-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-schedxaction-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-freqspec-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-transaction-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-commodity-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-book-xml-v2.c \
- ${top_srcdir}/src/backend/file/gnc-pricedb-xml-v2.c \
- ${top_srcdir}/src/backend/file/io-gncxml-gen.c \
- ${top_srcdir}/src/backend/file/io-gncxml-v2.c \
- ${top_srcdir}/src/backend/file/io-utils.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-parsers.c \
+ ${top_srcdir}/src/backend/xml/sixtp-dom-generators.c \
+ ${top_srcdir}/src/backend/xml/sixtp-utils.c \
+ ${top_srcdir}/src/backend/xml/sixtp.c \
+ ${top_srcdir}/src/backend/xml/sixtp-stack.c \
+ ${top_srcdir}/src/backend/xml/sixtp-to-dom-parser.c \
+ ${top_srcdir}/src/backend/xml/gnc-account-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-budget-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-lot-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-recurrence-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-schedxaction-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-freqspec-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-transaction-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-commodity-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-book-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/gnc-pricedb-xml-v2.c \
+ ${top_srcdir}/src/backend/xml/io-gncxml-gen.c \
+ ${top_srcdir}/src/backend/xml/io-gncxml-v2.c \
+ ${top_srcdir}/src/backend/xml/io-utils.c \
test-xml2-is-file.c
TESTS = \
@@ -186,7 +186,7 @@
--library-dir ${top_builddir}/src/core-utils \
--library-dir ${top_builddir}/src/gnc-module \
--library-dir ${top_builddir}/src/engine \
- --library-dir ${top_builddir}/src/backend/file
+ --library-dir ${top_builddir}/src/backend/xml
TESTS_ENVIRONMENT := \
GNC_ACCOUNT_PATH=${top_srcdir}/accounts/C \
@@ -235,7 +235,7 @@
-I${top_srcdir}/src/test-core \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/engine/test-core \
- -I${top_srcdir}/src/backend/file \
+ -I${top_srcdir}/src/backend/xml \
-I${top_srcdir}/src/backend/qsf \
${LIBXML2_CFLAGS} \
${GLIB_CFLAGS} \
@@ -249,4 +249,4 @@
test-real-data.sh \
test-xml2-is-file.c
-INCLUDES = -DG_LOG_DOMAIN=\"gnc.backend.file\"
+INCLUDES = -DG_LOG_DOMAIN=\"gnc.backend.xml\"
Modified: gnucash/branches/gda-dev2/src/backend/xml/test/test-load-backend.c
===================================================================
--- gnucash/branches/gda-dev2/src/backend/xml/test/test-load-backend.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/backend/xml/test/test-load-backend.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -30,7 +30,7 @@
#include "cashobjects.h"
#include "test-stuff.h"
-#define GNC_LIB_NAME "gncmod-backend-file"
+#define GNC_LIB_NAME "gncmod-backend-xml"
int main (int argc, char ** argv)
{
@@ -38,7 +38,7 @@
cashobjects_register();
do_test(
qof_load_backend_library ("../.libs/", GNC_LIB_NAME),
- " loading gnc-backend-file GModule failed");
+ " loading gnc-backend-xml GModule failed");
print_test_results();
qof_close();
exit(get_rv());
Modified: gnucash/branches/gda-dev2/src/backend/xml/test/test-load-xml2.c
===================================================================
--- gnucash/branches/gda-dev2/src/backend/xml/test/test-load-xml2.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/backend/xml/test/test-load-xml2.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -40,14 +40,14 @@
#include "cashobjects.h"
#include "TransLog.h"
#include "gnc-engine.h"
-#include "gnc-backend-file.h"
+#include "gnc-backend-xml.h"
#include "io-gncxml-v2.h"
#include "test-stuff.h"
#include "test-engine-stuff.h"
#include "test-file-stuff.h"
-#define GNC_LIB_NAME "gncmod-backend-file"
+#define GNC_LIB_NAME "gncmod-backend-xml"
static void
remove_files_pattern(const char *begining, const char *ending)
@@ -112,7 +112,7 @@
qof_init();
cashobjects_register();
do_test(qof_load_backend_library ("../.libs/", GNC_LIB_NAME),
- " loading gnc-backend-file GModule failed");
+ " loading gnc-backend-xml GModule failed");
if (!location)
{
Modified: gnucash/branches/gda-dev2/src/business/business-core/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-core/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/business/business-core/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -1,4 +1,4 @@
-SUBDIRS = . test file
+SUBDIRS = . gda test xml
pkglib_LTLIBRARIES = libgncmod-business-core.la
Modified: gnucash/branches/gda-dev2/src/business/business-core/gncEntry.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-core/gncEntry.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/business/business-core/gncEntry.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -658,14 +658,14 @@
/* ================================================================ */
/* Get Functions */
-Timespec gncEntryGetDate (GncEntry *entry)
+Timespec gncEntryGetDate (const GncEntry *entry)
{
Timespec ts; ts.tv_sec = 0; ts.tv_nsec = 0;
if (!entry) return ts;
return entry->date;
}
-Timespec gncEntryGetDateEntered (GncEntry *entry)
+Timespec gncEntryGetDateEntered (const GncEntry *entry)
{
Timespec ts; ts.tv_sec = 0; ts.tv_nsec = 0;
if (!entry) return ts;
Modified: gnucash/branches/gda-dev2/src/business/business-core/gncEntry.h
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-core/gncEntry.h 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/business/business-core/gncEntry.h 2007-12-23 20:56:51 UTC (rev 16701)
@@ -135,8 +135,8 @@
/* GET FUNCTIONS */
/** @name Generic (shared) data
@{ */
-Timespec gncEntryGetDate (GncEntry *entry);
-Timespec gncEntryGetDateEntered (GncEntry *entry);
+Timespec gncEntryGetDate (const GncEntry *entry);
+Timespec gncEntryGetDateEntered (const GncEntry *entry);
const char * gncEntryGetDescription (GncEntry *entry);
const char * gncEntryGetAction (GncEntry *entry);
const char * gncEntryGetNotes (GncEntry *notes);
Modified: gnucash/branches/gda-dev2/src/business/business-core/xml/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-core/xml/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/business/business-core/xml/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -1,11 +1,11 @@
SUBDIRS = .
-pkglib_LTLIBRARIES = libgncmod-business-backend-file.la
+pkglib_LTLIBRARIES = libgncmod-business-backend-xml.la
AM_CFLAGS = \
-I${top_srcdir}/src \
-I${top_srcdir}/src/backend \
- -I${top_srcdir}/src/backend/file \
+ -I${top_srcdir}/src/backend/xml \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/business/business-core \
@@ -13,8 +13,8 @@
${QOF_CFLAGS} \
${GLIB_CFLAGS}
-libgncmod_business_backend_file_la_SOURCES = \
- gncmod-business-backend-file.c \
+libgncmod_business_backend_xml_la_SOURCES = \
+ gncmod-business-backend-xml.c \
gnc-address-xml-v2.c \
gnc-bill-term-xml-v2.c \
gnc-customer-xml-v2.c \
@@ -41,11 +41,11 @@
gnc-vendor-xml-v2.h \
xml-helpers.h
-libgncmod_business_backend_file_la_LDFLAGS = -module -avoid-version
+libgncmod_business_backend_xml_la_LDFLAGS = -module -avoid-version
-libgncmod_business_backend_file_la_LIBADD = \
+libgncmod_business_backend_xml_la_LIBADD = \
${top_builddir}/src/business/business-core/libgncmod-business-core.la \
- ${top_builddir}/src/backend/file/libgnc-backend-file-utils.la \
+ ${top_builddir}/src/backend/xml/libgnc-backend-xml-utils.la \
${top_builddir}/src/engine/libgncmod-engine.la \
${top_builddir}/src/gnc-module/libgnc-module.la \
${LIBXML2_LIBS} \
Deleted: gnucash/branches/gda-dev2/src/business/business-core/xml/gncmod-business-backend-file.c
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-core/xml/gncmod-business-backend-file.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/business/business-core/xml/gncmod-business-backend-file.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -1,112 +0,0 @@
-/*********************************************************************
- * gncmod-business-backend-file.c
- * module definition/initialization for the file backend module
- *
- * Copyright (c) 2002 Derek Atkins <warlord at MIT.EDU>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, contact:
- *
- * Free Software Foundation Voice: +1-617-542-5942
- * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
- * Boston, MA 02110-1301, USA gnu at gnu.org
- *
- *********************************************************************/
-
-#include "config.h"
-#include <gmodule.h>
-
-#include "gnc-module.h"
-#include "gnc-module-api.h"
-#include "gnc-engine.h"
-#include "io-gncxml-v2.h"
-
-#include "gnc-address-xml-v2.h"
-#include "gnc-bill-term-xml-v2.h"
-#include "gnc-customer-xml-v2.h"
-#include "gnc-employee-xml-v2.h"
-#include "gnc-entry-xml-v2.h"
-#include "gnc-invoice-xml-v2.h"
-#include "gnc-job-xml-v2.h"
-#include "gnc-order-xml-v2.h"
-#include "gnc-owner-xml-v2.h"
-#include "gnc-tax-table-xml-v2.h"
-#include "gnc-vendor-xml-v2.h"
-
-GNC_MODULE_API_DECL(libgncmod_business_backend_file)
-
-/* version of the gnc module system interface we require */
-int libgncmod_business_backend_file_gnc_module_system_interface = 0;
-
-/* module versioning uses libtool semantics. */
-int libgncmod_business_backend_file_gnc_module_current = 0;
-int libgncmod_business_backend_file_gnc_module_revision = 0;
-int libgncmod_business_backend_file_gnc_module_age = 0;
-
-static GNCModule bus_core;
-static GNCModule file;
-
-
-char *
-libgncmod_business_backend_file_gnc_module_path(void)
-{
- return g_strdup("gnucash/business-core-file");
-}
-
-char *
-libgncmod_business_backend_file_gnc_module_description(void)
-{
- return g_strdup("The XML (v2) parsers for GnuCash business objects");
-}
-
-int
-libgncmod_business_backend_file_gnc_module_init(int refcount)
-{
- if(!gnc_engine_is_initialized()) { return FALSE; }
-
- bus_core = gnc_module_load("gnucash/business-core", 0);
- if(!bus_core) return FALSE;
-
- if (refcount == 0) {
- /* Initialize our pointers into the backend subsystem */
- gnc_address_xml_initialize ();
- gnc_billterm_xml_initialize ();
- gnc_customer_xml_initialize ();
- gnc_employee_xml_initialize ();
- gnc_entry_xml_initialize ();
- gnc_invoice_xml_initialize ();
- gnc_job_xml_initialize ();
- gnc_order_xml_initialize ();
- gnc_owner_xml_initialize ();
- gnc_taxtable_xml_initialize ();
- gnc_vendor_xml_initialize ();
- }
-
- return TRUE;
-}
-
-int
-libgncmod_business_backend_file_gnc_module_end(int refcount)
-{
- int unload = TRUE;
-
- if (bus_core)
- unload = gnc_module_unload(bus_core);
-
- if (refcount == 0) {
- bus_core = NULL;
- file = NULL;
- }
-
- return unload;
-}
Copied: gnucash/branches/gda-dev2/src/business/business-core/xml/gncmod-business-backend-xml.c (from rev 16700, gnucash/branches/gda-dev2/src/business/business-core/xml/gncmod-business-backend-file.c)
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-core/xml/gncmod-business-backend-xml.c (rev 0)
+++ gnucash/branches/gda-dev2/src/business/business-core/xml/gncmod-business-backend-xml.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -0,0 +1,112 @@
+/*********************************************************************
+ * gncmod-business-backend-file.c
+ * module definition/initialization for the file backend module
+ *
+ * Copyright (c) 2002 Derek Atkins <warlord at MIT.EDU>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, contact:
+ *
+ * Free Software Foundation Voice: +1-617-542-5942
+ * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
+ * Boston, MA 02110-1301, USA gnu at gnu.org
+ *
+ *********************************************************************/
+
+#include "config.h"
+#include <gmodule.h>
+
+#include "gnc-module.h"
+#include "gnc-module-api.h"
+#include "gnc-engine.h"
+#include "io-gncxml-v2.h"
+
+#include "gnc-address-xml-v2.h"
+#include "gnc-bill-term-xml-v2.h"
+#include "gnc-customer-xml-v2.h"
+#include "gnc-employee-xml-v2.h"
+#include "gnc-entry-xml-v2.h"
+#include "gnc-invoice-xml-v2.h"
+#include "gnc-job-xml-v2.h"
+#include "gnc-order-xml-v2.h"
+#include "gnc-owner-xml-v2.h"
+#include "gnc-tax-table-xml-v2.h"
+#include "gnc-vendor-xml-v2.h"
+
+GNC_MODULE_API_DECL(libgncmod_business_backend_xml)
+
+/* version of the gnc module system interface we require */
+int libgncmod_business_backend_xml_gnc_module_system_interface = 0;
+
+/* module versioning uses libtool semantics. */
+int libgncmod_business_backend_xml_gnc_module_current = 0;
+int libgncmod_business_backend_xml_gnc_module_revision = 0;
+int libgncmod_business_backend_xml_gnc_module_age = 0;
+
+static GNCModule bus_core;
+static GNCModule file;
+
+
+char *
+libgncmod_business_backend_xml_gnc_module_path(void)
+{
+ return g_strdup("gnucash/business-core-file");
+}
+
+char *
+libgncmod_business_backend_xml_gnc_module_description(void)
+{
+ return g_strdup("The XML (v2) parsers for GnuCash business objects");
+}
+
+int
+libgncmod_business_backend_xml_gnc_module_init(int refcount)
+{
+ if(!gnc_engine_is_initialized()) { return FALSE; }
+
+ bus_core = gnc_module_load("gnucash/business-core", 0);
+ if(!bus_core) return FALSE;
+
+ if (refcount == 0) {
+ /* Initialize our pointers into the backend subsystem */
+ gnc_address_xml_initialize ();
+ gnc_billterm_xml_initialize ();
+ gnc_customer_xml_initialize ();
+ gnc_employee_xml_initialize ();
+ gnc_entry_xml_initialize ();
+ gnc_invoice_xml_initialize ();
+ gnc_job_xml_initialize ();
+ gnc_order_xml_initialize ();
+ gnc_owner_xml_initialize ();
+ gnc_taxtable_xml_initialize ();
+ gnc_vendor_xml_initialize ();
+ }
+
+ return TRUE;
+}
+
+int
+libgncmod_business_backend_xml_gnc_module_end(int refcount)
+{
+ int unload = TRUE;
+
+ if (bus_core)
+ unload = gnc_module_unload(bus_core);
+
+ if (refcount == 0) {
+ bus_core = NULL;
+ file = NULL;
+ }
+
+ return unload;
+}
Modified: gnucash/branches/gda-dev2/src/business/business-gnome/business-gnome.scm
===================================================================
--- gnucash/branches/gda-dev2/src/business/business-gnome/business-gnome.scm 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/business/business-gnome/business-gnome.scm 2007-12-23 20:56:51 UTC (rev 16701)
@@ -5,7 +5,8 @@
(gnc:module-load "gnucash/business-core" 0)
(gnc:module-load "gnucash/business-utils" 0)
(gnc:module-load "gnucash/gnome-search" 0)
-(gnc:module-load "gnucash/business-core-file" 0)
+(gnc:module-load "gnucash/business-core-xml" 0)
+(gnc:module-load "gnucash/business-core-gda" 0)
(gnc:module-load "gnucash/dialog-tax-table" 0)
(gnc:module-load "gnucash/report/report-gnome" 0)
Modified: gnucash/branches/gda-dev2/src/engine/Account.c
===================================================================
--- gnucash/branches/gda-dev2/src/engine/Account.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/engine/Account.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -78,6 +78,9 @@
PROP_TAX_RELATED,
PROP_TAX_CODE,
PROP_TAX_SOURCE,
+
+ PROP_HIDDEN,
+ PROP_PLACEHOLDER,
};
typedef struct AccountPrivate
@@ -347,6 +350,12 @@
g_value_set_string(value,
xaccAccountGetTaxUSPayerNameSource(account));
break;
+ case PROP_HIDDEN:
+ g_value_set_boolean(value, xaccAccountGetHidden(account));
+ break;
+ case PROP_PLACEHOLDER:
+ g_value_set_boolean(value, xaccAccountGetPlaceholder(account));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -422,6 +431,12 @@
case PROP_TAX_SOURCE:
xaccAccountSetTaxUSPayerNameSource(account,
g_value_get_string(value));
+ case PROP_HIDDEN:
+ xaccAccountSetHidden(account, g_value_get_boolean(value));
+ break;
+ case PROP_PLACEHOLDER:
+ xaccAccountSetPlaceholder(account, g_value_get_boolean(value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -547,7 +562,7 @@
PROP_NON_STD_SCU,
g_param_spec_boolean ("non-std-scu",
"Non-std SCU",
- "TRUE id the account SCU doesn't match "
+ "TRUE if the account SCU doesn't match "
"the commodity SCU. This indicates a case "
"where the two were accidentally set to "
"mismatched values in older versions of "
@@ -718,6 +733,16 @@
"This is an unknown tax related field.",
NULL,
G_PARAM_READWRITE));
+
+ g_object_class_install_property
+ (gobject_class,
+ PROP_HIDDEN,
+ g_param_spec_boolean ("hidden",
+ "Hidden",
+ "Whether the account should be hidden in the "
+ "account tree.",
+ FALSE,
+ G_PARAM_READWRITE));
}
static void
Modified: gnucash/branches/gda-dev2/src/engine/SX-book.c
===================================================================
--- gnucash/branches/gda-dev2/src/engine/SX-book.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/engine/SX-book.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -61,7 +61,7 @@
}
Account *
-gnc_book_get_template_root( QofBook *book )
+gnc_book_get_template_root( const QofBook *book )
{
QofCollection *col;
if (!book) return NULL;
@@ -113,12 +113,12 @@
{
Account *root;
- root = xaccMallocAccount(book);
- xaccAccountBeginEdit(root);
- xaccAccountSetType(root, ACCT_TYPE_ROOT);
- xaccAccountCommitEdit(root);
- gnc_book_set_template_root (book, root);
-}
+ root = xaccMallocAccount(book);
+ xaccAccountBeginEdit(root);
+ xaccAccountSetType(root, ACCT_TYPE_ROOT);
+ xaccAccountCommitEdit(root);
+ gnc_book_set_template_root (book, root);
+ }
static void
sxtg_book_end (QofBook *book)
Modified: gnucash/branches/gda-dev2/src/engine/SX-book.h
===================================================================
--- gnucash/branches/gda-dev2/src/engine/SX-book.h 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/engine/SX-book.h 2007-12-23 20:56:51 UTC (rev 16701)
@@ -80,7 +80,7 @@
void gnc_sxes_del_sx(SchedXactions* sxes, SchedXaction* sx);
/** Returns the template group from the book. **/
-Account *gnc_book_get_template_root(QofBook *book);
+Account *gnc_book_get_template_root(const QofBook *book);
/** @return The list of SXes which reference the given Account. Caller should free this list. **/
GList* gnc_sx_get_sxes_referencing_account(QofBook *book, Account *acct);
Modified: gnucash/branches/gda-dev2/src/engine/SchedXaction.c
===================================================================
--- gnucash/branches/gda-dev2/src/engine/SchedXaction.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/engine/SchedXaction.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -88,6 +88,7 @@
/* create a new template account for our splits */
sx->template_acct = xaccMallocAccount(book);
guid = qof_instance_get_guid( sx );
+ xaccAccountBeginEdit( sx->template_acct );
xaccAccountSetName( sx->template_acct, guid_to_string( guid ));
xaccAccountSetCommodity
(sx->template_acct,
@@ -95,6 +96,7 @@
"template", "template",
"template", "template", 1 ) );
xaccAccountSetType( sx->template_acct, ACCT_TYPE_BANK );
+ xaccAccountCommitEdit( sx->template_acct );
ra = gnc_book_get_template_root( book );
gnc_account_append_child( ra, sx->template_acct );
}
Modified: gnucash/branches/gda-dev2/src/engine/gnc-book.h
===================================================================
--- gnucash/branches/gda-dev2/src/engine/gnc-book.h 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/engine/gnc-book.h 2007-12-23 20:56:51 UTC (rev 16701)
@@ -12,6 +12,3 @@
#define gnc_book_get_backend qof_book_get_backend
#define gnc_book_get_entity_table qof_book_get_entity_table
#define gnc_book_get_counter qof_book_get_counter
-#define gnc_book_x qof_book_x
-#define gnc_book_x qof_book_x
-#define gnc_book_x qof_book_x
Modified: gnucash/branches/gda-dev2/src/engine/gnc-engine.c
===================================================================
--- gnucash/branches/gda-dev2/src/engine/gnc-engine.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/engine/gnc-engine.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -36,7 +36,7 @@
#include "gnc-pricedb-p.h"
/** gnc file backend library name */
-#define GNC_LIB_NAME "gncmod-backend-file"
+#define GNC_LIB_NAME "gncmod-backend-xml"
/* gnc-backend-file location */
#include "gnc-path.h"
@@ -76,11 +76,10 @@
const gchar* lib;
gboolean required;
} libs[] = {
+ { "gncmod-backend-gda", TRUE },
{ GNC_LIB_NAME, TRUE },
-#ifdef SQL_DIR
/* shouldn't the PG gnc-module do this instead of US doing it? */
- { "gnc-backend-postgres", FALSE },
-#endif
+ { "gncmod-backend-postgres", FALSE },
{ NULL, FALSE } }, *lib;
gnc_engine_init_hook_t hook;
GList * cur;
Modified: gnucash/branches/gda-dev2/src/engine/gnc-filepath-utils.c
===================================================================
--- gnucash/branches/gda-dev2/src/engine/gnc-filepath-utils.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/engine/gnc-filepath-utils.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -205,6 +205,10 @@
LEAVE("filefrag is file uri");
return g_strdup(filefrag + 5);
}
+ if( g_ascii_strncasecmp( filefrag, "xml:", 4 ) == 0 ) {
+ LEAVE( "filefrag is xml file uri" );
+ return g_strdup( filefrag + 4);
+ }
/* get conservative on the length so that sprintf(getpid()) works ... */
/* strlen ("/.LCK") + sprintf (%x%d) */
@@ -293,6 +297,7 @@
if (!g_ascii_strncasecmp (pathfrag, "http://", 7) ||
!g_ascii_strncasecmp (pathfrag, "https://", 8) ||
+ !g_ascii_strncasecmp (pathfrag, "gda://", 6) ||
!g_ascii_strncasecmp (pathfrag, "postgres://", 11))
{
return g_strdup(pathfrag);
@@ -301,6 +306,9 @@
if (!g_ascii_strncasecmp (pathfrag, "file:", 5)) {
return (xaccResolveFilePath (pathfrag));
}
+ if (!g_ascii_strncasecmp (pathfrag, "xml:", 4)) {
+ return (g_strdup_printf( "xml:%s", xaccResolveFilePath (pathfrag)) );
+ }
return (xaccResolveFilePath (pathfrag));
}
Modified: gnucash/branches/gda-dev2/src/experimental/cgi-bin/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/experimental/cgi-bin/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/experimental/cgi-bin/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -5,7 +5,7 @@
AM_CFLAGS = \
-I../../engine -I${srcdir}/../../engine \
- -I../../backend/file -I${srcdir}/../../backend/file \
+ -I../../backend/xml -I${srcdir}/../../backend/xml \
${GLIB_CFLAGS}
LDADD = \
Modified: gnucash/branches/gda-dev2/src/gnome/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/gnome/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -10,7 +10,7 @@
${top_builddir}/src/report/report-system/libgncmod-report-system.la \
${top_builddir}/src/gnome-search/libgncmod-gnome-search.la \
${top_builddir}/src/gnome-utils/libgncmod-gnome-utils.la \
- ${top_builddir}/src/backend/file/libgnc-backend-file-utils.la \
+ ${top_builddir}/src/backend/xml/libgnc-backend-xml-utils.la \
${top_builddir}/src/app-utils/libgncmod-app-utils.la \
${top_builddir}/src/engine/libgncmod-engine.la \
${top_builddir}/src/calculation/libgncmod-calculation.la \
@@ -107,7 +107,7 @@
-I${top_srcdir}/src/calculation \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/app-utils \
- -I${top_srcdir}/src/backend/file \
+ -I${top_srcdir}/src/backend/xml \
-I${top_srcdir}/src/gnome-utils \
-I${top_srcdir}/src/gnome-search \
-I${top_srcdir}/src/register/ledger-core \
Modified: gnucash/branches/gda-dev2/src/gnome/dialog-sx-editor.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome/dialog-sx-editor.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/gnome/dialog-sx-editor.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -861,6 +861,8 @@
static void
gnc_sxed_save_sx( GncSxEditorDialog *sxed )
{
+ gnc_sx_begin_edit( sxed->sx );
+
/* name */
{
char *name;
@@ -962,6 +964,8 @@
/* now that we have it, set the start date */
xaccSchedXactionSetStartDate( sxed->sx, &gdate );
}
+
+ gnc_sx_commit_edit( sxed->sx );
}
static void
Modified: gnucash/branches/gda-dev2/src/gnome-utils/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/gnome-utils/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -8,7 +8,7 @@
-I${top_srcdir}/src/core-utils \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/engine \
- -I${top_srcdir}/src/backend/file \
+ -I${top_srcdir}/src/backend/xml \
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src \
-I${top_builddir}/src \
@@ -176,7 +176,7 @@
${top_builddir}/src/core-utils/libgnc-core-utils.la \
${top_builddir}/src/gnc-module/libgnc-module.la \
${top_builddir}/src/engine/libgncmod-engine.la \
- ${top_builddir}/src/backend/file/libgnc-backend-file-utils.la \
+ ${top_builddir}/src/backend/xml/libgnc-backend-xml-utils.la \
${top_builddir}/src/calculation/libgncmod-calculation.la \
${top_builddir}/src/app-utils/libgncmod-app-utils.la \
$(top_builddir)/lib/libc/libc-missing.la \
Modified: gnucash/branches/gda-dev2/src/gnome-utils/druid-gnc-xml-import.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/druid-gnc-xml-import.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/gnome-utils/druid-gnc-xml-import.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -30,7 +30,7 @@
#include "druid-gnc-xml-import.h"
#include "dialog-utils.h"
#include "druid-utils.h"
-#include "gnc-backend-file.h"
+#include "gnc-backend-xml.h"
#include "gnc-filepath-utils.h"
#include "gnc-module.h"
#include "gnc-ui.h"
Modified: gnucash/branches/gda-dev2/src/gnome-utils/gnc-file.c
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/gnc-file.c 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/gnome-utils/gnc-file.c 2007-12-23 20:56:51 UTC (rev 16701)
@@ -166,13 +166,41 @@
response = gtk_dialog_run(GTK_DIALOG(file_box));
if (response == GTK_RESPONSE_ACCEPT) {
+ gboolean need_free = FALSE;
+
/* look for constructs like postgres://foo */
internal_name = gtk_file_chooser_get_uri(GTK_FILE_CHOOSER (file_box));
if (strstr (internal_name, "file://") == internal_name) {
+ gchar* cur_folder;
+ char* colon;
+ char* slash;
+
/* nope, a local file name */
internal_name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (file_box));
+ cur_folder = gtk_file_chooser_get_current_folder( GTK_FILE_CHOOSER( file_box ) );
+ if( g_str_has_prefix( internal_name, cur_folder ) ) {
+ internal_name += strlen( cur_folder )+1;
+
+ /* If there's a ':' before a '/', assume it was from an access method
+ * and rearrange the name.
+ */
+ colon = strstr( internal_name, ":" );
+ slash = strstr( internal_name, "/" );
+ if( colon != NULL && (slash == NULL || slash > colon) ) {
+ const gchar* access_method = internal_name;
+ gchar* rest = colon+1;
+ *colon = '\0';
+
+ internal_name = g_strconcat( access_method, ":",
+ cur_folder, "/", rest, NULL );
+ need_free = TRUE;
+ }
+ }
}
file_name = g_strdup(internal_name);
+ if( need_free ) {
+ g_free( (gchar*)internal_name );
+ }
}
gtk_widget_destroy(GTK_WIDGET(file_box));
LEAVE("%s", file_name ? file_name : "(null)");
@@ -1034,6 +1062,24 @@
g_free(default_dir);
if (!filename) return;
+ gnc_file_do_save_as( filename );
+
+ LEAVE (" ");
+}
+
+void
+gnc_file_do_save_as (const char* filename)
+{
+ QofSession *new_session;
+ QofSession *session;
+ char *default_dir = NULL; /* Default to last open */
+ char *last;
+ char *newfile;
+ const char *oldfile;
+ QofBackendError io_err = ERR_BACKEND_NO_ERR;
+
+ ENTER(" ");
+
/* Check to see if the user specified the same file as the current
* file. If so, then just do that, instead of the below, which
* assumes a truly new name was given. */
Modified: gnucash/branches/gda-dev2/src/gnome-utils/gnc-file.h
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/gnc-file.h 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/gnome-utils/gnc-file.h 2007-12-23 20:56:51 UTC (rev 16701)
@@ -127,6 +127,7 @@
gboolean gnc_file_open (void);
void gnc_file_save (void);
void gnc_file_save_as (void);
+void gnc_file_do_save_as(const char* filename);
/** Tell the user about errors in the backends
Modified: gnucash/branches/gda-dev2/src/gnome-utils/test/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/gnome-utils/test/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/gnome-utils/test/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -17,7 +17,7 @@
--library-dir ${top_builddir}/src/core-utils \
--library-dir ${top_builddir}/src/gnc-module \
--library-dir ${top_builddir}/src/engine \
- --library-dir ${top_builddir}/src/backend/file \
+ --library-dir ${top_builddir}/src/backend/xml \
--library-dir ${top_builddir}/src/calculation \
--library-dir ${top_builddir}/src/app-utils \
--library-dir ${top_builddir}/src/gnome-utils
Modified: gnucash/branches/gda-dev2/src/import-export/qif-io-core/test/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/qif-io-core/test/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/import-export/qif-io-core/test/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -10,7 +10,7 @@
--gnc-module-dir ${top_builddir}/src/engine \
--gnc-module-dir ${top_builddir}/src/app-utils \
--gnc-module-dir ${top_builddir}/src/calculation \
- --gnc-module-dir ${top_builddir}/src/backend/file \
+ --gnc-module-dir ${top_builddir}/src/backend/xml \
--gnc-module-dir ${top_builddir}/src/import-export/qif-io-core \
--guile-load-dir ${top_srcdir}/src/import-export/qif-io-core/test \
--guile-load-dir ${top_srcdir}/lib \
Modified: gnucash/branches/gda-dev2/src/import-export/test/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/import-export/test/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/import-export/test/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -29,7 +29,7 @@
--library-dir ${top_builddir}/src/core-utils \
--library-dir ${top_builddir}/src/gnc-module \
--library-dir ${top_builddir}/src/engine \
- --library-dir ${top_builddir}/src/backend/file \
+ --library-dir ${top_builddir}/src/backend/xml \
--library-dir ${top_builddir}/src/calculation \
--library-dir ${top_builddir}/src/app-utils \
--library-dir ${top_builddir}/src/gnome-utils \
Modified: gnucash/branches/gda-dev2/src/report/report-gnome/test/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/report/report-gnome/test/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/report/report-gnome/test/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -12,7 +12,7 @@
--library-dir ${top_builddir}/src/core-utils \
--library-dir ${top_builddir}/src/gnc-module \
--library-dir ${top_builddir}/src/engine \
- --library-dir ${top_builddir}/src/backend/file \
+ --library-dir ${top_builddir}/src/backend/xml \
--library-dir ${top_builddir}/src/calculation \
--library-dir ${top_builddir}/src/app-utils \
--library-dir ${top_builddir}/src/gnome-utils \
Modified: gnucash/branches/gda-dev2/src/report/stylesheets/test/Makefile.am
===================================================================
--- gnucash/branches/gda-dev2/src/report/stylesheets/test/Makefile.am 2007-12-23 20:25:56 UTC (rev 16700)
+++ gnucash/branches/gda-dev2/src/report/stylesheets/test/Makefile.am 2007-12-23 20:56:51 UTC (rev 16701)
@@ -10,7 +10,7 @@
--library-dir ${top_builddir}/src/core-utils \
--library-dir ${top_builddir}/src/gnc-module \
--library-dir ${top_builddir}/src/engine \
- --library-dir ${top_builddir}/src/backend/file \
+ --library-dir ${top_builddir}/src/backend/xml \
--library-dir ${top_builddir}/src/calculation \
--library-dir ${top_builddir}/src/app-utils \
--library-dir ${top_builddir}/src/gnome-utils \
More information about the gnucash-changes
mailing list