From: Matthew Barnes Date: Wed, 30 Jan 2013 18:31:28 +0000 (-0500) Subject: EClient: Deprecate e_client_retrieve_capabilities_sync(). X-Git-Tag: upstream/3.7.5~33 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fbd464c4d0e94bfe63f7759cacbe1e4df148dfd7;p=platform%2Fupstream%2Fevolution-data-server.git EClient: Deprecate e_client_retrieve_capabilities_sync(). Capability list will be provided by EBookClient or ECalClient, there's no need to explicitly fetch it. This also deprecates the asynchronous functions: e_client_retrieve_capabilities() e_client_retrieve_capabilities_finish() --- diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c index 158774d..6446bae 100644 --- a/addressbook/libebook/e-book-client.c +++ b/addressbook/libebook/e-book-client.c @@ -763,17 +763,6 @@ book_client_unwrap_dbus_error (EClient *client, } static gboolean -book_client_retrieve_capabilities_sync (EClient *client, - gchar **capabilities, - GCancellable *cancellable, - GError **error) -{ - return e_client_get_backend_property_sync ( - client, CLIENT_BACKEND_PROPERTY_CAPABILITIES, - capabilities, cancellable, error); -} - -static gboolean book_client_get_backend_property_sync (EClient *client, const gchar *prop_name, gchar **prop_value, @@ -1088,7 +1077,6 @@ e_book_client_class_init (EBookClientClass *class) client_class = E_CLIENT_CLASS (class); client_class->get_dbus_proxy = book_client_get_dbus_proxy; client_class->unwrap_dbus_error = book_client_unwrap_dbus_error; - client_class->retrieve_capabilities_sync = book_client_retrieve_capabilities_sync; client_class->get_backend_property_sync = book_client_get_backend_property_sync; client_class->set_backend_property_sync = book_client_set_backend_property_sync; client_class->open_sync = book_client_open_sync; diff --git a/calendar/libecal/e-cal-client.c b/calendar/libecal/e-cal-client.c index 4d0f50b..f21c028 100644 --- a/calendar/libecal/e-cal-client.c +++ b/calendar/libecal/e-cal-client.c @@ -961,17 +961,6 @@ cal_client_unwrap_dbus_error (EClient *client, } static gboolean -cal_client_retrieve_capabilities_sync (EClient *client, - gchar **capabilities, - GCancellable *cancellable, - GError **error) -{ - return e_client_get_backend_property_sync ( - client, CLIENT_BACKEND_PROPERTY_CAPABILITIES, - capabilities, cancellable, error); -} - -static gboolean cal_client_get_backend_property_sync (EClient *client, const gchar *prop_name, gchar **prop_value, @@ -1448,7 +1437,6 @@ e_cal_client_class_init (ECalClientClass *class) client_class = E_CLIENT_CLASS (class); client_class->get_dbus_proxy = cal_client_get_dbus_proxy; client_class->unwrap_dbus_error = cal_client_unwrap_dbus_error; - client_class->retrieve_capabilities_sync = cal_client_retrieve_capabilities_sync; client_class->get_backend_property_sync = cal_client_get_backend_property_sync; client_class->set_backend_property_sync = cal_client_set_backend_property_sync; client_class->open_sync = cal_client_open_sync; diff --git a/docs/reference/libedataserver/libedataserver-sections.txt b/docs/reference/libedataserver/libedataserver-sections.txt index 70a5bcf..f868c25 100644 --- a/docs/reference/libedataserver/libedataserver-sections.txt +++ b/docs/reference/libedataserver/libedataserver-sections.txt @@ -62,9 +62,6 @@ e_client_get_backend_property_sync e_client_refresh e_client_refresh_finish e_client_refresh_sync -e_client_retrieve_capabilities -e_client_retrieve_capabilities_finish -e_client_retrieve_capabilities_sync e_client_util_parse_comma_strings EClientErrorsList e_client_util_unwrap_dbus_error @@ -72,6 +69,9 @@ e_client_util_unwrap_dbus_error CLIENT_BACKEND_PROPERTY_OPENED CLIENT_BACKEND_PROPERTY_OPENING e_client_is_opened +e_client_retrieve_capabilities +e_client_retrieve_capabilities_finish +e_client_retrieve_capabilities_sync e_client_set_backend_property e_client_set_backend_property_finish e_client_set_backend_property_sync diff --git a/libedataserver/e-client.c b/libedataserver/e-client.c index d71595e..2c4a308 100644 --- a/libedataserver/e-client.c +++ b/libedataserver/e-client.c @@ -45,7 +45,6 @@ struct _EClientPrivate { ESource *source; gboolean online; gboolean readonly; - gboolean capabilities_retrieved; GSList *capabilities; GRecMutex ops_mutex; @@ -405,6 +404,17 @@ client_retrieve_capabilities_finish (EClient *client, return TRUE; } +static gboolean +client_retrieve_capabilities_sync (EClient *client, + gchar **capabilities, + GCancellable *cancellable, + GError **error) +{ + return e_client_get_backend_property_sync ( + client, CLIENT_BACKEND_PROPERTY_CAPABILITIES, + capabilities, cancellable, error); +} + /* Helper for client_get_backend_property() */ static void client_get_backend_property_thread (GSimpleAsyncResult *simple, @@ -751,6 +761,7 @@ e_client_class_init (EClientClass *class) class->retrieve_capabilities = client_retrieve_capabilities; class->retrieve_capabilities_finish = client_retrieve_capabilities_finish; + class->retrieve_capabilities_sync = client_retrieve_capabilities_sync; class->get_backend_property = client_get_backend_property; class->get_backend_property_finish = client_get_backend_property_finish; class->set_backend_property = client_set_backend_property; @@ -899,23 +910,19 @@ e_client_get_source (EClient *client) static void client_ensure_capabilities (EClient *client) { - gchar *capabilities; + gchar *capabilities = NULL; g_return_if_fail (E_IS_CLIENT (client)); - if (client->priv->capabilities_retrieved || client->priv->capabilities) + if (client->priv->capabilities != NULL) return; - g_rec_mutex_lock (&client->priv->prop_mutex); - - capabilities = NULL; - e_client_retrieve_capabilities_sync (client, &capabilities, NULL, NULL); - /* e_client_set_capabilities is called inside the previous function */ + /* Despite appearances this function does not actually block. */ + e_client_get_backend_property_sync ( + client, CLIENT_BACKEND_PROPERTY_CAPABILITIES, + &capabilities, NULL, NULL); + e_client_set_capabilities (client, capabilities); g_free (capabilities); - - client->priv->capabilities_retrieved = TRUE; - - g_rec_mutex_unlock (&client->priv->prop_mutex); } /** @@ -1008,9 +1015,6 @@ e_client_set_capabilities (EClient *client, g_rec_mutex_lock (&client->priv->prop_mutex); - if (!capabilities) - client->priv->capabilities_retrieved = FALSE; - g_slist_foreach (client->priv->capabilities, (GFunc) g_free, NULL); g_slist_free (client->priv->capabilities); client->priv->capabilities = e_client_util_parse_comma_strings (capabilities); @@ -1242,6 +1246,8 @@ e_client_emit_backend_property_changed (EClient *client, * from the @callback. * * Since: 3.2 + * + * Deprecated: 3.8: Use e_client_get_capabilities() instead. **/ void e_client_retrieve_capabilities (EClient *client, @@ -1275,6 +1281,8 @@ e_client_retrieve_capabilities (EClient *client, * Returns: %TRUE if successful, %FALSE otherwise. * * Since: 3.2 + * + * Deprecated: 3.8: Use e_client_get_capabilities() instead. **/ gboolean e_client_retrieve_capabilities_finish (EClient *client, @@ -1319,6 +1327,8 @@ e_client_retrieve_capabilities_finish (EClient *client, * Returns: %TRUE if successful, %FALSE otherwise. * * Since: 3.2 + * + * Deprecated: 3.8: Use e_client_get_capabilities() instead. **/ gboolean e_client_retrieve_capabilities_sync (EClient *client, diff --git a/libedataserver/e-client.h b/libedataserver/e-client.h index 03c5d5d..7fd016f 100644 --- a/libedataserver/e-client.h +++ b/libedataserver/e-client.h @@ -182,6 +182,7 @@ struct _EClientClass { GError *dbus_error, GError **out_error); + /* This method is deprecated. */ void (*retrieve_capabilities) (EClient *client, GCancellable *cancellable, @@ -323,21 +324,6 @@ gboolean e_client_refresh_sync (EClient *client, GCancellable *cancellable, GError **error); -void e_client_retrieve_capabilities (EClient *client, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -gboolean e_client_retrieve_capabilities_finish - (EClient *client, - GAsyncResult *result, - gchar **capabilities, - GError **error); -gboolean e_client_retrieve_capabilities_sync - (EClient *client, - gchar **capabilities, - GCancellable *cancellable, - GError **error); - GSList * e_client_util_parse_comma_strings (const gchar *strings); @@ -388,6 +374,20 @@ gboolean e_client_util_unwrap_dbus_error (GError *dbus_error, #define CLIENT_BACKEND_PROPERTY_OPENING "opening" gboolean e_client_is_opened (EClient *client); +void e_client_retrieve_capabilities (EClient *client, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean e_client_retrieve_capabilities_finish + (EClient *client, + GAsyncResult *result, + gchar **capabilities, + GError **error); +gboolean e_client_retrieve_capabilities_sync + (EClient *client, + gchar **capabilities, + GCancellable *cancellable, + GError **error); void e_client_set_backend_property (EClient *client, const gchar *prop_name, const gchar *prop_value,