diff options
author | JP Rosevear <jpr@ximian.com> | 2001-09-26 00:35:40 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2001-09-26 00:35:40 +0800 |
commit | ce71400f35232aa9122fceb3436dfc56b8b206e8 (patch) | |
tree | 67fae3fc60b7549edad8d2ccf6965cb7a622fead /calendar/pcs/cal.c | |
parent | 240af05417b2f326140a2ac8fe4043f457b00976 (diff) | |
download | gsoc2013-evolution-ce71400f35232aa9122fceb3436dfc56b8b206e8.tar.gz gsoc2013-evolution-ce71400f35232aa9122fceb3436dfc56b8b206e8.tar.zst gsoc2013-evolution-ce71400f35232aa9122fceb3436dfc56b8b206e8.zip |
use bonobo-exception stuff to clean code
2001-09-25 JP Rosevear <jpr@ximian.com>
* pcs/cal.c: use bonobo-exception stuff to clean code
* pcs/cal-factory.c (add_uri): add uri to the list if the type
matches
(impl_CalFactory_uriList): implement uriList method
* pcs/cal-backend.h: new virtual function member
* pcs/cal-backend.c (cal_backend_is_remote): call virtual function
* pcs/cal-backend-file.c (cal_backend_file_class_init): override
virtual function
(cal_backend_file_is_remote): new virtual function, always return
FALSE
* idl/evolution-calendar.idl: uriList factory call, with flags for
types to get
* gui/dialogs/comp-editor.c (comp_editor_destroy): cast to remove
warning
* gui/e-itip-control.c (write_label_piece): kill warnings by take
const char *
* gui/component-factory.c (create_object): aggregate offline
interface
* gui/Makefile.am: compile new files
* calobj.[hc]: Remove obsolete files
* cal-util/cal-util.h: enum URI types for uriList call
* cal-client/cal-client.c (build_uri_list): build list from string
sequence
(cal_client_uri_list): factory call to get uri list
* cal-client/cal-client.h: new proto
* cal-client/cal-client.c: use bonobo exception stuff to clean
code
* gui/calendar-offline-handler.[hc]: Start some skeleton routines
for online/offline handling
* pcs/cal-factory.c (launch_backend_for_uri): use accessor and
remove FIXME
svn path=/trunk/; revision=13110
Diffstat (limited to 'calendar/pcs/cal.c')
-rw-r--r-- | calendar/pcs/cal.c | 68 |
1 files changed, 23 insertions, 45 deletions
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index 9532e8265a..481019bcb8 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -23,6 +23,7 @@ #include <config.h> #include <ical.h> +#include <bonobo/bonobo-exception.h> #include "cal.h" #include "query.h" #include "wombat.h" @@ -118,9 +119,8 @@ impl_Cal_get_object (PortableServer_Servant servant, g_free (calobj); return calobj_copy; } else { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_Cal_NotFound, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_NotFound); + return NULL; } } @@ -218,9 +218,7 @@ impl_Cal_get_objects_in_range (PortableServer_Servant servant, t_end = (time_t) end; if (t_start > t_end || t_start == -1 || t_end == -1) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_Cal_InvalidRange, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_InvalidRange); return NULL; } @@ -254,9 +252,7 @@ impl_Cal_get_free_busy (PortableServer_Servant servant, t_end = (time_t) end; if (t_start > t_end || t_start == -1 || t_end == -1) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_Cal_InvalidRange, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_InvalidRange); return NULL; } @@ -295,9 +291,7 @@ impl_Cal_get_free_busy (PortableServer_Servant servant, return seq; } - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_Cal_NotFound, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_NotFound); return NULL; } @@ -323,9 +317,7 @@ impl_Cal_get_alarms_in_range (PortableServer_Servant servant, seq = cal_backend_get_alarms_in_range (priv->backend, t_start, t_end, &valid_range); if (!valid_range) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_Cal_InvalidRange, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_InvalidRange); return NULL; } @@ -359,15 +351,11 @@ impl_Cal_get_alarms_for_object (PortableServer_Servant servant, return alarms; case CAL_BACKEND_GET_ALARMS_NOT_FOUND: - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_Cal_NotFound, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_NotFound); return NULL; case CAL_BACKEND_GET_ALARMS_INVALID_RANGE: - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_Cal_InvalidRange, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_InvalidRange); return NULL; default: @@ -389,9 +377,7 @@ impl_Cal_update_objects (PortableServer_Servant servant, priv = cal->priv; if (!cal_backend_update_objects (priv->backend, calobj)) - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_Cal_InvalidObject, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject); } /* Cal::remove_object method */ @@ -407,9 +393,7 @@ impl_Cal_remove_object (PortableServer_Servant servant, priv = cal->priv; if (!cal_backend_remove_object (priv->backend, uid)) - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_Cal_NotFound, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_NotFound); } /* Cal::getQuery implementation */ @@ -430,20 +414,16 @@ impl_Cal_get_query (PortableServer_Servant servant, query = query_new (priv->backend, ql, sexp); if (!query) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_Cal_CouldNotCreate, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_CouldNotCreate); return CORBA_OBJECT_NIL; } CORBA_exception_init (&ev2); query_copy = CORBA_Object_duplicate (BONOBO_OBJREF (query), &ev2); - if (ev2._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev2)) { CORBA_exception_free (&ev2); g_message ("Cal_get_query(): Could not duplicate the query reference"); - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_Cal_CouldNotCreate, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_CouldNotCreate); return CORBA_OBJECT_NIL; } @@ -474,9 +454,7 @@ impl_Cal_get_timezone_object (PortableServer_Servant servant, g_free (calobj); return calobj_copy; } else { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_Cal_NotFound, - NULL); + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_NotFound); return NULL; } } @@ -511,7 +489,7 @@ cal_construct (Cal *cal, CORBA_exception_init (&ev); priv->listener = CORBA_Object_duplicate (listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { g_message ("cal_construct: could not duplicate the listener"); priv->listener = CORBA_OBJECT_NIL; CORBA_exception_free (&ev); @@ -523,7 +501,7 @@ cal_construct (Cal *cal, priv->listener, "IDL:GNOME/Evolution/WombatClient:1.0", &ev); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { g_message ("cal_construct: could not get the WombatClient interface"); priv->wombat_client = CORBA_OBJECT_NIL; } @@ -584,7 +562,7 @@ cal_destroy (GtkObject *object) CORBA_exception_init (&ev); bonobo_object_release_unref (priv->listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) + if (BONOBO_EX (&ev)) g_message ("cal_destroy(): could not release the listener"); priv->listener = NULL; @@ -665,7 +643,7 @@ cal_notify_update (Cal *cal, const char *uid) CORBA_exception_init (&ev); GNOME_Evolution_Calendar_Listener_notifyObjUpdated (priv->listener, (char *) uid, &ev); - if (ev._major != CORBA_NO_EXCEPTION) + if (BONOBO_EX (&ev)) g_message ("cal_notify_update(): could not notify the listener " "about an updated object"); @@ -696,7 +674,7 @@ cal_notify_remove (Cal *cal, const char *uid) CORBA_exception_init (&ev); GNOME_Evolution_Calendar_Listener_notifyObjRemoved (priv->listener, (char *) uid, &ev); - if (ev._major != CORBA_NO_EXCEPTION) + if (BONOBO_EX (&ev)) g_message ("cal_notify_remove(): could not notify the listener " "about a removed object"); @@ -727,7 +705,7 @@ cal_notify_categories_changed (Cal *cal, GNOME_Evolution_Calendar_StringSeq *cat CORBA_exception_init (&ev); GNOME_Evolution_Calendar_Listener_notifyCategoriesChanged (priv->listener, categories, &ev); - if (ev._major != CORBA_NO_EXCEPTION) + if (BONOBO_EX (&ev)) g_message ("cal_notify_categories_changed(): Could not notify the listener " "about the current set of categories"); @@ -765,7 +743,7 @@ cal_get_password (Cal *cal, const char *prompt, const char *key) (const CORBA_char *) prompt, (const CORBA_char *) key, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { g_message ("cal_get_password: could not get password from associated WombatClient"); CORBA_exception_free (&ev); return NULL; @@ -804,7 +782,7 @@ cal_forget_password (Cal *cal, const char *key) (const CORBA_char *) key, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { + if (BONOBO_EX (&ev)) { g_message ("cal_forget_password: could not notify WombatClient about " "password to be forgotten"); } |