From df100f4a47cfc46a01647e80622b95fa6dc76160 Mon Sep 17 00:00:00 2001 From: Suman Manjunath Date: Mon, 28 Jan 2008 04:31:51 +0000 Subject: Patch from Milan Crha ** Fix for bug #240073 (Cancelled tasks should get a line striked through them) svn path=/trunk/; revision=34906 --- calendar/ChangeLog | 10 ++++++++++ calendar/gui/e-cal-model-tasks.c | 14 +++++++++++++- calendar/gui/e-cal-model-tasks.h | 3 ++- calendar/gui/e-calendar-table.c | 14 +++++++------- 4 files changed, 32 insertions(+), 9 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 77933d1843..7dd3b32914 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,13 @@ +2008-01-25 Milan Crha + + ** Fix for bug #240073 + + * gui/e-cal-model-tasks.h: + * gui/e-cal-model-tasks.c: (is_status_canceled), (ecmt_value_at): + Define new virtual readonly column to calculate strikeout state. + * gui/e-calendar-table.c: (e_calendar_table_init): + Use new virtual column as strikeout column. + 2008-01-25 Milan Crha ** Fix for bug #475781 diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c index a0caef3adc..05b97374bb 100644 --- a/calendar/gui/e-cal-model-tasks.c +++ b/calendar/gui/e-cal-model-tasks.c @@ -330,6 +330,16 @@ get_priority (ECalModelComponent *comp_data) return ""; } +static gboolean +is_status_canceled (ECalModelComponent *comp_data) +{ + icalproperty *prop; + + prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_STATUS_PROPERTY); + + return prop && icalproperty_get_status (prop) == ICAL_STATUS_CANCELLED; +} + static char * get_status (ECalModelComponent *comp_data) { @@ -477,7 +487,7 @@ ecmt_value_at (ETableModel *etm, int col, int row) g_return_val_if_fail (E_IS_CAL_MODEL_TASKS (model), NULL); - g_return_val_if_fail (col >= 0 && col < E_CAL_MODEL_TASKS_FIELD_LAST, NULL); + g_return_val_if_fail (col >= 0 && (col < E_CAL_MODEL_TASKS_FIELD_LAST || col == E_CAL_MODEL_TASKS_FIELD_STRIKEOUT), NULL); g_return_val_if_fail (row >= 0 && row < e_table_model_row_count (etm), NULL); if (col < E_CAL_MODEL_FIELD_LAST) @@ -490,6 +500,8 @@ ecmt_value_at (ETableModel *etm, int col, int row) switch (col) { case E_CAL_MODEL_TASKS_FIELD_COMPLETED : return get_completed (comp_data); + case E_CAL_MODEL_TASKS_FIELD_STRIKEOUT : + return GINT_TO_POINTER (is_status_canceled (comp_data) || is_complete (comp_data)); case E_CAL_MODEL_TASKS_FIELD_COMPLETE : return GINT_TO_POINTER (is_complete (comp_data)); case E_CAL_MODEL_TASKS_FIELD_DUE : diff --git a/calendar/gui/e-cal-model-tasks.h b/calendar/gui/e-cal-model-tasks.h index 2de52d541d..eb5d0609cb 100644 --- a/calendar/gui/e-cal-model-tasks.h +++ b/calendar/gui/e-cal-model-tasks.h @@ -46,7 +46,8 @@ typedef enum { E_CAL_MODEL_TASKS_FIELD_PRIORITY, E_CAL_MODEL_TASKS_FIELD_STATUS, E_CAL_MODEL_TASKS_FIELD_URL, - E_CAL_MODEL_TASKS_FIELD_LAST + E_CAL_MODEL_TASKS_FIELD_LAST, + E_CAL_MODEL_TASKS_FIELD_STRIKEOUT /* it's another virtual readonly column */ } ECalModelTasksField; typedef struct { diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index 3f39d72875..0718ac5a49 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -255,7 +255,7 @@ e_calendar_table_init (ECalendarTable *cal_table) */ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_COMPLETE, + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, "bg_color_column", E_CAL_MODEL_FIELD_COLOR, NULL); @@ -268,7 +268,7 @@ e_calendar_table_init (ECalendarTable *cal_table) */ cell = e_cell_date_edit_text_new (NULL, GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_COMPLETE, + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, "bg_color_column", E_CAL_MODEL_FIELD_COLOR, NULL); @@ -291,7 +291,7 @@ e_calendar_table_init (ECalendarTable *cal_table) /* Classification field. */ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_COMPLETE, + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, "bg_color_column", E_CAL_MODEL_FIELD_COLOR, "editable", FALSE, @@ -313,7 +313,7 @@ e_calendar_table_init (ECalendarTable *cal_table) /* Priority field. */ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_COMPLETE, + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, "bg_color_column", E_CAL_MODEL_FIELD_COLOR, "editable", FALSE, @@ -336,7 +336,7 @@ e_calendar_table_init (ECalendarTable *cal_table) /* Percent field. */ cell = e_cell_percent_new (NULL, GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_COMPLETE, + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, "bg_color_column", E_CAL_MODEL_FIELD_COLOR, NULL); @@ -365,7 +365,7 @@ e_calendar_table_init (ECalendarTable *cal_table) /* Transparency field. */ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_COMPLETE, + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, "bg_color_column", E_CAL_MODEL_FIELD_COLOR, "editable", FALSE, @@ -386,7 +386,7 @@ e_calendar_table_init (ECalendarTable *cal_table) /* Status field. */ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (cell), - "strikeout_column", E_CAL_MODEL_TASKS_FIELD_COMPLETE, + "strikeout_column", E_CAL_MODEL_TASKS_FIELD_STRIKEOUT, "bold_column", E_CAL_MODEL_TASKS_FIELD_OVERDUE, "bg_color_column", E_CAL_MODEL_FIELD_COLOR, "editable", FALSE, -- cgit v1.2.3