void AB_ImExporterAccountInfo_FillFromAccount(AB_IMEXPORTER_ACCOUNTINFO *iea, const AB_ACCOUNT *a) { const char *s; AB_ACCOUNT_TYPE at; assert(iea); assert(a); s=AB_Account_GetBankCode(a); AB_ImExporterAccountInfo_SetBankCode(iea, s); s=AB_Account_GetBankName(a); AB_ImExporterAccountInfo_SetBankName(iea, s); s=AB_Account_GetAccountNumber(a); AB_ImExporterAccountInfo_SetAccountNumber(iea, s); s=AB_Account_GetAccountName(a); AB_ImExporterAccountInfo_SetAccountName(iea, s); s=AB_Account_GetIBAN(a); AB_ImExporterAccountInfo_SetIban(iea, s); s=AB_Account_GetBIC(a); AB_ImExporterAccountInfo_SetBic(iea, s); s=AB_Account_GetCurrency(a); AB_ImExporterAccountInfo_SetCurrency(iea, s); s=AB_Account_GetOwnerName(a); AB_ImExporterAccountInfo_SetOwner(iea, s); at=AB_Account_GetAccountType(a); AB_ImExporterAccountInfo_SetType(iea, at); }
static gchar * ab_account_longname(const AB_ACCOUNT *ab_acc) { gchar *bankname; gchar *result; const char *ab_bankname, *bankcode; g_return_val_if_fail(ab_acc, NULL); ab_bankname = AB_Account_GetBankName(ab_acc); bankname = ab_bankname ? gnc_utf8_strip_invalid_strdup(ab_bankname) : NULL; bankcode = AB_Account_GetBankCode(ab_acc); /* Translators: Strings are 1. Account code, 2. Bank name, 3. Bank code. */ if (bankname && *bankname) result = g_strdup_printf(_("%s at %s (code %s)"), AB_Account_GetAccountNumber(ab_acc), bankname, bankcode); else result = g_strdup_printf(_("%s at bank code %s"), AB_Account_GetAccountNumber(ab_acc), bankcode); g_free(bankname); return result; }
static void createAccountListBoxString(const AB_ACCOUNT *a, GWEN_BUFFER *tbuf) { const char *s; char numbuf[32]; uint32_t uid; /* column 1 */ uid=AB_Account_GetUniqueId(a); snprintf(numbuf, sizeof(numbuf)-1, "%06d", uid); numbuf[sizeof(numbuf)-1]=0; GWEN_Buffer_AppendString(tbuf, numbuf); GWEN_Buffer_AppendString(tbuf, "\t"); /* column 2 */ s=AB_Account_GetBankCode(a); if (s && *s) GWEN_Buffer_AppendString(tbuf, s); GWEN_Buffer_AppendString(tbuf, "\t"); /* column 3 */ s=AB_Account_GetBankName(a); if (s && *s) GWEN_Buffer_AppendString(tbuf, s); GWEN_Buffer_AppendString(tbuf, "\t"); /* column 4 */ s=AB_Account_GetAccountNumber(a); if (s && *s) GWEN_Buffer_AppendString(tbuf, s); GWEN_Buffer_AppendString(tbuf, "\t"); /* column 5 */ s=AB_Account_GetAccountName(a); if (s && *s) GWEN_Buffer_AppendString(tbuf, s); GWEN_Buffer_AppendString(tbuf, "\t"); /* column 6 */ s=AB_Account_GetOwnerName(a); if (s && *s) GWEN_Buffer_AppendString(tbuf, s); GWEN_Buffer_AppendString(tbuf, "\t"); /* column 7 */ s=AB_Account_GetBackendName(a); if (s && *s) GWEN_Buffer_AppendString(tbuf, s); }
void KBAccountListViewItem::_populate() { QString tmp; int i; assert(_account); i = 0; // unique id setText(i++, QString::number(AB_Account_GetUniqueId(_account))); // bank code setText(i++, QString::fromUtf8(AB_Account_GetBankCode(_account))); // bank name tmp = AB_Account_GetBankName(_account); if (tmp.isEmpty()) tmp = i18nc("replacement for institution or account w/o name", "(unnamed)"); setText(i++, tmp); // account id setText(i++, QString::fromUtf8(AB_Account_GetAccountNumber(_account))); // account name tmp = QString::fromUtf8(AB_Account_GetAccountName(_account)); if (tmp.isEmpty()) tmp = i18nc("replacement for institution or account w/o name", "(unnamed)"); setText(i++, tmp); tmp = QString::fromUtf8(AB_Account_GetOwnerName(_account)); if (tmp.isEmpty()) tmp = ""; setText(i++, tmp); tmp = QString::fromUtf8(AB_Provider_GetName(AB_Account_GetProvider(_account))); if (tmp.isEmpty()) tmp = i18nc("replacement for institution or account w/o name", "(unnamed)"); setText(i++, tmp); }
static PyObject * aqbanking_listacc(PyObject *self, PyObject *args) { int rv; AB_ACCOUNT_LIST2 *accs; // List of accounts => to return. PyObject *accountList; aqbanking_Account *account; accountList = PyList_New(0); // Initialize aqbanking. rv = AB_create(NULL); if (rv > 0) { return NULL; } /* Get a list of accounts which are known to AqBanking. * There are some pecularities about the list returned: * The list itself is owned by the caller (who must call * AB_Account_List2_free() as we do below), but the elements of that * list (->the accounts) are still owned by AqBanking. * Therefore you MUST NOT free any of the accounts within the list returned. * This also rules out calling AB_Account_List2_freeAll() which not only * frees the list itself but also frees all its elements. * * The rest of this tutorial shows how lists are generally used by * AqBanking. */ accs = AB_Banking_GetAccounts(ab); if (accs) { AB_ACCOUNT_LIST2_ITERATOR *it; /* List2's are traversed using iterators. An iterator is an object * which points to a single element of a list. * If the list is empty NULL is returned. */ it=AB_Account_List2_First(accs); if (it) { AB_ACCOUNT *a; /* this function returns a pointer to the element of the list to * which the iterator currently points to */ a=AB_Account_List2Iterator_Data(it); while(a) { AB_PROVIDER *pro; account = (aqbanking_Account*) PyObject_CallObject((PyObject *) &aqbanking_AccountType, NULL); /* every account is assigned to a backend (sometimes called provider) * which actually performs online banking tasks. We get a pointer * to that provider/backend with this call to show its name in our * example.*/ pro = AB_Account_GetProvider(a); // Populate the object. account->no = PyUnicode_FromString(AB_Account_GetAccountNumber(a)); account->name = PyUnicode_FromString(AB_Account_GetAccountName(a)); account->description = PyUnicode_FromString(AB_Provider_GetName(pro)); account->bank_code = PyUnicode_FromString(AB_Account_GetBankCode(a)); account->bank_name = PyUnicode_FromString(AB_Account_GetBankName(a)); PyList_Append(accountList, (PyObject *)account); Py_DECREF(account); /* this function lets the iterator advance to the next element in * the list, so a following call to AB_Account_List2Iterator_Data() * would return a pointer to the next element. * This function also returns a pointer to the next element of the * list. If there is no next element then NULL is returned. */ a = AB_Account_List2Iterator_Next(it); } /* the iterator must be freed after using it */ AB_Account_List2Iterator_free(it); } /* as discussed the list itself is only a container which has to be freed * after use. This explicitly does not free any of the elements in that * list, and it shouldn't because AqBanking still is the owner of the * accounts */ AB_Account_List2_free(accs); } // Exit aqbanking. rv = AB_free(NULL); if (rv > 0) { Py_DECREF(account); Py_DECREF(accountList); return NULL; } return accountList; }
int main(int argc, char **argv) { AB_BANKING *ab; AB_ACCOUNT_LIST2 *accs; int rv; GWEN_GUI *gui; gui=GWEN_Gui_CGui_new(); GWEN_Gui_SetGui(gui); ab=AB_Banking_new("tutorial2", 0, 0); rv=AB_Banking_Init(ab); if (rv) { fprintf(stderr, "Error on init (%d)\n", rv); return 2; } rv=AB_Banking_OnlineInit(ab); if (rv) { fprintf(stderr, "Error on onlineinit (%d)\n", rv); return 2; } fprintf(stderr, "AqBanking successfully initialized.\n"); /* Get a list of accounts which are known to AqBanking. * There are some pecularities about the list returned: * The list itself is owned by the caller (who must call * AB_Account_List2_free() as we do below), but the elements of that * list (->the accounts) are still owned by AqBanking. * Therefore you MUST NOT free any of the accounts within the list returned. * This also rules out calling AB_Account_List2_freeAll() which not only * frees the list itself but also frees all its elements. * * The rest of this tutorial shows how lists are generally used by * AqBanking. */ accs=AB_Banking_GetAccounts(ab); if (accs) { AB_ACCOUNT_LIST2_ITERATOR *it; /* List2's are traversed using iterators. An iterator is an object * which points to a single element of a list. * If the list is empty NULL is returned. */ it=AB_Account_List2_First(accs); if (it) { AB_ACCOUNT *a; /* this function returns a pointer to the element of the list to * which the iterator currently points to */ a=AB_Account_List2Iterator_Data(it); while(a) { AB_PROVIDER *pro; /* every account is assigned to a backend (sometimes called provider) * which actually performs online banking tasks. We get a pointer * to that provider/backend with this call to show its name in our * example.*/ pro=AB_Account_GetProvider(a); fprintf(stderr, "Account: %s (%s) %s (%s) [%s]\n", AB_Account_GetBankCode(a), AB_Account_GetBankName(a), AB_Account_GetAccountNumber(a), AB_Account_GetAccountName(a), /* the name of the provider/backend as decribed above */ AB_Provider_GetName(pro)); /* this function lets the iterator advance to the next element in * the list, so a following call to AB_Account_List2Iterator_Data() * would return a pointer to the next element. * This function also returns a pointer to the next element of the * list. If there is no next element then NULL is returned. */ a=AB_Account_List2Iterator_Next(it); } /* the iterator must be freed after using it */ AB_Account_List2Iterator_free(it); } /* as discussed the list itself is only a container which has to be freed * after use. This explicitly does not free any of the elements in that * list, and it shouldn't because AqBanking still is the owner of the * accounts */ AB_Account_List2_free(accs); } rv=AB_Banking_OnlineFini(ab); if (rv) { fprintf(stderr, "ERROR: Error on online deinit (%d)\n", rv); return 3; } rv=AB_Banking_Fini(ab); if (rv) { fprintf(stderr, "ERROR: Error on deinit (%d)\n", rv); return 3; } AB_Banking_free(ab); return 0; }
GncABTransDialog * gnc_ab_trans_dialog_new(GtkWidget *parent, AB_ACCOUNT *ab_acc, gint commodity_scu, GncABTransType trans_type, GList *templates) { GncABTransDialog *td; GtkBuilder *builder; const gchar *ab_ownername; const gchar *ab_accountnumber; const gchar *ab_bankname; const gchar *ab_bankcode; GtkWidget *heading_label; GtkWidget *recp_name_heading; GtkWidget *recp_account_heading; GtkWidget *recp_bankcode_heading; GtkWidget *amount_hbox; GtkWidget *orig_name_heading; GtkWidget *orig_name_label; GtkWidget *orig_account_heading; GtkWidget *orig_account_label; GtkWidget *orig_bankname_heading; GtkWidget *orig_bankname_label; GtkWidget *orig_bankcode_heading; GtkWidget *orig_bankcode_label; GtkCellRenderer *renderer; GtkTreeViewColumn *column; g_return_val_if_fail(ab_acc, NULL); ab_ownername = AB_Account_GetOwnerName(ab_acc); if (!ab_ownername) ab_ownername = ""; ab_accountnumber = AB_Account_GetAccountNumber(ab_acc); ab_bankcode = AB_Account_GetBankCode(ab_acc); ab_bankname = AB_Account_GetBankName(ab_acc); if (!ab_bankname || !*ab_bankname) ab_bankname = _("(unknown)"); td = g_new0(GncABTransDialog, 1); td->parent = parent; td->ab_acc = ab_acc; td->trans_type = trans_type; #if HAVE_KTOBLZCHECK_H td->blzcheck = AccountNumberCheck_new(); #endif builder = gtk_builder_new(); gnc_builder_add_from_file (builder, "dialog-ab.glade", "Transaction Dialog"); td->dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Transaction Dialog")); if (parent) gtk_window_set_transient_for(GTK_WINDOW(td->dialog), GTK_WINDOW(parent)); /* Extract widgets */ heading_label = GTK_WIDGET(gtk_builder_get_object (builder, "heading_label")); recp_name_heading = GTK_WIDGET(gtk_builder_get_object (builder, "recp_name_heading")); td->recp_name_entry = GTK_WIDGET(gtk_builder_get_object (builder, "recp_name_entry")); recp_account_heading = GTK_WIDGET(gtk_builder_get_object (builder, "recp_account_heading")); td->recp_account_entry = GTK_WIDGET(gtk_builder_get_object (builder, "recp_account_entry")); recp_bankcode_heading = GTK_WIDGET(gtk_builder_get_object (builder, "recp_bankcode_heading")); td->recp_bankcode_entry = GTK_WIDGET(gtk_builder_get_object (builder, "recp_bankcode_entry")); td->recp_bankname_label = GTK_WIDGET(gtk_builder_get_object (builder, "recp_bankname_label")); amount_hbox = GTK_WIDGET(gtk_builder_get_object (builder, "amount_hbox")); td->purpose_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_entry")); td->purpose_cont_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_cont_entry")); td->purpose_cont2_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_cont2_entry")); td->purpose_cont3_entry = GTK_WIDGET(gtk_builder_get_object (builder, "purpose_cont3_entry")); orig_name_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_name_heading")); orig_name_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_name_label")); orig_account_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_account_heading")); orig_account_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_account_label")); orig_bankname_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankname_heading")); orig_bankname_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankname_label")); orig_bankcode_heading = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankcode_heading")); orig_bankcode_label = GTK_WIDGET(gtk_builder_get_object (builder, "orig_bankcode_label")); td->template_gtktreeview = GTK_TREE_VIEW(gtk_builder_get_object (builder, "template_list")); /* Amount edit */ td->amount_edit = gnc_amount_edit_new(); gtk_box_pack_start_defaults(GTK_BOX(amount_hbox), td->amount_edit); gnc_amount_edit_set_evaluate_on_enter(GNC_AMOUNT_EDIT(td->amount_edit), TRUE); gnc_amount_edit_set_fraction(GNC_AMOUNT_EDIT(td->amount_edit), commodity_scu); /* Check for what kind of transaction this should be, and change the * labels accordingly */ switch (trans_type) { case SINGLE_TRANSFER: case SINGLE_INTERNAL_TRANSFER: /* all labels are already set */ break; case SINGLE_DEBITNOTE: gtk_label_set_text(GTK_LABEL (heading_label), /* Translators: Strings from this file are * needed only in countries that have one of * aqbanking's Online Banking techniques * available. This is 'OFX DirectConnect' * (U.S. and others), 'HBCI' (in Germany), * or 'YellowNet' (Switzerland). If none of * these techniques are available in your * country, you may safely ignore strings * from the import-export/hbci * subdirectory. */ _("Enter an Online Direct Debit Note")); gtk_label_set_text(GTK_LABEL(recp_name_heading), _("Debited Account Owner")); gtk_label_set_text(GTK_LABEL(recp_account_heading), _("Debited Account Number")); gtk_label_set_text(GTK_LABEL(recp_bankcode_heading), _("Debited Account Bank Code")); gtk_label_set_text(GTK_LABEL(orig_name_heading), _("Credited Account Owner")); gtk_label_set_text(GTK_LABEL(orig_account_heading), _("Credited Account Number")); gtk_label_set_text(GTK_LABEL(orig_bankcode_heading), _("Credited Account Bank Code")); break; default: g_critical("gnc_ab_trans_dialog_new: Oops, unknown GncABTransType %d", trans_type); break; } gtk_label_set_text(GTK_LABEL(orig_name_label), ab_ownername); gtk_label_set_text(GTK_LABEL(orig_account_label), ab_accountnumber); gtk_label_set_text(GTK_LABEL(orig_bankname_label), ab_bankname); gtk_label_set_text (GTK_LABEL (orig_bankcode_label), ab_bankcode); /* Fill list for choosing a transaction template */ td->template_list_store = gtk_list_store_new(TEMPLATE_NUM_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER); g_list_foreach(templates, fill_templ_helper, td->template_list_store); gtk_tree_view_set_model(td->template_gtktreeview, GTK_TREE_MODEL(td->template_list_store)); td->templ_changed = FALSE; /* Keep a reference to the store */ /* Show this list */ renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes( "Template Name", renderer, "text", TEMPLATE_NAME, NULL); gtk_tree_view_append_column(td->template_gtktreeview, column); /* Connect the Signals */ gtk_builder_connect_signals_full (builder, gnc_builder_connect_full_func, td); g_object_unref(G_OBJECT(builder)); return td; }
void KBJobListViewItem::_populate() { QString tmp; int i; AB_ACCOUNT *a; const char *p; assert(_job); i = 0; a = AB_Job_GetAccount(_job); assert(a); // job id setText(i++, QString::number(AB_Job_GetJobId(_job))); // job type switch (AB_Job_GetType(_job)) { case AB_Job_TypeGetBalance: tmp = i18n("Get Balance"); break; case AB_Job_TypeGetTransactions: tmp = i18n("Get Transactions"); break; case AB_Job_TypeTransfer: tmp = i18n("Transfer"); break; case AB_Job_TypeDebitNote: tmp = i18n("Debit Note"); break; default: tmp = i18nc("Unknown job type", "(unknown)"); break; } setText(i++, tmp); // bank name tmp = AB_Account_GetBankName(a); if (tmp.isEmpty()) tmp = AB_Account_GetBankCode(a); if (tmp.isEmpty()) tmp = i18nc("Unknown bank code", "(unknown)"); setText(i++, tmp); // account name tmp = AB_Account_GetAccountName(a); if (tmp.isEmpty()) tmp = AB_Account_GetAccountNumber(a); if (tmp.isEmpty()) tmp = i18nc("Unknown account number", "(unknown)"); setText(i++, tmp); // status switch (AB_Job_GetStatus(_job)) { case AB_Job_StatusNew: tmp = i18nc("Status of the job", "new"); break; case AB_Job_StatusUpdated: tmp = i18nc("Status of the job", "updated"); break; case AB_Job_StatusEnqueued: tmp = i18nc("Status of the job", "enqueued"); break; case AB_Job_StatusSent: tmp = i18nc("Status of the job", "sent"); break; case AB_Job_StatusPending: tmp = i18nc("Status of the job", "pending"); break; case AB_Job_StatusFinished: tmp = i18nc("Status of the job", "finished"); break; case AB_Job_StatusError: tmp = i18nc("Status of the job", "error"); break; default: tmp = i18nc("Status of the job", "(unknown)"); break; } setText(i++, tmp); p = AB_Provider_GetName(AB_Account_GetProvider(a)); if (!p) tmp = i18nc("Unknown account provider", "(unknown)"); else tmp = p; setText(i++, tmp); p = AB_Job_GetCreatedBy(_job); if (!p) tmp = i18nc("Unknown creator of the job", "(unknown)"); else tmp = p; setText(i++, tmp); }