diff --git a/ChangeLog b/ChangeLog index c1b45f95d8..d72cd953b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-02-24 Christian Stimming + * src/import-export/import-account-matcher.h: Let the account + matcher accept a parent widget to avoid windows that are lost + behind other windows. Adapt importer modules accordingly. + * src/import-export/import-account-matcher.c: Don't allow placeholder be selected for importing transactions. Fixes bug#327891. diff --git a/src/import-export/hbci/druid-hbci-initial.c b/src/import-export/hbci/druid-hbci-initial.c index f5e34b8740..afea803f0d 100644 --- a/src/import-export/hbci/druid-hbci-initial.c +++ b/src/import-export/hbci/druid-hbci-initial.c @@ -399,7 +399,8 @@ on_accountlist_select_row (GtkCList *clist, gint row, GNC_COMMODITY_NS_ISO, AB_Account_GetCurrency (hbci_acc)); } - gnc_acc = gnc_import_select_account(NULL, TRUE, longname, currency, BANK, + gnc_acc = gnc_import_select_account(info->window, + NULL, TRUE, longname, currency, BANK, old_value, NULL); g_free(longname); diff --git a/src/import-export/import-account-matcher.c b/src/import-export/import-account-matcher.c index ed17885907..698e6088fa 100644 --- a/src/import-export/import-account-matcher.c +++ b/src/import-export/import-account-matcher.c @@ -121,7 +121,8 @@ static gpointer test_acct_online_id_match(Account *acct, gpointer param_online_i } } -Account * gnc_import_select_account(const gchar * account_online_id_value, +Account * gnc_import_select_account(gncUIWidget parent, + const gchar * account_online_id_value, gboolean auto_create, const gchar * account_human_description, gnc_commodity * new_account_default_commodity, @@ -168,6 +169,9 @@ Account * gnc_import_select_account(const gchar * account_online_id_value, } picker->dialog = glade_xml_get_widget (xml, "Generic Import Account Picker"); + if (parent) + gtk_window_set_transient_for (GTK_WINDOW (picker->dialog), + GTK_WINDOW (parent)); picker->account_tree_sw = glade_xml_get_widget (xml, "account_tree_sw"); online_id_label = glade_xml_get_widget (xml, "online_id_label"); button = glade_xml_get_widget (xml, "newbutton"); @@ -205,9 +209,11 @@ Account * gnc_import_select_account(const gchar * account_online_id_value, /* See if the selected account is a placeholder. */ if (xaccAccountGetPlaceholder (retval)) { - gnc_error_dialog (/* FIXME: add parent*/ NULL, - _("The account %s does not allow transactions."), - xaccAccountGetName (retval)); + gnc_error_dialog + (picker->dialog, + _("The account %s is a placeholder account and does not allow " + "transactions. Please choose a different account."), + xaccAccountGetName (retval)); response = GNC_RESPONSE_NEW; break; } diff --git a/src/import-export/import-account-matcher.h b/src/import-export/import-account-matcher.h index 7077fb39ad..aa90ed7125 100644 --- a/src/import-export/import-account-matcher.h +++ b/src/import-export/import-account-matcher.h @@ -26,6 +26,7 @@ #define ACCOUNT_MATCHER_H #include "Account.h" +#include "gnc-ui-common.h" /** Must be called with a string containing a unique identifier for the account. If an account with a matching online_id kvp_frame is @@ -36,6 +37,8 @@ again). If the user refuses to select or create an account, NULL is returned. + @param parent The parent widget. Can be NULL. + @param account_online_id_value The string containing your unique account_id coming from some string of your module. This is the normal mode of operation. Can be NULL. @@ -86,7 +89,8 @@ @return A pointer to the found or created Account, or NULL if no account was found or created. */ -Account * gnc_import_select_account(const gchar * account_online_id_value, +Account * gnc_import_select_account(gncUIWidget parent, + const gchar * account_online_id_value, gboolean auto_create, const gchar * account_human_description, gnc_commodity * new_account_default_commodity, diff --git a/src/import-export/import-main-matcher.c b/src/import-export/import-main-matcher.c index 4b72dd7b9f..7755bb175c 100644 --- a/src/import-export/import-main-matcher.c +++ b/src/import-export/import-main-matcher.c @@ -298,7 +298,8 @@ run_account_picker_dialog (GNCImportMainMatcher *info, gboolean ok_pressed; g_assert (trans_info); old_acc = gnc_import_TransInfo_get_destacc (trans_info); - new_acc = gnc_import_select_account(NULL, + new_acc = gnc_import_select_account(info->dialog, + NULL, TRUE, _("Destination account for the auto-balance split."), xaccTransGetCurrency(gnc_import_TransInfo_get_trans(trans_info)), diff --git a/src/import-export/mt940/gnc-mt940-import.c b/src/import-export/mt940/gnc-mt940-import.c index 847c43bc3b..22cc3b7383 100644 --- a/src/import-export/mt940/gnc-mt940-import.c +++ b/src/import-export/mt940/gnc-mt940-import.c @@ -211,7 +211,8 @@ accountinfolist_cb(AB_IMEXPORTER_ACCOUNTINFO *accinfo, void *user_data) { AB_ImExporterAccountInfo_GetAccountName(accinfo); gchar *online_id = g_strconcat (bank_code, account_number, NULL); - gnc_acc = gnc_import_select_account(online_id, 1, account_name, NULL, + gnc_acc = gnc_import_select_account(NULL, + online_id, 1, account_name, NULL, NO_TYPE, NULL, NULL); g_free(online_id); if (gnc_acc) { diff --git a/src/import-export/ofx/gnc-ofx-import.c b/src/import-export/ofx/gnc-ofx-import.c index 6f213ddbbb..bc8dbde44c 100644 --- a/src/import-export/ofx/gnc-ofx-import.c +++ b/src/import-export/ofx/gnc-ofx-import.c @@ -122,7 +122,8 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_u g_assert(gnc_ofx_importer_gui); if(data.account_id_valid==true){ - account = gnc_import_select_account(data.account_id, 0, NULL, NULL, NO_TYPE, NULL, NULL); + account = gnc_import_select_account(NULL, + data.account_id, 0, NULL, NULL, NO_TYPE, NULL, NULL); if(account!=NULL) { /********** Create the transaction and setup transaction data ************/ @@ -347,7 +348,8 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_u in any translations. */ _("Stock account for security \"%s\""), data.security_data_ptr->secname); - investment_account = gnc_import_select_account(data.unique_id, + investment_account = gnc_import_select_account(NULL, + data.unique_id, 1, investment_account_text, investment_commodity, @@ -413,6 +415,7 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_u _("Income account for security \"%s\""), data.security_data_ptr->secname); income_account=gnc_import_select_account(NULL, + NULL, 1, investment_account_text, currency, @@ -582,7 +585,10 @@ int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data) "%s \"%s\"", account_type_name, data.account_name); - selected_account = gnc_import_select_account(data.account_id, 1, account_description, default_commodity, default_type, NULL, NULL); + selected_account = gnc_import_select_account(NULL, + data.account_id, 1, + account_description, default_commodity, + default_type, NULL, NULL); g_free(account_description); g_free(account_type_name); }