Move application file code into app-file module.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@5389 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-09-20 02:38:15 +00:00
parent 48e027b218
commit 06d2d6158e
48 changed files with 521 additions and 369 deletions

View File

@ -41,22 +41,21 @@ AC_DEFINE_UNQUOTED(GNUCASH_MAJOR_VERSION, $GNUCASH_MAJOR_VERSION)
AC_DEFINE_UNQUOTED(GNUCASH_MINOR_VERSION, $GNUCASH_MINOR_VERSION)
AC_DEFINE_UNQUOTED(GNUCASH_MICRO_VERSION, $GNUCASH_MICRO_VERSION)
AC_CANONICAL_HOST
AM_MAINTAINER_MODE
AM_ACLOCAL_INCLUDE(macros)
AC_PROG_CC
dnl Set of available languages.
ALL_LINGUAS="da de en_GB es fr it ja no pt_PT ru sv"
AM_GNU_GETTEXT
AM_PROG_XML_I18N_TOOLS
AC_CANONICAL_HOST
AM_MAINTAINER_MODE
AM_ACLOCAL_INCLUDE(macros)
AC_PROG_INSTALL
AC_PROG_CC
AM_PROG_LIBTOOL
AC_ARG_PROGRAM
AC_ISC_POSIX
AC_C_BIGENDIAN
AC_PROG_MAKE_SET
@ -709,6 +708,7 @@ AC_OUTPUT(
po/Makefile
rpm/Makefile
src/Makefile
src/app-file/Makefile
src/app-utils/Makefile
src/app-utils/test/Makefile
src/backend/Makefile

View File

@ -61,7 +61,6 @@ src/backend/postgres/price.c
src/backend/postgres/txn.c
src/backend/postgres/txnmass.c
src/backend/postgres/upgrade.c
src/FileDialog.c
src/app-utils/test/test-link-module.c
src/app-utils/test/test-exp-parser.c
src/app-utils/test/test-print-parse-amount.c
@ -83,8 +82,8 @@ src/gnome-utils/druid-utils.c
src/gnome-utils/gncmod-gnome-utils.c
src/gnome-utils/test/test-link-module.c
src/gnome-utils/gnc-amount-edit.c
src/gnome-utils/gnc-commodity-edit.c
src/gnome-utils/gnc-account-tree.c
src/gnome-utils/gnc-commodity-edit.c
src/gnome-utils/cursors.c
src/gnome-utils/gnc-html.c
src/gnome-utils/gnc-menu-extensions.c
@ -150,6 +149,8 @@ src/engine/SX-ttinfo.c
src/engine/kvp-scm.c
src/engine/test-core/test-engine-stuff.c
src/engine/test-core/gncmod-test-engine.c
src/app-file/gnc-file.c
src/app-file/gncmod-app-file.c
src/experimental/cgi-bin/fastcgi-hello.c
src/experimental/cgi-bin/gnc-server.c
src/experimental/cgi-bin/hello.c
@ -223,9 +224,9 @@ src/gnome/window-reconcile.c
src/gnome/window-register.c
src/gnome/window-report.c
src/gnome/gnucash.desktop.in
src/gnome/dialog-sx-from-trans.c
src/gnome/argv-list-converters.c
src/gnome/file-utils.c
src/gnome/dialog-sx-from-trans.c
src/guile/tip-of-the-day.c
src/guile/guile-util.c
src/import-export/qif-import/dialog-account-picker.c
@ -235,6 +236,7 @@ src/import-export/qif-import/qif.glade
src/import-export/qif-io-core/gncmod-qifiocore.c
src/import-export/binary-import/druid-commodity.c
src/import-export/binary-import/gncmod-binary-import.c
src/import-export/binary-import/test/test-link-module.c
src/import-export/binary-import/binary-import.glade
src/optional/swig/gnucash-swig-defines.c
src/optional/swig/helperfuncs.c

View File

@ -10,6 +10,7 @@ SUBDIRS = \
tax \
app-utils \
gnome-utils \
app-file \
register \
import-export \
report \
@ -35,9 +36,11 @@ gnucash_LDADD = \
-Lcalculation -Lcalculation/.libs \
-Lnetwork-utils -Lnetwork-utils/.libs \
-Lapp-utils -Lapp-utils/.libs \
-Lapp-file -Lapp-file/.libs \
gnc-module/libgncmodule.la \
gnome-utils/libgncmod-gnome-utils.la \
app-utils/libgncmod-app-utils.la \
app-file/libgncmod-app-file.la \
engine/libgncmod-engine.la \
engine/libgw-engine.la \
engine/libgw-glib.la \
@ -65,15 +68,11 @@ gnucash_LDADD = \
-lltdl
gnucash_SOURCES = \
FileDialog.c \
gnc-main.c
noinst_HEADERS = \
AccWindow.h \
FileBox.h \
FileDialog.h \
RecnWindow.h \
file-history.h \
gnc-ui.h
EXTRA_DIST = \

View File

@ -26,6 +26,8 @@ register/register-core Toolkit independent register code, formerly in
register/register-gnome Gnome-specific register code, formerly in
src/register/gnome
import-export/binary-import utils for importing old GnuCash binary files
import-export/qif-import the old qif importer with Gnome druid
import-export/qif-io-core new qif import/export module. unfinished.
@ -39,6 +41,8 @@ report/stylesheets predefined style sheet templates
app-utils utils for the gnucash app framework (component
mgr, cmd line processing, gettext stuff, etc)
app-file application-level file handling
gnome-utils Extensions and utilities for using Gnome/Gtk
with GnuCash, including new widgets.

10
src/app-file/.cvsignore Normal file
View File

@ -0,0 +1,10 @@
Makefile
Makefile.in
.scm-links
gw-app-utils.c
gw-app-utils.h
gw-app-utils.html
*.lo
*.la
.deps
.libs

69
src/app-file/Makefile.am Normal file
View File

@ -0,0 +1,69 @@
SUBDIRS = . #test
pkglib_LTLIBRARIES = libgncmod-app-file.la
CFLAGS = @CFLAGS@ ${GLIB_CFLAGS} ${G_WRAP_COMPILE_ARGS}
INCLUDES = -I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/app-utils \
${GNOME_INCLUDEDIR} \
${GUILE_INCS}
libgncmod_app_file_la_SOURCES = \
gnc-file.c \
gncmod-app-file.c
gncincludedir = ${GNC_INCLUDE_DIR}
gncinclude_HEADERS = \
gnc-file.h \
gnc-file-dialog.h \
gnc-file-history.h
noinst_HEADERS = gnc-file-p.h
libgncmod_app_file_la_LDFLAGS = -module
libgncmod_app_file_la_LIBADD = \
-L../gnc-module -L../gnc-module/.libs -lgncmodule \
-L../engine -L../engine/.libs -lgncmod-engine \
-L../calculation -L../calculation/.libs -lgncmod-calculation \
-L../app-utils -L../app-utils/.libs -lgncmod-app-utils \
${GUILE_LIBS} \
${GLIB_LIBS}
#libgw_app_file_la_SOURCES = gw-app-file.c
#libgw_app_file_la_LDFLAGS = -module
#gncmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash
#gncmod_DATA = app-file.scm
#gwmoddir = ${GNC_GWRAP_LIBDIR}
#gwmod_LTLIBRARIES = libgw-app-file.la
#gwmod_DATA = gw-app-file-spec.scm
noinst_DATA = .scm-links
#EXTRA_DIST = \
# ${gncmod_DATA} \
# ${gncscm_DATA} \
# ${gwmod_DATA}
.scm-links:
rm -f gnucash g-wrapped
ln -sf . gnucash
ln -sf . g-wrapped
touch .scm-links
#gw-app-file.c gw-app-file.h: .scm-links gw-app-file-spec.scm
# FLAVOR=gnome guile -c \
# "(set! %load-path (cons \"${G_WRAP_MODULE_DIR}\" %load-path)) \
# (set! %load-path (cons \"${PWD}\" %load-path)) \
# (set! %load-path (cons \"${top_srcdir}/src/engine\" %load-path)) \
# (primitive-load \"./gw-app-file-spec.scm\") \
# (gw:generate-module \"gw-app-file\")"
#BUILT_SOURCES += gw-app-file.c gw-app-file.h
#CLEANFILES += gw-app-file.c gw-app-file.h gw-app-file.html \
# gnucash g-wrapped .scm-links

View File

@ -1,6 +1,7 @@
/********************************************************************\
* FileBox.c -- the file dialog box *
* gnc-file-dialog.c -- the file dialog dialog *
* Copyright (C) 1997 Robin D. Clark *
* Copyright (c) 2001 Linux Developers Group *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@ -15,21 +16,16 @@
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
* *
* Author: Rob Clark *
* Internet: rclark@cs.hmc.edu *
* Address: 609 8th Street *
* Huntington Beach, CA 92648-4632 *
\********************************************************************/
#ifndef FILEBOX_H
#define FILEBOX_H
#ifndef GNC_FILE_DIALOG_H
#define GNC_FILE_DIALOG_H
#include "config.h"
/** PROTOTYPES ******************************************************/
const char *fileBox (const char * title,
const char * filter,
const char * default_name);
const char * gnc_file_dialog (const char * title,
const char * filter,
const char * default_name);
#endif

View File

@ -1,5 +1,5 @@
/********************************************************************\
* file-history.h -- functions to maintain file-history menu *
* gnc-file-history.h -- functions to maintain file-history menu *
* Copyright (C) 2000 Robby Stephenson *
* *
* This program is free software; you can redistribute it and/or *
@ -20,14 +20,15 @@
* Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/
#ifndef HISTORY_H
#define HISTORY_H
#ifndef GNC_FILE_HISTORY_H
#define GNC_FILE_HISTORY_H
#include "gnc-ui-common.h"
#include <gnome.h>
#define MAX_HISTORY 4
void gnc_history_add_file (const char *filename);
void gnc_history_update_menu (GnomeApp * app);
void gnc_history_update_menu (gncUIWidget app);
const char * gnc_history_get_last (void);
#endif

28
src/app-file/gnc-file-p.h Normal file
View File

@ -0,0 +1,28 @@
/********************************************************************\
* Copyright (C) 1997 Robin D. Clark *
* Copyright (C) 1998, 1999, 2000 Linas Vepstas (linas@linas.org) *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
\********************************************************************/
#ifndef GNC_FILE_P_H
#define GNC_FILE_P_H
#include "gnc-file.h"
void gnc_file_init (void);
#endif

View File

@ -26,18 +26,19 @@
#include <string.h>
#include "Backend.h"
#include "FileBox.h"
#include "FileDialog.h"
#include "Group.h"
#include "file-history.h"
#include "global-options.h"
#include "gnc-commodity.h"
#include "gnc-component-manager.h"
#include "gnc-engine.h"
#include "gnc-engine-util.h"
#include "gnc-engine.h"
#include "gnc-event.h"
#include "gnc-file-dialog.h"
#include "gnc-file-history.h"
#include "gnc-file-p.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "messages.h"
#include "global-options.h"
/* FIXME: this is wrong. This file should not need this include. */
#include "gnc-book-p.h"
@ -49,7 +50,20 @@ static short module = MOD_GUI;
static GNCBook *current_book = NULL;
/* ======================================================== */
static GNCBook *
gnc_get_current_book_internal (void)
{
if (!current_book)
current_book = gnc_book_new ();
return current_book;
}
void
gnc_file_init (void)
{
gnc_set_current_book_handler (gnc_get_current_book_internal);
}
static gboolean
show_book_error (GNCBackendError io_error, const char *newfile)
@ -201,10 +215,8 @@ show_book_error (GNCBackendError io_error, const char *newfile)
return uh_oh;
}
/* ======================================================== */
static void
gncAddHistory (GNCBook *book)
gnc_add_history (GNCBook *book)
{
char *url;
@ -222,19 +234,17 @@ gncAddHistory (GNCBook *book)
g_free (url);
}
/* ======================================================== */
void
gncFileNew (void)
gnc_file_new (void)
{
GNCBook *book;
/* If user attempts to start a new session before saving results of
* the last one, prompt them to clean up their act. */
if (!gncFileQuerySave ())
if (!gnc_file_query_save ())
return;
book = gncGetCurrentBook ();
book = gnc_get_current_book_internal ();
/* close any ongoing file sessions, and free the accounts.
* disable events so we don't get spammed by redraws. */
@ -250,31 +260,29 @@ gncFileNew (void)
gnc_commodity_table_remove_non_iso (gnc_engine_commodities ());
/* start a new book */
gncGetCurrentBook ();
gnc_get_current_book_internal ();
if(gnc_lookup_boolean_option("General",
"No account list setup on new file",
TRUE))
{
gh_call2(gh_eval_str("gnc:hook-run-danglers"),
gh_eval_str("gnc:*book-opened-hook*"),
gh_str02scm(gnc_book_get_url(current_book)));
gh_call2(gh_eval_str("gnc:hook-run-danglers"),
gh_eval_str("gnc:*book-opened-hook*"),
gh_str02scm(gnc_book_get_url(current_book)));
}
else
{
gnc_ui_hierarchy_druid ();
gnc_ui_hierarchy_druid ();
}
gnc_engine_resume_events ();
gnc_gui_refresh_all ();
}
/* ======================================================== */
gboolean
gncFileQuerySave (void)
gnc_file_query_save (void)
{
GNCBook * book = gncGetCurrentBook();
GNCBook * book = gnc_get_current_book_internal ();
/* If user wants to mess around before finishing business with
* the old file, give em a chance to figure out what's up.
@ -282,7 +290,8 @@ gncFileQuerySave (void)
* up the file-selection dialog, we don't blow em out of the water;
* instead, give them another chance to say "no" to the verify box.
*/
while (gnc_book_not_saved(book)) {
while (gnc_book_not_saved(book))
{
GNCVerifyResult result;
const char *message = _("Changes have been made since the last "
"Save. Save the data to file?");
@ -302,17 +311,16 @@ gncFileQuerySave (void)
if (result == GNC_VERIFY_NO)
return TRUE;
gncFileSave ();
gnc_file_save ();
}
return TRUE;
}
/* ======================================================== */
/* private utilities for file open; done in two stages */
static gboolean
gncPostFileOpen (const char * filename)
gnc_post_file_open (const char * filename)
{
GNCBook *new_book;
gboolean uh_oh = FALSE;
@ -325,8 +333,8 @@ gncPostFileOpen (const char * filename)
newfile = xaccResolveURL (filename);
if (!newfile)
{
show_book_error (ERR_FILEIO_FILE_NOT_FOUND, filename);
return FALSE;
show_book_error (ERR_FILEIO_FILE_NOT_FOUND, filename);
return FALSE;
}
/* disable events while moving over to the new set of accounts;
@ -360,30 +368,30 @@ gncPostFileOpen (const char * filename)
/* if file appears to be locked, ask the user ... */
if (ERR_BACKEND_LOCKED == io_err)
{
if (FALSE == show_book_error (io_err, newfile))
{
/* user told us to ignore locks. So ignore them. */
gnc_book_begin (new_book, newfile, TRUE, FALSE);
}
else
{
/* Can't use the given file, so just create a new
* database so that the user will get a window that
* they can click "Exit" on.
*/
gncFileNew();
}
if (FALSE == show_book_error (io_err, newfile))
{
/* user told us to ignore locks. So ignore them. */
gnc_book_begin (new_book, newfile, TRUE, FALSE);
}
else
{
/* Can't use the given file, so just create a new
* database so that the user will get a window that
* they can click "Exit" on.
*/
gnc_file_new ();
}
}
/* if the database doesn't exist, ask the user ... */
else if ((ERR_BACKEND_NO_SUCH_DB == io_err) ||
(ERR_SQL_DB_TOO_OLD == io_err))
{
if (FALSE == show_book_error (io_err, newfile))
{
/* user told us to create a new database. Do it. */
gnc_book_begin (new_book, newfile, FALSE, TRUE);
}
if (FALSE == show_book_error (io_err, newfile))
{
/* user told us to create a new database. Do it. */
gnc_book_begin (new_book, newfile, FALSE, TRUE);
}
}
/* Check for errors again, since above may have cleared the lock.
@ -433,7 +441,7 @@ gncPostFileOpen (const char * filename)
* reason, we don't want to leave them high & dry without a
* topgroup, because if the user continues, then bad things will
* happen. */
current_book = gncGetCurrentBook ();
current_book = gnc_get_current_book_internal ();
g_free (newfile);
@ -458,7 +466,7 @@ gncPostFileOpen (const char * filename)
/* --------------- END CORE SESSION CODE -------------- */
/* clean up old stuff, and then we're outta here. */
gncAddHistory (current_book);
gnc_add_history (current_book);
g_free (newfile);
@ -468,45 +476,43 @@ gncPostFileOpen (const char * filename)
return TRUE;
}
/* ======================================================== */
gboolean
gncFileOpen (void)
gnc_file_open (void)
{
const char * newfile;
gboolean result;
if (!gncFileQuerySave ())
if (!gnc_file_query_save ())
return FALSE;
newfile = fileBox(_("Open"), NULL, gnc_history_get_last());
result = gncPostFileOpen (newfile);
newfile = gnc_file_dialog (_("Open"), NULL, gnc_history_get_last ());
result = gnc_post_file_open (newfile);
/* This dialogue can show up early in the startup process. If the
* user fails to pick a file (by e.g. hitting the cancel button), we
* might be left with a null topgroup, which leads to nastiness when
* user goes to create their very first account. So create one. */
gncGetCurrentBook ();
gnc_get_current_book_internal ();
return result;
}
gboolean
gncFileOpenFile (const char * newfile)
gnc_file_open_file (const char * newfile)
{
if (!newfile) return FALSE;
if (!gncFileQuerySave ())
if (!gnc_file_query_save ())
return FALSE;
return gncPostFileOpen (newfile);
return gnc_post_file_open (newfile);
}
/* ======================================================== */
static gboolean been_here_before = FALSE;
void
gncFileSave (void)
gnc_file_save (void)
{
GNCBackendError io_err;
const char * newfile;
@ -516,18 +522,18 @@ gncFileSave (void)
/* hack alert -- Somehow make sure all in-progress edits get committed! */
/* If we don't have a filename/path to save to get one. */
book = gncGetCurrentBook ();
book = gnc_get_current_book_internal ();
if (!gnc_book_get_file_path (book))
{
gncFileSaveAs();
gnc_file_save_as ();
return;
}
/* use the current session to save to file */
gnc_set_busy_cursor(NULL, TRUE);
gnc_set_busy_cursor (NULL, TRUE);
gnc_book_save (book);
gnc_unset_busy_cursor(NULL);
gnc_unset_busy_cursor (NULL);
/* Make sure everything's OK - disk could be full, file could have
become read-only etc. */
@ -539,26 +545,24 @@ gncFileSave (void)
if (been_here_before) return;
been_here_before = TRUE;
gncFileSaveAs(); /* been_here prevents infinite recursion */
gnc_file_save_as (); /* been_here prevents infinite recursion */
been_here_before = FALSE;
return;
}
gncAddHistory (book);
gnc_add_history (book);
gnc_book_mark_saved(book);
gnc_book_mark_saved (book);
/* save the main window state */
gh_call1(gh_eval_str("gnc:main-window-save-state"),
gh_str02scm(gnc_book_get_url(current_book)));
gh_call1 (gh_eval_str("gnc:main-window-save-state"),
gh_str02scm(gnc_book_get_url(current_book)));
LEAVE (" ");
}
/* ======================================================== */
void
gncFileSaveAs (void)
gnc_file_save_as (void)
{
AccountGroup *group;
GNCPriceDB *pdb;
@ -572,7 +576,7 @@ gncFileSaveAs (void)
GNCBackendError io_err = ERR_BACKEND_NO_ERR;
ENTER(" ");
filename = fileBox(_("Save"), "*.gnc", NULL);
filename = gnc_file_dialog (_("Save"), "*.gnc", NULL);
if (!filename) return;
/* Check to see if the user specified the same file as the current
@ -585,12 +589,12 @@ gncFileSaveAs (void)
return;
}
book = gncGetCurrentBook ();
book = gnc_get_current_book_internal ();
oldfile = gnc_book_get_file_path (book);
if (oldfile && (strcmp(oldfile, newfile) == 0))
{
g_free (newfile);
gncFileSave ();
gnc_file_save ();
return;
}
@ -679,20 +683,19 @@ gncFileSaveAs (void)
gnc_book_set_pricedb(new_book, pdb);
gnc_book_set_schedxactions(new_book, sxList);
gnc_book_set_template_group(new_book, templateGroup);
gncFileSave ();
gnc_file_save ();
g_free (newfile);
LEAVE (" ");
}
/* ======================================================== */
void
gncFileQuit (void)
gnc_file_quit (void)
{
GNCBook *book;
book = gncGetCurrentBook ();
book = gnc_get_current_book_internal ();
/* disable events; otherwise the mass deletetion of accounts and
* transactions during shutdown would cause massive redraws */
@ -708,30 +711,3 @@ gncFileQuit (void)
gnc_engine_resume_events ();
gnc_gui_refresh_all ();
}
/* ======================================================== */
AccountGroup *
gncGetCurrentGroup (void)
{
AccountGroup *grp;
GNCBook *book;
book = gncGetCurrentBook ();
grp = gnc_book_get_group (book);
return grp;
}
/* ======================================================== */
GNCBook *
gncGetCurrentBook (void)
{
if (!current_book)
current_book = gnc_book_new ();
return current_book;
}
/********************* END OF FILE **********************************/

View File

@ -18,11 +18,10 @@
\********************************************************************/
/*
* FILE:
* FileDialog.h
* FILE: gnc-file.h
*
* FUNCTION:
* A set of file-handling utility dialogs for GUI menubars and menubuttons.
* A set of file-handling utilities for GnuCash applications.
* These utilities will "do the right thing" when used in the "File..."
* pulldown menu, for the "New", "Open", "Save", "SaveAs", etc. menu entries.
* In particular, they will verify that old files don't get clobbered,
@ -34,7 +33,7 @@
* These utilities are appropriate for direct invocation from guile.
* (they should be wrapped by g-wrap).
*
* These GUI dialogues implement and maintain a single global "session"
* These GUI utilities implement and maintain a single global "session"
* that defines the currently edited account group. In a sense, these
* functions provide the GUI for the xaccSession object. The session
* is essentially a file that is open for editing, with locks on it
@ -42,15 +41,15 @@
* open.
*
*
* The gncFileSave() routine will check for an existing edit session,
* The gnc_file_save() routine will check for an existing edit session,
* and if one exists, it will save the account info to a file.
* If an error occurs, a popup dialogue will inform the user of
* the error. If there is no existing filename open, then the
* user will be prompted for a file to save to (using the
* gncFileSaveAs() routine). The existing session will remain
* gnc_file_save_as() routine). The existing session will remain
* open for further editing.
*
* The gncFileSaveAs() routine will prompt the user for a filename
* The gnc_file_save_as() routine will prompt the user for a filename
* to save the account data to (using the standard GUI file dialogue
* box). If the user specifies a filename, the account data will be
* saved. If an error occurs, a popup dialogue will inform the user
@ -62,25 +61,25 @@
* filename, locking out other users. This new session remains
* open for further editing.
*
* The gncFileQuerySave() routine will display a popup dialog asking
* The gnc_file_query_save() routine will display a popup dialog asking
* the user if they wish to save their current work. If they answer
* "yes", their work will be saved (using the gncFileSave function),
* otherwise no action will be performed. If there is no currently
* locked session, a popup will query the user for a filename
* (using the gncFileSaveAs() routine). The routine will return
* (using the gnc_file_save_as() routine). The routine will return
* TRUE if the user hits "Yes" or "No" and FALSE if the user
* hits "Cancel". If nothing needed to be saved, the routine
* will return TRUE.
*
* The gncFileNew() routine will check for an existing edit session.
* The gnc_file_new() routine will check for an existing edit session.
* If one exists, it will ask the user if they want to save it,
* (using the gncFileQuerySave() dialogue). Then the current
* (using the gnc_file_query_save_as() dialogue). Then the current
* session will be destroyed, file locks will be removed, and
* account group structures will be set up for a new session.
*
* The gncFileOpen() routine check for an existing edit session.
* The gnc_file_open() routine check for an existing edit session.
* If one exists, it will ask the user if they want to save it.
* (using the gncFileQuerySave() dialogue). Next, the user will
* (using the gnc_file_query_save() dialogue). Next, the user will
* be prompted with a GUI standard file-selection dialogue to
* to pick a new file. If no file is picked, this routine returns.
* If a new file was picked, then the current session will be
@ -94,17 +93,11 @@
* case it is up to the user to try again, or to pick
* a different filename).
*
* The gncFileOpenFile() routine behaves much like the gncFileOpen()
* The gnc_file_open_file() routine behaves much like the gnc_file_open()
* routine, except that the new file to open is passed as a char *
* argument.
*
* The gncFileQIFImport() routine will pop up a standard file selection
* dialogue asking the user to pick a QIF file. If one is selected
* the the QIF file is opened and read. It's contents are merged
* into the existing session (if any). The current session continues
* to remain open for editing.
*
* The gncFileQuit() routine will close out and destroy the current session.
* The gnc_file_quit() routine will close out and destroy the current session.
* The user WILL NOT BE PROMPTED to confirm this action, or do do
* any kind of saving beforehand.
*
@ -116,30 +109,20 @@
* Derived from Rob Clark's original MainWindow.c code, Dec 1998
*/
#ifndef GNC_FILE_DIALOG_H
#define GNC_FILE_DIALOG_H
#ifndef GNC_FILE_H
#define GNC_FILE_H
#include "config.h"
#include "Group.h"
#include "gnc-book.h"
void gncFileNew (void);
gboolean gncFileOpen (void);
void gncFileQIFImport (void);
void gncFileSave (void);
void gncFileSaveAs (void);
void gnc_file_new (void);
gboolean gnc_file_open (void);
void gnc_file_save (void);
void gnc_file_save_as (void);
gboolean gncFileOpenFile (const char *filename);
gboolean gnc_file_open_file (const char *filename);
gboolean gncFileQuerySave (void);
gboolean gnc_file_query_save (void);
void gncFileQuit (void);
void gnc_file_quit (void);
AccountGroup *gncGetCurrentGroup (void);
Account *gncGetTemplateAccount(void);
GNCBook *gncGetCurrentBook (void);
#endif /* GNC_FILE_DIALOG_H */
#endif /* GNC_FILE_H */

View File

@ -0,0 +1,67 @@
/*********************************************************************
* gncmod-app-file.c
* module definition/initialization app-level file interface
*
* Copyright (c) 2001 Linux Developers Group, Inc.
*********************************************************************/
#include <stdio.h>
#include <guile/gh.h>
#include <glib.h>
#include <libguile/strports.h>
#include <libguile/modules.h>
#include "gnc-file-p.h"
#include "gnc-module.h"
#include "gnc-module-api.h"
/* version of the gnc module system interface we require */
int gnc_module_system_interface = 0;
/* module versioning uses libtool semantics. */
int gnc_module_current = 0;
int gnc_module_revision = 0;
int gnc_module_age = 0;
char *
gnc_module_path(void) {
return g_strdup("gnucash/app-file");
}
char *
gnc_module_description(void) {
return g_strdup("Application level file interface");
}
static void
lmod(char * mn)
{
char * form = g_strdup_printf("(use-modules %s)\n", mn);
gh_eval_str(form);
g_free(form);
}
int
gnc_module_init(int refcount) {
if (refcount == 0)
{
/* load the engine (we depend on it) */
if(!gnc_module_load("gnucash/engine", 0)) {
return FALSE;
}
/* load the calculation module (we depend on it) */
if(!gnc_module_load("gnucash/app-utils", 0)) {
return FALSE;
}
gnc_file_init ();
}
return TRUE;
}
int
gnc_module_end(int refcount) {
return TRUE;
}

View File

@ -67,6 +67,7 @@ gwmod_DATA = gw-app-utils-spec.scm
noinst_DATA = .scm-links
EXTRA_DIST = \
.cvsignore \
${gncmod_DATA} \
${gncscm_DATA} \
${gwmod_DATA}

View File

@ -52,7 +52,7 @@ static gboolean reverse_balance_inited = FALSE;
static SCM reverse_balance_callback_id = SCM_UNDEFINED;
static gboolean reverse_type[NUM_ACCOUNT_TYPES];
static GNCGroupCB group_cb = NULL;
static GNCBookCB book_cb = NULL;
/********************************************************************\
@ -197,19 +197,31 @@ gnc_reverse_balance (Account *account)
return reverse_type[type];
}
AccountGroup *
gnc_get_current_group (void)
void
gnc_set_current_book_handler (GNCBookCB cb)
{
if (group_cb)
return group_cb ();
book_cb = cb;
}
GNCBook *
gnc_get_current_book (void)
{
GNCBook *book;
if (book_cb)
return book_cb ();
return NULL;
}
void
gnc_set_current_group_handler (GNCGroupCB cb)
AccountGroup *
gnc_get_current_group (void)
{
group_cb = cb;
GNCBook *book;
book = gnc_get_current_book ();
return gnc_book_get_group (book);
}
const char *

View File

@ -28,13 +28,12 @@
#include <glib.h>
#include <locale.h>
#include "gnc-book.h"
#include "gnc-commodity.h"
#include "gnc-numeric.h"
#include "Account.h"
#include "Transaction.h"
typedef AccountGroup * (*GNCGroupCB) (void);
typedef GNCBook * (*GNCBookCB) (void);
/* User Settings ****************************************************/
@ -50,8 +49,10 @@ const char * gnc_register_default_hint_font(void);
/* Engine enhancements & i18n ***************************************/
void gnc_set_current_book_handler (GNCBookCB cb);
GNCBook * gnc_get_current_book (void);
AccountGroup * gnc_get_current_group (void);
void gnc_set_current_group_handler (GNCGroupCB cb);
typedef enum
{

View File

@ -4,7 +4,7 @@ pkglib_LTLIBRARIES = libgncmod-engine.la
CFLAGS = @CFLAGS@ ${GNUCASH_ENGINE_BASE_CFLAGS}
INCLUDES = -I${top_srcdir}/src/gnc-module -I../
INCLUDES = -I${top_srcdir}/src/gnc-module
libgncmod_engine_la_SOURCES = \
Account.c \

View File

@ -39,7 +39,6 @@
#include "Group.h"
#include "guid.h"
#include "gnc-book.h"
#include "FileDialog.h"
#include "SX-ttinfo.h"
static short module = MOD_SX;

View File

@ -28,7 +28,6 @@
#include <gnome.h>
#include "FileDialog.h"
#include "Group.h"
#include "dialog-utils.h"
#include "gnc-account-tree.h"

View File

@ -44,7 +44,6 @@
#include "Account.h"
#include "Group.h"
#include "FileDialog.h"
#include "dialog-utils.h"
#include "print-session.h"
#include "global-options.h"

View File

@ -105,6 +105,7 @@ INCLUDES = \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/network-utils \
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src/app-file \
-I${top_srcdir}/src/backend/file \
-I${top_srcdir}/src/g-wrap \
-I${top_srcdir}/src/gnome-utils \
@ -113,6 +114,7 @@ INCLUDES = \
-I${top_srcdir}/src/register/register-core \
-I${top_srcdir}/src/register/register-gnome \
-I${top_srcdir}/src/report/report-system \
-I${top_srcdir}/src/import-export/binary-import \
-I${top_srcdir}/src/import-export/qif-import \
${GNOME_INCLUDEDIR} \
${GUILE_INCS}

View File

@ -27,7 +27,6 @@
#include <string.h>
#include "AccWindow.h"
#include "FileDialog.h"
#include "dialog-account.h"
#include "dialog-utils.h"
#include "global-options.h"
@ -42,6 +41,7 @@
#include "gnc-gui-query.h"
#include "gnc-ledger-display.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "messages.h"
#include "top-level.h"
#include "window-help.h"
@ -368,7 +368,7 @@ gnc_ui_to_account(AccountWindow *aw)
xaccAccountInsertSubAccount (parent_account, account);
}
else
xaccGroupInsertAccount (gncGetCurrentGroup(), account);
xaccGroupInsertAccount (gnc_get_current_group (), account);
xaccAccountCommitEdit (parent_account);
xaccAccountCommitEdit (account);
@ -907,7 +907,7 @@ gnc_new_account_ok (AccountWindow *aw)
AccountGroup *group;
char separator;
group = gncGetCurrentGroup();
group = gnc_get_current_group ();
separator = gnc_get_account_separator();
@ -1697,7 +1697,7 @@ gnc_split_account_name (const char *in_name, Account **base_account)
names = NULL;
name = g_strdup (in_name);
*base_account = NULL;
group = gncGetCurrentGroup ();
group = gnc_get_current_group ();
separator = gnc_get_account_separator ();

View File

@ -25,13 +25,13 @@
#include <gnome.h>
#include "FileDialog.h"
#include "dialog-commodity.h"
#include "dialog-utils.h"
#include "gnc-commodity.h"
#include "gnc-component-manager.h"
#include "gnc-engine-util.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "messages.h"
@ -236,7 +236,7 @@ remove_clicked (GtkWidget *widget, gpointer data)
if (!cd->commodity)
return;
accounts = xaccGroupGetSubAccounts (gncGetCurrentGroup ());
accounts = xaccGroupGetSubAccounts (gnc_get_current_group ());
can_delete = TRUE;
do_delete = FALSE;

View File

@ -26,11 +26,11 @@
#include <gnome.h>
#include "FileBox.h"
#include "file-history.h"
#include "messages.h"
#include "gnc-engine-util.h"
#include "gnc-file-dialog.h"
#include "gnc-file-history.h"
#include "gnc-ui.h"
#include "messages.h"
typedef struct _FileBoxInfo FileBoxInfo;
struct _FileBoxInfo
@ -54,7 +54,7 @@ static gboolean gnc_file_box_delete_cb(GtkWidget *widget, GdkEvent *event,
/********************************************************************\
* fileBox *
* gnc_file_dialog *
* Pops up a file selection dialog (either a "Save As" or an *
* "Open"), and returns the name of the file the user selected. *
* (This function does not return until the user selects a file *
@ -67,7 +67,9 @@ static gboolean gnc_file_box_delete_cb(GtkWidget *widget, GdkEvent *event,
\********************************************************************/
const char *
fileBox (const char * title, const char * filter, const char *default_name)
gnc_file_dialog (const char * title,
const char * filter,
const char *default_name)
{
ENTER("\n");
@ -169,5 +171,3 @@ gnc_file_box_delete_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data)
/* Don't delete the window, we'll handle things ourselves. */
return TRUE;
}
/* ======================== END OF FILE ======================== */

View File

@ -30,7 +30,6 @@
#include <stdio.h>
#include <time.h>
#include "FileDialog.h"
#include "Query.h"
#include "dialog-find-transactions.h"
#include "dialog-utils.h"
@ -41,6 +40,7 @@
#include "gnc-engine-util.h"
#include "gnc-ledger-display.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "messages.h"
#include "window-help.h"
#include "window-register.h"
@ -511,7 +511,7 @@ gnc_ui_find_transactions_dialog_ok_cb(GtkButton * button,
assert(ftd->q);
q = xaccMallocQuery();
xaccQuerySetGroup(q, gncGetCurrentGroup());
xaccQuerySetGroup(q, gnc_get_current_group ());
/* account selections */
selected_accounts =

View File

@ -22,10 +22,8 @@
#include "config.h"
#include <glib.h>
#include <gnome.h>
#include "FileDialog.h"
#include "Group.h"
#include "SchedXaction.h"
#include "Transaction.h"
@ -199,7 +197,7 @@ nr_next_clicked( GtkButton *b, gpointer ud )
sxsld->transList = NULL;
}
book = gncGetCurrentBook();
book = gnc_get_current_book ();
sxList = gnc_book_get_schedxactions( book );
if ( sxList == NULL ) {
PERR( "No scheduled transactions to play with\n" );
@ -423,7 +421,7 @@ slr_create_transactions( SchedXaction *sx, GDate *gd )
char *id;
/* get template account group */
ag = gnc_book_get_template_group( gncGetCurrentBook() );
ag = gnc_book_get_template_group( gnc_get_current_book () );
id = guid_to_string( xaccSchedXactionGetGUID(sx) );
acct = xaccGetAccountFromName( ag, id );
DEBUG( "Got account \"%s\"\n",
@ -433,7 +431,6 @@ slr_create_transactions( SchedXaction *sx, GDate *gd )
xaccAccountForEachTransaction( acct,
create_each_transaction,
gd );
}
#if 0

View File

@ -27,7 +27,6 @@
#include <guile/gh.h>
#include <time.h>
#include "FileDialog.h"
#include "dialog-utils.h"
#include "global-options.h"
#include "gnc-amount-edit.h"
@ -38,6 +37,7 @@
#include "gnc-engine-util.h"
#include "gnc-pricedb.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "guile-util.h"
#include "engine-helpers.h"
#include "messages.h"
@ -181,7 +181,7 @@ gnc_prices_load_prices (PricesDialog *pdb_dialog)
GList *node;
int new_row;
book = gncGetCurrentBook ();
book = gnc_get_current_book ();
old_price = pdb_dialog->price;
prices = NULL;
new_row = 0;
@ -430,7 +430,7 @@ static void
price_ok_clicked (GtkWidget *widget, gpointer data)
{
PricesDialog *pdb_dialog = data;
GNCBook *book = gncGetCurrentBook ();
GNCBook *book = gnc_get_current_book ();
GNCPriceDB *pdb = gnc_book_get_pricedb (book);
const char *error_str;
@ -514,7 +514,7 @@ remove_clicked (GtkWidget *widget, gpointer data)
if (gnc_verify_dialog_parented (pdb_dialog->dialog, message, TRUE))
{
GNCBook *book = gncGetCurrentBook ();
GNCBook *book = gnc_get_current_book ();
GNCPriceDB *pdb = gnc_book_get_pricedb (book);
gnc_pricedb_remove_price (pdb, pdb_dialog->price);
@ -563,7 +563,7 @@ remove_old_clicked (GtkWidget *widget, gpointer data)
result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
if (result == 0)
{
GNCBook *book = gncGetCurrentBook ();
GNCBook *book = gnc_get_current_book ();
GNCPriceDB *pdb = gnc_book_get_pricedb (book);
GList *node;
Timespec ts;
@ -614,7 +614,7 @@ static void
get_quotes_clicked (GtkWidget *widget, gpointer data)
{
PricesDialog *pdb_dialog = data;
GNCBook *book = gncGetCurrentBook ();
GNCBook *book = gnc_get_current_book ();
SCM quotes_func;
SCM book_scm;

View File

@ -27,25 +27,23 @@
#include <locale.h>
#include <time.h>
#include "gnc-ui.h"
#include "FreqSpec.h"
#include "SchedXaction.h"
#include "gnc-book.h"
#include "FileDialog.h"
#include "gnucash-sheet.h"
#include "window-register.h"
#include "window-help.h"
#include "dialog-scheduledxaction.h"
#include "dialog-utils.h"
#include "gnc-book.h"
#include "gnc-component-manager.h"
#include "gnc-date-edit.h"
#include "gnc-engine-util.h"
#include "gnc-frequency.h"
#include "gnc-gui-query.h"
#include "gnc-ledger-display.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "gnucash-sheet.h"
#include "messages.h"
#include "window-help.h"
#include "window-register.h"
static short module = MOD_SX;
@ -274,7 +272,7 @@ editor_ok_button_clicked( GtkButton *b, SchedXactionEditorDialog *sxed )
/* add to list */
putSchedXactionInClist( sxed->sx, sxed->sxd );
if ( sxed->new ) {
book = gncGetCurrentBook();
book = gnc_get_current_book ();
sxList = gnc_book_get_schedxactions( book );
sxList = g_list_append( sxList, sxed->sx );
gnc_book_set_schedxactions( book, sxList );
@ -446,12 +444,13 @@ schedXact_populate( SchedXactionDialog *sxd )
time_t tmpTime;
int i;
book = gncGetCurrentBook();
book = gnc_get_current_book ();
sxList = gnc_book_get_schedxactions( book );
g_list_foreach( sxList, putSchedXactionInClist, sxd );
sx_clist = GTK_CLIST( glade_xml_get_widget( sxd->gxml, "sched_xact_list" ) );
sx_clist = GTK_CLIST( glade_xml_get_widget( sxd->gxml,
"sched_xact_list" ) );
for ( i=0; i<3; i++ ) {
gtk_clist_set_column_auto_resize( sx_clist, i, TRUE );
}
@ -830,7 +829,7 @@ new_button_clicked( GtkButton *b, gpointer d )
{
SchedXactionDialog *sxd;
SchedXaction *tmpSX =
xaccSchedXactionMalloc( gncGetCurrentBook());
xaccSchedXactionMalloc( gnc_get_current_book ());
SchedXactionEditorDialog *sxed;
sxd = (SchedXactionDialog*)d;
@ -919,14 +918,15 @@ delete_button_clicked( GtkButton *b, gpointer d )
switch ( confirmSel ) {
case 0:
sel = cl->selection;
book = gncGetCurrentBook();
book = gnc_get_current_book ();
sxList = gnc_book_get_schedxactions( book );
gtk_clist_freeze( cl );
/* delete back-to-front so clist index numbers aren't
invalidated */
sel = g_list_last( sel );
do {
sx = (SchedXaction*)gtk_clist_get_row_data( cl, (int)sel->data );
sx = (SchedXaction*)
gtk_clist_get_row_data( cl, (int)sel->data );
sxList = g_list_remove( sxList, (gpointer)sx );
gtk_clist_remove( cl, (int)sel->data );
xaccSchedXactionFree( sx );
@ -939,8 +939,6 @@ delete_button_clicked( GtkButton *b, gpointer d )
return;
break;
}
return;
}
static

View File

@ -26,14 +26,14 @@
#include <gnome.h>
#include "dialog-utils.h"
#include "SchedXaction.h"
#include "dialog-sx-from-trans.h"
#include "dialog-scheduledxaction.h"
#include "SX-ttinfo.h"
#include "SchedXaction.h"
#include "dialog-scheduledxaction.h"
#include "dialog-sx-from-trans.h"
#include "dialog-utils.h"
#include "gnc-book.h"
#include "gnc-engine-util.h"
#include "FileDialog.h"
#include "gnc-ui-util.h"
#define SX_GLADE_FILE "sched-xact.glade"
#define SXFTD_DIALOG_GLADE_NAME "sx_from_real_trans"
@ -359,7 +359,7 @@ sxftd_ok_clicked(GtkWidget *w, gpointer user_data)
if (sx_error == 0)
{
book = gncGetCurrentBook();
book = gnc_get_current_book ();
sx_list = gnc_book_get_schedxactions(book);
sx_list = g_list_append(sx_list, sxfti->sx);
gnc_book_set_schedxactions(book, sx_list);
@ -418,7 +418,7 @@ gnc_sx_create_from_trans(Transaction *trans)
sxfti->trans = trans;
sxfti->sx = xaccSchedXactionMalloc(gncGetCurrentBook());
sxfti->sx = xaccSchedXactionMalloc(gnc_get_current_book ());
sxfti_attach_callbacks(sxfti);

View File

@ -25,7 +25,6 @@
#include <gnome.h>
#include <glib.h>
#include "FileDialog.h"
#include "Group.h"
#include "SchedXaction.h"
#include "Transaction.h"
@ -691,7 +690,7 @@ sxsincelast_populate( sxSinceLastData *sxsld )
autoCreateList = toCreateList = reminderList = NULL;
autoCreateRow = toCreateRow = remindersRow = 0;
sxList = gnc_book_get_schedxactions( gncGetCurrentBook() );
sxList = gnc_book_get_schedxactions( gnc_get_current_book () );
if ( sxList == NULL ) {
DEBUG( "No scheduled transactions to populate." );
@ -1275,7 +1274,7 @@ _create_transactions_on( SchedXaction *sx, GDate *gd, toCreateTuple *tct )
tct->clistRow = -1;
}
ag = gnc_book_get_template_group( gncGetCurrentBook() );
ag = gnc_book_get_template_group( gnc_get_current_book () );
id = guid_to_string( xaccSchedXactionGetGUID(sx) );
if(ag && id)
{
@ -1329,7 +1328,7 @@ _sxsl_get_sx_vars( SchedXaction *sx, GHashTable *varHash )
Account *acct;
char *id;
ag = gnc_book_get_template_group( gncGetCurrentBook() );
ag = gnc_book_get_template_group( gnc_get_current_book () );
id = guid_to_string( xaccSchedXactionGetGUID(sx) );
acct = xaccGetAccountFromName( ag, id );
g_free( id );
@ -1786,7 +1785,7 @@ sx_obsolete_ok_clicked(GtkButton *button, gpointer user_data)
SchedXaction *sx;
GList *actual_sx_list, *actual_sx_listref, *removelist_ref;
GNCBook *book = gncGetCurrentBook();
GNCBook *book = gnc_get_current_book ();
actual_sx_list = gnc_book_get_schedxactions(book);
for(removelist_ref = sxsld->actual_to_remove;

View File

@ -26,7 +26,6 @@
#include <gnome.h>
#include "FileDialog.h"
#include "dialog-transfer.h"
#include "dialog-utils.h"
#include "global-options.h"

View File

@ -27,7 +27,6 @@
#include <sys/types.h>
#include <unistd.h>
#include "FileDialog.h"
#include "Group.h"
#include "dialog-new-user.h"
#include "dialog-utils.h"
@ -38,6 +37,7 @@
#include "gnc-component-manager.h"
#include "gnc-dir.h"
#include "gnc-gui-query.h"
#include "gnc-ui-util.h"
#include "io-example-account.h"
#include "top-level.h"
@ -826,10 +826,7 @@ on_finish (GnomeDruidPage *gnomedruidpage,
gnc_set_first_startup (FALSE);
if (our_final_group)
{
xaccGroupConcatGroup (gnc_book_get_group (gncGetCurrentBook ()),
our_final_group);
}
xaccGroupConcatGroup (gnc_get_current_group (), our_final_group);
gnc_resume_gui_refresh ();
}

View File

@ -25,7 +25,6 @@
#include <gnome.h>
#include "FileDialog.h"
#include "Group.h"
#include "dialog-utils.h"
#include "druid-utils.h"
@ -38,6 +37,7 @@
#include "gnc-exp-parser.h"
#include "gnc-gui-query.h"
#include "gnc-ui.h"
#include "gnc-ui-util.h"
#include "messages.h"
@ -94,7 +94,7 @@ fill_account_list (StockSplitInfo *info, Account *account)
gtk_clist_clear (clist);
accounts = xaccGroupGetSubAccounts (gncGetCurrentGroup ());
accounts = xaccGroupGetSubAccounts (gnc_get_current_group ());
for (node = accounts; node; node = node->next)
{
Account *account = node->data;
@ -420,7 +420,7 @@ stock_split_finish (GnomeDruidPage *druidpage,
gnc_price_set_value (price, amount);
gnc_price_commit_edit (price);
book = gncGetCurrentBook ();
book = gnc_get_current_book ();
pdb = gnc_book_get_pricedb (book);
if (!gnc_pricedb_add_price (pdb, price))

View File

@ -24,15 +24,14 @@
#include <gnome.h>
#include "file-history.h"
#include "FileDialog.h"
#include "gnc-ui.h"
#include "gnc-file-history.h"
#include "gnc-file.h"
static GSList *history_list = NULL;
static gint num_menu_entries = -1;
static void
__gnc_history_config_write(void)
gnc_history_config_write (void)
{
int max_files, i = 0;
char *key;
@ -61,7 +60,7 @@ __gnc_history_config_write(void)
}
static void
__gnc_history_get_list(void)
gnc_history_get_list (void)
{
int max_files, i;
char *key, *filename;
@ -90,13 +89,13 @@ __gnc_history_get_list(void)
}
static void
__gnc_history_file_cb(GtkWidget *w, char *data)
gnc_history_file_cb (GtkWidget *w, char *data)
{
gncFileOpenFile(data);
gnc_file_open_file (data);
}
void
gnc_history_add_file(const char *newfile)
gnc_history_add_file (const char *newfile)
{
int i, max_files;
gboolean used_default, matched = FALSE;
@ -115,19 +114,23 @@ gnc_history_add_file(const char *newfile)
gnome_config_set_int("MaxFiles", max_files);
if(history_list == NULL)
__gnc_history_get_list();
gnc_history_get_list ();
i = 0;
tmp = history_list;
while(tmp != NULL && i < max_files) {
while(tmp != NULL && i < max_files)
{
if(!matched && /* no match yet */
((i == max_files - 1) || /* last entry */
(strcmp(newfile, (char *)tmp->data) == 0)) ) { /* filename match */
g_free(tmp->data);
matched = TRUE;
} else {
}
else
{
new_list = g_slist_prepend(new_list, tmp->data);
}
i++;
tmp = tmp->next;
}
@ -137,7 +140,7 @@ gnc_history_add_file(const char *newfile)
g_slist_free(history_list);
history_list = new_list;
__gnc_history_config_write();
gnc_history_config_write ();
/* Update apps immediately */
{
@ -148,7 +151,7 @@ gnc_history_add_file(const char *newfile)
GtkWidget *w = containers->data;
if (GNOME_IS_APP (w))
gnc_history_update_menu (GNOME_APP(w));
gnc_history_update_menu (w);
containers = containers->next;
}
@ -156,10 +159,10 @@ gnc_history_add_file(const char *newfile)
}
const char *
gnc_history_get_last(void)
gnc_history_get_last (void)
{
if(history_list == NULL)
__gnc_history_get_list();
gnc_history_get_list ();
if(history_list == NULL)
return NULL;
@ -168,12 +171,12 @@ gnc_history_get_last(void)
}
void
gnc_history_update_menu(GnomeApp * app)
gnc_history_update_menu (GtkWidget * app_w)
{
GtkWidget *app_w;
GnomeUIInfo *menu;
GnomeDockItem *di;
GtkWidget *menushell;
GnomeApp *app;
gpointer data;
char *path;
char *file;
@ -183,9 +186,13 @@ gnc_history_update_menu(GnomeApp * app)
int i, n;
int pos;
if (!app)
if (!app_w)
return;
g_return_if_fail (GNOME_IS_APP (app_w));
app = GNOME_APP (app_w);
di = gnome_app_get_dock_item_by_name(app, GNOME_APP_MENUBAR_NAME);
if (di == NULL)
return;
@ -215,9 +222,9 @@ gnc_history_update_menu(GnomeApp * app)
}
if(history_list == NULL)
__gnc_history_get_list();
gnc_history_get_list();
if(history_list == NULL)
if (history_list == NULL)
return;
n = g_slist_length(history_list);
@ -256,7 +263,7 @@ gnc_history_update_menu(GnomeApp * app)
(menu+i)->hint = NULL;
(menu+i)->moreinfo = (gpointer)__gnc_history_file_cb;
(menu+i)->moreinfo = gnc_history_file_cb;
(menu+i)->user_data = file;
(menu+i)->unused_data = NULL;
(menu+i)->pixmap_type = 0;

View File

@ -26,7 +26,6 @@
#include <gnome.h>
#include "FileDialog.h"
#include "date.h"
#include "dialog-utils.h"
#include "global-options.h"
@ -110,7 +109,7 @@ gnc_reconcile_list_new(Account *account, GNCReconcileListType type)
list->query = xaccMallocQuery();
xaccQuerySetGroup(list->query, gncGetCurrentGroup());
xaccQuerySetGroup(list->query, gnc_get_current_group ());
/* match the account */
xaccQueryAddSingleAccountMatch(list->query, account, QUERY_OR);

View File

@ -35,8 +35,6 @@
#include <X11/Xlib.h>
#include "AccWindow.h"
#include "FileBox.h"
#include "FileDialog.h"
#include "TransLog.h"
#include "argv-list-converters.h"
#include "combocell.h"
@ -49,6 +47,7 @@
#include "global-options.h"
#include "gnc-component-manager.h"
#include "gnc-engine-util.h"
#include "gnc-file.h"
#include "gnc-menu-extensions.h"
#include "gnc-network.h"
#include "gnc-splash.h"
@ -201,7 +200,7 @@ gnc_html_register_url_cb (const char *location, const char *label,
/* href="gnc-register:account=My Bank Account" */
if (strncmp("account=", location, 8) == 0)
{
account = xaccGetAccountFromFullName (gncGetCurrentGroup (),
account = xaccGetAccountFromFullName (gnc_get_current_group (),
location + 8,
gnc_get_account_separator ());
reg = regWindowSimple (account);
@ -544,8 +543,6 @@ gnucash_ui_init(void)
gnc_ui_commodity_set_help_callback (gnc_commodity_help_cb);
gnc_set_current_group_handler (gncGetCurrentGroup);
/* initialize gnome MDI and set up application window defaults */
app = gnc_main_window_new();
/* Run the ui startup hooks. */
@ -563,10 +560,12 @@ gnucash_ui_init(void)
static gboolean hasstarted = FALSE;
void
gnc_default_ui_start(void) {
if(!hasstarted) {
gnc_default_ui_start(void)
{
if (!hasstarted)
{
hasstarted = TRUE;
gncGetCurrentBook();
gnc_get_current_book ();
}
}
@ -641,7 +640,7 @@ gnc_ui_check_events (gpointer not_used)
if (gtk_main_level() != 1)
return TRUE;
book = gncGetCurrentBook ();
book = gnc_get_current_book ();
if (!book)
return TRUE;
@ -722,7 +721,7 @@ gnc_ui_main(void)
gboolean
gnucash_ui_open_file(const char name[])
{
return gncFileOpenFile(name);
return gnc_file_open_file (name);
}
/* ============================================================== */
@ -730,7 +729,7 @@ gnucash_ui_open_file(const char name[])
int
gnucash_ui_select_file(void)
{
gncFileOpen();
gnc_file_open ();
return 1;
}

View File

@ -29,16 +29,13 @@
#include <string.h>
#include "AccWindow.h"
#include "FileBox.h"
#include "FileDialog.h"
#include "Scrub.h"
#include "dialog-account.h"
#include "dialog-transfer.h"
#include "dialog-utils.h"
#include "file-history.h"
#include "global-options.h"
#include "gnc-account-tree.h"
#include "gnc-book.h"
#include "gnc-commodity.h"
#include "gnc-component-manager.h"
#include "gnc-engine-util.h"
@ -46,8 +43,9 @@
#include "gnc-ui.h"
#include "gnucash.h"
#include "gtkselect.h"
#include "messages.h"
#include "io-gncxml-v2.h"
#include "mainwindow-account-tree.h"
#include "messages.h"
#include "option-util.h"
#include "top-level.h"
#include "window-acct-tree.h"
@ -57,9 +55,6 @@
#include "window-register.h"
#include "window-report.h"
#include "io-gncxml-v2.h"
#include "gnc-book.h"
static short module = MOD_GUI;
#define WINDOW_ACCT_TREE_CM_CLASS "window-acct-tree"
@ -524,7 +519,7 @@ gnc_acct_tree_window_menu_scrub_sub_cb(GtkWidget * widget,
static void
gnc_acct_tree_window_menu_scrub_all_cb(GtkWidget * widget,
GnomeMDIChild * child) {
AccountGroup *group = gncGetCurrentGroup ();
AccountGroup *group = gnc_get_current_group ();
gnc_suspend_gui_refresh ();

View File

@ -29,7 +29,6 @@
#include <string.h>
#include "Account.h"
#include "FileDialog.h"
#include "Group.h"
#include "dialog-utils.h"
#include "global-options.h"
@ -383,7 +382,7 @@ gnc_main_window_summary_refresh (GNCMainSummary * summary)
/* Make sure there's at least one accumulator in the list. */
gnc_ui_get_currency_accumulator (&currency_list, default_currency);
group = gncGetCurrentGroup ();
group = gnc_get_current_group ();
gnc_ui_accounts_recurse(group, &currency_list, euro);
for (current = g_list_first(summary->totals_list); current;

View File

@ -33,43 +33,40 @@
#include <sys/stat.h>
#include <unistd.h>
#include "dialog-account.h"
#include "dialog-fincalc.h"
#include "dialog-find-transactions.h"
#include "dialog-nextrun.h"
#include "dialog-options.h"
#include "dialog-scheduledxaction.h"
#include "dialog-sxsincelast.h"
#include "dialog-totd.h"
#include "dialog-transfer.h"
#include "dialog-utils.h"
#include "druid-qif-import.h"
#include "gfec.h"
#include "global-options.h"
#include "gnc-component-manager.h"
#include "gnc-engine.h"
#include "gnc-file-dialog.h"
#include "gnc-file-history.h"
#include "gnc-file.h"
#include "gnc-gui-query.h"
#include "gnc-menu-extensions.h"
#include "gnc-ui.h"
#include "gnucash.h"
#include "io-utils.h"
#include "mainwindow-account-tree.h"
#include "option-util.h"
#include "top-level.h"
#include "FileBox.h"
#include "FileDialog.h"
#include "dialog-account.h"
#include "dialog-fincalc.h"
#include "dialog-find-transactions.h"
#include "dialog-options.h"
#include "dialog-totd.h"
#include "dialog-transfer.h"
#include "dialog-utils.h"
#include "dialog-scheduledxaction.h"
#include "dialog-nextrun.h"
#include "dialog-sxsincelast.h"
#include "window-help.h"
#include "window-main.h"
#include "window-main-summarybar.h"
#include "window-acct-tree.h"
#include "window-help.h"
#include "window-main-summarybar.h"
#include "window-main.h"
#include "window-reconcile.h"
#include "window-register.h"
#include "window-report.h"
#include "file-history.h"
#include "global-options.h"
#include "gnc-component-manager.h"
#include "gnc-gui-query.h"
#include "mainwindow-account-tree.h"
#include "option-util.h"
#define WINDOW_MAIN_CM_CLASS "window-main"
static void gnc_main_window_create_menus(GNCMainInfo * maininfo);
@ -182,10 +179,10 @@ gnc_main_window_app_created_cb(GnomeMDI * mdi, GnomeApp * app,
mainwin);
/* set up extensions menu and hints */
gnc_extensions_menu_setup(app);
gnc_extensions_menu_setup (app);
/* make sure the file history is shown */
gnc_history_update_menu(app);
gnc_history_update_menu (GTK_WIDGET (app));
}
static void
@ -198,7 +195,7 @@ gnc_main_window_child_set_title (GNCMainChildInfo *childwin)
if (!childwin || !childwin->app)
return;
filename = gnc_book_get_url (gncGetCurrentBook ());
filename = gnc_book_get_url (gnc_get_current_book ());
if (!filename)
filename = _("<no file>");
@ -246,15 +243,17 @@ static void
gnc_refresh_main_window_info (void)
{
GList *containers = gtk_container_get_toplevels ();
while (containers) {
while (containers)
{
GtkWidget *w = containers->data;
if (GNOME_IS_APP (w)) {
if (GNOME_IS_APP (w))
{
gnc_app_set_title (GNOME_APP (w));
gnc_history_update_menu(GNOME_APP(w));
gnc_history_update_menu (w);
}
containers = containers->next;
}
}
@ -684,8 +683,8 @@ gnc_main_window_options_cb(GtkWidget *widget, gpointer data) {
static void
gnc_main_window_file_new_file_cb(GtkWidget * widget) {
gncFileNew();
gnc_refresh_main_window_info();
gnc_file_new ();
gnc_refresh_main_window_info ();
}
static void
@ -704,25 +703,25 @@ gnc_main_window_file_new_window_cb(GtkWidget * widget, GnomeMDI * mdi) {
static void
gnc_main_window_file_open_cb(GtkWidget * widget) {
gncFileOpen();
gnc_refresh_main_window_info();
gnc_file_open ();
gnc_refresh_main_window_info ();
}
static void
gnc_main_window_file_save_cb(GtkWidget * widget) {
gncFileSave();
gnc_refresh_main_window_info();
gnc_file_save ();
gnc_refresh_main_window_info ();
}
static void
gnc_main_window_file_save_as_cb(GtkWidget * widget) {
gncFileSaveAs();
gnc_refresh_main_window_info();
gnc_file_save_as ();
gnc_refresh_main_window_info ();
}
static void
gnc_main_window_file_import_cb(GtkWidget * widget) {
gncFileQIFImport();
gnc_file_qif_import ();
}
static void
@ -733,7 +732,7 @@ gnc_main_window_file_export_cb(GtkWidget * widget) {
FILE *file;
int rc;
filename = fileBox (_("Export"), NULL, NULL);
filename = gnc_file_dialog (_("Export"), NULL, NULL);
if (!filename)
return;
@ -803,8 +802,8 @@ gnc_main_window_file_export_cb(GtkWidget * widget) {
if (rc == EOF)
break;
write_commodities (file, gncGetCurrentBook ());
write_accounts (file, gncGetCurrentBook ());
write_commodities (file, gnc_get_current_book ());
write_accounts (file, gnc_get_current_book ());
rc = fputs ("<\\gnc-v2>\n", file);
if (rc == EOF)

View File

@ -34,7 +34,6 @@
#include <time.h>
#include "AccWindow.h"
#include "FileDialog.h"
#include "Scrub.h"
#include "dialog-find-transactions.h"
#include "dialog-transfer.h"
@ -1221,7 +1220,7 @@ gnc_register_scrub_all_cb (GtkWidget *widget, gpointer data)
gnc_suspend_gui_refresh ();
root = gncGetCurrentGroup ();
root = gnc_get_current_group ();
for (node = xaccQueryGetSplits (query); node; node = node->next)
{
@ -1251,7 +1250,7 @@ gnc_register_scrub_current_cb (GtkWidget *widget, gpointer data)
gnc_suspend_gui_refresh ();
root = gncGetCurrentGroup ();
root = gnc_get_current_group ();
xaccTransScrubOrphans (trans, root);
xaccTransScrubImbalance (trans, root, NULL);
@ -2318,7 +2317,7 @@ account_latest_price (Account *account)
commodity = xaccAccountGetCommodity (account);
currency = gnc_default_currency ();
book = gncGetCurrentBook ();
book = gnc_get_current_book ();
pdb = gnc_book_get_pricedb (book);
return gnc_pricedb_lookup_latest (pdb, commodity, currency);
@ -3334,7 +3333,7 @@ invoiceTransCB (GtkWidget *widget, gpointer data)
query = xaccMallocQuery ();
xaccQuerySetGroup (query, gncGetCurrentGroup ());
xaccQuerySetGroup (query, gnc_get_current_group ());
xaccQueryAddGUIDMatch (query, xaccSplitGetGUID (split), QUERY_AND);

View File

@ -32,11 +32,11 @@
#include <g-wrap-runtime-guile.h>
#include "FileBox.h"
#include "dialog-options.h"
#include "dialog-utils.h"
#include "gnc-component-manager.h"
#include "gnc-engine-util.h"
#include "gnc-file-dialog.h"
#include "gnc-gui-query.h"
#include "gnc-html-history.h"
#include "gnc-html.h"
@ -339,7 +339,7 @@ gnc_report_window_export_button_cb(GtkWidget * w, gpointer data) {
{
const char *filepath;
filepath = fileBox (_("Save HTML To File"), NULL, NULL);
filepath = gnc_file_dialog (_("Save HTML To File"), NULL, NULL);
if (!filepath)
return TRUE;

View File

@ -13,6 +13,7 @@ INCLUDES = \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src/app-file \
-I${top_srcdir}/src/gnome-utils \
-I${top_srcdir}/src \
-I${top_srcdir}/src/gnome \
@ -42,6 +43,9 @@ libgncmod_binary_import_la_LIBADD = \
-L${top_srcdir}/src/app-utils \
-L${top_srcdir}/src/app-utils/.libs \
-lgncmod-app-utils \
-L${top_srcdir}/src/app-file \
-L${top_srcdir}/src/app-file/.libs \
-lgncmod-app-file \
-L${top_srcdir}/src/gnome-utils \
-L${top_srcdir}/src/gnome-utils/.libs \
-lgncmod-gnome-utils \
@ -66,6 +70,7 @@ gladedir = $(GNC_GLADE_DIR)
glade_DATA = binary-import.glade
EXTRA_DIST = \
.cvsignore \
${gncmod_DATA} \
${gwmod_DATA} \
${glade_DATA}
@ -86,6 +91,3 @@ gw-binary-import.c gw-binary-import.h: .scm-links gw-binary-import-spec.scm
BUILT_SOURCES += gw-binary-import.c gw-binary-import.h
CLEANFILES += gw-binary-import.c gw-binary-import.h gw-binary-import.html \
gnucash g-wrapped .scm-links
EXTRA_DIST = \
.cvsignore

View File

@ -31,7 +31,6 @@
#include <glib.h>
#include <assert.h>
#include "FileDialog.h"
#include "Scrub.h"
#include "dialog-commodity.h"
#include "dialog-utils.h"
@ -40,6 +39,7 @@
#include "gnc-commodity.h"
#include "gnc-engine-util.h"
#include "gnc-engine.h"
#include "gnc-file.h"
#include "gnc-gui-query.h"
#include "gnc-pricedb-p.h"
#include "gnc-ui-util.h"
@ -114,7 +114,7 @@ window_delete_cb(GtkWidget *widget,
CommodityDruid *cd = user_data;
/* unload the current file (can't have out-of-date commodities) */
gncFileQuit();
gnc_file_quit ();
gnc_ui_commodity_druid_destroy (cd);
@ -382,8 +382,8 @@ gnc_ui_commodity_druid_cancel_cb(GnomeDruidPage * page, gpointer druid,
gnc_ui_commodity_druid_destroy(cd);
/* unload the current file (can't have out-of-date commodities) */
gncFileQuit();
gncFileNew();
gnc_file_quit ();
gnc_file_new ();
return TRUE;
}

View File

@ -54,6 +54,11 @@ gnc_module_init(int refcount) {
return FALSE;
}
/* load the calculation module (we depend on it) */
if(!gnc_module_load("gnucash/app-file", 0)) {
return FALSE;
}
/* load the calculation module (we depend on it) */
if(!gnc_module_load("gnucash/gnome-utils", 0)) {
return FALSE;

View File

@ -15,6 +15,7 @@ LDADD = \
-L${top_srcdir}/src/network-utils -L${top_srcdir}/src/network-utils/.libs \
-L${top_srcdir}/src/app-utils -L${top_srcdir}/src/app-utils/.libs \
-L${top_srcdir}/src/gnome-utils -L${top_srcdir}/src/gnome-utils/.libs \
-L${top_srcdir}/src/app-file -L${top_srcdir}/src/app-file/.libs \
${top_srcdir}/src/gnc-module/libgncmodule.la \
${top_srcdir}/src/engine/libgncmod-engine.la \
${top_srcdir}/src/app-utils/libgncmod-app-utils.la \

View File

@ -44,6 +44,7 @@ INCLUDES = \
-I${top_srcdir}/src/engine \
-I${top_srcdir}/src/gnc-module \
-I${top_srcdir}/src/app-utils \
-I${top_srcdir}/src/app-file \
-I${top_srcdir}/src/guile \
-I${top_srcdir}/src/gnome \
-I${top_srcdir}/src/gnome-utils \

View File

@ -32,8 +32,6 @@
#include <unistd.h>
#include "Account.h"
#include "FileBox.h"
#include "FileDialog.h"
#include "dialog-account-picker.h"
#include "dialog-commodity.h"
#include "dialog-utils.h"
@ -42,6 +40,7 @@
#include "global-options.h"
#include "gnc-component-manager.h"
#include "gnc-engine-util.h"
#include "gnc-file-dialog.h"
#include "gnc-gui-query.h"
#include "gnc-ui-util.h"
#include "gnc-ui.h"
@ -340,7 +339,7 @@ gnc_ui_qif_import_select_file_cb(GtkButton * button,
QIFImportWindow * wind = user_data;
const char * new_file_name;
new_file_name = fileBox(_("Select QIF File"), "*.qif", "");
new_file_name = gnc_file_dialog (_("Select QIF File"), "*.qif", "");
/* set the filename entry for what was selected */
if(wind->filename_entry) {
@ -1665,7 +1664,7 @@ gnc_ui_qif_import_druid_get_mappings(QIFImportWindow * w) {
/* ======================================================== */
void
gncFileQIFImport (void)
gnc_file_qif_import (void)
{
/* pop up the QIF File Import dialog box */
gnc_ui_qif_import_druid_make();

View File

@ -21,8 +21,8 @@
* Boston, MA 02111-1307, USA gnu@gnu.org *
\********************************************************************/
#ifndef __DIALOG_QIF_IMPORT_H_
#define __DIALOG_QIF_IMPORT_H_
#ifndef DIALOG_QIF_IMPORT_H
#define DIALOG_QIF_IMPORT_H
#include <guile/gh.h>
@ -31,4 +31,12 @@
QIFImportWindow * gnc_ui_qif_import_druid_make(void);
void gnc_ui_qif_import_druid_destroy (QIFImportWindow * window);
SCM gnc_ui_qif_import_druid_get_mappings(QIFImportWindow * w);
/* The gnc_file_qif_import() routine will pop up a standard file
* selection dialogue asking the user to pick a QIF file. If one
* is selected the the QIF file is opened and read. It's contents
* are merged into the existing session (if any). The current
* session continues to remain open for editing. */
void gnc_file_qif_import (void);
#endif

View File

@ -146,6 +146,7 @@
;; Hopefully we can gradually make them autoloading.
(gnc:module-load "gnucash/engine" 0)
(gnc:module-load "gnucash/app-utils" 0)
(gnc:module-load "gnucash/app-file" 0)
(gnc:module-load "gnucash/register/ledger-core" 0)
(gnc:module-load "gnucash/register/register-core" 0)
(gnc:module-load "gnucash/register/register-gnome" 0)