From 7033b331ee47b601279e68464323fe76b7ceebe5 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 31 Mar 2018 17:01:56 +0100 Subject: [PATCH 1/5] Bug794707 - Aqbanking combo boxes missing selection. Modified w_combobox.c setup procedure was had an error when modified for gtk3 use. --- borrowed/gwengui-gtk3/w_combobox.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/borrowed/gwengui-gtk3/w_combobox.c b/borrowed/gwengui-gtk3/w_combobox.c index f82dbf8e6b..50dc1dc074 100644 --- a/borrowed/gwengui-gtk3/w_combobox.c +++ b/borrowed/gwengui-gtk3/w_combobox.c @@ -258,10 +258,13 @@ int Gtk3Gui_WComboBox_Setup(GWEN_WIDGET *w) { /* create widget */ store=gtk_list_store_new(1, G_TYPE_STRING); if (flags & GWEN_WIDGET_FLAGS_READONLY) - g=gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(store)); + g=gtk_combo_box_new_with_model(GTK_TREE_MODEL(store)); else + { /* TODO: why the heck does *this* combo box have two columns in the list?? */ g=gtk_combo_box_new_with_model_and_entry(GTK_TREE_MODEL(store)); + gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX(g), 0); + } g_object_unref(store); cr=gtk_cell_renderer_text_new(); From f7211edbabdc8c802168b93973a1164067fed264 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 31 Mar 2018 17:05:05 +0100 Subject: [PATCH 2/5] Couple of missing properties for groupbox When fixing related combo error a couple of critical errors were logged for 'Function is not appropriate for this type of widget' which turned out to be visibility properties so added them to stop error. --- borrowed/gwengui-gtk3/w_groupbox.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/borrowed/gwengui-gtk3/w_groupbox.c b/borrowed/gwengui-gtk3/w_groupbox.c index 65fde56e0b..be41b5dd55 100644 --- a/borrowed/gwengui-gtk3/w_groupbox.c +++ b/borrowed/gwengui-gtk3/w_groupbox.c @@ -36,6 +36,10 @@ int Gtk3Gui_WGroupBox_SetIntProperty(GWEN_WIDGET *w, /* just ignore these for now */ return 0; + case GWEN_DialogProperty_Visibility: + gtk_widget_set_visible (GTK_WIDGET(g), (value==0)?FALSE:TRUE); + return 0; + default: break; } @@ -72,6 +76,9 @@ int Gtk3Gui_WGroupBox_GetIntProperty(GWEN_WIDGET *w, /* just ignore these for now */ return 0; + case GWEN_DialogProperty_Visibility: + return (gtk_widget_get_visible(GTK_WIDGET(g))==TRUE)?1:0; + default: break; } From 3f7d70ace3f35ce71e94eaf1707cd538a7a28f79 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 31 Mar 2018 17:08:53 +0100 Subject: [PATCH 3/5] Error for lineedit when setting text Critical errors were logged when trying to set the gtkentry text when value is null, test for this before setting entry text. --- borrowed/gwengui-gtk3/w_lineedit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/borrowed/gwengui-gtk3/w_lineedit.c b/borrowed/gwengui-gtk3/w_lineedit.c index 2fe7062732..90aa126bbe 100644 --- a/borrowed/gwengui-gtk3/w_lineedit.c +++ b/borrowed/gwengui-gtk3/w_lineedit.c @@ -97,7 +97,8 @@ int Gtk3Gui_WLineEdit_SetCharProperty(GWEN_WIDGET *w, switch(prop) { case GWEN_DialogProperty_Value: - gtk_entry_set_text(GTK_ENTRY(g), value); + if (value && *value) + gtk_entry_set_text(GTK_ENTRY(g), value); return 0; default: break; From 9b120f95a975bd6a977a3f0485c54a9e4f08c597 Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 31 Mar 2018 17:11:15 +0100 Subject: [PATCH 4/5] Missing container add for textbrowser Needed to add gtk_container_add to add the text_view to the scroll window. --- borrowed/gwengui-gtk3/w_textbrowser.c | 1 + 1 file changed, 1 insertion(+) diff --git a/borrowed/gwengui-gtk3/w_textbrowser.c b/borrowed/gwengui-gtk3/w_textbrowser.c index 8d1393f221..bd722d0678 100644 --- a/borrowed/gwengui-gtk3/w_textbrowser.c +++ b/borrowed/gwengui-gtk3/w_textbrowser.c @@ -203,6 +203,7 @@ static int Gtk3Gui_WTextBrowser_Setup(GWEN_WIDGET *w) { /* create widget */ gs=gtk_scrolled_window_new(NULL, NULL); g=gtk_text_view_new(); + gtk_container_add(GTK_CONTAINER(gs), GTK_WIDGET(g)); if (s && *s) { GWEN_BUFFER *tbuf; From c9f497cf78696d508b02af4787260ef8ed34cefa Mon Sep 17 00:00:00 2001 From: Robert Fewell <14uBobIT@gmail.com> Date: Sat, 31 Mar 2018 17:13:41 +0100 Subject: [PATCH 5/5] Fix transient parent warnings when doing MT940 import --- gnucash/import-export/aqb/gnc-ab-utils.c | 20 ++++++++++--------- .../import-export/aqb/gnc-file-aqb-import.c | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/gnucash/import-export/aqb/gnc-ab-utils.c b/gnucash/import-export/aqb/gnc-ab-utils.c index 161aca6e2f..549fd28045 100644 --- a/gnucash/import-export/aqb/gnc-ab-utils.c +++ b/gnucash/import-export/aqb/gnc-ab-utils.c @@ -60,9 +60,9 @@ static AB_BANKING *gnc_AB_BANKING = NULL; static gint gnc_AB_BANKING_refcount = 0; static gpointer join_ab_strings_cb(const gchar *str, gpointer user_data); -static Account *gnc_ab_accinfo_to_gnc_acc( +static Account *gnc_ab_accinfo_to_gnc_acc(GtkWidget *parent, AB_IMEXPORTER_ACCOUNTINFO *account_info); -static Account *gnc_ab_txn_to_gnc_acc( +static Account *gnc_ab_txn_to_gnc_acc(GtkWidget *parent, const AB_TRANSACTION *transaction); static const AB_TRANSACTION *txn_transaction_cb( const AB_TRANSACTION *element, gpointer user_data); @@ -590,11 +590,12 @@ gnc_ab_trans_to_gnc(const AB_TRANSACTION *ab_trans, Account *gnc_acc) * Call gnc_import_select_account() on the online id constructed using * the information in @a acc_info. * + * @param parent Parent Widget * @param acc_info AB_IMEXPORTER_ACCOUNTINFO * @return A GnuCash account, or NULL otherwise */ static Account * -gnc_ab_accinfo_to_gnc_acc(AB_IMEXPORTER_ACCOUNTINFO *acc_info) +gnc_ab_accinfo_to_gnc_acc(GtkWidget *parent, AB_IMEXPORTER_ACCOUNTINFO *acc_info) { const gchar *bankcode, *accountnumber; gchar *online_id; @@ -608,7 +609,7 @@ gnc_ab_accinfo_to_gnc_acc(AB_IMEXPORTER_ACCOUNTINFO *acc_info) accountnumber ? accountnumber : "", (gchar*)NULL); gnc_acc = gnc_import_select_account( - NULL, online_id, 1, AB_ImExporterAccountInfo_GetAccountName(acc_info), + parent, online_id, 1, AB_ImExporterAccountInfo_GetAccountName(acc_info), NULL, ACCT_TYPE_NONE, NULL, NULL); if (!gnc_acc) { @@ -625,11 +626,12 @@ gnc_ab_accinfo_to_gnc_acc(AB_IMEXPORTER_ACCOUNTINFO *acc_info) * Call gnc_import_select_account() on the online id constructed using * the local information in @a transaction. * + * @param parent Parent Widget * @param transaction AB_TRANSACTION * @return A GnuCash account, or NULL otherwise */ static Account * -gnc_ab_txn_to_gnc_acc(const AB_TRANSACTION *transaction) +gnc_ab_txn_to_gnc_acc(GtkWidget *parent, const AB_TRANSACTION *transaction) { const gchar *bankcode, *accountnumber; gchar *online_id; @@ -648,7 +650,7 @@ gnc_ab_txn_to_gnc_acc(const AB_TRANSACTION *transaction) accountnumber ? accountnumber : "", (gchar*)NULL); gnc_acc = gnc_import_select_account( - NULL, online_id, 1, AB_Transaction_GetLocalName(transaction), + parent, online_id, 1, AB_Transaction_GetLocalName(transaction), NULL, ACCT_TYPE_NONE, NULL, NULL); if (!gnc_acc) { @@ -671,7 +673,7 @@ txn_transaction_cb(const AB_TRANSACTION *element, gpointer user_data) g_return_val_if_fail(element && data, NULL); /* Create a GnuCash transaction from ab_trans */ - txnacc = gnc_ab_txn_to_gnc_acc(element); + txnacc = gnc_ab_txn_to_gnc_acc(GTK_WIDGET(data->parent), element); gnc_trans = gnc_ab_trans_to_gnc(element, txnacc ? txnacc : data->gnc_acc); if (data->execute_txns && data->ab_acc) @@ -824,7 +826,7 @@ txn_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data) } /* Lookup the corresponding gnucash account */ - gnc_acc = gnc_ab_accinfo_to_gnc_acc(element); + gnc_acc = gnc_ab_accinfo_to_gnc_acc(GTK_WIDGET(data->parent), element); if (!gnc_acc) return NULL; data->gnc_acc = gnc_acc; @@ -928,7 +930,7 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data) } /* Lookup the corresponding gnucash account */ - gnc_acc = gnc_ab_accinfo_to_gnc_acc(element); + gnc_acc = gnc_ab_accinfo_to_gnc_acc(GTK_WIDGET (data->parent), element); if (!gnc_acc) return NULL; data->gnc_acc = gnc_acc; diff --git a/gnucash/import-export/aqb/gnc-file-aqb-import.c b/gnucash/import-export/aqb/gnc-file-aqb-import.c index b7cbbddf87..16cc8d3d2d 100644 --- a/gnucash/import-export/aqb/gnc-file-aqb-import.c +++ b/gnucash/import-export/aqb/gnc-file-aqb-import.c @@ -236,7 +236,7 @@ gnc_file_aqbanking_import(GtkWindow *parent, ieci = gnc_ab_import_context(context, AWAIT_TRANSACTIONS, execute_transactions, execute_transactions ? api : NULL, - NULL); + GTK_WIDGET(parent)); if (execute_transactions) {