[evolution-data-server] ECalBackend: Convert get_backend_property() method.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] ECalBackend: Convert get_backend_property() method.
- Date: Mon, 1 Apr 2013 16:16:07 +0000 (UTC)
commit b237c672c37a1a2cf137a1a226c27993f0aaa96c
Author: Matthew Barnes <mbarnes redhat com>
Date: Mon Apr 1 11:08:32 2013 -0400
ECalBackend: Convert get_backend_property() method.
This method does not block, so simplify its signature and ditch the
asynchronous wrappers. Also, ECalBackendSync does not need its own
get_backend_property_sync() method.
Removed functions:
e_cal_backend_get_backend_property_sync()
e_cal_backend_get_backend_property_finish()
e_cal_backend_sync_get_backend_property()
e_data_cal_respond_get_backend_property()
calendar/backends/caldav/e-cal-backend-caldav.c | 56 +++---
.../backends/contacts/e-cal-backend-contacts.c | 30 ++--
calendar/backends/file/e-cal-backend-file.c | 64 +++---
calendar/backends/http/e-cal-backend-http.c | 40 ++--
calendar/backends/weather/e-cal-backend-weather.c | 47 ++---
calendar/libedata-cal/e-cal-backend-sync.c | 69 -------
calendar/libedata-cal/e-cal-backend-sync.h | 14 --
calendar/libedata-cal/e-cal-backend.c | 215 ++------------------
calendar/libedata-cal/e-cal-backend.h | 21 +--
calendar/libedata-cal/e-data-cal.c | 59 +-----
calendar/libedata-cal/e-data-cal.h | 5 -
.../libedata-cal/libedata-cal-sections.txt | 4 -
12 files changed, 146 insertions(+), 478 deletions(-)
---
diff --git a/calendar/backends/caldav/e-cal-backend-caldav.c b/calendar/backends/caldav/e-cal-backend-caldav.c
index a3a31fb..2ced0e1 100644
--- a/calendar/backends/caldav/e-cal-backend-caldav.c
+++ b/calendar/backends/caldav/e-cal-backend-caldav.c
@@ -127,6 +127,18 @@ struct _ECalBackendCalDAVPrivate {
guint refresh_id;
};
+/* Forward Declarations */
+static void caldav_source_authenticator_init
+ (ESourceAuthenticatorInterface *interface);
+
+G_DEFINE_TYPE_WITH_CODE (
+ ECalBackendCalDAV,
+ e_cal_backend_caldav,
+ E_TYPE_CAL_BACKEND_SYNC,
+ G_IMPLEMENT_INTERFACE (
+ E_TYPE_SOURCE_AUTHENTICATOR,
+ caldav_source_authenticator_init))
+
/* ************************************************************************* */
/* Debugging */
@@ -2594,18 +2606,11 @@ get_usermail (ECalBackend *backend)
/* ************************************************************************* */
/* ********** ECalBackendSync virtual function implementation ************* */
-static gboolean
-caldav_get_backend_property (ECalBackendSync *backend,
- EDataCal *cal,
- GCancellable *cancellable,
- const gchar *prop_name,
- gchar **prop_value,
- GError **perror)
+static gchar *
+caldav_get_backend_property (ECalBackend *backend,
+ const gchar *prop_name)
{
- gboolean processed = TRUE;
-
g_return_val_if_fail (prop_name != NULL, FALSE);
- g_return_val_if_fail (prop_value != NULL, FALSE);
if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) {
ESourceWebdav *extension;
@@ -2636,12 +2641,15 @@ caldav_get_backend_property (ECalBackendSync *backend,
"," CAL_STATIC_CAPABILITY_SAVE_SCHEDULES);
}
- *prop_value = g_string_free (caps, FALSE);
+ return g_string_free (caps, FALSE);
+
} else if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS) ||
g_str_equal (prop_name, CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS)) {
- *prop_value = get_usermail (E_CAL_BACKEND (backend));
+ return get_usermail (E_CAL_BACKEND (backend));
+
} else if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_DEFAULT_OBJECT)) {
ECalComponent *comp;
+ gchar *prop_value;
comp = e_cal_component_new ();
@@ -2657,17 +2665,19 @@ caldav_get_backend_property (ECalBackendSync *backend,
break;
default:
g_object_unref (comp);
- g_propagate_error (perror, EDC_ERROR (ObjectNotFound));
- return TRUE;
+ return NULL;
}
- *prop_value = e_cal_component_get_as_string (comp);
+ prop_value = e_cal_component_get_as_string (comp);
+
g_object_unref (comp);
- } else {
- processed = FALSE;
+
+ return prop_value;
}
- return processed;
+ /* Chain up to parent's get_backend_property() method. */
+ return E_CAL_BACKEND_CLASS (e_cal_backend_caldav_parent_class)->
+ get_backend_property (backend, prop_name);
}
static void
@@ -5107,14 +5117,6 @@ caldav_source_authenticator_init (ESourceAuthenticatorInterface *interface)
/* ************************************************************************* */
/* ***************************** GObject Foo ******************************* */
-G_DEFINE_TYPE_WITH_CODE (
- ECalBackendCalDAV,
- e_cal_backend_caldav,
- E_TYPE_CAL_BACKEND_SYNC,
- G_IMPLEMENT_INTERFACE (
- E_TYPE_SOURCE_AUTHENTICATOR,
- caldav_source_authenticator_init))
-
static void
e_cal_backend_caldav_dispose (GObject *object)
{
@@ -5264,7 +5266,7 @@ e_cal_backend_caldav_class_init (ECalBackendCalDAVClass *class)
object_class->finalize = e_cal_backend_caldav_finalize;
object_class->constructed = cal_backend_caldav_constructed;
- sync_class->get_backend_property_sync = caldav_get_backend_property;
+ backend_class->get_backend_property = caldav_get_backend_property;
sync_class->open_sync = caldav_do_open;
sync_class->refresh_sync = caldav_refresh;
diff --git a/calendar/backends/contacts/e-cal-backend-contacts.c
b/calendar/backends/contacts/e-cal-backend-contacts.c
index e17f4ac..16e7b5a 100644
--- a/calendar/backends/contacts/e-cal-backend-contacts.c
+++ b/calendar/backends/contacts/e-cal-backend-contacts.c
@@ -969,34 +969,29 @@ create_anniversary (ECalBackendContacts *cbc,
/* First the empty stubs */
-static gboolean
-e_cal_backend_contacts_get_backend_property (ECalBackendSync *backend,
- EDataCal *cal,
- GCancellable *cancellable,
- const gchar *prop_name,
- gchar **prop_value,
- GError **perror)
+static gchar *
+e_cal_backend_contacts_get_backend_property (ECalBackend *backend,
+ const gchar *prop_name)
{
- gboolean processed = TRUE;
-
g_return_val_if_fail (prop_name != NULL, FALSE);
- g_return_val_if_fail (prop_value != NULL, FALSE);
if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) {
- *prop_value = NULL;
+ return NULL;
+
} else if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS) ||
g_str_equal (prop_name, CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS)) {
/* A contact backend has no particular email address associated
* with it (although that would be a useful feature some day).
*/
- *prop_value = NULL;
+ return NULL;
+
} else if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_DEFAULT_OBJECT)) {
- *prop_value = NULL;
- } else {
- processed = FALSE;
+ return NULL;
}
- return processed;
+ /* Chain up to parent's get_backend_property() method. */
+ return E_CAL_BACKEND_CLASS (e_cal_backend_contacts_parent_class)->
+ get_backend_property (backend, prop_name);
}
static void
@@ -1364,7 +1359,8 @@ e_cal_backend_contacts_class_init (ECalBackendContactsClass *class)
object_class->dispose = e_cal_backend_contacts_dispose;
object_class->constructed = e_cal_backend_contacts_constructed;
- sync_class->get_backend_property_sync = e_cal_backend_contacts_get_backend_property;
+ backend_class->get_backend_property = e_cal_backend_contacts_get_backend_property;
+
sync_class->open_sync = e_cal_backend_contacts_open;
sync_class->create_objects_sync = e_cal_backend_contacts_create_objects;
sync_class->receive_objects_sync = e_cal_backend_contacts_receive_objects;
diff --git a/calendar/backends/file/e-cal-backend-file.c b/calendar/backends/file/e-cal-backend-file.c
index 6c5f621..de3cbe0 100644
--- a/calendar/backends/file/e-cal-backend-file.c
+++ b/calendar/backends/file/e-cal-backend-file.c
@@ -459,36 +459,35 @@ bump_revision (ECalBackendFile *cbfile)
/* Calendar backend methods */
/* Get_email_address handler for the file backend */
-static gboolean
-e_cal_backend_file_get_backend_property (ECalBackendSync *backend,
- EDataCal *cal,
- GCancellable *cancellable,
- const gchar *prop_name,
- gchar **prop_value,
- GError **perror)
+static gchar *
+e_cal_backend_file_get_backend_property (ECalBackend *backend,
+ const gchar *prop_name)
{
- gboolean processed = TRUE;
-
g_return_val_if_fail (prop_name != NULL, FALSE);
- g_return_val_if_fail (prop_value != NULL, FALSE);
if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) {
- *prop_value = g_strdup (CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS ","
- CAL_STATIC_CAPABILITY_NO_THISANDFUTURE ","
- CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED ","
- CAL_STATIC_CAPABILITY_REMOVE_ONLY_THIS ","
- CAL_STATIC_CAPABILITY_NO_THISANDPRIOR ","
- CAL_STATIC_CAPABILITY_BULK_ADDS ","
- CAL_STATIC_CAPABILITY_BULK_MODIFIES ","
- CAL_STATIC_CAPABILITY_BULK_REMOVES);
+ return g_strjoin (
+ ","
+ CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS,
+ CAL_STATIC_CAPABILITY_NO_THISANDFUTURE,
+ CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED,
+ CAL_STATIC_CAPABILITY_REMOVE_ONLY_THIS,
+ CAL_STATIC_CAPABILITY_NO_THISANDPRIOR,
+ CAL_STATIC_CAPABILITY_BULK_ADDS,
+ CAL_STATIC_CAPABILITY_BULK_MODIFIES,
+ CAL_STATIC_CAPABILITY_BULK_REMOVES,
+ NULL);
+
} else if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS) ||
g_str_equal (prop_name, CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS)) {
/* A file backend has no particular email address associated
* with it (although that would be a useful feature some day).
*/
- *prop_value = NULL;
+ return NULL;
+
} else if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_DEFAULT_OBJECT)) {
ECalComponent *comp;
+ gchar *prop_value;
comp = e_cal_component_new ();
@@ -504,25 +503,25 @@ e_cal_backend_file_get_backend_property (ECalBackendSync *backend,
break;
default:
g_object_unref (comp);
- g_propagate_error (perror, EDC_ERROR (ObjectNotFound));
- return TRUE;
+ return NULL;
}
- *prop_value = e_cal_component_get_as_string (comp);
+ prop_value = e_cal_component_get_as_string (comp);
+
g_object_unref (comp);
- } else if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_REVISION)) {
- icalproperty *prop;
- const gchar *revision;
- prop = ensure_revision (E_CAL_BACKEND_FILE (backend));
- revision = icalproperty_get_x (prop);
+ return prop_value;
- *prop_value = g_strdup (revision);
- } else {
- processed = FALSE;
+ } else if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_REVISION)) {
+ icalproperty *prop;
+
+ prop = ensure_revision (E_CAL_BACKEND_FILE (backend));
+ return g_strdup (icalproperty_get_x (prop));
}
- return processed;
+ /* Chain up to parent's get_backend_property() method. */
+ return E_CAL_BACKEND_CLASS (e_cal_backend_file_parent_class)->
+ get_backend_property (backend, prop_name);
}
/* function to resolve timezones */
@@ -3486,7 +3485,8 @@ e_cal_backend_file_class_init (ECalBackendFileClass *class)
object_class->finalize = e_cal_backend_file_finalize;
object_class->constructed = cal_backend_file_constructed;
- sync_class->get_backend_property_sync = e_cal_backend_file_get_backend_property;
+ backend_class->get_backend_property = e_cal_backend_file_get_backend_property;
+
sync_class->open_sync = e_cal_backend_file_open;
sync_class->create_objects_sync = e_cal_backend_file_create_objects;
sync_class->modify_objects_sync = e_cal_backend_file_modify_objects;
diff --git a/calendar/backends/http/e-cal-backend-http.c b/calendar/backends/http/e-cal-backend-http.c
index 740b3b5..cb02e6e 100644
--- a/calendar/backends/http/e-cal-backend-http.c
+++ b/calendar/backends/http/e-cal-backend-http.c
@@ -199,41 +199,42 @@ e_cal_backend_http_constructed (GObject *object)
/* Calendar backend methods */
-static gboolean
-e_cal_backend_http_get_backend_property (ECalBackendSync *backend,
- EDataCal *cal,
- GCancellable *cancellable,
- const gchar *prop_name,
- gchar **prop_value,
- GError **perror)
+static gchar *
+e_cal_backend_http_get_backend_property (ECalBackend *backend,
+ const gchar *prop_name)
{
- gboolean processed = TRUE;
-
- g_return_val_if_fail (prop_name != NULL, FALSE);
- g_return_val_if_fail (prop_value != NULL, FALSE);
+ g_return_val_if_fail (prop_name != NULL, NULL);
if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) {
- *prop_value = g_strdup (CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS ","
- CAL_STATIC_CAPABILITY_REFRESH_SUPPORTED);
+ return g_strjoin (
+ ","
+ CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS,
+ CAL_STATIC_CAPABILITY_REFRESH_SUPPORTED,
+ NULL);
+
} else if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS) ||
g_str_equal (prop_name, CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS)) {
/* A HTTP backend has no particular email address associated
* with it (although that would be a useful feature some day).
*/
- *prop_value = NULL;
+ return NULL;
+
} else if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_DEFAULT_OBJECT)) {
icalcomponent *icalcomp;
icalcomponent_kind kind;
+ gchar *prop_value;
kind = e_cal_backend_get_kind (E_CAL_BACKEND (backend));
icalcomp = e_cal_util_new_component (kind);
- *prop_value = icalcomponent_as_ical_string_r (icalcomp);
+ prop_value = icalcomponent_as_ical_string_r (icalcomp);
icalcomponent_free (icalcomp);
- } else {
- processed = FALSE;
+
+ return prop_value;
}
- return processed;
+ /* Chain up to parent's get_backend_property() method. */
+ return E_CAL_BACKEND_CLASS (e_cal_backend_http_parent_class)->
+ get_backend_property (backend, prop_name);
}
static gchar *
@@ -1502,7 +1503,8 @@ e_cal_backend_http_class_init (ECalBackendHttpClass *class)
object_class->finalize = e_cal_backend_http_finalize;
object_class->constructed = e_cal_backend_http_constructed;
- sync_class->get_backend_property_sync = e_cal_backend_http_get_backend_property;
+ backend_class->get_backend_property = e_cal_backend_http_get_backend_property;
+
sync_class->open_sync = e_cal_backend_http_open;
sync_class->refresh_sync = e_cal_backend_http_refresh;
sync_class->create_objects_sync = e_cal_backend_http_create_objects;
diff --git a/calendar/backends/weather/e-cal-backend-weather.c
b/calendar/backends/weather/e-cal-backend-weather.c
index 0f65e0c..12ede55 100644
--- a/calendar/backends/weather/e-cal-backend-weather.c
+++ b/calendar/backends/weather/e-cal-backend-weather.c
@@ -434,39 +434,37 @@ create_weather (ECalBackendWeather *cbw,
return cal_comp;
}
-static gboolean
-e_cal_backend_weather_get_backend_property (ECalBackendSync *backend,
- EDataCal *cal,
- GCancellable *cancellable,
- const gchar *prop_name,
- gchar **prop_value,
- GError **perror)
+static gchar *
+e_cal_backend_weather_get_backend_property (ECalBackend *backend,
+ const gchar *prop_name)
{
- gboolean processed = TRUE;
-
g_return_val_if_fail (prop_name != NULL, FALSE);
- g_return_val_if_fail (prop_value != NULL, FALSE);
if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CAPABILITIES)) {
- *prop_value = g_strdup (CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT ","
- CAL_STATIC_CAPABILITY_NO_AUDIO_ALARMS ","
- CAL_STATIC_CAPABILITY_NO_DISPLAY_ALARMS ","
- CAL_STATIC_CAPABILITY_NO_PROCEDURE_ALARMS ","
- CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT ","
- CAL_STATIC_CAPABILITY_NO_THISANDFUTURE ","
- CAL_STATIC_CAPABILITY_NO_THISANDPRIOR ","
- CAL_STATIC_CAPABILITY_REFRESH_SUPPORTED);
+ return g_strjoin (
+ ","
+ CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT,
+ CAL_STATIC_CAPABILITY_NO_AUDIO_ALARMS,
+ CAL_STATIC_CAPABILITY_NO_DISPLAY_ALARMS,
+ CAL_STATIC_CAPABILITY_NO_PROCEDURE_ALARMS,
+ CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT,
+ CAL_STATIC_CAPABILITY_NO_THISANDFUTURE,
+ CAL_STATIC_CAPABILITY_NO_THISANDPRIOR,
+ CAL_STATIC_CAPABILITY_REFRESH_SUPPORTED,
+ NULL);
+
} else if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS) ||
g_str_equal (prop_name, CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS)) {
/* Weather has no particular email addresses associated with it */
- *prop_value = NULL;
+ return NULL;
+
} else if (g_str_equal (prop_name, CAL_BACKEND_PROPERTY_DEFAULT_OBJECT)) {
- *prop_value = NULL;
- } else {
- processed = FALSE;
+ return NULL;
}
- return processed;
+ /* Chain up to parent's get_backend_property() method. */
+ return E_CAL_BACKEND_CLASS (e_cal_backend_weather_parent_class)->
+ get_backend_property (backend, prop_name);
}
static void
@@ -809,7 +807,8 @@ e_cal_backend_weather_class_init (ECalBackendWeatherClass *class)
object_class->finalize = e_cal_backend_weather_finalize;
- sync_class->get_backend_property_sync = e_cal_backend_weather_get_backend_property;
+ backend_class->get_backend_property = e_cal_backend_weather_get_backend_property;
+
sync_class->open_sync = e_cal_backend_weather_open;
sync_class->refresh_sync = e_cal_backend_weather_refresh;
sync_class->receive_objects_sync = e_cal_backend_weather_receive_objects;
diff --git a/calendar/libedata-cal/e-cal-backend-sync.c b/calendar/libedata-cal/e-cal-backend-sync.c
index 68ab831..217d67a 100644
--- a/calendar/libedata-cal/e-cal-backend-sync.c
+++ b/calendar/libedata-cal/e-cal-backend-sync.c
@@ -114,42 +114,6 @@ e_cal_backend_sync_refresh (ECalBackendSync *backend,
}
/**
- * e_cal_backend_sync_get_backend_property:
- * @backend: An ECalBackendSync object.
- * @cal: An EDataCal object.
- * @cancellable: a #GCancellable for the operation
- * @prop_name: Property name whose value to retrieve.
- * @prop_value: Return value of the @prop_name.
- * @error: Out parameter for a #GError.
- *
- * Calls the get_backend_property_sync method on the given backend.
- *
- * Returns whether processed this property. Returning FALSE means to pass
- * the call to the ECalBackend parent class, thus neither @error should be
- * set in this case.
- *
- * Since: 3.2
- **/
-gboolean
-e_cal_backend_sync_get_backend_property (ECalBackendSync *backend,
- EDataCal *cal,
- GCancellable *cancellable,
- const gchar *prop_name,
- gchar **prop_value,
- GError **error)
-{
- gboolean res = FALSE;
-
- e_return_data_cal_error_val_if_fail (backend && E_IS_CAL_BACKEND_SYNC (backend), InvalidArg);
- e_return_data_cal_error_val_if_fail (prop_name, InvalidArg);
- e_return_data_cal_error_val_if_fail (prop_value, InvalidArg);
-
- LOCK_WRAPPER_RET_VAL (get_backend_property_sync, (backend, cal, cancellable, prop_name, prop_value,
error));
-
- return res;
-}
-
-/**
* e_cal_backend_sync_get_object:
* @backend: An ECalBackendSync object.
* @cal: An EDataCal object.
@@ -540,24 +504,6 @@ cal_backend_refresh (ECalBackend *backend,
}
static void
-cal_backend_get_backend_property (ECalBackend *backend,
- EDataCal *cal,
- guint32 opid,
- GCancellable *cancellable,
- const gchar *prop_name)
-{
- GError *error = NULL;
- gchar *prop_value = NULL;
-
- if (e_cal_backend_sync_get_backend_property (E_CAL_BACKEND_SYNC (backend), cal, cancellable,
prop_name, &prop_value, &error))
- e_data_cal_respond_get_backend_property (cal, opid, error, prop_value);
- else
- (* E_CAL_BACKEND_CLASS (e_cal_backend_sync_parent_class)->get_backend_property) (backend,
cal, opid, cancellable, prop_name);
-
- g_free (prop_value);
-}
-
-static void
cal_backend_get_object (ECalBackend *backend,
EDataCal *cal,
guint32 opid,
@@ -841,18 +787,6 @@ cal_backend_add_timezone (ECalBackend *backend,
e_data_cal_respond_add_timezone (cal, opid, error);
}
-static gboolean
-cal_backend_sync_get_backend_property (ECalBackendSync *backend,
- EDataCal *cal,
- GCancellable *cancellable,
- const gchar *prop_name,
- gchar **prop_value,
- GError **error)
-{
- /* to indicate to pass to the ECalBackend parent class */
- return FALSE;
-}
-
static void
e_cal_backend_sync_finalize (GObject *object)
{
@@ -880,7 +814,6 @@ e_cal_backend_sync_class_init (ECalBackendSyncClass *class)
backend_class = E_CAL_BACKEND_CLASS (class);
backend_class->open = cal_backend_open;
backend_class->refresh = cal_backend_refresh;
- backend_class->get_backend_property = cal_backend_get_backend_property;
backend_class->get_object = cal_backend_get_object;
backend_class->get_object_list = cal_backend_get_object_list;
backend_class->get_free_busy = cal_backend_get_free_busy;
@@ -893,8 +826,6 @@ e_cal_backend_sync_class_init (ECalBackendSyncClass *class)
backend_class->discard_alarm = cal_backend_discard_alarm;
backend_class->get_timezone = cal_backend_get_timezone;
backend_class->add_timezone = cal_backend_add_timezone;
-
- class->get_backend_property_sync = cal_backend_sync_get_backend_property;
}
static void
diff --git a/calendar/libedata-cal/e-cal-backend-sync.h b/calendar/libedata-cal/e-cal-backend-sync.h
index 79cd8a0..f749d70 100644
--- a/calendar/libedata-cal/e-cal-backend-sync.h
+++ b/calendar/libedata-cal/e-cal-backend-sync.h
@@ -54,13 +54,6 @@ struct _ECalBackendSyncClass {
EDataCal *cal,
GCancellable *cancellable,
GError **error);
- gboolean (*get_backend_property_sync)
- (ECalBackendSync *backend,
- EDataCal *cal,
- GCancellable *cancellable,
- const gchar *prop_name,
- gchar **prop_value,
- GError **error);
/* This method is deprecated. */
gboolean (*set_backend_property_sync)
@@ -167,13 +160,6 @@ void e_cal_backend_sync_refresh (ECalBackendSync *backend,
EDataCal *cal,
GCancellable *cancellable,
GError **error);
-gboolean e_cal_backend_sync_get_backend_property
- (ECalBackendSync *backend,
- EDataCal *cal,
- GCancellable *cancellable,
- const gchar *prop_name,
- gchar **prop_value,
- GError **error);
void e_cal_backend_sync_get_object (ECalBackendSync *backend,
EDataCal *cal,
GCancellable *cancellable,
diff --git a/calendar/libedata-cal/e-cal-backend.c b/calendar/libedata-cal/e-cal-backend.c
index ea79c80..54eefb9 100644
--- a/calendar/libedata-cal/e-cal-backend.c
+++ b/calendar/libedata-cal/e-cal-backend.c
@@ -69,7 +69,6 @@ struct _AsyncContext {
gchar *tzid;
gchar *tzobject;
ECalObjModType mod;
- const gchar *prop_name;
time_t start;
time_t end;
GSList *compid_list;
@@ -359,65 +358,41 @@ cal_backend_set_default_cache_dir (ECalBackend *backend)
g_free (filename);
}
-static void
+static gchar *
cal_backend_get_backend_property (ECalBackend *backend,
- EDataCal *cal,
- guint32 opid,
- GCancellable *cancellable,
const gchar *prop_name)
{
- g_return_if_fail (backend != NULL);
- g_return_if_fail (E_IS_CAL_BACKEND (backend));
- g_return_if_fail (cal != NULL);
- g_return_if_fail (prop_name != NULL);
+ gchar *prop_value = NULL;
+
+ g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
+ g_return_val_if_fail (prop_name != NULL, NULL);
if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_OPENED)) {
- e_data_cal_respond_get_backend_property (
- cal, opid, NULL, "TRUE");
+ prop_value = g_strdup ("TRUE");
} else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_OPENING)) {
- e_data_cal_respond_get_backend_property (
- cal, opid, NULL, "FALSE");
+ prop_value = g_strdup ("FALSE");
} else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_REVISION)) {
- e_data_cal_respond_get_backend_property (
- cal, opid, NULL, "0");
+ prop_value = g_strdup ("0");
} else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_ONLINE)) {
gboolean online;
online = e_backend_get_online (E_BACKEND (backend));
-
- e_data_cal_respond_get_backend_property (
- cal, opid, NULL, online ? "TRUE" : "FALSE");
+ prop_value = g_strdup (online ? "TRUE" : "FALSE");
} else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_READONLY)) {
gboolean readonly;
readonly = e_cal_backend_is_readonly (backend);
-
- e_data_cal_respond_get_backend_property (
- cal, opid, NULL, readonly ? "TRUE" : "FALSE");
+ prop_value = g_strdup (readonly ? "TRUE" : "FALSE");
} else if (g_str_equal (prop_name, CLIENT_BACKEND_PROPERTY_CACHE_DIR)) {
- const gchar *cache_dir;
-
- cache_dir = e_cal_backend_get_cache_dir (backend);
-
- e_data_cal_respond_get_backend_property (
- cal, opid, NULL, cache_dir);
-
- } else {
- GError *error;
-
- error = e_data_cal_create_error_fmt (
- NotSupported,
- _("Unknown calendar property '%s'"), prop_name);
-
- /* Takes ownership of the GError. */
- e_data_cal_respond_get_backend_property (
- cal, opid, error, NULL);
+ prop_value = e_cal_backend_dup_cache_dir (backend);
}
+
+ return prop_value;
}
static gboolean
@@ -1164,180 +1139,30 @@ e_cal_backend_create_cache_filename (ECalBackend *backend,
}
/**
- * e_cal_backend_get_backend_property_sync:
+ * e_cal_backend_get_backend_property:
* @backend: an #ECalBackend
* @prop_name: a backend property name
- * @cancellable: optional #GCancellable object, or %NULL
- * @error: return location for a #GError, or %NULL
*
* Obtains the value of the backend property named @prop_name.
- *
- * Despite appearances, this function does not actually block. So the
- * @cancellable can safely be %NULL. If can, however, return an error
- * if @prop_name is not recognized.
- *
- * The returned string must be freed with g_free() when finished with it.
+ * Freed the returned string with g_free() when finished with it.
*
* Returns: the value for @prop_name
*
* Since: 3.10
**/
gchar *
-e_cal_backend_get_backend_property_sync (ECalBackend *backend,
- const gchar *prop_name,
- GCancellable *cancellable,
- GError **error)
+e_cal_backend_get_backend_property (ECalBackend *backend,
+ const gchar *prop_name)
{
- EAsyncClosure *closure;
- GAsyncResult *result;
- gchar *prop_value;
+ ECalBackendClass *class;
g_return_val_if_fail (E_IS_CAL_BACKEND (backend), NULL);
g_return_val_if_fail (prop_name != NULL, NULL);
- closure = e_async_closure_new ();
-
- e_cal_backend_get_backend_property (
- backend, prop_name, cancellable,
- e_async_closure_callback, closure);
-
- result = e_async_closure_wait (closure);
-
- prop_value = e_cal_backend_get_backend_property_finish (
- backend, result, error);
-
- e_async_closure_free (closure);
-
- return prop_value;
-}
-
-/* Helper for e_cal_backend_get_backend_property() */
-static void
-cal_backend_get_backend_property_thread (GSimpleAsyncResult *simple,
- GObject *source_object,
- GCancellable *cancellable)
-{
- ECalBackend *backend;
- ECalBackendClass *class;
- EDataCal *data_cal;
- AsyncContext *async_context;
- guint32 opid;
-
- backend = E_CAL_BACKEND (source_object);
-
class = E_CAL_BACKEND_GET_CLASS (backend);
- g_return_if_fail (class->get_backend_property != NULL);
+ g_return_val_if_fail (class->get_backend_property != NULL, NULL);
- data_cal = e_cal_backend_ref_data_cal (backend);
- g_return_if_fail (data_cal != NULL);
-
- async_context = g_simple_async_result_get_op_res_gpointer (simple);
-
- opid = cal_backend_stash_operation (backend, simple);
-
- class->get_backend_property (
- backend, data_cal, opid, cancellable,
- async_context->prop_name);
-
- g_object_unref (data_cal);
-}
-
-/**
- * e_cal_backend_get_backend_property:
- * @backend: an #ECalBackend
- * @prop_name: a backend property name
- * @cancellable: optional #GCancellable object, or %NULL
- * @callback: a #GAsyncReadyCallback to call when the request is satisfied
- * @user_data: data to pass to the callback function
- *
- * Asynchronously obtains the value of the backend property named @prop_name.
- *
- * Despite appearances, e_cal_backend_get_backend_property_sync() does not
- * actually block, and is more convenient than this function. This function
- * exists for the moment merely to invoke the class method and collect the
- * result from #EDataCal.
- *
- * When the operation is finished, @callback will be called. You can then
- * call e_cal_backend_get_backend_property_finish() to get the result of
- * the operation.
- *
- * Since: 3.10
- **/
-void
-e_cal_backend_get_backend_property (ECalBackend *backend,
- const gchar *prop_name,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data)
-{
- GSimpleAsyncResult *simple;
- AsyncContext *async_context;
-
- g_return_if_fail (E_IS_CAL_BACKEND (backend));
- g_return_if_fail (prop_name != NULL);
-
- async_context = g_slice_new0 (AsyncContext);
- async_context->prop_name = g_intern_string (prop_name);
- async_context->string_queue = &async_context->result_queue;
-
- simple = g_simple_async_result_new (
- G_OBJECT (backend), callback, user_data,
- e_cal_backend_get_backend_property);
-
- g_simple_async_result_set_check_cancellable (simple, cancellable);
-
- g_simple_async_result_set_op_res_gpointer (
- simple, async_context, (GDestroyNotify) async_context_free);
-
- cal_backend_push_operation (
- backend, simple, cancellable, FALSE,
- cal_backend_get_backend_property_thread);
-
- cal_backend_dispatch_next_operation (backend);
-
- g_object_unref (simple);
-}
-
-/**
- * e_cal_backend_get_backend_property_finish:
- * @backend: an #ECalBackend
- * @result: a #GAsyncResult
- * @error: return location for a #GError, or %NULL
- *
- * Finishes the operation started with e_cal_backend_get_backend_property().
- *
- * The returned string must be freed with g_free() when finished with it.
- *
- * Returns: the requested property value
- *
- * Since: 3.10
- **/
-gchar *
-e_cal_backend_get_backend_property_finish (ECalBackend *backend,
- GAsyncResult *result,
- GError **error)
-{
- GSimpleAsyncResult *simple;
- AsyncContext *async_context;
- gchar *prop_value;
-
- g_return_val_if_fail (
- g_simple_async_result_is_valid (
- result, G_OBJECT (backend),
- e_cal_backend_get_backend_property), NULL);
-
- simple = G_SIMPLE_ASYNC_RESULT (result);
- async_context = g_simple_async_result_get_op_res_gpointer (simple);
-
- if (g_simple_async_result_propagate_error (simple, error))
- return NULL;
-
- prop_value = g_queue_pop_head (&async_context->result_queue);
- g_return_val_if_fail (prop_value != NULL, NULL);
-
- g_warn_if_fail (g_queue_is_empty (&async_context->result_queue));
-
- return prop_value;
+ return class->get_backend_property (backend, prop_name);
}
/**
diff --git a/calendar/libedata-cal/e-cal-backend.h b/calendar/libedata-cal/e-cal-backend.h
index 2d7e0a5..304d27f 100644
--- a/calendar/libedata-cal/e-cal-backend.h
+++ b/calendar/libedata-cal/e-cal-backend.h
@@ -111,10 +111,7 @@ struct _ECalBackendClass {
EBackendClass parent_class;
/* Virtual methods */
- void (*get_backend_property) (ECalBackend *backend,
- EDataCal *cal,
- guint32 opid,
- GCancellable *cancellable,
+ gchar * (*get_backend_property) (ECalBackend *backend,
const gchar *prop_name);
void (*open) (ECalBackend *backend,
@@ -236,21 +233,9 @@ void e_cal_backend_remove_view (ECalBackend *backend,
EDataCalView *view);
GList * e_cal_backend_list_views (ECalBackend *backend);
-gchar * e_cal_backend_get_backend_property_sync
- (ECalBackend *backend,
- const gchar *prop_name,
- GCancellable *cancellable,
- GError **error);
-void e_cal_backend_get_backend_property
+gchar * e_cal_backend_get_backend_property
(ECalBackend *backend,
- const gchar *prop_name,
- GCancellable *cancellable,
- GAsyncReadyCallback callback,
- gpointer user_data);
-gchar * e_cal_backend_get_backend_property_finish
- (ECalBackend *backend,
- GAsyncResult *result,
- GError **error);
+ const gchar *prop_name);
gboolean e_cal_backend_open_sync (ECalBackend *backend,
GCancellable *cancellable,
GError **error);
diff --git a/calendar/libedata-cal/e-data-cal.c b/calendar/libedata-cal/e-data-cal.c
index a570c7f..b7c4362 100644
--- a/calendar/libedata-cal/e-data-cal.c
+++ b/calendar/libedata-cal/e-data-cal.c
@@ -1537,50 +1537,6 @@ e_data_cal_respond_refresh (EDataCal *cal,
}
/**
- * e_data_cal_respond_get_backend_property:
- * @cal: A calendar client interface.
- * @error: Operation error, if any, automatically freed if passed it.
- * @prop_value: Value of a property
- *
- * Notifies listeners of the completion of the get_backend_property method call.
- *
- * Since: 3.2
- */
-void
-e_data_cal_respond_get_backend_property (EDataCal *cal,
- guint32 opid,
- GError *error,
- const gchar *prop_value)
-{
- ECalBackend *backend;
- GSimpleAsyncResult *simple;
- GQueue *queue = NULL;
-
- g_return_if_fail (E_IS_DATA_CAL (cal));
-
- backend = e_data_cal_ref_backend (cal);
- g_return_if_fail (backend != NULL);
-
- simple = e_cal_backend_prepare_for_completion (backend, opid, &queue);
- g_return_if_fail (simple != NULL);
- g_return_if_fail (queue != NULL);
-
- if (error == NULL) {
- /* Convert NULL to an empty string. */
- if (prop_value == NULL)
- prop_value = "";
- g_queue_push_tail (queue, g_strdup (prop_value));
- } else {
- g_simple_async_result_take_error (simple, error);
- }
-
- g_simple_async_result_complete_in_idle (simple);
-
- g_object_unref (simple);
- g_object_unref (backend);
-}
-
-/**
* e_data_cal_respond_get_object:
* @cal: A calendar client interface.
* @error: Operation error, if any, automatically freed if passed it.
@@ -2502,36 +2458,31 @@ data_cal_constructed (GObject *object)
/* XXX Initialize the rest of the properties. */
prop_name = CLIENT_BACKEND_PROPERTY_CAPABILITIES;
- prop_value = e_cal_backend_get_backend_property_sync (
- backend, prop_name, NULL, NULL);
+ prop_value = e_cal_backend_get_backend_property (backend, prop_name);
e_data_cal_report_backend_property_changed (
cal, prop_name, prop_value);
g_free (prop_value);
prop_name = CLIENT_BACKEND_PROPERTY_REVISION;
- prop_value = e_cal_backend_get_backend_property_sync (
- backend, prop_name, NULL, NULL);
+ prop_value = e_cal_backend_get_backend_property (backend, prop_name);
e_data_cal_report_backend_property_changed (
cal, prop_name, prop_value);
g_free (prop_value);
prop_name = CAL_BACKEND_PROPERTY_CAL_EMAIL_ADDRESS;
- prop_value = e_cal_backend_get_backend_property_sync (
- backend, prop_name, NULL, NULL);
+ prop_value = e_cal_backend_get_backend_property (backend, prop_name);
e_data_cal_report_backend_property_changed (
cal, prop_name, prop_value);
g_free (prop_value);
prop_name = CAL_BACKEND_PROPERTY_ALARM_EMAIL_ADDRESS;
- prop_value = e_cal_backend_get_backend_property_sync (
- backend, prop_name, NULL, NULL);
+ prop_value = e_cal_backend_get_backend_property (backend, prop_name);
e_data_cal_report_backend_property_changed (
cal, prop_name, prop_value);
g_free (prop_value);
prop_name = CAL_BACKEND_PROPERTY_DEFAULT_OBJECT;
- prop_value = e_cal_backend_get_backend_property_sync (
- backend, prop_name, NULL, NULL);
+ prop_value = e_cal_backend_get_backend_property (backend, prop_name);
e_data_cal_report_backend_property_changed (
cal, prop_name, prop_value);
g_free (prop_value);
diff --git a/calendar/libedata-cal/e-data-cal.h b/calendar/libedata-cal/e-data-cal.h
index b3bb673..c4e77c5 100644
--- a/calendar/libedata-cal/e-data-cal.h
+++ b/calendar/libedata-cal/e-data-cal.h
@@ -180,11 +180,6 @@ void e_data_cal_respond_open (EDataCal *cal,
void e_data_cal_respond_refresh (EDataCal *cal,
guint32 opid,
GError *error);
-void e_data_cal_respond_get_backend_property
- (EDataCal *cal,
- guint32 opid,
- GError *error,
- const gchar *prop_value);
void e_data_cal_respond_get_object (EDataCal *cal,
guint32 opid,
GError *error,
diff --git a/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt
b/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt
index 9db891e..7d6330e 100644
--- a/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt
+++ b/docs/reference/calendar/libedata-cal/libedata-cal-sections.txt
@@ -22,9 +22,7 @@ e_cal_backend_create_cache_filename
e_cal_backend_add_view
e_cal_backend_remove_view
e_cal_backend_list_views
-e_cal_backend_get_backend_property_sync
e_cal_backend_get_backend_property
-e_cal_backend_get_backend_property_finish
e_cal_backend_open_sync
e_cal_backend_open
e_cal_backend_open_finish
@@ -212,7 +210,6 @@ ECalBackendSync
e_cal_backend_sync_set_lock
e_cal_backend_sync_open
e_cal_backend_sync_refresh
-e_cal_backend_sync_get_backend_property
e_cal_backend_sync_get_object
e_cal_backend_sync_get_object_list
e_cal_backend_sync_get_free_busy
@@ -263,7 +260,6 @@ e_data_cal_get_object_path
e_data_cal_is_opened
e_data_cal_respond_open
e_data_cal_respond_refresh
-e_data_cal_respond_get_backend_property
e_data_cal_respond_get_object
e_data_cal_respond_get_object_list
e_data_cal_respond_get_free_busy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]