GnuCash Daily Diff
Dave Peticolas
peticolas@linas.org
Tue, 22 May 2001 08:03:26 -0500 (CDT)
Index: gnucash/ChangeLog
diff -u gnucash/ChangeLog:1.497 gnucash/ChangeLog:1.501
--- gnucash/ChangeLog:1.497 Mon May 21 04:03:19 2001
+++ gnucash/ChangeLog Tue May 22 02:48:23 2001
@@ -1,4 +1,22 @@
+2001-05-22 Dave Peticolas <dave@krondo.com>
+
+ * src/gnome/druid-qif-import.c: fix scrollbar bug. raise qif
+ window to top
+
2001-05-21 Dave Peticolas <dave@krondo.com>
+
+ * src/gnome/window-main.c: remove cruft
+
+ * src/gnome/new-user-callbacks.c: use gncp_new_user_finish
+
+ * src/gnome/new-user-funs.c: finish new user choices dialog.
+ (gncp_new_user_finish): new func
+
+ * src/scm/main.scm: use new 'new user' call
+
+ * src/guile/gnc.gwp: change new user api
+
+ * src/guile/gnucash.h: change new user api
* doc/sgml/C/xacc-balancesheet.sgml: fix warning
Index: gnucash/src/engine/BackendP.h
diff -u gnucash/src/engine/BackendP.h:1.15 gnucash/src/engine/BackendP.h:1.16
--- gnucash/src/engine/BackendP.h:1.15 Wed May 9 18:03:35 2001
+++ gnucash/src/engine/BackendP.h Tue May 22 01:27:06 2001
@@ -144,6 +144,7 @@
void (*book_begin) (GNCBook *, const char *book_id,
gboolean ignore_lock, gboolean create_if_nonexistent);
AccountGroup * (*book_load) (Backend *);
+ GNCPriceDB * (*price_load) (Backend *);
void (*book_end) (Backend *);
int (*account_begin_edit) (Backend *, Account *);
int (*account_commit_edit) (Backend *, Account *);
@@ -153,6 +154,7 @@
void (*run_query) (Backend *, Query *);
void (*sync) (Backend *, AccountGroup *);
+ void (*sync_price) (Backend *, GNCPriceDB *);
gboolean (*events_pending) (Backend *be);
gboolean (*process_events) (Backend *be);
Index: gnucash/src/engine/NetIO.c
diff -u gnucash/src/engine/NetIO.c:1.9 gnucash/src/engine/NetIO.c:1.10
--- gnucash/src/engine/NetIO.c:1.9 Tue Apr 17 04:32:02 2001
+++ gnucash/src/engine/NetIO.c Tue May 22 01:27:06 2001
@@ -294,6 +294,7 @@
/* generic backend handlers */
be->be.book_begin = NULL;
be->be.book_load = xmlbeBookLoad;
+ be->be.price_load = NULL;
be->be.book_end = xmlbeBookEnd;
be->be.account_begin_edit = NULL;
@@ -303,6 +304,9 @@
be->be.trans_rollback_edit = NULL;
be->be.run_query = xmlbeRunQuery;
be->be.sync = NULL;
+ be->be.sync_price = NULL;
+ be->be.events_pending = NULL;
+ be->be.process_events = NULL;
be->be.last_err = ERR_BACKEND_NO_ERR;
Index: gnucash/src/engine/gnc-book.c
diff -u gnucash/src/engine/gnc-book.c:1.36 gnucash/src/engine/gnc-book.c:1.37
--- gnucash/src/engine/gnc-book.c:1.36 Mon May 14 03:38:24 2001
+++ gnucash/src/engine/gnc-book.c Tue May 22 01:27:07 2001
@@ -80,12 +80,14 @@
* This is a 'stack' that is one deep.
* FIXME: This is a hack. I'm trying to move us away from static
* global vars. This may be a temp fix if we decide to integrate
- * FileIO errors into GNCBook errors. */
+ * FileIO errors into GNCBook errors.
+ */
GNCBackendError last_err;
char *error_message;
/* ---------------------------------------------------- */
/* the following struct members apply only for file-io */
+ /* these should be moved to a file-io backend. */
/* the fully-resolved path to the file */
char *fullpath;
@@ -95,8 +97,8 @@
int lockfd;
/* ---------------------------------------------------- */
- /* This struct member applies for network and SQL i/o */
- /* It is not currently used for file i/o, but maybe it should be ?? */
+ /* This struct member applies for network, rpc and SQL i/o */
+ /* It is not currently used for file i/o, but it should be. */
Backend *backend;
};
@@ -768,7 +770,7 @@
/* For the rpc backend, do the equivalent of
* the statically loaded
- * book->backend = pgendNew (); */
+ * book->backend = rpcendNew (); */
rpc_new = dlsym (dll_handle, "rpcendNew");
dll_err = dlerror();
if (dll_err)
@@ -828,39 +830,35 @@
if (strncmp(book->book_id, "file:", 5) == 0)
{
- /* file: */
-
if (!book->lockfile)
{
gnc_book_push_error (book, ERR_BACKEND_LOCKED, NULL);
return FALSE;
}
+ }
- /* At this point, we should are supposed to have a valid book
- * id and a lock on the file. */
-
- xaccLogDisable();
- xaccGroupMarkDoFree (book->topgroup);
- xaccFreeAccountGroup (book->topgroup);
- book->topgroup = NULL;
- gnc_pricedb_destroy(book->pricedb);
- book->pricedb = NULL;
+ /* At this point, we should are supposed to have a valid book
+ * id and a lock on the file. */
- xaccLogSetBaseName(book->fullpath);
-
- gnc_book_clear_error (book);
- gnc_book_load_from_file(book);
+ xaccLogDisable();
+ xaccGroupMarkDoFree (book->topgroup);
+ xaccFreeAccountGroup (book->topgroup);
+ book->topgroup = NULL;
+ gnc_pricedb_destroy(book->pricedb);
+ book->pricedb = NULL;
- xaccLogEnable();
+ xaccLogSetBaseName(book->fullpath);
+ xaccLogEnable();
- if (!book->topgroup) return FALSE;
- if (!book->pricedb) return FALSE;
- if (gnc_book_get_error(book) != ERR_BACKEND_NO_ERR) return FALSE;
+ gnc_book_clear_error (book);
+ if (strncmp(book->book_id, "file:", 5) == 0)
+ {
+ xaccLogDisable();
+ gnc_book_load_from_file(book);
xaccGroupScrubSplits (book->topgroup);
+ xaccLogEnable();
- LEAVE("book_id=%s", book->book_id ? book->book_id : "(null)");
- return TRUE;
}
else if ((strncmp(book->book_id, "http://", 7) == 0) ||
(strncmp(book->book_id, "https://", 8) == 0) ||
@@ -875,15 +873,8 @@
* generic, backend-independent operation.
*/
Backend *be = book->backend;
- xaccLogDisable();
- xaccGroupMarkDoFree (book->topgroup);
- xaccFreeAccountGroup (book->topgroup);
- xaccLogEnable();
- book->topgroup = NULL;
-
- gnc_book_clear_error (book);
- /* starting the session should result in a bunch of accounts
+ /* Starting the session should result in a bunch of accounts
* and currencies being downloaded, but probably no transactions;
* The GUI will need to do a query for that.
*/
@@ -893,21 +884,30 @@
xaccLogSetBaseName(book->fullpath);
book->topgroup = (be->book_load) (be);
-
xaccGroupSetBackend (book->topgroup, be);
-
gnc_book_push_error(book, xaccBackendGetError(be), NULL);
+
+ if (be->price_load)
+ {
+ book->pricedb = (be->price_load) (be);
+ gnc_book_push_error(book, xaccBackendGetError(be), NULL);
+ }
xaccLogEnable();
}
- LEAVE("book_id=%s", book->book_id ? book->book_id : "(null)");
- return TRUE;
}
else
{
gnc_book_push_error (book, ERR_BACKEND_NO_BACKEND, NULL);
return FALSE;
}
+
+ if (!book->topgroup) return FALSE;
+ if (!book->pricedb) return FALSE;
+ if (gnc_book_get_error(book) != ERR_BACKEND_NO_ERR) return FALSE;
+
+ LEAVE("book_id=%s", book->book_id ? book->book_id : "(null)");
+ return TRUE;
}
/* ---------------------------------------------------------------------- */
@@ -957,21 +957,40 @@
* then give the user the option to save to disk.
*/
be = book->backend;
- if (be && be->sync && book->topgroup) {
- GNCBackendError err;
+ if (be) {
/* if invoked as SaveAs(), then backend not yet set */
xaccGroupSetBackend (book->topgroup, be);
+
+ if (be->sync && book->topgroup) {
+ GNCBackendError err;
+ (be->sync)(be, book->topgroup);
+ err = xaccBackendGetError(be);
+
+ if (ERR_BACKEND_NO_ERR != err) {
+ gnc_book_push_error (book, err, NULL);
+
+ /* we close the backend here ... isn't this a bit harsh ??? */
+ if (be->book_end) {
+ (be->book_end)(be);
+ return;
+ }
+ }
+ }
- (be->sync)(be, book->topgroup);
- err = xaccBackendGetError(be);
+ if (be->sync_price && book->pricedb) {
+ GNCBackendError err;
+ (be->sync_price)(be, book->pricedb);
+ err = xaccBackendGetError(be);
- if (ERR_BACKEND_NO_ERR != err) {
- gnc_book_push_error (book, err, NULL);
+ if (ERR_BACKEND_NO_ERR != err) {
+ gnc_book_push_error (book, err, NULL);
- /* we close the backend here ... isn't this a bit harsh ??? */
- if (be->book_end) {
- (be->book_end)(be);
+ /* we close the backend here ... isn't this a bit harsh ??? */
+ if (be->book_end) {
+ (be->book_end)(be);
+ return;
+ }
}
}
return;
@@ -1290,6 +1309,7 @@
return (xaccResolveFilePath (pathfrag));
}
+/* ---------------------------------------------------------------------- */
void
gnc_run_rpc_server (void)
Index: gnucash/src/engine/rpc/RpcBackend.c
diff -u gnucash/src/engine/rpc/RpcBackend.c:1.3 gnucash/src/engine/rpc/RpcBackend.c:1.4
--- gnucash/src/engine/rpc/RpcBackend.c:1.3 Wed May 9 19:12:44 2001
+++ gnucash/src/engine/rpc/RpcBackend.c Tue May 22 01:27:08 2001
@@ -33,6 +33,7 @@
#include "gnc-engine.h"
#include "gnc-engine-util.h"
#include "gnc-event.h"
+#include "gnc-pricedb.h"
#include "guid.h"
#include "TransactionP.h"
@@ -99,6 +100,7 @@
be->be.trans_rollback_edit = be->snr.trans_rollback_edit;
be->be.run_query = be->snr.run_query;
be->be.sync = be->snr.sync;
+ be->be.sync_price = be->snr.sync_price;
}
static void rpcendDisable (RPCBackend *be)
@@ -118,6 +120,7 @@
be->snr.trans_rollback_edit = be->be.trans_rollback_edit;
be->snr.run_query = be->be.run_query;
be->snr.sync = be->be.sync;
+ be->snr.sync_price = be->be.sync_price;
/* And turn off future calls */
be->be.account_begin_edit = NULL;
@@ -127,6 +130,7 @@
be->be.trans_rollback_edit = NULL;
be->be.run_query = NULL;
be->be.sync = NULL;
+ be->be.sync_price = NULL;
}
static void myClose (void *arg)
@@ -316,7 +320,8 @@
/*
* book_load will only load the commodity table and account tree
*/
-static AccountGroup * rpcend_book_load (Backend *bend)
+static AccountGroup *
+rpcend_book_load (Backend *bend)
{
RPCBackend *be = (RPCBackend *)bend;
AccountGroup *ag = NULL;
@@ -368,6 +373,14 @@
return ag;
}
+static GNCPriceDB *
+rpcend_price_load (Backend *bend)
+{
+ /* XXX hack alert -- implement this */
+ PERR ("price loading not implemented");
+ return gnc_pricedb_create();
+}
+
static void rpcend_book_end (Backend *bend)
{
RPCBackend *be = (RPCBackend *)bend;
@@ -666,7 +679,8 @@
LEAVE ("be=%p, q=%p", be, q);
}
-static void rpcend_sync (Backend *bend, AccountGroup *acctgrp)
+static void
+rpcend_sync (Backend *bend, AccountGroup *acctgrp)
{
RPCBackend *be = (RPCBackend *)bend;
gncrpc_sync1_args args1;
@@ -747,6 +761,13 @@
return;
}
+static void
+rpcend_sync_price (Backend *bend, GNCPriceDB *prdb)
+{
+ /* XXX hack alert -- implement this */
+ PERR ("Price saving not implemented");
+}
+
static gboolean rpcend_events_pending (Backend *bend)
{
RPCBackend *be = (RPCBackend *)bend;
@@ -876,9 +897,11 @@
}
/* Setup callbacks */
+ /* XXX hack alert -- need to implement price saving/loading */
rpcendEnable (be);
be->be.book_end = rpcend_book_end;
be->be.book_load = rpcend_book_load;
+ be->be.price_load = rpcend_price_load;
be->be.account_begin_edit = rpcend_account_begin_edit;
be->be.account_commit_edit = rpcend_account_commit_edit;
be->be.trans_begin_edit = rpcend_trans_begin_edit;
@@ -886,6 +909,7 @@
be->be.trans_rollback_edit = rpcend_trans_rollback_edit;
be->be.run_query = rpcend_run_query;
be->be.sync = rpcend_sync;
+ be->be.sync_price = rpcend_sync_price;
be->be.events_pending = rpcend_events_pending;
be->be.process_events = rpcend_process_events;
Index: gnucash/src/engine/sql/Makefile.am
diff -u gnucash/src/engine/sql/Makefile.am:1.11 gnucash/src/engine/sql/Makefile.am:1.12
--- gnucash/src/engine/sql/Makefile.am:1.11 Fri May 11 14:57:13 2001
+++ gnucash/src/engine/sql/Makefile.am Tue May 22 01:27:11 2001
@@ -2,7 +2,7 @@
# Build the postgres backend as its own loadable shared object.
lib_LTLIBRARIES = libgnc_postgres.la
-libgnc_postgres_la_LDFLAGS = -version-info 6:1:6
+libgnc_postgres_la_LDFLAGS = -version-info 6:2:6
libgnc_postgres_la_SOURCES = \
Index: gnucash/src/engine/sql/PostgresBackend.c
diff -u gnucash/src/engine/sql/PostgresBackend.c:1.39 gnucash/src/engine/sql/PostgresBackend.c:1.40
--- gnucash/src/engine/sql/PostgresBackend.c:1.39 Thu May 10 11:49:44 2001
+++ gnucash/src/engine/sql/PostgresBackend.c Tue May 22 01:27:11 2001
@@ -1,3 +1,25 @@
+/********************************************************************\
+ * PostgresBackend.c -- implements postgres backend *
+ * *
+ * 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, contact: *
+ * *
+ * Free Software Foundation Voice: +1-617-542-5942 *
+ * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
+ * Boston, MA 02111-1307, USA gnu@gnu.org *
+\********************************************************************/
+
+
/*
* FILE:
* PostgresBackend.c
@@ -1270,6 +1292,59 @@
/* ============================================================= */
/* ============================================================= */
+/* PRICE STUFF */
+/* ============================================================= */
+/* ============================================================= */
+
+static void
+pgendStorePriceDBNoLock (PGBackend *be, GNCPriceDB *prdb)
+{
+ PERR ("not implemented");
+}
+
+static void
+pgendStorePriceDB (PGBackend *be, GNCPriceDB *prdb)
+{
+ char *p;
+ ENTER ("be=%p, prdb=%p", be, prdb);
+ if (!be || !prdb) return;
+
+ /* lock it up so that we store atomically */
+ p = "BEGIN;\n"
+ "LOCK TABLE gncPrice IN EXCLUSIVE MODE;\n";
+ SEND_QUERY (be,p, );
+ FINISH_QUERY(be->connection);
+
+ pgendStorePriceDBNoLock (be, prdb);
+
+ p = "COMMIT;";
+ SEND_QUERY (be,p, );
+ FINISH_QUERY(be->connection);
+ LEAVE(" ");
+}
+
+/* ============================================================= */
+/* The pgendGetAllPrices() routine sucks *all* of the
+ * prices out of the database. This is a potential
+ * CPU and memory-burner; its use is not suggested for anything
+ * but single-user mode.
+ */
+
+static GNCPriceDB *
+pgendGetAllPrices (PGBackend *be)
+{
+ GNCPriceDB *prdb;
+
+ prdb = gnc_pricedb_create();
+
+ /* XXX Not finished */
+ PERR ("postgress backend price db loading not implemented");
+
+ return prdb;
+}
+
+/* ============================================================= */
+/* ============================================================= */
/* HIGHER LEVEL ROUTINES AND BACKEND PROPER */
/* ============================================================= */
/* ============================================================= */
@@ -1577,6 +1652,57 @@
/* ============================================================= */
+static void
+pgendSyncPriceDB (Backend *bend, GNCPriceDB *prdb)
+{
+ PERR ("not implemented");
+}
+
+/* ============================================================= */
+/* The pgendSyncPriceSingleFile() routine syncs the prices in the
+ * engine with the database.
+ * In single file mode, we treat 'sync' as 'file save'.
+ * We start by deleting *everything*, and then writing
+ * everything out. This is rather nasty, ugly and dangerous,
+ * but that's the nature of single-file mode. Note: we
+ * have to delete everything because in this mode, there is
+ * no other way of finding out that a price was deleted.
+ * i.e. there's no other way to delete.
+ * So start with a clean slate.
+ *
+ * The use of this routine/this mode is 'depricated'.
+ * Its handy for testing, sanity-checking, and as a failsafe,
+ * but its use shouldn't be encouraged.
+ *
+ * XXX hack alert -- database consistency depends on commodities
+ * having been stored with the pgendSyncSingleFile() routine.
+ */
+
+static void
+pgendSyncPriceDBSingleFile (Backend *bend, GNCPriceDB *prdb)
+{
+ char *p;
+ PGBackend *be = (PGBackend *)bend;
+ ENTER ("be=%p, prdb=%p", be, prdb);
+
+ p = "BEGIN;\n"
+ "LOCK TABLE gncPrice IN EXCLUSIVE MODE;\n"
+ "DELETE FROM gncPrice;\n";
+ SEND_QUERY (be,p, );
+ FINISH_QUERY(be->connection);
+
+ /* Store accounts and commodities */
+ pgendStorePriceDBNoLock (be, prdb);
+
+ p = "COMMIT;";
+ SEND_QUERY (be,p, );
+ FINISH_QUERY(be->connection);
+
+ LEAVE(" ");
+}
+
+/* ============================================================= */
+
static const char *
pgendSessionGetMode (PGBackend *be)
{
@@ -1903,6 +2029,31 @@
}
/* ============================================================= */
+/* The pgend_price_load_single() routine loads the engine with
+ * price data from the database.
+ */
+
+static GNCPriceDB *
+pgend_price_load_single (Backend *bend)
+{
+ GNCPriceDB *prdb;
+ PGBackend *be = (PGBackend *)bend;
+ if (!be) return NULL;
+
+ /* don't send events to GUI, don't accept callaback to backend */
+ gnc_engine_suspend_events();
+ pgendDisable(be);
+
+ prdb = pgendGetAllPrices (be);
+
+ /* re-enable events */
+ pgendEnable(be);
+ gnc_engine_resume_events();
+
+ return prdb;
+}
+
+/* ============================================================= */
/* The pgend_session_begin() routine implements the main entrypoint
* into the SQL backend code.
*
@@ -2203,6 +2354,7 @@
case MODE_SINGLE_FILE:
pgendEnable(be);
be->be.book_load = pgend_book_load_single;
+ be->be.price_load = pgend_price_load_single;
be->be.account_begin_edit = NULL;
be->be.account_commit_edit = NULL;
be->be.trans_begin_edit = NULL;
@@ -2210,6 +2362,7 @@
be->be.trans_rollback_edit = NULL;
be->be.run_query = NULL;
be->be.sync = pgendSyncSingleFile;
+ be->be.sync_price = pgendSyncPriceDBSingleFile;
PWARN ("MODE_SINGLE_FILE is beta -- \n"
"we've fixed all known bugs but that doesn't mean\n"
"there aren't any!\n");
@@ -2218,6 +2371,7 @@
case MODE_SINGLE_UPDATE:
pgendEnable(be);
be->be.book_load = pgend_book_load_single;
+ be->be.price_load = pgend_price_load_single;
be->be.account_begin_edit = NULL;
be->be.account_commit_edit = pgend_account_commit_edit;
be->be.trans_begin_edit = NULL;
@@ -2225,7 +2379,8 @@
be->be.trans_rollback_edit = NULL;
be->be.run_query = NULL;
be->be.sync = pgendSync;
- PWARN ("MODE_SINGLE_FILE is beta -- \n"
+ be->be.sync_price = pgendSyncPriceDB;
+ PWARN ("MODE_SINGLE_UPDATE is beta -- \n"
"we've fixed all known bugs but that doesn't mean\n"
"there aren't any!\n");
break;
@@ -2240,6 +2395,7 @@
be->be.trans_rollback_edit = NULL;
be->be.run_query = pgendRunQuery;
be->be.sync = pgendSync;
+ be->be.sync_price = pgendSyncPriceDB;
PWARN ("MODE_POLL is experimental -- you might corrupt your data\n");
break;
@@ -2278,6 +2434,7 @@
be->snr.trans_rollback_edit = be->be.trans_rollback_edit;
be->snr.run_query = be->be.run_query;
be->snr.sync = be->be.sync;
+ be->snr.sync_price = be->be.sync_price;
be->be.account_begin_edit = NULL;
be->be.account_commit_edit = NULL;
@@ -2286,6 +2443,7 @@
be->be.trans_rollback_edit = NULL;
be->be.run_query = NULL;
be->be.sync = NULL;
+ be->be.sync_price = NULL;
}
/* ============================================================= */
@@ -2309,6 +2467,7 @@
be->be.trans_rollback_edit = be->snr.trans_rollback_edit;
be->be.run_query = be->snr.run_query;
be->be.sync = be->snr.sync;
+ be->be.sync_price = be->snr.sync_price;
}
/* ============================================================= */
@@ -2331,6 +2490,7 @@
/* generic backend handlers */
be->be.book_begin = pgend_session_begin;
be->be.book_load = NULL;
+ be->be.price_load = NULL;
be->be.book_end = pgend_session_end;
be->be.account_begin_edit = NULL;
@@ -2340,6 +2500,9 @@
be->be.trans_rollback_edit = NULL;
be->be.run_query = NULL;
be->be.sync = NULL;
+ be->be.sync_price = NULL;
+ be->be.events_pending = NULL;
+ be->be.process_events = NULL;
be->nest_count = 0;
pgendDisable(be);
Index: gnucash/src/gnome/druid-qif-import.c
diff -u gnucash/src/gnome/druid-qif-import.c:1.33 gnucash/src/gnome/druid-qif-import.c:1.35
--- gnucash/src/gnome/druid-qif-import.c:1.33 Mon May 14 17:16:43 2001
+++ gnucash/src/gnome/druid-qif-import.c Tue May 22 02:48:24 2001
@@ -264,7 +264,8 @@
}
gtk_widget_show_all(retval->window);
-
+ gdk_window_raise (retval->window->window);
+
return retval;
}
@@ -872,7 +873,10 @@
if(sel_item >= 0) {
gtk_clist_select_row(GTK_CLIST(wind->selected_file_list), sel_item, 0);
- }
+ }
+
+ /* Wheee! Look at me! I'm a little one-line hack to make stuff work! */
+ gtk_widget_queue_resize (wind->window);
}
Index: gnucash/src/gnome/new-user-callbacks.c
diff -u gnucash/src/gnome/new-user-callbacks.c:1.9 gnucash/src/gnome/new-user-callbacks.c:1.10
--- gnucash/src/gnome/new-user-callbacks.c:1.9 Tue May 15 10:50:45 2001
+++ gnucash/src/gnome/new-user-callbacks.c Mon May 21 16:27:32 2001
@@ -110,9 +110,7 @@
gnc_ui_delete_new_user_window();
- gh_eval_str("(gnc:default-ui-start)");
- gh_eval_str("(gnc:show-main-window)");
- gh_eval_str("(gnc:hook-run-danglers gnc:*book-opened-hook* #f)");
+ gncp_new_user_finish();
set_first_startup(0);
@@ -150,10 +148,8 @@
gnc_ui_delete_new_user_window();
gnc_ui_delete_nu_cancel_dialog();
-
- gh_eval_str("(gnc:default-ui-start)");
- gh_eval_str("(gnc:show-main-window)");
- gh_eval_str("(gnc:hook-run-danglers gnc:*book-opened-hook* #f)");
+
+ gncp_new_user_finish();
}
void
@@ -650,4 +646,3 @@
return FALSE;
}
-
Index: gnucash/src/gnome/new-user-funs.c
diff -u gnucash/src/gnome/new-user-funs.c:1.8 gnucash/src/gnome/new-user-funs.c:1.9
--- gnucash/src/gnome/new-user-funs.c:1.8 Tue May 15 10:50:45 2001
+++ gnucash/src/gnome/new-user-funs.c Mon May 21 16:27:33 2001
@@ -26,13 +26,16 @@
#include <guile/gh.h>
#include <stdio.h>
+#include "druid-qif-import.h"
#include "new-user-callbacks.h"
#include "new-user-interface.h"
#include "new-user-funs.h"
#include "glade-support.h"
#include "gnc-amount-edit.h"
#include "gnc-currency-edit.h"
+#include "gnc-ui.h"
#include "gnc-ui-util.h"
+#include "window-help.h"
#include "Group.h"
#include "io-example-account.h"
@@ -350,3 +353,58 @@
return deleteit(&cancelDialog);
}
+void
+gnc_ui_show_new_user_choice_window(void)
+{
+ GtkWidget *dialog;
+ GtkWidget *new_accounts_button;
+ GtkWidget *import_qif_button;
+ GtkWidget *tutorial_button;
+ gint result;
+
+ dialog = create_newUserChoiceWindow ();
+
+ gnome_dialog_close_hides (GNOME_DIALOG (dialog), TRUE);
+
+ new_accounts_button = lookup_widget (dialog, "new_accounts_button");
+ import_qif_button = lookup_widget (dialog, "import_qif_button");
+ tutorial_button = lookup_widget (dialog, "tutorial_button");
+
+ result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+ if (result != 0)
+ {
+ gnc_ui_show_nu_cancel_dialog();
+ gtk_widget_destroy (dialog);
+ gncp_new_user_finish ();
+ return;
+ }
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (new_accounts_button)))
+ {
+ gnc_ui_show_new_user_window ();
+ gtk_widget_destroy (dialog);
+ return;
+ }
+
+ if (gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (import_qif_button)))
+ {
+ gnc_ui_qif_import_druid_make ();
+ }
+ else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (tutorial_button)))
+ {
+ /* FIXME: change to tutorial */
+ helpWindow (NULL, NULL, HH_ABOUT);
+ }
+
+ gncp_new_user_finish ();
+ gtk_widget_destroy (dialog);
+}
+
+void
+gncp_new_user_finish (void)
+{
+ gh_eval_str("(gnc:default-ui-start)");
+ gh_eval_str("(gnc:show-main-window)");
+ gh_eval_str("(gnc:hook-run-danglers gnc:*book-opened-hook* #f)");
+}
Index: gnucash/src/gnome/new-user-funs.h
diff -u gnucash/src/gnome/new-user-funs.h:1.6 gnucash/src/gnome/new-user-funs.h:1.7
--- gnucash/src/gnome/new-user-funs.h:1.6 Mon May 21 01:53:36 2001
+++ gnucash/src/gnome/new-user-funs.h Mon May 21 16:27:33 2001
@@ -32,7 +32,7 @@
int gnc_ui_show_new_user_window(void);
int gnc_ui_delete_new_user_window(void);
-int gnc_ui_show_new_user_choice_window(void);
+void gnc_ui_show_new_user_choice_window(void);
int gnc_ui_show_nu_cancel_dialog(void);
int gnc_ui_delete_nu_cancel_dialog(void);
@@ -52,5 +52,6 @@
/* private */
void on_finalAccountBalanceEdit_changed (GNCAmountEdit *gae);
+void gncp_new_user_finish (void);
#endif /* NEW_USER_FUNS_H */
Index: gnucash/src/gnome/new-user-interface.c
diff -u gnucash/src/gnome/new-user-interface.c:1.14 gnucash/src/gnome/new-user-interface.c:1.15
--- gnucash/src/gnome/new-user-interface.c:1.14 Mon May 21 01:53:36 2001
+++ gnucash/src/gnome/new-user-interface.c Mon May 21 16:27:33 2001
@@ -551,9 +551,9 @@
GtkWidget *frame4;
GtkWidget *vbox6;
GSList *new_user_group_group = NULL;
- GtkWidget *radiobutton1;
- GtkWidget *radiobutton2;
- GtkWidget *radiobutton3;
+ GtkWidget *new_accounts_button;
+ GtkWidget *import_qif_button;
+ GtkWidget *tutorial_button;
GtkWidget *dialog_action_area2;
GtkWidget *button1;
GtkWidget *button3;
@@ -585,32 +585,32 @@
gtk_container_add (GTK_CONTAINER (frame4), vbox6);
gtk_container_set_border_width (GTK_CONTAINER (vbox6), 3);
- radiobutton1 = gtk_radio_button_new_with_label (new_user_group_group, _("Create a new set of accounts"));
- new_user_group_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton1));
- gtk_widget_set_name (radiobutton1, "radiobutton1");
- gtk_widget_ref (radiobutton1);
- gtk_object_set_data_full (GTK_OBJECT (newUserChoiceWindow), "radiobutton1", radiobutton1,
+ new_accounts_button = gtk_radio_button_new_with_label (new_user_group_group, _("Create a new set of accounts"));
+ new_user_group_group = gtk_radio_button_group (GTK_RADIO_BUTTON (new_accounts_button));
+ gtk_widget_set_name (new_accounts_button, "new_accounts_button");
+ gtk_widget_ref (new_accounts_button);
+ gtk_object_set_data_full (GTK_OBJECT (newUserChoiceWindow), "new_accounts_button", new_accounts_button,
(GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (radiobutton1);
- gtk_box_pack_start (GTK_BOX (vbox6), radiobutton1, FALSE, FALSE, 0);
+ gtk_widget_show (new_accounts_button);
+ gtk_box_pack_start (GTK_BOX (vbox6), new_accounts_button, FALSE, FALSE, 0);
- radiobutton2 = gtk_radio_button_new_with_label (new_user_group_group, _("Import my QIF files"));
- new_user_group_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton2));
- gtk_widget_set_name (radiobutton2, "radiobutton2");
- gtk_widget_ref (radiobutton2);
- gtk_object_set_data_full (GTK_OBJECT (newUserChoiceWindow), "radiobutton2", radiobutton2,
+ import_qif_button = gtk_radio_button_new_with_label (new_user_group_group, _("Import my QIF files"));
+ new_user_group_group = gtk_radio_button_group (GTK_RADIO_BUTTON (import_qif_button));
+ gtk_widget_set_name (import_qif_button, "import_qif_button");
+ gtk_widget_ref (import_qif_button);
+ gtk_object_set_data_full (GTK_OBJECT (newUserChoiceWindow), "import_qif_button", import_qif_button,
(GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (radiobutton2);
- gtk_box_pack_start (GTK_BOX (vbox6), radiobutton2, FALSE, FALSE, 0);
+ gtk_widget_show (import_qif_button);
+ gtk_box_pack_start (GTK_BOX (vbox6), import_qif_button, FALSE, FALSE, 0);
- radiobutton3 = gtk_radio_button_new_with_label (new_user_group_group, _("Open the new user tutorial"));
- new_user_group_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton3));
- gtk_widget_set_name (radiobutton3, "radiobutton3");
- gtk_widget_ref (radiobutton3);
- gtk_object_set_data_full (GTK_OBJECT (newUserChoiceWindow), "radiobutton3", radiobutton3,
+ tutorial_button = gtk_radio_button_new_with_label (new_user_group_group, _("Open the new user tutorial"));
+ new_user_group_group = gtk_radio_button_group (GTK_RADIO_BUTTON (tutorial_button));
+ gtk_widget_set_name (tutorial_button, "tutorial_button");
+ gtk_widget_ref (tutorial_button);
+ gtk_object_set_data_full (GTK_OBJECT (newUserChoiceWindow), "tutorial_button", tutorial_button,
(GtkDestroyNotify) gtk_widget_unref);
- gtk_widget_show (radiobutton3);
- gtk_box_pack_start (GTK_BOX (vbox6), radiobutton3, FALSE, FALSE, 0);
+ gtk_widget_show (tutorial_button);
+ gtk_box_pack_start (GTK_BOX (vbox6), tutorial_button, FALSE, FALSE, 0);
dialog_action_area2 = GNOME_DIALOG (newUserChoiceWindow)->action_area;
gtk_widget_set_name (dialog_action_area2, "dialog_action_area2");
Index: gnucash/src/gnome/new-user.glade
diff -u gnucash/src/gnome/new-user.glade:1.14 gnucash/src/gnome/new-user.glade:1.15
--- gnucash/src/gnome/new-user.glade:1.14 Mon May 21 01:53:37 2001
+++ gnucash/src/gnome/new-user.glade Mon May 21 16:27:34 2001
@@ -743,7 +743,7 @@
<widget>
<class>GtkRadioButton</class>
- <name>radiobutton1</name>
+ <name>new_accounts_button</name>
<can_focus>True</can_focus>
<label>Create a new set of accounts</label>
<active>False</active>
@@ -758,7 +758,7 @@
<widget>
<class>GtkRadioButton</class>
- <name>radiobutton2</name>
+ <name>import_qif_button</name>
<can_focus>True</can_focus>
<label>Import my QIF files</label>
<active>False</active>
@@ -773,7 +773,7 @@
<widget>
<class>GtkRadioButton</class>
- <name>radiobutton3</name>
+ <name>tutorial_button</name>
<can_focus>True</can_focus>
<label>Open the new user tutorial</label>
<active>False</active>
Index: gnucash/src/gnome/window-main.c
diff -u gnucash/src/gnome/window-main.c:1.126 gnucash/src/gnome/window-main.c:1.127
--- gnucash/src/gnome/window-main.c:1.126 Tue May 15 11:14:25 2001
+++ gnucash/src/gnome/window-main.c Mon May 21 16:42:15 2001
@@ -910,11 +910,6 @@
static void
gnc_main_window_create_menus(GNCMainInfo * maininfo) {
- static GnomeUIInfo gnc_report_new_template[] =
- {
- GNOMEUIINFO_END
- };
-
static GnomeUIInfo gnc_file_menu_template[] =
{
GNOMEUIINFO_MENU_NEW_ITEM(N_("New _File"),
Index: gnucash/src/guile/gnc.gwp
diff -u gnucash/src/guile/gnc.gwp:1.95 gnucash/src/guile/gnc.gwp:1.96
--- gnucash/src/guile/gnc.gwp:1.95 Thu May 10 17:55:05 2001
+++ gnucash/src/guile/gnc.gwp Mon May 21 16:27:36 2001
@@ -2144,11 +2144,11 @@
(gw:wrap-function
mod
- 'gnc:show-new-user-window
- '<gw:int>
- "gnc_ui_show_new_user_window"
+ 'gnc:show-new-user-choice-window
+ '<gw:void>
+ "gnc_ui_show_new_user_choice_window"
'()
- "Show the new user window.")
+ "Show the new user choice window.")
(gw:wrap-function
mod
Index: gnucash/src/guile/gnucash.h
diff -u gnucash/src/guile/gnucash.h:1.12 gnucash/src/guile/gnucash.h:1.13
--- gnucash/src/guile/gnucash.h:1.12 Thu Mar 22 06:26:36 2001
+++ gnucash/src/guile/gnucash.h Mon May 21 16:27:37 2001
@@ -34,7 +34,7 @@
int gnucash_ui_init(void);
int gnc_ui_show_main_window(void);
-int gnc_ui_show_new_user_window(void);
+void gnc_ui_show_new_user_choice_window(void);
int gnc_ui_start_event_loop(void);
int gnc_ui_main(void);
Index: gnucash/src/scm/main.scm
diff -u gnucash/src/scm/main.scm:1.44 gnucash/src/scm/main.scm:1.45
--- gnucash/src/scm/main.scm:1.44 Tue May 15 11:27:55 2001
+++ gnucash/src/scm/main.scm Mon May 21 16:27:38 2001
@@ -163,7 +163,7 @@
(gnc:lookup-global-option "__new_user" "first_startup")))
1))
(begin
- (gnc:show-new-user-window)
+ (gnc:show-new-user-choice-window)
(gnc:start-ui-event-loop))
(begin
(gnc:load-account-file)