diff options
author | Federico Mena Quintero <federico@helixcode.com> | 2000-02-17 17:21:20 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2000-02-17 17:21:20 +0800 |
commit | cf16aa4fb112337616d20f4f2f9c2512cbe5e82f (patch) | |
tree | e8e3eb3c798e3a2492a9f8c1a045b85a04479d99 /calendar/pcs/cal-backend.c | |
parent | 514b2de963c04ce463ff84a54933673be284ad45 (diff) | |
download | gsoc2013-evolution-cf16aa4fb112337616d20f4f2f9c2512cbe5e82f.tar gsoc2013-evolution-cf16aa4fb112337616d20f4f2f9c2512cbe5e82f.tar.gz gsoc2013-evolution-cf16aa4fb112337616d20f4f2f9c2512cbe5e82f.tar.bz2 gsoc2013-evolution-cf16aa4fb112337616d20f4f2f9c2512cbe5e82f.tar.lz gsoc2013-evolution-cf16aa4fb112337616d20f4f2f9c2512cbe5e82f.tar.xz gsoc2013-evolution-cf16aa4fb112337616d20f4f2f9c2512cbe5e82f.tar.zst gsoc2013-evolution-cf16aa4fb112337616d20f4f2f9c2512cbe5e82f.zip |
Implemented.
2000-02-17 Federico Mena Quintero <federico@helixcode.com>
* cal-client.c (cal_client_remove_object): Implemented.
* cal.c (cal_notify_remove): Implemented.
(Cal_remove_object): Implemented.
(cal_get_epv): Fill in the remove_object field in the epv.
* cal-backend.c (cal_backend_remove_object): Implemented.
(notify_remove): New function to notify clients that an object was
removed.
svn path=/trunk/; revision=1821
Diffstat (limited to 'calendar/pcs/cal-backend.c')
-rw-r--r-- | calendar/pcs/cal-backend.c | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index 1ce4b615c3..6b9894e098 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -856,6 +856,23 @@ notify_update (CalBackend *backend, const char *uid) } } +/* Notifies a backend's clients that an object was removed */ +static void +notify_remove (CalBackend *backend, const char *uid) +{ + CalBackendPrivate *priv; + GList *l; + + priv = backend->priv; + + for (l = priv->clients; l; l = l->next) { + Cal *cal; + + cal = CAL (l->data); + cal_notify_remove (cal, uid); + } +} + /** * cal_backend_update_object: * @backend: A calendar backend. @@ -900,22 +917,45 @@ cal_backend_update_object (CalBackend *backend, const char *uid, const char *cal add_object (backend, new_ico); + /* FIXME: do the notification asynchronously */ + notify_update (backend, new_ico->uid); return TRUE; } -void +/** + * cal_backend_remove_object: + * @backend: A calendar backend. + * @uid: Unique identifier of the object to remove. + * + * Removes an object in a calendar backend. The backend will notify all of its + * clients about the change. + * + * Return value: TRUE on success, FALSE on being passed an UID for an object + * that does not exist in the backend. + **/ +gboolean cal_backend_remove_object (CalBackend *backend, const char *uid) { CalBackendPrivate *priv; + iCalObject *ico; - g_return_if_fail (backend != NULL); - g_return_if_fail (IS_CAL_BACKEND (backend)); + g_return_val_if_fail (backend != NULL, FALSE); + g_return_val_if_fail (IS_CAL_BACKEND (backend), FALSE); priv = backend->priv; - g_return_if_fail (priv->loaded); + g_return_val_if_fail (priv->loaded, FALSE); - g_return_if_fail (uid != NULL); + g_return_val_if_fail (uid != NULL, FALSE); - /* FIXME */ + ico = lookup_object (backend, uid); + if (!ico) + return FALSE; + + remove_object (backend, ico); + + /* FIXME: do the notification asynchronously */ + + notify_remove (backend, uid); + return TRUE; } |