aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-09-18 00:26:32 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-09-18 00:26:32 +0800
commit850cfc375fcc212ee49c0110212b87c910beebfa (patch)
treef8cccb40668c01871c44fb963385e4d1790d0032 /calendar
parentf5c14b7b76fbda37c57ad5d5c54e208124efc9a8 (diff)
downloadgsoc2013-evolution-850cfc375fcc212ee49c0110212b87c910beebfa.tar
gsoc2013-evolution-850cfc375fcc212ee49c0110212b87c910beebfa.tar.gz
gsoc2013-evolution-850cfc375fcc212ee49c0110212b87c910beebfa.tar.bz2
gsoc2013-evolution-850cfc375fcc212ee49c0110212b87c910beebfa.tar.lz
gsoc2013-evolution-850cfc375fcc212ee49c0110212b87c910beebfa.tar.xz
gsoc2013-evolution-850cfc375fcc212ee49c0110212b87c910beebfa.tar.zst
gsoc2013-evolution-850cfc375fcc212ee49c0110212b87c910beebfa.zip
get itip addresses (calendar_model_destroy): destroy same
2001-09-17 JP Rosevear <jpr@ximian.com> * gui/calendar-model.c (calendar_model_init): get itip addresses (calendar_model_destroy): destroy same (calendar_model_value_at): do more thorough checking on whether to use recurring, assigned, assigned to or regular task icons svn path=/trunk/; revision=12899
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog7
-rw-r--r--calendar/gui/calendar-model.c64
2 files changed, 59 insertions, 12 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 0194f8871a..78cfbe149d 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,12 @@
2001-09-17 JP Rosevear <jpr@ximian.com>
+ * gui/calendar-model.c (calendar_model_init): get itip addresses
+ (calendar_model_destroy): destroy same
+ (calendar_model_value_at): do more thorough checking on whether to
+ use recurring, assigned, assigned to or regular task icons
+
+2001-09-17 JP Rosevear <jpr@ximian.com>
+
* cal-util/cal-component.c (for_each_remove_all_alarms): for each
call back, removes the alarms
(cal_component_remove_all_alarms): remove all alarms from the
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index 141d8e96c4..5779266a2f 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -37,6 +37,7 @@
#include <cal-util/timeutil.h>
#include "calendar-commands.h"
#include "calendar-config.h"
+#include "itip-utils.h"
#include "calendar-model.h"
@@ -69,6 +70,9 @@ struct _CalendarModelPrivate {
creating a new task. */
gchar *default_category;
+ /* Addresses for determining icons */
+ GList *addresses;
+
/* The current timezone. */
icaltimezone *zone;
};
@@ -175,6 +179,8 @@ calendar_model_init (CalendarModel *model)
priv->new_comp_vtype = CAL_COMPONENT_EVENT;
priv->use_24_hour_format = TRUE;
+ priv->addresses = itip_addresses_get ();
+
priv->zone = NULL;
}
@@ -258,6 +264,8 @@ calendar_model_destroy (GtkObject *object)
g_free (priv->default_category);
+ itip_addresses_free (priv->addresses);
+
/* Free the private structure */
g_free (priv);
@@ -756,23 +764,55 @@ calendar_model_value_at (ETableModel *etm, int col, int row)
return GINT_TO_POINTER (cal_component_has_alarms (comp));
case CAL_COMPONENT_FIELD_ICON:
- /* FIXME: Also support 'Assigned to me' & 'Assigned to someone
- else'. */
+ {
+ ItipAddress *ia;
+ CalComponentOrganizer organizer;
+ GSList *attendees = NULL, *sl;
+ gint retval = 0;
+
if (cal_component_has_recurrences (comp))
return GINT_TO_POINTER (1);
- else {
- icalcomponent *ical_comp;
-
- ical_comp = cal_component_get_icalcomponent (comp);
- if (icalcomponent_get_first_property (ical_comp,
- ICAL_ATTENDEE_PROPERTY) != NULL)
- {
- return GINT_TO_POINTER (2); /* Task-assigned */
+
+ cal_component_get_organizer (comp, &organizer);
+ if (organizer.value != NULL) {
+ GList *l;
+ const char *text = itip_strip_mailto (organizer.value);
+
+ for (l = priv->addresses; l != NULL; l = l->next) {
+ ia = l->data;
+
+ if (!strcmp (text, ia->address)) {
+ retval = 3;
+ goto cleanup;
+ }
}
- else {
- return GINT_TO_POINTER (0);
+ }
+
+ cal_component_get_attendee_list (comp, &attendees);
+ for (sl = attendees; sl != NULL; sl = sl->next) {
+ CalComponentAttendee *ca = sl->data;
+ const char *text;
+ GList *l;
+
+ text = itip_strip_mailto (ca->value);
+ for (l = priv->addresses; l != NULL; l = l->next) {
+ ia = l->data;
+
+ if (!strcmp (text, ia->address)) {
+ if (ca->delto != NULL)
+ retval = 3;
+ else
+ retval = 2;
+ goto cleanup;
+ }
}
}
+
+ cleanup:
+ cal_component_free_attendee_list (attendees);
+ return GINT_TO_POINTER (retval);
+ break;
+ }
case CAL_COMPONENT_FIELD_COMPLETE:
return GINT_TO_POINTER (is_complete (comp));