diff options
-rw-r--r-- | calendar/ChangeLog | 15 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.c | 31 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.h | 2 | ||||
-rw-r--r-- | calendar/idl/evolution-calendar.idl | 3 | ||||
-rw-r--r-- | calendar/pcs/cal-backend-file.c | 10 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.c | 23 | ||||
-rw-r--r-- | calendar/pcs/cal-backend.h | 3 | ||||
-rw-r--r-- | calendar/pcs/cal.c | 17 |
8 files changed, 103 insertions, 1 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index bfed9faa20..ebc7cbfb3b 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,20 @@ 2002-10-01 Rodrigo Moya <rodrigo@ximian.com> + * idl/evolution-calendar.idl: added isReadOnly method to Cal + interface. + + * pcs/cal.c (impl_Cal_is_read_only): new method implementation. + + * pcs/cal-backend.[ch]: added is_read_only method to CalBackend class. + (cal_backend_is_read_only): new function. + + * pcs/cal-backend-file.c (cal_backend_file_is_read_only): new method. + (cal_backend_file_class_init): set new signal's virtual method. + + * cal-client/cal-client.[ch] (cal_client_is_read_only): new function. + +2002-10-01 Rodrigo Moya <rodrigo@ximian.com> + Fixes #15710 * gui/dialogs/alarm-page.c (alarm_page_init): added a diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index 21932ed464..0f270c05bc 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -1019,6 +1019,37 @@ cal_client_get_uri (CalClient *client) } /** + * cal_client_is_read_only: + * @client: A calendar client. + * + * Queries whether the calendar client can perform modifications + * on the calendar or not. + * + * Return value: TRUE if the calendar is read-only, FALSE otherwise. + */ +gboolean +cal_client_is_read_only (CalClient *client) +{ + CalClientPrivate *priv; + CORBA_Environment ev; + CORBA_boolean read_only; + + g_return_val_if_fail (client != NULL, NULL); + g_return_val_if_fail (IS_CAL_CLIENT (client), NULL); + + priv = client->priv; + + CORBA_exception_init (&ev); + read_only = GNOME_Evolution_Calendar_Cal_isReadOnly (priv->cal, &ev); + if (BONOBO_EX (&ev)) { + g_message ("cal_client_is_read_only: could not call isReadOnly method"); + } + CORBA_exception_free (&ev); + + return read_only; +} + +/** * cal_client_get_email_address: * @client: A calendar client. * diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h index f636bf4896..e7a1649a0c 100644 --- a/calendar/cal-client/cal-client.h +++ b/calendar/cal-client/cal-client.h @@ -143,6 +143,8 @@ CalClientLoadState cal_client_get_load_state (CalClient *client); const char *cal_client_get_uri (CalClient *client); +gboolean cal_client_is_read_only (CalClient *client); + const char *cal_client_get_email_address (CalClient *client); gboolean cal_client_set_mode (CalClient *client, CalMode mode); diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl index e5a6e92c27..78fe0ba07a 100644 --- a/calendar/idl/evolution-calendar.idl +++ b/calendar/idl/evolution-calendar.idl @@ -137,6 +137,9 @@ module Calendar { /* A calendar is identified by its URI */ readonly attribute string uri; + /* Check write permissions for calendar */ + boolean isReadOnly (); + /* Return the email address associated with this calendar, if any. */ string getEmailAddress () diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c index 70b56be130..4fd65904cc 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 gboolean cal_backend_file_is_read_only (CalBackend *backend); static const char *cal_backend_file_get_email_address (CalBackend *backend); static CalBackendOpenStatus cal_backend_file_open (CalBackend *backend, const char *uristr, @@ -188,6 +189,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->is_read_only = cal_backend_file_is_read_only; 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; @@ -451,6 +453,14 @@ cal_backend_file_get_uri (CalBackend *backend) return (const char *) priv->uri; } +/* Is_read_only handler for the file backend */ +static gboolean +cal_backend_file_is_read_only (CalBackend *backend) +{ + /* we just return FALSE, since all calendars are read-write */ + return FALSE; +} + /* Get_email_address handler for the file backend */ static const char * cal_backend_file_get_email_address (CalBackend *backend) diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c index 19f8261797..95bc26b093 100644 --- a/calendar/pcs/cal-backend.c +++ b/calendar/pcs/cal-backend.c @@ -144,6 +144,7 @@ cal_backend_class_init (CalBackendClass *class) class->get_email_address = NULL; class->open = NULL; class->is_loaded = NULL; + class->is_read_only = NULL; class->get_query = NULL; class->get_mode = NULL; class->set_mode = NULL; @@ -319,6 +320,28 @@ cal_backend_is_loaded (CalBackend *backend) } /** + * cal_backend_is_read_only + * @backend: A calendar backend. + * + * Queries whether a calendar backend is read only or not. + * + * Return value: TRUE if the calendar is read only, FALSE otherwise. + */ +gboolean +cal_backend_is_read_only (CalBackend *backend) +{ + gboolean result; + + g_return_val_if_fail (backend != NULL, FALSE); + g_return_val_if_fail (IS_CAL_BACKEND (backend), FALSE); + + g_assert (CLASS (backend)->is_read_only != NULL); + result = (* CLASS (backend)->is_read_only) (backend); + + return result; +} + +/** * cal_backend_get_query: * @backend: A calendar backend. * @ql: The query listener. diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h index af11be14e8..8bc71ac91e 100644 --- a/calendar/pcs/cal-backend.h +++ b/calendar/pcs/cal-backend.h @@ -99,6 +99,7 @@ struct _CalBackendClass { gboolean only_if_exists); gboolean (* is_loaded) (CalBackend *backend); + gboolean (* is_read_only) (CalBackend *backend); Query *(* get_query) (CalBackend *backend, GNOME_Evolution_Calendar_QueryListener ql, @@ -157,6 +158,8 @@ CalBackendOpenStatus cal_backend_open (CalBackend *backend, const char *uristr, gboolean cal_backend_is_loaded (CalBackend *backend); +gboolean cal_backend_is_read_only (CalBackend *backend); + Query *cal_backend_get_query (CalBackend *backend, GNOME_Evolution_Calendar_QueryListener ql, const char *sexp); diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index 31580e62e4..60fcdc59ad 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -48,7 +48,7 @@ struct _CalPrivate { /* Cal::get_uri method */ static CORBA_char * impl_Cal_get_uri (PortableServer_Servant servant, - CORBA_Environment *ev) + CORBA_Environment *ev) { Cal *cal; CalPrivate *priv; @@ -64,6 +64,20 @@ impl_Cal_get_uri (PortableServer_Servant servant, return str_uri_copy; } +/* Cal::is_read_only method */ +static CORBA_boolean +impl_Cal_is_read_only (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + Cal *cal; + CalPrivate *priv; + + cal = CAL (bonobo_object_from_servant (servant)); + priv = cal->priv; + + return cal_backend_is_read_only (priv->backend); +} + /* Cal::get_email_address method */ static CORBA_char * impl_Cal_get_email_address (PortableServer_Servant servant, @@ -731,6 +745,7 @@ cal_class_init (CalClass *klass) /* Epv methods */ epv->_get_uri = impl_Cal_get_uri; + epv->isReadOnly = impl_Cal_is_read_only; epv->getEmailAddress = impl_Cal_get_email_address; epv->setMode = impl_Cal_set_mode; epv->countObjects = impl_Cal_get_n_objects; |