[empathy] Use ensure_chatroom in callback



commit 2f9166bf42462e44b40462cbd9fc562f6cf507af
Author: Jonas Bonn <jonas southpole se>
Date:   Fri Mar 5 17:02:53 2010 +0100

    Use ensure_chatroom in callback
    
    The new function ensure_chatroom should be used by favorite-toggled
    callback.

 src/empathy-chat-window.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 94717f3..39711e2 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]