From 347749b8b8051ee3f561ca55898c41de84f7744c Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandresavard@msavard.(none)>
Date: Thu, 16 Jun 2011 16:58:30 -0400
Subject: [PATCH] #6183: Calling calltree_add_call explicitely for history

---
 sflphone-client-gnome/src/actions.c           | 10 ++++++++--
 sflphone-client-gnome/src/contacts/calllist.c | 15 +++++----------
 sflphone-client-gnome/src/dbus/dbus.c         |  2 ++
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c
index a6f0a4c7d3..8495bbaee7 100644
--- a/sflphone-client-gnome/src/actions.c
+++ b/sflphone-client-gnome/src/actions.c
@@ -626,6 +626,7 @@ sflphone_incoming_call (callable_obj_t * c)
     calllist_add_call (current_calls, c);
     calllist_add_call (history, c);
     calltree_add_call (current_calls, c, NULL);
+    calltree_add_call (history, c, NULL);
     update_actions();
     calltree_display (current_calls);
 
@@ -950,7 +951,10 @@ static int _place_registered_call (callable_obj_t * c)
     }
 
     c->_history_state = OUTGOING;
+    
     calllist_add_call (history, c);
+    calltree_add_call (history, c, NULL);    
+
     return 0;
 }
 
@@ -1314,9 +1318,11 @@ void sflphone_fill_history (void)
 
                 // do something with key and value
                 create_history_entry_from_serialized_form ( (gchar*) key, (gchar*) value, &history_entry);
-                DEBUG ("HISTORY ENTRY: %i\n", history_entry->_time_start);
-                // Add it and update the GUI
+                DEBUG ("SFLphone: History timestart%d\n", history_entry->_time_start);
+                
+		// Add it and update the GUI
                 calllist_add_call (history, history_entry);
+		calltree_add_call (history, history_entry, NULL);
 
                 // remove entry from map
                 g_hash_table_remove (entries, key_to_min);
diff --git a/sflphone-client-gnome/src/contacts/calllist.c b/sflphone-client-gnome/src/contacts/calllist.c
index 0caacf5fa1..68791f3631 100644
--- a/sflphone-client-gnome/src/contacts/calllist.c
+++ b/sflphone-client-gnome/src/contacts/calllist.c
@@ -49,7 +49,6 @@ gint is_callID_callstruct(gconstpointer a, gconstpointer b)
     
     call = c->elem.call;
 
-    DEBUG("Compare %s to %s", call->_callID, (const gchar *)b);
     if(g_strcasecmp(call->_callID, (const gchar *) b) == 0) {
         return 0;
     }
@@ -147,16 +146,12 @@ calllist_add_call (calltab_t* tab, callable_obj_t * c)
 {
     QueueElement *element;
 
-    DEBUG(")))))))))))))))))))))))))))))))))))))))))))) Calllist: Add Call %s", c->_callID);
+    DEBUG("Calllist: Add Call %s", c->_callID);
 
-    // if (tab == history) {
-    //    calllist_add_history_call (c);
-    // } else {
-	element = (QueueElement *)malloc(sizeof(QueueElement));
-	element->type = HIST_CALL;
-	element->elem.call = c;
-        g_queue_push_tail (tab->callQueue, (gpointer *) element);
-    // }
+    element = (QueueElement *)malloc(sizeof(QueueElement));
+    element->type = HIST_CALL;
+    element->elem.call = c;
+    g_queue_push_tail (tab->callQueue, (gpointer *) element);
 }
 
 // TODO : sflphoneGTK : try to do this more generic
diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c
index 49ff53cdb3..cb46476b5c 100644
--- a/sflphone-client-gnome/src/dbus/dbus.c
+++ b/sflphone-client-gnome/src/dbus/dbus.c
@@ -76,6 +76,8 @@ new_call_created_cb (DBusGProxy *proxy UNUSED, const gchar *accountID,
     calllist_add_call(current_calls, c);
     calllist_add_call(history, c);
     calltree_add_call(current_calls, c, NULL);
+    calltree_add_call(history, c, NULL);
+
     update_actions();
     calltree_display(current_calls);
 }
-- 
GitLab