diff --git a/ChangeLog b/ChangeLog index f38bab6273..26ea7554f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2001-04-21 Dave Peticolas + + * src/guile/gnc-helpers.c: more work on scm<->query. + +2001-04-20 Dave Peticolas + + * src/gnome/window-report.c: raise app of new report to top + + * src/register/recncell.c: add confirmation callback + + * src/SplitLedger.c: implement reconcile confirm cb + + * src/gnome/gnc-html.c: add missing include + + * src/gnome/dialog-transfer.c: fix spelling + 2001-04-20 Bill Gribble * src/gnome/dialog-column-view.c: maintain the report window diff --git a/po/POTFILES.in b/po/POTFILES.in index 070d017715..8272018b09 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -45,7 +45,6 @@ src/gnome/window-register.c src/gnome/window-report.c src/guile/gnucash.c src/register/gnome/gnucash-style.c -src/register/recncell.c src/register/splitreg.c src/scm/gnumeric/guile-strings.c src/scm/guile-strings.c diff --git a/src/SplitLedger.c b/src/SplitLedger.c index 1c84c234e5..0324752bf2 100644 --- a/src/SplitLedger.c +++ b/src/SplitLedger.c @@ -4471,6 +4471,30 @@ xaccSRConfirmHandler (VirtualLocation virt_loc, return TRUE; } +static gboolean +recn_cell_confirm (char old_flag, gpointer data) +{ + SplitRegister *reg = data; + + if (old_flag == YREC) + { + const char *message = _("Do you really want to mark this transaction " + "not reconciled?\nDoing so might make future " + "reconciliation difficult!"); + gboolean confirm; + + confirm = gnc_lookup_boolean_option ("Register", + "Confirm before changing reconciled", + TRUE); + if (!confirm) + return TRUE; + + return gnc_verify_dialog_parented (xaccSRGetParent (reg), message, TRUE); + } + + return TRUE; +} + /* ======================================================== */ G_INLINE_FUNC void @@ -4916,8 +4940,8 @@ xaccSRLoadRegister (SplitRegister *reg, GList * slist, xaccComboCellSetCompleteChar (reg->mxfrmCell, account_separator); xaccComboCellSetCompleteChar (reg->xfrmCell, account_separator); - /* set the dialog parent for the reconcile cell */ - xaccRecnCellSetParent (reg->recnCell, xaccSRGetParent (reg)); + /* set the confirmation callback for the reconcile cell */ + xaccRecnCellSetConfirmCB (reg->recnCell, recn_cell_confirm, reg); /* enable callback for cursor user-driven moves */ table->move_cursor = LedgerMoveCursor; diff --git a/src/gnome/dialog-transfer.c b/src/gnome/dialog-transfer.c index 54c471f49e..cba84cf8b3 100644 --- a/src/gnome/dialog-transfer.c +++ b/src/gnome/dialog-transfer.c @@ -701,7 +701,7 @@ gnc_xfer_dialog_ok_cb(GtkWidget * widget, gpointer data) (GTK_TOGGLE_BUTTON(xferData->amount_radio))) { gnc_parse_error_dialog (xferData, - _("You must enter a valie `to' amount.")); + _("You must enter a valid `to' amount.")); return; } } diff --git a/src/gnome/gnc-html.c b/src/gnome/gnc-html.c index 912dcb3e71..d8cfc83fee 100644 --- a/src/gnome/gnc-html.c +++ b/src/gnome/gnc-html.c @@ -58,6 +58,7 @@ #include "gnc-http.h" #include "gnc-html-history.h" #include "gnc-network.h" +#include "gnc-ui.h" #include "query-user.h" #include "window-help.h" #include "window-main.h" diff --git a/src/gnome/window-report.c b/src/gnome/window-report.c index a5a66bb7d4..bcaefc34d2 100644 --- a/src/gnome/window-report.c +++ b/src/gnome/window-report.c @@ -224,8 +224,14 @@ gnc_main_window_open_report_url(const char * url, gint toplevel) { GNOME_MDI_CHILD(reportchild)); } else { + GNCMainChildInfo * childwin; + gnome_mdi_add_view(GNOME_MDI(maininfo->mdi), GNOME_MDI_CHILD(reportchild)); + + childwin = gtk_object_get_user_data(GTK_OBJECT(reportchild)); + if (childwin && childwin->app && GTK_WIDGET (childwin->app)->window) + gdk_window_raise (GTK_WIDGET (childwin->app)->window); } } diff --git a/src/register/recncell.c b/src/register/recncell.c index 6eb10e9341..461798d172 100644 --- a/src/register/recncell.c +++ b/src/register/recncell.c @@ -41,8 +41,6 @@ #include "basiccell.h" #include "gnc-engine-util.h" -#include "gnc-ui.h" -#include "messages.h" #include "recncell.h" /* hack alert -- I am uncomfortable with including engine @@ -86,21 +84,9 @@ RecnEnter (BasicCell *_cell, { RecnCell *cell = (RecnCell *) _cell; - /* throw up a popup if the user tries to undo a reconciled transaction - hack alert -- this sets a new precedent. gnc_verify_dialog is defined - in both the motif and the gnome subdirs; I don't think I like it that - way. Now it's in ui-callbacks.h which is UI independent, but that's - still perhaps not optimal. */ - - if (cell->reconciled_flag == YREC) - { - const char *message = _("Do you really want to mark this transaction " - "not reconciled?\nDoing so might make future " - "reconciliation difficult!"); - - if (!gnc_verify_dialog_parented (cell->parent, message, TRUE)) - return FALSE; - } + if (cell->confirm_cb && + ! (cell->confirm_cb (cell->reconciled_flag, cell->confirm_data))) + return FALSE; if (cell->reconciled_flag == NREC) cell->reconciled_flag = CREC; @@ -120,6 +106,7 @@ xaccInitRecnCell (RecnCell *cell) xaccInitBasicCell (&cell->cell); xaccRecnCellSetFlag (cell, NREC); + cell->confirm_cb = NULL; cell->cell.enter_cell = RecnEnter; cell->cell.set_value = RecnSetValue; @@ -219,11 +206,13 @@ xaccRecnCellSetStringGetter (RecnCellStringGetter getter) /* ================================================ */ void -xaccRecnCellSetParent (RecnCell *cell, gncUIWidget parent) +xaccRecnCellSetConfirmCB (RecnCell *cell, RecnCellConfirm confirm_cb, + gpointer data) { g_return_if_fail (cell != NULL); - cell->parent = parent; + cell->confirm_cb = confirm_cb; + cell->confirm_data = data; } /* --------------- end of file ---------------------- */ diff --git a/src/register/recncell.h b/src/register/recncell.h index 793c73c1d5..4e46478fc6 100644 --- a/src/register/recncell.h +++ b/src/register/recncell.h @@ -40,17 +40,21 @@ #ifndef __RECN_CELL_C__ #define __RECN_CELL_C__ -#include "basiccell.h" -#include "gnc-ui.h" +#include -typedef const char * (*RecnCellStringGetter)(char); +#include "basiccell.h" + +typedef const char * (*RecnCellStringGetter) (char flag); +typedef gboolean (*RecnCellConfirm) (char old_flag, gpointer data); typedef struct _RecnCell { BasicCell cell; char reconciled_flag; /* The actual flag value */ - gncUIWidget parent; + + RecnCellConfirm confirm_cb; + gpointer confirm_data; } RecnCell; RecnCell * xaccMallocRecnCell (void); @@ -59,7 +63,9 @@ void xaccDestroyRecnCell (RecnCell *cell); void xaccRecnCellSetFlag (RecnCell *cell, char reconciled_flag); char xaccRecnCellGetFlag (RecnCell *cell); -void xaccRecnCellSetParent (RecnCell *cell, gncUIWidget parent); +void xaccRecnCellSetConfirmCB (RecnCell *cell, + RecnCellConfirm confirm_cb, + gpointer data); void xaccRecnCellSetStringGetter (RecnCellStringGetter getter);