Skip to content
Snippets Groups Projects
Commit 7da4268f authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

History - pop head and push tail if full

parent d57b955d
No related branches found
No related tags found
No related merge requests found
......@@ -377,7 +377,7 @@ sflphone_incoming_call (call_t * c)
call_list_add ( current_calls, c );
call_list_add( history, c );
update_call_tree_add( current_calls , c );
update_call_tree_add( history , c );
//update_call_tree_add( history , c );
update_menus();
}
......@@ -649,7 +649,7 @@ sflphone_place_call ( call_t * c )
// Update history
c->history_state = OUTGOING;
call_list_add(history, c);
update_call_tree_add(history, c);
//update_call_tree_add(history, c);
}
}
......
......@@ -81,9 +81,20 @@ call_list_add (calltab_t* tab, call_t * c)
{
if( tab == history )
{
g_print("ADD THE FUCKING CALL call list size = %i - max calls = %i\n", call_list_get_size(tab) , dbus_get_max_calls());
// First case: can still add calls to the list
if( call_list_get_size(tab) < dbus_get_max_calls() )
{
g_print("ADD THE FUCKING CALL\n");
g_queue_push_tail (tab->callQueue, (gpointer *) c);
update_call_tree_add( history , c );
}
// List full -> Remove the last call from history and preprend the new call to the list
else
{
update_call_tree_remove( history , (call_t*)g_queue_pop_head( tab -> callQueue ) );
g_queue_push_tail (tab->callQueue, (gpointer *) c);
update_call_tree_add( history , c );
}
}
else
......
......@@ -619,7 +619,8 @@ update_call_tree (calltab_t* tab, call_t * c)
void
update_call_tree_add (calltab_t* tab, call_t * c)
{
if( tab == history && ( call_list_get_size( tab ) >= dbus_get_max_calls() ) )
g_print("ADD THE FUCKING CALL call list size = %i - max calls = %i\n", call_list_get_size(tab) , dbus_get_max_calls());
if( tab == history && ( call_list_get_size( tab ) > dbus_get_max_calls() ) )
return;
GdkPixbuf *pixbuf;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment