diff options
author | JP Rosevear <jpr@ximian.com> | 2002-09-05 00:19:21 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2002-09-05 00:19:21 +0800 |
commit | f768bddb9325e7784477bcbcef0bce2a466a635a (patch) | |
tree | 7a5223bc31dc49e046ea4b41e0c3da35467b282c /calendar | |
parent | ddaa0af2ceba5de217424eeddfa3f650049ddfa1 (diff) | |
download | gsoc2013-evolution-f768bddb9325e7784477bcbcef0bce2a466a635a.tar gsoc2013-evolution-f768bddb9325e7784477bcbcef0bce2a466a635a.tar.gz gsoc2013-evolution-f768bddb9325e7784477bcbcef0bce2a466a635a.tar.bz2 gsoc2013-evolution-f768bddb9325e7784477bcbcef0bce2a466a635a.tar.lz gsoc2013-evolution-f768bddb9325e7784477bcbcef0bce2a466a635a.tar.xz gsoc2013-evolution-f768bddb9325e7784477bcbcef0bce2a466a635a.tar.zst gsoc2013-evolution-f768bddb9325e7784477bcbcef0bce2a466a635a.zip |
provide error message param, give a dialog with the message if we get a
2002-09-04 JP Rosevear <jpr@ximian.com>
* gui/itip-utils.c (comp_server_send): provide error message
param, give a dialog with the message if we get a busy result;
return TRUE if we succeed
(itip_send_comp): bail out if we had a problem sending via the
server
* cal-client/cal-client.c (cal_client_send_object): pass back
error message if we get the busy exception in the new param
* cal-client/cal-client.h: update proto
* pcs/cal.c (impl_Cal_send_object): dump backend error message
into Busy exception
* pcs/cal-backend.h: update proto
* pcs/cal-backend.c (cal_backend_send_object): take/pass new error
message parameter
* pcs/cal-backend-file.c (cal_backend_file_send_object): take new param
* idl/evolution-calendar.idl: add errorMsg to Busy exception
svn path=/trunk/; revision=17964
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 25 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.c | 13 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.h | 3 | ||||
-rw-r--r-- | calendar/gui/itip-utils.c | 23 | ||||
-rw-r--r-- | calendar/idl/evolution-calendar.idl | 2 | ||||
-rw-r--r-- | calendar/pcs/cal-backend-file.c | 5 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.c | 4 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.h | 6 | ||||
-rw-r--r-- | calendar/pcs/cal.c | 8 |
9 files changed, 67 insertions, 22 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 303de841c0..33f2cdff63 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,28 @@ +2002-09-04 JP Rosevear <jpr@ximian.com> + + * gui/itip-utils.c (comp_server_send): provide error message + param, give a dialog with the message if we get a busy result; + return TRUE if we succeed + (itip_send_comp): bail out if we had a problem sending via the + server + + * cal-client/cal-client.c (cal_client_send_object): pass back + error message if we get the busy exception in the new param + + * cal-client/cal-client.h: update proto + + * pcs/cal.c (impl_Cal_send_object): dump backend error message + into Busy exception + + * pcs/cal-backend.h: update proto + + * pcs/cal-backend.c (cal_backend_send_object): take/pass new error + message parameter + + * pcs/cal-backend-file.c (cal_backend_file_send_object): take new param + + * idl/evolution-calendar.idl: add errorMsg to Busy exception + 2002-09-04 Ettore Perazzoli <ettore@ximian.com> * gui/component-factory.c (create_object): Pass NULL as diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index b46dc3a215..6d9deacde8 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -2446,7 +2446,8 @@ cal_client_remove_object (CalClient *client, const char *uid) CalClientResult cal_client_send_object (CalClient *client, icalcomponent *icalcomp, - icalcomponent **new_icalcomp, GList **users) + icalcomponent **new_icalcomp, GList **users, + char error_msg[256]) { CalClientPrivate *priv; CORBA_Environment ev; @@ -2470,13 +2471,15 @@ cal_client_send_object (CalClient *client, icalcomponent *icalcomp, CORBA_exception_init (&ev); obj_string = GNOME_Evolution_Calendar_Cal_sendObject (priv->cal, obj_string, &user_list, &ev); - if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject)) + if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject)) { retval = CAL_CLIENT_SEND_INVALID_OBJECT; - else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_Busy)) + } else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_Busy)) { retval = CAL_CLIENT_SEND_BUSY; - else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_PermissionDenied)) + strcpy (error_msg, + ((GNOME_Evolution_Calendar_Cal_Busy *)(CORBA_exception_value (&ev)))->errorMsg); + } else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_PermissionDenied)) { retval = CAL_CLIENT_SEND_PERMISSION_DENIED; - else if (BONOBO_EX (&ev)) { + } else if (BONOBO_EX (&ev)) { g_message ("cal_client_update_objects(): could not send the objects"); retval = CAL_CLIENT_SEND_CORBA_ERROR; } else { diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h index de5e19ffdf..ef42cdccd6 100644 --- a/calendar/cal-client/cal-client.h +++ b/calendar/cal-client/cal-client.h @@ -186,7 +186,8 @@ CalClientResult cal_client_update_objects (CalClient *client, icalcomponent *ica CalClientResult cal_client_remove_object (CalClient *client, const char *uid); CalClientSendResult cal_client_send_object (CalClient *client, icalcomponent *icalcomp, - icalcomponent **new_icalcomp, GList **users); + icalcomponent **new_icalcomp, GList **users, + char error_msg[256]); CalQuery *cal_client_get_query (CalClient *client, const char *sexp); diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index c6af6989ba..544c9f5e25 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -521,15 +521,17 @@ comp_content_type (CalComponent *comp, CalComponentItipMethod method) } -static GList * -comp_server_send (CalComponentItipMethod method, CalComponent *comp, CalClient *client, icalcomponent *zones) +static gboolean +comp_server_send (CalComponentItipMethod method, CalComponent *comp, CalClient *client, + icalcomponent *zones, GList **users) { - CalClientResult result; + CalClientSendResult result; icalcomponent *top_level, *new_top_level = NULL; - GList *users = NULL; + char error_msg[256]; + gboolean retval = FALSE; top_level = comp_toplevel_with_zones (method, comp, client, zones); - result = cal_client_send_object (client, top_level, &new_top_level, &users); + result = cal_client_send_object (client, top_level, &new_top_level, users, error_msg); if (result == CAL_CLIENT_SEND_SUCCESS) { icalcomponent *ical_comp; @@ -538,11 +540,17 @@ comp_server_send (CalComponentItipMethod method, CalComponent *comp, CalClient * icalcomponent_remove_component (new_top_level, ical_comp); cal_component_set_icalcomponent (comp, ical_comp); icalcomponent_free (new_top_level); + + retval = TRUE; + } else if (result == CAL_CLIENT_SEND_BUSY) { + e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, error_msg); + + retval = FALSE; } icalcomponent_free (top_level); - return users; + return retval; } static gboolean @@ -800,7 +808,8 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp, composer_server = BONOBO_OBJREF (bonobo_server); /* Give the server a chance to manipulate the comp */ - users = comp_server_send (method, send_comp, client, zones); + if (!comp_server_send (method, send_comp, client, zones, &users)) + goto cleanup; /* Tidy up the comp */ comp = comp_compliant (method, send_comp); diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl index 1153b5307d..d235d11061 100644 --- a/calendar/idl/evolution-calendar.idl +++ b/calendar/idl/evolution-calendar.idl @@ -132,7 +132,7 @@ module Calendar { exception InvalidObject {}; exception CouldNotCreate {}; exception PermissionDenied {}; - exception Busy {}; + exception Busy {string errorMsg;}; /* A calendar is identified by its URI */ readonly attribute string uri; diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c index 9b531412e8..f4992f2952 100644 --- a/calendar/pcs/cal-backend-file.c +++ b/calendar/pcs/cal-backend-file.c @@ -126,7 +126,8 @@ static CalBackendResult cal_backend_file_remove_object (CalBackend *backend, con static CalBackendSendResult cal_backend_file_send_object (CalBackend *backend, const char *calobj, gchar **new_calobj, - GNOME_Evolution_Calendar_UserList **user_list); + GNOME_Evolution_Calendar_UserList **user_list, + char error_msg[256]); static icaltimezone* cal_backend_file_get_timezone (CalBackend *backend, const char *tzid); static icaltimezone* cal_backend_file_get_default_timezone (CalBackend *backend); @@ -1904,7 +1905,7 @@ cal_backend_file_remove_object (CalBackend *backend, const char *uid) static CalBackendSendResult cal_backend_file_send_object (CalBackend *backend, const char *calobj, char **new_calobj, - GNOME_Evolution_Calendar_UserList **user_list) + GNOME_Evolution_Calendar_UserList **user_list, char error_msg[256]) { *new_calobj = g_strdup (calobj); diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index 02254f07c5..0954c53472 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -712,14 +712,14 @@ cal_backend_remove_object (CalBackend *backend, const char *uid) CalBackendSendResult cal_backend_send_object (CalBackend *backend, const char *calobj, char **new_calobj, - GNOME_Evolution_Calendar_UserList **user_list) + GNOME_Evolution_Calendar_UserList **user_list, char error_msg[256]) { g_return_val_if_fail (backend != NULL, CAL_BACKEND_SEND_INVALID_OBJECT); g_return_val_if_fail (IS_CAL_BACKEND (backend), CAL_BACKEND_SEND_INVALID_OBJECT); g_return_val_if_fail (calobj != NULL, CAL_BACKEND_SEND_INVALID_OBJECT); g_assert (CLASS (backend)->send_object != NULL); - return (* CLASS (backend)->send_object) (backend, calobj, new_calobj, user_list); + return (* CLASS (backend)->send_object) (backend, calobj, new_calobj, user_list, error_msg); } /** diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h index 69efb86c1a..737a1604e8 100644 --- a/calendar/pcs/cal-backend.h +++ b/calendar/pcs/cal-backend.h @@ -133,7 +133,8 @@ struct _CalBackendClass { CalBackendResult (* remove_object) (CalBackend *backend, const char *uid); CalBackendSendResult (* send_object) (CalBackend *backend, const char *calobj, char **new_calobj, - GNOME_Evolution_Calendar_UserList **user_list); + GNOME_Evolution_Calendar_UserList **user_list, + char error_msg[256]); /* Timezone related virtual methods */ icaltimezone *(* get_timezone) (CalBackend *backend, const char *tzid); @@ -195,7 +196,8 @@ CalBackendResult cal_backend_update_objects (CalBackend *backend, const char *ca CalBackendResult cal_backend_remove_object (CalBackend *backend, const char *uid); CalBackendSendResult cal_backend_send_object (CalBackend *backend, const char *calobj, char **new_calobj, - GNOME_Evolution_Calendar_UserList **user_list); + GNOME_Evolution_Calendar_UserList **user_list, + char error_msg[256]); icaltimezone* cal_backend_get_timezone (CalBackend *backend, const char *tzid); icaltimezone* cal_backend_get_default_timezone (CalBackend *backend); diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index 3abff9cf98..321a7c23db 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -452,12 +452,14 @@ impl_Cal_send_object (PortableServer_Servant servant, CalPrivate *priv; CORBA_char *calobj_copy; char *new_calobj; + GNOME_Evolution_Calendar_Cal_Busy *err; CalBackendSendResult result; + char error_msg[256]; cal = CAL (bonobo_object_from_servant (servant)); priv = cal->priv; - result = cal_backend_send_object (priv->backend, calobj, &new_calobj, user_list); + result = cal_backend_send_object (priv->backend, calobj, &new_calobj, user_list, error_msg); switch (result) { case CAL_BACKEND_SEND_SUCCESS: calobj_copy = CORBA_string_dup (new_calobj); @@ -470,7 +472,9 @@ impl_Cal_send_object (PortableServer_Servant servant, break; case CAL_BACKEND_SEND_BUSY: - bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_Busy); + err = GNOME_Evolution_Calendar_Cal_Busy__alloc (); + err->errorMsg = CORBA_string_dup (error_msg); + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Calendar_Cal_Busy, err); break; case CAL_BACKEND_SEND_PERMISSION_DENIED: |