diff options
Diffstat (limited to 'tp-account-widgets/tpaw-utils.c')
-rw-r--r-- | tp-account-widgets/tpaw-utils.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/tp-account-widgets/tpaw-utils.c b/tp-account-widgets/tpaw-utils.c index 8570658c3..3efc422b5 100644 --- a/tp-account-widgets/tpaw-utils.c +++ b/tp-account-widgets/tpaw-utils.c @@ -3,6 +3,7 @@ * * Authors: Marco Barisione <marco.barisione@collabora.co.uk> * Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> + * Sjoerd Simons <sjoerd.simons@collabora.co.uk> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,6 +23,8 @@ #include "config.h" #include "tpaw-utils.h" +#include <glib/gi18n-lib.h> + #define DEBUG_FLAG EMPATHY_DEBUG_OTHER #include "empathy-debug.h" @@ -67,3 +70,89 @@ tpaw_connect_new_account (TpAccount *account, break; } } + +gchar * +tpaw_protocol_icon_name (const gchar *protocol) +{ + if (!tp_strdiff (protocol, "yahoojp")) + /* Yahoo Japan uses the same icon as Yahoo */ + protocol = "yahoo"; + else if (!tp_strdiff (protocol, "simple")) + /* SIMPLE uses the same icon as SIP */ + protocol = "sip"; + else if (!tp_strdiff (protocol, "sms")) + return g_strdup ("phone"); + + return g_strdup_printf ("im-%s", protocol); +} + +const char * +tpaw_protocol_name_to_display_name (const gchar *proto_name) +{ + int i; + static struct { + const gchar *proto; + const gchar *display; + gboolean translated; + } names[] = { + { "jabber", "Jabber", FALSE }, + { "msn", "Windows Live (MSN)", FALSE, }, + { "local-xmpp", N_("People Nearby"), TRUE }, + { "irc", "IRC", FALSE }, + { "icq", "ICQ", FALSE }, + { "aim", "AIM", FALSE }, + { "yahoo", "Yahoo!", FALSE }, + { "yahoojp", N_("Yahoo! Japan"), TRUE }, + { "groupwise", "GroupWise", FALSE }, + { "sip", "SIP", FALSE }, + { "gadugadu", "Gadu-Gadu", FALSE }, + { "mxit", "Mxit", FALSE }, + { "myspace", "Myspace", FALSE }, + { "sametime", "Sametime", FALSE }, + { "skype-dbus", "Skype (D-BUS)", FALSE }, + { "skype-x11", "Skype (X11)", FALSE }, + { "zephyr", "Zephyr", FALSE }, + { NULL, NULL } + }; + + for (i = 0; names[i].proto != NULL; i++) + { + if (!tp_strdiff (proto_name, names[i].proto)) + { + if (names[i].translated) + return gettext (names[i].display); + else + return names[i].display; + } + } + + return proto_name; +} + +const char * +tpaw_service_name_to_display_name (const gchar *service_name) +{ + int i; + static struct { + const gchar *service; + const gchar *display; + gboolean translated; + } names[] = { + { "google-talk", N_("Google Talk"), FALSE }, + { "facebook", N_("Facebook Chat"), TRUE }, + { NULL, NULL } + }; + + for (i = 0; names[i].service != NULL; i++) + { + if (!tp_strdiff (service_name, names[i].service)) + { + if (names[i].translated) + return gettext (names[i].display); + else + return names[i].display; + } + } + + return service_name; +} |