aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/pcs')
-rw-r--r--calendar/pcs/cal-backend-file.c16
-rw-r--r--calendar/pcs/cal-backend.c13
-rw-r--r--calendar/pcs/cal-backend.h14
-rw-r--r--calendar/pcs/cal.c44
4 files changed, 87 insertions, 0 deletions
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index ad15d0433c..9b531412e8 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -124,6 +124,10 @@ static CalBackendResult cal_backend_file_update_objects (CalBackend *backend,
const char *calobj);
static CalBackendResult cal_backend_file_remove_object (CalBackend *backend, const char *uid);
+static CalBackendSendResult cal_backend_file_send_object (CalBackend *backend,
+ const char *calobj, gchar **new_calobj,
+ GNOME_Evolution_Calendar_UserList **user_list);
+
static icaltimezone* cal_backend_file_get_timezone (CalBackend *backend, const char *tzid);
static icaltimezone* cal_backend_file_get_default_timezone (CalBackend *backend);
static gboolean cal_backend_file_set_default_timezone (CalBackend *backend,
@@ -199,6 +203,7 @@ cal_backend_file_class_init (CalBackendFileClass *class)
backend_class->get_alarms_for_object = cal_backend_file_get_alarms_for_object;
backend_class->update_objects = cal_backend_file_update_objects;
backend_class->remove_object = cal_backend_file_remove_object;
+ backend_class->send_object = cal_backend_file_send_object;
backend_class->get_timezone = cal_backend_file_get_timezone;
backend_class->get_default_timezone = cal_backend_file_get_default_timezone;
@@ -1897,6 +1902,17 @@ cal_backend_file_remove_object (CalBackend *backend, const char *uid)
return CAL_BACKEND_RESULT_SUCCESS;
}
+static CalBackendSendResult
+cal_backend_file_send_object (CalBackend *backend, const char *calobj, char **new_calobj,
+ GNOME_Evolution_Calendar_UserList **user_list)
+{
+ *new_calobj = g_strdup (calobj);
+
+ *user_list = GNOME_Evolution_Calendar_UserList__alloc ();
+ (*user_list)->_length = 0;
+
+ return CAL_BACKEND_SEND_SUCCESS;
+}
static icaltimezone*
cal_backend_file_get_timezone (CalBackend *backend, const char *tzid)
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index 50aeb148e2..02254f07c5 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -158,6 +158,7 @@ cal_backend_class_init (CalBackendClass *class)
class->get_alarms_for_object = NULL;
class->update_objects = NULL;
class->remove_object = NULL;
+ class->send_object = NULL;
}
@@ -709,6 +710,18 @@ cal_backend_remove_object (CalBackend *backend, const char *uid)
return (* CLASS (backend)->remove_object) (backend, uid);
}
+CalBackendSendResult
+cal_backend_send_object (CalBackend *backend, const char *calobj, char **new_calobj,
+ GNOME_Evolution_Calendar_UserList **user_list)
+{
+ 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);
+}
+
/**
* cal_backend_last_client_gone:
* @backend: A calendar backend.
diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h
index b3647d9720..69efb86c1a 100644
--- a/calendar/pcs/cal-backend.h
+++ b/calendar/pcs/cal-backend.h
@@ -59,6 +59,14 @@ typedef enum {
CAL_BACKEND_RESULT_PERMISSION_DENIED
} CalBackendResult;
+/* Send result values */
+typedef enum {
+ CAL_BACKEND_SEND_SUCCESS,
+ CAL_BACKEND_SEND_INVALID_OBJECT,
+ CAL_BACKEND_SEND_BUSY,
+ CAL_BACKEND_SEND_PERMISSION_DENIED,
+} CalBackendSendResult;
+
/* Result codes for ::get_alarms_in_range() */
typedef enum {
CAL_BACKEND_GET_ALARMS_SUCCESS,
@@ -124,6 +132,9 @@ struct _CalBackendClass {
CalBackendResult (* update_objects) (CalBackend *backend, const char *calobj);
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);
+
/* Timezone related virtual methods */
icaltimezone *(* get_timezone) (CalBackend *backend, const char *tzid);
icaltimezone *(* get_default_timezone) (CalBackend *backend);
@@ -183,6 +194,9 @@ 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);
+
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 26ed90de76..4f8ff173f0 100644
--- a/calendar/pcs/cal.c
+++ b/calendar/pcs/cal.c
@@ -441,6 +441,49 @@ impl_Cal_remove_object (PortableServer_Servant servant,
}
}
+/* Cal::send_object method */
+static GNOME_Evolution_Calendar_CalObj
+impl_Cal_send_object (PortableServer_Servant servant,
+ const GNOME_Evolution_Calendar_CalObj calobj,
+ GNOME_Evolution_Calendar_UserList **user_list,
+ CORBA_Environment *ev)
+{
+ Cal *cal;
+ CalPrivate *priv;
+ CORBA_char *calobj_copy;
+ char *new_calobj;
+ CalBackendSendResult result;
+
+ cal = CAL (bonobo_object_from_servant (servant));
+ priv = cal->priv;
+
+ result = cal_backend_send_object (priv->backend, calobj, &new_calobj, user_list);
+ switch (result) {
+ case CAL_BACKEND_SEND_SUCCESS:
+ calobj_copy = CORBA_string_dup (calobj);
+ g_free (new_calobj);
+
+ return calobj_copy;
+
+ case CAL_BACKEND_SEND_INVALID_OBJECT:
+ bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_InvalidObject);
+ break;
+
+ case CAL_BACKEND_SEND_BUSY:
+ bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_Busy);
+ break;
+
+ case CAL_BACKEND_SEND_PERMISSION_DENIED:
+ bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_PermissionDenied);
+ break;
+
+ default :
+ g_assert_not_reached ();
+ }
+
+ return NULL;
+}
+
/* Cal::getQuery implementation */
static GNOME_Evolution_Calendar_Query
impl_Cal_get_query (PortableServer_Servant servant,
@@ -671,6 +714,7 @@ cal_class_init (CalClass *klass)
epv->getAlarmsForObject = impl_Cal_get_alarms_for_object;
epv->updateObjects = impl_Cal_update_objects;
epv->removeObject = impl_Cal_remove_object;
+ epv->sendObject = impl_Cal_send_object;
epv->getQuery = impl_Cal_get_query;
}