aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs/cal-factory.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@helixcode.com>2000-01-19 11:32:45 +0800
committerArturo Espinosa <unammx@src.gnome.org>2000-01-19 11:32:45 +0800
commitbd4e64bd780fc0e39832f5c5abf1a15522fa6076 (patch)
tree927a0247d1a123aef71d576d84e71dd9d9cbfd39 /calendar/pcs/cal-factory.c
parenta943a5c706c2dcf6956129838c8b4e5f95de93f4 (diff)
downloadgsoc2013-evolution-bd4e64bd780fc0e39832f5c5abf1a15522fa6076.tar.gz
gsoc2013-evolution-bd4e64bd780fc0e39832f5c5abf1a15522fa6076.tar.zst
gsoc2013-evolution-bd4e64bd780fc0e39832f5c5abf1a15522fa6076.zip
Moved the calendar backend here. This is the actual calendar-handling
2000-01-18 Federico Mena Quintero <federico@helixcode.com> * cal-backend.c cal-backend.h: Moved the calendar backend here. This is the actual calendar-handling object. (load_from_vobject): Moved over from calendar.c. Modified to use a CalBackend instead of the old Calendar structure. (add_object): Likewise. * cal.c: Now the Cal object is just a calendar client interface object; we use it as a "viewport" onto a CalBackend. This also lets us do correct resource management. * cal-common.h: New file with common forward declarations; we can't have circular dependencies between headers. 2000-01-18 Federico Mena Quintero <federico@helixcode.com> * cal-factory.c (cal_factory_load): Queue a load job. (load_fn): Load job handler. Lookup the calendar by URI, load it if it is not loaded, or just report it to the new listener if it is. * job.c job.h: New files with a simple job queue manager. * gnome-calendar.idl (Listener::cal_loaded): Do not return the whole calendar object string. The client will be able to query the calendar for the events it needs. * cal-listener.c (Listener_cal_loaded): Ref the calendar GNOME object. We unref it when the listener is destroyed. 2000-01-17 Federico Mena Quintero <federico@helixcode.com> The files from the gncal directory of the gnome-pim module on CVS were moved here, to evolution/calendar, in preparation for the Evolution work. The calendar is being split into a model/view architecture. The model is a personal calendar server (PAS): it provides storage, notification, and event generation; the views/controllers are the calendar user agents and things like Pilot synchronizers. svn path=/trunk/; revision=1591
Diffstat (limited to 'calendar/pcs/cal-factory.c')
-rw-r--r--calendar/pcs/cal-factory.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/calendar/pcs/cal-factory.c b/calendar/pcs/cal-factory.c
index ac1043bc10..053baebe5c 100644
--- a/calendar/pcs/cal-factory.c
+++ b/calendar/pcs/cal-factory.c
@@ -187,20 +187,6 @@ cal_factory_get_epv (void)
return epv;
}
-/* Returns whether a CORBA object is nil */
-static gboolean
-corba_object_is_nil (CORBA_Object object)
-{
- CORBA_Environment ev;
- gboolean retval;
-
- CORBA_exception_init (&ev);
- retval = CORBA_Object_is_nil (object, &ev);
- CORBA_exception_free (&ev);
-
- return retval;
-}
-
/* Loading and creating calendars */
@@ -288,7 +274,6 @@ cal_factory_construct (CalFactory *factory, GNOME_Calendar_CalFactory corba_fact
{
g_return_val_if_fail (factory != NULL, NULL);
g_return_val_if_fail (IS_CAL_FACTORY (factory), NULL);
- g_return_val_if_fail (!corba_object_is_nil (corba_factory), NULL);
gnome_object_construct (GNOME_OBJECT (factory), corba_factory);
return factory;
@@ -319,6 +304,7 @@ cal_factory_corba_object_create (GnomeObject *object)
CORBA_exception_init (&ev);
POA_GNOME_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;
@@ -341,15 +327,25 @@ CalFactory *
cal_factory_new (void)
{
CalFactory *factory;
+ CORBA_Environment ev;
GNOME_Calendar_CalFactory corba_factory;
+ gboolean retval;
factory = gtk_type_new (CAL_FACTORY_TYPE);
+
corba_factory = cal_factory_corba_object_create (GNOME_OBJECT (factory));
- if (corba_object_is_nil (corba_factory)) {
- gtk_object_destroy (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 object");
+ gtk_object_unref (factory);
+ CORBA_exception_free (&ev);
return NULL;
}
+ CORBA_exception_free (&ev);
+
return cal_factory_construct (factory, corba_factory);
}
@@ -358,18 +354,25 @@ cal_factory_load (CalFactory *factory, const char *uri, GNOME_Calendar_Listener
{
LoadCreateJobData *jd;
CORBA_Environment ev;
+ GNOME_Calendar_Listener listener_copy;
CORBA_exception_init (&ev);
+ 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 = CORBA_Object_duplicate (listener, &ev);
- GNOME_Unknown_ref (jd->listener);
+ jd->listener = listener_copy;
job_add (load_fn, jd);
-
- CORBA_exception_free (&ev);
}
void