Author: mcrha
Date: Thu Feb 14 18:16:31 2008
New Revision: 35013
URL: http://svn.gnome.org/viewvc/evolution?rev=35013&view=rev

Log:
2008-02-14  Milan Crha  <[EMAIL PROTECTED]>

        ** 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.



Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/gui/e-calendar-table.c
   trunk/calendar/gui/e-calendar-table.etspec

Modified: trunk/calendar/gui/e-calendar-table.c
==============================================================================
--- trunk/calendar/gui/e-calendar-table.c       (original)
+++ trunk/calendar/gui/e-calendar-table.c       Thu Feb 14 18:16:31 2008
@@ -220,6 +220,39 @@
                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 @@
                                    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 */
 

Modified: trunk/calendar/gui/e-calendar-table.etspec
==============================================================================
--- trunk/calendar/gui/e-calendar-table.etspec  (original)
+++ trunk/calendar/gui/e-calendar-table.etspec  Thu Feb 14 18:16:31 2008
@@ -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>
_______________________________________________
SVN-commits-list mailing list (read only)
http://mail.gnome.org/mailman/listinfo/svn-commits-list

Want to limit the commits to a few modules? Go to above URL, log in to edit 
your options and select the modules ('topics') you want.
Module maintainer? It is possible to set the reply-to to your development 
mailing list. Email [EMAIL PROTECTED] if interested.

Reply via email to