aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-client/cal-client.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-07-12 10:38:25 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-07-12 10:38:25 +0800
commit421aa80ae6961cb4ddef8e79133ce89fcfbbf52d (patch)
treefd3811ceee6c56a89c0c930502c3d9ba279766c8 /calendar/cal-client/cal-client.c
parent0a9ff51460111657627b5e3a7eca6a45606b4fb2 (diff)
downloadgsoc2013-evolution-421aa80ae6961cb4ddef8e79133ce89fcfbbf52d.tar
gsoc2013-evolution-421aa80ae6961cb4ddef8e79133ce89fcfbbf52d.tar.gz
gsoc2013-evolution-421aa80ae6961cb4ddef8e79133ce89fcfbbf52d.tar.bz2
gsoc2013-evolution-421aa80ae6961cb4ddef8e79133ce89fcfbbf52d.tar.lz
gsoc2013-evolution-421aa80ae6961cb4ddef8e79133ce89fcfbbf52d.tar.xz
gsoc2013-evolution-421aa80ae6961cb4ddef8e79133ce89fcfbbf52d.tar.zst
gsoc2013-evolution-421aa80ae6961cb4ddef8e79133ce89fcfbbf52d.zip
renamed updateObject to updateObjects and removed the UID argument, since
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. svn path=/trunk/; revision=11027
Diffstat (limited to 'calendar/cal-client/cal-client.c')
-rw-r--r--calendar/cal-client/cal-client.c77
1 files changed, 66 insertions, 11 deletions
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.