[evolution-data-server/account-mgmt: 11/28] Adapt libecal to the new ESource API.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/account-mgmt: 11/28] Adapt libecal to the new ESource API.
- Date: Wed, 2 Mar 2011 03:45:57 +0000 (UTC)
commit 8effe8a64e55f029658c5e7e935f1479c8075be3
Author: Matthew Barnes <mbarnes redhat com>
Date: Sat Nov 13 10:00:02 2010 -0500
Adapt libecal to the new ESource API.
calendar/libecal/e-cal.c | 574 +++++++-------------
calendar/libecal/e-cal.h | 10 +-
calendar/tests/ecal/Makefile.am | 3 -
calendar/tests/ecal/ecal-test-utils.c | 48 +--
calendar/tests/ecal/ecal-test-utils.h | 7 -
calendar/tests/ecal/test-ecal-add-timezone.c | 1 -
calendar/tests/ecal/test-ecal-create-object.c | 2 -
.../tests/ecal/test-ecal-get-alarm-email-address.c | 2 -
calendar/tests/ecal/test-ecal-get-cal-address.c | 2 -
calendar/tests/ecal/test-ecal-get-capabilities.c | 1 -
calendar/tests/ecal/test-ecal-get-default-object.c | 2 -
calendar/tests/ecal/test-ecal-get-free-busy.c | 2 -
calendar/tests/ecal/test-ecal-get-ldap-attribute.c | 2 -
calendar/tests/ecal/test-ecal-get-object-list.c | 2 -
.../tests/ecal/test-ecal-get-objects-for-uid.c | 2 -
calendar/tests/ecal/test-ecal-get-query.c | 3 -
calendar/tests/ecal/test-ecal-get-timezone.c | 2 -
calendar/tests/ecal/test-ecal-modify-object.c | 3 -
calendar/tests/ecal/test-ecal-open.c | 3 -
calendar/tests/ecal/test-ecal-receive-objects.c | 2 -
calendar/tests/ecal/test-ecal-remove-object.c | 1 -
calendar/tests/ecal/test-ecal-remove.c | 21 -
calendar/tests/ecal/test-ecal-send-objects.c | 2 -
.../tests/ecal/test-ecal-set-default-timezone.c | 1 -
calendar/tests/ecal/test-ecal-set-mode.c | 2 -
.../tests/ecal/test-ecal-stress-factory--fifo.c | 4 -
.../ecal/test-ecal-stress-factory--open-async.c | 1 -
.../tests/ecal/test-ecal-stress-factory--serial.c | 1 -
.../ecal/test-ecal-stress-factory--single-cal.c | 5 +-
calendar/tests/ecal/test-ecal.c | 28 +-
calendar/tests/ecal/test-recur.c | 4 +-
calendar/tests/ecal/test-search.c | 4 +-
.../calendar/libecal/libecal-sections.txt | 3 -
docs/reference/calendar/libecal/tmpl/e-cal.sgml | 31 +-
.../calendar/libecal/tmpl/libecal-unused.sgml | 26 +
35 files changed, 243 insertions(+), 564 deletions(-)
---
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index f1efd8c..ff7cb4d 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -41,6 +41,8 @@
#include <libical/ical.h>
#include <libedataserver/e-url.h>
#include <libedataserver/e-data-server-util.h>
+#include <libedataserver/e-source-authentication.h>
+#include <libedataserver/e-source-registry.h>
#include <glib-object.h>
@@ -85,11 +87,7 @@ struct _ECalPrivate {
/* Load state to avoid multiple loads */
ECalLoadState load_state;
- /* URI of the calendar that is being loaded or is already loaded, or
- * NULL if we are not loaded.
- */
ESource *source;
- gchar *uri;
ECalSourceType type;
/* Email address associated with this calendar, or NULL */
@@ -415,7 +413,6 @@ e_cal_init (ECal *ecal)
ecal->priv = priv = E_CAL_GET_PRIVATE (ecal);
priv->load_state = E_CAL_LOAD_NOT_LOADED;
- priv->uri = NULL;
priv->local_attachment_store = NULL;
priv->cal_address = NULL;
@@ -533,11 +530,6 @@ e_cal_finalize (GObject *object)
priv->source = NULL;
}
- if (priv->uri) {
- g_free (priv->uri);
- priv->uri = NULL;
- }
-
if (priv->local_attachment_store) {
g_free (priv->local_attachment_store);
priv->local_attachment_store = NULL;
@@ -865,10 +857,10 @@ set_local_attachment_store (ECal *ecal)
ECal *
e_cal_new (ESource *source, ECalSourceType type)
{
- ECal *ecal;
- ECalPrivate *priv;
- gchar *path, *xml;
+ ECal *cal;
+ gchar *path;
GError *error = NULL;
+ const gchar *uid;
GDBusConnection *connection;
g_return_val_if_fail (source && E_IS_SOURCE (source), NULL);
@@ -882,151 +874,86 @@ e_cal_new (ESource *source, ECalSourceType type)
return NULL;
}
- ecal = g_object_new (E_TYPE_CAL, NULL);
- priv = ecal->priv;
+ cal = g_object_new (E_TYPE_CAL, NULL);
+
+ cal->priv->source = g_object_ref (source);
+ cal->priv->type = type;
- priv->source = g_object_ref (source);
- priv->uri = e_source_get_uri (source);
- priv->type = type;
+ uid = e_source_get_uid (source);
- xml = e_source_to_standalone_xml (priv->source);
- if (!e_gdbus_cal_factory_call_get_cal_sync (cal_factory_proxy, xml, convert_type (priv->type), &path, NULL, &error)) {
- g_free (xml);
+ if (!e_gdbus_cal_factory_call_get_cal_sync (
+ cal_factory_proxy, uid, convert_type (cal->priv->type), &path, NULL, &error)) {
unwrap_gerror (&error);
g_warning ("Cannot get cal from factory: %s", error ? error->message : "Unknown error");
if (error)
g_error_free (error);
- g_object_unref (ecal);
+ g_object_unref (cal);
return NULL;
}
- g_free (xml);
- priv->gdbus_cal = e_gdbus_cal_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (cal_factory_proxy)),
+ cal->priv->gdbus_cal = e_gdbus_cal_proxy_new_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (cal_factory_proxy)),
G_DBUS_PROXY_FLAGS_NONE,
CALENDAR_DBUS_SERVICE_NAME,
path,
NULL,
&error);
- if (!priv->gdbus_cal) {
+ if (!cal->priv->gdbus_cal) {
g_free (path);
unwrap_gerror (&error);
g_warning ("Cannot create cal proxy: %s", error ? error->message : "Unknown error");
if (error)
g_error_free (error);
- g_object_unref (ecal);
+ g_object_unref (cal);
return NULL;
}
- connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (priv->gdbus_cal));
- priv->gone_signal_id = g_dbus_connection_signal_subscribe (connection,
+ connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (cal->priv->gdbus_cal));
+ cal->priv->gone_signal_id = g_dbus_connection_signal_subscribe (connection,
"org.freedesktop.DBus", /* sender */
"org.freedesktop.DBus", /* interface */
"NameOwnerChanged", /* member */
"/org/freedesktop/DBus", /* object_path */
CALENDAR_DBUS_SERVICE_NAME, /* arg0 */
G_DBUS_SIGNAL_FLAGS_NONE,
- gdbus_cal_connection_gone_cb, ecal, NULL);
- g_signal_connect (connection, "closed", G_CALLBACK (gdbus_cal_closed_cb), ecal);
+ gdbus_cal_connection_gone_cb, cal, NULL);
+ g_signal_connect (connection, "closed", G_CALLBACK (gdbus_cal_closed_cb), cal);
- g_signal_connect (priv->gdbus_cal, "auth-required", G_CALLBACK (auth_required_cb), ecal);
- g_signal_connect (priv->gdbus_cal, "backend-error", G_CALLBACK (backend_error_cb), ecal);
- g_signal_connect (priv->gdbus_cal, "readonly", G_CALLBACK (readonly_cb), ecal);
- g_signal_connect (priv->gdbus_cal, "mode", G_CALLBACK (mode_cb), ecal);
+ g_signal_connect (cal->priv->gdbus_cal, "auth-required", G_CALLBACK (auth_required_cb), cal);
+ g_signal_connect (cal->priv->gdbus_cal, "backend-error", G_CALLBACK (backend_error_cb), cal);
+ g_signal_connect (cal->priv->gdbus_cal, "readonly", G_CALLBACK (readonly_cb), cal);
+ g_signal_connect (cal->priv->gdbus_cal, "mode", G_CALLBACK (mode_cb), cal);
/* Set the local attachment store path for the calendar */
- set_local_attachment_store (ecal);
+ set_local_attachment_store (cal);
g_free (path);
- return ecal;
+ return cal;
}
-/* for each known source calls check_func, which should return TRUE if the required
- source have been found. Function returns NULL or the source on which was returned
- TRUE by the check_func. Non-NULL pointer should be unreffed by g_object_unref.
-
- 'sources' is an output parameter and cannot be NULL. When returned non-NULL, then
- should be freed with g_object_unref function. */
-static ESource *
-search_known_sources (ECalSourceType type, gboolean (*check_func)(ESource *source, gpointer user_data), gpointer user_data, ESourceList **sources, GError **error)
+static ECal *
+cal_new_system (ECalSourceType type,
+ GError **error)
{
- ESource *res = NULL;
- GSList *g;
- GError *err = NULL;
+ ESourceRegistry *registry;
+ ESource *source;
- g_return_val_if_fail (sources != NULL, NULL);
- g_return_val_if_fail (check_func != NULL, NULL);
+ /* XXX The GError parameter is there just to illustrate
+ * that the public functions calling this need one. */
- *sources = NULL;
+ registry = e_source_registry_get_default ();
+ source = e_source_registry_lookup_by_uid (registry, "system");
- if (!e_cal_get_sources (sources, type, &err)) {
- g_propagate_error (error, err);
+ if (!E_IS_SOURCE (source)) {
+ g_set_error_literal (
+ error, E_CALENDAR_ERROR,
+ E_CALENDAR_STATUS_NO_SUCH_CALENDAR,
+ _("No system source found"));
return NULL;
}
- for (g = e_source_list_peek_groups (*sources); g; g = g->next) {
- ESourceGroup *group = E_SOURCE_GROUP (g->data);
- GSList *s;
-
- for (s = e_source_group_peek_sources (group); s; s = s->next) {
- ESource *source = E_SOURCE (s->data);
-
- if (check_func (source, user_data)) {
- res = g_object_ref (source);
- break;
- }
- }
-
- if (res)
- break;
- }
-
- return res;
-}
-
-static gboolean
-check_uri (ESource *source, gpointer uri)
-{
- const gchar *suri;
-
- g_return_val_if_fail (source != NULL, FALSE);
- g_return_val_if_fail (uri != NULL, FALSE);
-
- suri = e_source_peek_absolute_uri (source);
-
- return suri && g_ascii_strcasecmp (suri, uri) == 0;
-}
-
-/**
- * e_cal_new_from_uri:
- * @uri: The URI pointing to the calendar to open.
- * @type: Type of the client.
- *
- * Creates a new calendar client. This does not open the calendar itself,
- * for that, #e_cal_open or #e_cal_open_async needs to be called.
- *
- * Returns: A newly-created calendar client, or NULL if the client could
- * not be constructed because it could not contact the calendar server.
- **/
-ECal *
-e_cal_new_from_uri (const gchar *uri, ECalSourceType type)
-{
- ESourceList *sources = NULL;
- ESource *source;
- ECal *cal;
-
- source = search_known_sources (type, check_uri, (gpointer) uri, &sources, NULL);
- if (!source)
- source = e_source_new_with_absolute_uri ("", uri);
-
- cal = e_cal_new (source, type);
-
- g_object_unref (source);
- if (sources)
- g_object_unref (sources);
-
- return cal;
+ return e_cal_new (source, type);
}
/**
@@ -1042,7 +969,7 @@ e_cal_new_from_uri (const gchar *uri, ECalSourceType type)
ECal *
e_cal_new_system_calendar (void)
{
- return e_cal_new_from_uri ("local:system", E_CAL_SOURCE_TYPE_EVENT);
+ return cal_new_system (E_CAL_SOURCE_TYPE_EVENT, NULL);
}
/**
@@ -1058,7 +985,7 @@ e_cal_new_system_calendar (void)
ECal *
e_cal_new_system_tasks (void)
{
- return e_cal_new_from_uri ("local:system", E_CAL_SOURCE_TYPE_TODO);
+ return cal_new_system (E_CAL_SOURCE_TYPE_TODO, NULL);
}
/**
@@ -1074,7 +1001,7 @@ e_cal_new_system_tasks (void)
ECal *
e_cal_new_system_memos (void)
{
- return e_cal_new_from_uri ("local:system", E_CAL_SOURCE_TYPE_JOURNAL);
+ return cal_new_system (E_CAL_SOURCE_TYPE_JOURNAL, NULL);
}
/**
@@ -1113,41 +1040,6 @@ e_cal_set_auth_func (ECal *ecal, ECalAuthFunc func, gpointer data)
ecal->priv->auth_user_data = data;
}
-static gchar *
-build_proxy_pass_key (ECal *ecal, const gchar * parent_user)
-{
- gchar *euri_str;
- const gchar *uri;
- EUri *euri;
-
- uri = e_cal_get_uri (ecal);
-
- euri = e_uri_new (uri);
- g_free (euri->user);
- euri->user = g_strdup (parent_user);
-
- euri_str = e_uri_to_string (euri, FALSE);
-
- e_uri_free (euri);
- return euri_str;
-}
-
-static gchar *
-build_pass_key (ECal *ecal)
-{
- gchar *euri_str;
- const gchar *uri;
- EUri *euri;
-
- uri = e_cal_get_uri (ecal);
-
- euri = e_uri_new (uri);
- euri_str = e_uri_to_string (euri, FALSE);
-
- e_uri_free (euri);
- return euri_str;
-}
-
static void
async_open_report_result (ECal *ecal, const GError *error)
{
@@ -1195,6 +1087,43 @@ async_open_ready_cb (EGdbusCal *gdbus_cal, GAsyncResult *res, ECal *ecal)
}
static gboolean
+get_groupwise_proxy_prompt (ESource *source,
+ gchar **prompt)
+{
+ ESourceExtension *extension;
+ gchar *parent_id_name = NULL;
+ gboolean prompt_swapped = FALSE;
+
+ /* FIXME This absolutely does not belong here. We don't have
+ * access to the GroupWise ESource extension from here,
+ * so we have to recreate the GSettings object manually.
+ * This suggests we need to make the design more flexible
+ * so this logic can live in the GroupWise backend where
+ * it belongs. */
+
+ if (!e_source_has_extension (source, "GroupWise Backend"))
+ return FALSE;
+
+ extension = e_source_get_extension (source, "GroupWise Backend");
+ g_object_get (extension, "parent-id-name", &parent_id_name, NULL);
+
+ if (parent_id_name != NULL && *parent_id_name != '\0') {
+ /* This password prompt will be prompted rarely.
+ * Since the key that is passed to the auth_func
+ * corresponds to the parent user. */
+ g_free (*prompt);
+ *prompt = g_strdup_printf (
+ _("Enter password for %s to enable proxy for user %s"),
+ e_source_get_display_name (source), parent_id_name);
+ prompt_swapped = TRUE;
+ }
+
+ g_free (parent_id_name);
+
+ return prompt_swapped;
+}
+
+static gboolean
open_calendar (ECal *ecal, gboolean only_if_exists, GError **error,
#ifndef E_CAL_DISABLE_DEPRECATED
ECalendarStatus *status,
@@ -1202,7 +1131,12 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error,
gboolean needs_auth, gboolean async)
{
ECalPrivate *priv;
- gchar *username = NULL, *auth_type = NULL, *password = NULL;
+ ESourceAuthentication *extension;
+ gchar *password = NULL;
+ gchar *prompt;
+ const gchar *method;
+ const gchar *user;
+ const gchar *extension_name;
g_return_val_if_fail (error != NULL, FALSE);
@@ -1215,73 +1149,59 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error,
return TRUE;
}
- /* see if the backend needs authentication */
- if ( (priv->mode != CAL_MODE_LOCAL) && e_source_get_property (priv->source, "auth")) {
- gchar *prompt, *key;
- gchar *parent_user;
+ /* See if the backend requires authentication. */
- priv->load_state = E_CAL_LOAD_AUTHENTICATING;
+ if (priv->mode == CAL_MODE_LOCAL)
+ goto load;
- if (priv->auth_func == NULL) {
- priv->load_state = E_CAL_LOAD_NOT_LOADED;
- #ifndef E_CAL_DISABLE_DEPRECATED
- *status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
- #endif
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
- }
+ extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
+ extension = e_source_get_extension (priv->source, extension_name);
- username = e_source_get_duped_property (priv->source, "username");
- if (!username) {
- priv->load_state = E_CAL_LOAD_NOT_LOADED;
- #ifndef E_CAL_DISABLE_DEPRECATED
- *status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
- #endif
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
- }
+ if (!e_source_authentication_required (extension))
+ goto load;
- prompt = g_strdup_printf (_("Enter password for %s (user %s)"),
- e_source_peek_name (priv->source), username);
+ /* Authentication is required. */
- auth_type = e_source_get_duped_property (priv->source, "auth-type");
- if (auth_type)
- key = build_pass_key (ecal);
- else {
- parent_user = e_source_get_duped_property (priv->source, "parent_id_name");
- if (parent_user) {
- key = build_proxy_pass_key (ecal, parent_user);
- /*
- This password prompt will be prompted rarely. Since the key that is passed to
- the auth_func corresponds to the parent user.
- */
- prompt = g_strdup_printf (_("Enter password for %s to enable proxy for user %s"), e_source_peek_name (priv->source), parent_user);
- g_free (parent_user);
- } else
- key = g_strdup (e_cal_get_uri (ecal));
- }
- g_free (auth_type);
+ priv->load_state = E_CAL_LOAD_AUTHENTICATING;
- if (!key) {
- priv->load_state = E_CAL_LOAD_NOT_LOADED;
- #ifndef E_CAL_DISABLE_DEPRECATED
- *status = E_CALENDAR_STATUS_URI_NOT_LOADED;
- #endif
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
- }
+ if (priv->auth_func == NULL) {
+ priv->load_state = E_CAL_LOAD_NOT_LOADED;
+ #ifndef E_CAL_DISABLE_DEPRECATED
+ *status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
+ #endif
+ E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
+ }
- password = priv->auth_func (ecal, prompt, key, priv->auth_user_data);
+ user = e_source_authentication_get_user (extension);
+ if (user == NULL) {
+ priv->load_state = E_CAL_LOAD_NOT_LOADED;
+ #ifndef E_CAL_DISABLE_DEPRECATED
+ *status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
+ #endif
+ E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
+ }
- if (!password) {
- priv->load_state = E_CAL_LOAD_NOT_LOADED;
- #ifndef E_CAL_DISABLE_DEPRECATED
- *status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
- #endif
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
- }
+ prompt = g_strdup_printf (
+ _("Enter password for %s (user %s)"),
+ e_source_get_display_name (priv->source), user);
+
+ method = e_source_authentication_get_method (extension);
+ if (method == NULL)
+ get_groupwise_proxy_prompt (priv->source, &prompt);
- g_free (prompt);
- g_free (key);
+ password = priv->auth_func (ecal, prompt, NULL, priv->auth_user_data);
+
+ if (!password) {
+ priv->load_state = E_CAL_LOAD_NOT_LOADED;
+ #ifndef E_CAL_DISABLE_DEPRECATED
+ *status = E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED;
+ #endif
+ E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_AUTHENTICATION_REQUIRED, error);
}
+ g_free (prompt);
+
+load:
priv->load_state = E_CAL_LOAD_LOADING;
#ifndef E_CAL_DISABLE_DEPRECATED
@@ -1290,7 +1210,7 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error,
if (!async) {
gchar *gdbus_username = NULL, *gdbus_password = NULL;
- if (!e_gdbus_cal_call_open_sync (priv->gdbus_cal, only_if_exists, e_util_ensure_gdbus_string (username, &gdbus_username), e_util_ensure_gdbus_string (password, &gdbus_password), NULL, error)) {
+ if (!e_gdbus_cal_call_open_sync (priv->gdbus_cal, only_if_exists, e_util_ensure_gdbus_string (user, &gdbus_username), e_util_ensure_gdbus_string (password, &gdbus_password), NULL, error)) {
#ifndef E_CAL_DISABLE_DEPRECATED
*status = E_CALENDAR_STATUS_DBUS_EXCEPTION;
#endif
@@ -1303,14 +1223,13 @@ open_calendar (ECal *ecal, gboolean only_if_exists, GError **error,
} else {
gchar *gdbus_username = NULL, *gdbus_password = NULL;
- e_gdbus_cal_call_open (priv->gdbus_cal, only_if_exists, e_util_ensure_gdbus_string (username, &gdbus_username), e_util_ensure_gdbus_string (password, &gdbus_password), NULL, (GAsyncReadyCallback) async_open_ready_cb, ecal);
+ e_gdbus_cal_call_open (priv->gdbus_cal, only_if_exists, e_util_ensure_gdbus_string (user, &gdbus_username), e_util_ensure_gdbus_string (password, &gdbus_password), NULL, (GAsyncReadyCallback) async_open_ready_cb, ecal);
g_free (gdbus_username);
g_free (gdbus_password);
}
g_free (password);
- g_free (username);
if (!*error) {
if (!async) {
@@ -1491,31 +1410,6 @@ e_cal_refresh (ECal *ecal, GError **error)
return TRUE;
}
-/**
- * e_cal_remove:
- * @ecal: A calendar client.
- * @error: Placeholder for error information.
- *
- * Removes a calendar.
- *
- * Returns: TRUE if the calendar was removed, FALSE if there was an error.
- */
-gboolean
-e_cal_remove (ECal *ecal, GError **error)
-{
- ECalPrivate *priv;
-
- e_return_error_if_fail (E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
- priv = ecal->priv;
- e_return_error_if_fail (priv->gdbus_cal, E_CALENDAR_STATUS_REPOSITORY_OFFLINE);
-
- if (!e_gdbus_cal_call_remove_sync (priv->gdbus_cal, NULL, error)) {
- E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_DBUS_EXCEPTION, error);
- }
-
- return TRUE;
-}
-
#if 0
/* Builds an URI list out of a CORBA string sequence */
static GList *
@@ -1648,27 +1542,6 @@ e_cal_get_source (ECal *ecal)
}
/**
- * e_cal_get_uri:
- * @ecal: A calendar client.
- *
- * Queries the URI that is open in a calendar client.
- *
- * Returns: The URI of the calendar that is already loaded or is being
- * loaded, or NULL if the client has not started a load request yet.
- **/
-const gchar *
-e_cal_get_uri (ECal *ecal)
-{
- ECalPrivate *priv;
-
- g_return_val_if_fail (ecal != NULL, NULL);
- g_return_val_if_fail (E_IS_CAL (ecal), NULL);
-
- priv = ecal->priv;
- return priv->uri;
-}
-
-/**
* e_cal_get_local_attachment_store
* @ecal: A calendar client.
*
@@ -4213,8 +4086,8 @@ e_cal_open_default (ECal **ecal,
gpointer data,
GError **error)
{
- ESourceList *source_list;
- ESource *source;
+ ESourceRegistry *registry;
+ ESource *source = NULL;
ECal *client;
g_return_val_if_fail (ecal != NULL, FALSE);
@@ -4222,180 +4095,103 @@ e_cal_open_default (ECal **ecal,
/* In case something goes wrong... */
*ecal = NULL;
- if (!e_cal_get_sources (&source_list, type, error))
- return FALSE;
+ registry = e_source_registry_get_default ();
- source = e_source_list_peek_default_source (source_list);
- if (!source) {
- g_set_error_literal (error, E_CALENDAR_ERROR,
- E_CALENDAR_STATUS_NO_SUCH_CALENDAR,
- e_cal_get_error_message (E_CALENDAR_STATUS_NO_SUCH_CALENDAR));
- g_object_unref (source_list);
+ if (type == E_CAL_SOURCE_TYPE_EVENT)
+ source = e_source_registry_get_default_calendar (registry);
+ else if (type == E_CAL_SOURCE_TYPE_JOURNAL)
+ source = e_source_registry_get_default_memo_list (registry);
+ else if (type == E_CAL_SOURCE_TYPE_TODO)
+ source = e_source_registry_get_default_task_list (registry);
+
+ if (source == NULL) {
+ g_set_error_literal (
+ error, E_CALENDAR_ERROR,
+ E_CALENDAR_STATUS_NO_SUCH_CALENDAR,
+ e_cal_get_error_message (E_CALENDAR_STATUS_NO_SUCH_CALENDAR));
return FALSE;
}
- /* XXX This can fail but doesn't take a GError!? */
+ /* XXX So this can fail, but doesn't take a GError!? */
client = e_cal_new (source, type);
- if (!client) {
- g_set_error_literal (error, E_CALENDAR_ERROR,
- E_CALENDAR_STATUS_OTHER_ERROR,
- e_cal_get_error_message (E_CALENDAR_STATUS_OTHER_ERROR));
- g_object_unref (source_list);
+ g_object_unref (source);
+
+ if (client == NULL) {
+ g_set_error_literal (
+ error, E_CALENDAR_ERROR,
+ E_CALENDAR_STATUS_OTHER_ERROR,
+ e_cal_get_error_message (E_CALENDAR_STATUS_OTHER_ERROR));
return FALSE;
}
e_cal_set_auth_func (client, func, data);
if (!e_cal_open (client, TRUE, error)) {
g_object_unref (client);
- g_object_unref (source_list);
return FALSE;
}
*ecal = client;
- g_object_unref (source_list);
-
return TRUE;
}
/**
* e_cal_set_default:
- * @ecal: A calendar client.
- * @error: Placeholder for error information.
+ * @ecal: an #ECal
+ * @error: return location for a #GError, or %NULL
*
- * Sets a calendar as the default one.
+ * Sets the #ESource in @ecal as default.
*
- * Returns: TRUE if the operation was successful, FALSE otherwise.
+ * The @error parameter is only for backward-compatibility.
+ * This function never fails, so you can safely pass %NULL.
+ *
+ * Returns: %TRUE always
*/
gboolean
e_cal_set_default (ECal *ecal, GError **error)
{
ESource *source;
+ ECalSourceType source_type;
- e_return_error_if_fail (ecal && E_IS_CAL (ecal), E_CALENDAR_STATUS_INVALID_ARG);
+ g_return_val_if_fail (E_IS_CAL (ecal), FALSE);
source = e_cal_get_source (ecal);
- if (!source) {
- g_set_error_literal (error, E_CALENDAR_ERROR,
- E_CALENDAR_STATUS_NO_SUCH_CALENDAR,
- e_cal_get_error_message (E_CALENDAR_STATUS_NO_SUCH_CALENDAR));
- return FALSE;
- }
-
- return e_cal_set_default_source (source, ecal->priv->type, error);
-}
-
-static gboolean
-set_default_source (ESourceList *sources, ESource *source, GError **error)
-{
- const gchar *uid;
- GError *err = NULL;
- GSList *g;
-
- uid = e_source_peek_uid (source);
-
- /* make sure the source is actually in the ESourceList. if
- it's not we don't bother adding it, just return an error */
- source = e_source_list_peek_source_by_uid (sources, uid);
- if (!source) {
- g_set_error_literal (error, E_CALENDAR_ERROR,
- E_CALENDAR_STATUS_NO_SUCH_CALENDAR,
- e_cal_get_error_message (E_CALENDAR_STATUS_NO_SUCH_CALENDAR));
- g_object_unref (sources);
- return FALSE;
- }
-
- /* loop over all the sources clearing out any "default"
- properties we find */
- for (g = e_source_list_peek_groups (sources); g; g = g->next) {
- GSList *s;
- for (s = e_source_group_peek_sources (E_SOURCE_GROUP (g->data));
- s; s = s->next) {
- e_source_set_property (E_SOURCE (s->data), "default", NULL);
- }
- }
-
- /* set the "default" property on the source */
- e_source_set_property (source, "default", "true");
-
- if (!e_source_list_sync (sources, &err)) {
- g_propagate_error (error, err);
- return FALSE;
- }
+ source_type = e_cal_get_source_type (ecal);
+ e_cal_set_default_source (source, source_type, NULL);
return TRUE;
}
/**
* e_cal_set_default_source:
- * @source: An #ESource.
- * @type: Type of the source.
- * @error: Placeholder for error information.
+ * @source: an #ESource
+ * @type: type of the source
+ * @error: return location for a #GError, or %NULL
*
- * Sets the default source for the specified @type.
+ * Sets @source as the default source for the specified @type.
*
- * Returns: TRUE if the operation was successful, FALSE otherwise.
+ * The @error parameter is only for backward-compatibility.
+ * This function never fails, so you can safely pass %NULL.
+ *
+ * Returns: %TRUE always
*/
gboolean
-e_cal_set_default_source (ESource *source, ECalSourceType type, GError **error)
+e_cal_set_default_source (ESource *source,
+ ECalSourceType type,
+ GError **error)
{
- ESourceList *sources;
- GError *err = NULL;
+ ESourceRegistry *registry;
- if (!e_cal_get_sources (&sources, type, &err)) {
- g_propagate_error (error, err);
- return FALSE;
- }
+ g_return_val_if_fail (E_IS_SOURCE (source), FALSE);
- return set_default_source (sources, source, error);
-}
+ registry = e_source_registry_get_default ();
-static gboolean
-get_sources (ESourceList **sources, const gchar *key, GError **error)
-{
- GConfClient *gconf = gconf_client_get_default ();
-
- *sources = e_source_list_new_for_gconf (gconf, key);
- g_object_unref (gconf);
+ if (type == E_CAL_SOURCE_TYPE_EVENT)
+ e_source_registry_set_default_calendar (registry, source);
+ else if (type == E_CAL_SOURCE_TYPE_JOURNAL)
+ e_source_registry_set_default_memo_list (registry, source);
+ else if (type == E_CAL_SOURCE_TYPE_TODO)
+ e_source_registry_set_default_task_list (registry, source);
return TRUE;
}
-
-/**
- * e_cal_get_sources:
- * @sources: Return value for list of sources.
- * @type: Type of the sources to get.
- * @error: Placeholder for error information.
- *
- * Gets the list of sources defined in the configuration for the given @type.
- *
- * Returns: TRUE if the operation was successful, FALSE otherwise.
- */
-gboolean
-e_cal_get_sources (ESourceList **sources, ECalSourceType type, GError **error)
-{
- e_return_error_if_fail (sources != NULL, E_CALENDAR_STATUS_INVALID_ARG);
- *sources = NULL;
-
- switch (type) {
- case E_CAL_SOURCE_TYPE_EVENT:
- return get_sources (sources, "/apps/evolution/calendar/sources", error);
- break;
- case E_CAL_SOURCE_TYPE_TODO:
- return get_sources (sources, "/apps/evolution/tasks/sources", error);
- break;
- case E_CAL_SOURCE_TYPE_JOURNAL:
- return get_sources (sources, "/apps/evolution/memos/sources", error);
- break;
- default:
- g_set_error_literal (error, E_CALENDAR_ERROR,
- E_CALENDAR_STATUS_NO_SUCH_CALENDAR,
- e_cal_get_error_message (E_CALENDAR_STATUS_NO_SUCH_CALENDAR));
- return FALSE;
- }
-
- g_set_error_literal (error, E_CALENDAR_ERROR,
- E_CALENDAR_STATUS_NO_SUCH_CALENDAR,
- e_cal_get_error_message (E_CALENDAR_STATUS_NO_SUCH_CALENDAR));
- return FALSE;
-}
diff --git a/calendar/libecal/e-cal.h b/calendar/libecal/e-cal.h
index ea599d5..841dc9b 100644
--- a/calendar/libecal/e-cal.h
+++ b/calendar/libecal/e-cal.h
@@ -22,9 +22,7 @@
#ifndef E_CAL_H
#define E_CAL_H
-#include <glib-object.h>
-#include "libedataserver/e-source-list.h"
-#include "libedataserver/e-source.h"
+#include <libedataserver/e-source.h>
#include <libecal/e-cal-recur.h>
#include <libecal/e-cal-util.h>
#include <libecal/e-cal-view.h>
@@ -94,7 +92,7 @@ struct _ECalClass {
typedef gchar * (* ECalAuthFunc) (ECal *ecal,
const gchar *prompt,
- const gchar *key,
+ const gchar *unused,
gpointer user_data);
GType e_cal_get_type (void);
@@ -104,7 +102,6 @@ GType e_cal_set_mode_status_enum_get_type (void);
GType cal_mode_enum_get_type (void);
ECal *e_cal_new (ESource *source, ECalSourceType type);
-ECal *e_cal_new_from_uri (const gchar *uri, ECalSourceType type);
ECal *e_cal_new_system_calendar (void);
ECal *e_cal_new_system_tasks (void);
ECal *e_cal_new_system_memos (void);
@@ -114,7 +111,6 @@ void e_cal_set_auth_func (ECal *ecal, ECalAuthFunc func, gpointer data);
gboolean e_cal_open (ECal *ecal, gboolean only_if_exists, GError **error);
void e_cal_open_async (ECal *ecal, gboolean only_if_exists);
gboolean e_cal_refresh (ECal *ecal, GError **error);
-gboolean e_cal_remove (ECal *ecal, GError **error);
GList *e_cal_uri_list (ECal *ecal, CalMode mode);
@@ -122,7 +118,6 @@ ECalSourceType e_cal_get_source_type (ECal *ecal);
ECalLoadState e_cal_get_load_state (ECal *ecal);
ESource *e_cal_get_source (ECal *ecal);
-const gchar *e_cal_get_uri (ECal *ecal);
gboolean e_cal_is_read_only (ECal *ecal, gboolean *read_only, GError **error);
gboolean e_cal_get_cal_address (ECal *ecal, gchar **cal_address, GError **error);
@@ -208,7 +203,6 @@ const gchar * e_cal_get_error_message (ECalendarStatus status);
gboolean e_cal_open_default (ECal **ecal, ECalSourceType type, ECalAuthFunc func, gpointer data, GError **error);
gboolean e_cal_set_default (ECal *ecal, GError **error);
gboolean e_cal_set_default_source (ESource *source, ECalSourceType type, GError **error);
-gboolean e_cal_get_sources (ESourceList **sources, ECalSourceType type, GError **error);
const gchar * e_cal_get_local_attachment_store (ECal *ecal);
gboolean e_cal_get_recurrences_no_master (ECal *ecal);
gboolean e_cal_get_attachments_for_comp (ECal *ecal, const gchar *uid, const gchar *rid, GSList **list, GError **error);
diff --git a/calendar/tests/ecal/Makefile.am b/calendar/tests/ecal/Makefile.am
index e1fbff0..8f13ff1 100644
--- a/calendar/tests/ecal/Makefile.am
+++ b/calendar/tests/ecal/Makefile.am
@@ -32,7 +32,6 @@ test_scripts = \
# ordered by relative complexity
TESTS = \
- test-ecal-remove \
test-ecal-open \
test-ecal-get-free-busy \
test-ecal-get-timezone \
@@ -99,8 +98,6 @@ test_ecal_open_LDADD=$(TEST_ECAL_LIBS)
test_ecal_open_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
test_ecal_receive_objects_LDADD=$(TEST_ECAL_LIBS)
test_ecal_receive_objects_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
-test_ecal_remove_LDADD=$(TEST_ECAL_LIBS)
-test_ecal_remove_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
test_ecal_remove_object_LDADD=$(TEST_ECAL_LIBS)
test_ecal_remove_object_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
test_ecal_send_objects_LDADD=$(TEST_ECAL_LIBS)
diff --git a/calendar/tests/ecal/ecal-test-utils.c b/calendar/tests/ecal/ecal-test-utils.c
index 7f90366..347c28b 100644
--- a/calendar/tests/ecal/ecal-test-utils.c
+++ b/calendar/tests/ecal/ecal-test-utils.c
@@ -51,20 +51,6 @@ test_print (const gchar *format,
}
ECal*
-ecal_test_utils_cal_new_from_uri (const gchar *uri,
- ECalSourceType type)
-{
- ECal *cal;
-
- test_print ("loading calendar '%s'\n", uri);
- cal = e_cal_new_from_uri (uri, type);
- if (!cal)
- g_error ("failed to create calendar: `%s'", uri);
-
- return cal;
-}
-
-ECal*
ecal_test_utils_cal_new_temp (gchar **uri,
ECalSourceType type)
{
@@ -73,19 +59,21 @@ ecal_test_utils_cal_new_temp (gchar **uri,
gchar *uri_result;
file_template = g_build_filename (g_get_tmp_dir (),
- "ecal-test-XXXXXX/", NULL);
+ "ecal-test-XXXXXX/", NULL);
g_mkstemp (file_template);
- uri_result = g_strconcat ("local:", file_template, NULL);
+ uri_result = g_strconcat ("local:", file_template, NULL);
if (!uri_result) {
- g_error ("failed to convert %s to a 'local:' URI", file_template);
+ g_error ("failed to convert %s to a 'local:' URI", file_template);
}
g_free (file_template);
- cal = ecal_test_utils_cal_new_from_uri (uri_result, type);
+ /* FIXME We don't build ECals from URIs anymore. */
+ /* cal = ecal_test_utils_cal_new_from_uri (uri_result, type); */
+ cal = NULL;
if (uri)
- *uri = g_strdup (uri_result);
+ *uri = g_strdup (uri_result);
g_free (uri_result);
@@ -99,11 +87,13 @@ ecal_test_utils_cal_open (ECal *cal,
GError *error = NULL;
if (!e_cal_open (cal, only_if_exists, &error)) {
- const gchar *uri;
+ ESource *source;
+ const gchar *uid;
- uri = e_cal_get_uri (cal);
+ source = e_cal_get_source (cal);
+ uid = e_source_get_uid (source);
- g_warning ("failed to open calendar: `%s': %s", uri,
+ g_warning ("failed to open calendar: `%s': %s", uid,
error->message);
exit (1);
}
@@ -151,20 +141,6 @@ ecal_test_utils_cal_async_open (ECal *cal,
e_cal_open_async (cal, only_if_exists);
}
-void
-ecal_test_utils_cal_remove (ECal *cal)
-{
- GError *error = NULL;
-
- if (!e_cal_remove (cal, &error)) {
- g_warning ("failed to remove calendar; %s\n", error->message);
- exit (1);
- }
- test_print ("successfully removed the temporary calendar\n");
-
- g_object_unref (cal);
-}
-
gchar *
ecal_test_utils_cal_get_alarm_email_address (ECal *cal)
{
diff --git a/calendar/tests/ecal/ecal-test-utils.h b/calendar/tests/ecal/ecal-test-utils.h
index 60760e7..aaa2892 100644
--- a/calendar/tests/ecal/ecal-test-utils.h
+++ b/calendar/tests/ecal/ecal-test-utils.h
@@ -37,10 +37,6 @@ test_print (const gchar *format,
...);
ECal*
-ecal_test_utils_cal_new_from_uri (const gchar *uri,
- ECalSourceType type);
-
-ECal*
ecal_test_utils_cal_new_temp (gchar **uri,
ECalSourceType type);
@@ -54,9 +50,6 @@ ecal_test_utils_cal_async_open (ECal *cal,
GSourceFunc callback,
gpointer user_data);
-void
-ecal_test_utils_cal_remove (ECal *cal);
-
gchar *
ecal_test_utils_cal_get_alarm_email_address (ECal *cal);
diff --git a/calendar/tests/ecal/test-ecal-add-timezone.c b/calendar/tests/ecal/test-ecal-add-timezone.c
index 2c034c1..0940871 100644
--- a/calendar/tests/ecal/test-ecal-add-timezone.c
+++ b/calendar/tests/ecal/test-ecal-add-timezone.c
@@ -43,7 +43,6 @@ main (gint argc, gchar **argv)
g_assert (!g_strcmp0 (icaltimezone_get_tznames (zone),
icaltimezone_get_tznames (zone_final)));
- ecal_test_utils_cal_remove (cal);
icaltimezone_free (zone, TRUE);
return 0;
diff --git a/calendar/tests/ecal/test-ecal-create-object.c b/calendar/tests/ecal/test-ecal-create-object.c
index e9f2301..abbb93d 100644
--- a/calendar/tests/ecal/test-ecal-create-object.c
+++ b/calendar/tests/ecal/test-ecal-create-object.c
@@ -26,8 +26,6 @@ main (gint argc, gchar **argv)
component_final = ecal_test_utils_cal_get_object (cal, uid);
ecal_test_utils_cal_assert_objects_equal_shallow (component, component_final);
- ecal_test_utils_cal_remove (cal);
-
g_free (uid);
icalcomponent_free (component);
icalcomponent_free (component_final);
diff --git a/calendar/tests/ecal/test-ecal-get-alarm-email-address.c b/calendar/tests/ecal/test-ecal-get-alarm-email-address.c
index c9bff46..f6eb0f6 100644
--- a/calendar/tests/ecal/test-ecal-get-alarm-email-address.c
+++ b/calendar/tests/ecal/test-ecal-get-alarm-email-address.c
@@ -20,8 +20,6 @@ main (gint argc, gchar **argv)
address = ecal_test_utils_cal_get_alarm_email_address (cal);
test_print ("alarm email address: '%s'\n", address);
- ecal_test_utils_cal_remove (cal);
-
g_free (address);
return 0;
diff --git a/calendar/tests/ecal/test-ecal-get-cal-address.c b/calendar/tests/ecal/test-ecal-get-cal-address.c
index 5bd21b6..748bc15 100644
--- a/calendar/tests/ecal/test-ecal-get-cal-address.c
+++ b/calendar/tests/ecal/test-ecal-get-cal-address.c
@@ -20,8 +20,6 @@ main (gint argc, gchar **argv)
address = ecal_test_utils_cal_get_cal_address (cal);
test_print ("calendar address: '%s'\n", address);
- ecal_test_utils_cal_remove (cal);
-
g_free (address);
return 0;
diff --git a/calendar/tests/ecal/test-ecal-get-capabilities.c b/calendar/tests/ecal/test-ecal-get-capabilities.c
index d81ddb8..d0f8e2c 100644
--- a/calendar/tests/ecal/test-ecal-get-capabilities.c
+++ b/calendar/tests/ecal/test-ecal-get-capabilities.c
@@ -16,7 +16,6 @@ main (gint argc, gchar **argv)
cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
ecal_test_utils_cal_open (cal, FALSE);
ecal_test_utils_cal_get_capabilities (cal);
- ecal_test_utils_cal_remove (cal);
return 0;
}
diff --git a/calendar/tests/ecal/test-ecal-get-default-object.c b/calendar/tests/ecal/test-ecal-get-default-object.c
index f6ff1e8..e084593 100644
--- a/calendar/tests/ecal/test-ecal-get-default-object.c
+++ b/calendar/tests/ecal/test-ecal-get-default-object.c
@@ -23,8 +23,6 @@ main (gint argc, gchar **argv)
component_string = icalcomponent_as_ical_string (component);
test_print ("default object:\n%s", component_string);
- ecal_test_utils_cal_remove (cal);
-
g_free (component_string);
return 0;
diff --git a/calendar/tests/ecal/test-ecal-get-free-busy.c b/calendar/tests/ecal/test-ecal-get-free-busy.c
index 7ed04d2..d3d151b 100644
--- a/calendar/tests/ecal/test-ecal-get-free-busy.c
+++ b/calendar/tests/ecal/test-ecal-get-free-busy.c
@@ -30,8 +30,6 @@ main (gint argc, gchar **argv)
free_busy = ecal_test_utils_cal_get_free_busy (cal, users, start, end);
- ecal_test_utils_cal_remove (cal);
-
g_list_foreach (free_busy, (GFunc) g_object_unref, NULL);
g_list_free (free_busy);
diff --git a/calendar/tests/ecal/test-ecal-get-ldap-attribute.c b/calendar/tests/ecal/test-ecal-get-ldap-attribute.c
index 7f1e3c1..e3d4807 100644
--- a/calendar/tests/ecal/test-ecal-get-ldap-attribute.c
+++ b/calendar/tests/ecal/test-ecal-get-ldap-attribute.c
@@ -20,8 +20,6 @@ main (gint argc, gchar **argv)
attr = ecal_test_utils_cal_get_ldap_attribute (cal);
test_print ("LDAP attribute: '%s'\n", attr);
- ecal_test_utils_cal_remove (cal);
-
g_free (attr);
return 0;
diff --git a/calendar/tests/ecal/test-ecal-get-object-list.c b/calendar/tests/ecal/test-ecal-get-object-list.c
index ad39125..1081d82 100644
--- a/calendar/tests/ecal/test-ecal-get-object-list.c
+++ b/calendar/tests/ecal/test-ecal-get-object-list.c
@@ -41,8 +41,6 @@ main (gint argc, gchar **argv)
ecal_test_utils_cal_assert_objects_equal_shallow (component,
component_final);
- ecal_test_utils_cal_remove (cal);
-
e_cal_free_object_list (components);
g_free (uid);
icalcomponent_free (component);
diff --git a/calendar/tests/ecal/test-ecal-get-objects-for-uid.c b/calendar/tests/ecal/test-ecal-get-objects-for-uid.c
index a502008..3493e4a 100644
--- a/calendar/tests/ecal/test-ecal-get-objects-for-uid.c
+++ b/calendar/tests/ecal/test-ecal-get-objects-for-uid.c
@@ -37,8 +37,6 @@ main (gint argc, gchar **argv)
component_final = e_cal_component_get_icalcomponent (e_component_final);
ecal_test_utils_cal_assert_objects_equal_shallow (component, component_final);
- ecal_test_utils_cal_remove (cal);
-
g_list_foreach (components, (GFunc) g_object_unref, NULL);
g_list_free (components);
g_free (uid);
diff --git a/calendar/tests/ecal/test-ecal-get-query.c b/calendar/tests/ecal/test-ecal-get-query.c
index ec443ed..9106b48 100644
--- a/calendar/tests/ecal/test-ecal-get-query.c
+++ b/calendar/tests/ecal/test-ecal-get-query.c
@@ -135,9 +135,6 @@ alter_cal_cb (ECal *cal)
/* remove the object */
ecal_test_utils_cal_remove_object (cal, uid);
- /* Clean-up */
- ecal_test_utils_cal_remove (cal);
-
g_object_unref (e_component_final);
g_free (uid);
icalcomponent_free (component);
diff --git a/calendar/tests/ecal/test-ecal-get-timezone.c b/calendar/tests/ecal/test-ecal-get-timezone.c
index 29399ec..c8ea7ed 100644
--- a/calendar/tests/ecal/test-ecal-get-timezone.c
+++ b/calendar/tests/ecal/test-ecal-get-timezone.c
@@ -25,7 +25,5 @@ main (gint argc, gchar **argv)
g_assert (!g_strcmp0 (icaltimezone_get_tzid (zone),
icaltimezone_get_tzid (utc_zone)));
- ecal_test_utils_cal_remove (cal);
-
return 0;
}
diff --git a/calendar/tests/ecal/test-ecal-modify-object.c b/calendar/tests/ecal/test-ecal-modify-object.c
index 52feb52..d531240 100644
--- a/calendar/tests/ecal/test-ecal-modify-object.c
+++ b/calendar/tests/ecal/test-ecal-modify-object.c
@@ -58,9 +58,6 @@ main (gint argc, gchar **argv)
ecal_test_utils_cal_assert_e_cal_components_equal (e_component,
e_component_final);
- /* Clean-up */
- ecal_test_utils_cal_remove (cal);
-
g_object_unref (e_component_final);
g_free (uid);
icalcomponent_free (component);
diff --git a/calendar/tests/ecal/test-ecal-open.c b/calendar/tests/ecal/test-ecal-open.c
index 1748fb8..4746884 100644
--- a/calendar/tests/ecal/test-ecal-open.c
+++ b/calendar/tests/ecal/test-ecal-open.c
@@ -39,7 +39,6 @@ main (gint argc, gchar **argv)
/* Sync version */
cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
ecal_test_utils_cal_open (cal, FALSE);
- ecal_test_utils_cal_remove (cal);
/* Async version */
cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
@@ -51,7 +50,5 @@ main (gint argc, gchar **argv)
(GSourceFunc) open_complete_cb, loop);
g_main_loop_run (loop);
- ecal_test_utils_cal_remove (cal);
-
return 0;
}
diff --git a/calendar/tests/ecal/test-ecal-receive-objects.c b/calendar/tests/ecal/test-ecal-receive-objects.c
index 4721d65..5d6617c 100644
--- a/calendar/tests/ecal/test-ecal-receive-objects.c
+++ b/calendar/tests/ecal/test-ecal-receive-objects.c
@@ -27,8 +27,6 @@ main (gint argc, gchar **argv)
component = e_cal_component_get_icalcomponent (e_component);
ecal_test_utils_cal_receive_objects (cal, component);
- ecal_test_utils_cal_remove (cal);
-
g_object_unref (e_component);
g_free (uid);
diff --git a/calendar/tests/ecal/test-ecal-remove-object.c b/calendar/tests/ecal/test-ecal-remove-object.c
index 1bc9e1c..3f561e3 100644
--- a/calendar/tests/ecal/test-ecal-remove-object.c
+++ b/calendar/tests/ecal/test-ecal-remove-object.c
@@ -26,7 +26,6 @@ main (gint argc, gchar **argv)
component_final = ecal_test_utils_cal_get_object (cal, uid);
ecal_test_utils_cal_assert_objects_equal_shallow (component, component_final);
ecal_test_utils_cal_remove_object (cal, uid);
- ecal_test_utils_cal_remove (cal);
g_free (uid);
icalcomponent_free (component);
diff --git a/calendar/tests/ecal/test-ecal-send-objects.c b/calendar/tests/ecal/test-ecal-send-objects.c
index 0670e7b..72a2a53 100644
--- a/calendar/tests/ecal/test-ecal-send-objects.c
+++ b/calendar/tests/ecal/test-ecal-send-objects.c
@@ -29,8 +29,6 @@ main (gint argc, gchar **argv)
component = e_cal_component_get_icalcomponent (e_component);
ecal_test_utils_cal_send_objects (cal, component, &users, &modified_component);
- ecal_test_utils_cal_remove (cal);
-
g_list_foreach (users, (GFunc) g_free, NULL);
g_list_free (users);
diff --git a/calendar/tests/ecal/test-ecal-set-default-timezone.c b/calendar/tests/ecal/test-ecal-set-default-timezone.c
index 98a18de..d3e2776 100644
--- a/calendar/tests/ecal/test-ecal-set-default-timezone.c
+++ b/calendar/tests/ecal/test-ecal-set-default-timezone.c
@@ -47,7 +47,6 @@ main (gint argc, gchar **argv)
g_assert (!g_strcmp0 (icaltimezone_get_tznames (zone),
icaltimezone_get_tznames (zone_final)));
- ecal_test_utils_cal_remove (cal);
icaltimezone_free (zone, TRUE);
return 0;
diff --git a/calendar/tests/ecal/test-ecal-set-mode.c b/calendar/tests/ecal/test-ecal-set-mode.c
index ca74049..ae54055 100644
--- a/calendar/tests/ecal/test-ecal-set-mode.c
+++ b/calendar/tests/ecal/test-ecal-set-mode.c
@@ -54,7 +54,5 @@ main (gint argc, gchar **argv)
g_main_loop_run (loop);
- ecal_test_utils_cal_remove (cal);
-
return 0;
}
diff --git a/calendar/tests/ecal/test-ecal-stress-factory--fifo.c b/calendar/tests/ecal/test-ecal-stress-factory--fifo.c
index 16a4069..66956e5 100644
--- a/calendar/tests/ecal/test-ecal-stress-factory--fifo.c
+++ b/calendar/tests/ecal/test-ecal-stress-factory--fifo.c
@@ -26,9 +26,5 @@ main (gint argc, gchar **argv)
g_free (uri);
}
- for (i = 0; i < NUM_CALS; i++) {
- ecal_test_utils_cal_remove (cals[i]);
- }
-
return 0;
}
diff --git a/calendar/tests/ecal/test-ecal-stress-factory--open-async.c b/calendar/tests/ecal/test-ecal-stress-factory--open-async.c
index 68b83a7..9ede527 100644
--- a/calendar/tests/ecal/test-ecal-stress-factory--open-async.c
+++ b/calendar/tests/ecal/test-ecal-stress-factory--open-async.c
@@ -18,7 +18,6 @@ static void
open_complete_cb (ECalTestClosure *closure)
{
g_source_remove (open_timeout_id);
- ecal_test_utils_cal_remove (closure->cal);
cals_processed++;
diff --git a/calendar/tests/ecal/test-ecal-stress-factory--serial.c b/calendar/tests/ecal/test-ecal-stress-factory--serial.c
index 9960fb2..361e538 100644
--- a/calendar/tests/ecal/test-ecal-stress-factory--serial.c
+++ b/calendar/tests/ecal/test-ecal-stress-factory--serial.c
@@ -22,7 +22,6 @@ main (gint argc, gchar **argv)
cal = ecal_test_utils_cal_new_temp (&uri,
E_CAL_SOURCE_TYPE_EVENT);
ecal_test_utils_cal_open (cal, FALSE);
- ecal_test_utils_cal_remove (cal);
g_free (uri);
}
diff --git a/calendar/tests/ecal/test-ecal-stress-factory--single-cal.c b/calendar/tests/ecal/test-ecal-stress-factory--single-cal.c
index a969e6a..21c2cf9 100644
--- a/calendar/tests/ecal/test-ecal-stress-factory--single-cal.c
+++ b/calendar/tests/ecal/test-ecal-stress-factory--single-cal.c
@@ -19,6 +19,9 @@ main (gint argc, gchar **argv)
cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
g_object_unref (cal);
+ /* FIXME We don't build ECals from URIs anymore. */
+
+#if 0
/* open and close the same calendar repeatedly */
for (i = 0; i < NUM_OPENS-1; i++) {
cal = ecal_test_utils_cal_new_from_uri (uri,
@@ -28,7 +31,7 @@ main (gint argc, gchar **argv)
}
cal = ecal_test_utils_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_EVENT);
- ecal_test_utils_cal_remove (cal);
+#endif
g_free (uri);
diff --git a/calendar/tests/ecal/test-ecal.c b/calendar/tests/ecal/test-ecal.c
index a0285bc..26bdf02 100644
--- a/calendar/tests/ecal/test-ecal.c
+++ b/calendar/tests/ecal/test-ecal.c
@@ -321,23 +321,6 @@ test_get_alarms_in_range (ECal *client)
}
static const gchar *
-test_set_uri (ECal *client, const gchar *uri)
-{
- /* The uri is set as part of create_client call. This method merely
- * verifies it was done correctly.
- */
- gchar *cal_uri;
- gboolean compare = 0;
- cal_uri = g_strconcat ("file://", uri, NULL);
- compare = !strcmp (e_cal_get_uri (client), cal_uri);
-
- g_free (cal_uri);
- mu_assert ("Test set_uri : uri was not set correctly\n", compare);
-
- return NULL;
-}
-
-static const gchar *
test_cal_loaded (ECal *client)
{
/* Test one loaded calendar and another that is not loaded. */
@@ -352,12 +335,14 @@ static const gchar *
test_get_source (ECal *client, const gchar *expected)
{
ESource *source;
- gchar *uri;
+ const gchar *uri;
gchar *cal_uri;
gboolean compare = 0;
source = e_cal_get_source (client);
- uri = e_source_get_uri (source);
+ /* FIXME ESources no longer have built-in URIs. */
+ /* uri = e_source_get_uri (source); */
+ uri = "";
cal_uri = g_strconcat ("file://", expected, NULL);
compare = !strcmp (expected, uri);
@@ -634,7 +619,6 @@ all_tests (ECal *client, const gchar *uri)
mu_run_test (test_new_system_calendar ());
mu_run_test (test_new_system_tasks ());
mu_run_test (test_new_system_memos ());
- mu_run_test (test_set_uri (client, uri));
mu_run_test (test_get_source (client, uri));
mu_run_test (test_cal_loaded (client));
@@ -674,7 +658,9 @@ create_client (ECal **client, const gchar *uri, ECalSourceType type, gboolean on
GError *error = NULL;
cal_uri = g_strconcat ("file://", uri, NULL);
- *client = e_cal_new_from_uri (cal_uri, type);
+ /* FIXME We don't build ECals from URIs anymore. */
+ /* *client = e_cal_new_from_uri (cal_uri, type); */
+ *client = NULL;
if (!*client) {
g_message (G_STRLOC ": could not create the client");
exit (1);
diff --git a/calendar/tests/ecal/test-recur.c b/calendar/tests/ecal/test-recur.c
index c18aef7..698fd40 100644
--- a/calendar/tests/ecal/test-recur.c
+++ b/calendar/tests/ecal/test-recur.c
@@ -15,7 +15,9 @@ main (gint argc, gchar **argv)
exit (0);
}
- ecal = e_cal_new_from_uri (argv[1], E_CAL_SOURCE_TYPE_EVENT);
+ /* FIXME We don't build ECals from URIs anymore. */
+ /* ecal = e_cal_new_from_uri (argv[1], E_CAL_SOURCE_TYPE_EVENT); */
+ ecal = NULL;
if (!e_cal_open (ecal, TRUE, NULL)) {
printf ("failed to open calendar\n");
diff --git a/calendar/tests/ecal/test-search.c b/calendar/tests/ecal/test-search.c
index ded2825..96226d9 100644
--- a/calendar/tests/ecal/test-search.c
+++ b/calendar/tests/ecal/test-search.c
@@ -16,7 +16,9 @@ main (gint argc, gchar **argv)
exit (0);
}
- ecal = e_cal_new_from_uri (argv[1], E_CAL_SOURCE_TYPE_EVENT);
+ /* FIXME We don't build ECals from URIs anymore. */
+ /* ecal = e_cal_new_from_uri (argv[1], E_CAL_SOURCE_TYPE_EVENT); */
+ ecal = NULL;
if (!e_cal_open (ecal, TRUE, NULL)) {
printf ("failed to open calendar\n");
diff --git a/docs/reference/calendar/libecal/libecal-sections.txt b/docs/reference/calendar/libecal/libecal-sections.txt
index 54d645f..7ae7dd9 100644
--- a/docs/reference/calendar/libecal/libecal-sections.txt
+++ b/docs/reference/calendar/libecal/libecal-sections.txt
@@ -176,7 +176,6 @@ ECalSetModeStatus
ECalLoadState
ECalAuthFunc
e_cal_new
-e_cal_new_from_uri
e_cal_new_system_calendar
e_cal_new_system_tasks
e_cal_new_system_memos
@@ -184,12 +183,10 @@ e_cal_set_auth_func
e_cal_open
e_cal_open_async
e_cal_refresh
-e_cal_remove
e_cal_uri_list
e_cal_get_source_type
e_cal_get_load_state
e_cal_get_source
-e_cal_get_uri
e_cal_is_read_only
e_cal_get_cal_address
e_cal_get_alarm_email_address
diff --git a/docs/reference/calendar/libecal/tmpl/e-cal.sgml b/docs/reference/calendar/libecal/tmpl/e-cal.sgml
index f360005..da99ccf 100644
--- a/docs/reference/calendar/libecal/tmpl/e-cal.sgml
+++ b/docs/reference/calendar/libecal/tmpl/e-cal.sgml
@@ -102,7 +102,7 @@ Represents an entire calendar or task list, not individual items within them.2
@ecal:
@prompt:
- key:
+ unused:
@user_data:
@Returns:
@@ -117,16 +117,6 @@ Represents an entire calendar or task list, not individual items within them.2
@Returns:
-<!-- ##### FUNCTION e_cal_new_from_uri ##### -->
-<para>
-
-</para>
-
- uri:
- type:
- Returns:
-
-
<!-- ##### FUNCTION e_cal_new_system_calendar ##### -->
<para>
@@ -194,16 +184,6 @@ Represents an entire calendar or task list, not individual items within them.2
@Returns:
-<!-- ##### FUNCTION e_cal_remove ##### -->
-<para>
-
-</para>
-
- ecal:
- error:
- Returns:
-
-
<!-- ##### FUNCTION e_cal_uri_list ##### -->
<para>
@@ -241,15 +221,6 @@ Represents an entire calendar or task list, not individual items within them.2
@Returns:
-<!-- ##### FUNCTION e_cal_get_uri ##### -->
-<para>
-
-</para>
-
- ecal:
- Returns:
-
-
<!-- ##### FUNCTION e_cal_is_read_only ##### -->
<para>
diff --git a/docs/reference/calendar/libecal/tmpl/libecal-unused.sgml b/docs/reference/calendar/libecal/tmpl/libecal-unused.sgml
index b77d556..8fc011f 100644
--- a/docs/reference/calendar/libecal/tmpl/libecal-unused.sgml
+++ b/docs/reference/calendar/libecal/tmpl/libecal-unused.sgml
@@ -572,6 +572,14 @@ ESourceTaskList
@error:
@Returns:
+<!-- ##### FUNCTION e_cal_get_uri ##### -->
+<para>
+
+</para>
+
+ ecal:
+ Returns:
+
<!-- ##### FUNCTION e_cal_listener_construct ##### -->
<para>
@@ -598,6 +606,15 @@ ESourceTaskList
@listener:
+<!-- ##### FUNCTION e_cal_new_from_uri ##### -->
+<para>
+
+</para>
+
+ uri:
+ type:
+ Returns:
+
<!-- ##### FUNCTION e_cal_open_status_enum_get_type ##### -->
<para>
@@ -606,6 +623,15 @@ ESourceTaskList
@void:
@Returns:
+<!-- ##### FUNCTION e_cal_remove ##### -->
+<para>
+
+</para>
+
+ ecal:
+ error:
+ Returns:
+
<!-- ##### FUNCTION e_cal_remove_calendar ##### -->
<para>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]