diff --git a/.cvsignore b/.cvsignore index 4365f254c9..b7e51fac83 100644 --- a/.cvsignore +++ b/.cvsignore @@ -48,3 +48,4 @@ tags *.diff *.diffs *.xac.*.xac +autom4te.cache diff --git a/ChangeLog b/ChangeLog index 5791e27462..781e2ac016 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-05-02 Christian Stimming + + * configure.in: Add pkg-config test for libgnomeui-2.0. + + * src/import-export/hbci/*.c: Port hbci import module to Gnome2, + sourcecode compiles now. Copy changes from HEAD branch. 2003-04-29 TomF changes for gnucash-gnome2-dev, 12th batch * src/gnome-utils/gnc-date-edit.c:gnc_date_edit_class_init: diff --git a/configure.in b/configure.in index 1a48387c68..c54b20007d 100644 --- a/configure.in +++ b/configure.in @@ -777,13 +777,20 @@ then GNOME_INIT GNOME_COMPILE_WARNINGS + # Look for libgnomeui by pkg-config + PKG_CHECK_MODULES(GNOMEUI, libgnomeui-2.0) + AS_SCRUB_INCLUDE(GNOMEUI_CFLAGS) + AC_SUBST(GNOMEUI_CFLAGS) + AC_SUBST(GNOMEUI_LIBS) + # look for gdk-pixbuf PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0) AS_SCRUB_INCLUDE(GDK_PIXBUF_CFLAGS) AC_SUBST(GDK_PIXBUF_CFLAGS) AC_SUBST(GDK_PIXBUF_LIBS) - # Gnome-Print + # Gnome-Print -- some people already have/need libgnomeprint-2.2 + #PKG_CHECK_MODULES(GNOME_PRINT, libgnomeprint-2.2) PKG_CHECK_MODULES(GNOME_PRINT, libgnomeprint-2.0) AS_SCRUB_INCLUDE(GNOME_PRINT_CFLAGS) AC_SUBST(GNOME_PRINT_CFLAGS) diff --git a/src/import-export/hbci/dialog-daterange.c b/src/import-export/hbci/dialog-daterange.c index ae9567b621..8c49571ce5 100644 --- a/src/import-export/hbci/dialog-daterange.c +++ b/src/import-export/hbci/dialog-daterange.c @@ -61,24 +61,17 @@ gnc_hbci_enter_daterange (GtkWidget *parent, xml = gnc_glade_xml_new ("hbci.glade", "HBCI_daterange_dialog"); - g_assert - (dialog = glade_xml_get_widget (xml, "HBCI_daterange_dialog")); + dialog = glade_xml_get_widget (xml, "HBCI_daterange_dialog"); if (parent) gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (parent)); - g_assert - (heading_label = glade_xml_get_widget (xml, "heading_label")); - g_assert - (last_retrieval_button = glade_xml_get_widget (xml, "last_retrieval_button")); - g_assert - (first_button = glade_xml_get_widget (xml, "first_button")); - g_assert - (info.enter_from_button = glade_xml_get_widget (xml, "enter_from_button")); - g_assert - (info.enter_to_button = glade_xml_get_widget (xml, "enter_to_button")); - g_assert - (now_button = glade_xml_get_widget (xml, "now_button")); + heading_label = glade_xml_get_widget (xml, "heading_label"); + last_retrieval_button = glade_xml_get_widget (xml, "last_retrieval_button"); + first_button = glade_xml_get_widget (xml, "first_button"); + info.enter_from_button = glade_xml_get_widget (xml, "enter_from_button"); + info.enter_to_button = glade_xml_get_widget (xml, "enter_to_button"); + now_button = glade_xml_get_widget (xml, "now_button"); info.from_dateedit = gnc_date_edit_new_ts (*from_date, FALSE, FALSE); gtk_container_add (GTK_CONTAINER (glade_xml_get_widget diff --git a/src/import-export/hbci/dialog-hbcitrans.c b/src/import-export/hbci/dialog-hbcitrans.c index b4691706df..5ca227efb5 100644 --- a/src/import-export/hbci/dialog-hbcitrans.c +++ b/src/import-export/hbci/dialog-hbcitrans.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "dialog-utils.h" #include "gnc-ui.h" @@ -46,6 +47,7 @@ gnc_hbci_trans (GtkWidget *parent, HBCI_Transaction *trans = NULL; gint result; const HBCI_Bank *bank; + gboolean successful; g_assert (api); g_assert (h_acc); @@ -83,46 +85,26 @@ gnc_hbci_trans (GtkWidget *parent, GtkWidget *amount_edit; GtkWidget *exec_later_button; - g_assert - (heading_label = glade_xml_get_widget (xml, "heading_label")); - g_assert - (recp_name_entry = glade_xml_get_widget (xml, "recp_name_entry")); - g_assert - (recp_name_heading = glade_xml_get_widget (xml, "recp_name_heading")); - g_assert - (recp_account_entry = glade_xml_get_widget (xml, "recp_account_entry")); - g_assert - (recp_account_heading = glade_xml_get_widget (xml, "recp_account_heading")); - g_assert - (recp_bankcode_entry = glade_xml_get_widget (xml, "recp_bankcode_entry")); - g_assert - (recp_bankcode_heading = glade_xml_get_widget (xml, "recp_bankcode_heading")); - g_assert - (recp_bankname_label = glade_xml_get_widget (xml, "recp_bankname_label")); - g_assert - (amount_hbox = glade_xml_get_widget (xml, "amount_hbox")); - g_assert - (purpose_entry = glade_xml_get_widget (xml, "purpose_entry")); - g_assert - (purpose_cont_entry = glade_xml_get_widget (xml, "purpose_cont_entry")); - g_assert - (orig_name_label = glade_xml_get_widget (xml, "orig_name_label")); - g_assert - (orig_account_label = glade_xml_get_widget (xml, "orig_account_label")); - g_assert - (orig_bankname_label = glade_xml_get_widget (xml, "orig_bankname_label")); - g_assert - (orig_bankcode_label = glade_xml_get_widget (xml, "orig_bankcode_label")); - g_assert - (orig_name_heading = glade_xml_get_widget (xml, "orig_name_heading")); - g_assert - (orig_account_heading = glade_xml_get_widget (xml, "orig_account_heading")); - g_assert - (orig_bankname_heading = glade_xml_get_widget (xml, "orig_bankname_heading")); - g_assert - (orig_bankcode_heading = glade_xml_get_widget (xml, "orig_bankcode_heading")); - g_assert - (exec_later_button = glade_xml_get_widget (xml, "exec_later_button")); + heading_label = glade_xml_get_widget (xml, "heading_label"); + recp_name_entry = glade_xml_get_widget (xml, "recp_name_entry"); + recp_name_heading = glade_xml_get_widget (xml, "recp_name_heading"); + recp_account_entry = glade_xml_get_widget (xml, "recp_account_entry"); + recp_account_heading = glade_xml_get_widget (xml, "recp_account_heading"); + recp_bankcode_entry = glade_xml_get_widget (xml, "recp_bankcode_entry"); + recp_bankcode_heading = glade_xml_get_widget (xml, "recp_bankcode_heading"); + recp_bankname_label = glade_xml_get_widget (xml, "recp_bankname_label"); + amount_hbox = glade_xml_get_widget (xml, "amount_hbox"); + purpose_entry = glade_xml_get_widget (xml, "purpose_entry"); + purpose_cont_entry = glade_xml_get_widget (xml, "purpose_cont_entry"); + orig_name_label = glade_xml_get_widget (xml, "orig_name_label"); + orig_account_label = glade_xml_get_widget (xml, "orig_account_label"); + orig_bankname_label = glade_xml_get_widget (xml, "orig_bankname_label"); + orig_bankcode_label = glade_xml_get_widget (xml, "orig_bankcode_label"); + orig_name_heading = glade_xml_get_widget (xml, "orig_name_heading"); + orig_account_heading = glade_xml_get_widget (xml, "orig_account_heading"); + orig_bankname_heading = glade_xml_get_widget (xml, "orig_bankname_heading"); + orig_bankcode_heading = glade_xml_get_widget (xml, "orig_bankcode_heading"); + exec_later_button = glade_xml_get_widget (xml, "exec_later_button"); amount_edit = gnc_amount_edit_new(); gtk_box_pack_start_defaults(GTK_BOX(amount_hbox), amount_edit); @@ -189,102 +171,128 @@ gnc_hbci_trans (GtkWidget *parent, from the boxes. */ gnome_dialog_close_hides (GNOME_DIALOG (dialog), TRUE); - gtk_widget_show_all (GTK_WIDGET (dialog)); + /* Repeat until HBCI action was successful or user pressed cancel */ + do { - result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - /* printf("hbci_trans: result button was %d.\n", result); */ - - /* Was cancel pressed or dialog closed? */ - if ((result != 0) && (result != 1)) { - gtk_widget_destroy (GTK_WIDGET (dialog)); - return NULL; - } - - /* Fill in the user-entered values */ - trans = HBCI_Transaction_new(); + gtk_widget_show_all (dialog); - HBCI_Transaction_setOurCountryCode (trans, HBCI_Bank_countryCode (bank)); - HBCI_Transaction_setOurBankCode (trans, HBCI_Bank_bankCode (bank)); - HBCI_Transaction_setOurAccountId (trans, HBCI_Account_accountId (h_acc)); - HBCI_Transaction_setOurSuffix (trans, HBCI_Account_accountSuffix (h_acc)); - - HBCI_Transaction_setOtherCountryCode (trans, 280); - HBCI_Transaction_setOtherBankCode - (trans, gtk_entry_get_text (GTK_ENTRY (recp_bankcode_entry))); - /* printf("Got otherBankCode %s.\n", - HBCI_Transaction_otherBankCode (trans)); */ - HBCI_Transaction_setOtherAccountId - (trans, gtk_entry_get_text (GTK_ENTRY (recp_account_entry))); - /* printf("Got otherAccountId %s.\n", - HBCI_Transaction_otherAccountId (trans)); */ - HBCI_Transaction_addOtherName - (trans, gtk_entry_get_text (GTK_ENTRY (recp_name_entry))); - - HBCI_Transaction_addDescription - (trans, gtk_entry_get_text (GTK_ENTRY (purpose_entry))); - HBCI_Transaction_addDescription - (trans, gtk_entry_get_text (GTK_ENTRY (purpose_cont_entry))); - - HBCI_Transaction_setValue - (trans, HBCI_Value_new_double - (gnc_amount_edit_get_damount (GNC_AMOUNT_EDIT (amount_edit)), "EUR")); - /* FIXME: Replace "EUR" by account-dependent string here. */ - /*printf("dialog-hbcitrans: Got value as %s .\n", - HBCI_Value_toReadableString (HBCI_Transaction_value (trans)));*/ - if (HBCI_Value_getValue (HBCI_Transaction_value (trans)) == 0.0) { - printf("dialog-hbcitrans: Oops, value is zero. Cancelling HBCI job.\n"); - gtk_widget_destroy (GTK_WIDGET (dialog)); - HBCI_Transaction_delete (trans); - return NULL; - } - - { - /* Create a Do-Transaction (Transfer) job. */ - HBCI_OutboxJobTransfer *transfer_job; - HBCI_OutboxJobDebitNote *debit_job; - HBCI_OutboxJob *job = NULL; - - switch (trans_type) { - case SINGLE_DEBITNOTE: - debit_job = - HBCI_OutboxJobDebitNote_new (customer, (HBCI_Account *)h_acc, trans); - job = HBCI_OutboxJobDebitNote_OutboxJob (debit_job); - break; - case SINGLE_TRANSFER: - transfer_job = - HBCI_OutboxJobTransfer_new (customer, (HBCI_Account *)h_acc, trans); - job = HBCI_OutboxJobTransfer_OutboxJob (transfer_job); - break; - default: - printf("dialog-hbcitrans: Oops, unknown GNC_HBCI_Transtype %d.\n", - trans_type); - transfer_job = - HBCI_OutboxJobTransfer_new (customer, (HBCI_Account *)h_acc, trans); - job = HBCI_OutboxJobTransfer_OutboxJob (transfer_job); + result = gnome_dialog_run (GNOME_DIALOG (dialog)); + gtk_widget_hide_all (dialog); + /*result = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));*/ + /* printf("hbci_trans: result button was %d.\n", result); */ + + /* Was cancel pressed or dialog closed? 0 == execute now, 1 == + scheduled for later execution (currently unimplemented) */ + if ((result != 0) && (result != 1)) { + gtk_widget_destroy (GTK_WIDGET (dialog)); + return NULL; + } + + /* Fill in the user-entered values */ + trans = HBCI_Transaction_new(); + +#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>8) + /* OpenHBCI newer than 0.9.8: use account's bankCode values + * instead of the bank's ones since this is what some banks + * require. */ + HBCI_Transaction_setOurCountryCode (trans, + HBCI_Account_countryCode (h_acc)); + HBCI_Transaction_setOurBankCode (trans, + HBCI_Account_instituteCode (h_acc)); +#else + HBCI_Transaction_setOurCountryCode (trans, HBCI_Bank_countryCode (bank)); + HBCI_Transaction_setOurBankCode (trans, HBCI_Bank_bankCode (bank)); +#endif + HBCI_Transaction_setOurAccountId (trans, HBCI_Account_accountId (h_acc)); + HBCI_Transaction_setOurSuffix (trans, HBCI_Account_accountSuffix (h_acc)); + + HBCI_Transaction_setOtherCountryCode (trans, 280); + HBCI_Transaction_setOtherBankCode + (trans, gtk_entry_get_text (GTK_ENTRY (recp_bankcode_entry))); + /* printf("Got otherBankCode %s.\n", + HBCI_Transaction_otherBankCode (trans)); */ + HBCI_Transaction_setOtherAccountId + (trans, gtk_entry_get_text (GTK_ENTRY (recp_account_entry))); + /* printf("Got otherAccountId %s.\n", + HBCI_Transaction_otherAccountId (trans)); */ + HBCI_Transaction_addOtherName + (trans, gtk_entry_get_text (GTK_ENTRY (recp_name_entry))); + + HBCI_Transaction_addDescription + (trans, gtk_entry_get_text (GTK_ENTRY (purpose_entry))); + HBCI_Transaction_addDescription + (trans, gtk_entry_get_text (GTK_ENTRY (purpose_cont_entry))); + + HBCI_Transaction_setValue + (trans, HBCI_Value_new_double + (gnc_amount_edit_get_damount (GNC_AMOUNT_EDIT (amount_edit)), "EUR")); + /* FIXME: Replace "EUR" by account-dependent string here. */ + /*printf("dialog-hbcitrans: Got value as %s .\n", + HBCI_Value_toReadableString (HBCI_Transaction_value (trans)));*/ + if (HBCI_Value_getValue (HBCI_Transaction_value (trans)) == 0.0) { + printf("dialog-hbcitrans: Oops, value is zero. Cancelling HBCI job.\n"); + gtk_widget_destroy (GTK_WIDGET (dialog)); + HBCI_Transaction_delete (trans); + return NULL; } - g_assert (job); - HBCI_API_addJob (api, job); - - if (result == 0) { - - /* If the user pressed "execute now", then execute this job now. */ - if (!gnc_hbci_api_execute (parent, api, job, interactor)) { - - /* HBCI_API_executeOutbox failed. */ - gtk_widget_destroy (GTK_WIDGET (dialog)); - HBCI_Transaction_delete (trans); - HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_DONE); - return NULL; + { + /* Create a Do-Transaction (Transfer) job. */ + HBCI_OutboxJobTransfer *transfer_job; + HBCI_OutboxJobDebitNote *debit_job; + HBCI_OutboxJob *job = NULL; + + switch (trans_type) { + case SINGLE_DEBITNOTE: + debit_job = + HBCI_OutboxJobDebitNote_new (customer, (HBCI_Account *)h_acc, trans); + job = HBCI_OutboxJobDebitNote_OutboxJob (debit_job); + break; + case SINGLE_TRANSFER: + transfer_job = + HBCI_OutboxJobTransfer_new (customer, (HBCI_Account *)h_acc, trans); + job = HBCI_OutboxJobTransfer_OutboxJob (transfer_job); + break; + default: + printf("dialog-hbcitrans: Oops, unknown GNC_HBCI_Transtype %d.\n", + trans_type); + transfer_job = + HBCI_OutboxJobTransfer_new (customer, (HBCI_Account *)h_acc, trans); + job = HBCI_OutboxJobTransfer_OutboxJob (transfer_job); } - } - - } + HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE); - } + g_assert (job); + HBCI_API_addJob (api, job); + + if (result == 0) { + + /* If the user pressed "execute now", then execute this job now. */ + successful = gnc_hbci_api_execute (parent, api, job, interactor); + + /*printf("dialog-hbcitrans: Ok, result of api_execute was %d.\n", + successful);*/ + + if (!successful) { + /* HBCI_API_executeOutbox failed. */ + HBCI_Transaction_delete (trans); + HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE); + } + } /* result == 0 */ + else { + /* huh? Only result == 0 should be possible. Simply ignore + this case. */ + break; + } /* result == 0 */ + + } /* Create a do-transaction (transfer) job */ + + } while (!successful); + + } /* GtkWidget declarations/definitions */ - HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_DONE); + HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE); gtk_widget_destroy (GTK_WIDGET (dialog)); return trans; } diff --git a/src/import-export/hbci/druid-hbci-initial.c b/src/import-export/hbci/druid-hbci-initial.c index 11b23cdc8b..81b28f2248 100644 --- a/src/import-export/hbci/druid-hbci-initial.c +++ b/src/import-export/hbci/druid-hbci-initial.c @@ -44,6 +44,11 @@ #include #include +#include +#ifndef OPENHBCI_VERSION_BUILD +# define OPENHBCI_VERSION_BUILD 0 +#endif + typedef enum _infostate { INI_ADD_BANK, INI_ADD_USER, @@ -293,14 +298,14 @@ druid_enable_next_button(HBCIInitialInfo *info) { g_assert(info); gnome_druid_set_buttons_sensitive (GNOME_DRUID (info->druid), - TRUE, TRUE, TRUE); + TRUE, TRUE, TRUE, TRUE); } static void druid_disable_next_button(HBCIInitialInfo *info) { g_assert(info); gnome_druid_set_buttons_sensitive (GNOME_DRUID (info->druid), - TRUE, FALSE, TRUE); + TRUE, FALSE, TRUE, TRUE); } /* * end button enabling @@ -508,10 +513,8 @@ choose_hbciversion_dialog (GtkWindow *parent, HBCI_Bank *bank) xml = gnc_glade_xml_new ("hbci.glade", "HBCI_version_dialog"); - g_assert - (dialog = glade_xml_get_widget (xml, "HBCI_version_dialog")); - g_assert - (version_clist = glade_xml_get_widget (xml, "version_clist")); + dialog = glade_xml_get_widget (xml, "HBCI_version_dialog"); + version_clist = glade_xml_get_widget (xml, "version_clist"); gtk_signal_connect (GTK_OBJECT (version_clist), "select_row", GTK_SIGNAL_FUNC (hbciversion_select_row), &selected_row); gtk_signal_connect (GTK_OBJECT (version_clist), "unselect_row", @@ -664,6 +667,21 @@ on_configfile_next (GnomeDruidPage *gnomedruidpage, if (api == NULL) return TRUE; } + // no libchipcard? Make that button greyed out + if +#if ((OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>13)) + (HBCI_API_mediumType(info->api, "DDVCard") != MediumTypeCard) +#else /* openhbci > 0.9.9.13 */ + (! HBCI_Hbci_hasLibchipcard ()) +#endif /* openhbci <= 0.9.9.13 */ + { + gtk_widget_set_sensitive (GTK_WIDGET (info->mediumddv), + FALSE); + } else { + gtk_widget_set_sensitive (GTK_WIDGET (info->mediumddv), + TRUE); + } + /* Get HBCI bank and account list */ { @@ -886,6 +904,7 @@ on_userid_next (GnomeDruidPage *gnomedruidpage, HBCI_User *newuser; HBCI_Error *err; char *mediumname; + const char *mediumtype; int secmode; //printf("on_userid_next: Didn't find user with userid %s.\n", userid); @@ -909,18 +928,30 @@ on_userid_next (GnomeDruidPage *gnomedruidpage, return TRUE; } secmode = HBCI_SECURITY_RDH; + mediumtype = "RDHFile"; } else { /* Create DDV Medium */ mediumname = g_strdup(""); secmode = HBCI_SECURITY_DDV; + mediumtype = "DDVCard"; } +#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5) + medium = HBCI_API_createNewMedium (api, + mediumtype, + FALSE, + HBCI_Bank_countryCode (bank), + HBCI_Bank_bankCode (bank), + userid, + mediumname, &err); +#else /* openhbci > 0.9.9.5 */ medium = HBCI_API_createNewMedium (api, HBCI_Bank_countryCode (bank), HBCI_Bank_bankCode (bank), userid, mediumname, secmode, &err); +#endif /* openhbci > 0.9.9.5 */ g_free(mediumname); if (medium == NULL) { @@ -944,7 +975,11 @@ on_userid_next (GnomeDruidPage *gnomedruidpage, /* Test mounting only for DDV cards. RDH files should work... */ if (secmode == HBCI_SECURITY_DDV) { +#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5) + err = HBCI_Medium_mountMedium (medium, NULL); +#else /* openhbci > 0.9.9.5 */ err = HBCI_Medium_mountMedium (medium, newuser, NULL); +#endif /* openhbci > 0.9.9.5 */ if (err != NULL) { printf("on_userid_next: Mounting medium failed: %s.\n", HBCI_Error_message (err)); @@ -1050,7 +1085,7 @@ on_accountinfo_next (GnomeDruidPage *gnomedruidpage, return FALSE; } - HBCI_API_clearQueueByStatus (info->api, HBCI_JOB_STATUS_DONE); + HBCI_API_clearQueueByStatus (info->api, HBCI_JOB_STATUS_NONE); } //update_accountlist(info->api); @@ -1090,7 +1125,7 @@ on_accountlist_prepare (GnomeDruidPage *gnomedruidpage, info->gnc_hash = gnc_hbci_new_hash_from_kvp (info->api); gnome_druid_set_buttons_sensitive (GNOME_DRUID (info->druid), - FALSE, TRUE, TRUE); + FALSE, TRUE, TRUE, TRUE); update_accountlist(info); } @@ -1171,7 +1206,7 @@ on_iniletter_info_next (GnomeDruidPage *gnomedruidpage, return FALSE; } - HBCI_API_clearQueueByStatus (info->api, HBCI_JOB_STATUS_DONE); + HBCI_API_clearQueueByStatus (info->api, HBCI_JOB_STATUS_NONE); info->gotkeysforCustomer = info->newcustomer; } @@ -1303,7 +1338,7 @@ on_iniletter_userinfo_next (GnomeDruidPage *gnomedruidpage, return FALSE; } - HBCI_API_clearQueueByStatus (info->api, HBCI_JOB_STATUS_DONE); + HBCI_API_clearQueueByStatus (info->api, HBCI_JOB_STATUS_NONE); } else { printf("on_iniletter_userinfo_next: Oops, already got keys for another customer. Not yet implemented.\n"); @@ -1412,7 +1447,7 @@ on_button_clicked (GtkButton *button, gpointer user_data) { HBCIInitialInfo *info = user_data; - char *name; + const char *name; g_assert(info->druid); g_assert(info->userpage); @@ -1507,7 +1542,7 @@ void gnc_hbci_initial_druid (void) g_strdup (gnc_hbci_get_book_configfile (gnc_get_current_book () )); if (info->configfile && g_file_test (info->configfile, - G_FILE_TEST_ISFILE | G_FILE_TEST_ISLINK)) + G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK)) gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (info->configfileentry))), @@ -1562,10 +1597,6 @@ void gnc_hbci_initial_druid (void) curdir); g_free (curdir); } - // no libchipcard? Make that button greyed out - if (! HBCI_Hbci_hasLibchipcard ()) - gtk_widget_set_sensitive (GTK_WIDGET (info->mediumddv), - FALSE); gtk_signal_connect (GTK_OBJECT (page), "back", GTK_SIGNAL_FUNC (on_userid_back), info); gtk_signal_connect (GTK_OBJECT (page), "prepare", diff --git a/src/import-export/hbci/druid-hbci-utils.c b/src/import-export/hbci/druid-hbci-utils.c index 8dadd02072..d5984e7382 100644 --- a/src/import-export/hbci/druid-hbci-utils.c +++ b/src/import-export/hbci/druid-hbci-utils.c @@ -246,7 +246,7 @@ gnc_verify_exist_or_new_file (GtkWidget *parent, const char *filename) { g_assert (parent); - if (g_file_test (filename, G_FILE_TEST_ISFILE | G_FILE_TEST_ISLINK)) { + if (g_file_test (filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK)) { return TRUE; } @@ -261,7 +261,7 @@ gboolean gnc_test_dir_exist_error (GtkWindow *parent, const char *filename) { char *dirname = g_dirname (filename); - gboolean dirtest = g_file_test (dirname, G_FILE_TEST_ISDIR); + gboolean dirtest = g_file_test (dirname, G_FILE_TEST_IS_DIR); g_free (dirname); if (!dirtest) { gnc_error_dialog_parented diff --git a/src/import-export/hbci/glade/hbci.glade b/src/import-export/hbci/glade/hbci.glade index c3183de310..6d92bd2f4e 100644 --- a/src/import-export/hbci/glade/hbci.glade +++ b/src/import-export/hbci/glade/hbci.glade @@ -2614,7 +2614,7 @@ Press 'Finish' now. GTK_UPDATE_CONTINUOUS - GtkText + GtkTextView log_text True False diff --git a/src/import-export/hbci/gnc-hbci-getbalance.c b/src/import-export/hbci/gnc-hbci-getbalance.c index 331021afbe..81b6f346bb 100644 --- a/src/import-export/hbci/gnc-hbci-getbalance.c +++ b/src/import-export/hbci/gnc-hbci-getbalance.c @@ -214,7 +214,7 @@ gnc_hbci_getbalance (GtkWidget *parent, Account *gnc_acc) booked_tt); } - HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_DONE); + HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE); } } } diff --git a/src/import-export/hbci/gnc-hbci-gettrans.c b/src/import-export/hbci/gnc-hbci-gettrans.c index ad994d1f2e..825a10b1a6 100644 --- a/src/import-export/hbci/gnc-hbci-gettrans.c +++ b/src/import-export/hbci/gnc-hbci-gettrans.c @@ -234,7 +234,7 @@ gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc) } /* Clean up behind ourself. */ - HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_DONE); + HBCI_API_clearQueueByStatus (api, HBCI_JOB_STATUS_NONE); } } diff --git a/src/import-export/hbci/gnc-hbci-utils.c b/src/import-export/hbci/gnc-hbci-utils.c index 981f5b9e8d..6d79623f8a 100644 --- a/src/import-export/hbci/gnc-hbci-utils.c +++ b/src/import-export/hbci/gnc-hbci-utils.c @@ -49,7 +49,7 @@ gnc_hbci_api_new (const char *filename, gboolean allowNewFile, if (!filename) return NULL; if (!allowNewFile && - (!g_file_test (filename, G_FILE_TEST_ISFILE | G_FILE_TEST_ISLINK))) + (!g_file_test (filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_IS_SYMLINK))) { /* ENOENT is "No such file or directory" */ gchar *errstring = g_strdup_printf ("%s: %s", filename, strerror (ENOENT)); diff --git a/src/import-export/hbci/hbci-interaction.c b/src/import-export/hbci/hbci-interaction.c index 0ccd969592..024e9efac3 100644 --- a/src/import-export/hbci/hbci-interaction.c +++ b/src/import-export/hbci/hbci-interaction.c @@ -38,6 +38,11 @@ #include "dialog-pass.h" +#include +#ifndef OPENHBCI_VERSION_BUILD +# define OPENHBCI_VERSION_BUILD 0 +#endif + #define PREF_TAB_ONLINE_BANKING N_("Online Banking & Importing") @@ -93,7 +98,12 @@ void GNCInteractor_show(GNCInteractor *i) void GNCInteractor_hide(GNCInteractor *i) { g_assert(i); - gtk_widget_hide_all (i->dialog); + if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (i->close_checkbutton))) + gtk_widget_hide_all (i->dialog); + gnc_set_boolean_option ("__gui", "hbci_close_on_finish", + gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (i->close_checkbutton))); } void GNCInteractor_delete(GNCInteractor *data) @@ -104,7 +114,7 @@ void GNCInteractor_delete(GNCInteractor *data) gnc_set_boolean_option ("__gui", "hbci_close_on_finish", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->close_checkbutton))); - g_object_unref (GTK_OBJECT (data->dialog)); + gtk_object_unref (GTK_OBJECT (data->dialog)); gtk_widget_destroy (data->dialog); } @@ -242,7 +252,7 @@ static int msgInputPin(const HBCI_User *user, if (!retval) break; - if (strlen(passwd) < minsize) { + if (strlen(passwd) < (unsigned int)minsize) { gboolean retval; char *msg = g_strdup_printf ( _("The PIN needs to be at least %d characters \n" @@ -276,7 +286,7 @@ static int msgInputPin(const HBCI_User *user, static int msgInsertMediumOrAbort(const HBCI_User *user, - MediumType t, + MediumType mtype, void *user_data) { GNCInteractor *data = user_data; @@ -291,21 +301,67 @@ static int msgInsertMediumOrAbort(const HBCI_User *user, (HBCI_User_userId (user) ? HBCI_User_userId (user) : _("Unknown"))); b = HBCI_User_bank (user); - if (b != NULL) - /* xgettext:c-format */ - msgstr = g_strdup_printf ( _("Please insert chip card for \n" - "user '%s' at bank '%s'."), - username, bank_to_str (b)); - else - /* xgettext:c-format */ - msgstr = g_strdup_printf ( _("Please insert chip card for \n" - "user '%s' at unknown bank."), - username); + switch (mtype) + { +#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5) + case MediumTypeFile: +#else /* openhbci > 0.9.9.5 */ + case MediumRDHFile: + case MediumRDHFileOld: +#endif /* openhbci > 0.9.9.5 */ + if (b != NULL) + /* xgettext:c-format */ + msgstr = g_strdup_printf ( _("Please make sure the key file for \n" + "user '%s' at bank '%s' can be accessed."), + username, bank_to_str (b)); + else + /* xgettext:c-format */ + msgstr = g_strdup_printf ( _("Please make sure the key file for \n" + "user '%s' at unknown bank can be accessed."), + username); + break; +#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5) + case MediumTypeCard: +#else /* openhbci > 0.9.9.5 */ + case MediumDDVCard: + case MediumRDHCard: +#endif /* openhbci > 0.9.9.5 */ + default: + if (b != NULL) + /* xgettext:c-format */ + msgstr = g_strdup_printf ( _("Please insert chip card for \n" + "user '%s' at bank '%s'."), + username, bank_to_str (b)); + else + /* xgettext:c-format */ + msgstr = g_strdup_printf ( _("Please insert chip card for \n" + "user '%s' at unknown bank."), + username); + } } else - msgstr = g_strdup ( _("Please insert chip card for \n" - "unknown user at unknown bank.")); - + switch (mtype) + { +#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5) + case MediumTypeFile: +#else /* openhbci > 0.9.9.5 */ + case MediumRDHFile: + case MediumRDHFileOld: +#endif /* openhbci > 0.9.9.5 */ + msgstr = g_strdup ( _("Please make sure the key file for \n" + "unknown user at unknown bank can be accessed.")); + break; +#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5) + case MediumTypeCard: +#else /* openhbci > 0.9.9.5 */ + case MediumDDVCard: + case MediumRDHCard: +#endif /* openhbci > 0.9.9.5 */ + default: + msgstr = g_strdup ( _("Please insert chip card for \n" + "unknown user at unknown bank.")); + } + retval = gnc_ok_cancel_dialog_parented (data->parent, GNC_VERIFY_OK, msgstr); @@ -316,7 +372,7 @@ static int msgInsertMediumOrAbort(const HBCI_User *user, static int msgInsertCorrectMediumOrAbort(const HBCI_User *user, - MediumType t, + MediumType mtype, void *user_data) { GNCInteractor *data = user_data; @@ -331,21 +387,70 @@ static int msgInsertCorrectMediumOrAbort(const HBCI_User *user, (HBCI_User_userId (user) ? HBCI_User_userId (user) : _("Unknown"))); b = HBCI_User_bank (user); - if (b != NULL) - /* xgettext:c-format */ - msgstr = g_strdup_printf ( _("Please insert the correct chip card for \n" - "user '%s' at bank '%s'."), - username, bank_to_str (b)); - else - /* xgettext:c-format */ - msgstr = g_strdup_printf ( _("Please insert the correct chip card for \n" - "user '%s' at unknown bank."), - username); + switch (mtype) + { +#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5) + case MediumTypeFile: +#else /* openhbci > 0.9.9.5 */ + case MediumRDHFile: + case MediumRDHFileOld: +#endif /* openhbci > 0.9.9.5 */ + if (b != NULL) + /* xgettext:c-format */ + msgstr = g_strdup_printf ( _("The key file does not seem to be the correct \n" + "file for user '%s' at bank '%s'. Please make \n" + "sure the correct key file can be accessed."), + username, bank_to_str (b)); + else + /* xgettext:c-format */ + msgstr = g_strdup_printf ( _("The key file does not seem to be the correct \n" + "file for user '%s' at unknown bank. Please make \n" + "sure the correct key file can be accessed."), + username); + break; +#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5) + case MediumTypeCard: +#else /* openhbci > 0.9.9.5 */ + case MediumDDVCard: + case MediumRDHCard: +#endif /* openhbci > 0.9.9.5 */ + default: + if (b != NULL) + /* xgettext:c-format */ + msgstr = g_strdup_printf ( _("Please insert the correct chip card for \n" + "user '%s' at bank '%s'."), + username, bank_to_str (b)); + else + /* xgettext:c-format */ + msgstr = g_strdup_printf ( _("Please insert the correct chip card for \n" + "user '%s' at unknown bank."), + username); + } } else - msgstr = g_strdup ( _("Please insert the correct chip card for \n" - "unknown user at unknown bank.")); - + switch (mtype) + { +#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5) + case MediumTypeFile: +#else /* openhbci > 0.9.9.5 */ + case MediumRDHFile: + case MediumRDHFileOld: +#endif /* openhbci > 0.9.9.5 */ + msgstr = g_strdup ( _("The key file does not seem to be the correct \n" + "file for unknown user at unknown bank. Please make \n" + "sure the correct key file can be accessed.")); + break; +#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>9) || (OPENHBCI_VERSION_BUILD>5) + case MediumTypeCard: +#else /* openhbci > 0.9.9.5 */ + case MediumDDVCard: + case MediumRDHCard: +#endif /* openhbci > 0.9.9.5 */ + default: + msgstr = g_strdup ( _("Please insert the correct chip card for \n" + "unknown user at unknown bank.")); + } + retval = gnc_ok_cancel_dialog_parented (data->parent, GNC_VERIFY_OK, msgstr); diff --git a/src/import-export/hbci/hbci-progressmon.c b/src/import-export/hbci/hbci-progressmon.c index 404883d19c..687b9702f3 100644 --- a/src/import-export/hbci/hbci-progressmon.c +++ b/src/import-export/hbci/hbci-progressmon.c @@ -28,6 +28,7 @@ #include #include +#include #include "dialog-utils.h" #include "druid-utils.h" #include "gnc-ui-util.h" @@ -174,6 +175,19 @@ static void jobStarted(JobProgressType type, int actions, void *user_data) case JOB_SEND_KEYS: msg = _("Job: Send Keys"); break; +#if (OPENHBCI_VERSION_MAJOR>0) || (OPENHBCI_VERSION_MINOR>9) || (OPENHBCI_VERSION_PATCHLEVEL>8) + /** Disable keys */ + case JOB_DISABLE_KEYS: + msg = _("Job: Disable Keys"); + break; + /** Change keys */ + case JOB_CHANGE_KEYS: + msg = _("Job: Change Keys"); + break; +#else /* OPENHBCI_VERSION > 0.9.8 */ + default: + msg = _("Unknown"); +#endif /* OPENHBCI_VERSION > 0.9.8 */ } g_assert(msg); @@ -286,16 +300,16 @@ static void logMsg (const char *msg, void *user_data) void add_log_text (GNCInteractor *data, const char *msg) { - int pos; + /*int pos;*/ g_assert(data); - pos = gtk_text_get_length (GTK_TEXT (data->log_text)); - gtk_editable_insert_text (GTK_EDITABLE (data->log_text), - msg, strlen (msg), - &pos); - gtk_editable_insert_text (GTK_EDITABLE (data->log_text), - "\n", 1, - &pos); + /* pos = gtk_text_get_length (GTK_TEXT_VIEW (data->log_text)); */ + gtk_text_buffer_insert_at_cursor + (gtk_text_view_get_buffer(GTK_TEXT_VIEW (data->log_text)), + msg, -1); + gtk_text_buffer_insert_at_cursor + (gtk_text_view_get_buffer(GTK_TEXT_VIEW (data->log_text)), + "\n", -1); } static void destr(void *user_data) @@ -309,7 +323,7 @@ on_button_clicked (GtkButton *button, gpointer user_data) { GNCInteractor *data = user_data; - char *name; + const char *name; g_assert(data); name = gtk_widget_get_name (GTK_WIDGET (button)); @@ -317,7 +331,8 @@ on_button_clicked (GtkButton *button, GNCInteractor_setAborted(data); } else if (strcmp (name, "close_button") == 0) { if (data->state != RUNNING) - GNCInteractor_hide (data); + gtk_widget_hide_all (data->dialog); + /*GNCInteractor_hide (data);*/ } else { printf("on_button_clicked: Oops, unknown button: %s\n", name); @@ -335,18 +350,18 @@ gnc_hbci_new_pmonitor(GNCInteractor *data) xml = gnc_glade_xml_new ("hbci.glade", "HBCI_connection_dialog"); - g_assert (dialog = glade_xml_get_widget (xml, "HBCI_connection_dialog")); + (dialog = glade_xml_get_widget (xml, "HBCI_connection_dialog")); data->dialog = dialog; - g_assert (data->job_entry = glade_xml_get_widget (xml, "job_entry")); - g_assert (data->action_entry = glade_xml_get_widget (xml, "action_entry")); - g_assert (data->action_progress = + (data->job_entry = glade_xml_get_widget (xml, "job_entry")); + (data->action_entry = glade_xml_get_widget (xml, "action_entry")); + (data->action_progress = glade_xml_get_widget (xml, "action_progress")); - g_assert (data->log_text = glade_xml_get_widget (xml, "log_text")); - g_assert (data->abort_button = glade_xml_get_widget (xml, "abort_button")); + (data->log_text = glade_xml_get_widget (xml, "log_text")); + (data->abort_button = glade_xml_get_widget (xml, "abort_button")); gtk_widget_set_sensitive (GTK_WIDGET (data->abort_button), FALSE); - g_assert (data->close_button = glade_xml_get_widget (xml, "close_button")); - g_assert (data->close_checkbutton = - glade_xml_get_widget (xml, "close_checkbutton")); + (data->close_button = glade_xml_get_widget (xml, "close_button")); + (data->close_checkbutton = + glade_xml_get_widget (xml, "close_checkbutton")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->close_checkbutton), @@ -361,7 +376,7 @@ gnc_hbci_new_pmonitor(GNCInteractor *data) gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (data->parent)); //gtk_widget_set_parent (GTK_WIDGET (dialog), data->parent); - g_object_ref (GTK_OBJECT (dialog)); + gtk_object_ref (GTK_OBJECT (dialog)); gtk_widget_hide_all (dialog); pmon = HBCI_ProgressMonitorCB_new(&destr,