]> git.0d.be Git - empathy.git/commitdiff
No need to RequestHandle, MissionControl has API to request the channel
authorXavier Claessens <xclaesse@gmail.com>
Thu, 31 May 2007 13:23:57 +0000 (13:23 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Thu, 31 May 2007 13:23:57 +0000 (13:23 +0000)
2007-05-31  Xavier Claessens  <xclaesse@gmail.com>

* libempathy-gtk/gossip-new-chatroom-dialog.c: No need to RequestHandle,
MissionControl has API to request the channel from handle string.

* libempathy-gtk/empathy-main-window.c: Request room channel when
clicking on favorite rooms.

* TODO: Add a task: supporting registering.

svn path=/trunk/; revision=102

ChangeLog
TODO
libempathy-gtk/empathy-main-window.c
libempathy-gtk/gossip-new-chatroom-dialog.c

index df6ac50370c9be096c563a7176d1c39b3f5edd59..069075904bd23a1162297cdf212a4fe57777226b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-05-31  Xavier Claessens  <xclaesse@gmail.com>
+
+       * libempathy-gtk/gossip-new-chatroom-dialog.c: No need to RequestHandle,
+       MissionControl has API to request the channel from handle string.
+
+       * libempathy-gtk/empathy-main-window.c: Request room channel when
+       clicking on favorite rooms.
+
+       * TODO: Add a task: supporting registering.
+
 2007-05-31  Xavier Claessens  <xclaesse@gmail.com>
 
        * libempathy/empathy-idle.c: Do not restore away presence message when
diff --git a/TODO b/TODO
index 8367547b0bc0cd42ae12582539621975584cf376..f6d5d9cd52b2931ae27c91e642423756875ad5ed 100644 (file)
--- a/TODO
+++ b/TODO
@@ -10,6 +10,7 @@ Things you can do if you want to help:
  - Remove Quit option everywhere, empathy is a session service and shouldn't be leaved.
  - Add sound events
  - Import loggin system from gossip
+ - Add register capability in GossipAccountsDialog if the profile says it's supported.
  - Testing and Bugfixing.
 
 SoC projects:
index befe2f53162935442a7916e5b2dac12ef06b2d08..1ae2274104876b786fb9f5700e578b47d4b64d65 100644 (file)
@@ -111,6 +111,7 @@ static void     main_window_favorite_chatroom_menu_activate_cb (GtkMenuItem
 static void     main_window_favorite_chatroom_menu_update      (EmpathyMainWindow               *window);
 static void     main_window_favorite_chatroom_menu_add         (EmpathyMainWindow               *window,
                                                                GossipChatroom                  *chatroom);
+static void     main_window_favorite_chatroom_join             (GossipChatroom                  *chatroom);
 static void     main_window_chat_quit_cb                       (GtkWidget                       *widget,
                                                                EmpathyMainWindow               *window);
 static void     main_window_chat_new_message_cb                (GtkWidget                       *widget,
@@ -446,17 +447,7 @@ static void
 main_window_favorite_chatroom_menu_activate_cb (GtkMenuItem    *menu_item,
                                                GossipChatroom *chatroom)
 {
-/*FIXME:
-       GossipSession          *session;
-       GossipAccount          *account;
-       GossipChatroomProvider *provider;
-
-       session = gossip_app_get_session ();
-       account = gossip_chatroom_get_account (chatroom);
-       provider = gossip_session_get_chatroom_provider (session, account);
-
-       gossip_group_chat_new (provider, chatroom);
-*/
+       main_window_favorite_chatroom_join (chatroom);
 }
 
 static void
@@ -501,6 +492,28 @@ main_window_favorite_chatroom_menu_add (EmpathyMainWindow *window,
        gtk_widget_show (menu_item);
 }
 
+static void
+main_window_favorite_chatroom_join (GossipChatroom *chatroom)
+{
+       MissionControl *mc;
+       McAccount      *account;
+       const gchar    *room;
+
+       mc = gossip_mission_control_new ();
+       account = gossip_chatroom_get_account (chatroom);
+       room = gossip_chatroom_get_room (chatroom);
+
+       gossip_debug (DEBUG_DOMAIN, "Requesting channel for '%s'", room);
+
+       mission_control_request_channel_with_string_handle (mc,
+                                                           account,
+                                                           TP_IFACE_CHANNEL_TYPE_TEXT,
+                                                           room,
+                                                           TP_HANDLE_TYPE_ROOM,
+                                                           NULL, NULL);        
+       g_object_unref (mc);
+}
+
 static void
 main_window_chat_quit_cb (GtkWidget         *widget,
                          EmpathyMainWindow *window)
@@ -533,7 +546,13 @@ static void
 main_window_room_join_favorites_cb (GtkWidget         *widget,
                                    EmpathyMainWindow *window)
 {
-       //gossip_session_chatroom_join_favorites (window->session);
+       GList *chatrooms, *l;
+
+       chatrooms = gossip_chatroom_manager_get_chatrooms (window->chatroom_manager, NULL);
+       for (l = chatrooms; l; l = l->next) {
+               main_window_favorite_chatroom_join (l->data);
+       }
+       g_list_free (chatrooms);
 }
 
 static void
index 838f90a7436925f189b1c2f1e6bbb5b33995b9b7..81594f1d1637397f01c8a5d6833fbc5ec19cee05 100644 (file)
@@ -128,10 +128,6 @@ static void     new_chatroom_dialog_model_row_deleted_cb            (GtkTreeMode
 static void     new_chatroom_dialog_model_selection_changed         (GtkTreeSelection        *selection,
                                                                     GossipNewChatroomDialog *dialog);
 static void     new_chatroom_dialog_join                            (GossipNewChatroomDialog *dialog);
-static void     new_chatroom_dialog_request_handles_cb              (DBusGProxy              *proxy,
-                                                                    GArray                  *handles,
-                                                                    GError                  *error,
-                                                                    McAccount               *account);
 static void     new_chatroom_dialog_entry_changed_cb                (GtkWidget               *entry,
                                                                     GossipNewChatroomDialog *dialog);
 static void     new_chatroom_dialog_browse_start                    (GossipNewChatroomDialog *dialog);
@@ -604,12 +600,10 @@ new_chatroom_dialog_join (GossipNewChatroomDialog *dialog)
        McAccount            *account;
        GossipAccountChooser *account_chooser;
        MissionControl       *mc;
-       TpConn               *tp_conn;
        GList                *chatrooms, *l;
        const gchar          *room;
        const gchar          *server = NULL;
        gchar                *room_name = NULL;
-       const gchar          *room_names[2] = {NULL, NULL};
 
        chatrooms = new_chatroom_dialog_model_get_selected (dialog);
        if (chatrooms) {
@@ -626,66 +620,24 @@ new_chatroom_dialog_join (GossipNewChatroomDialog *dialog)
        }
        account_chooser = GOSSIP_ACCOUNT_CHOOSER (dialog->account_chooser);
        account = gossip_account_chooser_get_account (account_chooser);
-       mc = gossip_mission_control_new ();
-       tp_conn = mission_control_get_connection (mc, account, NULL);
-
-       if (!tp_conn) {
-               g_object_unref (mc);
-               return;
-       }
 
        if (!G_STR_EMPTY (server)) {
                room_name = g_strconcat (room, "@", server, NULL);
-               room_names[0] = room_name;
        } else {
-               room_names[0] = room;
+               room_name = g_strdup (room);
        }
 
-       gossip_debug (DEBUG_DOMAIN, "Requesting handle for room '%s'",
-                     room_names[0]);
-
-       /* Gives the ref of account/tp_conn to the callback */
-       tp_conn_request_handles_async (DBUS_G_PROXY (tp_conn),
-                                      TP_HANDLE_TYPE_ROOM,
-                                      room_names,
-                                      (tp_conn_request_handles_reply)
-                                      new_chatroom_dialog_request_handles_cb,
-                                      account);
-       g_free (room_name);
-       g_object_unref (mc);
-}
-
-static void
-new_chatroom_dialog_request_handles_cb (DBusGProxy *proxy,
-                                       GArray     *handles,
-                                       GError     *error,
-                                       McAccount  *account)
-{
-       MissionControl *mc;
-       guint           handle;
-
-       if (error) {
-               gossip_debug (DEBUG_DOMAIN,
-                             "Error requesting room handle: %s",
-                             error ? error->message : "No error given");
-               goto OUT;
-       }
+       gossip_debug (DEBUG_DOMAIN, "Requesting channel for '%s'", room_name);
 
        mc = gossip_mission_control_new ();
-       handle = g_array_index (handles, guint, 0);
-
-       gossip_debug (DEBUG_DOMAIN, "Got handle %d, requesting channel", handle);
-       mission_control_request_channel (mc,
-                                        account,
-                                        TP_IFACE_CHANNEL_TYPE_TEXT,
-                                        handle,
-                                        TP_HANDLE_TYPE_ROOM,
-                                        NULL, NULL);   
+       mission_control_request_channel_with_string_handle (mc,
+                                                           account,
+                                                           TP_IFACE_CHANNEL_TYPE_TEXT,
+                                                           room_name,
+                                                           TP_HANDLE_TYPE_ROOM,
+                                                           NULL, NULL);        
+       g_free (room_name);
        g_object_unref (mc);
-
-OUT:
-       g_object_unref (account);
-       g_object_unref (proxy);
 }
 
 static void