From ed7345eec736a39e3e37a4e76a0bdba7157270b7 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 25 Jan 2000 08:06:48 +0000 Subject: Check that the listener is not nil and emit and exception if it is. 2000-01-25 Federico Mena Quintero * cal-factory.c (CalFactory_load): Check that the listener is not nil and emit and exception if it is. * gnome-calendar.idl (CalFactory::load CalFactory::create): Now these raise the NilListener exception. * tlacuache.c (calendar_notify): Error stub for alarms. (alarm_defaults): Stub array. (debug_alarms): Stub variable. (main): Initialize gnome-vfs. svn path=/trunk/; revision=1627 --- calendar/pcs/cal-factory.c | 41 +++++++++++++++++++++++++++++++++++------ calendar/pcs/tlacuache.c | 27 ++++++++++++++++++++++++++- 2 files changed, 61 insertions(+), 7 deletions(-) (limited to 'calendar/pcs') diff --git a/calendar/pcs/cal-factory.c b/calendar/pcs/cal-factory.c index 6a522df67f..aef37e29cd 100644 --- a/calendar/pcs/cal-factory.c +++ b/calendar/pcs/cal-factory.c @@ -162,10 +162,25 @@ CalFactory_load (PortableServer_Servant servant, { CalFactory *factory; CalFactoryPrivate *priv; + CORBA_Environment ev2; + gboolean result; factory = CAL_FACTORY (gnome_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_GNOME_Calendar_CalFactory_NilListener, + NULL); + + CORBA_exception_free (&ev2); + return; + } + CORBA_exception_free (&ev2); + cal_factory_load (factory, uri, listener); } @@ -187,10 +202,10 @@ CalFactory_create (PortableServer_Servant servant, /** * cal_factory_get_epv: - * @void: - * + * @void: + * * Creates an EPV for the CalFactory CORBA class. - * + * * Return value: A newly-allocated EPV. **/ POA_GNOME_Calendar_CalFactory__epv * @@ -422,10 +437,10 @@ cal_factory_corba_object_create (GnomeObject *object) /** * cal_factory_new: - * @void: - * + * @void: + * * Creates a new #CalFactory object. - * + * * Return value: A newly-created #CalFactory, or NULL if its corresponding CORBA * object could not be created. **/ @@ -461,8 +476,22 @@ cal_factory_load (CalFactory *factory, const char *uri, GNOME_Calendar_Listener LoadCreateJobData *jd; CORBA_Environment ev; GNOME_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) { diff --git a/calendar/pcs/tlacuache.c b/calendar/pcs/tlacuache.c index 159d8b14ca..0af24d1829 100644 --- a/calendar/pcs/tlacuache.c +++ b/calendar/pcs/tlacuache.c @@ -22,16 +22,36 @@ #include #include #include +#include #include "cal-factory.h" +#include "calobj.h" /* The calendar factory */ static CalFactory *factory; -/* The alarms code needs this */ + + +/* 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 */ @@ -93,6 +113,11 @@ main (int argc, char **argv) exit (1); } + if (!gnome_vfs_init ()) { + g_message ("main(): could not initialize GNOME-VFS"); + exit (1); + } + if (!create_cal_factory ()) exit (1); -- cgit v1.2.3