]> git.0d.be Git - empathy.git/commitdiff
Use ensure_chatroom in callback
authorJonas Bonn <jonas@southpole.se>
Fri, 5 Mar 2010 16:02:53 +0000 (17:02 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 27 May 2010 14:32:35 +0000 (16:32 +0200)
The new function ensure_chatroom should be used by favorite-toggled
callback.

src/empathy-chat-window.c

index 94717f3c89511d6023c93a2ac6b6968afc07db12..39711e2cda06c5d4e8170cc898683342f93adbbd 100644 (file)
@@ -828,19 +828,14 @@ chat_window_favorite_toggled_cb (GtkToggleAction   *toggle_action,
        account = empathy_chat_get_account (priv->current_chat);
        room = empathy_chat_get_id (priv->current_chat);
 
-       chatroom = empathy_chatroom_manager_find (priv->chatroom_manager,
-                                                 account, room);
-
-       if (chatroom == NULL) {
-               const gchar *name;
-
-               name = empathy_chat_get_name (priv->current_chat);
-               chatroom = empathy_chatroom_new_full (account, room, name, FALSE);
-               empathy_chatroom_manager_add (priv->chatroom_manager, chatroom);
-               g_object_unref (chatroom);
-       }
+       chatroom = empathy_chatroom_manager_ensure_chatroom (
+                    priv->chatroom_manager,
+                    account,
+                    room,
+                    empathy_chat_get_name (priv->current_chat));
 
        empathy_chatroom_set_favorite (chatroom, active);
+       g_object_unref(chatroom);
 }
 
 static void