diff options
Diffstat (limited to 'calendar/pcs')
-rw-r--r-- | calendar/pcs/cal-backend.c | 498 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.h | 75 | ||||
-rw-r--r-- | calendar/pcs/cal-common.h | 41 | ||||
-rw-r--r-- | calendar/pcs/cal-factory.c | 517 | ||||
-rw-r--r-- | calendar/pcs/cal-factory.h | 70 | ||||
-rw-r--r-- | calendar/pcs/cal.c | 346 | ||||
-rw-r--r-- | calendar/pcs/cal.h | 67 | ||||
-rw-r--r-- | calendar/pcs/calobj.c | 1490 | ||||
-rw-r--r-- | calendar/pcs/calobj.h | 215 | ||||
-rw-r--r-- | calendar/pcs/job.c | 98 | ||||
-rw-r--r-- | calendar/pcs/job.h | 35 | ||||
-rw-r--r-- | calendar/pcs/tlacuache.c | 126 | ||||
-rw-r--r-- | calendar/pcs/tlacuache.gnorba | 5 |
13 files changed, 0 insertions, 3583 deletions
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c deleted file mode 100644 index 72315e3882..0000000000 --- a/calendar/pcs/cal-backend.c +++ /dev/null @@ -1,498 +0,0 @@ -/* Evolution calendar backend - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero <federico@helixcode.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include "cal-backend.h" -#include "calobj.h" -#include "../libversit/vcc.h" - - - -/* VCalendar product ID */ -#define PRODID "-//Helix Code//NONSGML Tlacuache//EN" - - - -/* Private part of the CalBackend structure */ -typedef struct { - /* URI where the calendar data is stored */ - GnomeVFSURI *uri; - - /* List of Cal client interface objects, each with its listener */ - GList *clients; - - /* All the iCalObject structures in the calendar, hashed by UID. The - * hash key *is* icalobj->uid; it is not copied, so don't free it when - * you remove an object from the hash table. - */ - GHashTable *object_hash; - - /* All events, TODOs, and journals in the calendar */ - GList *events; - GList *todos; - GList *journals; - - /* Whether a calendar has been loaded */ - guint loaded : 1; -} CalBackendPrivate; - - - -static void cal_backend_class_init (CalBackendClass *class); -static void cal_backend_init (CalBackend *backend); -static void cal_backend_destroy (GtkObject *object); - -static GtkObjectClass *parent_class; - - - -/** - * cal_backend_get_type: - * @void: - * - * Registers the #CalBackend class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CalBackend class. - **/ -GtkType -cal_backend_get_type (void) -{ - static GtkType cal_backend_type = 0; - - if (!cal_backend_type) { - static const GtkTypeInfo cal_backend_info = { - "CalBackend", - sizeof (CalBackend), - sizeof (CalBackendClass), - (GtkClassInitFunc) cal_backend_class_init, - (GtkObjectInitFunc) cal_backend_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_backend_type = gtk_type_unique (GTK_TYPE_OBJECT, &cal_backend_info); - } - - return cal_backend_type; -} - -/* Class initialization function for the calendar backend */ -static void -cal_backend_class_init (CalBackendClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (GTK_TYPE_OBJECT); - - object_class->destroy = cal_backend_destroy; -} - -/* Object initialization function for the calendar backend */ -static void -cal_backend_init (CalBackend *backend) -{ - CalBackendPrivate *priv; - - priv = g_new0 (CalBackendPrivate, 1); - backend->priv = priv; -} - -/* Destroy handler for the calendar backend */ -static void -cal_backend_destroy (GtkObject *object) -{ - CalBackend *backend; - CalBackendPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_BACKEND (object)); - - backend = CAL_BACKEND (object); - priv = backend->priv; - - /* FIXME: free stuff */ - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* iCalObject manipulation functions */ - -/* Ensures that an iCalObject has a unique identifier. If it doesn't have one, - * it will create one for it. Returns whether an UID was created or not. - */ -static gboolean -ensure_uid (iCalObject *ico) -{ - char *buf; - gulong str_time; - static guint seqno = 0; - - if (ico->uid) - return FALSE; - - str_time = (gulong) time (NULL); - - /* Is this good enough? */ - - buf = g_strdup_printf ("Evolution-Tlacuache-%d-%ld-%u", (int) getpid(), str_time, seqno++); - ico->uid = buf; - - return TRUE; -} - -/* Adds an object to the calendar backend. Does *not* perform notification to - * calendar clients. - */ -static void -add_object (CalBackend *backend, iCalObject *ico) -{ - CalBackendPrivate *priv; - - g_assert (ico != NULL); - priv = backend->priv; - -#if 0 - /* FIXME: gnomecal old code */ - ico->new = 0; -#endif - - if (ensure_uid (ico)) - /* FIXME: mark the calendar as dirty so that we can re-save it - * with the object's new UID. - */ - ; - - g_hash_table_insert (priv->object_hash, ico->uid, ico); - - switch (ico->type) { - case ICAL_EVENT: - priv->events = g_list_prepend (priv->events, ico); -#if 0 - /* FIXME: gnomecal old code */ - ical_object_try_alarms (ico); -# ifdef DEBUGGING_MAIL_ALARM - ico->malarm.trigger = 0; - calendar_notify (0, ico); -# endif -#endif - break; - - case ICAL_TODO: - priv->todos = g_list_prepend (priv->todos, ico); - break; - - case ICAL_JOURNAL: - priv->journals = g_list_prepend (priv->journals, ico); - break; - - default: - g_assert_not_reached (); - } - -#if 0 - /* FIXME: gnomecal old code */ - ico->last_mod = time (NULL); -#endif -} - -/* Load a calendar from a VObject */ -static void -load_from_vobject (CalBackend *backend, VObject *vobject) -{ - CalBackendPrivate *priv; - VObjectIterator i; - - priv = backend->priv; - - g_assert (!priv->loaded); - g_assert (priv->object_hash == NULL); - priv->object_hash = g_hash_table_new (g_str_hash, g_str_equal); - - initPropIterator (&i, vobject); - - while (moreIteration (&i)) { - VObject *this; - iCalObject *ical; - const char *object_name; - - this = nextVObject (&i); - object_name = vObjectName (this); -#if 0 - /* FIXME? What is this used for in gnomecal? */ - if (strcmp (object_name, VCDCreatedProp) == 0) { - cal->created = time_from_isodate (str_val (this)); - continue; - } -#endif - if (strcmp (object_name, VCLocationProp) == 0) - continue; /* FIXME: imlement */ - - if (strcmp (object_name, VCProdIdProp) == 0) - continue; /* FIXME: implement */ - - if (strcmp (object_name, VCVersionProp) == 0) - continue; /* FIXME: implement */ - - if (strcmp (object_name, VCTimeZoneProp) == 0) - continue; /* FIXME: implement */ - - ical = ical_object_create_from_vobject (this, object_name); - - if (ical) - add_object (backend, ical); - } -} - -/* Creates a VObject with the base information of a calendar */ -static VObject * -get_calendar_base_vobject (CalBackend *backend) -{ - VObject *vobj; - time_t now; - struct tm tm; - - /* We call localtime for the side effect of setting tzname */ - - now = time (NULL); - tm = *localtime (&now); - - vobj = newVObject (VCCalProp); - - addPropValue (vobj, VCProdIdProp, PRODID); - -#if defined (HAVE_TM_ZONE) - addPropValue (vobj, VCTimeZoneProp, tm.tm_zone); -#elif defined (HAVE_TZNAME) - addPropValue (vobj, VCTimeZoneProp, tzname[0]); -#endif - - /* Per the vCalendar spec, this must be "1.0" */ - addPropValue (vobj, VCVersionProp, "1.0"); - - return vobj; -} - - - -/** - * cal_backend_new: - * @void: - * - * Creates a new empty calendar backend. A calendar must then be loaded or - * created before the backend can be used. - * - * Return value: A newly-created calendar backend. - **/ -CalBackend * -cal_backend_new (void) -{ - return CAL_BACKEND (gtk_type_new (CAL_BACKEND_TYPE)); -} - -/** - * cal_backend_get_uri: - * @backend: A calendar backend. - * - * Queries the URI of a calendar backend, which must already have a loaded - * calendar. - * - * Return value: The URI where the calendar is stored. - **/ -GnomeVFSURI * -cal_backend_get_uri (CalBackend *backend) -{ - CalBackendPrivate *priv; - - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, NULL); - g_assert (priv->uri != NULL); - - return priv->uri; -} - -/** - * cal_backend_add_cal: - * @backend: A calendar backend. - * @cal: A calendar client interface object. - * - * Adds a calendar client interface object to a calendar @backend. The calendar - * backend must already have a loaded calendar. - **/ -void -cal_backend_add_cal (CalBackend *backend, Cal *cal) -{ - CalBackendPrivate *priv; - - 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)); - - gtk_object_ref (GTK_OBJECT (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 (GTK_OBJECT (cal)); - priv->clients = g_list_remove_link (priv->clients, l); - g_list_free_1 (l); -} - -/** - * cal_backend_load: - * @backend: A calendar backend. - * @uri: URI that contains the calendar data. - * - * Loads a calendar backend with data from a calendar stored at the specified - * URI. - * - * Return value: An operation status code. - **/ -CalBackendLoadStatus -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); - g_return_val_if_fail (uri != NULL, CAL_BACKEND_LOAD_ERROR); - - priv = backend->priv; - g_return_val_if_fail (!priv->loaded, CAL_BACKEND_LOAD_ERROR); - - /* 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; - - load_from_vobject (backend, vobject); - cleanVObject (vobject); - cleanStrTbl (); - - gnome_vfs_uri_ref (uri); - - priv->uri = uri; - priv->loaded = TRUE; - return CAL_BACKEND_LOAD_SUCCESS; -} - -/** - * cal_backend_get_object: - * @backend: A calendar backend. - * @uid: Unique identifier for a calendar object. - * - * Queries a calendar backend for a calendar object based on its unique - * identifier. - * - * Return value: The string representation of a complete calendar wrapping the - * the sought object, or NULL if no object had the specified UID. A complete - * calendar is returned because you also need the timezone data. - **/ -char * -cal_backend_get_object (CalBackend *backend, const char *uid) -{ - CalBackendPrivate *priv; - iCalObject *ico; - VObject *vcalobj, *vobj; - char *buf; - - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - priv = backend->priv; - g_return_val_if_fail (priv->loaded, NULL); - - g_return_val_if_fail (uid != NULL, NULL); - - g_assert (priv->object_hash != NULL); - - ico = g_hash_table_lookup (priv->objec_hash, uid); - - if (!ico) - return NULL; - - vcalobj = get_calendar_base_vobject (backend); - vobj = ical_object_to_vobject (ico); - addVObjectProp (vcalobj, vobj); - - buf = writeMemVObject (NULL, NULL, vcalobj); - - cleanVObject (vcalobj); - cleanStrTbl (); - - return buf; -} diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h deleted file mode 100644 index e972cbd59e..0000000000 --- a/calendar/pcs/cal-backend.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Evolution calendar backend - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero <federico@helixcode.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CAL_BACKEND_H -#define CAL_BACKEND_H - -#include <libgnome/gnome-defs.h> -#include <libgnomevfs/gnome-vfs.h> -#include "evolution-calendar.h" -#include "cal-common.h" -#include "cal.h" - -BEGIN_GNOME_DECLS - - - -#define CAL_BACKEND_TYPE (cal_backend_get_type ()) -#define CAL_BACKEND(obj) (GTK_CHECK_CAST ((obj), CAL_BACKEND_TYPE, CalBackend)) -#define CAL_BACKEND_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_BACKEND_TYPE, \ - CalBackendClass)) -#define IS_CAL_BACKEND(obj) (GTK_CHECK_TYPE ((obj), CAL_BACKEND_TYPE)) -#define IS_CAL_BACKEND_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_BACKEND_TYPE)) - -typedef enum { - CAL_BACKEND_LOAD_SUCCESS, /* Loading OK */ - CAL_BACKEND_LOAD_ERROR /* We need better error reporting in libversit */ -} CalBackendLoadStatus; - -struct _CalBackend { - GtkObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalBackendClass { - GtkObjectClass parent_class; -}; - -GtkType cal_backend_get_type (void); - -CalBackend *cal_backend_new (void); - -GnomeVFSURI *cal_backend_get_uri (CalBackend *backend); - -void cal_backend_add_cal (CalBackend *backend, Cal *cal); -void cal_backend_remove_cal (CalBackend *backend, Cal *cal); - -CalBackendLoadStatus cal_backend_load (CalBackend *backend, GnomeVFSURI *uri); - -char *cal_backend_get_object (CalBackend *backend, const char *uid); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/pcs/cal-common.h b/calendar/pcs/cal-common.h deleted file mode 100644 index e51ddf1bdd..0000000000 --- a/calendar/pcs/cal-common.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Evolution calendar server - common declarations - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero <federico@helixcode.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CAL_COMMON_H -#define CAL_COMMON_H - -#include <libgnome/gnome-defs.h> - -BEGIN_GNOME_DECLS - - - -typedef struct _CalBackend CalBackend; -typedef struct _CalBackendClass CalBackendClass; - -typedef struct _Cal Cal; -typedef struct _CalClass CalClass; - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/pcs/cal-factory.c b/calendar/pcs/cal-factory.c deleted file mode 100644 index d5b79ef423..0000000000 --- a/calendar/pcs/cal-factory.c +++ /dev/null @@ -1,517 +0,0 @@ -/* Evolution calendar factory - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero <federico@helixcode.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include "cal.h" -#include "cal-backend.h" -#include "cal-factory.h" -#include "job.h" - - - -/* Private part of the CalFactory structure */ -typedef struct { - /* Hash table from GnomeVFSURI structures to CalBackend objects */ - GHashTable *backends; -} CalFactoryPrivate; - - - -static void cal_factory_class_init (CalFactoryClass *class); -static void cal_factory_init (CalFactory *factory); -static void cal_factory_destroy (GtkObject *object); - -static POA_Evolution_Calendar_CalFactory__vepv cal_factory_vepv; - -static BonoboObjectClass *parent_class; - - - -/** - * cal_factory_get_type: - * @void: - * - * Registers the #CalFactory class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the #CalFactory class. - **/ -GtkType -cal_factory_get_type (void) -{ - static GtkType cal_factory_type = 0; - - if (!cal_factory_type) { - static const GtkTypeInfo cal_factory_info = { - "CalFactory", - sizeof (CalFactory), - sizeof (CalFactoryClass), - (GtkClassInitFunc) cal_factory_class_init, - (GtkObjectInitFunc) cal_factory_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_factory_type = gtk_type_unique (bonobo_object_get_type (), &cal_factory_info); - } - - return cal_factory_type; -} - -/* CORBA class initialization function for the calendar factory */ -static void -init_cal_factory_corba_class (void) -{ - cal_factory_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - cal_factory_vepv.Evolution_Calendar_CalFactory_epv = cal_factory_get_epv (); -} - -/* Class initialization function for the calendar factory */ -static void -cal_factory_class_init (CalFactoryClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (bonobo_object_get_type ()); - - object_class->destroy = cal_factory_destroy; - - init_cal_factory_corba_class (); -} - -/* Object initialization function for the calendar factory */ -static void -cal_factory_init (CalFactory *factory) -{ - CalFactoryPrivate *priv; - - priv = g_new0 (CalFactoryPrivate, 1); - factory->priv = priv; - - priv->backends = g_hash_table_new (gnome_vfs_uri_hash, gnome_vfs_uri_hequal); -} - -/* Frees a uri/backend pair from the backends hash table */ -static void -free_backend (gpointer key, gpointer value, gpointer data) -{ - GnomeVFSURI *uri; - CalBackend *backend; - - uri = key; - backend = value; - - gnome_vfs_uri_unref (uri); - gtk_object_unref (GTK_OBJECT (backend)); -} - -/* Destroy handler for the calendar */ -static void -cal_factory_destroy (GtkObject *object) -{ - CalFactory *factory; - CalFactoryPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL_FACTORY (object)); - - factory = CAL_FACTORY (object); - priv = factory->priv; - - g_hash_table_foreach (priv->backends, free_backend, NULL); - g_hash_table_destroy (priv->backends); - priv->backends = NULL; - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* CORBA servant implementation */ - -/* CalFactory::load method */ -static void -CalFactory_load (PortableServer_Servant servant, - const CORBA_char *uri, - Evolution_Calendar_Listener listener, - CORBA_Environment *ev) -{ - CalFactory *factory; - CalFactoryPrivate *priv; - CORBA_Environment ev2; - gboolean result; - - factory = CAL_FACTORY (bonobo_object_from_servant (servant)); - priv = factory->priv; - - CORBA_exception_init (&ev2); - result = CORBA_Object_is_nil (listener, &ev2); - - if (ev2._major != CORBA_NO_EXCEPTION || result) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_Calendar_CalFactory_NilListener, - NULL); - - CORBA_exception_free (&ev2); - return; - } - CORBA_exception_free (&ev2); - - cal_factory_load (factory, uri, listener); -} - -/* CalFactory::create method */ -static void -CalFactory_create (PortableServer_Servant servant, - const CORBA_char *uri, - Evolution_Calendar_Listener listener, - CORBA_Environment *ev) -{ - CalFactory *factory; - CalFactoryPrivate *priv; - - factory = CAL_FACTORY (bonobo_object_from_servant (servant)); - priv = factory->priv; - - cal_factory_create (factory, uri, listener); -} - -/** - * cal_factory_get_epv: - * @void: - * - * Creates an EPV for the CalFactory CORBA class. - * - * Return value: A newly-allocated EPV. - **/ -POA_Evolution_Calendar_CalFactory__epv * -cal_factory_get_epv (void) -{ - POA_Evolution_Calendar_CalFactory__epv *epv; - - epv = g_new0 (POA_Evolution_Calendar_CalFactory__epv, 1); - epv->load = CalFactory_load; - epv->create = CalFactory_create; - - return epv; -} - - - -/* Loading and creating calendars */ - -/* Job data */ -typedef struct { - CalFactory *factory; - char *uri; - Evolution_Calendar_Listener listener; -} LoadCreateJobData; - -/* Looks up a calendar backend in a factory's hash table of uri->cal */ -static CalBackend * -lookup_backend (CalFactory *factory, GnomeVFSURI *uri) -{ - CalFactoryPrivate *priv; - CalBackend *backend; - - priv = factory->priv; - - backend = g_hash_table_lookup (priv->backends, uri); - return backend; -} - -/* Loads a calendar backend and puts it in the factory's backend hash table */ -static CalBackend * -load_backend (CalFactory *factory, GnomeVFSURI *uri, Evolution_Calendar_Listener listener) -{ - CalFactoryPrivate *priv; - CalBackend *backend; - CalBackendLoadStatus status; - - priv = factory->priv; - - backend = cal_backend_new (); - if (!backend) { - g_message ("load_backend(): could not create the backend"); - return NULL; - } - - status = cal_backend_load (backend, uri); - - switch (status) { - case CAL_BACKEND_LOAD_SUCCESS: - gnome_vfs_uri_ref (uri); - g_hash_table_insert (priv->backends, uri, backend); - - return backend; - - case CAL_BACKEND_LOAD_ERROR: - gtk_object_unref (GTK_OBJECT (backend)); - return NULL; - - default: - g_assert_not_reached (); - return NULL; - } -} - -/* Adds a listener to a calendar backend by creating a calendar client interface - * object. - */ -static void -add_calendar_client (CalFactory *factory, CalBackend *backend, Evolution_Calendar_Listener listener) -{ - Cal *cal; - CORBA_Environment ev; - - cal = cal_new (backend, listener); - if (!cal) { - g_message ("add_calendar_client(): could not create the calendar client interface"); - - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_cal_loaded (listener, - Evolution_Calendar_Listener_ERROR, - CORBA_OBJECT_NIL, - &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("add_calendar_client(): could not notify the listener"); - - CORBA_exception_free (&ev); - return; - } - - cal_backend_add_cal (backend, cal); - - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_cal_loaded (listener, - Evolution_Calendar_Listener_SUCCESS, - bonobo_object_corba_objref (BONOBO_OBJECT (cal)), - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("add_calendar_client(): could not notify the listener"); - cal_backend_remove_cal (backend, cal); - } - - gtk_object_unref (GTK_OBJECT (cal)); -} - -/* Job handler for the load calendar command */ -static void -load_fn (gpointer data) -{ - LoadCreateJobData *jd; - CalFactory *factory; - GnomeVFSURI *uri; - Evolution_Calendar_Listener listener; - CalBackend *backend; - CORBA_Environment ev; - - jd = data; - - /* Look up the calendar */ - - uri = gnome_vfs_uri_new (jd->uri); - g_free (jd->uri); - - factory = jd->factory; - listener = jd->listener; - g_free (jd); - - backend = lookup_backend (factory, uri); - - if (!backend) - backend = load_backend (factory, uri, listener); - - gnome_vfs_uri_unref (uri); - - if (!backend) { - g_message ("load_fn(): could not load the backend"); - CORBA_exception_init (&ev); - Evolution_Calendar_Listener_cal_loaded (listener, - Evolution_Calendar_Listener_ERROR, - CORBA_OBJECT_NIL, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("load_fn(): could not notify the listener"); - - CORBA_exception_free (&ev); - goto out; - } - - add_calendar_client (factory, backend, listener); - - out: - - CORBA_exception_init (&ev); - CORBA_Object_release (listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("load_fn(): could not release the listener"); - - CORBA_exception_free (&ev); -} - - - -/** - * cal_factory_construct: - * @factory: A calendar factory. - * @corba_factory: CORBA object for the calendar factory. - * - * Constructs a calendar factory by binding the corresponding CORBA object to - * it. - * - * Return value: The same object as the @factory argument. - **/ -CalFactory * -cal_factory_construct (CalFactory *factory, Evolution_Calendar_CalFactory corba_factory) -{ - g_return_val_if_fail (factory != NULL, NULL); - g_return_val_if_fail (IS_CAL_FACTORY (factory), NULL); - - bonobo_object_construct (BONOBO_OBJECT (factory), corba_factory); - return factory; -} - -/** - * cal_factory_corba_object_create: - * @object: #BonoboObject that will wrap the CORBA object. - * - * Creates and activates the CORBA object that is wrapped by the specified - * calendar factory @object. - * - * Return value: An activated object reference or #CORBA_OBJECT_NIL in case of - * failure. - **/ -Evolution_Calendar_CalFactory -cal_factory_corba_object_create (BonoboObject *object) -{ - POA_Evolution_Calendar_CalFactory *servant; - CORBA_Environment ev; - - g_return_val_if_fail (object != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (IS_CAL_FACTORY (object), CORBA_OBJECT_NIL); - - servant = (POA_Evolution_Calendar_CalFactory *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &cal_factory_vepv; - - CORBA_exception_init (&ev); - POA_Evolution_Calendar_CalFactory__init ((PortableServer_Servant) servant, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_factory_corba_object_create(): could not init the servant"); - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - return (Evolution_Calendar_CalFactory) bonobo_object_activate_servant (object, servant); -} - -/** - * cal_factory_new: - * @void: - * - * Creates a new #CalFactory object. - * - * Return value: A newly-created #CalFactory, or NULL if its corresponding CORBA - * object could not be created. - **/ -CalFactory * -cal_factory_new (void) -{ - CalFactory *factory; - CORBA_Environment ev; - Evolution_Calendar_CalFactory corba_factory; - gboolean retval; - - factory = gtk_type_new (CAL_FACTORY_TYPE); - - corba_factory = cal_factory_corba_object_create (BONOBO_OBJECT (factory)); - - CORBA_exception_init (&ev); - retval = CORBA_Object_is_nil (corba_factory, &ev); - - if (ev._major != CORBA_NO_EXCEPTION || retval) { - g_message ("cal_factory_new(): could not create the CORBA factory"); - gtk_object_unref (GTK_OBJECT (factory)); - CORBA_exception_free (&ev); - return NULL; - } - CORBA_exception_free (&ev); - - return cal_factory_construct (factory, corba_factory); -} - -void -cal_factory_load (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener) -{ - LoadCreateJobData *jd; - CORBA_Environment ev; - Evolution_Calendar_Listener listener_copy; - gboolean result; - - CORBA_exception_init (&ev); - result = CORBA_Object_is_nil (listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_factory_load(): could not see if the listener was NIL"); - CORBA_exception_free (&ev); - return; - } - CORBA_exception_free (&ev); - - if (result) { - g_message ("cal_factory_load(): cannot operate on a NIL listener!"); - return; - } - - listener_copy = CORBA_Object_duplicate (listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_factory_load(): could not duplicate the listener"); - CORBA_exception_free (&ev); - return; - } - - CORBA_exception_free (&ev); - - jd = g_new (LoadCreateJobData, 1); - jd->factory = factory; - jd->uri = g_strdup (uri); - jd->listener = listener_copy; - - job_add (load_fn, jd); -} - -void -cal_factory_create (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener) -{ - /* FIXME */ -} diff --git a/calendar/pcs/cal-factory.h b/calendar/pcs/cal-factory.h deleted file mode 100644 index 9d5fd57e2c..0000000000 --- a/calendar/pcs/cal-factory.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Evolution calendar factory - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero <federico@helixcode.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CAL_FACTORY_H -#define CAL_FACTORY_H - -#include <libgnome/gnome-defs.h> -#include <bonobo/bonobo-object.h> -#include "evolution-calendar.h" - -BEGIN_GNOME_DECLS - - - -#define CAL_FACTORY_TYPE (cal_factory_get_type ()) -#define CAL_FACTORY(obj) (GTK_CHECK_CAST ((obj), CAL_FACTORY_TYPE, CalFactory)) -#define CAL_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_FACTORY_TYPE, \ - CalFactoryClass)) -#define IS_CAL_FACTORY(obj) (GTK_CHECK_TYPE ((obj), CAL_FACTORY_TYPE)) -#define IS_CAL_FACTORY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_FACTORY_TYPE)) - -typedef struct _CalFactory CalFactory; -typedef struct _CalFactoryClass CalFactoryClass; - -struct _CalFactory { - BonoboObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalFactoryClass { - BonoboObjectClass parent_class; -}; - -GtkType cal_factory_get_type (void); - -CalFactory *cal_factory_construct (CalFactory *factory, Evolution_Calendar_CalFactory corba_factory); -Evolution_Calendar_CalFactory cal_factory_corba_object_create (BonoboObject *object); - -CalFactory *cal_factory_new (void); - -void cal_factory_load (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener); -void cal_factory_create (CalFactory *factory, const char *uri, Evolution_Calendar_Listener listener); - -POA_Evolution_Calendar_CalFactory__epv *cal_factory_get_epv (void); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c deleted file mode 100644 index 1ce1d91716..0000000000 --- a/calendar/pcs/cal.c +++ /dev/null @@ -1,346 +0,0 @@ -/* Evolution calendar client interface object - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero <federico@helixcode.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include "cal.h" -#include "cal-backend.h" - - - -/* Private part of the Cal structure */ -typedef struct { - /* Our backend */ - CalBackend *backend; - - /* Listener on the client we notify */ - Evolution_Calendar_Listener listener; -} CalPrivate; - - - -static void cal_class_init (CalClass *class); -static void cal_init (Cal *cal); -static void cal_destroy (GtkObject *object); - -static POA_Evolution_Calendar_Cal__vepv cal_vepv; - -static BonoboObjectClass *parent_class; - - - -/** - * cal_get_type: - * @void: - * - * Registers the #Cal class if necessary, and returns the type ID associated to - * it. - * - * Return value: The type ID of the #Cal class. - **/ -GtkType -cal_get_type (void) -{ - static GtkType cal_type = 0; - - if (!cal_type) { - static const GtkTypeInfo cal_info = { - "Cal", - sizeof (Cal), - sizeof (CalClass), - (GtkClassInitFunc) cal_class_init, - (GtkObjectInitFunc) cal_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - cal_type = gtk_type_unique (BONOBO_OBJECT_TYPE, &cal_info); - } - - return cal_type; -} - -/* CORBA class initialzation function for the calendar */ -static void -init_cal_corba_class (void) -{ - cal_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - cal_vepv.Evolution_Calendar_Cal_epv = cal_get_epv (); -} - -/* Class initialization function for the calendar */ -static void -cal_class_init (CalClass *class) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) class; - - parent_class = gtk_type_class (BONOBO_OBJECT_TYPE); - - object_class->destroy = cal_destroy; - - init_cal_corba_class (); -} - -/* Object initialization function for the calendar */ -static void -cal_init (Cal *cal) -{ - CalPrivate *priv; - - priv = g_new0 (CalPrivate, 1); - cal->priv = priv; - - priv->listener = CORBA_OBJECT_NIL; -} - -/* Destroy handler for the calendar */ -static void -cal_destroy (GtkObject *object) -{ - Cal *cal; - CalPrivate *priv; - CORBA_Environment ev; - - g_return_if_fail (object != NULL); - g_return_if_fail (IS_CAL (object)); - - cal = CAL (object); - priv = cal->priv; - - CORBA_exception_init (&ev); - CORBA_Object_release (priv->listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("cal_destroy(): could not release the listener"); - - CORBA_exception_free (&ev); - - g_free (priv); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - - - -/* CORBA servant implementation */ - -/* Cal::get_uri method */ -static CORBA_char * -Cal_get_uri (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - GnomeVFSURI *uri; - char *str_uri; - CORBA_char *str_uri_copy; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - uri = cal_backend_get_uri (priv->backend); - str_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE); - str_uri_copy = CORBA_string_dup (str_uri); - g_free (str_uri); - - return str_uri_copy; - -} - -/* Cal::get_object method */ -static Evolution_Calendar_CalObj -Cal_get_object (PortableServer_Servant servant, - const Evolution_Calendar_CalObjUID uid, - CORBA_Environment *ev) -{ - Cal *cal; - CalPrivate *priv; - char *calobj; - - cal = CAL (bonobo_object_from_servant (servant)); - priv = cal->priv; - - calobj = cal_backend_get_object (priv->backend, uid); - - if (calobj) { - CORBA_char *calobj_copy; - - calobj_copy = CORBA_string_dup (calobj); - g_free (calobj); - return calobj_copy; - } else { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Evolution_Calendar_Cal_NotFound, - NULL); - return NULL; - } -} - -/** - * cal_get_epv: - * @void: - * - * Creates an EPV for the Cal CORBA class. - * - * Return value: A newly-allocated EPV. - **/ -POA_Evolution_Calendar_Cal__epv * -cal_get_epv (void) -{ - POA_Evolution_Calendar_Cal__epv *epv; - - epv = g_new0 (POA_Evolution_Calendar_Cal__epv, 1); - epv->_get_uri = Cal_get_uri; - epv->get_object = Cal_get_object; - - return epv; -} - - - -/** - * cal_construct: - * @cal: A calendar client interface. - * @corba_cal: CORBA object for the calendar. - * @backend: Calendar backend that this @cal presents an interface to. - * @listener: Calendar listener for notification. - * - * Constructs a calendar client interface object by binding the corresponding - * CORBA object to it. The calendar interface is bound to the specified - * @backend, and will notify the @listener about changes to the calendar. - * - * Return value: The same object as the @cal argument. - **/ -Cal * -cal_construct (Cal *cal, - Evolution_Calendar_Cal corba_cal, - CalBackend *backend, - Evolution_Calendar_Listener listener) -{ - CalPrivate *priv; - CORBA_Environment ev; - - g_return_val_if_fail (cal != NULL, NULL); - g_return_val_if_fail (IS_CAL (cal), NULL); - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - priv = cal->priv; - - CORBA_exception_init (&ev); - priv->listener = CORBA_Object_duplicate (listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_construct: could not duplicate the listener"); - priv->listener = CORBA_OBJECT_NIL; - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - priv->backend = backend; - - bonobo_object_construct (BONOBO_OBJECT (cal), corba_cal); - return cal; -} - -/** - * cal_corba_object_create: - * @object: #BonoboObject that will wrap the CORBA object. - * - * Creates and activates the CORBA object that is wrapped by the specified - * calendar client interface @object. - * - * Return value: An activated object reference or #CORBA_OBJECT_NIL in case of - * failure. - **/ -Evolution_Calendar_Cal -cal_corba_object_create (BonoboObject *object) -{ - POA_Evolution_Calendar_Cal *servant; - CORBA_Environment ev; - - g_return_val_if_fail (object != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (IS_CAL (object), CORBA_OBJECT_NIL); - - servant = (POA_Evolution_Calendar_Cal *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &cal_vepv; - - CORBA_exception_init (&ev); - POA_Evolution_Calendar_Cal__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("cal_corba_object_create(): could not init the servant"); - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - return (Evolution_Calendar_Cal) bonobo_object_activate_servant (object, servant); -} - -/** - * cal_new: - * @backend: A calendar backend. - * @listener: A calendar listener. - * - * Creates a new calendar client interface object and binds it to the specified - * @backend and @listener objects. - * - * Return value: A newly-created #Cal calendar client interface object, or NULL - * if its corresponding CORBA object could not be created. - **/ -Cal * -cal_new (CalBackend *backend, Evolution_Calendar_Listener listener) -{ - Cal *cal, *retval; - Evolution_Calendar_Cal corba_cal; - CORBA_Environment ev; - gboolean ret; - - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); - - cal = CAL (gtk_type_new (CAL_TYPE)); - corba_cal = cal_corba_object_create (BONOBO_OBJECT (cal)); - - CORBA_exception_init (&ev); - ret = CORBA_Object_is_nil ((CORBA_Object) corba_cal, &ev); - if (ev._major != CORBA_NO_EXCEPTION || ret) { - g_message ("cal_new(): could not create the CORBA object"); - gtk_object_unref (GTK_OBJECT (cal)); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - retval = cal_construct (cal, corba_cal, backend, listener); - if (!retval) { - g_message ("cal_new(): could not construct the calendar client interface"); - gtk_object_unref (GTK_OBJECT (cal)); - return NULL; - } - - return retval; -} diff --git a/calendar/pcs/cal.h b/calendar/pcs/cal.h deleted file mode 100644 index b866470437..0000000000 --- a/calendar/pcs/cal.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Evolution calendar client interface object - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero <federico@helixcode.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef CAL_H -#define CAL_H - -#include <libgnome/gnome-defs.h> -#include <bonobo/bonobo-object.h> -#include "evolution-calendar.h" -#include "cal-common.h" - -BEGIN_GNOME_DECLS - - - -#define CAL_TYPE (cal_get_type ()) -#define CAL(obj) (GTK_CHECK_CAST ((obj), CAL_TYPE, Cal)) -#define CAL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_TYPE, CalClass)) -#define IS_CAL(obj) (GTK_CHECK_TYPE ((obj), CAL_TYPE)) -#define IS_CAL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_TYPE)) - -struct _Cal { - BonoboObject object; - - /* Private data */ - gpointer priv; -}; - -struct _CalClass { - BonoboObjectClass parent_class; -}; - -GtkType cal_get_type (void); - -Cal *cal_construct (Cal *cal, - Evolution_Calendar_Cal corba_cal, - CalBackend *backend, - Evolution_Calendar_Listener listener); -Evolution_Calendar_Cal cal_corba_object_create (BonoboObject *object); - -Cal *cal_new (CalBackend *backend, Evolution_Calendar_Listener listener); - -POA_Evolution_Calendar_Cal__epv *cal_get_epv (void); - - - -END_GNOME_DECLS - -#endif diff --git a/calendar/pcs/calobj.c b/calendar/pcs/calobj.c deleted file mode 100644 index f3004ddb13..0000000000 --- a/calendar/pcs/calobj.c +++ /dev/null @@ -1,1490 +0,0 @@ -/* - * Calendar objects implementations. - * Copyright (C) 1998 the Free Software Foundation - * - * Authors: - * Miguel de Icaza (miguel@gnu.org) - * Federico Mena (quartic@gimp.org) - */ -#include <config.h> -#include <string.h> -#include <glib.h> -#include <ctype.h> -#include <unistd.h> -#include "calobj.h" -#include "timeutil.h" -#include "../libversit/vcc.h" - -extern CalendarAlarm alarm_defaults[4]; - -static char * -ical_gen_uid (void) -{ - static char *hostname; - time_t t = time (NULL); - static int serial; - - if (!hostname){ - char buffer [128]; - - if ((gethostname (buffer, sizeof (buffer)-1) == 0) && - (buffer [0] != 0)) - hostname = g_strdup (buffer); - else - hostname = g_strdup ("localhost"); - } - - return g_strdup_printf ( - "%s-%d-%d-%d-%d@%s", - isodate_from_time_t (t), - getpid (), - getgid (), - getppid (), - serial++, - hostname); -} - -iCalObject * -ical_object_new (void) -{ - iCalObject *ico; - - ico = g_new0 (iCalObject, 1); - - ico->seq = -1; - ico->dtstamp = time (NULL); - ico->uid = ical_gen_uid (); - - ico->pilot_id = 0; - ico->pilot_status = ICAL_PILOT_SYNC_MOD; - - return ico; -} - -static void -default_alarm (iCalObject *ical, CalendarAlarm *alarm, char *def_mail, enum AlarmType type) -{ - alarm->type = type; - alarm->enabled = alarm_defaults[type].enabled; - alarm->count = alarm_defaults[type].count; - alarm->units = alarm_defaults[type].units; - if (alarm_defaults[type].data) - alarm->data = g_strdup (alarm_defaults[type].data); - else - alarm->data = g_strdup (""); -} - -iCalObject * -ical_new (char *comment, char *organizer, char *summary) -{ - iCalObject *ico; - - ico = ical_object_new (); - - ico->comment = g_strdup (comment); - ico->organizer = g_strdup (organizer); - ico->summary = g_strdup (summary); - ico->class = g_strdup ("PUBLIC"); - ico->status = g_strdup ("NEEDS ACTION"); - - default_alarm (ico, &ico->dalarm, organizer, ALARM_DISPLAY); - default_alarm (ico, &ico->palarm, organizer, ALARM_PROGRAM); - default_alarm (ico, &ico->malarm, organizer, ALARM_MAIL); - default_alarm (ico, &ico->aalarm, organizer, ALARM_AUDIO); - - return ico; -} - -static void -my_free (gpointer data, gpointer user_dat_ignored) -{ - g_free (data); -} - -static void -list_free (GList *list) -{ - g_list_foreach (list, my_free, 0); - g_list_free (list); -} - -#define free_if_defined(x) if (x){ g_free (x); x = 0; } -#define lfree_if_defined(x) if (x){ list_free (x); x = 0; } -void -ical_object_destroy (iCalObject *ico) -{ - /* Regular strings */ - free_if_defined (ico->comment); - free_if_defined (ico->organizer); - free_if_defined (ico->summary); - free_if_defined (ico->uid); - free_if_defined (ico->status); - free_if_defined (ico->class); - free_if_defined (ico->url); - free_if_defined (ico->recur); - - /* Lists */ - lfree_if_defined (ico->exdate); - lfree_if_defined (ico->categories); - lfree_if_defined (ico->resources); - lfree_if_defined (ico->related); - lfree_if_defined (ico->attach); - - /* Alarms */ - g_free (ico->dalarm.data); - g_free (ico->palarm.data); - g_free (ico->malarm.data); - g_free (ico->aalarm.data); - - g_free (ico); -} - -static GList * -set_list (char *str) -{ - GList *list = 0; - char *s; - - for (s = strtok (str, ";"); s; s = strtok (NULL, ";")) - list = g_list_prepend (list, g_strdup (s)); - - return list; -} - -static GList * -set_date_list (char *str) -{ - GList *list = 0; - char *s; - - for (s = strtok (str, ";,"); s; s = strtok (NULL, ";,")){ - time_t *t = g_new (time_t, 1); - - while (*s && isspace (*s)) - s++; - *t = time_from_isodate (s); - list = g_list_prepend (list, t); - } - return list; -} - -void -ical_object_add_exdate (iCalObject *o, time_t t) -{ - time_t *pt = g_new (time_t, 1); - - *pt = t; - o->exdate = g_list_prepend (o->exdate, pt); -} - -static void -ignore_space(char **str) -{ - while (**str && isspace (**str)) - (*str)++; -} - -static void -skip_numbers (char **str) -{ - while (**str){ - ignore_space (str); - if (!isdigit (**str)) - return; - while (**str && isdigit (**str)) - (*str)++; - } -} - -static void -weekdaylist (iCalObject *o, char **str) -{ - int i; - struct { - char first_letter, second_letter; - int index; - } days [] = { - { 'S', 'U', 0 }, - { 'M', 'O', 1 }, - { 'T', 'U', 2 }, - { 'W', 'E', 3 }, - { 'T', 'H', 4 }, - { 'F', 'R', 5 }, - { 'S', 'A', 6 } - }; - - ignore_space (str); - do { - for (i = 0; i < 7; i++){ - if (**str == days [i].first_letter && *(*str+1) == days [i].second_letter){ - o->recur->weekday |= 1 << i; - *str += 2; - if (**str == ' ') - (*str)++; - } - } - } while (isalpha (**str)); - - if (o->recur->weekday == 0){ - struct tm tm = *localtime (&o->dtstart); - - o->recur->weekday = 1 << tm.tm_wday; - } -} - -static void -weekdaynum (iCalObject *o, char **str) -{ - int i; - struct { - char first_letter, second_letter; - int index; - } days [] = { - { 'S', 'U', 0 }, - { 'M', 'O', 1 }, - { 'T', 'U', 2 }, - { 'W', 'E', 3 }, - { 'T', 'H', 4 }, - { 'F', 'R', 5 }, - { 'S', 'A', 6 } - }; - - ignore_space (str); - do { - for (i = 0; i < 7; i++){ - if (**str == days [i].first_letter && *(*str+1) == days [i].second_letter){ - o->recur->weekday = i; - *str += 2; - if (**str == ' ') - (*str)++; - } - } - } while (isalpha (**str)); -} - -static void -ocurrencelist (iCalObject *o, char **str) -{ - char *p; - - ignore_space (str); - p = *str; - if (!isdigit (*p)) - return; - - if (!(*p >= '1' && *p <= '5')) - return; - - if (!(*(p+1) == '+' || *(p+1) == '-')) - return; - - o->recur->u.month_pos = (*p-'0') * (*(p+1) == '+' ? 1 : -1); - *str += 2; -} - -static void -daynumber (iCalObject *o, char **str) -{ - int val = 0; - char *p = *str; - - ignore_space (str); - if (strcmp (p, "LD")){ - o->recur->u.month_day = DAY_LASTDAY; - *str += 2; - return; - } - - if (!(isdigit (*p))) - return; - - while (**str && isdigit (**str)){ - val = val * 10 + (**str - '0'); - (*str)++; - } - - if (**str == '+') - (*str)++; - - if (**str == '-') - val *= -1; - o->recur->u.month_day = val; -} - -static void -daynumberlist (iCalObject *o, char **str) -{ - int first = 0; - int val = 0; - - ignore_space (str); - - while (**str){ - if (!isdigit (**str)) - return; - while (**str && isdigit (**str)){ - val = 10 * val + (**str - '0'); - (*str)++; - } - if (!first){ - /* - * Some broken applications set this to zero - */ - if (val == 0){ - struct tm day = *localtime (&o->dtstart); - - val = day.tm_mday; - } - o->recur->u.month_day = val; - first = 1; - val = 0; - } - } -} - -static void -load_recur_weekly (iCalObject *o, char **str) -{ - weekdaylist (o, str); -} - -static void -load_recur_monthly_pos (iCalObject *o, char **str) -{ - ocurrencelist (o, str); - weekdaynum (o, str); -} - -static void -load_recur_monthly_day (iCalObject *o, char **str) -{ - daynumberlist (o, str); -} - -static void -load_recur_yearly_month (iCalObject *o, char **str) -{ - /* Skip as we do not support multiple months and we do expect - * the dtstart to agree with the value on this field - */ - skip_numbers (str); -} - -static void -load_recur_yearly_day (iCalObject *o, char **str) -{ - /* Skip as we do not support multiple days and we do expect - * the dtstart to agree with the value on this field - * - * FIXME: we should support every-n-years - */ - skip_numbers (str); -} - -static void -duration (iCalObject *o, char **str) -{ - unsigned int duration = 0; - - ignore_space (str); - if (**str != '#') - return; - (*str)++; - while (**str && isdigit (**str)){ - duration = duration * 10 + (**str - '0'); - (*str)++; - } - o->recur->duration = duration; -} - -static void -enddate (iCalObject *o, char **str) -{ - ignore_space (str); - if (isdigit (**str)){ - o->recur->_enddate = time_from_isodate (*str); - *str += 16; - } -} - -static int -load_recurrence (iCalObject *o, char *str) -{ - enum RecurType type; - int interval = 0; - - type = -1; - switch (*str++){ - case 'D': - type = RECUR_DAILY; - break; - - case 'W': - type = RECUR_WEEKLY; - break; - - case 'M': - if (*str == 'P') - type = RECUR_MONTHLY_BY_POS; - else if (*str == 'D') - type = RECUR_MONTHLY_BY_DAY; - str++; - break; - - case 'Y': - if (*str == 'M') - type = RECUR_YEARLY_BY_MONTH; - else if (*str == 'D') - type = RECUR_YEARLY_BY_DAY; - str++; - break; - } - if (type == -1) - return 0; - - o->recur = g_new0 (Recurrence, 1); - o->recur->type = type; - ignore_space (&str); - - /* Get the interval */ - for (;*str && isdigit (*str);str++) - interval = interval * 10 + (*str-'0'); - - if (interval == 0) - interval = 1; - - o->recur->interval = interval; - - /* this is the default per the spec */ - o->recur->duration = 2; - - ignore_space (&str); - - switch (type){ - case RECUR_DAILY: - break; - case RECUR_WEEKLY: - load_recur_weekly (o, &str); - break; - case RECUR_MONTHLY_BY_POS: - load_recur_monthly_pos (o, &str); - break; - case RECUR_MONTHLY_BY_DAY: - load_recur_monthly_day (o, &str); - break; - case RECUR_YEARLY_BY_MONTH: - load_recur_yearly_month (o, &str); - break; - case RECUR_YEARLY_BY_DAY: - load_recur_yearly_day (o, &str); - break; - default: - g_warning ("Unimplemented recurrence type %d", (int) type); - break; - } - duration (o, &str); - enddate (o, &str); - - /* Compute the enddate */ - if (o->recur->_enddate == 0){ - if (o->recur->duration != 0){ - ical_object_compute_end (o); - } else - o->recur->enddate = 0; - } else { - o->recur->enddate = o->recur->_enddate; - } - return 1; -} - -#define is_a_prop_of(obj,prop) isAPropertyOf (obj,prop) -#define str_val(obj) the_str = fakeCString (vObjectUStringZValue (obj)) -#define has(obj,prop) (vo = isAPropertyOf (obj, prop)) - -/* - * FIXME: This is loosing precission. Enhanec the thresholds - */ -#define HOURS(n) (n*(60*60)) - -static void -setup_alarm_at (iCalObject *ico, CalendarAlarm *alarm, char *iso_time, VObject *vo) -{ - time_t alarm_time = time_from_isodate (iso_time); - time_t base = ico->dtstart; - int d = difftime (base, alarm_time); - VObject *a; - char *the_str; - - alarm->enabled = 1; - if (d > HOURS (2)){ - if (d > HOURS (48)){ - alarm->count = d / HOURS (24); - alarm->units = ALARM_DAYS; - } else { - alarm->count = d / (60*60); - alarm->units = ALARM_HOURS; - } - } else { - alarm->count = d / 60; - alarm->units = ALARM_MINUTES; - } - - if ((a = is_a_prop_of (vo, VCSnoozeTimeProp))){ - alarm->snooze_secs = isodiff_to_secs (str_val (a)); - free (the_str); - } - - if ((a = is_a_prop_of (vo, VCRepeatCountProp))){ - alarm->snooze_repeat = atoi (str_val (a)); - free (the_str); - } -} - -/* - * Duplicates an iCalObject. Implementation is a grand hack - */ -iCalObject * -ical_object_duplicate (iCalObject *o) -{ - VObject *vo; - iCalObject *new; - - vo = ical_object_to_vobject (o); - switch (o->type){ - case ICAL_EVENT: - new = ical_object_create_from_vobject (vo, VCEventProp); - break; - case ICAL_TODO: - new = ical_object_create_from_vobject (vo, VCTodoProp); - break; - default: - new = NULL; - } - - cleanVObject (vo); - return new; -} - -/* FIXME: we need to load the recurrence properties */ -iCalObject * -ical_object_create_from_vobject (VObject *o, const char *object_name) -{ - time_t now = time (NULL); - iCalObject *ical; - VObject *vo, *a; - VObjectIterator i; - char *the_str; - - ical = g_new0 (iCalObject, 1); - - if (strcmp (object_name, VCEventProp) == 0) - ical->type = ICAL_EVENT; - else if (strcmp (object_name, VCTodoProp) == 0) - ical->type = ICAL_TODO; - else { - g_free (ical); - return 0; - } - - /* uid */ - if (has (o, VCUniqueStringProp)){ - ical->uid = g_strdup (str_val (vo)); - free (the_str); - } else { - ical->uid = ical_gen_uid (); - } - - /* seq */ - if (has (o, VCSequenceProp)){ - ical->seq = atoi (str_val (vo)); - free (the_str); - } else - ical->seq = 0; - - /* dtstart */ - if (has (o, VCDTstartProp)){ - ical->dtstart = time_from_isodate (str_val (vo)); - free (the_str); - } else - ical->dtstart = 0; - - /* dtend */ - ical->dtend = 0; /* default value */ - if (ical->type == ICAL_EVENT){ - if (has (o, VCDTendProp)){ - ical->dtend = time_from_isodate (str_val (vo)); - free (the_str); - } - } else if (ical->type == ICAL_TODO){ - if (has (o, VCDueProp)){ - ical->dtend = time_from_isodate (str_val (vo)); - free (the_str); - } - } - - /* dcreated */ - if (has (o, VCDCreatedProp)){ - ical->created = time_from_isodate (str_val (vo)); - free (the_str); - } - - /* completed */ - if (has (o, VCCompletedProp)){ - ical->completed = time_from_isodate (str_val (vo)); - free (the_str); - } - - /* last_mod */ - if (has (o, VCLastModifiedProp)){ - ical->last_mod = time_from_isodate (str_val (vo)); - free (the_str); - } else - ical->last_mod = now; - - /* exdate */ - if (has (o, VCExpDateProp)){ - ical->exdate = set_date_list (str_val (vo)); - free (the_str); - } - - /* description/comment */ - if (has (o, VCDescriptionProp)){ - ical->comment = g_strdup (str_val (vo)); - free (the_str); - } - - /* summary */ - if (has (o, VCSummaryProp)){ - ical->summary = g_strdup (str_val (vo)); - free (the_str); - } else - ical->summary = g_strdup (""); - - /* status */ - if (has (o, VCStatusProp)){ - ical->status = g_strdup (str_val (vo)); - free (the_str); - } else - ical->status = g_strdup ("NEEDS ACTION"); - - if (has (o, VCClassProp)){ - ical->class = g_strdup (str_val (vo)); - free (the_str); - } else - ical->class = "PUBLIC"; - - /* categories */ - if (has (o, VCCategoriesProp)){ - ical->categories = set_list (str_val (vo)); - free (the_str); - } - - /* resources */ - if (has (o, VCResourcesProp)){ - ical->resources = set_list (str_val (vo)); - free (the_str); - } - - /* priority */ - if (has (o, VCPriorityProp)){ - ical->priority = atoi (str_val (vo)); - free (the_str); - } - - /* tranparency */ - if (has (o, VCTranspProp)){ - ical->transp = atoi (str_val (vo)) ? ICAL_TRANSPARENT : ICAL_OPAQUE; - free (the_str); - } - - /* Organizer */ - if (has (o, VCOrgNameProp)){ - ical->organizer = g_strdup (str_val (vo)); - free (the_str); - } - - /* related */ - if (has (o, VCRelatedToProp)){ - ical->related = set_list (str_val (vo)); - free (the_str); - } - - /* attach */ - initPropIterator (&i, o); - while (moreIteration (&i)){ - vo = nextVObject (&i); - if (strcmp (vObjectName (vo), VCAttachProp) == 0){ - ical->attach = g_list_prepend (ical->attach, g_strdup (str_val (vo))); - free (the_str); - } - } - - /* url */ - if (has (o, VCURLProp)){ - ical->url = g_strdup (str_val (vo)); - free (the_str); - } - - /* dalarm */ - ical->dalarm.type = ALARM_DISPLAY; - ical->dalarm.enabled = 0; - if (has (o, VCDAlarmProp)){ - if ((a = is_a_prop_of (vo, VCRunTimeProp))){ - setup_alarm_at (ical, &ical->dalarm, str_val (a), vo); - free (the_str); - } - } - - /* aalarm */ - ical->aalarm.type = ALARM_AUDIO; - ical->aalarm.enabled = 0; - if (has (o, VCAAlarmProp)){ - if ((a = is_a_prop_of (vo, VCRunTimeProp))){ - setup_alarm_at (ical, &ical->aalarm, str_val (a), vo); - free (the_str); - } - } - - /* palarm */ - ical->palarm.type = ALARM_PROGRAM; - ical->palarm.enabled = 0; - if (has (o, VCPAlarmProp)){ - ical->palarm.type = ALARM_PROGRAM; - if ((a = is_a_prop_of (vo, VCRunTimeProp))){ - setup_alarm_at (ical, &ical->palarm, str_val (a), vo); - free (the_str); - - if ((a = is_a_prop_of (vo, VCProcedureNameProp))){ - ical->palarm.data = g_strdup (str_val (a)); - free (the_str); - } else - ical->palarm.data = g_strdup (""); - } - } - - /* malarm */ - ical->malarm.type = ALARM_MAIL; - ical->malarm.enabled = 0; - if (has (o, VCMAlarmProp)){ - ical->malarm.type = ALARM_MAIL; - if ((a = is_a_prop_of (vo, VCRunTimeProp))){ - setup_alarm_at (ical, &ical->malarm, str_val (a), vo); - free (the_str); - - if ((a = is_a_prop_of (vo, VCEmailAddressProp))){ - ical->malarm.data = g_strdup (str_val (a)); - free (the_str); - } else - ical->malarm.data = g_strdup (""); - } - } - - /* rrule */ - if (has (o, VCRRuleProp)){ - if (!load_recurrence (ical, str_val (vo))) { - ical_object_destroy (ical); - return NULL; - } - free (the_str); - } - - /* - * Pilot - */ - if (has (o, XPilotIdProp)){ - ical->pilot_id = atoi (str_val (vo)); - free (the_str); - } else - ical->pilot_id = 0; - - if (has (o, XPilotStatusProp)){ - ical->pilot_status = atoi (str_val (vo)); - free (the_str); - } else - ical->pilot_status = ICAL_PILOT_SYNC_MOD; - - return ical; -} - -static char * -to_str (int num) -{ - static char buf [40]; - - sprintf (buf, "%d", num); - return buf; -} - -/* - * stores a GList in the property. - */ -static void -store_list (VObject *o, char *prop, GList *values) -{ - GList *l; - int len; - char *result, *p; - - for (len = 0, l = values; l; l = l->next) - len += strlen (l->data) + 1; - - result = g_malloc (len); - - for (p = result, l = values; l; l = l->next) { - int len = strlen (l->data); - - strcpy (p, l->data); - - if (l->next) { - p [len] = ';'; - p += len+1; - } else - p += len; - } - - *p = 0; - - addPropValue (o, prop, result); - g_free (result); -} - -static void -store_date_list (VObject *o, char *prop, GList *values) -{ - GList *l; - int size, len; - char *s, *p; - - size = g_list_length (values); - s = p = g_malloc ((size * 17 + 1) * sizeof (char)); - - for (l = values; l; l = l->next){ - strcpy (s, isodate_from_time_t (*(time_t *)l->data)); - len = strlen (s); - s [len] = ','; - s += len + 1; - } - s--; - *s = 0; - addPropValue (o, prop, p); - g_free (p); -} - -static char *recur_type_name [] = { "D", "W", "MP", "MD", "YM", "YD" }; -static char *recur_day_list [] = { "SU", "MO", "TU","WE", "TH", "FR", "SA" }; -static char *alarm_names [] = { VCMAlarmProp, VCPAlarmProp, VCDAlarmProp, VCAAlarmProp }; - -static VObject * -save_alarm (VObject *o, CalendarAlarm *alarm, iCalObject *ical) -{ - VObject *alarm_object; - struct tm tm; - time_t alarm_time; - - if (!alarm->enabled) - return NULL; - tm = *localtime (&ical->dtstart); - switch (alarm->units){ - case ALARM_MINUTES: - tm.tm_min -= alarm->count; - break; - - case ALARM_HOURS: - tm.tm_hour -= alarm->count; - break; - - case ALARM_DAYS: - tm.tm_mday -= alarm->count; - break; - } - - alarm_time = mktime (&tm); - alarm_object = addProp (o, alarm_names [alarm->type]); - addPropValue (alarm_object, VCRunTimeProp, isodate_from_time_t (alarm_time)); - - if (alarm->snooze_secs) - addPropValue (alarm_object, VCSnoozeTimeProp, isodiff_from_secs (alarm->snooze_secs)); - else - addPropValue (alarm_object, VCSnoozeTimeProp, ""); - - if (alarm->snooze_repeat){ - char buf [20]; - - sprintf (buf, "%d", alarm->snooze_repeat); - addPropValue (alarm_object, VCRepeatCountProp, buf); - } else - addPropValue (alarm_object, VCRepeatCountProp, ""); - return alarm_object; -} - -VObject * -ical_object_to_vobject (iCalObject *ical) -{ - VObject *o, *alarm, *s; - GList *l; - - if (ical->type == ICAL_EVENT) - o = newVObject (VCEventProp); - else - o = newVObject (VCTodoProp); - - /* uid */ - if (ical->uid) - addPropValue (o, VCUniqueStringProp, ical->uid); - - /* seq */ - addPropValue (o, VCSequenceProp, to_str (ical->seq)); - - /* dtstart */ - addPropValue (o, VCDTstartProp, isodate_from_time_t (ical->dtstart)); - - /* dtend */ - if (ical->type == ICAL_EVENT){ - addPropValue (o, VCDTendProp, isodate_from_time_t (ical->dtend)); - } else if (ical->type == ICAL_TODO){ - addPropValue (o, VCDueProp, isodate_from_time_t (ical->dtend)); - } - - /* dcreated */ - addPropValue (o, VCDCreatedProp, isodate_from_time_t (ical->created)); - - /* completed */ - if (ical->completed) - addPropValue (o, VCDTendProp, isodate_from_time_t (ical->completed)); - - /* last_mod */ - addPropValue (o, VCLastModifiedProp, isodate_from_time_t (ical->last_mod)); - - /* exdate */ - if (ical->exdate) - store_date_list (o, VCExpDateProp, ical->exdate); - - /* description/comment */ - if (ical->comment && strlen (ical->comment)){ - s = addPropValue (o, VCDescriptionProp, ical->comment); - if (strchr (ical->comment, '\n')) - addProp (s, VCQuotedPrintableProp); - } - - /* summary */ - if (strlen (ical->summary)){ - s = addPropValue (o, VCSummaryProp, ical->summary); - if (strchr (ical->summary, '\n')) - addProp (s, VCQuotedPrintableProp); - } else { - addPropValue (o, VCSummaryProp, _("Appointment")); - } - - /* status */ - addPropValue (o, VCStatusProp, ical->status); - - /* class */ - addPropValue (o, VCClassProp, ical->class); - - /* categories */ - if (ical->categories) - store_list (o, VCCategoriesProp, ical->categories); - - /* resources */ - if (ical->resources) - store_list (o, VCCategoriesProp, ical->resources); - - /* priority */ - addPropValue (o, VCPriorityProp, to_str (ical->priority)); - - /* transparency */ - addPropValue (o, VCTranspProp, to_str (ical->transp)); - - /* Owenr/organizer */ - if (ical->organizer) - addPropValue (o, VCOrgNameProp, ical->organizer); - - /* related */ - if (ical->related) - store_list (o, VCRelatedToProp, ical->related); - - /* attach */ - for (l = ical->attach; l; l = l->next) - addPropValue (o, VCAttachProp, l->data); - - /* url */ - if (ical->url) - addPropValue (o, VCURLProp, ical->url); - - if (ical->recur){ - char result [256]; - char buffer [80]; - int i; - - sprintf (result, "%s%d ", recur_type_name [ical->recur->type], ical->recur->interval); - switch (ical->recur->type){ - case RECUR_DAILY: - break; - - case RECUR_WEEKLY: - for (i = 0; i < 7; i++){ - if (ical->recur->weekday & (1 << i)){ - sprintf (buffer, "%s ", recur_day_list [i]); - strcat (result, buffer); - } - } - break; - - case RECUR_MONTHLY_BY_POS: { - int nega = ical->recur->u.month_pos < 0; - - sprintf (buffer, "%d%s ", nega ? -ical->recur->u.month_pos : ical->recur->u.month_pos, - nega ? "-" : "+"); - strcat (result, buffer); - /* the gui is set up for a single day, not a set here in this case */ - sprintf (buffer, "%s ", recur_day_list [ical->recur->weekday]); - strcat (result, buffer); - } - break; - - case RECUR_MONTHLY_BY_DAY: - sprintf (buffer, "%d ", ical->recur->u.month_pos); - strcat (result, buffer); - break; - - case RECUR_YEARLY_BY_MONTH: - break; - - case RECUR_YEARLY_BY_DAY: - break; - } - if (ical->recur->_enddate == 0) - sprintf (buffer, "#%d ",ical->recur->duration); - else - sprintf (buffer, "%s ", isodate_from_time_t (ical->recur->_enddate)); - strcat (result, buffer); - addPropValue (o, VCRRuleProp, result); - } - - save_alarm (o, &ical->aalarm, ical); - save_alarm (o, &ical->dalarm, ical); - - if ((alarm = save_alarm (o, &ical->palarm, ical))) - addPropValue (alarm, VCProcedureNameProp, ical->palarm.data); - if ((alarm = save_alarm (o, &ical->malarm, ical))) - addPropValue (alarm, VCEmailAddressProp, ical->malarm.data); - - /* Pilot */ - { - char buffer [20]; - - sprintf (buffer, "%d", ical->pilot_id); - addPropValue (o, XPilotIdProp, buffer); - sprintf (buffer, "%d", ical->pilot_status); - addPropValue (o, XPilotStatusProp, buffer); - } - - return o; -} - -void -ical_foreach (GList *events, calendarfn fn, void *closure) -{ - for (; events; events = events->next){ - iCalObject *ical = events->data; - - (*fn) (ical, ical->dtstart, ical->dtend, closure); - } -} - -static int -is_date_in_list (GList *list, struct tm *date) -{ - struct tm tm; - - for (; list; list = list->next){ - time_t *timep = list->data; - - tm = *localtime (timep); - if (date->tm_mday == tm.tm_mday && - date->tm_mon == tm.tm_mon && - date->tm_year == tm.tm_year){ - return 1; - } - } - return 0; -} - -static int -generate (iCalObject *ico, time_t reference, calendarfn cb, void *closure) -{ - struct tm dt_start, dt_end, ref; - time_t s_t, e_t; - - dt_start = *localtime (&ico->dtstart); - dt_end = *localtime (&ico->dtend); - ref = *localtime (&reference); - - dt_start.tm_mday = ref.tm_mday; - dt_start.tm_mon = ref.tm_mon; - dt_start.tm_year = ref.tm_year; - - dt_end.tm_mday = ref.tm_mday; - dt_end.tm_mon = ref.tm_mon; - dt_end.tm_year = ref.tm_year; - - - if (ref.tm_isdst > dt_start.tm_isdst){ - dt_start.tm_hour--; - dt_end.tm_hour--; - } else if (ref.tm_isdst < dt_start.tm_isdst){ - dt_start.tm_hour++; - dt_end.tm_hour++; - } - - s_t = mktime (&dt_start); - - if (ico->exdate && is_date_in_list (ico->exdate, &dt_start)) - return 1; - - e_t = mktime (&dt_end); - - if ((s_t == -1) || (e_t == -1)) { - g_warning ("Produced invalid dates!\n"); - return 0; - } - - return (*cb) (ico, s_t, e_t, closure); -} - -int -ical_object_get_first_weekday (int weekday_mask) -{ - int i; - - for (i = 0; i < 7; i++) - if (weekday_mask & (1 << i)) - return i; - - return -1; -} - -#define time_in_range(t, a, b) ((t >= a) && (b ? (t < b) : 1)) -#define recur_in_range(t, r) (r->enddate ? (t < r->enddate) : 1) - -/* - * Generate every possible event. Invokes the callback routine for - * every occurrence of the event in the [START, END] time interval. - * - * If END is zero, the event is generated forever. - * The callback routine is expected to return 0 when no further event - * generation is requested. - */ -void -ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure) -{ - time_t current; - int first_week_day; - - /* If there is no recurrence, just check ranges */ - - if (!ico->recur) { - if ((end && (ico->dtstart < end) && (ico->dtend > start)) - || ((end == 0) && (ico->dtend > start))) { - time_t ev_s, ev_e; - - /* Clip range */ - - ev_s = MAX (ico->dtstart, start); - ev_e = MIN (ico->dtend, end); - - (* cb) (ico, ev_s, ev_e, closure); - } - return; - } - - /* The event has a recurrence rule -- check that we will generate at least one instance */ - - if (end != 0) { - if (ico->dtstart > end) - return; - - if (!IS_INFINITE (ico->recur) && (ico->recur->enddate < start)) - return; - } - - /* Generate the instances */ - - current = ico->dtstart; - - switch (ico->recur->type) { - case RECUR_DAILY: - do { - if (time_in_range (current, start, end) && recur_in_range (current, ico->recur)) - if (!generate (ico, current, cb, closure)) - return; - - /* Advance */ - - current = time_add_day (current, ico->recur->interval); - - if (current == -1) { - g_warning ("RECUR_DAILY: time_add_day() returned invalid time"); - return; - } - } while ((current < end) || (end == 0)); - - break; - - case RECUR_WEEKLY: - do { - struct tm tm; - - tm = *localtime (¤t); - - if (time_in_range (current, start, end) && recur_in_range (current, ico->recur)) { - /* Weekdays to recur on are specified as a bitmask */ - if (ico->recur->weekday & (1 << tm.tm_wday)) { - if (!generate (ico, current, cb, closure)) - return; - } - } - - /* Advance by day for scanning the week or by interval at week end */ - - if (tm.tm_wday == 6) - current = time_add_day (current, (ico->recur->interval - 1) * 7 + 1); - else - current = time_add_day (current, 1); - - if (current == -1) { - g_warning ("RECUR_WEEKLY: time_add_day() returned invalid time\n"); - return; - } - } while (current < end || (end == 0)); - - break; - - case RECUR_MONTHLY_BY_POS: - /* FIXME: We only deal with positives now */ - if (ico->recur->u.month_pos < 0) { - g_warning ("RECUR_MONTHLY_BY_POS does not support negative positions yet"); - return; - } - - if (ico->recur->u.month_pos == 0) - return; - - first_week_day = /* ical_object_get_first_weekday (ico->recur->weekday); */ - ico->recur->weekday; /* the i/f only lets you choose a single day of the week! */ - - /* This should not happen, but take it into account */ - if (first_week_day == -1) { - g_warning ("ical_object_get_first_weekday() returned -1"); - return; - } - - do { - struct tm tm; - time_t t; - int week_day_start; - - tm = *localtime (¤t); - tm.tm_mday = 1; - t = mktime (&tm); - tm = *localtime (&t); - week_day_start = tm.tm_wday; - - tm.tm_mday = (7 * (ico->recur->u.month_pos - ((week_day_start <= first_week_day ) ? 1 : 0)) - - (week_day_start - first_week_day) + 1); - if( tm.tm_mday > 31 ) - { - tm.tm_mday = 1; - tm.tm_mon += ico->recur->interval; - current = mktime (&tm); - continue; - } - - switch( tm.tm_mon ) - { - case 3: - case 5: - case 8: - case 10: - if( tm.tm_mday > 30 ) - { - tm.tm_mday = 1; - tm.tm_mon += ico->recur->interval; - current = mktime (&tm); - continue; - } - break; - case 1: - if( ((tm.tm_year+1900)%4) == 0 - && ((tm.tm_year+1900)%400) != 100 - && ((tm.tm_year+1900)%400) != 200 - && ((tm.tm_year+1900)%400) != 300 ) - { - - if( tm.tm_mday > 29 ) - { - tm.tm_mday = 1; - tm.tm_mon += ico->recur->interval; - current = mktime (&tm); - continue; - } - } - else - { - if( tm.tm_mday > 28 ) - { - tm.tm_mday = 1; - tm.tm_mon += ico->recur->interval; - current = mktime (&tm); - continue; - } - } - break; - } - - t = mktime (&tm); - - if (time_in_range (t, start, end) && recur_in_range (current, ico->recur)) - if (!generate (ico, t, cb, closure)) - return; - - /* Advance by the appropriate number of months */ - - current = mktime (&tm); - - tm.tm_mday = 1; - tm.tm_mon += ico->recur->interval; - current = mktime (&tm); - - if (current == -1) { - g_warning ("RECUR_MONTHLY_BY_DAY: mktime error\n"); - return; - } - } while ((current < end) || (end == 0)); - - break; - - case RECUR_MONTHLY_BY_DAY: - do { - struct tm tm; - time_t t; - int p; - - tm = *localtime (¤t); - - p = tm.tm_mday; - tm.tm_mday = ico->recur->u.month_day; - t = mktime (&tm); - if (time_in_range (t, start, end) && recur_in_range (current, ico->recur)) - if (!generate (ico, t, cb, closure)) - return; - - /* Advance by the appropriate number of months */ - - tm.tm_mday = p; - tm.tm_mon += ico->recur->interval; - current = mktime (&tm); - - if (current == -1) { - g_warning ("RECUR_MONTHLY_BY_DAY: mktime error\n"); - return; - } - } while (current < end || (end == 0)); - - break; - - case RECUR_YEARLY_BY_MONTH: - case RECUR_YEARLY_BY_DAY: - do { - if (time_in_range (current, start, end) && recur_in_range (current, ico->recur)) - if (!generate (ico, current, cb, closure)) - return; - - /* Advance */ - - current = time_add_year (current, ico->recur->interval); - } while (current < end || (end == 0)); - - break; - - default: - g_assert_not_reached (); - } -} - -static int -duration_callback (iCalObject *ico, time_t start, time_t end, void *closure) -{ - int *count = closure; - struct tm tm; - - tm = *localtime (&start); - - (*count)++; - if (ico->recur->duration == *count) { - ico->recur->enddate = time_day_end (end); - return 0; - } - return 1; -} - -/* Computes ico->recur->enddate from ico->recur->duration */ -void -ical_object_compute_end (iCalObject *ico) -{ - int count = 0; - - g_return_if_fail (ico->recur != NULL); - - ico->recur->_enddate = 0; - ico->recur->enddate = 0; - ical_object_generate_events (ico, ico->dtstart, 0, duration_callback, &count); -} - -int -alarm_compute_offset (CalendarAlarm *a) -{ - if (!a->enabled) - return -1; - switch (a->units){ - case ALARM_MINUTES: - a->offset = a->count * 60; - break; - case ALARM_HOURS: - a->offset = a->count * 3600; - break; - case ALARM_DAYS: - a->offset = a->count * 24 * 3600; - } - return a->offset; -} - -iCalObject * -ical_object_new_from_string (const char *vcal_string) -{ - iCalObject *ical = NULL; - VObject *cal, *event; - VObjectIterator i; - const char *object_name; - - cal = Parse_MIME (vcal_string, strlen (vcal_string)); - - initPropIterator (&i, cal); - - while (moreIteration (&i)){ - event = nextVObject (&i); - - object_name = vObjectName (event); - - if (strcmp (object_name, VCEventProp) == 0){ - ical = ical_object_create_from_vobject (event, object_name); - break; - } - } - - cleanVObject (cal); - cleanStrTbl (); - - return ical; -} - diff --git a/calendar/pcs/calobj.h b/calendar/pcs/calobj.h deleted file mode 100644 index fbc92a41c5..0000000000 --- a/calendar/pcs/calobj.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Internal representation of a Calendar object. This is modeled after the - * iCalendar/vCalendar specificiation - * - * Authors: Miguel de Icaza (miguel@gnu.org) - * Federico Mena (quartic@gimp.org). - */ -#ifndef CALOBJ_H -#define CALOBJ_H - -#include <libgnome/libgnome.h> -#include "../libversit/vcc.h" - -BEGIN_GNOME_DECLS - -enum AlarmType { - ALARM_MAIL, - ALARM_PROGRAM, - ALARM_DISPLAY, - ALARM_AUDIO -}; - -enum AlarmUnit { - ALARM_MINUTES, - ALARM_HOURS, - ALARM_DAYS -}; - -typedef struct { - enum AlarmType type; - int enabled; - int count; - enum AlarmUnit units; - char *data; - - /* Does not get saved, internally used */ - time_t offset; - time_t trigger; - - int snooze_secs; - int snooze_repeat; - - /* Widgets */ - void *w_count; /* A GtkEntry */ - void *w_enabled; /* A GtkChecButton */ - void *w_timesel; /* A GtkMenu */ - void *w_entry; /* A GnomeEntryFile/GtkEntry for PROGRAM/MAIL */ - void *w_label; -} CalendarAlarm; - -/* Calendar object type */ -typedef enum { - ICAL_EVENT, - ICAL_TODO, - ICAL_JOURNAL, - ICAL_FBREQUEST, - ICAL_FBREPLY, - ICAL_BUSYTIME, - ICAL_TIMEZONE -} iCalType; - -/* For keys that might contain binary or text/binary */ -typedef struct { - char *data; - int len; -} iCalValue; - -typedef enum { - ICAL_PILOT_SYNC_NONE = 0, - ICAL_PILOT_SYNC_MOD = 1, - ICAL_PILOT_SYNC_DEL = 3 -} iCalPilotState; - -typedef struct { - int valid; /* true if the Geography was specified */ - double latitude; - double longitude; -} iCalGeo; - -typedef enum { - ICAL_OPAQUE, - ICAL_TRANSPARENT -} iCalTransp; - -typedef char NotYet; - -enum RecurType { - RECUR_DAILY, - RECUR_WEEKLY, - RECUR_MONTHLY_BY_POS, - RECUR_MONTHLY_BY_DAY, - RECUR_YEARLY_BY_MONTH, - RECUR_YEARLY_BY_DAY, -}; - -#define DAY_LASTDAY 10000 - -typedef struct { - enum RecurType type; - - int interval; - - /* Used for recur computation */ - time_t enddate; /* If the value is zero, it is an infinite event - * otherwise, it is either the _enddate value (if - * this is what got specified) or it is our computed - * ending date (computed from the duration item). - */ - - int weekday; - - union { - int month_pos; - int month_day; - } u; - - int duration; - time_t _enddate; /* As found on the vCalendar file */ - int __count; -} Recurrence; - -#define IS_INFINITE(r) (r->duration == 0) - -/* Flags to indicate what has changed in an object */ -typedef enum { - CHANGE_NEW = 1 << 0, /* new object */ - CHANGE_SUMMARY = 1 << 1, /* summary */ - CHANGE_DATES = 1 << 2, /* dtstart / dtend */ - CHANGE_ALL = CHANGE_SUMMARY | CHANGE_DATES -} CalObjectChange; - -/* - * This describes an iCalendar object, note that we never store durations, instead we - * always compute the end time computed from the start + duration. - */ -typedef struct { - iCalType type; - - GList *attach; /* type: one or more URIs or binary data */ - GList *attendee; /* type: CAL-ADDRESS */ - GList *categories; /* type: one or more TEXT */ - char *class; - - char *comment; /* we collapse one or more TEXTs into one */ - time_t completed; - time_t created; - GList *contact; /* type: one or more TEXT */ - time_t dtstamp; - time_t dtstart; - time_t dtend; - GList *exdate; /* type: one or more time_t's */ - GList *exrule; /* type: one or more RECUR */ - iCalGeo geo; - time_t last_mod; - char *location; - char *organizer; - int percent; - int priority; - char *rstatus; /* request status for freebusy */ - GList *related; /* type: one or more TEXT */ - GList *resources; /* type: one or more TEXT */ - GList *rdate; /* type: one or more recurrence date */ - GList *rrule; /* type: one or more recurrence rules */ - int seq; - char *status; - char *summary; - iCalTransp transp; - char *uid; - char *url; - time_t recurid; - - CalendarAlarm dalarm; - CalendarAlarm aalarm; - CalendarAlarm palarm; - CalendarAlarm malarm; - - Recurrence *recur; - - int new; - void *user_data; /* Generic data pointer */ - - /* Pilot */ - iCalPilotState pilot_status; /* Status information */ - guint32 pilot_id; /* Pilot ID */ -} iCalObject; - -/* The callback for the recurrence generator */ -typedef int (*calendarfn) (iCalObject *, time_t, time_t, void *); - -iCalObject *ical_new (char *comment, char *organizer, char *summary); -iCalObject *ical_object_new (void); -iCalObject *ical_object_new_from_string (const char *vcalendar_string); -void ical_object_destroy (iCalObject *ico); -iCalObject *ical_object_create_from_vobject (VObject *obj, const char *object_name); -VObject *ical_object_to_vobject (iCalObject *ical); -iCalObject *ical_object_duplicate (iCalObject *o); -void ical_foreach (GList *events, calendarfn fn, void *closure); -void ical_object_generate_events (iCalObject *ico, time_t start, time_t end, calendarfn cb, void *closure); -void ical_object_add_exdate (iCalObject *o, time_t t); - -/* Computes the enddate field of the recurrence based on the duration */ -void ical_object_compute_end (iCalObject *ico); - -/* Returns the first toggled day in a weekday mask -- we do this because we do not support multiple - * days on a monthly-by-pos recurrence. If no days are toggled, it returns -1. - */ -int ical_object_get_first_weekday (int weekday_mask); - -/* Returns the number of seconds configured to trigger the alarm in advance to an event */ -int alarm_compute_offset (CalendarAlarm *a); - -END_GNOME_DECLS - -#endif - diff --git a/calendar/pcs/job.c b/calendar/pcs/job.c deleted file mode 100644 index d97df6d883..0000000000 --- a/calendar/pcs/job.c +++ /dev/null @@ -1,98 +0,0 @@ -/* GNOME personal calendar server - job manager - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero <federico@helixcode.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include "job.h" - - - -/* The job list */ - -typedef struct { - JobFunc func; - gpointer data; -} Job; - -static GSList *jobs_head; -static GSList *jobs_tail; - -static guint jobs_idle_id; - - - -/* Runs a job and dequeues it */ -static gboolean -run_job (gpointer data) -{ - Job *job; - GSList *l; - - g_assert (jobs_head != NULL); - - job = jobs_head->data; - (* job->func) (job->data); - g_free (job); - - l = jobs_head; - jobs_head = g_slist_remove_link (jobs_head, jobs_head); - g_slist_free_1 (l); - - if (!jobs_head) { - jobs_tail = NULL; - jobs_idle_id = 0; - return FALSE; - } else - return TRUE; -} - -/** - * job_add: - * @func: Function to run the job. - * @data: Data to pass to @function. - * - * Adds a job to the queue. The job will automatically be run asynchronously. - **/ -void -job_add (JobFunc func, gpointer data) -{ - Job *job; - - g_return_if_fail (func != NULL); - - job = g_new (Job, 1); - job->func = func; - job->data = data; - - if (!jobs_head) { - g_assert (jobs_tail == NULL); - g_assert (jobs_idle_id == 0); - - jobs_head = g_slist_append (NULL, job); - jobs_tail = jobs_head; - - jobs_idle_id = g_idle_add (run_job, NULL); - } else { - g_assert (jobs_tail != NULL); - g_assert (jobs_idle_id != 0); - - jobs_tail = g_slist_append (jobs_tail, job)->next; - } -} diff --git a/calendar/pcs/job.h b/calendar/pcs/job.h deleted file mode 100644 index c9bce24dd4..0000000000 --- a/calendar/pcs/job.h +++ /dev/null @@ -1,35 +0,0 @@ -/* GNOME personal calendar server - job manager - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero <federico@helixcode.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef JOB_H -#define JOB_H - -#include <glib.h> - - - -typedef void (* JobFunc) (gpointer data); - -void job_add (JobFunc func, gpointer data); - - - -#endif diff --git a/calendar/pcs/tlacuache.c b/calendar/pcs/tlacuache.c deleted file mode 100644 index b11b5030d8..0000000000 --- a/calendar/pcs/tlacuache.c +++ /dev/null @@ -1,126 +0,0 @@ -/* Tlacuache - personal calendar server main module - * - * Copyright (C) 2000 Helix Code, Inc. - * - * Author: Federico Mena-Quintero <federico@helixcode.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#include <config.h> -#include <libgnorba/gnorba.h> -#include <bonobo.h> -#include <libgnomevfs/gnome-vfs.h> -#include "cal-factory.h" -#include "calobj.h" - - - -/* The calendar factory */ -static CalFactory *factory; - - - -/* Stuff that the un-converted alarm code needs to build */ - -int debug_alarms = FALSE; - -void calendar_notify (time_t time, CalendarAlarm *which, void *data); - -CalendarAlarm alarm_defaults[4] = { - { ALARM_MAIL, 0, 15, ALARM_MINUTES }, - { ALARM_PROGRAM, 0, 15, ALARM_MINUTES }, - { ALARM_DISPLAY, 0, 15, ALARM_MINUTES }, - { ALARM_AUDIO, 0, 15, ALARM_MINUTES } -}; - -void -calendar_notify (time_t time, CalendarAlarm *which, void *data) -{ - g_error ("calendar_notify() called!"); -} - - - -/* Creates and registers the calendar factory */ -static gboolean -create_cal_factory (void) -{ - CORBA_Object object; - CORBA_Environment ev; - int result; - - factory = cal_factory_new (); - if (!factory) { - g_message ("create_cal_factory(): could not create the calendar factory!"); - return FALSE; - } - - object = bonobo_object_corba_objref (BONOBO_OBJECT (factory)); - - CORBA_exception_init (&ev); - result = goad_server_register (CORBA_OBJECT_NIL, - object, - "calendar:cal-factory", - "object", - &ev); - - if (ev._major != CORBA_NO_EXCEPTION || result == -1) { - g_message ("create_cal_factory(): could not register the calendar factory"); - CORBA_exception_free (&ev); - return FALSE; - } else if (result == -2) { - g_message ("create_cal_factory(): a calendar factory is already registered"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - return TRUE; -} - -int -main (int argc, char **argv) -{ - CORBA_Environment ev; - - bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE); - - CORBA_exception_init (&ev); - gnome_CORBA_init ("tlacuache", VERSION, &argc, argv, GNORBA_INIT_SERVER_FUNC, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("main(): could not initialize the ORB"); - CORBA_exception_free (&ev); - exit (1); - } - CORBA_exception_free (&ev); - - if (!bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) { - g_message ("main(): could not initialize Bonobo"); - exit (1); - } - - if (!gnome_vfs_init ()) { - g_message ("main(): could not initialize GNOME-VFS"); - exit (1); - } - - if (!create_cal_factory ()) - exit (1); - - bonobo_main (); - return 0; -} diff --git a/calendar/pcs/tlacuache.gnorba b/calendar/pcs/tlacuache.gnorba deleted file mode 100644 index acf2289229..0000000000 --- a/calendar/pcs/tlacuache.gnorba +++ /dev/null @@ -1,5 +0,0 @@ -[calendar:cal-factory] -type=exe -repo_id=IDL:GNOME/Calendar/CalFactory:1.0 -description=Calendar factory for the Personal Calendar Server -location_info=tlacuache |