gnucash maint: Multiple changes pushed

Christopher Lam clam at code.gnucash.org
Tue Sep 20 12:12:25 EDT 2022


Updated	 via  https://github.com/Gnucash/gnucash/commit/788c3ee6 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3e4a4dbf (commit)
	from  https://github.com/Gnucash/gnucash/commit/2505955a (commit)



commit 788c3ee6176d1a843769d12b9008b7e619ec741a
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Sep 21 00:06:25 2022 +0800

    [import-main-matcher] setup_entry handles NULL and empty initial
    
    gtk_entry_set_text throws a warning if initial is empty. Avoid calling
    when initial==NULL.
    
    Also, if the imported transaction has empty-string desc/notes/memo, we
    don't want to populate the GtkEntryCompletion with it.

diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index bb03dcb1b..b82a201b6 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -1020,14 +1020,17 @@ setup_entry (GtkWidget *entry, gboolean sensitive, GHashTable *hash,
     GtkEntryCompletion* completion;
     GtkListStore *list;
 
-    gtk_entry_set_text (GTK_ENTRY (entry), sensitive ? initial : _("Disabled"));
+    if (!sensitive)
+        gtk_entry_set_text (GTK_ENTRY (entry), _("Disabled"));
+    else if (initial && *initial)
+        gtk_entry_set_text (GTK_ENTRY (entry), initial);
     gtk_widget_set_sensitive (entry, sensitive);
     if (!sensitive)
         return;
 
     list = gtk_list_store_new (NUM_COMPLETION_COLS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING);
     g_hash_table_foreach (hash, (GHFunc)populate_list, list);
-    if (initial && !g_hash_table_lookup (hash, (gpointer)initial))
+    if (initial && *initial && !g_hash_table_lookup (hash, (gpointer)initial))
         populate_list ((gpointer)initial, NULL, list);
     gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list),
                                           COMPLETION_LIST_ORIGINAL,

commit 3e4a4dbfe12981b6ffd6eddfc93e568e6ead0f98
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Wed Sep 21 00:05:34 2022 +0800

    [import-main-matcher] initialize hash tables in common setup
    
    ... otherwise the hash tables aren't initialized when the CSV importer
    calls the import matcher.

diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 9c785bb38..bb03dcb1b 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -1676,6 +1676,10 @@ gnc_gen_trans_common_setup (GNCImportMainMatcher *info,
     if (heading)
         gtk_label_set_text (GTK_LABEL(heading_label), heading);
 
+    info->desc_hash = g_hash_table_new (g_str_hash, g_str_equal);
+    info->notes_hash = g_hash_table_new (g_str_hash, g_str_equal);
+    info->memo_hash = g_hash_table_new (g_str_hash, g_str_equal);
+    info->new_strings = NULL;
     info->transaction_processed_cb = NULL;
 
     /* Connect the signals */
@@ -1731,11 +1735,6 @@ gnc_gen_trans_list_new (GtkWidget *parent,
     // This ensure this dialog is closed when the session is closed.
     gnc_gui_component_set_session (info->id, gnc_get_current_session());
 
-    info->desc_hash = g_hash_table_new (g_str_hash, g_str_equal);
-    info->notes_hash = g_hash_table_new (g_str_hash, g_str_equal);
-    info->memo_hash = g_hash_table_new (g_str_hash, g_str_equal);
-
-    info->new_strings = NULL;
     return info;
 }
 



Summary of changes:
 gnucash/import-export/import-main-matcher.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)



More information about the gnucash-changes mailing list