How to get dialog-transfer's created transaction?

Christian Stimming stimming at tuhh.de
Tue Jun 24 02:19:42 CDT 2003


-----BEGIN PGP SIGNED MESSAGE-----

On Dienstag, 24. Juni 2003 01:02, Derek Atkins wrote:
> Excellent!  A non-db question!  Thanks, Christian, we needed the
> change of pace ;)
>
> Christian Stimming <stimming at tuhh.de> writes:
> > Status: Currently there is no way to get any hold of the Transaction that
> > was created in the gnc_xfer_dialog -- it is created inside the
> > gnc_xfer_dialog_ok_cb inside one particular code block, and there is no
> > pointer at all about the created Transaction anywhere else.
> >
> > Question: I'd like to add a "Transaction*" field to the struct
> > _xferDialog, 
>
> Unfortunately that wont help.  The dialog data is destroyed as soon as
> you click "ok", so you don't have any time to actually grab it out.

Yes, I figured that, too, after some more looking at the code...

> You're better off creating a callback function that will pass the
> transaction back to you.  Eg:
>
> void gnc_dialog_transfer_set_txn_cb(DialogTransfer* dialog,
>                 void(*handler)(gpointer, Transaction*), gpointer arg)
> {
>         ....
>         dialog->txn_cb_handler = handler;
>         dialog->txn_cb_arg = arg;
>         ...
> }
>
> Then after you create the transaction you can do:
>
>         if (dialog->txn_cb_handler)
>                 (dialog->txn_cb_handler)(dialog->txb_cb_arg, trans);
>
> The only question here is whether you are guaranteed that the
> transaction dialog exits before you do.  If not, you'll have to reset
> the handler to NULL.

Ok, sounds good, and I think I can do that, if I need it, sometime during the 
next days. Thanks.

Christian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iQCVAwUBPveLDmXAi+BfhivFAQG4UgP/TqhNRtwa+P1OiGAqeJ7Xikf9xaYJFwe5
QMTFruaPXFgXmgIjZad9HFBtV4eeUmReGIL1TE+ZGEvibXRo0H+XxkhDknOm3oUS
97FKRWHcY0DGi26tky4yEDz8IgqlpXKFY8Imk7YLDuWqrZBIJ1mhz/u4wzjN2z65
J8iL4k4LTPo=
=GUg+
-----END PGP SIGNATURE-----



More information about the gnucash-devel mailing list