diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index 06fe04a15852bf17292065c3ece03900935834b0..54c9bc3dfe7937483b3a31d267c0f6b6435fca9b 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -339,45 +339,83 @@ button_pressed(GtkWidget* widget, GdkEventButton *event, gpointer user_data UNUS gchar* -calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type) +calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type, gchar** display_info) { gchar * description; + gchar * tmp_info; - if(c->_state_code == 0) { + DEBUG("----------------- calltree_display_call_info -----------------\n"); + + switch(display_type) { + + case DISPLAY_TYPE_CALL: + + DEBUG("display a normal call"); + if(c->_state_code == 0) { + + if(g_strcmp0("", c->_peer_name) == 0) { + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>", + c->_peer_name, + c->_peer_number); + } + else { + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>", + c->_peer_name, + c->_peer_number); + } - if(g_strcmp0("", c->_peer_name) == 0) { - description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>", - c->_peer_name, - c->_peer_number); } else { - description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>", - c->_peer_name, - c->_peer_number); + if(g_strcmp0("", c->_peer_name) == 0) { + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s (%d)</i>", + c->_peer_number, + c->_peer_name, + c->_state_code_description, + c->_state_code); + } + else { + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s (%d)</i>", + c->_peer_name, + c->_peer_number, + c->_state_code_description, + c->_state_code); + } } - } - else { - if(g_strcmp0("", c->_peer_name) == 0) { - description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s (%d)</i>", + break; + + + case DISPLAY_TYPE_CALL_TRANSFER: + + DEBUG("display a call transfer") + + if(g_strcmp0("",c->_peer_name) == 0){ + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>Transfert to:%s</i> ", c->_peer_number, c->_peer_name, - c->_state_code_description, - c->_state_code); + c->_trsft_to); } else { - description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>%s (%d)</i>", + description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>Transfert to:%s</i> ", c->_peer_name, c->_peer_number, - c->_state_code_description, - c->_state_code); + c->_trsft_to); } - } + DEBUG("Transfer string: %s", description); + break; - return description; + default : + DEBUG("Not an allowable type of display"); + break; + + } + + // return description; + tmp_info = g_strdup(description); + *display_info = tmp_info; } @@ -629,6 +667,10 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) if(c->_state == CALL_STATE_TRANSFERT) { + + calltree_display_call_info(c, DISPLAY_TYPE_CALL_TRANSFER, &description); + DEBUG("second try: %s", description); + /* if(g_strcmp0("",c->_peer_name) == 0){ description = g_markup_printf_escaped("<b>%s</b> <i>%s</i>\n<i>Transfert to:%s</i> ", c->_peer_number, @@ -641,6 +683,7 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) c->_peer_number, c->_trsft_to); } + */ } else { @@ -800,6 +843,7 @@ void calltree_add_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) gchar * date=""; gchar *duration=""; + /* if(c->_state_code == 0) { if(g_strcmp0("", c->_peer_name) == 0) { @@ -830,6 +874,9 @@ void calltree_add_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) c->_state_code); } } + */ + + calltree_display_call_info(c, DISPLAY_TYPE_CALL, &description); gtk_tree_store_prepend (tab->store, &iter, parent); diff --git a/sflphone-client-gnome/src/contacts/calltree.h b/sflphone-client-gnome/src/contacts/calltree.h index ea5337948c84312aef89376e3d8d85837fd9267f..90af092040b5fce303280baea73a22cce6fa4d89 100644 --- a/sflphone-client-gnome/src/contacts/calltree.h +++ b/sflphone-client-gnome/src/contacts/calltree.h @@ -44,8 +44,8 @@ enum { * Tags used to identify display type in calltree */ typedef enum { - DISPLAY_TYPE_CALL_TRANSFER, DISPLAY_TYPE_CALL, + DISPLAY_TYPE_CALL_TRANSFER, DISPLAY_TYPE_SAS, DISPLAY_TYPE_STATE_CODE } CallDisplayType;