From 0c0ecfd16fada6e9ee70dace2b38aa2651b87eaa Mon Sep 17 00:00:00 2001 From: Alexandre Savard <alexandresavard@alexandresavard-desktop.(none)> Date: Tue, 1 Dec 2009 17:08:42 -0500 Subject: [PATCH] [#2474] Use calltree_display_call_info for Normal calls and Transfers --- sflphone-client-gnome/src/contacts/calltree.c | 87 ++++++++++++++----- sflphone-client-gnome/src/contacts/calltree.h | 2 +- 2 files changed, 68 insertions(+), 21 deletions(-) diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index 06fe04a158..54c9bc3dfe 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 ea5337948c..90af092040 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; -- GitLab