aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog9
-rw-r--r--calendar/gui/e-calendar-table.c35
-rw-r--r--calendar/gui/e-calendar-table.etspec2
3 files changed, 45 insertions, 1 deletions
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 <mcrha@redhat.com>
+
+ ** 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 <sragavan@novell.com>
* 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 @@
<ETableColumn model_col= "12" _title="Due date" expansion="2.0" minimum_width="10" resizable="true" cell="dateedit" compare="date-compare" priority="-2"/>
<ETableColumn model_col= "15" _title="% Complete" expansion="1.0" minimum_width="10" resizable="true" cell="percent" compare="percent-compare" priority="-3"/>
<ETableColumn model_col= "16" _title="Priority" expansion="1.0" minimum_width="10" resizable="true" cell="priority" compare="priority-compare" priority="-3"/>
- <ETableColumn model_col="17" _title="Status" expansion="1.0" minimum_width="10" resizable="true" cell="calstatus" compare="collate" priority="-1"/>
+ <ETableColumn model_col="17" _title="Status" expansion="1.0" minimum_width="10" resizable="true" cell="calstatus" compare="status-compare" priority="-1"/>
<ETableColumn model_col="0" _title="Categories" cell="calstring" compare="stringcase" expansion="1.0" minimum_width="10" resizable="true" priority="-2"/>
<ETableState>