]> git.0d.be Git - empathy.git/commitdiff
use tp_capabilities_supports_room_list() (#641491)
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 4 Feb 2011 14:24:36 +0000 (15:24 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 24 Feb 2011 09:11:56 +0000 (10:11 +0100)
src/empathy-new-chatroom-dialog.c

index f0e58c749731b3d8e23d592f6b117a382f977521..edaeb0ea587b19eaf1e1ac18a09d58c9fcef6eb6 100644 (file)
@@ -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),