]> git.0d.be Git - empathy.git/commitdiff
If chats have no name, use the channel's ID instead of fallback to "Conversation...
authorXavier Claessens <xclaesse@src.gnome.org>
Thu, 13 Nov 2008 20:24:34 +0000 (20:24 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Thu, 13 Nov 2008 20:24:34 +0000 (20:24 +0000)
svn path=/trunk/; revision=1717

libempathy-gtk/empathy-chat.c
src/empathy-chat-window.c

index 1dd3908b4047092dd3a110b4d500c8349c1d1b4c..fe289539c7b2121c6fd3732aa80db60373bea674 100644 (file)
@@ -118,6 +118,7 @@ chat_get_property (GObject    *object,
                   GValue     *value,
                   GParamSpec *pspec)
 {
+       EmpathyChat *chat = EMPATHY_CHAT (object);
        EmpathyChatPriv *priv = GET_PRIV (object);
 
        switch (param_id) {
@@ -128,7 +129,7 @@ chat_get_property (GObject    *object,
                g_value_set_object (value, priv->account);
                break;
        case PROP_NAME:
-               g_value_set_string (value, priv->name);
+               g_value_set_string (value, empathy_chat_get_name (chat));
                break;
        case PROP_ID:
                g_value_set_string (value, priv->id);
@@ -1641,10 +1642,19 @@ const gchar *
 empathy_chat_get_name (EmpathyChat *chat)
 {
        EmpathyChatPriv *priv = GET_PRIV (chat);
+       const gchar *ret;
 
        g_return_val_if_fail (EMPATHY_IS_CHAT (chat), NULL);
 
-       return priv->name;
+       ret = priv->name;
+       if (!ret && priv->remote_contact) {
+               ret = empathy_contact_get_name (priv->remote_contact);
+       }
+
+       if (!ret)
+               ret = priv->id;
+
+       return ret ? ret : _("Conversation");
 }
 
 const gchar *
index 7ae404e096f82bf70b2d8c2d02121a61a14b04d3..a6b82dc0f9c66daccc20d7abf5fad56d74b4d7f1 100644 (file)
@@ -263,23 +263,6 @@ chat_window_create_label (EmpathyChatWindow *window,
        return hbox;
 }
 
-static const gchar *
-chat_window_get_chat_name (EmpathyChat *chat)
-{
-       EmpathyContact *remote_contact = NULL;
-       const gchar    *name = NULL;
-
-       name = empathy_chat_get_name (chat);
-       if (!name) {
-               remote_contact = empathy_chat_get_remote_contact (chat);
-               if (remote_contact) {
-                       name = empathy_contact_get_name (remote_contact);
-               }
-       }
-
-       return name ? name : _("Conversation");
-}
-
 static void
 chat_window_update (EmpathyChatWindow *window)
 {
@@ -304,7 +287,7 @@ chat_window_update (EmpathyChatWindow *window)
        first_page = (page_num == 0);
        last_page = (page_num == (num_pages - 1));
        is_connected = empathy_chat_get_tp_chat (priv->current_chat) != NULL;
-       name = chat_window_get_chat_name (priv->current_chat);
+       name = empathy_chat_get_name (priv->current_chat);
        n_chats = g_list_length (priv->chats);
 
        DEBUG ("Update window");
@@ -382,7 +365,7 @@ chat_window_update_chat_tab (EmpathyChat *chat)
        priv = GET_PRIV (window);
 
        /* Get information */
-       name = chat_window_get_chat_name (chat);
+       name = empathy_chat_get_name (chat);
        subject = empathy_chat_get_subject (chat);
        remote_contact = empathy_chat_get_remote_contact (chat);