diff --git a/sflphone-client-gnome/src/contacts/calltab.c b/sflphone-client-gnome/src/contacts/calltab.c index f2b333a3ece50e069c1b0744e088f21905a50ccf..23709db648d2cb5966e90bf565a8bb9719463b74 100644 --- a/sflphone-client-gnome/src/contacts/calltab.c +++ b/sflphone-client-gnome/src/contacts/calltab.c @@ -52,25 +52,28 @@ calltab_t* calltab_init (gboolean searchbar_type, gchar *name) calltree_create (ret, searchbar_type); calllist_init (ret); - return ret; } void calltab_select_call (calltab_t* tab, callable_obj_t * c) { + DEBUG("CallTab: Select call"); + tab->selectedType = A_CALL; tab->selectedCall = c; - current_calls->selectedConf = NULL; + tab->selectedConf = NULL; } void -calltab_select_conf (conference_obj_t * c) +calltab_select_conf (calltab_t *tab, conference_obj_t * c) { - current_calls->selectedType = A_CONFERENCE; - current_calls->selectedConf = c; - current_calls->selectedCall = NULL; + DEBUG("CallTab: Selected conf"); + + tab->selectedType = A_CONFERENCE; + tab->selectedConf = c; + tab->selectedCall = NULL; } gint diff --git a/sflphone-client-gnome/src/contacts/calltab.h b/sflphone-client-gnome/src/contacts/calltab.h index b0ca9a8a26dd69152511398c2c5c1446aefbae98..2250072118d888f342ee1caee63eb0e32469ccb3 100644 --- a/sflphone-client-gnome/src/contacts/calltab.h +++ b/sflphone-client-gnome/src/contacts/calltab.h @@ -48,10 +48,10 @@ calltab_t* calltab_init (gboolean searchbar_type, gchar *name); * is the currently highlighted one in the list. * @param c The call */ void -calltab_select_call (calltab_t*, callable_obj_t *); +calltab_select_call (calltab_t *, callable_obj_t *); void -calltab_select_conf (conference_obj_t *); +calltab_select_conf (calltab_t *, conference_obj_t *); gint calltab_get_selected_type (calltab_t* tab); diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index c2d1296708c244379cc5da369f47c7ef7ff5dd30..2860bd810afe569218f2550824d0d90906f1c912 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -113,10 +113,17 @@ call_selected_cb (GtkTreeSelection *sel, void* data UNUSED) gchar* string_path; - if (! gtk_tree_selection_get_selected (sel, &model, &iter)) { + if (!gtk_tree_selection_get_selected (sel, &model, &iter)) { return; } + if(active_calltree == history) { + DEBUG("Current call tree is history"); + } + else if(active_calltree == current_calls) { + DEBUG("Current call tree is current calls"); + } + // store info for dragndrop path = gtk_tree_model_get_path (model, &iter); string_path = gtk_tree_path_to_string (path); @@ -130,7 +137,7 @@ call_selected_cb (GtkTreeSelection *sel, void* data UNUSED) val.g_type = 0; gtk_tree_model_get_value (model, &iter, COLUMN_ACCOUNT_PTR, &val); - calltab_select_conf ( (conference_obj_t*) g_value_get_pointer (&val)); + calltab_select_conf ( active_calltree, (conference_obj_t*) g_value_get_pointer (&val)); selected_conf = (conference_obj_t*) g_value_get_pointer (&val); @@ -243,7 +250,6 @@ row_activated (GtkTreeView *tree_view UNUSED, calltree_add_call (current_calls, new_call, NULL); // Function sflphone_place_call (new_call) is processed in process_dialing calltree_display (current_calls); - } } } else if (calltab_get_selected_type (current_calls) == A_CONFERENCE) { @@ -281,70 +287,83 @@ void row_single_click (GtkTreeView *tree_view UNUSED, void * data UNUSED) { callable_obj_t * selectedCall = NULL; + conference_obj_t *selectedConf = NULL; account_t * account_details = NULL; gchar * displaySasOnce=""; DEBUG ("CallTree: Single click action"); selectedCall = calltab_get_selected_call (active_calltree); + selectedConf = calltab_get_selected_conf (active_calltree); - /* - if(!selected_call) { - selected_call = selectedCall; + if(active_calltree == current_calls) { + DEBUG("CallTree: Active calltree is current_calls"); + } + else if(active_calltree == history) { + DEBUG("CallTree: Active calltree is history"); } - */ - if (selectedCall) { + if(calltab_get_selected_type(active_calltree) == A_CALL) { - account_details = account_list_get_by_id (selectedCall->_accountID); - DEBUG ("AccountID %s", selectedCall->_accountID); + DEBUG("CallTree: Selected a call"); - if (account_details != NULL) { - displaySasOnce = g_hash_table_lookup (account_details->properties, ACCOUNT_DISPLAY_SAS_ONCE); - DEBUG ("Display SAS once %s", displaySasOnce); - } else { - GHashTable * properties = NULL; - sflphone_get_ip2ip_properties (&properties); + if (selectedCall) { - if (properties != NULL) { - displaySasOnce = g_hash_table_lookup (properties, ACCOUNT_DISPLAY_SAS_ONCE); - DEBUG ("IP2IP displaysasonce %s", displaySasOnce); - } - } + account_details = account_list_get_by_id (selectedCall->_accountID); + DEBUG ("AccountID %s", selectedCall->_accountID); - /* Make sure that we are not in the history tab since - * nothing is defined for it yet - */ - if (active_calltree == current_calls) { + if (account_details != NULL) { + displaySasOnce = g_hash_table_lookup (account_details->properties, ACCOUNT_DISPLAY_SAS_ONCE); + DEBUG ("Display SAS once %s", displaySasOnce); + } else { + GHashTable * properties = NULL; + sflphone_get_ip2ip_properties (&properties); - // sflphone_selected_call_codec(selectedCall); + if (properties != NULL) { + displaySasOnce = g_hash_table_lookup (properties, ACCOUNT_DISPLAY_SAS_ONCE); + DEBUG ("IP2IP displaysasonce %s", displaySasOnce); + } + } - // DEBUG("single click action: %s", dbus_get_current_codec_name(selectedCall)); - // sflphone_display_selected_codec(dbus_get_current_codec_name(selectedCall)); + /* Make sure that we are not in the history tab since + * nothing is defined for it yet + */ + if (active_calltree == current_calls) { - switch (selectedCall->_srtp_state) { + switch (selectedCall->_srtp_state) { - case SRTP_STATE_ZRTP_SAS_UNCONFIRMED: - selectedCall->_srtp_state = SRTP_STATE_ZRTP_SAS_CONFIRMED; + case SRTP_STATE_ZRTP_SAS_UNCONFIRMED: + selectedCall->_srtp_state = SRTP_STATE_ZRTP_SAS_CONFIRMED; - if (g_strcasecmp (displaySasOnce,"true") == 0) { - selectedCall->_zrtp_confirmed = TRUE; - } + if (g_strcasecmp (displaySasOnce,"true") == 0) { + selectedCall->_zrtp_confirmed = TRUE; + } - dbus_confirm_sas (selectedCall); - calltree_update_call (current_calls, selectedCall, NULL); - break; - case SRTP_STATE_ZRTP_SAS_CONFIRMED: - selectedCall->_srtp_state = SRTP_STATE_ZRTP_SAS_UNCONFIRMED; - dbus_reset_sas (selectedCall); - calltree_update_call (current_calls, selectedCall, NULL); - break; - default: - DEBUG ("Single click but no action"); - break; + dbus_confirm_sas (selectedCall); + calltree_update_call (current_calls, selectedCall, NULL); + break; + case SRTP_STATE_ZRTP_SAS_CONFIRMED: + selectedCall->_srtp_state = SRTP_STATE_ZRTP_SAS_UNCONFIRMED; + dbus_reset_sas (selectedCall); + calltree_update_call (current_calls, selectedCall, NULL); + break; + default: + DEBUG ("Single click but no action"); + break; + } } } } + else if(calltab_get_selected_type(active_calltree) == A_CONFERENCE) { + DEBUG("CallTree: Selected a conference"); + + if(selectedConf) { + DEBUG("CallTree: There is actually a selected conf"); + } + } + else { + WARN("CallTree: Warning: Unknow selection type"); + } } static gboolean @@ -598,9 +617,10 @@ calltree_create (calltab_t* tab, gboolean searchbar_type) G_CALLBACK (menuitem_response), (gpointer) g_strdup (conference)); gtk_menu_shell_append (GTK_MENU_SHELL (popupmenu), menu_items); gtk_widget_show (menu_items); + } - - + if(tab == history) { + gtk_tree_view_set_show_expanders(GTK_TREE_VIEW(tab->view), TRUE); } @@ -898,7 +918,7 @@ void calltree_add_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) DEBUG ("CallTree: Add call to calltree id: %s, peer name: %s", c->_callID, c->_peer_name); if (tab == history) { - calltree_add_history_entry (c); + calltree_add_history_entry (c, parent); return; } @@ -1008,7 +1028,7 @@ void calltree_add_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) history_reinit (history); } -void calltree_add_history_entry (callable_obj_t * c) +void calltree_add_history_entry (callable_obj_t *c, GtkTreeIter *parent) { DEBUG ("CallTree: Calltree add history entry %s", c->_callID); @@ -1025,20 +1045,28 @@ void calltree_add_history_entry (callable_obj_t * c) calltree_display_call_info (c, DISPLAY_TYPE_HISTORY, NULL, &description); - gtk_tree_store_prepend (history->store, &iter, NULL); + gtk_tree_store_prepend (history->store, &iter, parent); - switch (c->_history_state) { - case INCOMING: - pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/incoming.svg", NULL); - break; - case OUTGOING: - pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/outgoing.svg", NULL); - break; - case MISSED: - pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/missed.svg", NULL); - break; - default: - WARN ("History - Should not happen!"); + if(parent == NULL) { + // this is a first level call not participating to a conference + switch (c->_history_state) { + case INCOMING: + pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/incoming.svg", NULL); + break; + case OUTGOING: + pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/outgoing.svg", NULL); + break; + case MISSED: + pixbuf = gdk_pixbuf_new_from_file (ICONS_DIR "/missed.svg", NULL); + break; + default: + WARN ("History - Should not happen!"); + } + } + else { + DEBUG("?????????????????????????????????????????????????????????????????????\n"); + // participant to a conference + pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/current.svg", NULL); } date = get_formatted_start_timestamp (c->_time_start); @@ -1357,21 +1385,42 @@ void calltree_remove_conference (calltab_t* tab, const conference_obj_t* conf, G void calltree_add_history_conference(conference_obj_t *conf) { GdkPixbuf *pixbuf = NULL; - gchar *description = ""; + gchar *description = "Conference: ", *date = "", *duration = ""; GtkTreeIter iter; + gchar *call_id; + callable_obj_t *call; + GSList *conference_participant; - DEBUG("------------------------------ ADD CONFERENCE TO HISTORY"); + DEBUG("CallTree: Add conference %s to history", conf->_confID); + + if(!conf) { + ERROR("CallTree: Error conference is NULL"); + } gtk_tree_store_prepend(history->store, &iter, NULL); - pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/", NULL); + pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersAttached.svg", NULL); if(pixbuf) { if(gdk_pixbuf_get_width(pixbuf) > 32 || gdk_pixbuf_get_height(pixbuf) > 32) { pixbuf = gdk_pixbuf_scale_simple(pixbuf, 32, 32, GDK_INTERP_BILINEAR); } - } + } + conference_participant = conf->participant_list; + if(conference_participant) { + while(conference_participant) { + call_id = (gchar *)(conference_participant->data); + call = calllist_get(current_calls, call_id); + if(call) { + calltree_add_history_entry(call, &iter); + } + conference_participant = conference_next_participant(conference_participant); + } + } + + date = get_formatted_start_timestamp(conf->_time_start); + description = g_strconcat(description, date, NULL); gtk_tree_store_set(history->store, &iter, 0, pixbuf, 1, description, 2, NULL, 3, conf, -1); if(pixbuf != NULL) { diff --git a/sflphone-client-gnome/src/contacts/calltree.h b/sflphone-client-gnome/src/contacts/calltree.h index d6fa160baa671d4904811b2f48ab8a4189f68d49..b13a43381e200be6587f2819232600cad549af19 100644 --- a/sflphone-client-gnome/src/contacts/calltree.h +++ b/sflphone-client-gnome/src/contacts/calltree.h @@ -90,8 +90,13 @@ calltree_update_call (calltab_t* ct, callable_obj_t * c, GtkTreeIter *parent); void calltree_remove_call (calltab_t* ct, callable_obj_t * c, GtkTreeIter *parent); +/** + * Add a callable object to history treeview + * @param The callable object to be inserted into the history + * @param The parent item in case of a conference, should be NULL in case of a normal call + */ void -calltree_add_history_entry (callable_obj_t * c); +calltree_add_history_entry (callable_obj_t *, GtkTreeIter *); void calltree_add_conference (calltab_t* tab, conference_obj_t* conf); diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c index d6c1294e0caafbbf530db474b394c4c043b94170..43885433f7204ae575351c396031a195e4778afe 100644 --- a/sflphone-client-gnome/src/dbus/dbus.c +++ b/sflphone-client-gnome/src/dbus/dbus.c @@ -344,6 +344,8 @@ conference_created_cb (DBusGProxy *proxy UNUSED, const gchar* confID, void * foo call->_confID = g_strdup (confID); } + set_timestamp(&new_conf->_time_start); + conferencelist_add (new_conf); calltree_add_conference (current_calls, new_conf); calltree_add_conference (history, new_conf); diff --git a/sflphone-client-gnome/src/uimanager.c b/sflphone-client-gnome/src/uimanager.c index 1fc4d03fbb130871bc7eac84a2197af721be7355..9e092f28f5728505094b222d21ef2975fd5f8f4e 100644 --- a/sflphone-client-gnome/src/uimanager.c +++ b/sflphone-client-gnome/src/uimanager.c @@ -201,10 +201,6 @@ update_actions() } } - // g_signal_handler_block (GTK_OBJECT (recordWidget), recordButtonConnId); - // gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (recordWidget), FALSE); - // g_signal_handler_unblock (GTK_OBJECT (recordWidget), recordButtonConnId); - callable_obj_t * selectedCall = calltab_get_selected_call (active_calltree); conference_obj_t * selectedConf = calltab_get_selected_conf (active_calltree); @@ -214,6 +210,9 @@ update_actions() instant_messaging_enabled = eel_gconf_get_integer (INSTANT_MESSAGING_ENABLED); if (selectedCall) { + + DEBUG("UIManager: Update actions for call"); + // update icon in systray show_status_hangup_icon(); @@ -340,6 +339,8 @@ update_actions() } } else if (selectedConf) { + DEBUG("UIManager: Update actions for conference"); + // update icon in systray show_status_hangup_icon();