* src/gnome-utils/gw-gnome-utils-spec.scm: add wrapping for widgets

and other api

* src/backend/postgres/test/test-db.c: add check for initial
account balances

* src/backend/postgres/PostgresBackend.c: fix bug. begin/commit
account group when loading intitial balances


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@6386 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2001-12-18 01:11:30 +00:00
parent 596dd309c3
commit 465fa68ee6
8 changed files with 320 additions and 15 deletions

View File

@ -1,3 +1,14 @@
2001-12-17 Dave Peticolas <dave@krondo.com>
* src/gnome-utils/gw-gnome-utils-spec.scm: add wrapping for widgets
and other api
* src/backend/postgres/test/test-db.c: add check for initial
account balances
* src/backend/postgres/PostgresBackend.c: fix bug. begin/commit
account group when loading intitial balances
2001-12-12 Dave Peticolas <dave@krondo.com>
* src/report/report-gnome/test/test-load-module: add

View File

@ -1245,7 +1245,10 @@ pgend_book_load_poll (Backend *bend)
pgendKVPInit(be);
pgendGetAllAccounts (be, grp);
xaccAccountGroupBeginEdit (grp);
pgendGroupGetAllBalances (be, grp, ts);
xaccAccountGroupCommitEdit (grp);
/* re-enable events */
pgendEnable(be);

View File

@ -480,8 +480,8 @@ pgendAccountGetBalance (PGBackend *be, Account *acc, Timespec as_of_date)
cleared_baln = gnc_numeric_create (cl_b, deno);
reconciled_baln = gnc_numeric_create (rec_b, deno);
xaccAccountSetStartingBalance (acc, baln,
cleared_baln, reconciled_baln);
xaccAccountSetStartingBalance (acc, baln, cleared_baln, reconciled_baln);
DEBUGCMD ({
char buf[80];
gnc_timespec_to_iso8601_buff (as_of_date, buf);
@ -489,8 +489,6 @@ pgendAccountGetBalance (PGBackend *be, Account *acc, Timespec as_of_date)
xaccAccountGetDescription (acc), buf,
b, deno, cl_b, deno, rec_b, deno);
})
return;
}
/* ============================================================= */

View File

@ -83,8 +83,6 @@ save_db_file (GNCSession *session, const char *db_name, const char *mode)
filename = db_file_url (db_name, mode);
printf("SAVING!!! %s\n", filename);
gnc_session_begin (session, filename, FALSE, TRUE);
io_err = gnc_session_get_error (session);
if (!do_test_args (io_err == ERR_BACKEND_NO_ERR,
@ -594,6 +592,60 @@ test_trans_query (Transaction *trans, gpointer data)
return TRUE;
}
static gboolean
compare_balances (GNCSession *session_1, GNCSession *session_2)
{
GNCBook * book_1 = gnc_session_get_book (session_1);
GNCBook * book_2 = gnc_session_get_book (session_2);
GList * list;
GList * node;
g_return_val_if_fail (session_1, FALSE);
g_return_val_if_fail (session_2, FALSE);
list = xaccGroupGetSubAccounts (gnc_book_get_group (book_1));
for (node = list; node; node = node->next)
{
Account * account_1 = node->data;
Account * account_2;
account_2 = xaccAccountLookup (xaccAccountGetGUID (account_1), book_2);
if (!account_2)
{
g_warning ("session_1 has account %s but not session_2",
guid_to_string (xaccAccountGetGUID (account_1)));
return FALSE;
}
if (!gnc_numeric_eq (xaccAccountGetBalance (account_1),
xaccAccountGetBalance (account_2)))
{
g_warning ("balances not equal for account %s",
guid_to_string (xaccAccountGetGUID (account_1)));
return FALSE;
}
if (!gnc_numeric_eq (xaccAccountGetClearedBalance (account_1),
xaccAccountGetClearedBalance (account_2)))
{
g_warning ("cleared balances not equal for account %s",
guid_to_string (xaccAccountGetGUID (account_1)));
return FALSE;
}
if (!gnc_numeric_eq (xaccAccountGetReconciledBalance (account_1),
xaccAccountGetReconciledBalance (account_2)))
{
g_warning ("reconciled balances not equal for account %s",
guid_to_string (xaccAccountGetGUID (account_1)));
return FALSE;
}
}
g_list_free (list);
return TRUE;
}
static gboolean
test_queries (GNCSession *session_base, const char *db_name, const char *mode)
{
@ -644,7 +696,12 @@ test_mode (const char *db_name, const char *mode,
return FALSE;
if (multi_user)
{
if (!compare_balances (session, session_db))
return FALSE;
multi_user_get_everything (session_db, session);
}
ok = gnc_book_equal (gnc_session_get_book (session),
gnc_session_get_book (session_db));

View File

@ -146,6 +146,7 @@ gw-gnome-utils.scm gw-gnome-utils.c gw-gnome-utils.h: .scm-links gw-gnome-utils-
"(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)) \
(set! %load-path (cons \"${top_srcdir}/src/app-utils\" %load-path)) \
(primitive-load \"./gw-gnome-utils-spec.scm\") \
(gw:generate-module \"gw-gnome-utils\")"

View File

@ -484,6 +484,7 @@ gnc_date_edit_set_time (GNCDateEdit *gde, time_t the_time)
char buffer [40];
g_return_if_fail (gde != NULL);
g_return_if_fail (GNC_IS_DATE_EDIT (gde));
if (the_time == 0)
the_time = time (NULL);
@ -506,6 +507,12 @@ gnc_date_edit_set_time (GNCDateEdit *gde, time_t the_time)
gtk_entry_set_text (GTK_ENTRY (gde->time_entry), buffer);
}
void
gnc_date_edit_set_time_ts (GNCDateEdit *gde, Timespec the_time)
{
gnc_date_edit_set_time (gde, the_time.tv_sec);
}
/**
* gnc_date_edit_set_popup_range:
* @gde: The GNCDateEdit widget
@ -519,6 +526,7 @@ void
gnc_date_edit_set_popup_range (GNCDateEdit *gde, int low_hour, int up_hour)
{
g_return_if_fail (gde != NULL);
g_return_if_fail (GNC_IS_DATE_EDIT (gde));
gde->lower_hour = low_hour;
gde->upper_hour = up_hour;
@ -677,6 +685,12 @@ gnc_date_edit_new (time_t the_time, int show_time, int use_24_format)
| (use_24_format ? GNC_DATE_EDIT_24_HR : 0)));
}
GtkWidget *
gnc_date_edit_new_ts (Timespec the_time, int show_time, int use_24_format)
{
return gnc_date_edit_new (the_time.tv_sec, show_time, use_24_format);
}
/**
* gnc_date_edit_new_flags:
* @the_time: The initial time for the date editor.
@ -794,6 +808,16 @@ gnc_date_edit_get_date (GNCDateEdit *gde)
return mktime (&tm);
}
Timespec
gnc_date_edit_get_date_ts (GNCDateEdit *gde)
{
Timespec ts = { 0, 0 };
ts.tv_sec = gnc_date_edit_get_date (gde);
return ts;
}
/**
* gnc_date_edit_get_date_end:
* @gde: The GNCDateEdit widget
@ -829,6 +853,16 @@ gnc_date_edit_get_date_end (GNCDateEdit *gde)
return mktime (&tm);
}
Timespec
gnc_date_edit_get_date_end_ts (GNCDateEdit *gde)
{
Timespec ts = { 0, 0 };
ts.tv_sec = gnc_date_edit_get_date_end (gde);
return ts;
}
/**
* gnc_date_edit_set_flags:
* @gde: The date editor widget whose flags should be changed.

View File

@ -88,16 +88,21 @@ guint gnc_date_edit_get_type (void);
GtkWidget *gnc_date_edit_new (time_t the_time,
int show_time, int use_24_format);
GtkWidget *gnc_date_edit_new_ts (Timespec the_time,
int show_time, int use_24_format);
GtkWidget *gnc_date_edit_new_flags (time_t the_time,
GNCDateEditFlags flags);
void gnc_date_edit_set_time (GNCDateEdit *gde, time_t the_time);
void gnc_date_edit_set_time_ts (GNCDateEdit *gde, Timespec the_time);
void gnc_date_edit_set_popup_range (GNCDateEdit *gde,
int low_hour, int up_hour);
time_t gnc_date_edit_get_date (GNCDateEdit *gde);
Timespec gnc_date_edit_get_date_ts (GNCDateEdit *gde);
time_t gnc_date_edit_get_date_end (GNCDateEdit *gde);
Timespec gnc_date_edit_get_date_end_ts (GNCDateEdit *gde);
void gnc_date_edit_set_flags (GNCDateEdit *gde,
GNCDateEditFlags flags);

View File

@ -3,6 +3,7 @@
(use-modules (g-wrap))
(use-modules (g-wrapped gw-glib-spec))
(use-modules (g-wrapped gw-engine-spec))
(use-modules (g-wrapped gw-app-utils-spec))
(debug-set! maxdepth 100000)
(debug-set! stack 2000000)
@ -32,6 +33,7 @@
(gw:module-depends-on mod "gw-runtime")
(gw:module-depends-on mod "gw-engine")
(gw:module-depends-on mod "gw-glib")
(gw:module-depends-on mod "gw-app-utils")
(gw:module-set-guile-module! mod '(g-wrapped gw-gnome-utils))
@ -39,12 +41,16 @@
mod
(lambda (client-only?)
(list
"#include <gnc-mdi-utils.h>\n"
"#include <print-session.h>\n"
"#include <gnc-menu-extensions.h>\n"
"#include <gnc-html.h>\n"
"#include <dialog-utils.h>\n"
"#include <druid-utils.h>\n"
"#include <gnc-amount-edit.h>\n"
"#include <gnc-date-edit.h>\n"
"#include <gnc-gui-query.h>\n"
"#include <gnc-html.h>\n"
"#include <gnc-mdi-utils.h>\n"
"#include <gnc-menu-extensions.h>\n"
"#include <gnc-ui.h>\n"
"#include <print-session.h>\n"
)))
(let ((nnt (gw:wrap-non-native-type
@ -217,4 +223,194 @@
(<gnc:list-of-string> choices))
"Show a dialog offering different mutually exclusive choices
in a radio list.")
;; gnc-amount-edit.h
(let ((nnt (gw:wrap-non-native-type
mod
'<gnc:GNCAmountEdit>
"GNCAmountEdit*" "const GNCAmountEdit*")))
#t)
(gw:wrap-function
mod
'gnc:amount-edit-new
'<gnc:UIWidget>
"gnc_amount_edit_new"
'()
"Return a new amount edit widget.")
(gw:wrap-function
mod
'gnc:amount-edit-gtk-entry
'<gnc:UIWidget>
"gnc_amount_edit_gtk_entry"
'((<gnc:GNCAmountEdit> amount-edit))
"Return the gtk entry for a gnc amount edit widget.")
(gw:wrap-function
mod
'gnc:amount-edit-set-amount
'<gw:void>
"gnc_amount_edit_set_amount"
'((<gnc:GNCAmountEdit> amount-edit)
(<gnc:numeric> amount))
"Set the amount of an amount edit widget.")
(gw:wrap-function
mod
'gnc:amount-edit-get-amount
'<gnc:numeric>
"gnc_amount_edit_get_amount"
'((<gnc:GNCAmountEdit> amount-edit))
"Return the amount in an amount edit widget.")
(gw:wrap-function
mod
'gnc:amount-edit-evaluate
'<gw:bool>
"gnc_amount_edit_evaluate"
'((<gnc:GNCAmountEdit> amount-edit))
"Evaluate the contents of an amount edit widget and return
#t if it is a valid entry.")
(gw:wrap-function
mod
'gnc:amount-edit-set-print-info
'<gw:void>
"gnc_amount_edit_set_print_info"
'((<gnc:GNCAmountEdit> amount-edit)
(<gnc:print-amount-info-scm> print-info))
"Set the print info used by the amount edit.")
(gw:wrap-function
mod
'gnc:amount-edit-set-fraction
'<gw:void>
"gnc_amount_edit_set_fraction"
'((<gnc:GNCAmountEdit> amount-edit)
(<gw:int> fraction))
"Set the fraction used by the amount edit widget.")
(gw:wrap-function
mod
'gnc:amount-edit-set-evaluate-on-enter
'<gw:void>
"gnc_amount_edit_set_evaluate_on_enter"
'((<gnc:GNCAmountEdit> amount-edit)
(<gw:bool> evaluate-on-enter))
"Set whether the edit widget evaluates on enter.")
;; gnc-date-edit.h
(let ((nnt (gw:wrap-non-native-type
mod
'<gnc:GNCDateEdit>
"GNCDateEdit*" "const GNCDateEdit*")))
#t)
(gw:wrap-function
mod
'gnc:date-edit-new
'<gnc:UIWidget>
"gnc_date_edit_new_ts"
'((<gnc:time-pair> date)
(<gw:bool> show-time)
(<gw:bool> use-24-hour-format))
"Return a new date edit widget.")
(gw:wrap-function
mod
'gnc:date-edit-set-time
'<gw:void>
"gnc_date_edit_set_time_ts"
'((<gnc:GNCDateEdit> date-edit)
(<gnc:time-pair> time))
"Set the time used by the date edit widget.")
(gw:wrap-function
mod
'gnc:date-edit-get-date
'<gnc:time-pair>
"gnc_date_edit_get_date_ts"
'((<gnc:GNCDateEdit> date-edit))
"Return the date of the date-edit widget.")
(gw:wrap-function
mod
'gnc:date-edit-get-date-end
'<gnc:time-pair>
"gnc_date_edit_get_date_end_ts"
'((<gnc:GNCDateEdit> date-edit))
"Return the date of the date-edit widget at the end of the day.")
;; druid-utils.h
(let ((nnt (gw:wrap-non-native-type
mod
'<gnc:GnomeDruid>
"GnomeDruid*" "const GnomeDruid*")))
#t)
(gw:wrap-function
mod
'gnc:druid-set-title-image
'<gw:void>
"gnc_druid_set_title_image"
'((<gnc:GnomeDruid> druid)
((<gw:m-chars-caller-owned>) image-path))
"Set the title image of a druid.")
(gw:wrap-function
mod
'gnc:druid-set-logo-image
'<gw:void>
"gnc_druid_set_logo_image"
'((<gnc:GnomeDruid> druid)
((<gw:m-chars-caller-owned>) logo-path))
"Set the logo image of a druid.")
(gw:wrap-function
mod
'gnc:druid-set-watermark-image
'<gw:void>
"gnc_druid_set_watermark_image"
'((<gnc:GnomeDruid> druid)
((<gw:m-chars-caller-owned>) watermark-path))
"Set the watermark image of a druid.")
(gw:wrap-function
mod
'gnc:druid-set-colors
'<gw:void>
"gnc_druid_set_colors"
'((<gnc:GnomeDruid> druid))
"Set the colors of a druid.")
;; dialog-utils.h
(let ((nnt (gw:wrap-non-native-type
mod
'<gnc:GtkCList>
"GtkCList*" "const GtkCList*")))
#t)
(gw:wrap-function
mod
'gnc:clist-set-check
'<gw:void>
"gnc_clist_set_check"
'((<gnc:GtkCList> clist)
(<gw:int> row)
(<gw:int> col)
(<gw:bool> checked))
"Set the check status of a clist cell.")
(gw:wrap-function
mod
'gnc:clist-columns-autosize
'<gw:void>
"gnc_clist_columns_autosize"
'((<gnc:GtkCList> clist))
"Autosize the columns of a clist including the titles.")
)