From 97062a3b81c5ea0bf8b3f5af0a56e21e0511cd03 Mon Sep 17 00:00:00 2001 From: Chris Shoemaker Date: Fri, 26 May 2006 00:10:35 +0000 Subject: [PATCH] Merge 'misc-backend' -r 14160:14184 into trunk. This includes the now semi-functional postgres backend. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14198 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 113 ++++++++++++++++++ lib/libqof/backend/file/Makefile.am | 1 + lib/libqof/backend/file/qof-backend-qsf.h | 4 +- lib/libqof/backend/file/qsf-backend.c | 12 +- lib/libqof/qof/guid.c | 13 +- lib/libqof/qof/qof.h | 4 +- lib/libqof/qof/qofbackend-p.h | 11 +- lib/libqof/qof/qofbackend.c | 29 ++--- lib/libqof/qof/qofbackend.h | 15 ++- lib/libqof/qof/qofbook.c | 2 +- lib/libqof/qof/qofsession-p.h | 3 - lib/libqof/qof/qofsession.c | 76 +++++++++--- lib/libqof/qof/qofsession.h | 4 + lib/libqof/qof/qofutil.c | 1 + lib/libqof/qof/qofutil.h | 3 +- src/backend/file/gnc-backend-file.c | 17 ++- src/backend/file/gnc-backend-file.h | 17 +-- src/backend/file/test/test-load-backend.c | 17 ++- src/backend/file/test/test-load-xml2.c | 6 +- src/backend/postgres/Makefile.am | 19 +-- src/backend/postgres/PostgresBackend.c | 8 +- src/backend/postgres/PostgresBackend.h | 5 +- src/backend/postgres/test/test-db.c | 8 +- src/backend/postgres/test/test-load-backend.c | 6 +- src/backend/postgres/test/test-period.c | 6 +- src/engine/Account.c | 4 +- src/engine/Makefile.am | 2 +- src/engine/Period.c | 4 + src/engine/Transaction.c | 1 + src/engine/gnc-commodity.h | 2 +- src/engine/gnc-engine.c | 75 +++--------- src/engine/gnc-engine.h | 8 +- src/engine/gnc-pricedb.c | 1 + src/engine/gnc-session-scm.c | 7 -- src/engine/gnc-session-scm.h | 2 - src/engine/gw-engine-spec.scm | 8 -- src/gnome-utils/gnc-file.c | 11 +- src/gnome-utils/gnc-html-graph-gog.c | 8 +- src/gnome-utils/gnc-main-window.c | 2 +- 39 files changed, 306 insertions(+), 229 deletions(-) diff --git a/ChangeLog b/ChangeLog index 28cf5ae7e1..c0324ca312 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,12 +15,125 @@ * configure.in: Deactivate --enable-sql because PostgreSQL backend is still broken and we can't fix it before 2.0.0; bug#332251. +r14181 | chris | 2006-05-24 18:57:43 -0400 (Wed, 24 May 2006) | 3 lines + + M /gnucash/branches/misc-backend/lib/libqof/qof/guid.c + + The postgres backend depends on the value of the null guid, so revert it + to its 1.8 value. + r14180 | chris | 2006-05-24 18:54:03 -0400 (Wed, 24 May 2006) | 2 lines M /gnucash/trunk/lib/libqof/qof/gnc-date.c Consistently pad date formats with zeros instead of spaces. +r14170 | chris | 2006-05-23 23:55:35 -0400 (Tue, 23 May 2006) | 2 lines + + M /gnucash/branches/misc-backend/src/backend/postgres/Makefile.am + M /gnucash/branches/misc-backend/src/backend/postgres/PostgresBackend.c + M /gnucash/branches/misc-backend/src/engine/Account.c + M /gnucash/branches/misc-backend/src/engine/gnc-commodity.h + + Trivial comments/cleanups. + +r14169 | chris | 2006-05-23 23:53:52 -0400 (Tue, 23 May 2006) | 2 lines + + M /gnucash/branches/misc-backend/src/gnome-utils/gnc-html-graph-gog.c + + Clarify unused parameters. + +r14168 | chris | 2006-05-23 23:48:00 -0400 (Tue, 23 May 2006) | 3 lines + + M /gnucash/branches/misc-backend/src/gnome-utils/gnc-file.c + + There's no need to rerun the book-saved callbacks in gnc_file_save_as() + because they've already been run in gnc_file_save() + +r14167 | chris | 2006-05-23 23:44:50 -0400 (Tue, 23 May 2006) | 6 lines + + M /gnucash/branches/misc-backend/src/gnome-utils/gnc-file.c + M /gnucash/branches/misc-backend/src/gnome-utils/gnc-main-window.c + + Use the session URL instead of file path for + 1) determining if we have something open + 2) determining if we're saving exactly what we have open + 3) updating the title bar + +r14166 | chris | 2006-05-23 23:34:18 -0400 (Tue, 23 May 2006) | 2 lines + + M /gnucash/branches/misc-backend/lib/libqof/backend/file/Makefile.am + M /gnucash/branches/misc-backend/lib/libqof/backend/file/qof-backend-qsf.h + M /gnucash/branches/misc-backend/lib/libqof/backend/file/qsf-backend.c + M /gnucash/branches/misc-backend/lib/libqof/qof/qof.h + M /gnucash/branches/misc-backend/lib/libqof/qof/qofsession.c + + Move the QSF backend from custom init to GModule init. + +r14165 | chris | 2006-05-23 23:21:09 -0400 (Tue, 23 May 2006) | 18 lines + + M /gnucash/branches/misc-backend/lib/libqof/backend/file/qsf-backend.c + M /gnucash/branches/misc-backend/lib/libqof/qof/qofbackend-p.h + M /gnucash/branches/misc-backend/lib/libqof/qof/qofbackend.c + M /gnucash/branches/misc-backend/lib/libqof/qof/qofbackend.h + M /gnucash/branches/misc-backend/lib/libqof/qof/qofsession-p.h + M /gnucash/branches/misc-backend/lib/libqof/qof/qofsession.c + M /gnucash/branches/misc-backend/lib/libqof/qof/qofsession.h + M /gnucash/branches/misc-backend/lib/libqof/qof/qofutil.c + M /gnucash/branches/misc-backend/lib/libqof/qof/qofutil.h + M /gnucash/branches/misc-backend/src/backend/file/gnc-backend-file.c + M /gnucash/branches/misc-backend/src/backend/file/gnc-backend-file.h + M /gnucash/branches/misc-backend/src/backend/file/test/test-load-backend.c + M /gnucash/branches/misc-backend/src/backend/file/test/test-load-xml2.c + M /gnucash/branches/misc-backend/src/backend/postgres/PostgresBackend.c + M /gnucash/branches/misc-backend/src/backend/postgres/PostgresBackend.h + M /gnucash/branches/misc-backend/src/backend/postgres/test/test-db.c + M /gnucash/branches/misc-backend/src/backend/postgres/test/test-load-backend.c + M /gnucash/branches/misc-backend/src/backend/postgres/test/test-period.c + M /gnucash/branches/misc-backend/src/engine/Period.c + M /gnucash/branches/misc-backend/src/engine/Transaction.c + M /gnucash/branches/misc-backend/src/engine/gnc-engine.c + M /gnucash/branches/misc-backend/src/engine/gnc-engine.h + M /gnucash/branches/misc-backend/src/engine/gnc-pricedb.c + M /gnucash/branches/misc-backend/src/engine/gnc-session-scm.c + M /gnucash/branches/misc-backend/src/engine/gnc-session-scm.h + M /gnucash/branches/misc-backend/src/engine/gw-engine-spec.scm + + Decrease coupling between backends and engine: + - do not include the (supposedly) private qofbackend-p.h in qofutil.h, + instead, include it explictly in only the places that need it. + - since backends are GModules, use the GModule module init hook, instead + of rolling our own and using a different function for each backend + - loop over a list of backends for the engine to try to load + - include the postgres backend in that list of backends + - move qof_session_export() from gnc-engine.c to qofsession.c + - publicize qof_backend_set_error() and qof_backend_get_error() + - privatize QofBookFileType to gnc-backend-file.c + + Incidental: + - Plug a string leak in qofsession.c + - drop the unused gnc_session_scm_export code + - Drop unimplemented prototype gncBackendInit_file() + - Formatting cleanups. + +r14164 | chris | 2006-05-23 23:18:14 -0400 (Tue, 23 May 2006) | 2 lines + + M /gnucash/branches/misc-backend/lib/libqof/qof/qofbook.c + + Recognize unequal books as unequal. + +r14163 | chris | 2006-05-23 23:16:19 -0400 (Tue, 23 May 2006) | 2 lines + + M /gnucash/branches/misc-backend/src/engine/Makefile.am + + Make sure GNC_LIBDIR is updated when the installation dir changes. + +r14161 | chris | 2006-05-23 21:40:39 -0400 (Tue, 23 May 2006) | 2 lines + + A /gnucash/branches/misc-backend (from /gnucash/trunk:14160) + + Branched from trunk at r14160, hoping postgres will work again someday... + r14159 | chris | 2006-05-23 21:25:30 -0400 (Tue, 23 May 2006) | 4 lines M /gnucash/trunk/lib/guile-www/cgi.scm diff --git a/lib/libqof/backend/file/Makefile.am b/lib/libqof/backend/file/Makefile.am index caf55861c4..3669a897eb 100644 --- a/lib/libqof/backend/file/Makefile.am +++ b/lib/libqof/backend/file/Makefile.am @@ -14,6 +14,7 @@ libgncqof_backend_qsf_la_SOURCES = \ qsf-xml-map.c \ qsf-xml.c +libgncqof_backend_qsf_la_LDFLAGS = -module libgncqof_backend_qsf_la_LIBADD = \ ${QOF_LIBS} \ ${GLIB_LIBS} \ diff --git a/lib/libqof/backend/file/qof-backend-qsf.h b/lib/libqof/backend/file/qof-backend-qsf.h index 1b8c88e144..87a1fcdc5f 100644 --- a/lib/libqof/backend/file/qof-backend-qsf.h +++ b/lib/libqof/backend/file/qof-backend-qsf.h @@ -139,6 +139,7 @@ Check the QofBackendError - don't assume the file is OK. #ifndef _QOF_BACKEND_QSF_H #define _QOF_BACKEND_QSF_H +#include #include "qoflog.h" #include "qofbackend.h" @@ -162,7 +163,8 @@ default values for the QofBackendOption KvpFrame. Calls gettext because QofBackendOption strings are translatable. */ -void qsf_provider_init(void); +G_MODULE_EXPORT const gchar * +g_module_check_init(GModule *module); /** \name Supported backend configurations @{ diff --git a/lib/libqof/backend/file/qsf-backend.c b/lib/libqof/backend/file/qsf-backend.c index 058d6b0944..8234628d1c 100644 --- a/lib/libqof/backend/file/qsf-backend.c +++ b/lib/libqof/backend/file/qsf-backend.c @@ -24,6 +24,7 @@ #include "config.h" #include #include "qof.h" +#include "qofbackend-p.h" #include "qof-backend-qsf.h" #include #include @@ -1269,17 +1270,11 @@ qsf_provider_free (QofBackendProvider *prov) g_free (prov); } -void -qsf_provider_init(void) +G_MODULE_EXPORT const gchar * +g_module_check_init(GModule *module) { QofBackendProvider *prov; -/* #ifdef ENABLE_NLS - setlocale (LC_ALL, ""); - bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - textdomain (GETTEXT_PACKAGE); - #endif*/ prov = g_new0 (QofBackendProvider, 1); prov->provider_name = "QSF Backend Version 0.2"; prov->access_method = "file"; @@ -1288,4 +1283,5 @@ qsf_provider_init(void) prov->check_data_type = qsf_determine_file_type; prov->provider_free = qsf_provider_free; qof_backend_register_provider (prov); + return NULL; } diff --git a/lib/libqof/qof/guid.c b/lib/libqof/qof/guid.c index f750c9408e..9addaa0a49 100644 --- a/lib/libqof/qof/guid.c +++ b/lib/libqof/qof/guid.c @@ -122,16 +122,13 @@ guid_null(void) static int null_inited = 0; static GUID null_guid; - if (!null_inited) - { - int i; - char *tmp = "NULLGUID.EMPTY."; + if (!null_inited) { + int i; - /* 16th space for '\O' */ - for (i = 0; i < GUID_DATA_SIZE; i++) - null_guid.data[i] = tmp[i]; + for (i = 0; i < GUID_DATA_SIZE; i++) + null_guid.data[i] = '\0'; - null_inited = 1; + null_inited = 1; } return &null_guid; diff --git a/lib/libqof/qof/qof.h b/lib/libqof/qof/qof.h index 58f951bdb8..c840efae70 100644 --- a/lib/libqof/qof/qof.h +++ b/lib/libqof/qof/qof.h @@ -106,8 +106,6 @@ /** allow easy logging of QSF debug messages */ #define QOF_MOD_QSF "gncqof-backend-qsf" /** allow easy loading of the QSF backend */ -#define QSF_BACKEND_LIB "libgncqof-backend-qsf" -/** allow easy loading of the QSF backend */ -#define QSF_MODULE_INIT "qsf_provider_init" +#define QSF_BACKEND_LIB "gncqof-backend-qsf" #endif /* QOF_H_ */ diff --git a/lib/libqof/qof/qofbackend-p.h b/lib/libqof/qof/qofbackend-p.h index 3b008ca144..a42e365d7c 100644 --- a/lib/libqof/qof/qofbackend-p.h +++ b/lib/libqof/qof/qofbackend-p.h @@ -182,7 +182,7 @@ * pointer to the second book, where the results of the query * should go. * - * Cann the book commit() to complete the book partitioning. + * Call the book commit() to complete the book partitioning. * * After the begin(), there will be a call to run_query(), followed * probably by a string of object calls, and completed by commit(). @@ -367,15 +367,6 @@ struct QofBackend_s */ void qof_backend_register_provider (QofBackendProvider *); -/** The qof_backend_set_error() routine pushes an error code onto the error - * stack. (FIXME: the stack is 1 deep in current implementation). - */ -void qof_backend_set_error (QofBackend *be, QofBackendError err); - -/** The qof_backend_get_error() routine pops an error code off the error stack. - */ -QofBackendError qof_backend_get_error (QofBackend *be); - /** The qof_backend_set_message() assigns a string to the backend error message. */ void qof_backend_set_message(QofBackend *be, const char *format, ...); diff --git a/lib/libqof/qof/qofbackend.c b/lib/libqof/qof/qofbackend.c index 7ee90861aa..714d03a633 100644 --- a/lib/libqof/qof/qofbackend.c +++ b/lib/libqof/qof/qofbackend.c @@ -128,7 +128,7 @@ qof_backend_init(QofBackend *be) be->run_query = NULL; be->sync = NULL; - be->load_config = NULL; + be->load_config = NULL; be->events_pending = NULL; be->process_events = NULL; @@ -137,11 +137,11 @@ qof_backend_init(QofBackend *be) if (be->error_msg) g_free (be->error_msg); be->error_msg = NULL; be->percentage = NULL; - be->backend_configuration = kvp_frame_new(); - - /* to be removed */ - be->price_lookup = NULL; - be->export = NULL; + be->backend_configuration = kvp_frame_new(); + + /* to be removed */ + be->price_lookup = NULL; + be->export = NULL; } void @@ -384,30 +384,19 @@ qof_backend_commit_exists(QofBackend *be) } gboolean -qof_load_backend_library (const char *directory, - const char* filename, const char* init_fcn) +qof_load_backend_library (const char *directory, const char* module_name) { gchar *fullpath; - typedef void (* backend_init) (void); GModule *backend; - backend_init gmod_init; - gpointer g; g_return_val_if_fail(g_module_supported(), FALSE); - fullpath = g_module_build_path(directory, filename); + fullpath = g_module_build_path(directory, module_name); backend = g_module_open(fullpath, G_MODULE_BIND_LAZY); - if(!backend) { - g_message ("%s: %s\n", PACKAGE, g_module_error ()); - return FALSE; - } - g = &gmod_init; - if (!g_module_symbol (backend, init_fcn, g)) - { + if (!backend) { g_message ("%s: %s\n", PACKAGE, g_module_error ()); return FALSE; } g_module_make_resident(backend); - gmod_init(); return TRUE; } diff --git a/lib/libqof/qof/qofbackend.h b/lib/libqof/qof/qofbackend.h index 3fa30a125b..59025caebc 100644 --- a/lib/libqof/qof/qofbackend.h +++ b/lib/libqof/qof/qofbackend.h @@ -177,6 +177,15 @@ void qof_backend_run_commit(QofBackend *be, QofInstance *inst); gboolean qof_backend_commit_exists(QofBackend *be); //@} +/** The qof_backend_set_error() routine pushes an error code onto the error + * stack. (FIXME: the stack is 1 deep in current implementation). + */ +void qof_backend_set_error (QofBackend *be, QofBackendError err); + +/** The qof_backend_get_error() routine pops an error code off the error stack. + */ +QofBackendError qof_backend_get_error (QofBackend *be); + /** @name Backend Configuration using KVP The backend uses qof_backend_get_config to pass back a KvpFrame of QofBackendOption @@ -254,16 +263,14 @@ KvpFrame* qof_backend_get_config(QofBackend *be); /** \brief Load a QOF-compatible backend shared library. \param directory Can be NULL if filename is a complete path. -\param filename Name of the .la file that describes the +\param module_name Name of the .la file that describes the shared library. This provides platform independence, courtesy of libtool. -\param init_fcn The QofBackendProvider init function. \return FALSE in case or error, otherwise TRUE. */ gboolean -qof_load_backend_library (const gchar *directory, - const gchar* filename, const gchar* init_fcn); +qof_load_backend_library(const gchar *directory, const gchar* module_name); /** \brief Retrieve the backend used by this book */ QofBackend* qof_book_get_backend (QofBook *book); diff --git a/lib/libqof/qof/qofbook.c b/lib/libqof/qof/qofbook.c index 3f4ea3fa31..6da44917b5 100644 --- a/lib/libqof/qof/qofbook.c +++ b/lib/libqof/qof/qofbook.c @@ -139,7 +139,7 @@ qof_book_equal (QofBook *book_1, QofBook *book_2) { if (book_1 == book_2) return TRUE; if (!book_1 || !book_2) return FALSE; - return TRUE; + return FALSE; } /* ====================================================================== */ diff --git a/lib/libqof/qof/qofsession-p.h b/lib/libqof/qof/qofsession-p.h index 5cc02cff43..3ba3cb6080 100644 --- a/lib/libqof/qof/qofsession-p.h +++ b/lib/libqof/qof/qofsession-p.h @@ -70,7 +70,4 @@ QofBackend * qof_session_get_backend (QofSession *session); void qof_session_push_error (QofSession *session, QofBackendError err, const char *message); - -QofBackend* gncBackendInit_file(const char *book_id, void *data); - #endif diff --git a/lib/libqof/qof/qofsession.c b/lib/libqof/qof/qofsession.c index d7f48da795..ad26a8541d 100644 --- a/lib/libqof/qof/qofsession.c +++ b/lib/libqof/qof/qofsession.c @@ -843,7 +843,6 @@ struct backend_providers { const char *libdir; const char *filename; - const char *init_fcn; }; /* All available QOF backends need to be described here @@ -851,11 +850,11 @@ and the last entry must be three NULL's. Remember: Use the libdir from the current build environment and use JUST the module name without .so - .so is not portable! */ struct backend_providers backend_list[] = { - { QOF_LIB_DIR, QSF_BACKEND_LIB, QSF_MODULE_INIT }, + { QOF_LIB_DIR, QSF_BACKEND_LIB }, #ifdef HAVE_DWI - { QOF_LIB_DIR, "libqof_backend_dwi", "dwiend_provider_init" }, + { QOF_LIB_DIR, "libqof_backend_dwi"}, #endif - { NULL, NULL, NULL } + { NULL, NULL } }; static void @@ -876,11 +875,10 @@ qof_session_load_backend(QofSession * session, char * access_method) { for (num = 0; backend_list[num].filename != NULL; num++) { if(!qof_load_backend_library(backend_list[num].libdir, - backend_list[num].filename, backend_list[num].init_fcn)) + backend_list[num].filename)) { - PWARN (" failed to load %s from %s using %s", - backend_list[num].filename, backend_list[num].libdir, - backend_list[num].init_fcn); + PWARN (" failed to load %s from %s", + backend_list[num].filename, backend_list[num].libdir); } } } @@ -894,13 +892,14 @@ qof_session_load_backend(QofSession * session, char * access_method) /* More than one backend could provide this access method, check file type compatibility. */ type_check = (gboolean (*)(const char*)) prov->check_data_type; - prov_type = (type_check)(session->book_id); - if(!prov_type) - { + if (type_check) { + prov_type = (type_check)(session->book_id); + if (!prov_type) { PINFO(" %s not usable", prov->provider_name); p = p->next; continue; - } + } + } PINFO (" selected %s", prov->provider_name); if (NULL == prov->backend_new) { @@ -985,12 +984,12 @@ qof_session_begin (QofSession *session, const char * book_id, return; } - /* Store the session URL */ - session->book_id = g_strdup (book_id); - /* destroy the old backend */ qof_session_destroy_backend(session); + /* Store the session URL */ + session->book_id = g_strdup (book_id); + /* Look for something of the form of "file:/", "http://" or * "postgres://". Everything before the colon is the access * method. Load the first backend found for that access method. @@ -1000,7 +999,7 @@ qof_session_begin (QofSession *session, const char * book_id, { access_method = g_strdup (book_id); p = strchr (access_method, ':'); - *p = 0; + *p = '\0'; qof_session_load_backend(session, access_method); g_free (access_method); } @@ -1013,6 +1012,8 @@ qof_session_begin (QofSession *session, const char * book_id, /* No backend was found. That's bad. */ if (NULL == session->backend) { + g_free(session->book_id); + session->book_id = NULL; qof_session_push_error (session, ERR_BACKEND_BAD_URL, NULL); LEAVE (" BAD: no backend: sess=%p book-id=%s", session, book_id ? book_id : "(null)"); @@ -1207,7 +1208,7 @@ qof_session_save (QofSession *session, { for (num = 0; backend_list[num].filename != NULL; num++) { qof_load_backend_library(backend_list[num].libdir, - backend_list[num].filename, backend_list[num].init_fcn); + backend_list[num].filename); } } p = g_slist_copy(provider_list); @@ -1418,4 +1419,45 @@ qof_session_process_events (QofSession *session) return session->backend->process_events (session->backend); } +/* XXX This exports the list of accounts to a file. It does not + * export any transactions. It's a place-holder until full + * book-closing is implemented. + */ +gboolean +qof_session_export (QofSession *tmp_session, + QofSession *real_session, + QofPercentageFunc percentage_func) +{ + QofBook *book, *book2; + QofBackend *be; + + if ((!tmp_session) || (!real_session)) return FALSE; + + book = qof_session_get_book (real_session); + ENTER ("tmp_session=%p real_session=%p book=%p book_id=%s", + tmp_session, real_session, book, + qof_session_get_url(tmp_session) + ? qof_session_get_url(tmp_session) : "(null)"); + + /* There must be a backend or else. (It should always be the file + * backend too.) + */ + book2 = qof_session_get_book(tmp_session); + be = qof_book_get_backend(book2); + if (!be) + return FALSE; + + be->percentage = percentage_func; + if (be->export) { + int err; + + (be->export)(be, book); + err = qof_backend_get_error(be); + + if (ERR_BACKEND_NO_ERR != err) { return FALSE; } + } + + return TRUE; +} + /* =================== END OF FILE ====================================== */ diff --git a/lib/libqof/qof/qofsession.h b/lib/libqof/qof/qofsession.h index 12904900a6..9afe62e020 100644 --- a/lib/libqof/qof/qofsession.h +++ b/lib/libqof/qof/qofsession.h @@ -431,5 +431,9 @@ void qof_session_add_close_hook (GFunc fn, gpointer data); * @param session A pointer to the session being closed. */ void qof_session_call_close_hooks (QofSession *session); +gboolean qof_session_export (QofSession *tmp_session, + QofSession *real_session, + QofPercentageFunc percentage_func); + #endif /* QOF_SESSION_H */ /** @} */ diff --git a/lib/libqof/qof/qofutil.c b/lib/libqof/qof/qofutil.c index 9cb320669f..10d2285f98 100644 --- a/lib/libqof/qof/qofutil.c +++ b/lib/libqof/qof/qofutil.c @@ -32,6 +32,7 @@ #include #include #include "qof.h" +#include "qofbackend-p.h" static QofLogModule log_module = QOF_MOD_UTIL; diff --git a/lib/libqof/qof/qofutil.h b/lib/libqof/qof/qofutil.h index f9e612e51a..67ded53070 100644 --- a/lib/libqof/qof/qofutil.h +++ b/lib/libqof/qof/qofutil.h @@ -36,7 +36,8 @@ #include "qof.h" #include "qoflog.h" #include "qofutil.h" -#include "qofbackend-p.h" +#include "qofbackend.h" +#include "qofclass.h" #include "qofbook.h" #include "qofinstance.h" diff --git a/src/backend/file/gnc-backend-file.c b/src/backend/file/gnc-backend-file.c index 6403715ce6..adfb5734a4 100644 --- a/src/backend/file/gnc-backend-file.c +++ b/src/backend/file/gnc-backend-file.c @@ -66,6 +66,18 @@ 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 @@ -1024,8 +1036,8 @@ gnc_provider_free (QofBackendProvider *prov) g_free (prov); } -void -gnc_provider_init(void) +G_MODULE_EXPORT const gchar * +g_module_check_init(GModule *module) { QofBackendProvider *prov; #ifdef ENABLE_NLS @@ -1042,6 +1054,7 @@ gnc_provider_init(void) prov->provider_free = gnc_provider_free; prov->check_data_type = gnc_determine_file_type; qof_backend_register_provider (prov); + return NULL; } /* ========================== END OF FILE ===================== */ diff --git a/src/backend/file/gnc-backend-file.h b/src/backend/file/gnc-backend-file.h index 04d6689c59..4bc946ff02 100644 --- a/src/backend/file/gnc-backend-file.h +++ b/src/backend/file/gnc-backend-file.h @@ -32,7 +32,9 @@ #define GNC_BACKEND_FILE_H_ #include "qof.h" +#include +#include "qofbackend-p.h" struct FileBackend_struct { QofBackend be; @@ -51,20 +53,9 @@ struct FileBackend_struct typedef struct FileBackend_struct FileBackend; -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; - QofBackend * libgncmod_backend_file_LTX_gnc_backend_new(void); -void gnc_provider_init(void); +G_MODULE_EXPORT const gchar * +g_module_check_init(GModule *module); #endif /* GNC_BACKEND_FILE_H_ */ diff --git a/src/backend/file/test/test-load-backend.c b/src/backend/file/test/test-load-backend.c index 366d96eaf7..fe4e2bd047 100644 --- a/src/backend/file/test/test-load-backend.c +++ b/src/backend/file/test/test-load-backend.c @@ -29,17 +29,16 @@ #include "cashobjects.h" #include "test-stuff.h" -#define GNC_LIB_NAME "libgnc-backend-file.la" -#define GNC_LIB_INIT "gnc_provider_init" +#define GNC_LIB_NAME "gnc-backend-file" int main (int argc, char ** argv) { - qof_init(); - cashobjects_register(); - do_test( - qof_load_backend_library ("../", GNC_LIB_NAME, GNC_LIB_INIT), - " loading gnc-backend-file GModule failed"); + qof_init(); + cashobjects_register(); + do_test( + qof_load_backend_library ("../", GNC_LIB_NAME), + " loading gnc-backend-file GModule failed"); print_test_results(); - qof_close(); - return 0; + qof_close(); + return 0; } diff --git a/src/backend/file/test/test-load-xml2.c b/src/backend/file/test/test-load-xml2.c index aab8e1b961..50e2d710bc 100644 --- a/src/backend/file/test/test-load-xml2.c +++ b/src/backend/file/test/test-load-xml2.c @@ -47,8 +47,7 @@ #include "test-engine-stuff.h" #include "test-file-stuff.h" -#define GNC_LIB_NAME "libgnc-backend-file.la" -#define GNC_LIB_INIT "gnc_provider_init" +#define GNC_LIB_NAME "gnc-backend-file" static void remove_files_pattern(const char *begining, const char *ending) @@ -112,8 +111,7 @@ main (int argc, char ** argv) g_type_init(); qof_init(); cashobjects_register(); - do_test( - qof_load_backend_library ("../", GNC_LIB_NAME, GNC_LIB_INIT), + do_test(qof_load_backend_library ("../", GNC_LIB_NAME), " loading gnc-backend-file GModule failed"); if (!location) diff --git a/src/backend/postgres/Makefile.am b/src/backend/postgres/Makefile.am index f3ce79401c..e656330c8d 100644 --- a/src/backend/postgres/Makefile.am +++ b/src/backend/postgres/Makefile.am @@ -2,8 +2,17 @@ SUBDIRS = . test lib_LTLIBRARIES = libgnc-backend-postgres.la -libgnc_backend_postgres_la_LDFLAGS = -module +AM_CFLAGS = \ + -I.. -I../.. \ + -I../../engine \ + -I${srcdir}/../.. \ + -I${top_srcdir}/src/backend \ + -I${top_srcdir}/src/engine \ + ${PGSQL_CFLAGS} \ + ${QOF_CFLAGS} \ + ${GLIB_CFLAGS} +libgnc_backend_postgres_la_LDFLAGS = -module libgnc_backend_postgres_la_LIBADD = ${PGSQL_LIBS} -lpq \ ${top_builddir}/src/engine/libgncmod-engine.la \ ${QOF_LIBS} \ @@ -91,14 +100,6 @@ M4_SRC = \ SUFFIXES = .sql -AM_CFLAGS = \ - -I.. -I${srcdir}/.. \ - -I../.. -I${srcdir}/../.. \ - -I../../engine -I${srcdir}/../../engine \ - ${PGSQL_CFLAGS} \ - ${QOF_CFLAGS} \ - ${GLIB_CFLAGS} - $(M4_SRC): table.m4 %-autogen.c: %-objects.m4 table.m4 diff --git a/src/backend/postgres/PostgresBackend.c b/src/backend/postgres/PostgresBackend.c index ef884597fa..b2d456c633 100644 --- a/src/backend/postgres/PostgresBackend.c +++ b/src/backend/postgres/PostgresBackend.c @@ -253,7 +253,7 @@ pgend_set_book (PGBackend *be, QofBook *book) /* This routine finds the commodity by parsing a string * of the form NAMESPACE::MNEMONIC */ - +/* FIXME: replace w/ gnc_commodity_table_lookup_unique */ gnc_commodity * gnc_string_to_commodity (const char *str, QofBook *book) { @@ -264,7 +264,7 @@ gnc_string_to_commodity (const char *str, QofBook *book) comtab = gnc_book_get_commodity_table (book); space = g_strdup(str); - name = strchr (space, ':'); + name = strchr (space, ':'); /* BUG */ if (!name) { @@ -2542,7 +2542,8 @@ pg_provider_free (QofBackendProvider *prov) g_free (prov); } -void pgend_provider_init(void) +G_MODULE_EXPORT const gchar * +g_module_check_init(GModule *module) { QofBackendProvider *prov; @@ -2554,6 +2555,7 @@ void pgend_provider_init(void) prov->provider_free = pg_provider_free; prov->check_data_type = NULL; qof_backend_register_provider (prov); + return NULL; } /* ======================== END OF FILE ======================== */ diff --git a/src/backend/postgres/PostgresBackend.h b/src/backend/postgres/PostgresBackend.h index 513c92685b..0eb409c4c7 100644 --- a/src/backend/postgres/PostgresBackend.h +++ b/src/backend/postgres/PostgresBackend.h @@ -34,6 +34,7 @@ #ifndef POSTGRES_BACKEND_H #define POSTGRES_BACKEND_H +#include #include #include "Group.h" @@ -57,6 +58,7 @@ typedef enum { #define MAX_VERSION_AGE 10 +#include "qofbackend-p.h" struct _pgend { QofBackend be; @@ -132,6 +134,7 @@ QofBook * pgendGetBook(PGBackend *pbe); void pgendDisable (PGBackend *be); void pgendEnable (PGBackend *be); -void pgend_provider_init(void); +G_MODULE_EXPORT const gchar * +g_module_check_init(GModule *module); #endif /* POSTGRES_BACKEND_H */ diff --git a/src/backend/postgres/test/test-db.c b/src/backend/postgres/test/test-db.c index 9e8b2daaf4..07f61a24b4 100644 --- a/src/backend/postgres/test/test-db.c +++ b/src/backend/postgres/test/test-db.c @@ -32,8 +32,7 @@ #include "test-stuff.h" #include "test-engine-stuff.h" -#define PG_LIB_NAME "libgnc-backend-postgres.la" -#define PG_LIB_INIT "pgend_provider_init" +#define PG_LIB_NAME "gnc-backend-postgres" static QofLogModule log_module = GNC_MOD_TEST; @@ -1095,9 +1094,8 @@ main (int argc, char **argv) DbInfo *dbinfo; qof_init(); - do_test( - qof_load_backend_library (QOF_LIB_DIR, PG_LIB_NAME, PG_LIB_INIT), - " loading gnc-backend-postgres GModule failed"); + do_test(qof_load_backend_library (QOF_LIB_DIR, PG_LIB_NAME), + " loading gnc-backend-postgres GModule failed"); dbinfo = g_new0(DbInfo, 1); diff --git a/src/backend/postgres/test/test-load-backend.c b/src/backend/postgres/test/test-load-backend.c index 3562e36bf7..3c6053b839 100644 --- a/src/backend/postgres/test/test-load-backend.c +++ b/src/backend/postgres/test/test-load-backend.c @@ -29,8 +29,7 @@ #include "cashobjects.h" #include "test-stuff.h" -#define PG_LIB_NAME "libgnc-backend-postgres.la" -#define PG_LIB_INIT "pgend_provider_init" +#define PG_LIB_NAME "gnc-backend-postgres" int main (int argc, char ** argv) { @@ -38,8 +37,7 @@ int main (int argc, char ** argv) cashobjects_register(); /* the test needs to run locally in case make install * has not yet been run. Use GNC_LIBDIR usually. */ - do_test( - qof_load_backend_library ("../", PG_LIB_NAME, PG_LIB_INIT), + do_test(qof_load_backend_library ("../", PG_LIB_NAME), " loading gnc-backend-postgres GModule failed"); print_test_results(); qof_close(); diff --git a/src/backend/postgres/test/test-period.c b/src/backend/postgres/test/test-period.c index 873415ac75..4d7d087952 100644 --- a/src/backend/postgres/test/test-period.c +++ b/src/backend/postgres/test/test-period.c @@ -35,7 +35,6 @@ #include "Transaction.h" #define PG_LIB_NAME "libgnc-backend-postgres.la" -#define PG_LIB_INIT "pgend_provider_init" static void run_test (void) @@ -52,9 +51,8 @@ run_test (void) Timespec tsfirst, tslast, tsmiddle; char * test_url; - do_test( qof_load_backend_library (QOF_LIB_DIR, - PG_LIB_NAME, PG_LIB_INIT), - " loading gnc-backend-postgres GModule failed"); + do_test(qof_load_backend_library (QOF_LIB_DIR, PG_LIB_NAME), + " loading gnc-backend-postgres GModule failed"); session = get_random_session (); diff --git a/src/engine/Account.c b/src/engine/Account.c index c95084a684..17a56bb966 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -348,7 +348,7 @@ void xaccAccountCommitEdit (Account *acc) { g_return_if_fail(acc); - if(!qof_commit_edit(&acc->inst)) { return;} + if (!qof_commit_edit(&acc->inst)) return; /* If marked for deletion, get rid of subaccounts first, * and then the splits ... */ @@ -385,7 +385,7 @@ xaccAccountCommitEdit (Account *acc) qof_collection_foreach(col, destroy_pending_splits_for_account, acc); /* the lots should be empty by now */ - for (lp=acc->lots; lp; lp=lp->next) + for (lp = acc->lots; lp; lp = lp->next) { GNCLot *lot = lp->data; gnc_lot_destroy (lot); diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am index 5351ff4c6f..6a3e753e91 100644 --- a/src/engine/Makefile.am +++ b/src/engine/Makefile.am @@ -209,7 +209,7 @@ BUILT_SOURCES = \ CLEANFILES = gnucash g-wrapped .scm-links gncla-dir.h DISTCLEANFILES = ${SCM_FILE_LINKS} gw-engine.html gw-kvp.html -gncla-dir.h: gncla-dir.h.in +gncla-dir.h: gncla-dir.h.in ${top_builddir}/config.status rm -f $@.tmp sed < $< > $@.tmp \ -e 's:@-libdir-@:${libdir}:g' diff --git a/src/engine/Period.c b/src/engine/Period.c index 5f81bfe0d9..e05ee7d3f0 100644 --- a/src/engine/Period.c +++ b/src/engine/Period.c @@ -801,23 +801,27 @@ add_closing_balances (AccountGroup *closed_grp, static void period_begin_edit (QofBook *src_book, QofBook *dest_book) { + /* QofBackend *be; be = qof_book_get_backend(src_book); if (be && be->begin) { // (*be->begin)(be, GNC_ID_PERIOD, dest_book); } + */ } static void period_commit_edit (QofBook *src_book, QofBook *dest_book) { + /* QofBackend *be; be = qof_book_get_backend(src_book); if (be && be->commit) { // (*be->commit)(be, GNC_ID_PERIOD, dest_book); } + */ } /* ================================================================ */ diff --git a/src/engine/Transaction.c b/src/engine/Transaction.c index a3b2388d14..781f802264 100644 --- a/src/engine/Transaction.c +++ b/src/engine/Transaction.c @@ -48,6 +48,7 @@ #include "gnc-lot.h" #include "gnc-event.h" +#include "qofbackend-p.h" /* Notes about xaccTransBeginEdit(), xaccTransCommitEdit(), and * xaccTransRollback(): diff --git a/src/engine/gnc-commodity.h b/src/engine/gnc-commodity.h index fe889b7d91..907d33edd2 100644 --- a/src/engine/gnc-commodity.h +++ b/src/engine/gnc-commodity.h @@ -34,7 +34,7 @@ handling and identification system (GUID's, Entities, etc.) that the other parts of GnuCash use. The API really should be ported over. This would allow us to get rid of the - commodity table reoutines defined below. + commodity table routines defined below. @{ */ /** @file gnc-commodity.h diff --git a/src/engine/gnc-engine.c b/src/engine/gnc-engine.c index fbd6a92858..cd50317de7 100644 --- a/src/engine/gnc-engine.c +++ b/src/engine/gnc-engine.c @@ -1,5 +1,5 @@ /******************************************************************** - * gnc-engine.c -- top-level initialization for Gnucash Engine * + * gnc-engine.c -- top-level initialization for GnuCash Engine * * Copyright 2000 Bill Gribble * * * * This program is free software; you can redistribute it and/or * @@ -39,15 +39,14 @@ #include "gnc-pricedb-p.h" /** gnc file backend library name */ -#define GNC_LIB_NAME "libgnc-backend-file" -/** init_fcn for gnc file backend library. */ -#define GNC_LIB_INIT "gnc_provider_init" +#define GNC_LIB_NAME "gnc-backend-file" + /* gnc-backend-file location */ #include "gncla-dir.h" static GList * engine_init_hooks = NULL; static int engine_is_initialized = 0; -static QofLogModule log_module = GNC_MOD_ENGINE; +//static QofLogModule log_module = GNC_MOD_ENGINE; /* GnuCash version functions */ unsigned int @@ -76,15 +75,18 @@ gnucash_micro_version (void) void gnc_engine_init(int argc, char ** argv) { + static gchar *names[] = { + GNC_LIB_NAME, QSF_BACKEND_LIB, "gnc-backend-postgres", + NULL}; + gchar **np; gnc_engine_init_hook_t hook; - GList * cur; + GList * cur; if (1 == engine_is_initialized) return; /* initialize logging to our file. */ qof_log_init_filename("/tmp/gnucash.trace"); - /* Only set the core log_modules here - the rest can be set locally. */ + /* Only set the core log_modules here the rest can be set locally. */ qof_log_set_level(GNC_MOD_ENGINE, QOF_LOG_WARNING); qof_log_set_level(GNC_MOD_IO, QOF_LOG_WARNING); qof_log_set_level(GNC_MOD_GUI, QOF_LOG_WARNING); @@ -96,12 +98,11 @@ gnc_engine_init(int argc, char ** argv) /* Now register our core types */ cashobjects_register(); - g_return_if_fail((qof_load_backend_library - (QOF_LIB_DIR, QSF_BACKEND_LIB, QSF_MODULE_INIT))); - g_return_if_fail((qof_load_backend_library - (GNC_LIBDIR, GNC_LIB_NAME, GNC_LIB_INIT))); + for (np = names; *np; np++) { + if (qof_load_backend_library(GNC_LIBDIR, *np)) + engine_is_initialized = 1; + } - engine_is_initialized = 1; /* call any engine hooks */ for (cur = engine_init_hooks; cur; cur = cur->next) { @@ -138,10 +139,7 @@ gnc_engine_add_init_hook(gnc_engine_init_hook_t h) { gboolean gnc_engine_is_initialized (void) { -/* if (engine_is_initialized == 1) return TRUE; - return FALSE; -*/ - return (engine_is_initialized == 1) ? TRUE : FALSE; + return (engine_is_initialized == 1) ? TRUE : FALSE; } /* replicate old gnc-trace enum behaviour @@ -176,46 +174,3 @@ void gnc_log_default(void) qof_log_set_level(GNC_MOD_BUDGET, QOF_LOG_WARNING); } -/* ====================================================================== */ -/* XXX This exports the list of accounts to a file. It does not export - * any transactions. Its a place-holder until full book-closing is implemented. - */ - -gboolean -qof_session_export (QofSession *tmp_session, - QofSession *real_session, - QofPercentageFunc percentage_func) -{ - QofBook *book, *book2; - QofBackend *be; - int err; - - if ((!tmp_session) || (!real_session)) return FALSE; - - book = qof_session_get_book (real_session); - ENTER ("tmp_session=%p real_session=%p book=%p book_id=%s", - tmp_session, real_session, book, - qof_session_get_url(tmp_session) - ? qof_session_get_url(tmp_session) : "(null)"); - - /* There must be a backend or else. (It should always be the file - * backend too.) - */ - book2 = qof_session_get_book(tmp_session); - be = qof_book_get_backend(book2); - if (!be) - return FALSE; - - be->percentage = percentage_func; - if (be->export) - { - - (be->export)(be, book); - err = qof_backend_get_error(be); - - if (ERR_BACKEND_NO_ERR != err) { return FALSE; } - } - - return TRUE; -} - diff --git a/src/engine/gnc-engine.h b/src/engine/gnc-engine.h index 173e20ee13..3d8b2371cd 100644 --- a/src/engine/gnc-engine.h +++ b/src/engine/gnc-engine.h @@ -103,7 +103,7 @@ #define GNC_ID_SXTG "SXTGroup" #define GNC_ID_SXTT "SXTTrans" #define GNC_ID_TRANS "Trans" - + /* TYPES **********************************************************/ /* CAS: ISTM, it would make more sense to put the typedefs in their @@ -250,11 +250,5 @@ void gnc_log_default(void); * it will be called during the evaluation of gnc_engine_init */ void gnc_engine_add_init_hook(gnc_engine_init_hook_t hook); -gboolean -qof_session_export (QofSession *tmp_session, - QofSession *real_session, - QofPercentageFunc percentage_func); - - #endif /** @} */ diff --git a/src/engine/gnc-pricedb.c b/src/engine/gnc-pricedb.c index 9620e051f5..9bf9fd20c1 100644 --- a/src/engine/gnc-pricedb.c +++ b/src/engine/gnc-pricedb.c @@ -27,6 +27,7 @@ #include #include #include "gnc-pricedb-p.h" +#include "qofbackend-p.h" /* This static indicates the debugging module that this .o belongs to. */ static QofLogModule log_module = GNC_MOD_PRICE; diff --git a/src/engine/gnc-session-scm.c b/src/engine/gnc-session-scm.c index f37bbc3529..827cc621cf 100644 --- a/src/engine/gnc-session-scm.c +++ b/src/engine/gnc-session-scm.c @@ -69,13 +69,6 @@ gnc_session_scm_save (QofSession *session) qof_session_save (session, gnc_session_scm_gui_cb_helper); } -gboolean -gnc_session_scm_export (QofSession *tmp_session, QofSession *real_session) -{ - return qof_session_export(tmp_session, real_session, - gnc_session_scm_gui_cb_helper); -} - /* * Set the callback that will be used for any calls to the session * load/save functions from the scheme side of the code. diff --git a/src/engine/gnc-session-scm.h b/src/engine/gnc-session-scm.h index 8a3b8a42da..ef412b1645 100644 --- a/src/engine/gnc-session-scm.h +++ b/src/engine/gnc-session-scm.h @@ -43,8 +43,6 @@ #include "gnc-engine.h" void gnc_session_scm_load (QofSession *session); -gboolean gnc_session_scm_export (QofSession *tmp_session, - QofSession *real_session); void gnc_session_scm_save (QofSession *session); void gnc_session_scm_set_callback (SCM percentage_cb); diff --git a/src/engine/gw-engine-spec.scm b/src/engine/gw-engine-spec.scm index d1f4c20fff..6cd6f8452e 100644 --- a/src/engine/gw-engine-spec.scm +++ b/src/engine/gw-engine-spec.scm @@ -1441,14 +1441,6 @@ prior to time t.") '(( session)) "Save the data in the session.") -(gw:wrap-function - ws - 'gnc:session-export - ' - "gnc_session_scm_export" - '(( tmp_session) ( real_session)) - "Export the accounts in the session.") - (gw:wrap-function ws 'gnc:session-set-callback diff --git a/src/gnome-utils/gnc-file.c b/src/gnome-utils/gnc-file.c index cb4448e9d1..28ffd5c681 100644 --- a/src/gnome-utils/gnc-file.c +++ b/src/gnome-utils/gnc-file.c @@ -960,7 +960,7 @@ gnc_file_save (void) /* If we don't have a filename/path to save to get one. */ session = gnc_get_current_session (); - if (!qof_session_get_file_path (session)) + if (!qof_session_get_url(session)) { gnc_file_save_as (); return; @@ -977,10 +977,10 @@ gnc_file_save (void) /* Make sure everything's OK - disk could be full, file could have become read-only etc. */ - newfile = qof_session_get_file_path (session); io_err = qof_session_get_error (session); if (ERR_BACKEND_NO_ERR != io_err) { + newfile = qof_session_get_url(session); show_session_error (io_err, newfile, GNC_FILE_DIALOG_SAVE); if (been_here_before) return; @@ -1035,7 +1035,7 @@ gnc_file_save_as (void) } session = gnc_get_current_session (); - oldfile = qof_session_get_file_path (session); + oldfile = qof_session_get_url(session); if (oldfile && (strcmp(oldfile, newfile) == 0)) { g_free (newfile); @@ -1045,7 +1045,7 @@ gnc_file_save_as (void) /* -- this session code is NOT identical in FileOpen and FileSaveAs -- */ - xaccLogSetBaseName(newfile); + xaccLogSetBaseName(newfile); //FIXME: This is premature. save_in_progress++; new_session = qof_session_new (); qof_session_begin (new_session, newfile, FALSE, FALSE); @@ -1124,7 +1124,6 @@ gnc_file_save_as (void) save_in_progress--; g_free (newfile); - gnc_hook_run(HOOK_BOOK_SAVED, new_session); LEAVE (" "); } @@ -1136,7 +1135,7 @@ gnc_file_quit (void) gnc_set_busy_cursor (NULL, TRUE); session = gnc_get_current_session (); - /* disable events; otherwise the mass deletetion of accounts and + /* disable events; otherwise the mass deletion of accounts and * transactions during shutdown would cause massive redraws */ qof_event_suspend (); diff --git a/src/gnome-utils/gnc-html-graph-gog.c b/src/gnome-utils/gnc-html-graph-gog.c index b0b5601c2d..c5c4a03485 100644 --- a/src/gnome-utils/gnc-html-graph-gog.c +++ b/src/gnome-utils/gnc-html-graph-gog.c @@ -306,7 +306,7 @@ gtkhtml_pre_3_10_1_bug_workaround(GtkHTMLEmbedded *eb) * legend_urls_[123]: ? */ static gboolean -handle_piechart(gnc_html * html, GtkHTMLEmbedded * eb, gpointer d) +handle_piechart(gnc_html * html, GtkHTMLEmbedded * eb, gpointer unused) { GogObject *graph, *chart; GogPlot *plot; @@ -375,7 +375,7 @@ handle_piechart(gnc_html * html, GtkHTMLEmbedded * eb, gpointer d) * stacked:boolean **/ static gboolean -handle_barchart(gnc_html * html, GtkHTMLEmbedded * eb, gpointer d) +handle_barchart(gnc_html * html, GtkHTMLEmbedded * eb, gpointer unused) { GogObject *graph, *chart; GogPlot *plot; @@ -499,7 +499,7 @@ handle_barchart(gnc_html * html, GtkHTMLEmbedded * eb, gpointer d) } static gboolean -handle_scatter(gnc_html * html, GtkHTMLEmbedded * eb, gpointer d) +handle_scatter(gnc_html * html, GtkHTMLEmbedded * eb, gpointer unused) { GogObject *graph, *chart; GogPlot *plot; @@ -550,7 +550,7 @@ handle_scatter(gnc_html * html, GtkHTMLEmbedded * eb, gpointer d) } static void -draw_print_cb (GtkHTMLEmbedded *eb, GnomePrintContext *context, gpointer d) +draw_print_cb(GtkHTMLEmbedded *eb, GnomePrintContext *context, gpointer unused) { GogGraph *graph = GOG_GRAPH (g_object_get_data (G_OBJECT (eb), "graph")); diff --git a/src/gnome-utils/gnc-main-window.c b/src/gnome-utils/gnc-main-window.c index eaf961ab31..6d4e2eed21 100644 --- a/src/gnome-utils/gnc-main-window.c +++ b/src/gnome-utils/gnc-main-window.c @@ -906,7 +906,7 @@ gnc_main_window_prompt_for_save (GtkWidget *window) session = gnc_get_current_session(); book = qof_session_get_book(session); - filename = qof_session_get_file_path(session); + filename = qof_session_get_url(session); if (filename == NULL) filename = _(""); if ((tmp = strrchr(filename, '/')) != NULL)