r21526 - gnucash/trunk/src/libqof/qof - Remove qof_session_add_book() - a QofSession is used only with one book throughout gnucash.

Christian Stimming cstim at code.gnucash.org
Sun Nov 6 15:53:59 EST 2011


Author: cstim
Date: 2011-11-06 15:53:59 -0500 (Sun, 06 Nov 2011)
New Revision: 21526
Trac: http://svn.gnucash.org/trac/changeset/21526

Modified:
   gnucash/trunk/src/libqof/qof/qofsession.c
   gnucash/trunk/src/libqof/qof/qofsession.h
Log:
Remove qof_session_add_book() - a QofSession is used only with one book throughout gnucash.

Subsequently, the QofBook pointer in QofSession can be changed from
a GList to a QofBook*.

Modified: gnucash/trunk/src/libqof/qof/qofsession.c
===================================================================
--- gnucash/trunk/src/libqof/qof/qofsession.c	2011-11-05 23:05:00 UTC (rev 21525)
+++ gnucash/trunk/src/libqof/qof/qofsession.c	2011-11-06 20:53:59 UTC (rev 21526)
@@ -245,40 +245,6 @@
     return NULL;
 }
 
-void
-qof_session_add_book (QofSession *session, QofBook *addbook)
-{
-    GList *node;
-    if (!session) return;
-
-    ENTER (" sess=%p book=%p", session, addbook);
-
-    /* See if this book is already there ... */
-    for (node = session->books; node; node = node->next)
-    {
-        QofBook *book = node->data;
-        if (addbook == book) return;
-    }
-
-    if ('y' == addbook->book_open)
-    {
-        /* hack alert -- someone should free all the books in the list,
-         * but it should probably not be us ... since the books backends
-         * should be shutdown first, etc */
-        /* XXX this should probably be an error XXX */
-        g_list_free (session->books);
-        session->books = g_list_append (NULL, addbook);
-    }
-    else
-    {
-        /* XXX Need to tell the backend to add a book as well */
-        session->books = g_list_append (session->books, addbook);
-    }
-
-    qof_book_set_backend (addbook, session->backend);
-    LEAVE (" ");
-}
-
 QofBackend *
 qof_session_get_backend (const QofSession *session)
 {

Modified: gnucash/trunk/src/libqof/qof/qofsession.h
===================================================================
--- gnucash/trunk/src/libqof/qof/qofsession.h	2011-11-05 23:05:00 UTC (rev 21525)
+++ gnucash/trunk/src/libqof/qof/qofsession.h	2011-11-06 20:53:59 UTC (rev 21526)
@@ -190,15 +190,8 @@
 QofBackendError qof_session_pop_error (QofSession *session);
 /** @} */
 
-/** The qof_session_add_book() allows additional books to be added to
- *    a session.
- * XXX Under construction, clarify the following when done:
- * XXX There must already be an open book in the session already!?
- * XXX Only one open book at a time per session is allowed!?
- * XXX each book gets its own unique backend ???
- */
-void qof_session_add_book (QofSession *session, QofBook *book);
 
+/** Returns the QofBook of this session. */
 QofBook * qof_session_get_book (const QofSession *session);
 
 /**



More information about the gnucash-changes mailing list