[evolution-data-server] EClient: Deprecate unwrap_dbus_error() method.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] EClient: Deprecate unwrap_dbus_error() method.
- Date: Fri, 22 Feb 2013 16:58:13 +0000 (UTC)
commit 0b3d40a5776ce7e82b4bfc856ac05ca22bca7fba
Author: Matthew Barnes <mbarnes redhat com>
Date: Fri Feb 22 11:31:46 2013 -0500
EClient: Deprecate unwrap_dbus_error() method.
The generated D-Bus proxy classes return errors according to the usual
GLib conventions, and EDataBook and EDataCal convert server-side error
codes to client-side error codes before completing method invocations,
so we don't need this method anymore.
Added a default implementation to EClient which is just a pass-through.
addressbook/libebook/e-book-client.c | 62 ------------
calendar/libecal/e-cal-client.c | 64 ------------
.../libedataserver/libedataserver-sections.txt | 2 +-
libedataserver/e-client.c | 103 +++++--------------
libedataserver/e-client.h | 7 +-
5 files changed, 32 insertions(+), 206 deletions(-)
---
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index 0244841..3560456 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -179,56 +179,6 @@ run_in_thread_closure_free (RunInThreadClosure *run_in_thread_closure)
* @CLIENT_BACKEND_PROPERTY_CACHE_DIR, @CLIENT_BACKEND_PROPERTY_CAPABILITIES
*/
-/*
- * If the specified GError is a remote error, then create a new error
- * representing the remote error. If the error is anything else, then
- * leave it alone.
- */
-static gboolean
-unwrap_dbus_error (GError *error,
- GError **client_error)
-{
- #define err(a,b) "org.gnome.evolution.dataserver.AddressBook." a, b
- static EClientErrorsList book_errors[] = {
- { err ("Success", -1) },
- { err ("ContactNotFound", E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND) },
- { err ("ContactIDAlreadyExists",
E_BOOK_CLIENT_ERROR_CONTACT_ID_ALREADY_EXISTS) },
- { err ("NoSuchBook", E_BOOK_CLIENT_ERROR_NO_SUCH_BOOK) },
- { err ("BookRemoved", E_BOOK_CLIENT_ERROR_NO_SUCH_SOURCE) },
- { err ("NoSpace", E_BOOK_CLIENT_ERROR_NO_SPACE) }
- }, cl_errors[] = {
- { err ("Busy", E_CLIENT_ERROR_BUSY) },
- { err ("RepositoryOffline", E_CLIENT_ERROR_REPOSITORY_OFFLINE) },
- { err ("OfflineUnavailable", E_CLIENT_ERROR_OFFLINE_UNAVAILABLE) },
- { err ("PermissionDenied", E_CLIENT_ERROR_PERMISSION_DENIED) },
- { err ("AuthenticationFailed", E_CLIENT_ERROR_AUTHENTICATION_FAILED) },
- { err ("AuthenticationRequired", E_CLIENT_ERROR_AUTHENTICATION_REQUIRED) },
- { err ("CouldNotCancel", E_CLIENT_ERROR_COULD_NOT_CANCEL) },
- { err ("InvalidArg", E_CLIENT_ERROR_INVALID_ARG) },
- { err ("NotSupported", E_CLIENT_ERROR_NOT_SUPPORTED) },
- { err ("UnsupportedAuthenticationMethod",
E_CLIENT_ERROR_UNSUPPORTED_AUTHENTICATION_METHOD) },
- { err ("TLSNotAvailable", E_CLIENT_ERROR_TLS_NOT_AVAILABLE) },
- { err ("SearchSizeLimitExceeded", E_CLIENT_ERROR_SEARCH_SIZE_LIMIT_EXCEEDED) },
- { err ("SearchTimeLimitExceeded", E_CLIENT_ERROR_SEARCH_TIME_LIMIT_EXCEEDED) },
- { err ("InvalidQuery", E_CLIENT_ERROR_INVALID_QUERY) },
- { err ("QueryRefused", E_CLIENT_ERROR_QUERY_REFUSED) },
- { err ("NotOpened", E_CLIENT_ERROR_NOT_OPENED) },
- { err ("UnsupportedField", E_CLIENT_ERROR_OTHER_ERROR) },
- { err ("InvalidServerVersion", E_CLIENT_ERROR_OTHER_ERROR) },
- { err ("OutOfSync", E_CLIENT_ERROR_OUT_OF_SYNC) },
- { err ("OtherError", E_CLIENT_ERROR_OTHER_ERROR) }
- };
- #undef err
-
- if (error == NULL)
- return TRUE;
-
- if (!e_client_util_unwrap_dbus_error (error, client_error, book_errors, G_N_ELEMENTS (book_errors),
E_BOOK_CLIENT_ERROR, TRUE))
- e_client_util_unwrap_dbus_error (error, client_error, cl_errors, G_N_ELEMENTS (cl_errors),
E_CLIENT_ERROR, FALSE);
-
- return FALSE;
-}
-
static volatile gint active_book_clients = 0;
static guint book_factory_watcher_id = 0;
static EDBusAddressBookFactory *book_factory = NULL;
@@ -713,14 +663,6 @@ book_client_get_dbus_proxy (EClient *client)
return G_DBUS_PROXY (priv->dbus_proxy);
}
-static void
-book_client_unwrap_dbus_error (EClient *client,
- GError *dbus_error,
- GError **out_error)
-{
- unwrap_dbus_error (dbus_error, out_error);
-}
-
static gboolean
book_client_get_backend_property_sync (EClient *client,
const gchar *prop_name,
@@ -879,7 +821,6 @@ book_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
book_factory_activate (cancellable, &error);
if (error != NULL) {
- unwrap_dbus_error (error, &error);
g_simple_async_result_take_error (simple, error);
return;
}
@@ -893,7 +834,6 @@ book_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
((object_path == NULL) && (error != NULL)));
if (error != NULL) {
- unwrap_dbus_error (error, &error);
g_simple_async_result_take_error (simple, error);
return;
}
@@ -914,7 +854,6 @@ book_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
((priv->dbus_proxy == NULL) && (error != NULL)));
if (error != NULL) {
- unwrap_dbus_error (error, &error);
g_simple_async_result_take_error (simple, error);
return;
}
@@ -1031,7 +970,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->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 b2b6c88..44fd444 100644
--- a/calendar/libecal/e-cal-client.c
+++ b/calendar/libecal/e-cal-client.c
@@ -292,57 +292,6 @@ e_cal_client_error_create (ECalClientError code,
return g_error_new_literal (E_CAL_CLIENT_ERROR, code, custom_msg ? custom_msg :
e_cal_client_error_to_string (code));
}
-/*
- * If the specified GError is a remote error, then create a new error
- * representing the remote error. If the error is anything else, then
- * leave it alone.
- */
-static gboolean
-unwrap_dbus_error (GError *error,
- GError **client_error)
-{
- #define err(a,b) "org.gnome.evolution.dataserver.Calendar." a, b
- static EClientErrorsList cal_errors[] = {
- { err ("Success", -1) },
- { err ("ObjectNotFound", E_CAL_CLIENT_ERROR_OBJECT_NOT_FOUND) },
- { err ("InvalidObject", E_CAL_CLIENT_ERROR_INVALID_OBJECT) },
- { err ("ObjectIdAlreadyExists", E_CAL_CLIENT_ERROR_OBJECT_ID_ALREADY_EXISTS)
},
- { err ("NoSuchCal", E_CAL_CLIENT_ERROR_NO_SUCH_CALENDAR) },
- { err ("UnknownUser", E_CAL_CLIENT_ERROR_UNKNOWN_USER) },
- { err ("InvalidRange", E_CAL_CLIENT_ERROR_INVALID_RANGE) },
- }, cl_errors[] = {
- { err ("Busy", E_CLIENT_ERROR_BUSY) },
- { err ("InvalidArg", E_CLIENT_ERROR_INVALID_ARG) },
- { err ("RepositoryOffline", E_CLIENT_ERROR_REPOSITORY_OFFLINE) },
- { err ("OfflineUnavailable", E_CLIENT_ERROR_OFFLINE_UNAVAILABLE) },
- { err ("PermissionDenied", E_CLIENT_ERROR_PERMISSION_DENIED) },
- { err ("AuthenticationFailed", E_CLIENT_ERROR_AUTHENTICATION_FAILED) },
- { err ("AuthenticationRequired", E_CLIENT_ERROR_AUTHENTICATION_REQUIRED) },
- { err ("CouldNotCancel", E_CLIENT_ERROR_COULD_NOT_CANCEL) },
- { err ("NotSupported", E_CLIENT_ERROR_NOT_SUPPORTED) },
- { err ("UnsupportedAuthenticationMethod",
E_CLIENT_ERROR_UNSUPPORTED_AUTHENTICATION_METHOD) },
- { err ("TLSNotAvailable", E_CLIENT_ERROR_TLS_NOT_AVAILABLE) },
- { err ("SearchSizeLimitExceeded", E_CLIENT_ERROR_SEARCH_SIZE_LIMIT_EXCEEDED) },
- { err ("SearchTimeLimitExceeded", E_CLIENT_ERROR_SEARCH_TIME_LIMIT_EXCEEDED) },
- { err ("InvalidQuery", E_CLIENT_ERROR_INVALID_QUERY) },
- { err ("QueryRefused", E_CLIENT_ERROR_QUERY_REFUSED) },
- { err ("NotOpened", E_CLIENT_ERROR_NOT_OPENED) },
- { err ("UnsupportedField", E_CLIENT_ERROR_OTHER_ERROR) },
- { err ("UnsupportedMethod", E_CLIENT_ERROR_OTHER_ERROR) },
- { err ("InvalidServerVersion", E_CLIENT_ERROR_OTHER_ERROR) },
- { err ("OtherError", E_CLIENT_ERROR_OTHER_ERROR) }
- };
- #undef err
-
- if (error == NULL)
- return TRUE;
-
- if (!e_client_util_unwrap_dbus_error (error, client_error, cal_errors, G_N_ELEMENTS (cal_errors),
E_CAL_CLIENT_ERROR, TRUE))
- e_client_util_unwrap_dbus_error (error, client_error, cl_errors, G_N_ELEMENTS (cl_errors),
E_CLIENT_ERROR, FALSE);
-
- return FALSE;
-}
-
static volatile gint active_cal_clients = 0;
static guint cal_factory_watcher_id = 0;
static EDBusCalendarFactory *cal_factory = NULL;
@@ -920,14 +869,6 @@ cal_client_get_dbus_proxy (EClient *client)
return G_DBUS_PROXY (priv->dbus_proxy);
}
-static void
-cal_client_unwrap_dbus_error (EClient *client,
- GError *dbus_error,
- GError **out_error)
-{
- unwrap_dbus_error (dbus_error, out_error);
-}
-
static gboolean
cal_client_get_backend_property_sync (EClient *client,
const gchar *prop_name,
@@ -1078,7 +1019,6 @@ cal_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
cal_factory_activate (cancellable, &error);
if (error != NULL) {
- unwrap_dbus_error (error, &error);
g_simple_async_result_take_error (simple, error);
return;
}
@@ -1109,7 +1049,6 @@ cal_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
((object_path == NULL) && (error != NULL)));
if (object_path == NULL) {
- unwrap_dbus_error (error, &error);
g_simple_async_result_take_error (simple, error);
return;
}
@@ -1130,7 +1069,6 @@ cal_client_init_in_dbus_thread (GSimpleAsyncResult *simple,
((priv->dbus_proxy == NULL) && (error != NULL)));
if (error != NULL) {
- unwrap_dbus_error (error, &error);
g_simple_async_result_take_error (simple, error);
return;
}
@@ -1404,7 +1342,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->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;
@@ -2454,7 +2391,6 @@ get_objects_sync (ECalClient *client,
GError *error = NULL;
if (!e_cal_client_get_objects_for_uid_sync (client, uid, &objects, NULL, &error)) {
- unwrap_dbus_error (error, &error);
g_message ("Failed to get recurrence objects for uid %s \n", error ? error->message :
"Unknown error");
g_clear_error (&error);
return NULL;
diff --git a/docs/reference/libedataserver/libedataserver-sections.txt
b/docs/reference/libedataserver/libedataserver-sections.txt
index 15eef56..8e79555 100644
--- a/docs/reference/libedataserver/libedataserver-sections.txt
+++ b/docs/reference/libedataserver/libedataserver-sections.txt
@@ -54,7 +54,6 @@ e_client_check_capability
e_client_check_refresh_supported
e_client_is_readonly
e_client_is_online
-e_client_unwrap_dbus_error
e_client_get_backend_property
e_client_get_backend_property_finish
e_client_get_backend_property_sync
@@ -69,6 +68,7 @@ CLIENT_BACKEND_PROPERTY_OPENED
CLIENT_BACKEND_PROPERTY_OPENING
e_client_is_opened
e_client_cancel_all
+e_client_unwrap_dbus_error
e_client_retrieve_capabilities
e_client_retrieve_capabilities_finish
e_client_retrieve_capabilities_sync
diff --git a/libedataserver/e-client.c b/libedataserver/e-client.c
index fa54b02..43babbb 100644
--- a/libedataserver/e-client.c
+++ b/libedataserver/e-client.c
@@ -308,6 +308,17 @@ client_get_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
+static void
+client_unwrap_dbus_error (EClient *client,
+ GError *dbus_error,
+ GError **out_error)
+{
+ /* This method is deprecated. Make it a no-op. */
+
+ if (out_error != NULL)
+ *out_error = dbus_error;
+}
+
/* Helper for client_retrieve_capabilities() */
static void
client_retrieve_capabilities_thread (GSimpleAsyncResult *simple,
@@ -739,6 +750,7 @@ e_client_class_init (EClientClass *class)
object_class->get_property = client_get_property;
object_class->finalize = client_finalize;
+ class->unwrap_dbus_error = client_unwrap_dbus_error;
class->retrieve_capabilities = client_retrieve_capabilities;
class->retrieve_capabilities_finish = client_retrieve_capabilities_finish;
class->retrieve_capabilities_sync = client_retrieve_capabilities_sync;
@@ -1196,9 +1208,6 @@ e_client_retrieve_capabilities_finish (EClient *client,
e_client_set_capabilities (client, res ? *capabilities : NULL);
- if (error && *error)
- e_client_unwrap_dbus_error (client, *error, error);
-
return res;
}
@@ -1242,9 +1251,6 @@ e_client_retrieve_capabilities_sync (EClient *client,
e_client_set_capabilities (client, res ? *capabilities : NULL);
- if (error && *error)
- e_client_unwrap_dbus_error (client, *error, error);
-
return res;
}
@@ -1302,7 +1308,6 @@ e_client_get_backend_property_finish (EClient *client,
GError **error)
{
EClientClass *class;
- gboolean res;
g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
g_return_val_if_fail (prop_value != NULL, FALSE);
@@ -1311,12 +1316,8 @@ e_client_get_backend_property_finish (EClient *client,
g_return_val_if_fail (class != NULL, FALSE);
g_return_val_if_fail (class->get_backend_property_finish != NULL, FALSE);
- res = class->get_backend_property_finish (client, result, prop_value, error);
-
- if (error && *error)
- e_client_unwrap_dbus_error (client, *error, error);
-
- return res;
+ return class->get_backend_property_finish (
+ client, result, prop_value, error);
}
/**
@@ -1341,7 +1342,6 @@ e_client_get_backend_property_sync (EClient *client,
GError **error)
{
EClientClass *class;
- gboolean res;
g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
g_return_val_if_fail (prop_name != NULL, FALSE);
@@ -1351,12 +1351,8 @@ e_client_get_backend_property_sync (EClient *client,
g_return_val_if_fail (class != NULL, FALSE);
g_return_val_if_fail (class->get_backend_property_sync != NULL, FALSE);
- res = class->get_backend_property_sync (client, prop_name, prop_value, cancellable, error);
-
- if (error && *error)
- e_client_unwrap_dbus_error (client, *error, error);
-
- return res;
+ return class->get_backend_property_sync (
+ client, prop_name, prop_value, cancellable, error);
}
/**
@@ -1420,7 +1416,6 @@ e_client_set_backend_property_finish (EClient *client,
GError **error)
{
EClientClass *class;
- gboolean res;
g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
@@ -1428,12 +1423,7 @@ e_client_set_backend_property_finish (EClient *client,
g_return_val_if_fail (class != NULL, FALSE);
g_return_val_if_fail (class->set_backend_property_finish != NULL, FALSE);
- res = class->set_backend_property_finish (client, result, error);
-
- if (error && *error)
- e_client_unwrap_dbus_error (client, *error, error);
-
- return res;
+ return class->set_backend_property_finish (client, result, error);
}
/**
@@ -1462,7 +1452,6 @@ e_client_set_backend_property_sync (EClient *client,
GError **error)
{
EClientClass *class;
- gboolean res;
g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
g_return_val_if_fail (prop_name != NULL, FALSE);
@@ -1472,12 +1461,8 @@ e_client_set_backend_property_sync (EClient *client,
g_return_val_if_fail (class != NULL, FALSE);
g_return_val_if_fail (class->set_backend_property_sync != NULL, FALSE);
- res = class->set_backend_property_sync (client, prop_name, prop_value, cancellable, error);
-
- if (error && *error)
- e_client_unwrap_dbus_error (client, *error, error);
-
- return res;
+ return class->set_backend_property_sync (
+ client, prop_name, prop_value, cancellable, error);
}
/**
@@ -1540,7 +1525,6 @@ e_client_open_finish (EClient *client,
GError **error)
{
EClientClass *class;
- gboolean res;
g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
@@ -1548,12 +1532,7 @@ e_client_open_finish (EClient *client,
g_return_val_if_fail (class != NULL, FALSE);
g_return_val_if_fail (class->open_finish != NULL, FALSE);
- res = class->open_finish (client, result, error);
-
- if (error && *error)
- e_client_unwrap_dbus_error (client, *error, error);
-
- return res;
+ return class->open_finish (client, result, error);
}
/**
@@ -1579,18 +1558,12 @@ e_client_open_sync (EClient *client,
GError **error)
{
EClientClass *class;
- gboolean res;
class = E_CLIENT_GET_CLASS (client);
g_return_val_if_fail (class != NULL, FALSE);
g_return_val_if_fail (class->open_sync != NULL, FALSE);
- res = class->open_sync (client, only_if_exists, cancellable, error);
-
- if (error && *error)
- e_client_unwrap_dbus_error (client, *error, error);
-
- return res;
+ return class->open_sync (client, only_if_exists, cancellable, error);
}
/**
@@ -1646,7 +1619,6 @@ e_client_remove_finish (EClient *client,
GError **error)
{
EClientClass *class;
- gboolean res;
g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
@@ -1654,12 +1626,7 @@ e_client_remove_finish (EClient *client,
g_return_val_if_fail (class != NULL, FALSE);
g_return_val_if_fail (class->remove_finish != NULL, FALSE);
- res = class->remove_finish (client, result, error);
-
- if (error && *error)
- e_client_unwrap_dbus_error (client, *error, error);
-
- return res;
+ return class->remove_finish (client, result, error);
}
/**
@@ -1683,18 +1650,12 @@ e_client_remove_sync (EClient *client,
GError **error)
{
EClientClass *class;
- gboolean res;
class = E_CLIENT_GET_CLASS (client);
g_return_val_if_fail (class != NULL, FALSE);
g_return_val_if_fail (class->remove_sync != NULL, FALSE);
- res = class->remove_sync (client, cancellable, error);
-
- if (error && *error)
- e_client_unwrap_dbus_error (client, *error, error);
-
- return res;
+ return class->remove_sync (client, cancellable, error);
}
/**
@@ -1748,7 +1709,6 @@ e_client_refresh_finish (EClient *client,
GError **error)
{
EClientClass *class;
- gboolean res;
g_return_val_if_fail (E_IS_CLIENT (client), FALSE);
@@ -1756,12 +1716,7 @@ e_client_refresh_finish (EClient *client,
g_return_val_if_fail (class != NULL, FALSE);
g_return_val_if_fail (class->refresh_finish != NULL, FALSE);
- res = class->refresh_finish (client, result, error);
-
- if (error && *error)
- e_client_unwrap_dbus_error (client, *error, error);
-
- return res;
+ return class->refresh_finish (client, result, error);
}
/**
@@ -1785,18 +1740,12 @@ e_client_refresh_sync (EClient *client,
GError **error)
{
EClientClass *class;
- gboolean res;
class = E_CLIENT_GET_CLASS (client);
g_return_val_if_fail (class != NULL, FALSE);
g_return_val_if_fail (class->refresh_sync != NULL, FALSE);
- res = class->refresh_sync (client, cancellable, error);
-
- if (error && *error)
- e_client_unwrap_dbus_error (client, *error, error);
-
- return res;
+ return class->refresh_sync (client, cancellable, error);
}
/**
@@ -1964,6 +1913,8 @@ e_client_util_parse_comma_strings (const gchar *strings)
* @dbus_erorr and @out_error can point to the same variable.
*
* Since: 3.2
+ *
+ * Deprecated: 3.8: Use g_dbus_error_strip_remote_error() instead.
**/
void
e_client_unwrap_dbus_error (EClient *client,
diff --git a/libedataserver/e-client.h b/libedataserver/e-client.h
index 7abd91b..76b48a9 100644
--- a/libedataserver/e-client.h
+++ b/libedataserver/e-client.h
@@ -179,6 +179,7 @@ struct _EClientClass {
/* This method is deprecated. */
GDBusProxy * (*get_dbus_proxy) (EClient *client);
+ /* This method is deprecated. */
void (*unwrap_dbus_error) (EClient *client,
GError *dbus_error,
GError **out_error);
@@ -291,9 +292,6 @@ gboolean e_client_check_refresh_supported
(EClient *client);
gboolean e_client_is_readonly (EClient *client);
gboolean e_client_is_online (EClient *client);
-void e_client_unwrap_dbus_error (EClient *client,
- GError *dbus_error,
- GError **out_error);
void e_client_get_backend_property (EClient *client,
const gchar *prop_name,
@@ -374,6 +372,9 @@ gboolean e_client_util_unwrap_dbus_error (GError *dbus_error,
gboolean e_client_is_opened (EClient *client);
void e_client_cancel_all (EClient *client);
+void e_client_unwrap_dbus_error (EClient *client,
+ GError *dbus_error,
+ GError **out_error);
void e_client_retrieve_capabilities (EClient *client,
GCancellable *cancellable,
GAsyncReadyCallback callback,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]