[Pkg-telepathy-commits] [telepathy-mission-control-6] 40/90: McdConnection: rewrite translate_g_error() using g_dbus_error_encode_gerror()
Simon McVittie
smcv at debian.org
Wed May 14 12:09:03 UTC 2014
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian
in repository telepathy-mission-control-6.
commit 8ba869f6cc0f4af6073e6efeb8bbe276d5be8389
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Fri Mar 21 17:56:55 2014 +0000
McdConnection: rewrite translate_g_error() using g_dbus_error_encode_gerror()
---
src/mcd-connection.c | 36 +++++-------------------------------
1 file changed, 5 insertions(+), 31 deletions(-)
diff --git a/src/mcd-connection.c b/src/mcd-connection.c
index 88d63ee..c6f0be2 100644
--- a/src/mcd-connection.c
+++ b/src/mcd-connection.c
@@ -1270,36 +1270,12 @@ mcd_connection_early_get_interfaces_cb (TpProxy *proxy,
}
static gchar *
-translate_g_error (GQuark domain,
- gint code,
- const gchar *message)
+translate_g_error (const GError *error)
{
- if (domain == TP_ERROR)
+ if (error->domain == TP_DBUS_ERRORS)
{
- return g_strdup (tp_error_get_dbus_name (code));
- }
- else if (domain == TP_DBUS_ERRORS)
- {
- switch (code)
+ switch (error->code)
{
- case TP_DBUS_ERROR_UNKNOWN_REMOTE_ERROR:
- {
- const gchar *p = strchr (message, ':');
-
- if (p != NULL)
- {
- gchar *tmp = g_strndup (message, message - p);
-
- /* The syntactic restrictions for error names are the same
- * as for interface names. */
- if (g_dbus_is_interface_name (tmp))
- return tmp;
-
- g_free (tmp);
- }
- }
- break;
-
case TP_DBUS_ERROR_NO_INTERFACE:
return g_strdup (DBUS_ERROR_UNKNOWN_INTERFACE);
@@ -1308,8 +1284,7 @@ translate_g_error (GQuark domain,
}
}
- /* catch-all */
- return g_strdup (DBUS_ERROR_FAILED);
+ return g_dbus_error_encode_gerror (error);
}
static void
@@ -1357,8 +1332,7 @@ request_connection_cb (TpConnectionManager *proxy, const gchar *bus_name,
if (tperror)
{
- gchar *dbus_error = translate_g_error (tperror->domain,
- tperror->code, tperror->message);
+ gchar *dbus_error = translate_g_error (tperror);
GHashTable *details = tp_asv_new (
"debug-message", G_TYPE_STRING, tperror->message,
NULL);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-mission-control-6.git
More information about the Pkg-telepathy-commits
mailing list