diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2009-07-31 18:11:58 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2009-07-31 18:11:58 +0800 |
commit | 41e5b31c1918f40c3ba47bff2dc9ab682fe0391f (patch) | |
tree | 5d680931c7c0d951e35864c26ab33e1c42eb0138 | |
parent | 0279ad1b9504f81dbe6773eab9fdbd6ffdbfca3d (diff) | |
download | gsoc2013-empathy-41e5b31c1918f40c3ba47bff2dc9ab682fe0391f.tar gsoc2013-empathy-41e5b31c1918f40c3ba47bff2dc9ab682fe0391f.tar.gz gsoc2013-empathy-41e5b31c1918f40c3ba47bff2dc9ab682fe0391f.tar.bz2 gsoc2013-empathy-41e5b31c1918f40c3ba47bff2dc9ab682fe0391f.tar.lz gsoc2013-empathy-41e5b31c1918f40c3ba47bff2dc9ab682fe0391f.tar.xz gsoc2013-empathy-41e5b31c1918f40c3ba47bff2dc9ab682fe0391f.tar.zst gsoc2013-empathy-41e5b31c1918f40c3ba47bff2dc9ab682fe0391f.zip |
Use proper display names in the chooser
-rw-r--r-- | libempathy-gtk/empathy-protocol-chooser.c | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c index 462979843..79adbac9f 100644 --- a/libempathy-gtk/empathy-protocol-chooser.c +++ b/libempathy-gtk/empathy-protocol-chooser.c @@ -123,6 +123,36 @@ protocol_chooser_sort_func (GtkTreeModel *model, return cmp; } +static const char * +protocol_chooser_proto_name_to_display_name (const gchar *proto_name) +{ + int i; + + static struct { + const gchar *proto; + const gchar *display; + } names[] = { + { "jabber", "XMPP" }, + { "msn", "MSN" }, + { "local-xmpp", "Salut" }, + { "irc", "IRC" }, + { "icq", "ICQ" }, + { "aim", "AIM" }, + { "yahoo", "Yahoo" }, + { "groupwise", "GroupWise" }, + { "sip", "SIP" }, + { NULL, NULL } + }; + + for (i = 0; names[i].proto != NULL; i++) + { + if (!tp_strdiff (proto_name, names[i].proto)) + return names[i].display; + } + + return NULL; +} + static void protocol_choosers_add_cm (EmpathyProtocolChooser *chooser, TpConnectionManager *cm) @@ -134,24 +164,28 @@ protocol_choosers_add_cm (EmpathyProtocolChooser *chooser, { const TpConnectionManagerProtocol *proto = *iter; gchar *icon_name; - gchar *display_name; - + const gchar *display_name; + gchar *display_name_set; icon_name = g_strdup_printf ("im-%s", proto->name); + display_name = protocol_chooser_proto_name_to_display_name (proto->name); + + if (display_name == NULL) + display_name = proto->name; if (!tp_strdiff (cm->name, "haze")) - display_name = g_strdup_printf ("%s (Haze)", proto->name); + display_name_set = g_strdup_printf ("%s (Haze)", display_name); else - display_name = g_strdup (proto->name); + display_name_set = g_strdup (display_name); gtk_list_store_insert_with_values (priv->store, NULL, 0, COL_ICON, icon_name, - COL_LABEL, display_name, + COL_LABEL, display_name_set, COL_CM, cm, COL_PROTOCOL, proto, -1); - g_free (display_name); + g_free (display_name_set); g_free (icon_name); } } |