]> git.0d.be Git - empathy.git/blobdiff - src/empathy-new-chatroom-dialog.c
Update Simplified Chinese help translation.
[empathy.git] / src / empathy-new-chatroom-dialog.c
index f0e58c749731b3d8e23d592f6b117a382f977521..a09a5f7106d4939e1fb6ab7f5f45d10f076ad841 100644 (file)
@@ -36,7 +36,7 @@
 #include <libempathy/empathy-tp-roomlist.h>
 #include <libempathy/empathy-chatroom.h>
 #include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-dispatcher.h>
+#include <libempathy/empathy-request-util.h>
 
 #include <libempathy-gtk/empathy-account-chooser.h>
 #include <libempathy-gtk/empathy-ui-utils.h>
@@ -386,11 +386,8 @@ out:
 static void
 new_chatroom_dialog_update_widgets (EmpathyNewChatroomDialog *dialog)
 {
-       EmpathyAccountChooser *account_chooser;
        const gchar           *protocol;
 
-       account_chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser);
-
        if (dialog->account == NULL)
                return;
 
@@ -438,8 +435,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 +460,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),
@@ -540,8 +532,6 @@ new_chatroom_dialog_new_room_cb (EmpathyTpRoomlist        *room_list,
                                 EmpathyChatroom          *chatroom,
                                 EmpathyNewChatroomDialog *dialog)
 {
-       GtkTreeView      *view;
-       GtkTreeSelection *selection;
        GtkListStore     *store;
        GtkTreeIter       iter;
        gchar            *members;
@@ -555,8 +545,6 @@ new_chatroom_dialog_new_room_cb (EmpathyTpRoomlist        *room_list,
                empathy_chatroom_get_room (chatroom));
 
        /* Add to model */
-       view = GTK_TREE_VIEW (dialog->treeview);
-       selection = gtk_tree_view_get_selection (view);
        store = GTK_LIST_STORE (dialog->model);
        members = g_strdup_printf ("%d", empathy_chatroom_get_members_count (chatroom));
        tmp = g_strdup_printf ("<b>%s</b>", empathy_chatroom_get_name (chatroom));
@@ -695,8 +683,8 @@ new_chatroom_dialog_join (EmpathyNewChatroomDialog *dialog)
        g_strstrip (room_name);
 
        DEBUG ("Requesting channel for '%s'", room_name);
-       empathy_dispatcher_join_muc (account, room_name,
-               gtk_get_current_event_time ());
+
+       empathy_join_muc (account, room_name, empathy_get_current_action_time ());
 
        g_free (room_name);
 }