aboutsummaryrefslogtreecommitdiffstats
path: root/e-util
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2014-05-24 00:57:12 +0800
committerMilan Crha <mcrha@redhat.com>2014-05-24 00:57:12 +0800
commitb3819be9f7cc1f1f522e7fb4007c48c25ed09b0b (patch)
tree0bd4c7f004096cceae81a21d19c49bafab1b19e6 /e-util
parentdaee89cdda99b67fd985e90441df367e95bd1b3c (diff)
downloadgsoc2013-evolution-b3819be9f7cc1f1f522e7fb4007c48c25ed09b0b.tar
gsoc2013-evolution-b3819be9f7cc1f1f522e7fb4007c48c25ed09b0b.tar.gz
gsoc2013-evolution-b3819be9f7cc1f1f522e7fb4007c48c25ed09b0b.tar.bz2
gsoc2013-evolution-b3819be9f7cc1f1f522e7fb4007c48c25ed09b0b.tar.lz
gsoc2013-evolution-b3819be9f7cc1f1f522e7fb4007c48c25ed09b0b.tar.xz
gsoc2013-evolution-b3819be9f7cc1f1f522e7fb4007c48c25ed09b0b.tar.zst
gsoc2013-evolution-b3819be9f7cc1f1f522e7fb4007c48c25ed09b0b.zip
Bug #730199 - [MessageList] Support dates with value larger than 2^32
Diffstat (limited to 'e-util')
-rw-r--r--e-util/e-cell-date.c13
-rw-r--r--e-util/e-table-extras.c12
-rw-r--r--e-util/e-table-sorting-utils.c18
3 files changed, 39 insertions, 4 deletions
diff --git a/e-util/e-cell-date.c b/e-util/e-cell-date.c
index 973ae39196..610151a9a2 100644
--- a/e-util/e-cell-date.c
+++ b/e-util/e-cell-date.c
@@ -43,10 +43,12 @@ ecd_get_text (ECellText *cell,
gint col,
gint row)
{
- time_t date = GPOINTER_TO_INT (e_table_model_value_at (model, col, row));
+ gint64 *pdate = e_table_model_value_at (model, col, row);
const gchar *fmt_component, *fmt_part = NULL;
+ gchar *res;
- if (date == 0) {
+ if (!pdate || *pdate == 0) {
+ e_table_model_free_value (model, col, pdate);
return g_strdup (_("?"));
}
@@ -56,8 +58,11 @@ ecd_get_text (ECellText *cell,
else
fmt_part = "table";
- return e_datetime_format_format (
- fmt_component, fmt_part, DTFormatKindDateTime, date);
+ res = e_datetime_format_format (fmt_component, fmt_part, DTFormatKindDateTime, (time_t) *pdate);
+
+ e_table_model_free_value (model, col, pdate);
+
+ return res;
}
static void
diff --git a/e-util/e-table-extras.c b/e-util/e-table-extras.c
index b631dbd6e9..07f81ba44a 100644
--- a/e-util/e-table-extras.c
+++ b/e-util/e-table-extras.c
@@ -107,6 +107,15 @@ e_strint_compare (gconstpointer data1,
return e_int_compare (GINT_TO_POINTER (int1), GINT_TO_POINTER (int2));
}
+static gint
+e_int64ptr_compare (gconstpointer data1,
+ gconstpointer data2)
+{
+ const gint64 *pa = data1, *pb = data2;
+
+ return (*pa == *pb) ? 0 : (*pa < *pb) ? -1 : 1;
+}
+
/* UTF-8 strncasecmp - not optimized */
static gint
@@ -276,6 +285,9 @@ e_table_extras_init (ETableExtras *extras)
e_table_extras_add_compare (
extras, "string-integer",
(GCompareDataFunc) e_strint_compare);
+ e_table_extras_add_compare (
+ extras, "pointer-integer64",
+ (GCompareDataFunc) e_int64ptr_compare);
e_table_extras_add_search (extras, "string", e_string_search);
diff --git a/e-util/e-table-sorting-utils.c b/e-util/e-table-sorting-utils.c
index 494ebf4b7d..972a3fc2d2 100644
--- a/e-util/e-table-sorting-utils.c
+++ b/e-util/e-table-sorting-utils.c
@@ -391,6 +391,24 @@ e_table_sorting_utils_tree_sort (ETreeModel *source,
map_table[i] = map_copy[map[i]];
}
+ for (j = 0; j < cols; j++) {
+ ETableColumnSpecification *spec;
+ ETableCol *col;
+
+ spec = e_table_sort_info_sorting_get_nth (
+ sort_info, j, &closure.sort_type[j]);
+
+ col = e_table_header_get_column_by_spec (full_header, spec);
+ if (col == NULL) {
+ gint last = e_table_header_count (full_header) - 1;
+ col = e_table_header_get_column (full_header, last);
+ }
+
+ for (i = 0; i < count; i++) {
+ e_tree_model_free_value (source, col->spec->compare_col, closure.vals[i * cols + j]);
+ }
+ }
+
g_free (map);
g_free (map_copy);