[Gnucash-changes] r14248 -
gnucash/branches/register-rewrite/lib/libqof/qof - Factor out
one chuck of code into a static function.
Chris Shoemaker
chris at cvs.gnucash.org
Mon May 29 16:59:33 EDT 2006
Author: chris
Date: 2006-05-29 16:59:33 -0400 (Mon, 29 May 2006)
New Revision: 14248
Trac: http://svn.gnucash.org/trac/changeset/14248
Modified:
gnucash/branches/register-rewrite/lib/libqof/qof/qofsession.c
gnucash/branches/register-rewrite/lib/libqof/qof/qofsession.h
Log:
Factor out one chuck of code into a static function.
Modified: gnucash/branches/register-rewrite/lib/libqof/qof/qofsession.c
===================================================================
--- gnucash/branches/register-rewrite/lib/libqof/qof/qofsession.c 2006-05-29 20:55:36 UTC (rev 14247)
+++ gnucash/branches/register-rewrite/lib/libqof/qof/qofsession.c 2006-05-29 20:59:33 UTC (rev 14248)
@@ -213,6 +213,7 @@
QofSession *
qof_session_get_current_session (void)
{
+ PWARN("Use of deprecated qof_session_get_current_session()");
if (!current_session)
{
qof_event_suspend ();
@@ -228,6 +229,7 @@
void
qof_session_set_current_session (QofSession *session)
{
+ PWARN("Use of deprecated qof_session_set_current_session()");
current_session = session;
}
@@ -859,6 +861,21 @@
};
static void
+load_stock_backend_libraries(void)
+{
+ gint num;
+
+ for (num = 0; backend_list[num].filename != NULL; num++) {
+ if (!qof_load_backend_library(backend_list[num].libdir,
+ backend_list[num].filename)) {
+ PERR (" failed to load %s from %s",
+ backend_list[num].filename, backend_list[num].libdir);
+ }
+ }
+}
+
+
+static void
qof_session_load_backend(QofSession * session, char * access_method)
{
GSList *p;
@@ -866,25 +883,18 @@
QofBackendProvider *prov;
QofBook *book;
char *msg;
- gint num;
gboolean prov_type;
gboolean (*type_check) (const char*);
ENTER (" list=%d, initted=%s", g_slist_length(provider_list),
qof_providers_initialized ? "true" : "false");
prov_type = FALSE;
- if (!qof_providers_initialized)
- {
- for (num = 0; backend_list[num].filename != NULL; num++) {
- if(!qof_load_backend_library(backend_list[num].libdir,
- backend_list[num].filename))
- {
- PWARN (" failed to load %s from %s",
- backend_list[num].filename, backend_list[num].libdir);
- }
- }
- qof_providers_initialized = TRUE;
- }
+
+ if (!qof_providers_initialized) {
+ load_stock_backend_libraries();
+ qof_providers_initialized = TRUE;
+ }
+
p = provider_list;
while(p != NULL)
{
@@ -910,7 +920,7 @@
continue;
}
/* Use the providers creation callback */
- session->backend = (*(prov->backend_new))();
+ session->backend = (*(prov->backend_new))();
session->backend->provider = prov;
/* Tell the books about the backend that they'll be using. */
for (node=session->books; node; node=node->next)
Modified: gnucash/branches/register-rewrite/lib/libqof/qof/qofsession.h
===================================================================
--- gnucash/branches/register-rewrite/lib/libqof/qof/qofsession.h 2006-05-29 20:55:36 UTC (rev 14247)
+++ gnucash/branches/register-rewrite/lib/libqof/qof/qofsession.h 2006-05-29 20:59:33 UTC (rev 14248)
@@ -123,7 +123,7 @@
* It takes as an argument the book id. The book id must be a string
* in the form of a URI/URL. The access method specified depends
* on the loaded backends. In the absence of a customised backend,
- * only QSF XML would be accepted). Paths may be relative or absolute.
+ * only QSF XML would be accepted. Paths may be relative or absolute.
* If the path is relative; that is, if the argument is "file:somefile.xml"
* then the current working directory is assumed. Customised backends can
* choose to search other, application-specific, directories as well.
More information about the gnucash-changes
mailing list