Skip to content

Commit

Permalink
add qof-session-destroy and qof-session-save-quiet
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherlam committed Oct 7, 2023
1 parent 5bf52ca commit 0aa8114
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bindings/engine.i
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "SX-book.h"
#include "gnc-kvp-guile.h"
#include "glib-guile.h"
#include "qofsession.h"

#include "gncAddress.h"
#include "gncBillTerm.h"
Expand Down Expand Up @@ -200,6 +201,8 @@ QofSession * qof_session_new (QofBook* book);
QofBook * qof_session_get_book (QofSession *session);
// TODO: Unroll/remove
const char *qof_session_get_url (QofSession *session);
void qof_session_destroy (QofSession *session);
void qof_session_save_quiet (QofSession *session);

%ignore qof_print_date_time_buff;
%ignore gnc_tm_free;
Expand Down
11 changes: 11 additions & 0 deletions libgnucash/engine/qofsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,17 @@ qof_session_save_in_progress(const QofSession *session)
return session->is_saving ();
}

static void nop (const char *message, double percent)
{
}

void
qof_session_save_quiet (QofSession *session)
{
if (!session) return;
session->save (nop);
}

void
qof_session_end (QofSession *session)
{
Expand Down
8 changes: 8 additions & 0 deletions libgnucash/engine/qofsession.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,14 @@ void qof_session_save (QofSession *session,
void qof_session_safe_save (QofSession *session,
QofPercentageFunc percentage_func);

/** The qof_session_save_quiet () method will commit all changes that have been
* made to the session. For the file backend, this is nothing
* more than a write to the file of the current Accounts & etc.
* For the SQL backend, this is typically a no-op (since all data
* has already been written out to the database.
*/
void qof_session_save_quiet (QofSession *session);

/**
* The qof_session_end() method will release the session lock. For the
* file backend, it will *not* save the data to a file. Thus,
Expand Down

0 comments on commit 0aa8114

Please sign in to comment.