1 /* 2 * dialog-ab-trans.h -- 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License as 6 * published by the Free Software Foundation; either version 2 of 7 * the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, contact: 16 * 17 * Free Software Foundation Voice: +1-617-542-5942 18 * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 19 * Boston, MA 02110-1301, USA gnu@gnu.org 20 */ 21 22 /** 23 * @addtogroup Import_Export 24 * @{ 25 * @addtogroup AqBanking 26 * @{ 27 * @file dialog-ab-trans.h 28 * @brief Dialog for AqBanking transaction data 29 * @author Copyright (C) 2002 Christian Stimming <stimming@tuhh.de> 30 * @author Copyright (C) 2004 Bernd Wagner 31 * @author Copyright (C) 2006 David Hampton <hampton@employees.org> 32 * @author Copyright (C) 2008 Andreas Koehler <andi5.py@gmx.net> 33 */ 34 35 #ifndef DIALOG_AB_TRANS_H 36 #define DIALOG_AB_TRANS_H 37 38 #include "gnc-ab-utils.h" 39 #include <gtk/gtk.h> 40 #include <aqbanking/banking.h> 41 42 #include "Account.h" 43 44 G_BEGIN_DECLS 45 46 #define GNC_RESPONSE_NOW GTK_RESPONSE_YES 47 #define GNC_RESPONSE_LATER GTK_RESPONSE_NO 48 49 typedef struct _GncABTransDialog GncABTransDialog; 50 51 typedef enum _GncABTransType GncABTransType; 52 enum _GncABTransType 53 { 54 SINGLE_TRANSFER = 0, /* obsolete old non-SEPA transfer; no longer in use */ 55 SINGLE_DEBITNOTE, /* obsolete old non-SEPA debit note; no longer in use */ 56 SINGLE_INTERNAL_TRANSFER 57 , SEPA_TRANSFER 58 , SEPA_DEBITNOTE 59 #if (AQBANKING_VERSION_INT >= 60400) 60 , SEPA_INTERNAL_TRANSFER 61 #endif 62 }; 63 /** 64 * Returns true if the given GncABTransType is an European (SEPA) transaction 65 * (transfer or debit note), otherwise false. 66 */ 67 gboolean gnc_ab_trans_isSEPA(GncABTransType t); 68 69 /** 70 * Create a new AqBanking transfer dialog 71 * 72 * @param parent Widget to use as parent, may be NULL 73 * @param ab_acc Aqbanking account 74 * @param commodity_scu commodity used for the amount 75 * @param trans_type Type of transaction 76 * @param templates A GList of template transactions which will become fully 77 * managed by the dialog, so do not free it and retrieve snapshots via 78 * gnc_ab_trans_dialog_get_templ() 79 * @return A new GncABTransDialog, free with gnc_ab_trans_dialog_free() 80 */ 81 GncABTransDialog *gnc_ab_trans_dialog_new(GtkWidget *parent, GNC_AB_ACCOUNT_SPEC *ab_acc, 82 gint commodity_scu, 83 GncABTransType trans_type, 84 GList *templates); 85 86 /** 87 * Run the Aqbanking transfer dialog until correct values where entered or 88 * the user cancelled the dialog. 89 * 90 * @param td Transaction dialog 91 * @param ab_acc AqBanking account 92 * @return GTK_RESPONSE_CANCEL or GTK_RESPONSE_DESTROY_EVENT if the user cancelled the dialog 93 * and GNC_RESPONSE_NOW otherwise. 94 */ 95 gint gnc_ab_trans_dialog_run_until_ok(GncABTransDialog *td); 96 97 /** 98 * Free a Aqbanking transfer dialog 99 * 100 * @param td Transaction dialog 101 */ 102 void gnc_ab_trans_dialog_free(GncABTransDialog *td); 103 104 /** 105 * Retrieve the current list of transaction templates from the dialog @a 106 * td, unless @a changed is a specified location and the templates have 107 * not been touched by the user. 108 * 109 * @param td Transaction dialog 110 * @param changed Location to store whether the templates have been 111 * changed, may be NULL 112 * @return The a newly allocated list of the internal transaction 113 * templates. Free this one via g_list_free(). 114 */ 115 GList *gnc_ab_trans_dialog_get_templ(const GncABTransDialog *td, 116 gboolean *changed); 117 118 /** 119 * Retrieve the widget used as parent. 120 * 121 * @param td Transaction dialog 122 * @return The parent 123 */ 124 GtkWidget *gnc_ab_trans_dialog_get_parent(const GncABTransDialog *td); 125 126 /** 127 * Receive the Aqbanking Transaction filled by the dialog 128 * 129 * @param td Transaction dialog 130 * @return An Aqbanking transaction 131 */ 132 const AB_TRANSACTION *gnc_ab_trans_dialog_get_ab_trans(const GncABTransDialog *td); 133 134 /** 135 * Receive the Aqbanking job filled by the dialog. 136 * 137 * @param td Transaction dialog 138 * @return An Aqbanking job 139 */ 140 GNC_AB_JOB *gnc_ab_trans_dialog_get_job(const GncABTransDialog *td); 141 142 /** 143 * Return the AqBanking job associated with the transaction. 144 * 145 * @param td Transaction dialog 146 * @return An AQBanking job 147 */ 148 GNC_AB_JOB *gnc_ab_get_trans_job(GNC_AB_ACCOUNT_SPEC *ab_acc, 149 const AB_TRANSACTION *ab_trans, 150 GncABTransType trans_type); 151 152 G_END_DECLS 153 154 /** @} */ 155 /** @} */ 156 157 #endif /* DIALOG_AB_TRANS_H */ 158