From 5fd9df9e45b27e550f6516e1a31e6b79907b5af8 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Mon, 28 Feb 2011 12:29:40 +0000 Subject: Return meaningful errors when starting a call fails --- libempathy-gtk/empathy-call-utils.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-call-utils.c b/libempathy-gtk/empathy-call-utils.c index 86ce3b4f7..fdf30df67 100644 --- a/libempathy-gtk/empathy-call-utils.c +++ b/libempathy-gtk/empathy-call-utils.c @@ -33,6 +33,27 @@ #define DEBUG_FLAG EMPATHY_DEBUG_OTHER #include +static const gchar * +get_error_display_message (GError *error) +{ + if (error->domain != TP_ERROR) + return _("There was an error starting the call"); + + switch (error->code) + { + case TP_ERROR_NETWORK_ERROR: + return _("Network error"); + case TP_ERROR_NOT_CAPABLE: + return _("The specified contact doesn't support calls"); + case TP_ERROR_OFFLINE: + return _("The specified contact is offline"); + case TP_ERROR_INVALID_HANDLE: + return _("The specified contact is not valid"); + } + + return _("There was an error starting the call"); +} + static void show_call_error (GError *error) { @@ -40,7 +61,7 @@ show_call_error (GError *error) dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, - _("There was an error starting the call")); + get_error_display_message (error)); g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), -- cgit v1.2.3