aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs
diff options
context:
space:
mode:
authorArturo Espinosa <unammx@src.gnome.org>2000-02-03 15:16:37 +0800
committerArturo Espinosa <unammx@src.gnome.org>2000-02-03 15:16:37 +0800
commit38ca3c828fdca28729559e64f644214bc5222bee (patch)
tree6a322c68f739c915e7861d0a7203372c2dcdda07 /calendar/pcs
parent9d6fc52249f34b5a3985bea8ace18059be9e4bba (diff)
downloadgsoc2013-evolution-38ca3c828fdca28729559e64f644214bc5222bee.tar.gz
gsoc2013-evolution-38ca3c828fdca28729559e64f644214bc5222bee.tar.zst
gsoc2013-evolution-38ca3c828fdca28729559e64f644214bc5222bee.zip
Sync to laptop - Federico
svn path=/trunk/; revision=1664
Diffstat (limited to 'calendar/pcs')
-rw-r--r--calendar/pcs/cal-backend.c88
-rw-r--r--calendar/pcs/cal.c2
2 files changed, 65 insertions, 25 deletions
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index 91ffd8dc1d..ffbbdab472 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -34,14 +34,15 @@ typedef struct {
/* List of Cal client interface objects, each with its listener */
GList *clients;
- /* All events in the calendar and uri->event hash */
- GList *events;
- GHashTable *event_hash;
+ /* 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 TODOs in the calendar */
+ /* All events, TODOs, and journals in the calendar */
+ GList *events;
GList *todos;
-
- /* All journals in the calendar */
GList *journals;
/* Whether a calendar has been loaded */
@@ -136,29 +137,65 @@ cal_backend_destroy (GtkObject *object)
-/* Adds an object to the calendar backend */
+/* 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);
- g_assert (ico->uid != 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:
- g_hash_table_insert (priv->event_hash, ico->uid, ico);
priv->events = g_list_prepend (priv->events, ico);
#if 0
/* FIXME: gnomecal old code */
ical_object_try_alarms (ico);
-#ifdef DEBUGGING_MAIL_ALARM
+# ifdef DEBUGGING_MAIL_ALARM
ico->malarm.trigger = 0;
calendar_notify (0, ico);
-#endif
+# endif
#endif
break;
@@ -174,14 +211,6 @@ add_object (CalBackend *backend, iCalObject *ico)
g_assert_not_reached ();
}
- /* FIXME: things must come with an UID! */
-
- if (!ico->uid) {
- char buffer [80];
-
- snprintf (buffer, sizeof (buffer), "GnomeCalendar-%ld\n", time (NULL));
- ico->uid = g_strdup (buffer);
- }
#if 0
/* FIXME: gnomecal old code */
ico->last_mod = time (NULL);
@@ -197,8 +226,9 @@ load_from_vobject (CalBackend *backend, VObject *vobject)
priv = backend->priv;
- g_assert (priv->event_hash == NULL);
- priv->event_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ 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);
@@ -394,13 +424,16 @@ cal_backend_load (CalBackend *backend, GnomeVFSURI *uri)
* Queries a calendar backend for a calendar object based on its unique
* identifier.
*
- * Return value: The string representation of the sought object, or NULL if no
- * object had the specified UID.
+ * 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;
+ char *buf;
g_return_val_if_fail (backend != NULL, NULL);
g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL);
@@ -410,5 +443,12 @@ cal_backend_get_object (CalBackend *backend, const char *uid)
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;
+
/* FIXME */
}
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c
index 1403c2c028..1ce1d91716 100644
--- a/calendar/pcs/cal.c
+++ b/calendar/pcs/cal.c
@@ -182,7 +182,7 @@ Cal_get_object (PortableServer_Servant servant,
calobj = cal_backend_get_object (priv->backend, uid);
- if (uid) {
+ if (calobj) {
CORBA_char *calobj_copy;
calobj_copy = CORBA_string_dup (calobj);
10:20:42 +0800'>2009-05-171-1/+1 * Whoops, add two more hunks to complete XDMCP support.marcus2009-05-172-1/+21 * * Fix XDMCP support with gdm. Note: that for IPv4 support to work, onemarcus2009-05-176-12/+230 * Add an explicit dependency on hal.marcus2009-05-031-1/+2 * * Add support for a gdm_lang rc.conf macro to control the locale used bymarcus2009-05-034-1/+181 * Presenting GNOME 2.26.1 for FreeBSD.kwm2009-04-245-7/+19 * Presenting GNOME 2.26 for FreeBSD. Seemarcus2009-04-107-107/+36 * Take a stab at working around the hald/gdm race. After we loop waitingmarcus2009-02-012-1/+9 * Depend on hald when starting up so that we have a better chance of findingmarcus2009-01-272-2/+2 * Don't bother registering GConf files. The pkg-install will take care of thismarcus2009-01-121-3/+1 * Cleanup the gdm home directory.marcus2009-01-122-1/+4 * Presenting GNOME 2.24 for FreeBSD.marcus2009-01-1031-541/+462 * - Remove conditional checks for FreeBSD 5.x and olderwxs2009-01-061-6/+0 * Update to 2.20.8.marcus2008-09-084-15/+6 * Restore the ability to process gdm_flags when starting.marcus2008-08-182-2/+2 * * Add support for integrating GDM with GnomeKeyring and PAMmarcus2008-07-284-5/+38 * gdmchooser/XDMCP:vs2008-07-262-1/+29 * Update to 2.20.7.mezz2008-07-013-5/+7 * * Make sure seahorse-agent is only run when we're starting gnome-sessionmarcus2008-06-092-11/+33 * Add the ability to spawn seahorse-agent from gdm rather than from everymarcus2008-06-092-1/+18 * Bump portrevision due to upgrade of devel/gettext.edwin2008-06-061-0/+1 * Update to 2.20.6.mezz2008-05-152-4/+4 * Update to 2.20.5.marcus2008-04-082-5/+4 * Add a delay loop which keeps GDM from starting until the gettys have beenmarcus2008-03-262-2/+23 * The FreeBSD GNOME team is proud to annunce the release of GNOME 2.22.0 formarcus2008-03-245-24/+19 * Update to 2.20.3.mezz2008-01-082-4/+4 * Update to 2.20.2.mezz2007-12-124-9/+22 * Presenting GNOME 2.20.1 and all related works for FreeBSD. The officialmarcus2007-10-259-152/+258 * Use += to set LIB_DEPENDS and CONFIGURE_ARGS after bsd.port.pre.mk.marcus2007-08-281-3/+3 * Add optional support for consolekit.flz2007-08-281-2/+9 * Correct the location of the gdm.conf file in the gdm(1) man page.marcus2007-08-191-0/+3 * Update to 2.18.4.marcus2007-08-012-4/+4 * - Set --mandir and --infodir in CONFIGURE_ARGS if the configure scriptrafan2007-07-231-2/+1 * Update to 2.18.3.mezz2007-07-042-6/+5 * Add a hack to fix a lot of hardcore paths of /usr/X11R6 to fix the problem formezz2007-06-141-1/+4 * We do not need to remove pam.d anymore.marcus2007-06-041-1/+0 * Add dmxproto as well as dmx since dmx doesn't pull in dmxproto.marcus2007-06-031-2/+2 * Add a missing dependency on dmx to fix the packaging.marcus2007-06-031-0/+2 * Remove unneeded block.marcus2007-05-292-7/+1 * Update to 2.18.2, while I am here, get rid of X11BASE.mezz2007-05-293-6/+8 * - Welcome X.org 7.2 \o/.flz2007-05-202-36/+1 * Update to 2.18.1ahze2007-04-093-12/+12 * Presenting GNOME 2.18 for FreeBSD. GNOME 2.18 is a departure from recent GNOMEmarcus2007-03-196-28/+56 * Update to 2.16.5.mezz2007-01-303-5/+7 * Update to 2.16.4.marcus2006-12-142-4/+4 * Update to 2.16.3.marcus2006-11-232-5/+4 * - Allow to lift the annoying ~/.xsession-errors size limitjylefort2006-10-313-3/+37 * Update to 2.16.2.marcus2006-10-313-25/+4 * Fix a crash that can occur due to a NULL pointer dereference when enablingmarcus2006-10-202-0/+21 * Presenting GNOME 2.16.1 for FreeBSD. This release represents a massivemarcus2006-10-146-41/+79 * - Update to 2.14.10ahze2006-08-012-5/+4 * Fix a typo of swedish locale, sv_SV.UTF-8 -> sv_SE.UTF-8. Bump themezz2006-07-172-1/+2 * Update to 2.14.8.marcus2006-06-082-4/+4 * Update to 2.14.7.marcus2006-05-273-16/+9 * Don't chgrp the /var/gdm directory to gdm during the instal phase since themarcus2006-05-171-3/+10 * Update to 2.14.6.marcus2006-05-136-54/+9 * - Correct brazilian portuguese entrypav2006-05-111-1/+1 * Update to 2.14.5.marcus2006-05-043-116/+7 * Presenting GNOME 2.14.1 for FreeBSD! Checkoutmarcus2006-04-3010-67/+210 * Conversion to a single libtool environment.ade2006-02-232-2/+6 * Replace ugly "@unexec rmdir %D... 2>/dev/null || true" with @dirrmtryedwin2006-01-221-2/+2 * Require moused before our rc script runs to ensure X is ready for us.marcus2006-01-012-3/+7 * Seems -CURRENT needs a few tweaks to get gdm starting correctly. First,marcus2005-12-063-5/+6 * Update to 2.8.0.7.marcus2005-11-294-88/+4 * Remove shutdown keyword from the rcNG script since GDM will kill itself atmarcus2005-11-262-1/+2 * Update to 2.8.0.6.marcus2005-11-193-4/+68 * Mass-conversion to the USE_AUTOTOOLS New World Order. The code presentade2005-11-151-1/+1 * IPv6 support no logner disables IPv4 support.marcus2005-11-071-1/+1 * Bump PORTREVISION to chase the glib20 shared library update.marcus2005-11-051-0/+1 * Update to 2.8.0.5.marcus2005-10-042-3/+3 * Update to 2.8.0.4.marcus2005-09-073-4/+6 * * Update to 2.8.0.3marcus2005-08-298-75/+54 * Fix the build on 4.X.marcus2005-07-041-2/+49 * Update to 2.8.0.1.marcus2005-07-045-319/+6 * Correct a severe security issue if a user without a home directory logs inmarcus2005-06-282-9/+42 * - Fix plist for xorg users, gdm-dmx-reconnect-proxy wantsahze2005-06-222-1/+7 * - Add missing file to plistahze2005-06-222-0/+2 * Fix the build on 4.X.marcus2005-06-123-3/+284 * Update to GDM 2.8.0.0.marcus2005-06-118-68/+74 * Improve the startup script:jylefort2005-06-102-13/+2 * Fix an infinite loop that can occur when gnome-session attempts a logout.marcus2005-05-122-0/+43 * - Beautify console messagespav2005-05-041-2/+2 * Pad the "Sarting GDM" phrase with a leading space.marcus2005-04-251-1/+1 * Update to 2.6.0.9.adamw2005-04-123-4/+5 * Install a rcNG startup script, instead of the old one.kwm2005-04-115-44/+34 * Bump PORTREVISION to chase the glib20 shared lib version change.marcus2005-03-121-0/+1 * - Update WWW: lineahze2005-03-091-1/+1 * Update to 2.6.0.8.marcus2005-03-085-21/+25 * The glibc strftime padding options were MFC'd to 5-STABLE. Let's use them.marcus2005-02-211-1/+2 * Update to 2.6.0.7.marcus2005-02-044-5/+10 * - Move x11/gdm2 to x11/gdmpav2005-01-2512-0/+612 * Begin the de-orbit burn of the GNOME 1.4 desktop. This is phase I. Allmarcus2003-07-1619-844/+0 * Remove USE_GNOMENG.marcus2003-04-211-1/+0 * Fix the checks when installing config files.marcus2003-04-091-9/+9 * Clear moonlight beckons.ade2003-03-072-1/+1 * Properly install the config files when installing from package.marcus2003-02-201-0/+9 * One more pass at the gdm's. This time, allow the gdm user and group tomarcus2003-01-222-12/+4 * Correct last commit. PKG_PREFIX is only set by pkg_add, thus when building themarcus2003-01-202-2/+10 * Make sure directory permissions are properly set when installing frommarcus2003-01-202-6/+4 * Remove ${X11BASE}/sbin if it exists and is not empty.marcus2003-01-141-0/+1 * Fix install on -CURRENT.marcus2002-10-202-2/+10 * GNOME has just changed the layout of their FTP site. This resulted inmarcus2002-09-211-1/+1 * Add a missing dependency on libglade.marcus2002-09-091-1/+1 * Fix a typo in one of the patches.marcus2002-08-261-1/+1 * * Change the uid:gid for gdm to 92 as mailman already has 91marcus2002-08-104-12/+112 * Use USE_GNOMENG.sobomax2002-07-185-60/+21 * add missing files.nork2002-04-291-0/+1 * Do not show the security warning dialog if BATCH is set (it causesolgeni2002-04-251-1/+3 * Update to 2.2.5.5.sobomax2002-03-146-69/+141 * Add missed IS_INTERACTIVE=yes when not building on bento.sobomax2002-03-061-1/+5 * Make face browser working.sobomax2002-01-312-1/+28 * Fix installation when /usr/sbin not in the PATH.sobomax2002-01-291-4/+5 * When building on bento use numeric UID/GID because bento knows nothing aboutsobomax2002-01-251-0/+4 * Use user name instead of UID when setting owner for the directory withsobomax2002-01-241-1/+1 * Use correct permissions for ${PREFIX}/share/gnome/gdm.sobomax2002-01-151-0/+1 * Remove pkg-req - we don't need it anymore.sobomax2002-01-151-21/+0 * When installing package automagically create required user/group if they don'tsobomax2002-01-152-7/+37 * Kill useless hunk.sobomax2002-01-111-10/+0 * Respect user's settings in /etc/login.conf. Bump PORTREVISION.sobomax2002-01-114-0/+200 * Sync with reality.sobomax2002-01-021-3/+0 * Update to 2.2.5.4.sobomax2002-01-023-23/+2 * Set correct group for users' session.sobomax2001-12-312-0/+21 * Update pkg-message to match reality.sobomax2001-12-301-5/+5 * Upgrade 2.2.5.3.sobomax2001-12-293-3/+8 * Correct locale names for use on FreeBSD. Bump PORTREVISION.sobomax2001-12-203-12/+80 * Backout previous change - it seems that new revision of the patch doesn'tsobomax2001-12-201-17/+8 * Don't filter libc_r on 5-CURRENT.sobomax2001-12-201-8/+17 * Update to 2.2.5.2.sobomax2001-11-277-54/+50 * Apply some black cvs magick to readd patch-ar properly.sobomax2001-10-161-0/+19 * Apply some black cvs magick to readd patch-ar properly.sobomax2001-10-161-19/+0 * Fix several incompatibilities with FreeBSD. This makes gdm working, at leastsobomax2001-10-16