diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2001-09-27 19:08:03 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2001-09-27 19:08:03 +0800 |
commit | 32c4df4977b1c6fae62497de544b8e1538ca80d2 (patch) | |
tree | 3bfc470459e485cee5cdaefd269b8d600d2d0d86 /calendar/pcs | |
parent | 1372af4e7da3ff918873ba8419a878e067eb67cc (diff) | |
download | gsoc2013-evolution-32c4df4977b1c6fae62497de544b8e1538ca80d2.tar gsoc2013-evolution-32c4df4977b1c6fae62497de544b8e1538ca80d2.tar.gz gsoc2013-evolution-32c4df4977b1c6fae62497de544b8e1538ca80d2.tar.bz2 gsoc2013-evolution-32c4df4977b1c6fae62497de544b8e1538ca80d2.tar.lz gsoc2013-evolution-32c4df4977b1c6fae62497de544b8e1538ca80d2.tar.xz gsoc2013-evolution-32c4df4977b1c6fae62497de544b8e1538ca80d2.tar.zst gsoc2013-evolution-32c4df4977b1c6fae62497de544b8e1538ca80d2.zip |
added InvalidURI and UnsupportedMethod exceptions to the CalFactory
2001-09-27 Rodrigo Moya <rodrigo@ximian.com>
* idl/evolution-calendar.idl: added InvalidURI and UnsupportedMethod
exceptions to the CalFactory interface
* pcs/cal-factory.c (impl_CalFactory_open): raise InvalidURI exception on
URI errors and UnsupportedMethod when we don't support the method for
a given URI
2001-09-26 Rodrigo Moya <rodrigo@ximian.com>
* cal-client/cal-client.c: added support for using multiple calendar
factories
(cal_client_uri_list): use the list of factories loaded for this
CalClient
svn path=/trunk/; revision=13189
Diffstat (limited to 'calendar/pcs')
-rw-r--r-- | calendar/pcs/cal-factory.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/calendar/pcs/cal-factory.c b/calendar/pcs/cal-factory.c index b2b718f861..e7a7316193 100644 --- a/calendar/pcs/cal-factory.c +++ b/calendar/pcs/cal-factory.c @@ -417,7 +417,7 @@ open_fn (gpointer data) static void impl_CalFactory_open (PortableServer_Servant servant, - const CORBA_char *uri, + const CORBA_char *str_uri, CORBA_boolean only_if_exists, GNOME_Evolution_Calendar_Listener listener, CORBA_Environment *ev) @@ -428,10 +428,40 @@ impl_CalFactory_open (PortableServer_Servant servant, gboolean result; OpenJobData *jd; GNOME_Evolution_Calendar_Listener listener_copy; + GnomeVFSURI *uri; + const char *method_str; + GtkType type; factory = CAL_FACTORY (bonobo_object_from_servant (servant)); priv = factory->priv; + /* check URI to see if we support it */ + CORBA_exception_init (&ev2); + + uri = gnome_vfs_uri_new_private (str_uri, TRUE, TRUE, TRUE); + if (!uri) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_GNOME_Evolution_Calendar_CalFactory_InvalidURI, + NULL); + CORBA_exception_free (&ev2); + return; + } + + method_str = gnome_vfs_uri_get_scheme (uri); + type = g_hash_table_lookup (priv->methods, method_str); + + gnome_vfs_uri_unref (uri); + if (!type) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_GNOME_Evolution_Calendar_CalFactory_UnsupportedMethod, + NULL); + CORBA_exception_free (&ev2); + return; + } + + CORBA_exception_free (&ev2); + + /* duplicate the listener object */ CORBA_exception_init (&ev2); result = CORBA_Object_is_nil (listener, &ev2); @@ -459,9 +489,10 @@ impl_CalFactory_open (PortableServer_Servant servant, CORBA_exception_free (&ev2); + /* add new asynchronous job */ jd = g_new (OpenJobData, 1); jd->factory = factory; - jd->uri = g_strdup (uri); + jd->uri = g_strdup (str_uri); jd->only_if_exists = only_if_exists; jd->listener = listener_copy; |