From 0c420d13663f68e1a42178171066174429952e62 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 13 Feb 2001 22:03:40 +0000 Subject: override value to string virtual method (calendar_model_value_to_string): 2001-02-13 JP Rosevear * gui/calendar-model.c (calendar_model_class_init): override value to string virtual method (calendar_model_value_to_string): implement value to string for etable (necessary for group by) svn path=/trunk/; revision=8211 --- calendar/ChangeLog | 7 ++++++ calendar/gui/calendar-model.c | 48 +++++++++++++++++++++++++++++++++++++---- calendar/gui/e-calendar-table.c | 4 ++-- 3 files changed, 53 insertions(+), 6 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 9e44f14095..34d7f61c58 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2001-02-13 JP Rosevear + + * gui/calendar-model.c (calendar_model_class_init): override value + to string virtual method + (calendar_model_value_to_string): implement value to string for + etable (necessary for group by) + 2001-02-12 Rodrigo Moya * pcs/cal-backend-file.c: diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c index 3e4e41ea45..3e8f3359ab 100644 --- a/calendar/gui/calendar-model.c +++ b/calendar/gui/calendar-model.c @@ -41,6 +41,7 @@ #include #include #include +#include #include #include "calendar-model.h" #include "calendar-commands.h" @@ -103,9 +104,7 @@ static void *calendar_model_duplicate_value (ETableModel *etm, int col, const vo static void calendar_model_free_value (ETableModel *etm, int col, void *value); static void *calendar_model_initialize_value (ETableModel *etm, int col); static gboolean calendar_model_value_is_empty (ETableModel *etm, int col, const void *value); -#if 0 static char * calendar_model_value_to_string (ETableModel *etm, int col, const void *value); -#endif static void load_objects (CalendarModel *model); static int remove_object (CalendarModel *model, const char *uid); static void ensure_task_complete (CalComponent *comp, @@ -186,9 +185,7 @@ calendar_model_class_init (CalendarModelClass *class) etm_class->free_value = calendar_model_free_value; etm_class->initialize_value = calendar_model_initialize_value; etm_class->value_is_empty = calendar_model_value_is_empty; -#if 0 etm_class->value_to_string = calendar_model_value_to_string; -#endif class->categories_changed = NULL; } @@ -1526,6 +1523,49 @@ calendar_model_value_is_empty (ETableModel *etm, int col, const void *value) } } +static char * +calendar_model_value_to_string (ETableModel *etm, int col, const void *value) +{ + g_return_val_if_fail (col >= 0 && col < CAL_COMPONENT_FIELD_NUM_FIELDS, NULL); + + switch (col) { + case CAL_COMPONENT_FIELD_CATEGORIES: + case CAL_COMPONENT_FIELD_CLASSIFICATION: + case CAL_COMPONENT_FIELD_COMPLETED: + case CAL_COMPONENT_FIELD_DTEND: + case CAL_COMPONENT_FIELD_DTSTART: + case CAL_COMPONENT_FIELD_DUE: + case CAL_COMPONENT_FIELD_GEO: + case CAL_COMPONENT_FIELD_PERCENT: + case CAL_COMPONENT_FIELD_PRIORITY: + case CAL_COMPONENT_FIELD_SUMMARY: + case CAL_COMPONENT_FIELD_TRANSPARENCY: + case CAL_COMPONENT_FIELD_URL: + return e_utf8_from_locale_string (value); + + case CAL_COMPONENT_FIELD_ICON: + if ((int)value == 0) + return e_utf8_from_locale_string (_("Normal")); + else if ((int)value == 1) + return e_utf8_from_locale_string (_("Recurring")); + else + return e_utf8_from_locale_string (_("Assigned")); + + case CAL_COMPONENT_FIELD_HAS_ALARMS: + case CAL_COMPONENT_FIELD_COMPLETE: + case CAL_COMPONENT_FIELD_RECURRING: + case CAL_COMPONENT_FIELD_OVERDUE: + return e_utf8_from_locale_string (value ? _("Yes") : _("No")); + + case CAL_COMPONENT_FIELD_COLOR: + return NULL; + + default: + g_message ("calendar_model_value_as_string(): Requested invalid column %d", col); + return NULL; + } +} + /** diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c index eb3bf5e2b4..6b063ec2cf 100644 --- a/calendar/gui/e-calendar-table.c +++ b/calendar/gui/e-calendar-table.c @@ -211,10 +211,10 @@ static char *list [] = { " " \ - " " \ - " " \ " " \ -- cgit v1.2.3