fixes for a file-open bug

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1811 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas 1999-07-06 06:38:37 +00:00
parent 4cf132419d
commit 4d33542816
3 changed files with 42 additions and 5 deletions

View File

@ -38,8 +38,8 @@
// static short module = MOD_GUI;
/** GLOBALS *********************************************************/
Session *current_session = NULL;
AccountGroup *topgroup = NULL; /* the current top of the heriarchy */
static Session *current_session = NULL;
static AccountGroup *topgroup = NULL; /* the current top of the heriarchy */
/********************************************************************\
* fileMenubarCB -- handles file menubar choices *
@ -500,4 +500,34 @@ gncFileQuit (void)
}
/* ======================================================== */
AccountGroup *
gncGetCurrentGroup (void)
{
AccountGroup *grp;
grp = xaccSessionGetGroup (current_session);
if (grp) return grp;
/* If we are here, then no session has yet been started ... */
grp = topgroup;
if (grp) return grp;
/* if we are here, then topgroup not yet initialized ... */
xaccLogEnable();
topgroup = xaccMallocAccountGroup();
return topgroup;
}
#if 0
/* ======================================================== */
/* whats this for ???? */
gnc_main_window_get_session(gncUIWidget w)
{
return(current_session);
}
#endif
/********************* END OF FILE **********************************/

View File

@ -86,6 +86,10 @@
* The user WILL NOT BE PROMPTED to confirm this action, or do do
* any kind of saving beforehand.
*
* The gncGetCurrentGroup() routine will return the account group associated
* with the current session. It will always return a non-null value
* (barring system catastrophe such as out of memory).
*
* HISTORY:
* Derived from Rob Clark's original MainWindow.c code, Dec 1998
*/
@ -126,6 +130,11 @@ void gncFileOpenFile (const char *);
void gncFileQuerySave (void);
void gncFileQuit (void);
extern Session *current_session;
AccountGroup *gncGetCurrentGroup (void);
/* ??? why is this needed ??? */
/*
Session *gnc_main_window_get_session(gncUIWidget w);
*/
#endif /* __GNC_FILE_DIALOG_H__ */

View File

@ -29,7 +29,6 @@
#include "config.h"
#include "ui-callbacks.h"
#include "gnc-common.h"
#include "Session.h"
/** GLOBALS *********************************************************/
typedef enum {
@ -46,6 +45,5 @@ typedef enum {
void mainWindow();
void gnc_show_help(const gncHelpTypes t);
Session *gnc_main_window_get_session(gncUIWidget w);
#endif