From fc4059e17da2a94a3864f396b5de12d93865090d Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 17 Sep 2010 15:35:07 +0200 Subject: Add empathy_service_name_to_display_name() Also makes empathy_protocol_name_to_display_name() fallbacks to the protocol name so caller doesn't have to. --- libempathy/empathy-utils.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'libempathy/empathy-utils.c') diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index 85953f8f9..e2e1f8a28 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -539,7 +539,6 @@ empathy_protocol_name_to_display_name (const gchar *proto_name) gboolean translated; } names[] = { { "jabber", "Jabber", FALSE }, - { "gtalk", "Google Talk", FALSE }, { "msn", "MSN", FALSE, }, { "local-xmpp", N_("People Nearby"), TRUE }, { "irc", "IRC", FALSE }, @@ -547,7 +546,6 @@ empathy_protocol_name_to_display_name (const gchar *proto_name) { "aim", "AIM", FALSE }, { "yahoo", "Yahoo!", FALSE }, { "yahoojp", N_("Yahoo! Japan"), TRUE }, - { "facebook", N_("Facebook Chat"), TRUE }, { "groupwise", "GroupWise", FALSE }, { "sip", "SIP", FALSE }, { NULL, NULL } @@ -564,7 +562,35 @@ empathy_protocol_name_to_display_name (const gchar *proto_name) } } - return NULL; + return proto_name; +} + +const char * +empathy_service_name_to_display_name (const gchar *service_name) +{ + int i; + static struct { + const gchar *service; + const gchar *display; + gboolean translated; + } names[] = { + { "google-talk", "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 _(names[i].display); + else + return names[i].display; + } + } + + return service_name; } /* Note: this function depends on the account manager having its core feature -- cgit v1.2.3