Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-panel/applets/clock/ChangeLog,v
retrieving revision 1.586
diff -u -u -r1.586 ChangeLog
--- ChangeLog	7 Mar 2005 14:35:56 -0000	1.586
+++ ChangeLog	18 Apr 2005 22:03:28 -0000
@@ -1,3 +1,9 @@
+2005-04-18  Carlos Garcia Campos <carlosgc@gnome.org>
+
+	* calendar-client.[ch]:
+	* clock.c (handle_tasks_changed), (create_task_list): add a priority
+	field to CalendarTask and sort the model based on this priority
+	
 ==================== 2.10.0 ====================
 
 ==================== 2.9.92 ====================
Index: calendar-client.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/applets/clock/calendar-client.c,v
retrieving revision 1.10
diff -u -u -r1.10 calendar-client.c
--- calendar-client.c	31 Aug 2004 08:18:34 -0000	1.10
+++ calendar-client.c	18 Apr 2005 22:03:29 -0000
@@ -635,6 +635,18 @@
                                  default_zone);
 }
 
+static int
+get_ical_priority (icalcomponent *ical)
+{
+  icalproperty *prop;
+
+  prop = icalcomponent_get_first_property (ical, ICAL_PRIORITY_PROPERTY);
+    if (!prop)
+      return -1;
+
+  return icalproperty_get_priority (prop);
+}
+
 static char *
 get_source_color (ECal *esource)
 {
@@ -855,6 +867,7 @@
   task_copy->due_time         = task->due_time;
   task_copy->percent_complete = task->percent_complete;
   task_copy->completed_time   = task->completed_time;
+  task_copy->priority         = task->priority;
 }
 
 static void
@@ -893,6 +906,7 @@
   task->due_time         = get_ical_due_time (ical, default_zone);
   task->percent_complete = get_ical_percent_complete (ical);
   task->completed_time   = get_ical_completed_time (ical, default_zone);
+  task->priority         = get_ical_priority (ical);
 }
 
 void
Index: calendar-client.h
===================================================================
RCS file: /cvs/gnome/gnome-panel/applets/clock/calendar-client.h,v
retrieving revision 1.4
diff -u -u -r1.4 calendar-client.h
--- calendar-client.h	19 Jul 2004 19:11:14 -0000	1.4
+++ calendar-client.h	18 Apr 2005 22:03:29 -0000
@@ -95,6 +95,7 @@
   GTime  due_time;
   guint  percent_complete;
   GTime  completed_time;
+  int    priority;	
 } CalendarTask;
 
 typedef struct
Index: clock.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/applets/clock/clock.c,v
retrieving revision 1.165
diff -u -u -r1.165 clock.c
--- clock.c	26 Feb 2005 14:41:48 -0000	1.165
+++ clock.c	18 Apr 2005 22:03:29 -0000
@@ -546,6 +546,7 @@
         TASK_COLUMN_OVERDUE_ATTR,
         TASK_COLUMN_COLOR,
         TASK_COLUMN_URL,
+        TASK_COLUMN_PRIORITY,
         N_TASK_COLUMNS
 };
 
@@ -626,6 +627,7 @@
                                     TASK_COLUMN_COMPLETED_TIME,        task->completed_time,
                                     TASK_COLUMN_COLOR,                 task->color_string,
                                     TASK_COLUMN_URL,                   task->url,
+                                    TASK_COLUMN_PRIORITY,              task->priority,
                                     -1);
 
                 g_free (percent_complete_text);
@@ -908,11 +910,16 @@
                         G_TYPE_LONG,           /* completed time          */
                         PANGO_TYPE_ATTR_LIST,  /* summary text attributes */
                         G_TYPE_STRING,         /* color                   */
-                        G_TYPE_STRING          /* url                     */
+                        G_TYPE_STRING,         /* url                     */
+                        G_TYPE_INT             /* priority                */
                 };
 
                 cd->tasks_model = gtk_list_store_newv (N_TASK_COLUMNS, column_types);
 
+                gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (cd->tasks_model),
+                                                      TASK_COLUMN_PRIORITY,
+                                                      GTK_SORT_DESCENDING);
+
                 cd->tasks_filter = GTK_TREE_MODEL_FILTER (
                         gtk_tree_model_filter_new (GTK_TREE_MODEL (cd->tasks_model),
                                                    NULL));
@@ -929,8 +936,6 @@
                          cd,
                          NULL);
         }
-
-        /* FIXME: implement sorting */
 
         *tree_view = view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (cd->tasks_filter));
         gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE);
