mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 793156 - Incorrect date sort order in Generic import matcher window
The date column was being sorted by string as opposed to date value. Added an INT64 value to the model store to hold the time64 value and use that for sorting the tree view date column.
This commit is contained in:
parent
d458e13a7f
commit
a9e0f4a721
@ -68,7 +68,8 @@ struct _main_matcher_info
|
|||||||
|
|
||||||
enum downloaded_cols
|
enum downloaded_cols
|
||||||
{
|
{
|
||||||
DOWNLOADED_COL_DATE = 0,
|
DOWNLOADED_COL_DATE_TXT = 0,
|
||||||
|
DOWNLOADED_COL_DATE_INT64,
|
||||||
DOWNLOADED_COL_ACCOUNT,
|
DOWNLOADED_COL_ACCOUNT,
|
||||||
DOWNLOADED_COL_AMOUNT,
|
DOWNLOADED_COL_AMOUNT,
|
||||||
DOWNLOADED_COL_DESCRIPTION,
|
DOWNLOADED_COL_DESCRIPTION,
|
||||||
@ -418,7 +419,13 @@ add_text_column(GtkTreeView *view, const gchar *title, int col_num)
|
|||||||
"text", col_num,
|
"text", col_num,
|
||||||
"background", DOWNLOADED_COL_COLOR,
|
"background", DOWNLOADED_COL_COLOR,
|
||||||
NULL);
|
NULL);
|
||||||
gtk_tree_view_column_set_sort_column_id(column, col_num);
|
|
||||||
|
// If date column, use the time64 value for the sorting.
|
||||||
|
if (col_num == DOWNLOADED_COL_DATE_TXT)
|
||||||
|
gtk_tree_view_column_set_sort_column_id(column, DOWNLOADED_COL_DATE_INT64);
|
||||||
|
else
|
||||||
|
gtk_tree_view_column_set_sort_column_id(column, col_num);
|
||||||
|
|
||||||
g_object_set(G_OBJECT(column),
|
g_object_set(G_OBJECT(column),
|
||||||
"reorderable", TRUE,
|
"reorderable", TRUE,
|
||||||
"resizable", TRUE,
|
"resizable", TRUE,
|
||||||
@ -461,8 +468,8 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
|
|||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
|
|
||||||
view = info->view;
|
view = info->view;
|
||||||
store = gtk_list_store_new(NUM_DOWNLOADED_COLS,
|
store = gtk_list_store_new(NUM_DOWNLOADED_COLS, G_TYPE_STRING,
|
||||||
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
|
G_TYPE_INT64, G_TYPE_STRING, G_TYPE_STRING,
|
||||||
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN,
|
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN,
|
||||||
G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING,
|
G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING,
|
||||||
GDK_TYPE_PIXBUF, G_TYPE_POINTER, G_TYPE_STRING);
|
GDK_TYPE_PIXBUF, G_TYPE_POINTER, G_TYPE_STRING);
|
||||||
@ -472,7 +479,7 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
|
|||||||
/* Add the columns *
|
/* Add the columns *
|
||||||
* (keep the line break below to avoid a translator comment) */
|
* (keep the line break below to avoid a translator comment) */
|
||||||
add_text_column(view,
|
add_text_column(view,
|
||||||
_("Date"), DOWNLOADED_COL_DATE);
|
_("Date"), DOWNLOADED_COL_DATE_TXT);
|
||||||
column = add_text_column(view, _("Account"), DOWNLOADED_COL_ACCOUNT);
|
column = add_text_column(view, _("Account"), DOWNLOADED_COL_ACCOUNT);
|
||||||
gtk_tree_view_column_set_visible(column, show_account);
|
gtk_tree_view_column_set_visible(column, show_account);
|
||||||
add_text_column(view, _("Amount"), DOWNLOADED_COL_AMOUNT);
|
add_text_column(view, _("Amount"), DOWNLOADED_COL_AMOUNT);
|
||||||
@ -702,6 +709,7 @@ refresh_model_row (GNCImportMainMatcher *gui,
|
|||||||
gchar *int_required_class, *int_prob_required_class, *int_not_required_class;
|
gchar *int_required_class, *int_prob_required_class, *int_not_required_class;
|
||||||
gchar *class_extension = NULL;
|
gchar *class_extension = NULL;
|
||||||
Split *split;
|
Split *split;
|
||||||
|
time64 date;
|
||||||
g_assert (gui);
|
g_assert (gui);
|
||||||
g_assert (model);
|
g_assert (model);
|
||||||
g_assert (info);
|
g_assert (info);
|
||||||
@ -724,8 +732,10 @@ refresh_model_row (GNCImportMainMatcher *gui,
|
|||||||
gtk_list_store_set(store, iter, DOWNLOADED_COL_ACCOUNT, ro_text, -1);
|
gtk_list_store_set(store, iter, DOWNLOADED_COL_ACCOUNT, ro_text, -1);
|
||||||
|
|
||||||
/*Date*/
|
/*Date*/
|
||||||
text = qof_print_date ( xaccTransGetDate( gnc_import_TransInfo_get_trans(info) ) );
|
date = xaccTransGetDate (gnc_import_TransInfo_get_trans(info));
|
||||||
gtk_list_store_set(store, iter, DOWNLOADED_COL_DATE, text, -1);
|
text = qof_print_date (date);
|
||||||
|
gtk_list_store_set(store, iter, DOWNLOADED_COL_DATE_TXT, text, -1);
|
||||||
|
gtk_list_store_set(store, iter, DOWNLOADED_COL_DATE_INT64, date, -1);
|
||||||
g_free(text);
|
g_free(text);
|
||||||
|
|
||||||
/*Amount*/
|
/*Amount*/
|
||||||
|
Loading…
Reference in New Issue
Block a user