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; // static short module = MOD_GUI;
/** GLOBALS *********************************************************/ /** GLOBALS *********************************************************/
Session *current_session = NULL; static Session *current_session = NULL;
AccountGroup *topgroup = NULL; /* the current top of the heriarchy */ static AccountGroup *topgroup = NULL; /* the current top of the heriarchy */
/********************************************************************\ /********************************************************************\
* fileMenubarCB -- handles file menubar choices * * fileMenubarCB -- handles file menubar choices *
@ -499,5 +499,35 @@ gncFileQuit (void)
topgroup = NULL; topgroup = NULL;
} }
/* ======================================================== */
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 **********************************/ /********************* END OF FILE **********************************/

View File

@ -86,6 +86,10 @@
* The user WILL NOT BE PROMPTED to confirm this action, or do do * The user WILL NOT BE PROMPTED to confirm this action, or do do
* any kind of saving beforehand. * 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: * HISTORY:
* Derived from Rob Clark's original MainWindow.c code, Dec 1998 * Derived from Rob Clark's original MainWindow.c code, Dec 1998
*/ */
@ -126,6 +130,11 @@ void gncFileOpenFile (const char *);
void gncFileQuerySave (void); void gncFileQuerySave (void);
void gncFileQuit (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__ */ #endif /* __GNC_FILE_DIALOG_H__ */

View File

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