aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog24
-rw-r--r--calendar/cal-client/cal-client.c77
-rw-r--r--calendar/gui/e-week-view-event-item.c17
-rw-r--r--calendar/gui/e-week-view.c6
-rw-r--r--calendar/gui/e-week-view.h2
-rw-r--r--calendar/gui/print.c2
-rw-r--r--calendar/idl/evolution-calendar.idl2
-rw-r--r--calendar/pcs/cal-backend-file.c16
-rw-r--r--calendar/pcs/cal-backend.c14
-rw-r--r--calendar/pcs/cal-backend.h4
-rw-r--r--calendar/pcs/cal.c13
11 files changed, 138 insertions, 39 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 45e5770897..8ac823d09f 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,27 @@
+2001-07-11 Damon Chaplin <damon@ximian.com>
+
+ * idl/evolution-calendar.idl: renamed updateObject to updateObjects
+ and removed the UID argument, since it can add/update multiple objects
+ at once. (It can't yet, but it will!)
+
+ * pcs/cal.c:
+ * pcs/cal-backend.[hc]:
+ * pcs/cal-backend-file.c: renamed update_object to update_objects and
+ got rid of the UID arg.
+
+ * cal-client/cal-client.c (cal_client_update_objects): new function to
+ add/update multiple objects in one go, i.e for iTIP and for importing
+ calendars.
+
+ * gui/print.c (print_date_label): fixed type bug.
+
+ * gui/e-week-view.[hc]:
+ * gui/e-week-view-event-item.c: draw the timezone icons if the event's
+ DTSTART or DTEND is in a different timezone to the current one.
+ Note that we may want to change this so it compares the UTC offsets
+ rather than the TZIDs, since currently it will draw the icons for all
+ events coming from iTIP requests from other clients.
+
2001-07-11 Federico Mena Quintero <federico@ximian.com>
Fixes bug #4380 as well as some leftovers from the days of struct
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index dc81ec044a..4d2ba2805b 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -301,7 +301,7 @@ free_timezone (gpointer key, gpointer value, gpointer data)
{
/* Note that the key comes from within the icaltimezone value, so we
don't free that. */
- icaltimezone_free (value);
+ icaltimezone_free (value, TRUE);
}
/* Destroy handler for the calendar client */
@@ -1773,10 +1773,10 @@ append_timezone_string (gpointer key, gpointer value, gpointer data)
To do that we check every TZID in the component to see if it is a builtin
timezone. If it is, we see if it it in our cache. If it is in our cache,
then we know the server already has it and we don't need to send it.
- If it isn't in our cache, then we need to send it to the server, and we
- can add it to the cache as well. If we need to send any timezones to the
- server, then we have to create a complete VCALENDAR object, otherwise
- we can just send a single VEVENT/VTODO as before. */
+ If it isn't in our cache, then we need to send it to the server.
+ If we need to send any timezones to the server, then we have to create a
+ complete VCALENDAR object, otherwise we can just send a single VEVENT/VTODO
+ as before. */
static char*
cal_client_get_component_as_string (CalClient *client,
CalComponent *comp)
@@ -1831,8 +1831,6 @@ cal_client_get_component_as_string (CalClient *client,
g_hash_table_destroy (timezone_hash);
- fprintf (stderr, "Object String:\n=======\n%s======\n", obj_string);
-
return obj_string;
}
@@ -1855,7 +1853,6 @@ cal_client_update_object (CalClient *client, CalComponent *comp)
CORBA_Environment ev;
gboolean retval;
char *obj_string;
- const char *uid;
g_return_val_if_fail (client != NULL, FALSE);
g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
@@ -1869,12 +1866,10 @@ cal_client_update_object (CalClient *client, CalComponent *comp)
cal_component_commit_sequence (comp);
- cal_component_get_uid (comp, &uid);
-
obj_string = cal_client_get_component_as_string (client, comp);
CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_Cal_updateObject (priv->cal, (char *) uid, obj_string, &ev);
+ GNOME_Evolution_Calendar_Cal_updateObjects (priv->cal, obj_string, &ev);
g_free (obj_string);
if (ev._major == CORBA_USER_EXCEPTION &&
@@ -1893,6 +1888,66 @@ cal_client_update_object (CalClient *client, CalComponent *comp)
}
/**
+ * cal_client_update_objects:
+ * @client: A calendar client.
+ * @icalcomp: A toplevel VCALENDAR libical component.
+ *
+ * Asks a calendar to add or update one or more components, possibly including
+ * VTIMEZONE data. Any existing components with the same UIDs will be
+ * replaced. The VTIMEZONE data will be compared to existing VTIMEZONEs in
+ * the calendar, and the VTIMEZONEs may possibly be renamed, as well as all
+ * references to them throughout the VCALENDAR.
+ *
+ * The client program should not assume that the objects are actually in the
+ * server's storage until it has received the "obj_updated" notification
+ * signal.
+ *
+ * Return value: TRUE on success, FALSE on specifying an invalid component.
+ **/
+gboolean
+cal_client_update_objects (CalClient *client, icalcomponent *icalcomp)
+{
+ CalClientPrivate *priv;
+ CORBA_Environment ev;
+ gboolean retval;
+ char *obj_string;
+
+ g_return_val_if_fail (client != NULL, FALSE);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
+
+ priv = client->priv;
+ g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED,
+ FALSE);
+
+ g_return_val_if_fail (icalcomp != NULL, FALSE);
+
+ retval = FALSE;
+
+ /* Libical owns this memory, using one of its temporary buffers. */
+ obj_string = icalcomponent_as_ical_string (icalcomp);
+
+ CORBA_exception_init (&ev);
+ GNOME_Evolution_Calendar_Cal_updateObjects (priv->cal, obj_string, &ev);
+
+ if (ev._major == CORBA_USER_EXCEPTION &&
+ strcmp (CORBA_exception_id (&ev),
+ ex_GNOME_Evolution_Calendar_Cal_InvalidObject) == 0)
+ goto out;
+ else if (ev._major != CORBA_NO_EXCEPTION) {
+ g_message ("cal_client_update_objects(): could not update the objects");
+ goto out;
+ }
+
+ retval = TRUE;
+
+ out:
+ CORBA_exception_free (&ev);
+ return retval;
+
+}
+
+
+/**
* cal_client_remove_object:
* @client: A calendar client.
* @uid: Unique identifier of the calendar component to remove.
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index 06a065d364..a31b6e3ae6 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -559,6 +559,7 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
GdkGC *gc;
gint num_icons = 0, icon_x_inc;
gboolean draw_reminder_icon = FALSE, draw_recurrence_icon = FALSE;
+ gboolean draw_timezone_icon = FALSE;
GSList *categories_list, *elem;
week_view = E_WEEK_VIEW (GTK_WIDGET (GNOME_CANVAS_ITEM (wveitem)->canvas)->parent);
@@ -581,6 +582,11 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
num_icons++;
}
+ if (!cal_component_compare_event_timezone (comp, week_view->zone)) {
+ draw_timezone_icon = TRUE;
+ num_icons++;
+ }
+
cal_component_get_categories_list (comp, &categories_list);
num_icons += g_slist_length (categories_list);
@@ -611,6 +617,17 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
icon_x += icon_x_inc;
}
+ if (draw_timezone_icon && icon_x + E_WEEK_VIEW_ICON_WIDTH <= x2) {
+ gdk_gc_set_clip_origin (gc, icon_x, icon_y);
+ gdk_gc_set_clip_mask (gc, week_view->timezone_mask);
+ gdk_draw_pixmap (drawable, gc,
+ week_view->timezone_icon,
+ 0, 0, icon_x, icon_y,
+ E_WEEK_VIEW_ICON_WIDTH,
+ E_WEEK_VIEW_ICON_HEIGHT);
+ icon_x += icon_x_inc;
+ }
+
/* draw categories icons */
for (elem = categories_list; elem; elem = elem->next) {
char *category;
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 62e44644fa..2cf036289f 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -60,6 +60,7 @@
/* Images */
#include "art/bell.xpm"
#include "art/recur.xpm"
+#include "art/timezone-16.xpm"
#include "art/jump.xpm"
#define E_WEEK_VIEW_SMALL_FONT \
@@ -541,6 +542,7 @@ e_week_view_realize (GtkWidget *widget)
/* Create the pixmaps. */
week_view->reminder_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &week_view->reminder_mask, NULL, bell_xpm);
week_view->recurrence_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &week_view->recurrence_mask, NULL, recur_xpm);
+ week_view->timezone_icon = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &week_view->timezone_mask, NULL, timezone_16_xpm);
}
@@ -2457,6 +2459,10 @@ e_week_view_reshape_event_span (EWeekView *week_view,
if (cal_component_has_recurrences (comp))
num_icons++;
+ if (!cal_component_compare_event_timezone (comp,
+ week_view->zone))
+ num_icons++;
+
cal_component_get_categories_list (comp, &categories_list);
num_icons += g_slist_length (categories_list);
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index 4bbc0477d2..5b3f257f5e 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -303,6 +303,8 @@ struct _EWeekView
GdkBitmap *reminder_mask;
GdkPixmap *recurrence_icon;
GdkBitmap *recurrence_mask;
+ GdkPixmap *timezone_icon;
+ GdkBitmap *timezone_mask;
/* Colors for drawing. */
GdkColor colors[E_WEEK_VIEW_COLOR_LAST];
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index 5fda525e71..9a290fdf09 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -2104,7 +2104,7 @@ print_date_label (GnomePrintContext *pc, CalComponent *comp,
cal_component_get_completed (comp, &datetime.value);
if (datetime.value)
complete = icaltime_as_timet_with_zone (*datetime.value, zone);
- cal_component_free_icaltimetype (&datetime.value);
+ cal_component_free_icaltimetype (datetime.value);
buffer[0] = '\0';
diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl
index a855f09cce..bbe828d2ea 100644
--- a/calendar/idl/evolution-calendar.idl
+++ b/calendar/idl/evolution-calendar.idl
@@ -175,7 +175,7 @@ module Calendar {
* object after this call, and call getObject to get the
* updated version.
*/
- void updateObject (in CalObjUID uid, in CalObj calobj)
+ void updateObjects (in CalObj calobj)
raises (InvalidObject);
/* Removes a component */
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 967b2d4520..c906b09ffd 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -89,8 +89,7 @@ static GNOME_Evolution_Calendar_CalComponentAlarms *cal_backend_file_get_alarms_
CalBackend *backend, const char *uid,
time_t start, time_t end, gboolean *object_found);
-static gboolean cal_backend_file_update_object (CalBackend *backend, const char *uid,
- const char *calobj);
+static gboolean cal_backend_file_update_objects (CalBackend *backend, const char *calobj);
static gboolean cal_backend_file_remove_object (CalBackend *backend, const char *uid);
static icaltimezone* cal_backend_file_get_timezone (CalBackend *backend, const char *tzid);
@@ -159,7 +158,7 @@ cal_backend_file_class_init (CalBackendFileClass *class)
backend_class->get_changes = cal_backend_file_get_changes;
backend_class->get_alarms_in_range = cal_backend_file_get_alarms_in_range;
backend_class->get_alarms_for_object = cal_backend_file_get_alarms_for_object;
- backend_class->update_object = cal_backend_file_update_object;
+ backend_class->update_objects = cal_backend_file_update_objects;
backend_class->remove_object = cal_backend_file_remove_object;
backend_class->get_timezone = cal_backend_file_get_timezone;
@@ -1635,9 +1634,9 @@ notify_remove (CalBackendFile *cbfile, const char *uid)
}
}
-/* Update_object handler for the file backend */
+/* Update_objects handler for the file backend. */
static gboolean
-cal_backend_file_update_object (CalBackend *backend, const char *uid, const char *calobj)
+cal_backend_file_update_objects (CalBackend *backend, const char *calobj)
{
CalBackendFile *cbfile;
CalBackendFilePrivate *priv;
@@ -1652,7 +1651,6 @@ cal_backend_file_update_object (CalBackend *backend, const char *uid, const char
g_return_val_if_fail (priv->icalcomp != NULL, FALSE);
- g_return_val_if_fail (uid != NULL, FALSE);
g_return_val_if_fail (calobj != NULL, FALSE);
/* Pull the component from the string and ensure that it is sane */
@@ -1714,18 +1712,18 @@ cal_backend_file_update_object (CalBackend *backend, const char *uid, const char
return FALSE;
}
- /* Check the UID for sanity's sake */
+ /* Get the UID, and check it isn't empty. */
cal_component_get_uid (comp, &comp_uid);
- if (strcmp (uid, comp_uid) != 0) {
+ if (!comp_uid || !comp_uid[0]) {
gtk_object_unref (GTK_OBJECT (comp));
return FALSE;
}
/* Update the component */
- old_comp = lookup_component (cbfile, uid);
+ old_comp = lookup_component (cbfile, comp_uid);
if (old_comp)
remove_component (cbfile, old_comp);
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index 1ca13028a9..ad56462565 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -146,7 +146,7 @@ cal_backend_class_init (CalBackendClass *class)
class->get_changes = NULL;
class->get_alarms_in_range = NULL;
class->get_alarms_for_object = NULL;
- class->update_object = NULL;
+ class->update_objects = NULL;
class->remove_object = NULL;
}
@@ -471,10 +471,9 @@ cal_backend_get_alarms_for_object (CalBackend *backend, const char *uid,
}
/**
- * cal_backend_update_object:
+ * cal_backend_update_objects:
* @backend: A calendar backend.
- * @uid: Unique identifier of the object to update.
- * @calobj: String representation of the new calendar object.
+ * @calobj: String representation of the new calendar object(s).
*
* Updates an object in a calendar backend. It will replace any existing
* object that has the same UID as the specified one. The backend will in
@@ -484,15 +483,14 @@ cal_backend_get_alarms_for_object (CalBackend *backend, const char *uid,
* with an unsupported type.
**/
gboolean
-cal_backend_update_object (CalBackend *backend, const char *uid, const char *calobj)
+cal_backend_update_objects (CalBackend *backend, const char *calobj)
{
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (IS_CAL_BACKEND (backend), FALSE);
- g_return_val_if_fail (uid != NULL, FALSE);
g_return_val_if_fail (calobj != NULL, FALSE);
- g_assert (CLASS (backend)->update_object != NULL);
- return (* CLASS (backend)->update_object) (backend, uid, calobj);
+ g_assert (CLASS (backend)->update_objects != NULL);
+ return (* CLASS (backend)->update_objects) (backend, calobj);
}
/**
diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h
index 568ae45034..a1ba2af4c2 100644
--- a/calendar/pcs/cal-backend.h
+++ b/calendar/pcs/cal-backend.h
@@ -104,7 +104,7 @@ struct _CalBackendClass {
time_t start, time_t end, gboolean *object_found);
/* Object manipulation virtual methods */
- gboolean (* update_object) (CalBackend *backend, const char *uid, const char *calobj);
+ gboolean (* update_objects) (CalBackend *backend, const char *calobj);
gboolean (* remove_object) (CalBackend *backend, const char *uid);
/* Timezone related virtual methods */
@@ -147,7 +147,7 @@ GNOME_Evolution_Calendar_CalComponentAlarms *cal_backend_get_alarms_for_object (
CalBackendGetAlarmsForObjectResult *result);
-gboolean cal_backend_update_object (CalBackend *backend, const char *uid, const char *calobj);
+gboolean cal_backend_update_objects (CalBackend *backend, const char *calobj);
gboolean cal_backend_remove_object (CalBackend *backend, const char *uid);
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c
index 9cd5b5b219..f89d5c820f 100644
--- a/calendar/pcs/cal.c
+++ b/calendar/pcs/cal.c
@@ -347,12 +347,11 @@ impl_Cal_get_alarms_for_object (PortableServer_Servant servant,
}
}
-/* Cal::update_object method */
+/* Cal::update_objects method */
static void
-impl_Cal_update_object (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CalObjUID uid,
- const GNOME_Evolution_Calendar_CalObj calobj,
- CORBA_Environment *ev)
+impl_Cal_update_objects (PortableServer_Servant servant,
+ const GNOME_Evolution_Calendar_CalObj calobj,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -360,7 +359,7 @@ impl_Cal_update_object (PortableServer_Servant servant,
cal = CAL (bonobo_object_from_servant (servant));
priv = cal->priv;
- if (!cal_backend_update_object (priv->backend, uid, calobj))
+ if (!cal_backend_update_objects (priv->backend, calobj))
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_GNOME_Evolution_Calendar_Cal_InvalidObject,
NULL);
@@ -592,7 +591,7 @@ cal_class_init (CalClass *klass)
epv->getFreeBusy = impl_Cal_get_free_busy;
epv->getAlarmsInRange = impl_Cal_get_alarms_in_range;
epv->getAlarmsForObject = impl_Cal_get_alarms_for_object;
- epv->updateObject = impl_Cal_update_object;
+ epv->updateObjects = impl_Cal_update_objects;
epv->removeObject = impl_Cal_remove_object;
epv->getQuery = impl_Cal_get_query;
}