diff options
Diffstat (limited to 'calendar/pcs')
-rw-r--r-- | calendar/pcs/cal-backend-file.c | 12 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.c | 20 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.h | 4 | ||||
-rw-r--r-- | calendar/pcs/cal.c | 25 |
4 files changed, 61 insertions, 0 deletions
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c index 0e3c71c548..70b56be130 100644 --- a/calendar/pcs/cal-backend-file.c +++ b/calendar/pcs/cal-backend-file.c @@ -91,6 +91,7 @@ static void cal_backend_file_init (CalBackendFile *cbfile); static void cal_backend_file_destroy (GtkObject *object); static const char *cal_backend_file_get_uri (CalBackend *backend); +static const char *cal_backend_file_get_email_address (CalBackend *backend); static CalBackendOpenStatus cal_backend_file_open (CalBackend *backend, const char *uristr, gboolean only_if_exists); @@ -187,6 +188,7 @@ cal_backend_file_class_init (CalBackendFileClass *class) object_class->destroy = cal_backend_file_destroy; backend_class->get_uri = cal_backend_file_get_uri; + backend_class->get_email_address = cal_backend_file_get_email_address; backend_class->open = cal_backend_file_open; backend_class->is_loaded = cal_backend_file_is_loaded; backend_class->get_query = cal_backend_file_get_query; @@ -449,6 +451,16 @@ cal_backend_file_get_uri (CalBackend *backend) return (const char *) priv->uri; } +/* Get_email_address handler for the file backend */ +static const char * +cal_backend_file_get_email_address (CalBackend *backend) +{ + /* A file backend has no particular email address associated + * with it (although that would be a useful feature some day). + */ + return NULL; +} + /* Used from g_hash_table_foreach(), adds a category name to the sequence */ static void add_category_cb (gpointer key, gpointer value, gpointer data) diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index 0954c53472..19f8261797 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -141,6 +141,7 @@ cal_backend_class_init (CalBackendClass *class) class->obj_removed = NULL; class->get_uri = NULL; + class->get_email_address = NULL; class->open = NULL; class->is_loaded = NULL; class->get_query = NULL; @@ -182,6 +183,25 @@ cal_backend_get_uri (CalBackend *backend) return (* CLASS (backend)->get_uri) (backend); } +/** + * cal_backend_get_email_address: + * @backend: A calendar backend. + * + * Queries the email address associated with a calendar backend, which + * must already have an open calendar. + * + * Return value: The email address associated with the calendar. + **/ +const char * +cal_backend_get_email_address (CalBackend *backend) +{ + g_return_val_if_fail (backend != NULL, NULL); + g_return_val_if_fail (IS_CAL_BACKEND (backend), NULL); + + g_assert (CLASS (backend)->get_email_address != NULL); + return (* CLASS (backend)->get_email_address) (backend); +} + /* Callback used when a Cal is destroyed */ static void cal_destroy_cb (GtkObject *object, gpointer data) diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h index 737a1604e8..af11be14e8 100644 --- a/calendar/pcs/cal-backend.h +++ b/calendar/pcs/cal-backend.h @@ -93,6 +93,8 @@ struct _CalBackendClass { /* Virtual methods */ const char *(* get_uri) (CalBackend *backend); + const char *(* get_email_address) (CalBackend *backend); + CalBackendOpenStatus (* open) (CalBackend *backend, const char *uristr, gboolean only_if_exists); @@ -146,6 +148,8 @@ GtkType cal_backend_get_type (void); const char *cal_backend_get_uri (CalBackend *backend); +const char *cal_backend_get_email_address (CalBackend *backend); + void cal_backend_add_cal (CalBackend *backend, Cal *cal); CalBackendOpenStatus cal_backend_open (CalBackend *backend, const char *uristr, diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index a266977cbc..31580e62e4 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -64,6 +64,30 @@ impl_Cal_get_uri (PortableServer_Servant servant, return str_uri_copy; } +/* Cal::get_email_address method */ +static CORBA_char * +impl_Cal_get_email_address (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + Cal *cal; + CalPrivate *priv; + const char *str_email_address; + CORBA_char *str_email_address_copy; + + cal = CAL (bonobo_object_from_servant (servant)); + priv = cal->priv; + + str_email_address = cal_backend_get_email_address (priv->backend); + if (str_email_address == NULL) { + bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_NotFound); + return CORBA_OBJECT_NIL; + } + + str_email_address_copy = CORBA_string_dup (str_email_address); + + return str_email_address_copy; +} + /* Converts a calendar object type from its CORBA representation to our own * representation. */ @@ -707,6 +731,7 @@ cal_class_init (CalClass *klass) /* Epv methods */ epv->_get_uri = impl_Cal_get_uri; + epv->getEmailAddress = impl_Cal_get_email_address; epv->setMode = impl_Cal_set_mode; epv->countObjects = impl_Cal_get_n_objects; epv->getObject = impl_Cal_get_object; |