diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index 42e1cdef68c4a3e49e5b3ffaec78fee413f84299..5d98d19e7bb864c8690e8924ea42eef82c9bdacf 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -433,20 +433,22 @@ sflphone_hang_up() void sflphone_conference_hang_up() { - conference_obj_t * selectedConf = calltab_get_selected_conf(); + conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls); - if (selectedConf) + if (selectedConf) { dbus_hang_up_conference (selectedConf); + } } void sflphone_pick_up() { - DEBUG ("sflphone_pick_up\n"); callable_obj_t * selectedCall = NULL; selectedCall = calltab_get_selected_call (active_calltree); + DEBUG("SFLphone: Pick up"); + if (selectedCall) { switch (selectedCall->_state) { case CALL_STATE_DIALING: diff --git a/sflphone-client-gnome/src/conference_obj.c b/sflphone-client-gnome/src/conference_obj.c index ba451a562f90f9dca6342a134297ba8e8ed4c98f..c193e28df0ef16e40d081c1b8840d9ae917652dd 100644 --- a/sflphone-client-gnome/src/conference_obj.c +++ b/sflphone-client-gnome/src/conference_obj.c @@ -62,6 +62,7 @@ void create_new_conference (conference_state_t state, const gchar* confID, confe new_conf->_confID = g_strdup (conf_id); new_conf->participant_list = NULL; + new_conf->participant_number = NULL; *conf = new_conf; } @@ -114,8 +115,9 @@ void free_conference_obj_t (conference_obj_t *c) { g_free (c->_confID); - if (c->participant_list) - g_slist_free (c->participant_list); + if (c->participant_list) { + g_slist_free(c->participant_list); + } g_free (c); } @@ -124,9 +126,13 @@ void free_conference_obj_t (conference_obj_t *c) void conference_add_participant (const gchar* call_id, conference_obj_t* conf) { // store the new participant list after appending participant id - conf->participant_list = g_slist_append (conf->participant_list, (gpointer) call_id); + conf->participant_list = g_slist_append (conf->participant_list, (gpointer) g_strdup(call_id)); } +void conference_add_participant_number(const gchar *call_id, conference_obj_t *conf) +{ + conf->participant_number = g_slist_append(conf->participant_number, (gpointer) g_strdup(call_id)); +} void conference_remove_participant (const gchar* call_id, conference_obj_t* conf) { diff --git a/sflphone-client-gnome/src/conference_obj.h b/sflphone-client-gnome/src/conference_obj.h index 5a9f87988c706dd4a01b4140104ff3ba45548900..20ec9e88475222ce2c534f93e8a820c221b9bfdc 100644 --- a/sflphone-client-gnome/src/conference_obj.h +++ b/sflphone-client-gnome/src/conference_obj.h @@ -62,6 +62,7 @@ typedef struct { gboolean _conference_secured; // the security state of the conference gboolean _conf_srtp_enabled; // security required for this conference GSList *participant_list; // participant list for this + GSList *participant_number; GtkWidget *_im_widget; // associated instant messaging widget time_t _time_start; time_t _time_stop; diff --git a/sflphone-client-gnome/src/contacts/calltab.c b/sflphone-client-gnome/src/contacts/calltab.c index 23709db648d2cb5966e90bf565a8bb9719463b74..0d8d4a5c90a7e531af43b499403324baf5763399 100644 --- a/sflphone-client-gnome/src/contacts/calltab.c +++ b/sflphone-client-gnome/src/contacts/calltab.c @@ -58,7 +58,7 @@ calltab_t* calltab_init (gboolean searchbar_type, gchar *name) void calltab_select_call (calltab_t* tab, callable_obj_t * c) { - DEBUG("CallTab: Select call"); + DEBUG("CallTab: Select call %s", c ? c->_callID : ""); tab->selectedType = A_CALL; tab->selectedCall = c; @@ -69,7 +69,7 @@ calltab_select_call (calltab_t* tab, callable_obj_t * c) void calltab_select_conf (calltab_t *tab, conference_obj_t * c) { - DEBUG("CallTab: Selected conf"); + DEBUG("CallTab: Selected conf %s", c ? c->_confID : ""); tab->selectedType = A_CONFERENCE; tab->selectedConf = c; @@ -83,15 +83,15 @@ calltab_get_selected_type (calltab_t* tab) } callable_obj_t * -calltab_get_selected_call (calltab_t* tab) +calltab_get_selected_call (calltab_t *tab) { return tab->selectedCall; } conference_obj_t* -calltab_get_selected_conf () +calltab_get_selected_conf (calltab_t *tab) { - return current_calls->selectedConf; + return tab->selectedConf; } void diff --git a/sflphone-client-gnome/src/contacts/calltab.h b/sflphone-client-gnome/src/contacts/calltab.h index 2250072118d888f342ee1caee63eb0e32469ccb3..ce3df9c2a81cc9c086b50bd3eab28ed3b92f990a 100644 --- a/sflphone-client-gnome/src/contacts/calltab.h +++ b/sflphone-client-gnome/src/contacts/calltab.h @@ -40,7 +40,7 @@ calltab_t* current_calls; calltab_t* history; calltab_t* contacts; -calltab_t* calltab_init (gboolean searchbar_type, gchar *name); +calltab_t* calltab_init (gboolean, gchar *); @@ -54,15 +54,15 @@ void calltab_select_conf (calltab_t *, conference_obj_t *); gint -calltab_get_selected_type (calltab_t* tab); +calltab_get_selected_type (calltab_t *); /** Return the selected call. * @return The number of the caller */ callable_obj_t * -calltab_get_selected_call (calltab_t*); +calltab_get_selected_call (calltab_t *); conference_obj_t * -calltab_get_selected_conf (); +calltab_get_selected_conf (calltab_t *); void calltab_create_searchbar (calltab_t *); diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index 5410fd9fddea007ad2d8ccf42cf61f914cef2f31..9bba8babc2d71823e453e7559dc0786032fbc895 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -75,10 +75,11 @@ conference_obj_t *selected_conf; static void calltree_add_history_conference(conference_obj_t *); -static void drag_begin_cb (GtkWidget *widget, GdkDragContext *dc, gpointer data); -static void drag_end_cb (GtkWidget * mblist, GdkDragContext * context, gpointer data); -void drag_data_received_cb (GtkWidget *widget, GdkDragContext *dc, gint x, gint y, GtkSelectionData *selection_data, guint info, guint t, gpointer data); +static void drag_begin_cb (GtkWidget *, GdkDragContext *, gpointer); +static void drag_end_cb (GtkWidget *, GdkDragContext *, gpointer); +void drag_data_received_cb (GtkWidget *, GdkDragContext *, gint, gint, GtkSelectionData *, guint, guint, gpointer); static void menuitem_response (gchar *); +static void calltree_create_conf_from_participant_list (GSList *); enum { COLUMN_ACCOUNT_STATE = 0, @@ -103,7 +104,7 @@ static void call_selected_cb (GtkTreeSelection *sel, void* data UNUSED) { - DEBUG ("CallTree: Selection callback"); + DEBUG ("******************************************* CallTree: Selection callback"); GtkTreeIter iter; GValue val; @@ -153,7 +154,7 @@ call_selected_cb (GtkTreeSelection *sel, void* data UNUSED) } } - DEBUG ("CallTree: selected_path %s, selected_call_id %s, selected_path_depth %d", + DEBUG ("******************************* CallTree: selected_path %s, selected_conf_id %s, selected_path_depth %d", selected_path, selected_call_id, selected_path_depth); } else { @@ -244,12 +245,13 @@ row_activated (GtkTreeView *tree_view UNUSED, calllist_add (current_calls, new_call); calltree_add_call (current_calls, new_call, NULL); // Function sflphone_place_call (new_call) is processed in process_dialing - DEBUG("------------------------------------ PLACING A NEW CALL FROM ROW ACTIVATED (history)"); sflphone_place_call(new_call); calltree_display (current_calls); } } - } else if (calltab_get_selected_type (current_calls) == A_CONFERENCE) { + } else if (calltab_get_selected_type (active_calltree) == A_CONFERENCE) { + + DEBUG("SELECTED A CONFERENCE"); if (active_calltree == current_calls) { @@ -273,9 +275,39 @@ row_activated (GtkTreeView *tree_view UNUSED, } } } + else if (active_calltree == history) { + DEBUG("SELECTED A CONFERENCE IN HISTORY"); + + selectedConf = calltab_get_selected_conf(history); + if(selectedConf == NULL) { + ERROR("CallTree: Error: Could not get selected conference from history"); + return; + } + + DEBUG("Selected conf id %s", selectedConf->_confID); + + calltree_create_conf_from_participant_list(selectedConf->participant_list); + } } } +static void +calltree_create_conf_from_participant_list(GSList *list) { + gchar **participant_list; + gint list_length = g_slist_length(list); + gint i; + + DEBUG("CallTree: Create conference from participant list"); + + participant_list = (void *) malloc(sizeof(void*)); + + for(i = 0; i < list_length; i++) { + gchar *participant = g_slist_nth_data(list, i); + DEBUG("********************* participant %s ***************************", participant); + } + + // dbus_create_conf_from_participant_list(participant_list); +} /* Catch cursor-activated signal. That is, when the entry is single clicked */ void @@ -706,8 +738,9 @@ calltree_remove_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) callable_obj_t * selectedCall = calltab_get_selected_call (tab); - if (selectedCall == c) + if (selectedCall == c) { calltab_select_call (tab, NULL); + } update_actions(); diff --git a/sflphone-client-gnome/src/uimanager.c b/sflphone-client-gnome/src/uimanager.c index 9e092f28f5728505094b222d21ef2975fd5f8f4e..89434a20111762ffa93feb742e315a6273c59209 100644 --- a/sflphone-client-gnome/src/uimanager.c +++ b/sflphone-client-gnome/src/uimanager.c @@ -534,7 +534,7 @@ static void call_hold (void* foo UNUSED) { callable_obj_t * selectedCall = calltab_get_selected_call (current_calls); - conference_obj_t * selectedConf = calltab_get_selected_conf(); + conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls); DEBUG ("UIManager: Hold button pressed"); @@ -578,7 +578,7 @@ static void call_im (void* foo UNUSED) { callable_obj_t *selectedCall = calltab_get_selected_call (current_calls); - conference_obj_t *selectedConf = calltab_get_selected_conf(); + conference_obj_t *selectedConf = calltab_get_selected_conf(current_calls); if (calltab_get_selected_type (current_calls) == A_CALL) { @@ -599,9 +599,14 @@ call_im (void* foo UNUSED) static void conference_hold (void* foo UNUSED) { - conference_obj_t * selectedConf = calltab_get_selected_conf(); + conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls); - DEBUG ("UIManager: Hold button pressed (conference)"); + DEBUG ("UIManager: Hold button pressed for conference"); + + if(selectedConf == NULL) { + ERROR("UIManager: No conference selected"); + return; + } switch (selectedConf->_state) { case CONFERENCE_STATE_HOLD: @@ -629,16 +634,18 @@ conference_hold (void* foo UNUSED) static void call_pick_up (void * foo UNUSED) { - DEBUG ("------ call_button -----"); callable_obj_t * selectedCall; callable_obj_t* new_call; + + DEBUG ("UIManager: Pick up"); - selectedCall = calltab_get_selected_call (active_calltree); - - if (calllist_get_size (current_calls) > 0) + if (calllist_get_size (current_calls) > 0) { sflphone_pick_up(); + } else if (calllist_get_size (active_calltree) > 0) { + selectedCall = calltab_get_selected_call(active_calltree); + if (selectedCall) { create_new_call (CALL, CALL_STATE_DIALING, "", "", "", selectedCall->_peer_number, &new_call); @@ -660,13 +667,11 @@ call_pick_up (void * foo UNUSED) static void call_hang_up (void) { - DEBUG ("UIManager: Hang up button pressed (call)"); /* * [#3020] Restore the record toggle button * We set it to FALSE, as when we hang up a call, the recording is stopped. */ -// gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (recordWidget), FALSE); sflphone_hang_up(); @@ -699,12 +704,16 @@ call_configuration_assistant (void * foo UNUSED) static void remove_from_history (void * foo UNUSED) { - callable_obj_t* c = calltab_get_selected_call (history); + callable_obj_t* call = calltab_get_selected_call (history); - if (c) { - DEBUG ("UIManager: Remove the call from the history"); - calllist_remove_from_history (c); + DEBUG ("UIManager: Remove the call from the history"); + + if(call == NULL) { + ERROR("UIManager: Error: Call is NULL"); + return; } + + calllist_remove_from_history (call); } static void @@ -714,15 +723,20 @@ call_back (void * foo UNUSED) selected_call = calltab_get_selected_call (active_calltree); - if (selected_call) { - create_new_call (CALL, CALL_STATE_DIALING, "", "", - selected_call->_peer_name, selected_call->_peer_number, &new_call); + DEBUG("UIManager: Call back"); - calllist_add (current_calls, new_call); - calltree_add_call (current_calls, new_call, NULL); - sflphone_place_call (new_call); - calltree_display (current_calls); + if(selected_call == NULL) { + ERROR("UIManager: Error: No selected call"); + return; } + + create_new_call (CALL, CALL_STATE_DIALING, "", "", + selected_call->_peer_name, selected_call->_peer_number, &new_call); + + calllist_add (current_calls, new_call); + calltree_add_call (current_calls, new_call, NULL); + sflphone_place_call (new_call); + calltree_display (current_calls); } static void @@ -745,28 +759,33 @@ edit_copy (void * foo UNUSED) callable_obj_t * selectedCall = calltab_get_selected_call (current_calls); gchar * no = NULL; - if (selectedCall) { - switch (selectedCall->_state) { - case CALL_STATE_TRANSFERT: - case CALL_STATE_DIALING: - case CALL_STATE_RINGING: - no = selectedCall->_peer_number; - break; - case CALL_STATE_CURRENT: - case CALL_STATE_RECORD: - case CALL_STATE_HOLD: - case CALL_STATE_BUSY: - case CALL_STATE_FAILURE: - case CALL_STATE_INCOMING: - default: - no = selectedCall->_peer_number; - break; - } + DEBUG("UIManager: Edit/Copy"); - DEBUG ("UIManager: Clipboard number: %s\n", no); - gtk_clipboard_set_text (clip, no, strlen (no)); + if(selectedCall == NULL) { + ERROR("UIManager: Error: No selected call", selectedCall); + return; } + switch (selectedCall->_state) { + case CALL_STATE_TRANSFERT: + case CALL_STATE_DIALING: + case CALL_STATE_RINGING: + no = selectedCall->_peer_number; + break; + case CALL_STATE_CURRENT: + case CALL_STATE_RECORD: + case CALL_STATE_HOLD: + case CALL_STATE_BUSY: + case CALL_STATE_FAILURE: + case CALL_STATE_INCOMING: + default: + no = selectedCall->_peer_number; + break; + } + + DEBUG ("UIManager: Clipboard number: %s\n", no); + gtk_clipboard_set_text (clip, no, strlen (no)); + } // The menu Edit/Paste should paste the clipboard into the current selected call @@ -1157,7 +1176,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event) } } else { DEBUG ("UIManager: Menus: selected a conf"); - selectedConf = calltab_get_selected_conf(); + selectedConf = calltab_get_selected_conf(active_calltree); if (selectedConf) { switch (selectedConf->_state) {