aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/cal-client
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2002-05-17 00:41:35 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2002-05-17 00:41:35 +0800
commit48140af35f90d7ec4f994821a5265b1fe0159cfa (patch)
treedd2bde3e78c4fd5db7a97dbb754b59edf66bbb4e /calendar/cal-client
parentaad3ac6ddd62d5cd1b3421f5bf45ccdcf1b0ed35 (diff)
downloadgsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.tar
gsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.tar.gz
gsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.tar.bz2
gsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.tar.lz
gsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.tar.xz
gsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.tar.zst
gsoc2013-evolution-48140af35f90d7ec4f994821a5265b1fe0159cfa.zip
added PermissionDenied exception and make it be raised in open,
2002-05-16 Rodrigo Moya <rodrigo@ximian.com> * idl/evolution-calendar.idl: added PermissionDenied exception and make it be raised in open, updateObjects and removeObject. * pcs/cal-backend.h: added CAL_BACKEND_OPEN_PERMISSION_DENIED to CalBackendOpenStatus enumeration, added CalBackendResult enumeration. * pcs/cal.c: * pcs/cal-backend.c: * pcs/cal-backend-file.c: adapted to changes in update_objects and remove_object methods. * cal-client/cal-client.[ch]: added CalClientResult enumeration. (cal_client_update_object, cal_client_update_objects, cal_client_remove_object): changed to return a CalClientResult. * conduits/calendar/calendar-conduit.c: * calendar/conduits/todo/todo-conduit.c: * importers/icalendar-importer.c: * gui/dialogs/comp-editor.c: * gui/calendar-model.c: * gui/e-calendar-table.c: * gui/e-day-view.c: * gui/e-itip-control.c: * gui/e-week-view.c: * gui/comp-util.c: * gui/e-tasks.c: * gui/tasks-migrate.c: adapted to changes in cal_client_update_object(s) and cal_client_remove_object. svn path=/trunk/; revision=16932
Diffstat (limited to 'calendar/cal-client')
-rw-r--r--calendar/cal-client/cal-client.c99
-rw-r--r--calendar/cal-client/cal-client.h15
2 files changed, 62 insertions, 52 deletions
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index 30402bf126..612da541f5 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -2240,7 +2240,6 @@ cal_client_get_component_as_string (CalClient *client,
TRUE);
}
-
/**
* cal_client_update_object:
* @client: A calendar client.
@@ -2251,47 +2250,49 @@ cal_client_get_component_as_string (CalClient *client,
* assume that the object is actually in the server's storage until it has
* received the "obj_updated" notification signal.
*
- * Return value: TRUE on success, FALSE on specifying an invalid component.
+ * Return value: a #CalClientResult value indicating the result of the
+ * operation.
**/
-gboolean
+CalClientResult
cal_client_update_object (CalClient *client, CalComponent *comp)
{
CalClientPrivate *priv;
CORBA_Environment ev;
- gboolean retval;
+ CalClientResult retval;
char *obj_string;
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
+ g_return_val_if_fail (client != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_RESULT_INVALID_OBJECT);
priv = client->priv;
- g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, FALSE);
+ g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, CAL_CLIENT_RESULT_INVALID_OBJECT);
- g_return_val_if_fail (comp != NULL, FALSE);
-
- retval = FALSE;
+ g_return_val_if_fail (comp != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT);
cal_component_commit_sequence (comp);
obj_string = cal_client_get_component_as_string_internal (client,
comp, FALSE);
if (obj_string == NULL)
- return FALSE;
+ return CAL_CLIENT_RESULT_INVALID_OBJECT;
CORBA_exception_init (&ev);
GNOME_Evolution_Calendar_Cal_updateObjects (priv->cal, obj_string, &ev);
g_free (obj_string);
if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject))
- goto out;
+ retval = CAL_CLIENT_RESULT_INVALID_OBJECT;
+ else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_NotFound))
+ retval = CAL_CLIENT_RESULT_NOT_FOUND;
+ else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_PermissionDenied))
+ retval = CAL_CLIENT_RESULT_PERMISSION_DENIED;
else if (BONOBO_EX (&ev)) {
g_message ("cal_client_update_object(): could not update the object");
- goto out;
+ retval = CAL_CLIENT_RESULT_CORBA_ERROR;
}
+ else
+ retval = CAL_CLIENT_RESULT_SUCCESS;
- retval = TRUE;
-
- out:
CORBA_exception_free (&ev);
return retval;
}
@@ -2311,26 +2312,25 @@ cal_client_update_object (CalClient *client, CalComponent *comp)
* server's storage until it has received the "obj_updated" notification
* signal.
*
- * Return value: TRUE on success, FALSE on specifying an invalid component.
+ * Return value: a #CalClientResult value indicating the result of the
+ * operation.
**/
-gboolean
+CalClientResult
cal_client_update_objects (CalClient *client, icalcomponent *icalcomp)
{
CalClientPrivate *priv;
CORBA_Environment ev;
- gboolean retval;
+ CalClientResult retval;
char *obj_string;
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
+ g_return_val_if_fail (client != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_RESULT_INVALID_OBJECT);
priv = client->priv;
g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED,
- FALSE);
+ CAL_CLIENT_RESULT_INVALID_OBJECT);
- g_return_val_if_fail (icalcomp != NULL, FALSE);
-
- retval = FALSE;
+ g_return_val_if_fail (icalcomp != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT);
/* Libical owns this memory, using one of its temporary buffers. */
obj_string = icalcomponent_as_ical_string (icalcomp);
@@ -2339,18 +2339,20 @@ cal_client_update_objects (CalClient *client, icalcomponent *icalcomp)
GNOME_Evolution_Calendar_Cal_updateObjects (priv->cal, obj_string, &ev);
if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject))
- goto out;
+ retval = CAL_CLIENT_RESULT_INVALID_OBJECT;
+ else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_NotFound))
+ retval = CAL_CLIENT_RESULT_NOT_FOUND;
+ else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_PermissionDenied))
+ retval = CAL_CLIENT_RESULT_PERMISSION_DENIED;
else if (BONOBO_EX (&ev)) {
g_message ("cal_client_update_objects(): could not update the objects");
- goto out;
+ retval = CAL_CLIENT_RESULT_CORBA_ERROR;
}
+ else
+ retval = CAL_CLIENT_RESULT_SUCCESS;
- retval = TRUE;
-
- out:
CORBA_exception_free (&ev);
return retval;
-
}
@@ -2363,41 +2365,40 @@ cal_client_update_objects (CalClient *client, icalcomponent *icalcomp)
* component, all clients will be notified and they will emit the "obj_removed"
* signal.
*
- * Return value: TRUE on success, FALSE on specifying a UID for a component that
- * is not in the server. Returning FALSE is normal; the object may have
- * disappeared from the server before the client has had a chance to receive the
- * corresponding notification.
+ * Return value: a #CalClientResult value indicating the result of the
+ * operation.
**/
-gboolean
+CalClientResult
cal_client_remove_object (CalClient *client, const char *uid)
{
CalClientPrivate *priv;
CORBA_Environment ev;
- gboolean retval;
+ CalClientResult retval;
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
+ g_return_val_if_fail (client != NULL, CAL_CLIENT_RESULT_INVALID_OBJECT);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), CAL_CLIENT_RESULT_INVALID_OBJECT);
priv = client->priv;
- g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, FALSE);
+ g_return_val_if_fail (priv->load_state == CAL_CLIENT_LOAD_LOADED, CAL_CLIENT_RESULT_INVALID_OBJECT);
- g_return_val_if_fail (uid != NULL, FALSE);
-
- retval = FALSE;
+ g_return_val_if_fail (uid != NULL, CAL_CLIENT_RESULT_NOT_FOUND);
CORBA_exception_init (&ev);
GNOME_Evolution_Calendar_Cal_removeObject (priv->cal, (char *) uid, &ev);
- if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_NotFound))
- goto out;
+ if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject))
+ retval = CAL_CLIENT_RESULT_INVALID_OBJECT;
+ else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_NotFound))
+ retval = CAL_CLIENT_RESULT_NOT_FOUND;
+ else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_Cal_PermissionDenied))
+ retval = CAL_CLIENT_RESULT_PERMISSION_DENIED;
else if (BONOBO_EX (&ev)) {
g_message ("cal_client_remove_object(): could not remove the object");
- goto out;
+ retval = CAL_CLIENT_RESULT_CORBA_ERROR;
}
+ else
+ retval = CAL_CLIENT_RESULT_SUCCESS;
- retval = TRUE;
-
- out:
CORBA_exception_free (&ev);
return retval;
}
diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h
index a362059f3a..4a977e5a56 100644
--- a/calendar/cal-client/cal-client.h
+++ b/calendar/cal-client/cal-client.h
@@ -64,6 +64,15 @@ typedef enum {
CAL_CLIENT_GET_SYNTAX_ERROR
} CalClientGetStatus;
+/* Status for update_object(s) and remove_object */
+typedef enum {
+ CAL_CLIENT_RESULT_SUCCESS,
+ CAL_CLIENT_RESULT_CORBA_ERROR,
+ CAL_CLIENT_RESULT_INVALID_OBJECT,
+ CAL_CLIENT_RESULT_NOT_FOUND,
+ CAL_CLIENT_RESULT_PERMISSION_DENIED
+} CalClientResult;
+
/* Whether the client is not loaded, is being loaded, or is already loaded */
typedef enum {
CAL_CLIENT_LOAD_NOT_LOADED,
@@ -158,12 +167,12 @@ gboolean cal_client_get_alarms_for_object (CalClient *client, const char *uid,
/* Add or update a single object. When adding an object only builtin timezones
are allowed. To use external VTIMEZONE data call update_objects() instead.*/
-gboolean cal_client_update_object (CalClient *client, CalComponent *comp);
+CalClientResult cal_client_update_object (CalClient *client, CalComponent *comp);
/* Add or update multiple objects, possibly including VTIMEZONE data. */
-gboolean cal_client_update_objects (CalClient *client, icalcomponent *icalcomp);
+CalClientResult cal_client_update_objects (CalClient *client, icalcomponent *icalcomp);
-gboolean cal_client_remove_object (CalClient *client, const char *uid);
+CalClientResult cal_client_remove_object (CalClient *client, const char *uid);
CalQuery *cal_client_get_query (CalClient *client, const char *sexp);