From a922906362d64915eccf85e40a7f6a3fc50538b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20K=C3=B6hler?= Date: Sat, 27 May 2006 10:44:50 +0000 Subject: [PATCH] When the user chooses another default encoding, do not recheck the file for ambiguous words, but rather just resort what has been found before. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14209 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 6 ++++++ src/gnome-utils/druid-gnc-xml-import.c | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9721fafe26..5446644b26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-05-27 Andreas Köhler + + * src/gnome-utils/druid-gnc-xml-import.c: When the user chooses + another default encoding, do not recheck the file for ambiguous + words, but rather just resort what has been found before. + 2006-05-26 Derek Atkins * src/engine/gnc-engine.c: load the qsf backend from the right place. diff --git a/src/gnome-utils/druid-gnc-xml-import.c b/src/gnome-utils/druid-gnc-xml-import.c index 60b5d8466d..5d8f110f79 100644 --- a/src/gnome-utils/druid-gnc-xml-import.c +++ b/src/gnome-utils/druid-gnc-xml-import.c @@ -141,6 +141,7 @@ static void gxi_data_destroy (GncXmlImportData *data); static void gxi_ambiguous_info_destroy (GncXmlImportData *data); static void gxi_session_destroy (GncXmlImportData *data); static void gxi_check_file (GncXmlImportData *data); +static void gxi_sort_ambiguous_list (GncXmlImportData *data); static gboolean gxi_parse_file (GncXmlImportData *data); static gboolean gxi_save_file (GncXmlImportData *data); static void gxi_update_progress_bar (const gchar *message, double percentage); @@ -499,7 +500,7 @@ ambiguous_cmp (const ambiguous_type *a, const ambiguous_type *b, } } else { if (string_b) { - /* b looks good, a not. pub a to the top */ + /* b looks good, a not. put a to the top */ return -1; } else { /* both look suboptimal, see whether one has a decision attached to it */ @@ -636,11 +637,18 @@ gxi_check_file (GncXmlImportData *data) /* sort ambiguous words */ g_hash_table_foreach (data->ambiguous_ht, (GHFunc)ambiguous_list_insert, data); - data->ambiguous_list = g_list_sort_with_data ( - data->ambiguous_list, (GCompareDataFunc) ambiguous_cmp, data); + gxi_sort_ambiguous_list (data); } } +static void +gxi_sort_ambiguous_list (GncXmlImportData *data) +{ + data->ambiguous_list = g_list_sort_with_data ( + data->ambiguous_list, (GCompareDataFunc) ambiguous_cmp, data); + +} + static void subst_insert_amb (gchar *byte_sequence, GList *conv_list, GncXmlImportData *data) { @@ -1137,7 +1145,7 @@ gxi_default_enc_combo_changed_cb (GtkComboBox *combo, GncXmlImportData *data) } data->default_encoding = curr_enc; - gxi_check_file (data); + gxi_sort_ambiguous_list (data); gxi_update_string_box (data); gxi_update_conversion_forward (data); }