diff options
author | Federico Mena Quintero <federico@ximian.com> | 2001-02-21 06:35:35 +0800 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2001-02-21 06:35:35 +0800 |
commit | dae9728b0d2a4c24b8ddc1a8a45a3e2ca02c18bf (patch) | |
tree | 07b54daad83f6572a4162e5a02aaaf58848280a0 /calendar/gui/alarm-notify | |
parent | f9a92db9a9b72e9e65f59f20469cc72e6c84186f (diff) | |
download | gsoc2013-evolution-dae9728b0d2a4c24b8ddc1a8a45a3e2ca02c18bf.tar gsoc2013-evolution-dae9728b0d2a4c24b8ddc1a8a45a3e2ca02c18bf.tar.gz gsoc2013-evolution-dae9728b0d2a4c24b8ddc1a8a45a3e2ca02c18bf.tar.bz2 gsoc2013-evolution-dae9728b0d2a4c24b8ddc1a8a45a3e2ca02c18bf.tar.lz gsoc2013-evolution-dae9728b0d2a4c24b8ddc1a8a45a3e2ca02c18bf.tar.xz gsoc2013-evolution-dae9728b0d2a4c24b8ddc1a8a45a3e2ca02c18bf.tar.zst gsoc2013-evolution-dae9728b0d2a4c24b8ddc1a8a45a3e2ca02c18bf.zip |
Added a `registered' field. (cal_factory_oaf_register): New function; now
2001-02-16 Federico Mena Quintero <federico@ximian.com>
* pcs/cal-factory.c (CalFactoryPrivate): Added a `registered'
field.
(cal_factory_oaf_register): New function; now the factory performs
its own registration with OAF.
(cal_factory_destroy): Unregister from OAF if appropriate.
svn path=/trunk/; revision=8308
Diffstat (limited to 'calendar/gui/alarm-notify')
-rw-r--r-- | calendar/gui/alarm-notify/Makefile.am | 6 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/alarm-notify.c | 55 |
2 files changed, 59 insertions, 2 deletions
diff --git a/calendar/gui/alarm-notify/Makefile.am b/calendar/gui/alarm-notify/Makefile.am index 2bfdfa38df..5df0b3c234 100644 --- a/calendar/gui/alarm-notify/Makefile.am +++ b/calendar/gui/alarm-notify/Makefile.am @@ -30,6 +30,12 @@ INCLUDES = \ gladedir = $(datadir)/evolution/glade evolution_alarm_notify_SOURCES = \ + alarm.c \ + alarm.h \ + alarm-notify.c \ + alarm-notify.h \ + alarm-queue.c \ + alarm-queue.h \ notify-main.c evolution_alarm_notify_LDADD = \ diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 60346ba801..9d64bfd4a8 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -24,6 +24,8 @@ #include "config.h" #endif +#include <libgnomevfs/gnome-vfs.h> +#include <cal-client/cal-client.h> #include "alarm-notify.h" @@ -109,7 +111,7 @@ alarm_notify_init (AlarmNotify *an) priv = g_new0 (AlarmNotifyPrivate, 1); an->priv = priv; - /* FIXME */ + priv->uri_client_hash = g_hash_table_new (gnome_vfs_uri_hash, gnome_vfs_uri_hequal); } /* Destroy handler for the alarm notify system */ @@ -127,6 +129,9 @@ alarm_notify_destroy (GtkObject *object) /* FIXME */ + g_hash_table_destroy (priv->uri_client_hash); + priv->uri_client_hash = NULL; + g_free (priv); an->priv = NULL; @@ -145,13 +150,47 @@ AlarmNotify_addCalendar (PortableServer_Servant servant, CORBA_Environment *ev) { AlarmNotify *an; + AlarmNotifyPrivate *priv; GnomeVFSURI *uri; CalClient *client; an = ALARM_NOTIFY (bonobo_object_from_servant (servant)); + priv = an->priv; uri = gnome_vfs_uri_new (str_uri); if (!uri) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI, + NULL); + return; + } + + client = g_hash_table_lookup (priv->uri_client_hash, uri); + + if (client) { + gnome_vfs_uri_unref (uri); + + gtk_object_ref (GTK_OBJECT (client)); + return; + } + + client = cal_client_new (); + + if (client) { + g_hash_table_insert (priv->uri_client_hash, uri); + alarm_queue_add_client (client); + + if (!cal_client_open_calendar (client, str_uri, FALSE)) { + gtk_object_unref (GTK_OBJECT (client)); + client = NULL; + } + } else { + gnome_vfs_uri_unref (uri); + + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_GNOME_Evolution_Calendar_AlarmNotify_BackendContactError, + NULL); + return; } } @@ -162,10 +201,22 @@ AlarmNotify_removeCalendar (PortableServer_Servant servant, CORBA_Environment *ev) { AlarmNotify *an; + AlarmNotifyPrivate *priv; + CalClient *client; + char *orig_uri; an = ALARM_NOTIFY (bonobo_object_from_servant (servant)); + priv = an->priv; - /* FIXME */ + if (!g_hash_table_lookup_extended (priv->uri_client_hash, uri, &orig_uri, &client)) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_GNOME_Evolution_Calendar_AlarmNotify_NotFound); + return; + } + + gtk_object_unref (client); + + /* FIXME: do we need to do anything else? */ } /** |