gnucash maint: Multiple changes pushed

Robert Fewell bobit at code.gnucash.org
Thu Mar 18 06:50:38 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/1756f760 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1ba571c5 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a7d383fc (commit)
	from  https://github.com/Gnucash/gnucash/commit/d335a803 (commit)



commit 1756f76079221f77904ccb9c9a504f9ebca2eb0e
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Mar 18 10:43:59 2021 +0000

    Remove redundant store code causing error which was not being used.

diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index bcab57276..d23754bcb 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -393,7 +393,6 @@ static void
 resolve_conflicts (GNCImportMainMatcher *info)
 {
     GtkTreeModel* model = gtk_tree_view_get_model (info->view);
-    GtkListStore* store = GTK_LIST_STORE(model);
     GtkTreeIter import_iter, best_import;
     gint best_match = 0;
 

commit 1ba571c5b7af5915005ebe0e494c822d499a9e9d
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Mar 18 10:38:26 2021 +0000

    Allow for Header Bar use in CSV transaction Assistant
    
    There are a couple of action buttons that are added to the CSV
    transaction assistant with added alignment based on the action area
    being a GtkBox which causes errors if the header bar is used so test
    for the action area type and use appropriate specific functions.

diff --git a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
index f6fa649ad..0ef8e6828 100644
--- a/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
+++ b/gnucash/import-export/csv-imp/assistant-csv-trans-import.cpp
@@ -2028,6 +2028,14 @@ CsvImpTransAssist::assist_doc_page_prepare ()
     /* Add the Cancel button for the matcher */
     cancel_button = gtk_button_new_with_mnemonic (_("_Cancel"));
     gtk_assistant_add_action_widget (csv_imp_asst, cancel_button);
+    auto button_area = gtk_widget_get_parent (cancel_button);
+
+    if (GTK_IS_HEADER_BAR(button_area))
+        gtk_container_child_set (GTK_CONTAINER(button_area),
+                                 cancel_button,
+                                 "pack-type", GTK_PACK_START,
+                                 nullptr);
+
     g_signal_connect (cancel_button, "clicked",
                      G_CALLBACK(csv_tximp_assist_close_cb), this);
     gtk_widget_show (GTK_WIDGET(cancel_button));
@@ -2064,14 +2072,26 @@ CsvImpTransAssist::assist_match_page_prepare ()
     /* Add the help button for the matcher */
     help_button = gtk_button_new_with_mnemonic (_("_Help"));
     gtk_assistant_add_action_widget (csv_imp_asst, help_button);
+    auto button_area = gtk_widget_get_parent (help_button);
+
+    if (GTK_IS_HEADER_BAR(button_area))
+    {
+        gtk_container_child_set (GTK_CONTAINER(button_area),
+                                 help_button,
+                                 "pack-type", GTK_PACK_START,
+                                 nullptr);
+    }
+    else
+    {
+        // align the help button on the left side
+        gtk_widget_set_halign (GTK_WIDGET(button_area), GTK_ALIGN_FILL);  
+        gtk_widget_set_hexpand (GTK_WIDGET(button_area), TRUE);
+        gtk_box_set_child_packing (GTK_BOX(button_area), help_button,
+                                   FALSE, FALSE, 0, GTK_PACK_START);
+    }
     g_signal_connect (help_button, "clicked",
                      G_CALLBACK(on_matcher_help_clicked), gnc_csv_importer_gui);
 
-    // align the help button on the left side
-    auto action_box = gtk_widget_get_parent (help_button);
-    gtk_widget_set_halign (GTK_WIDGET(action_box), GTK_ALIGN_FILL);  
-    gtk_widget_set_hexpand (GTK_WIDGET(action_box), TRUE);
-    gtk_box_set_child_packing (GTK_BOX(action_box), help_button, FALSE, FALSE, 0, GTK_PACK_START);
     gtk_widget_show (GTK_WIDGET(help_button));
 
     /* Copy all of the transactions to the importer GUI. */

commit a7d383fc16002ac456b00ca72f79cac98816a1ba
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Thu Mar 18 10:28:24 2021 +0000

    Bug 798149 - Account name change affects CSV saved import setting
    
    The account full path was being used in the CSV saved settings so if
    any account name is change in the path it would prevent recall of the
    base account used. To fix this the account guid is saved instead and
    when recalled the account is looked up first by guid, if this fails the
    full path is checked which if successful immediately updates the saved
    base account setting with the account guid for future use.

diff --git a/gnucash/import-export/csv-imp/gnc-imp-settings-csv-tx.cpp b/gnucash/import-export/csv-imp/gnc-imp-settings-csv-tx.cpp
index eda119ab1..8ba7995aa 100644
--- a/gnucash/import-export/csv-imp/gnc-imp-settings-csv-tx.cpp
+++ b/gnucash/import-export/csv-imp/gnc-imp-settings-csv-tx.cpp
@@ -172,7 +172,25 @@ CsvTransImpSettings::load (void)
 
     gchar *key_char = g_key_file_get_string (keyfile, group.c_str(), CSV_ACCOUNT, &key_error);
     if (key_char && *key_char != '\0')
-        m_base_account = gnc_account_lookup_by_full_name (gnc_get_current_root_account(), key_char);
+    {
+        QofBook* book = gnc_get_current_book ();
+        GncGUID guid;
+
+        if (string_to_guid (key_char, &guid)) // find account by guid
+            m_base_account = xaccAccountLookup (&guid, book);
+
+        if (m_base_account == nullptr)
+        {
+            m_base_account = gnc_account_lookup_by_full_name (gnc_get_current_root_account(), key_char);
+
+            if (m_base_account) // save the account as guid, introduced in version 4.5
+            {
+                gchar acct_guid[GUID_ENCODING_LENGTH + 1];
+                guid_to_string_buff (xaccAccountGetGUID (m_base_account), acct_guid);
+                g_key_file_set_string (keyfile, group.c_str(), CSV_ACCOUNT, acct_guid);
+            }
+        }
+    }
     m_load_error |= handle_load_error (&key_error, group);
     if (key_char)
         g_free (key_char);
@@ -241,7 +259,11 @@ CsvTransImpSettings::save (void)
     g_key_file_set_boolean (keyfile, group.c_str(), CSV_MULTI_SPLIT, m_multi_split);
 
     if (m_base_account)
-        g_key_file_set_string (keyfile, group.c_str(), CSV_ACCOUNT, gnc_account_get_full_name(m_base_account));
+    {
+        gchar acct_guid[GUID_ENCODING_LENGTH + 1];
+        guid_to_string_buff (xaccAccountGetGUID (m_base_account), acct_guid);
+        g_key_file_set_string (keyfile, group.c_str(), CSV_ACCOUNT, acct_guid);
+    }
 
     std::vector<const char*> col_types_str;
     for (auto col_type : m_column_types)



Summary of changes:
 .../csv-imp/assistant-csv-trans-import.cpp         | 30 ++++++++++++++++++----
 .../csv-imp/gnc-imp-settings-csv-tx.cpp            | 26 +++++++++++++++++--
 gnucash/import-export/import-main-matcher.c        |  1 -
 3 files changed, 49 insertions(+), 8 deletions(-)



More information about the gnucash-changes mailing list