aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-backend.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-01-24 16:40:57 +0800
committerArturo Espinosa <unammx@src.gnome.org>2000-01-24 16:40:57 +0800
commit13429d5ff13d94a68148a7f16bf954c8939f3f19 (patch)
treeb65ba47768e17e0ee5b05a0a06a021eb894a301e /calendar/cal-backend.c
parent6e707feec4b4e2c9d89fe1278819addc1b8428fe (diff)
downloadgsoc2013-evolution-13429d5ff13d94a68148a7f16bf954c8939f3f19.tar
gsoc2013-evolution-13429d5ff13d94a68148a7f16bf954c8939f3f19.tar.gz
gsoc2013-evolution-13429d5ff13d94a68148a7f16bf954c8939f3f19.tar.bz2
gsoc2013-evolution-13429d5ff13d94a68148a7f16bf954c8939f3f19.tar.lz
gsoc2013-evolution-13429d5ff13d94a68148a7f16bf954c8939f3f19.tar.xz
gsoc2013-evolution-13429d5ff13d94a68148a7f16bf954c8939f3f19.tar.zst
gsoc2013-evolution-13429d5ff13d94a68148a7f16bf954c8939f3f19.zip
New function to remove a calendar client interface object from a backend.
2000-01-24 Federico Mena Quintero <federico@helixcode.com> * cal-backend.c (cal_backend_remove_cal): New function to remove a calendar client interface object from a backend. (cal_backend_load): Convert the URI to string and use Parse_MIME_FromFileName(). The conversion is not very smart, though. * cal-factory.c (load_backend): Moved most of the error handling upstream to load_fn(). (load_fn): Handle failure in case the backend could not be loaded. (cal_factory_destroy): Free the backends and the backend hash table. (add_calendar_client): Implemented. We create a Cal client interface object and attach it to the backend, and we notify the listener. svn path=/trunk/; revision=1618
Diffstat (limited to 'calendar/cal-backend.c')
-rw-r--r--calendar/cal-backend.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/calendar/cal-backend.c b/calendar/cal-backend.c
index 0d90e7a2dd..649a1dd8f4 100644
--- a/calendar/cal-backend.c
+++ b/calendar/cal-backend.c
@@ -297,10 +297,43 @@ cal_backend_add_cal (CalBackend *backend, Cal *cal)
g_return_if_fail (cal != NULL);
g_return_if_fail (IS_CAL (cal));
+ gtk_object_ref (cal);
priv->clients = g_list_prepend (priv->clients, cal);
}
/**
+ * cal_backend_remove_cal:
+ * @backend: A calendar backend.
+ * @cal: A calendar client interface object.
+ *
+ * Removes a calendar client interface object from a calendar backend. The
+ * calendar backend must already have a loaded calendar.
+ **/
+void
+cal_backend_remove_cal (CalBackend *backend, Cal *cal)
+{
+ CalBackendPrivate *priv;
+ GList *l;
+
+ g_return_if_fail (backend != NULL);
+ g_return_if_fail (IS_CAL_BACKEND (backend));
+
+ priv = backend->priv;
+ g_return_if_fail (priv->loaded);
+
+ g_return_if_fail (cal != NULL);
+ g_return_if_fail (IS_CAL (cal));
+
+ l = g_list_find (priv->clients, cal);
+ if (!l)
+ return;
+
+ gtk_object_unref (cal);
+ priv->clients = g_list_remove_link (priv->clients, l);
+ g_list_free1 (l);
+}
+
+/**
* cal_backend_load:
* @backend: A calendar backend.
* @uri: URI that contains the calendar data.
@@ -315,6 +348,7 @@ cal_backend_load (CalBackend *backend, GnomeVFSURI *uri)
{
CalBackendPrivate *priv;
VObject *vobject;
+ char *str_uri;
g_return_val_if_fail (backend != NULL, CAL_BACKEND_LOAD_ERROR);
g_return_val_if_fail (IS_CAL_BACKEND (backend), CAL_BACKEND_LOAD_ERROR);
@@ -323,7 +357,20 @@ cal_backend_load (CalBackend *backend, GnomeVFSURI *uri)
priv = backend->priv;
g_return_val_if_fail (!priv->loaded, CAL_BACKEND_LOAD_ERROR);
- vobject = Parse_MIME_FromURI (uri);
+ /* FIXME: this looks rather bad; maybe we should check for local files
+ * and fail if they are remote.
+ */
+
+ str_uri = gnome_vfs_uri_to_string (uri,
+ (GNOME_VFS_URI_HIDE_USER_NAME
+ | GNOME_VFS_URI_HIDE_PASSWORD
+ | GNOME_VFS_URI_HIDE_HOST_NAME
+ | GNOME_VFS_URI_HIDE_HOST_PORT
+ | GNOME_VFS_URI_HIDE_TOPLEVEL_METHOD));
+
+ vobject = Parse_MIME_FromFileName (str_uri);
+ g_free (str_uri);
+
if (!vobject)
return CAL_BACKEND_LOAD_ERROR;