GnuCash c935c2f+
Loading...
Searching...
No Matches
gnc-session.c
1/*
2 * gnc-session.c -- GnuCash's session handling
3 *
4 * Copyright (C) 2006 Chris Shoemaker <c.shoemaker@cox.net>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, contact:
18 *
19 * Free Software Foundation Voice: +1-617-542-5942
20 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
21 * Boston, MA 02110-1301, USA gnu@gnu.org
22 */
23
24#include <config.h>
25#include "qof.h"
26#include "gnc-session.h"
27#include "gnc-engine.h"
28#include "TransLog.h"
29
30static QofSession * current_session = NULL;
31static QofLogModule log_module = GNC_MOD_ENGINE;
32
33QofSession *
34gnc_get_current_session (void)
35{
36 if (!current_session)
37 {
38 QofBook* book = qof_book_new ();
40 current_session = qof_session_new (book);
42 }
43
44 return current_session;
45}
46
47gboolean
48gnc_current_session_exist(void)
49{
50 return (current_session != NULL);
51}
52
53void
54gnc_set_current_session (QofSession *session)
55{
56 if (current_session)
57 PINFO("Leak of current session.");
58 current_session = session;
59}
60
61void gnc_clear_current_session()
62{
63 if (current_session)
64 {
66 qof_session_destroy(current_session);
68 current_session = NULL;
69 }
70}
API for the transaction logger.
All type declarations for the whole Gnucash engine.
QofBook * qof_book_new(void)
Allocate, initialise and return a new QofBook.
Definition qofbook.cpp:290
void qof_event_resume(void)
Resume engine event generation.
Definition qofevent.cpp:156
void qof_event_suspend(void)
Suspend all engine events.
Definition qofevent.cpp:145
#define PINFO(format, args...)
Print an informational note.
Definition qoflog.h:256
void xaccLogEnable(void)
document me
Definition TransLog.cpp:100
void xaccLogDisable(void)
document me
Definition TransLog.cpp:96
QofBook reference.
Definition qofbook-p.hpp:47