diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-09-17 21:35:07 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-09-29 18:54:37 +0800 |
commit | fc4059e17da2a94a3864f396b5de12d93865090d (patch) | |
tree | b7e51c0ece0074708d6762786c88730c8cf20e6f /libempathy | |
parent | 3a6aca03ec70cb11d23cfd68e72a51a4a49220a2 (diff) | |
download | gsoc2013-empathy-fc4059e17da2a94a3864f396b5de12d93865090d.tar gsoc2013-empathy-fc4059e17da2a94a3864f396b5de12d93865090d.tar.gz gsoc2013-empathy-fc4059e17da2a94a3864f396b5de12d93865090d.tar.bz2 gsoc2013-empathy-fc4059e17da2a94a3864f396b5de12d93865090d.tar.lz gsoc2013-empathy-fc4059e17da2a94a3864f396b5de12d93865090d.tar.xz gsoc2013-empathy-fc4059e17da2a94a3864f396b5de12d93865090d.tar.zst gsoc2013-empathy-fc4059e17da2a94a3864f396b5de12d93865090d.zip |
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.
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-utils.c | 32 | ||||
-rw-r--r-- | libempathy/empathy-utils.h | 1 |
2 files changed, 30 insertions, 3 deletions
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 diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h index 6a67321d9..0f8adc33e 100644 --- a/libempathy/empathy-utils.h +++ b/libempathy/empathy-utils.h @@ -83,6 +83,7 @@ const gchar * empathy_account_get_error_message (TpAccount *account, gchar *empathy_protocol_icon_name (const gchar *protocol); const gchar *empathy_protocol_name_to_display_name (const gchar *proto_name); +const gchar *empathy_service_name_to_display_name (const gchar *proto_name); #define EMPATHY_ARRAY_TYPE_OBJECT (empathy_type_dbus_ao ()) GType empathy_type_dbus_ao (void); |