mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
move log file handling to gnc-book, where it belongs
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3514 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
eead62a8ce
commit
3a9c1996c7
@ -29,7 +29,6 @@
|
|||||||
#include "FileDialog.h"
|
#include "FileDialog.h"
|
||||||
#include "FileIO.h"
|
#include "FileIO.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "TransLog.h"
|
|
||||||
#include "file-history.h"
|
#include "file-history.h"
|
||||||
#include "gnc-component-manager.h"
|
#include "gnc-component-manager.h"
|
||||||
#include "gnc-engine-util.h"
|
#include "gnc-engine-util.h"
|
||||||
@ -162,10 +161,8 @@ gncFileNew (void)
|
|||||||
* disable logging and events so we don't get all that junk. */
|
* disable logging and events so we don't get all that junk. */
|
||||||
gnc_engine_suspend_events ();
|
gnc_engine_suspend_events ();
|
||||||
|
|
||||||
xaccLogDisable();
|
|
||||||
gnc_book_destroy (book);
|
gnc_book_destroy (book);
|
||||||
current_book = NULL;
|
current_book = NULL;
|
||||||
xaccLogEnable();
|
|
||||||
|
|
||||||
/* start a new book */
|
/* start a new book */
|
||||||
gncGetCurrentBook ();
|
gncGetCurrentBook ();
|
||||||
@ -276,7 +273,6 @@ gncPostFileOpen (const char * filename)
|
|||||||
gnc_engine_suspend_events ();
|
gnc_engine_suspend_events ();
|
||||||
|
|
||||||
gnc_set_busy_cursor (NULL);
|
gnc_set_busy_cursor (NULL);
|
||||||
xaccLogDisable ();
|
|
||||||
new_group = NULL;
|
new_group = NULL;
|
||||||
|
|
||||||
/* hack alert -- there has got to be a simpler way of dealing with
|
/* hack alert -- there has got to be a simpler way of dealing with
|
||||||
@ -329,7 +325,6 @@ gncPostFileOpen (const char * filename)
|
|||||||
uh_oh = TRUE;
|
uh_oh = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xaccLogEnable ();
|
|
||||||
gnc_unset_busy_cursor (NULL);
|
gnc_unset_busy_cursor (NULL);
|
||||||
|
|
||||||
/* going down -- abandon ship */
|
/* going down -- abandon ship */
|
||||||
@ -355,13 +350,9 @@ gncPostFileOpen (const char * filename)
|
|||||||
|
|
||||||
/* if we got to here, then we've successfully gotten a new session */
|
/* if we got to here, then we've successfully gotten a new session */
|
||||||
/* close up the old file session (if any) */
|
/* close up the old file session (if any) */
|
||||||
xaccLogDisable();
|
|
||||||
xaccLogSetBaseName (newfile);
|
|
||||||
|
|
||||||
gnc_book_destroy (current_book);
|
gnc_book_destroy (current_book);
|
||||||
current_book = new_book;
|
current_book = new_book;
|
||||||
|
|
||||||
xaccLogEnable();
|
|
||||||
gnc_engine_resume_events ();
|
gnc_engine_resume_events ();
|
||||||
gnc_gui_refresh_all ();
|
gnc_gui_refresh_all ();
|
||||||
|
|
||||||
@ -428,6 +419,7 @@ gncFileSave (void)
|
|||||||
GNCBook *book;
|
GNCBook *book;
|
||||||
int uh_oh = 0;
|
int uh_oh = 0;
|
||||||
int norr;
|
int norr;
|
||||||
|
ENTER (" ");
|
||||||
|
|
||||||
/* hack alert -- Somehow make sure all in-progress edits get committed! */
|
/* hack alert -- Somehow make sure all in-progress edits get committed! */
|
||||||
|
|
||||||
@ -484,6 +476,7 @@ gncFileSave (void)
|
|||||||
if (uh_oh) return;
|
if (uh_oh) return;
|
||||||
|
|
||||||
xaccGroupMarkSaved (gnc_book_get_group (book));
|
xaccGroupMarkSaved (gnc_book_get_group (book));
|
||||||
|
LEAVE (" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ======================================================== */
|
/* ======================================================== */
|
||||||
@ -500,6 +493,7 @@ gncFileSaveAs (void)
|
|||||||
gboolean uh_oh = FALSE;
|
gboolean uh_oh = FALSE;
|
||||||
int norr = 0;
|
int norr = 0;
|
||||||
|
|
||||||
|
ENTER(" ");
|
||||||
filename = fileBox(_("Save"), "*.gnc", NULL);
|
filename = fileBox(_("Save"), "*.gnc", NULL);
|
||||||
if (!filename) return;
|
if (!filename) return;
|
||||||
|
|
||||||
@ -514,7 +508,6 @@ gncFileSaveAs (void)
|
|||||||
g_free (buf);
|
g_free (buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
book = gncGetCurrentBook ();
|
book = gncGetCurrentBook ();
|
||||||
oldfile = gnc_book_get_file_path (book);
|
oldfile = gnc_book_get_file_path (book);
|
||||||
if (oldfile && (strcmp(oldfile, newfile) == 0))
|
if (oldfile && (strcmp(oldfile, newfile) == 0))
|
||||||
@ -530,7 +523,6 @@ gncFileSaveAs (void)
|
|||||||
/* disable logging while we move over to the new set of accounts to
|
/* disable logging while we move over to the new set of accounts to
|
||||||
* edit; the mass deletetion of accounts and transactions during
|
* edit; the mass deletetion of accounts and transactions during
|
||||||
* switchover is not something we want to keep in a journal. */
|
* switchover is not something we want to keep in a journal. */
|
||||||
xaccLogDisable ();
|
|
||||||
new_book = gnc_book_new ();
|
new_book = gnc_book_new ();
|
||||||
gnc_book_begin (new_book, newfile, FALSE);
|
gnc_book_begin (new_book, newfile, FALSE);
|
||||||
|
|
||||||
@ -545,7 +537,6 @@ gncFileSaveAs (void)
|
|||||||
gnc_book_begin (new_book, newfile, TRUE);
|
gnc_book_begin (new_book, newfile, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xaccLogEnable ();
|
|
||||||
|
|
||||||
/* check for session errors (e.g. file locked by another user) */
|
/* check for session errors (e.g. file locked by another user) */
|
||||||
if (!norr) norr = gnc_book_get_error (new_book);
|
if (!norr) norr = gnc_book_get_error (new_book);
|
||||||
@ -556,22 +547,16 @@ gncFileSaveAs (void)
|
|||||||
/* going down -- abandon ship */
|
/* going down -- abandon ship */
|
||||||
if (uh_oh)
|
if (uh_oh)
|
||||||
{
|
{
|
||||||
xaccLogDisable ();
|
|
||||||
gnc_book_destroy (new_book);
|
gnc_book_destroy (new_book);
|
||||||
xaccLogEnable ();
|
|
||||||
|
|
||||||
g_free (newfile);
|
g_free (newfile);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we got to here, then we've successfully gotten a new session */
|
/* if we got to here, then we've successfully gotten a new session */
|
||||||
/* close up the old file session (if any) */
|
/* close up the old file session (if any) */
|
||||||
xaccLogDisable ();
|
|
||||||
gnc_book_set_group (book, NULL);
|
gnc_book_set_group (book, NULL);
|
||||||
gnc_book_destroy (book);
|
gnc_book_destroy (book);
|
||||||
current_book = new_book;
|
current_book = new_book;
|
||||||
xaccLogEnable ();
|
|
||||||
|
|
||||||
/* --------------- END CORE SESSION CODE -------------- */
|
/* --------------- END CORE SESSION CODE -------------- */
|
||||||
|
|
||||||
@ -600,11 +585,11 @@ gncFileSaveAs (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* OK, save the data to the file ... */
|
/* OK, save the data to the file ... */
|
||||||
xaccLogSetBaseName (newfile);
|
|
||||||
gnc_book_set_group (new_book, group);
|
gnc_book_set_group (new_book, group);
|
||||||
gncFileSave ();
|
gncFileSave ();
|
||||||
|
|
||||||
g_free (newfile);
|
g_free (newfile);
|
||||||
|
LEAVE (" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ======================================================== */
|
/* ======================================================== */
|
||||||
@ -621,8 +606,6 @@ gncFileQuit (void)
|
|||||||
* a journal. */
|
* a journal. */
|
||||||
gnc_engine_suspend_events ();
|
gnc_engine_suspend_events ();
|
||||||
|
|
||||||
xaccLogDisable();
|
|
||||||
|
|
||||||
gnc_book_destroy (book);
|
gnc_book_destroy (book);
|
||||||
current_book = NULL;
|
current_book = NULL;
|
||||||
|
|
||||||
@ -635,11 +618,13 @@ gncFileQuit (void)
|
|||||||
AccountGroup *
|
AccountGroup *
|
||||||
gncGetCurrentGroup (void)
|
gncGetCurrentGroup (void)
|
||||||
{
|
{
|
||||||
|
AccountGroup *grp;
|
||||||
GNCBook *book;
|
GNCBook *book;
|
||||||
|
|
||||||
book = gncGetCurrentBook ();
|
book = gncGetCurrentBook ();
|
||||||
|
|
||||||
return gnc_book_get_group (book);
|
grp = gnc_book_get_group (book);
|
||||||
|
return grp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ======================================================== */
|
/* ======================================================== */
|
||||||
|
Loading…
Reference in New Issue
Block a user