From 47563841dba74003c0272ea4f53f63652ba3a8c7 Mon Sep 17 00:00:00 2001 From: Derek Atkins Date: Sun, 23 Jun 2002 01:24:40 +0000 Subject: [PATCH] Fix the item ordering (so it appears in ascending order) git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7002 57a11ea4-9604-0410-9ed3-97b8803252fd --- .../business-gnome/dialog-billterms.c | 10 ++++++--- .../dialog-tax-table/dialog-tax-table.c | 21 +++++++++++++------ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/business/business-gnome/dialog-billterms.c b/src/business/business-gnome/dialog-billterms.c index 34b2a0da94..3d681e376c 100644 --- a/src/business/business-gnome/dialog-billterms.c +++ b/src/business/business-gnome/dialog-billterms.c @@ -489,7 +489,7 @@ billterms_term_refresh (BillTermsWindow *btw) static void billterms_window_refresh (BillTermsWindow *btw) { - GList *list; + GList *list, *node; GtkAdjustment *vadjustment; GtkCList *clist; gfloat save_value = 0.0; @@ -514,12 +514,14 @@ billterms_window_refresh (BillTermsWindow *btw) if (list == NULL) { btw->current_term = NULL; billterms_term_refresh (btw); + } else { + list = g_list_reverse (g_list_copy (list)); } - for ( ; list; list = list->next) { + for ( node = list; node; node = node->next) { char *row_text[2]; gint row; - GncBillTerm *term = list->data; + GncBillTerm *term = node->data; gnc_gui_component_watch_entity (btw->component_id, gncBillTermGetGUID (term), @@ -533,6 +535,8 @@ billterms_window_refresh (BillTermsWindow *btw) gtk_clist_set_selectable (clist, row, TRUE); } + g_list_free (list); + gnc_gui_component_watch_entity_type (btw->component_id, GNC_BILLTERM_MODULE_NAME, GNC_EVENT_CREATE | GNC_EVENT_DESTROY); diff --git a/src/business/dialog-tax-table/dialog-tax-table.c b/src/business/dialog-tax-table/dialog-tax-table.c index 571ac56c41..c5ac748fc5 100644 --- a/src/business/dialog-tax-table/dialog-tax-table.c +++ b/src/business/dialog-tax-table/dialog-tax-table.c @@ -293,7 +293,7 @@ new_tax_table_dialog (TaxTableWindow *ttw, gboolean new_table, static void tax_table_entries_refresh (TaxTableWindow *ttw, gboolean new_table) { - GList *list; + GList *list, *node; GtkAdjustment *vadjustment = NULL; GtkCList *clist; gfloat save_value = 0.0; @@ -314,10 +314,13 @@ tax_table_entries_refresh (TaxTableWindow *ttw, gboolean new_table) /* Add the items to the list */ list = gncTaxTableGetEntries (ttw->current_table); - for ( ; list; list = list->next) { + if (list) + list = g_list_reverse (g_list_copy (list)); + + for (node = list ; node; node = node->next) { char *row_text[3]; gint row; - GncTaxTableEntry *entry = list->data; + GncTaxTableEntry *entry = node->data; Account *acc = gncTaxTableEntryGetAccount (entry); gnc_numeric amount = gncTaxTableEntryGetAmount (entry); @@ -346,6 +349,8 @@ tax_table_entries_refresh (TaxTableWindow *ttw, gboolean new_table) g_free (row_text[1]); } + g_list_free (list); + if (!new_table) { if (vadjustment) { save_value = CLAMP (save_value, vadjustment->lower, @@ -373,7 +378,7 @@ tax_table_entries_refresh (TaxTableWindow *ttw, gboolean new_table) static void tax_table_window_refresh (TaxTableWindow *ttw) { - GList *list; + GList *list, *node; GtkAdjustment *vadjustment; GtkCList *clist; gfloat save_value = 0.0; @@ -397,11 +402,13 @@ tax_table_window_refresh (TaxTableWindow *ttw) /* If there are no tables, clear the entries list */ if (list == NULL) gtk_clist_clear (GTK_CLIST (ttw->entries_clist)); + else + list = g_list_reverse (g_list_copy (list)); - for ( ; list; list = list->next) { + for (node = list; node; node = node->next) { char *row_text[2]; gint row; - GncTaxTable *table = list->data; + GncTaxTable *table = node->data; gnc_gui_component_watch_entity (ttw->component_id, gncTaxTableGetGUID (table), @@ -415,6 +422,8 @@ tax_table_window_refresh (TaxTableWindow *ttw) gtk_clist_set_selectable (clist, row, TRUE); } + g_list_free (list); + gnc_gui_component_watch_entity_type (ttw->component_id, GNC_TAXTABLE_MODULE_NAME, GNC_EVENT_CREATE | GNC_EVENT_DESTROY);