[empathy] use tp_capabilities_supports_room_list() (#641491)



commit ffb89eff7654897d8d5246bc06840411ab1de13f
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Fri Feb 4 15:24:36 2011 +0100

    use tp_capabilities_supports_room_list() (#641491)

 src/empathy-new-chatroom-dialog.c |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)
---
diff --git a/src/empathy-new-chatroom-dialog.c b/src/empathy-new-chatroom-dialog.c
index f0e58c7..edaeb0e 100644
--- a/src/empathy-new-chatroom-dialog.c
+++ b/src/empathy-new-chatroom-dialog.c
@@ -438,8 +438,7 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox             *combobox,
 	gboolean               listing = FALSE;
 	gboolean               expanded = FALSE;
 	TpConnection          *connection;
-	EmpathyDispatcher     *dispatcher;
-	GList                 *classes = NULL;
+	TpCapabilities *caps;
 
 	if (dialog->room_list) {
 		g_object_unref (dialog->room_list);
@@ -464,25 +463,21 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox             *combobox,
 	dialog->status_changed_id = g_signal_connect (dialog->account,
 		      "status-changed", G_CALLBACK (account_status_changed_cb), dialog);
 
-	dispatcher = empathy_dispatcher_dup_singleton ();
+	/* empathy_account_chooser_filter_supports_chatrooms ensures that the
+	* account has a connection and CAPABILITIES has been prepared. */
+	g_assert (connection != NULL);
+	g_assert (tp_proxy_is_prepared (connection,
+		TP_CONNECTION_FEATURE_CAPABILITIES));
+	caps = tp_connection_get_capabilities (connection);
 
-	if (connection != NULL) {
-		classes = empathy_dispatcher_find_requestable_channel_classes (dispatcher,
-			connection, TP_IFACE_CHANNEL_TYPE_ROOM_LIST,
-			TP_HANDLE_TYPE_NONE, NULL);
-	}
-
-	if (classes != NULL) {
+	if (tp_capabilities_supports_room_list (caps, NULL)) {
 		/* Roomlist channels are supported */
 		dialog->room_list = empathy_tp_roomlist_new (dialog->account);
-		g_list_free (classes);
 	}
 	else {
 		dialog->room_list = NULL;
 	}
 
-	g_object_unref (dispatcher);
-
 	if (dialog->room_list) {
 		g_signal_connect (dialog->room_list, "destroy",
 				  G_CALLBACK (new_chatroom_dialog_roomlist_destroy_cb),



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