From dafcf05cc318e3beae037ba2092eff2b9eb36d4d Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 14 Feb 2008 18:16:31 +0000 Subject: ** Fix for bug #514987 2008-02-14 Milan Crha ** Fix for bug #514987 * gui/e-calendar-table.etspec: * gui/e-calendar-table.c: (status_from_string), (status_compare_cb), (e_calendar_table_init): New sorting by Status based on the index in popup, not on the text. svn path=/trunk/; revision=35013 --- calendar/ChangeLog | 9 +++++++++ calendar/gui/e-calendar-table.c | 35 +++++++++++++++++++++++++++++++++++ calendar/gui/e-calendar-table.etspec | 2 +- 3 files changed, 45 insertions(+), 1 deletion(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index b052ec4613..9bb98d3be3 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,12 @@ +2008-02-14 Milan Crha + + ** Fix for bug #514987 + + * gui/e-calendar-table.etspec: + * gui/e-calendar-table.c: (status_from_string), (status_compare_cb), + (e_calendar_table_init): + New sorting by Status based on the index in popup, not on the text. + 2008-02-11 Srinivasa Ragavan * gui/alarm-notify/alarm-notify.c: (alarm_notify_add_calendar): Google diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 0718ac5a49..f649c1b17c 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -220,6 +220,39 @@ priority_compare_cb (gconstpointer a, gconstpointer b) return 0; } +static gint +status_from_string (const char *str) +{ + int status = -2; + + if (!str || !str[0]) + status = -1; + else if (!g_utf8_collate (str, _("Not Started"))) + status = 0; + else if (!g_utf8_collate (str, _("In Progress"))) + status = 1; + else if (!g_utf8_collate (str, _("Completed"))) + status = 2; + else if (!g_utf8_collate (str, _("Canceled"))) + status = 3; + + return status; +} + +static gint +status_compare_cb (gconstpointer a, gconstpointer b) +{ + int sa = status_from_string ((const char *)a); + int sb = status_from_string ((const char *)b); + + if (sa < sb) + return -1; + else if (sa > sb) + return 1; + + return 0; +} + static void row_appended_cb (ECalModel *model, ECalendarTable *cal_table) { @@ -412,6 +445,8 @@ e_calendar_table_init (ECalendarTable *cal_table) percent_compare_cb); e_table_extras_add_compare (extras, "priority-compare", priority_compare_cb); + e_table_extras_add_compare (extras, "status-compare", + status_compare_cb); /* Create pixmaps */ diff --git a/calendar/gui/e-calendar-table.etspec b/calendar/gui/e-calendar-table.etspec index 4abc284676..4e1e6c175c 100644 --- a/calendar/gui/e-calendar-table.etspec +++ b/calendar/gui/e-calendar-table.etspec @@ -7,7 +7,7 @@ - + -- cgit v1.2.3