]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-chat.c
Updatre python binding
[empathy.git] / libempathy-gtk / empathy-chat.c
index 550bd94b2d4e3dd78fd0b04714ab98929c2edfac..3494b02fd3ea2874e0ec82bab956039f445bb321 100644 (file)
@@ -81,7 +81,6 @@ struct _EmpathyChatPriv {
        time_t                 last_log_timestamp;
        gboolean               is_first_char;
        guint                  block_events_timeout_id;
-       GList                 *pending_messages;
        /* Used to automatically shrink a window that has temporarily
         * grown due to long input. 
         */
@@ -398,9 +397,6 @@ chat_finalize (GObject *object)
        chat_composing_remove_timeout (chat);
        g_object_unref (priv->log_manager);
 
-       g_list_foreach (priv->pending_messages, (GFunc) g_object_unref, NULL);
-       g_list_free (priv->pending_messages);
-
        dbus_g_proxy_disconnect_signal (DBUS_G_PROXY (priv->mc), "AccountStatusChanged",
                                        G_CALLBACK (chat_status_changed_cb),
                                        chat);
@@ -449,9 +445,6 @@ chat_destroy_cb (EmpathyTpChat *tp_chat,
                g_source_remove (priv->block_events_timeout_id);
        }
 
-       g_list_foreach (priv->pending_messages, (GFunc) g_object_unref, NULL);
-       g_list_free (priv->pending_messages);
-
        if (EMPATHY_CHAT_GET_CLASS (chat)->set_tp_chat) {
                EMPATHY_CHAT_GET_CLASS (chat)->set_tp_chat (chat, NULL);
        }
@@ -535,14 +528,6 @@ chat_message_received_cb (EmpathyTpChat  *tp_chat,
                return;
        }
 
-       if (chat->block_events) {
-               /* Wait until block_events cb before displaying
-                * them to have to chance to get alias/avatar of sender. */
-               priv->pending_messages = g_list_append (priv->pending_messages,
-                                                       g_object_ref (message));
-               return;
-       }
-
        sender = empathy_message_get_sender (message);
        empathy_debug (DEBUG_DOMAIN, "Appending message ('%s')",
                      empathy_contact_get_name (sender));
@@ -1443,6 +1428,22 @@ empathy_chat_is_connected (EmpathyChat *chat)
        return (priv->tp_chat != NULL);
 }
 
+static const gchar *
+chat_get_window_id_for_geometry (EmpathyChat *chat)
+{
+       gboolean separate_windows;
+
+       empathy_conf_get_bool (empathy_conf_get (),
+                              EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS,
+                              &separate_windows);
+
+       if (separate_windows) {
+               return empathy_chat_get_id (chat);
+       } else {
+               return "chat-window";
+       }
+}
+
 void
 empathy_chat_save_geometry (EmpathyChat *chat,
                           gint        x,
@@ -1450,7 +1451,7 @@ empathy_chat_save_geometry (EmpathyChat *chat,
                           gint        w,
                           gint        h)
 {
-       empathy_geometry_save (empathy_chat_get_id (chat), x, y, w, h);
+       empathy_geometry_save (chat_get_window_id_for_geometry (chat), x, y, w, h);
 }
 
 void
@@ -1460,7 +1461,7 @@ empathy_chat_load_geometry (EmpathyChat *chat,
                           gint       *w,
                           gint       *h)
 {
-       empathy_geometry_load (empathy_chat_get_id (chat), x, y, w, h);
+       empathy_geometry_load (chat_get_window_id_for_geometry (chat), x, y, w, h);
 }
 
 static gboolean
@@ -1468,18 +1469,10 @@ chat_block_events_timeout_cb (gpointer data)
 {
        EmpathyChat     *chat = EMPATHY_CHAT (data);
        EmpathyChatPriv *priv = GET_PRIV (chat);
-       GList           *l;
 
        chat->block_events = FALSE;
        priv->block_events_timeout_id = 0;
 
-       for (l = priv->pending_messages; l; l = l->next) {
-               chat_message_received_cb (priv->tp_chat, l->data, chat);
-               g_object_unref (l->data);
-       }
-       g_list_free (priv->pending_messages);
-       priv->pending_messages = NULL;
-
        return FALSE;
 }
 
@@ -1488,7 +1481,6 @@ empathy_chat_set_tp_chat (EmpathyChat   *chat,
                          EmpathyTpChat *tp_chat)
 {
        EmpathyChatPriv *priv;
-       GList           *messages;
 
        g_return_if_fail (EMPATHY_IS_CHAT (chat));
        g_return_if_fail (EMPATHY_IS_TP_CHAT (tp_chat));
@@ -1528,6 +1520,7 @@ empathy_chat_set_tp_chat (EmpathyChat   *chat,
        priv->tp_chat = g_object_ref (tp_chat);
        priv->id = g_strdup (empathy_tp_chat_get_id (tp_chat));
        priv->account = g_object_ref (empathy_tp_chat_get_account (tp_chat));
+       empathy_tp_chat_set_acknowledge (tp_chat, TRUE);
 
        if (priv->first_tp_chat) {
                chat_add_logs (chat);
@@ -1547,12 +1540,6 @@ empathy_chat_set_tp_chat (EmpathyChat   *chat,
                          G_CALLBACK (chat_destroy_cb),
                          chat);
 
-       /* Get pending messages, wait until block_events cb before displaying
-        * them to have to chance to get alias/avatar of sender. */
-       empathy_tp_chat_set_acknowledge (tp_chat, TRUE);
-       messages = empathy_tp_chat_get_pendings (tp_chat);
-       priv->pending_messages = g_list_concat (priv->pending_messages, messages);
-
        if (!priv->sensitive) {
                gtk_widget_set_sensitive (chat->input_text_view, TRUE);
                empathy_chat_view_append_event (chat->view, _("Connected"));