diff options
Diffstat (limited to 'libempathy/empathy-utils.c')
-rw-r--r-- | libempathy/empathy-utils.c | 84 |
1 files changed, 54 insertions, 30 deletions
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index fd54c9a98..92d12cb63 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -227,36 +227,6 @@ empathy_xml_node_find_child_prop_value (xmlNodePtr node, return found; } -guint -empathy_account_hash (gconstpointer key) -{ - g_return_val_if_fail (EMPATHY_IS_ACCOUNT (key), 0); - - return g_str_hash (empathy_account_get_unique_name (EMPATHY_ACCOUNT (key))); -} - -gboolean -empathy_account_equal (gconstpointer a, - gconstpointer b) -{ - return a == b; -} - -MissionControl * -empathy_mission_control_dup_singleton (void) -{ - static MissionControl *mc = NULL; - - if (!mc) { - mc = mission_control_new (tp_get_bus ()); - g_object_add_weak_pointer (G_OBJECT (mc), (gpointer) &mc); - } else { - g_object_ref (mc); - } - - return mc; -} - const gchar * empathy_presence_get_default_message (TpConnectionPresenceType presence) { @@ -378,3 +348,57 @@ empathy_uint_compare (gconstpointer a, return *(guint *) a - *(guint *) b; } +gchar * +empathy_protocol_icon_name (const gchar *protocol) +{ + return g_strdup_printf ("im-%s", protocol); +} + +GType +empathy_type_dbus_ao (void) +{ + static GType t = 0; + + if (G_UNLIKELY (t == 0)) + t = dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH); + + return t; +} + +const char * +empathy_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", "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 }, + { "facebook", N_("Facebook Chat"), TRUE }, + { "groupwise", "GroupWise", FALSE }, + { "sip", "SIP", FALSE }, + { NULL, NULL } + }; + + for (i = 0; names[i].proto != NULL; i++) + { + if (!tp_strdiff (proto_name, names[i].proto)) + { + if (names[i].translated) + return _(names[i].display); + else + return names[i].display; + } + } + + return NULL; +} + |