From 000e2ade56eb86a150a5a33e37bb685592e30186 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Mon, 17 Nov 2003 13:13:15 +0000 Subject: remove the AlarmNotify service, no more need for it, since the alarm 2003-11-17 Rodrigo Moya * idl/evolution-calendar.idl: remove the AlarmNotify service, no more need for it, since the alarm daemon will listen for changes on the GConf key. * gui/gnome-cal.c (add_alarms): removed function to talk to the alarm daemon. (client_cal_opened_cb): don't call add_alarms(). * gui/alarm-notify/alarm-notify.[ch]: made it a basic GObject. (AlarmNotify_addCalendar, AlarmNotify_removeCalendar): removed AlarmNotify interface implementation. (alarm_notify_class_init): no epv to initialize. (alarm_notify_remove_calendar): new function, copied from the CORBA method implementation. (alarm_notify_factory_fn): return NULL, since there is no objects that can be created via this factory now. * gui/alarm-notify/notify-main.c (main): now the factory is the alarm notification service itself. (load_calendars): no need to use exceptions here. * gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in.in: now the factory is the alarm notification service itself. * gui/main.c (launch_alarm_daemon_cb): dont use the AlarmNotify CORBA types. svn path=/trunk/; revision=23384 --- calendar/gui/alarm-notify/alarm-notify.c | 99 +++++++++++++------------------- 1 file changed, 39 insertions(+), 60 deletions(-) (limited to 'calendar/gui/alarm-notify/alarm-notify.c') diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 267a1001ca..fa43e2bab6 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -43,22 +43,32 @@ static void alarm_notify_class_init (AlarmNotifyClass *klass); static void alarm_notify_init (AlarmNotify *an, AlarmNotifyClass *klass); static void alarm_notify_finalize (GObject *object); -static void AlarmNotify_addCalendar (PortableServer_Servant servant, - const CORBA_char *str_uri, - CORBA_Environment *ev); -static void AlarmNotify_removeCalendar (PortableServer_Servant servant, - const CORBA_char *str_uri, - CORBA_Environment *ev); - static BonoboObjectClass *parent_class; -BONOBO_TYPE_FUNC_FULL (AlarmNotify, - GNOME_Evolution_Calendar_AlarmNotify, - BONOBO_TYPE_OBJECT, - alarm_notify); +GType +alarm_notify_get_type (void) +{ + static GType type = 0; + + if (!type) { + static GTypeInfo info = { + sizeof (AlarmNotifyClass), + (GBaseInitFunc) NULL, + (GBaseFinalizeFunc) NULL, + (GClassInitFunc) alarm_notify_class_init, + NULL, NULL, + sizeof (AlarmNotify), + 0, + (GInstanceInitFunc) alarm_notify_init + }; + type = g_type_register_static (G_TYPE_OBJECT, "AlarmNotify", &info, 0); + } + + return type; +} /* Class initialization function for the alarm notify service */ static void @@ -70,9 +80,6 @@ alarm_notify_class_init (AlarmNotifyClass *klass) parent_class = g_type_class_peek_parent (klass); - klass->epv.addCalendar = AlarmNotify_addCalendar; - klass->epv.removeCalendar = AlarmNotify_removeCalendar; - object_class->finalize = alarm_notify_finalize; } @@ -122,8 +129,6 @@ alarm_notify_finalize (GObject *object) -/* CORBA servant implementation */ - /* Looks for a canonicalized URI inside an array of URIs; returns the index * within the array or -1 if not found. */ @@ -228,41 +233,6 @@ remove_uri_to_load (const char *str_uri) free_uris (loaded_uris); } -/* AlarmNotify::addCalendar method */ -static void -AlarmNotify_addCalendar (PortableServer_Servant servant, - const CORBA_char *str_uri, - CORBA_Environment *ev) -{ - AlarmNotify *an; - - an = ALARM_NOTIFY (bonobo_object_from_servant (servant)); - alarm_notify_add_calendar (an, str_uri, TRUE, ev); -} - -/* AlarmNotify::removeCalendar method */ -static void -AlarmNotify_removeCalendar (PortableServer_Servant servant, - const CORBA_char *str_uri, - CORBA_Environment *ev) -{ - AlarmNotify *an; - AlarmNotifyPrivate *priv; - ECal *client; - - an = ALARM_NOTIFY (bonobo_object_from_servant (servant)); - priv = an->priv; - - client = g_hash_table_lookup (priv->uri_client_hash, str_uri); - if (client) { - alarm_queue_remove_client (client); - - g_hash_table_remove (priv->uri_client_hash, str_uri); - } - - remove_uri_to_load (str_uri); -} - /** @@ -288,15 +258,13 @@ alarm_notify_new (void) * @uri: URI of the calendar to load. * @load_afterwards: Whether this calendar should be loaded in the future * when the alarm daemon starts up. - * @ev: CORBA environment for exceptions. * * Tells the alarm notification service to load a calendar and start monitoring * its alarms. It can optionally be made to save the URI of this calendar so * that it can be loaded in the future when the alarm daemon starts up. **/ void -alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_afterwards, - CORBA_Environment *ev) +alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_afterwards) { AlarmNotifyPrivate *priv; ECal *client; @@ -304,7 +272,6 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a g_return_if_fail (an != NULL); g_return_if_fail (IS_ALARM_NOTIFY (an)); g_return_if_fail (str_uri != NULL); - g_return_if_fail (ev != NULL); priv = an->priv; @@ -321,10 +288,22 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a g_hash_table_insert (priv->uri_client_hash, g_strdup (str_uri), client); } - } else { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_AlarmNotify_BackendContactError, - NULL); - return; } } + +void +alarm_notify_remove_calendar (AlarmNotify *an, const char *str_uri) +{ + AlarmNotifyPrivate *priv; + ECal *client; + + priv = an->priv; + + client = g_hash_table_lookup (priv->uri_client_hash, str_uri); + if (client) { + alarm_queue_remove_client (client); + + g_hash_table_remove (priv->uri_client_hash, str_uri); + } + remove_uri_to_load (str_uri); +} -- cgit v1.2.3