aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-utils.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-08-05 18:38:26 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-08-05 18:38:29 +0800
commit0b5e1ce2f0aafecaaf855b1f81d52821862f6526 (patch)
tree4e29e3c254b7f561752ed17eb76a4a25f568f7f9 /libempathy/empathy-utils.c
parent76a6ff433280ed7bee6346ab05caa00ceb2aba49 (diff)
downloadgsoc2013-empathy-0b5e1ce2f0aafecaaf855b1f81d52821862f6526.tar
gsoc2013-empathy-0b5e1ce2f0aafecaaf855b1f81d52821862f6526.tar.gz
gsoc2013-empathy-0b5e1ce2f0aafecaaf855b1f81d52821862f6526.tar.bz2
gsoc2013-empathy-0b5e1ce2f0aafecaaf855b1f81d52821862f6526.tar.lz
gsoc2013-empathy-0b5e1ce2f0aafecaaf855b1f81d52821862f6526.tar.xz
gsoc2013-empathy-0b5e1ce2f0aafecaaf855b1f81d52821862f6526.tar.zst
gsoc2013-empathy-0b5e1ce2f0aafecaaf855b1f81d52821862f6526.zip
add empathy_dbus_error_name_get_default_message
Reuse existing errors for now.
Diffstat (limited to 'libempathy/empathy-utils.c')
-rw-r--r--libempathy/empathy-utils.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index 49df14b41..367b6aa9b 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -321,6 +321,50 @@ empathy_status_reason_get_default_message (TpConnectionStatusReason reason)
}
}
+static GHashTable *
+create_errors_to_message_hash (void)
+{
+ GHashTable *errors;
+
+ errors = g_hash_table_new (g_str_hash, g_str_equal);
+ g_hash_table_insert (errors, TP_ERROR_STR_NETWORK_ERROR, _("Network error"));
+ g_hash_table_insert (errors, TP_ERROR_STR_AUTHENTICATION_FAILED,
+ _("Authentication failed"));
+ g_hash_table_insert (errors, TP_ERROR_STR_ENCRYPTION_ERROR,
+ _("Encryption error"));
+ g_hash_table_insert (errors, TP_ERROR_STR_CERT_NOT_PROVIDED,
+ _("Certificate not provided"));
+ g_hash_table_insert (errors, TP_ERROR_STR_CERT_UNTRUSTED,
+ _("Certificate untrusted"));
+ g_hash_table_insert (errors, TP_ERROR_STR_CERT_EXPIRED,
+ _("Certificate expired"));
+ g_hash_table_insert (errors, TP_ERROR_STR_CERT_NOT_ACTIVATED,
+ _("Certificate not activated"));
+ g_hash_table_insert (errors, TP_ERROR_STR_CERT_HOSTNAME_MISMATCH,
+ _("Certificate hostname mismatch"));
+ g_hash_table_insert (errors, TP_ERROR_STR_CERT_FINGERPRINT_MISMATCH,
+ _("Certificate fingerprint mismatch"));
+ g_hash_table_insert (errors, TP_ERROR_STR_CERT_SELF_SIGNED,
+ _("Certificate self-signed"));
+
+ return errors;
+}
+
+const gchar *
+empathy_dbus_error_name_get_default_message (const gchar *error)
+{
+ static GHashTable *errors_to_message = NULL;
+
+ if (error == NULL)
+ return NULL;
+
+ if (G_UNLIKELY (errors_to_message == NULL)) {
+ errors_to_message = create_errors_to_message_hash ();
+ }
+
+ return g_hash_table_lookup (errors_to_message, error);
+}
+
gchar *
empathy_file_lookup (const gchar *filename, const gchar *subdir)
{