diff --git a/gnome/src/actions.c b/gnome/src/actions.c index 392defa39b78e341dc7a59a35ddaa8806cdf27fe..7918e674b8f86a917be0c49d25aacfd445648102 100644 --- a/gnome/src/actions.c +++ b/gnome/src/actions.c @@ -187,19 +187,19 @@ status_bar_display_account() void sflphone_quit() { - if (calllist_get_size(current_calls) == 0 || main_window_ask_quit()) { + if (calllist_get_size(current_calls_tab) == 0 || main_window_ask_quit()) { // Save the history sflphone_save_history(); dbus_unregister(getpid()); dbus_clean(); account_list_free(); - calllist_clean(current_calls); - calllist_clean(contacts); - calllist_clean(history); - gtk_tree_store_clear(history->store); - gtk_tree_store_clear(current_calls->store); - gtk_tree_store_clear(contacts->store); + calllist_clean(current_calls_tab); + calllist_clean(contacts_tab); + calllist_clean(history_tab); + gtk_tree_store_clear(history_tab->store); + gtk_tree_store_clear(current_calls_tab->store); + gtk_tree_store_clear(contacts_tab->store); gtk_main_quit(); } } @@ -208,7 +208,7 @@ void sflphone_hold(callable_obj_t * c) { c->_state = CALL_STATE_HOLD; - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); update_actions(); } @@ -216,7 +216,7 @@ void sflphone_ringing(callable_obj_t * c) { c->_state = CALL_STATE_RINGING; - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); update_actions(); } @@ -225,8 +225,8 @@ sflphone_hung_up(callable_obj_t * c) { DEBUG("SFLphone: Hung up"); - calllist_remove_call(current_calls, c->_callID); - calltree_remove_call(current_calls, c); + calllist_remove_call(current_calls_tab, c->_callID); + calltree_remove_call(current_calls_tab, c); c->_state = CALL_STATE_DIALING; call_remove_all_errors(c); update_actions(); @@ -339,14 +339,14 @@ gboolean sflphone_init(GError **error) // Init icons factory init_icon_factory(); - current_calls = calltab_init(FALSE, CURRENT_CALLS); - contacts = calltab_init(TRUE, CONTACTS); - history = calltab_init(TRUE, HISTORY); + current_calls_tab = calltab_init(FALSE, CURRENT_CALLS); + contacts_tab = calltab_init(TRUE, CONTACTS); + history_tab = calltab_init(TRUE, HISTORY); account_list_init(); codec_capabilities_load(); - conferencelist_init(current_calls); - conferencelist_init(history); + conferencelist_init(current_calls_tab); + conferencelist_init(history_tab); // Fetch the configured accounts sflphone_fill_account_list(); @@ -373,8 +373,8 @@ GHashTable *sflphone_get_ip2ip_properties(void) void sflphone_hang_up() { - callable_obj_t * selectedCall = calltab_get_selected_call(current_calls); - conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree); + callable_obj_t * selectedCall = calltab_get_selected_call(current_calls_tab); + conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree_tab); DEBUG("SFLphone: Hang up"); @@ -426,7 +426,7 @@ sflphone_hang_up() } } - calltree_update_call(history, selectedCall, NULL); + calltree_update_call(history_tab, selectedCall); statusbar_update_clock(""); } @@ -434,7 +434,7 @@ sflphone_hang_up() void sflphone_pick_up() { - callable_obj_t *selectedCall = calltab_get_selected_call(active_calltree); + callable_obj_t *selectedCall = calltab_get_selected_call(active_calltree_tab); if (!selectedCall) { sflphone_new_call(); @@ -453,7 +453,7 @@ sflphone_pick_up() break; case CALL_STATE_INCOMING: selectedCall->_history_state = INCOMING; - calltree_update_call(history, selectedCall, NULL); + calltree_update_call(history_tab, selectedCall); // if instant messaging window is visible, create new tab (deleted automatically if not used) if (im_window_is_visible()) @@ -465,8 +465,8 @@ sflphone_pick_up() case CALL_STATE_TRANSFER: dbus_transfer(selectedCall); time(&selectedCall->_time_stop); - calltree_remove_call(current_calls, selectedCall); - calllist_remove_call(current_calls, selectedCall->_callID); + calltree_remove_call(current_calls_tab, selectedCall); + calllist_remove_call(current_calls_tab, selectedCall->_callID); break; case CALL_STATE_CURRENT: case CALL_STATE_HOLD: @@ -483,8 +483,8 @@ sflphone_pick_up() void sflphone_on_hold() { - callable_obj_t * selectedCall = calltab_get_selected_call(current_calls); - conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree); + callable_obj_t * selectedCall = calltab_get_selected_call(current_calls_tab); + conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree_tab); if (selectedCall) { switch (selectedCall->_state) { @@ -505,8 +505,8 @@ void sflphone_off_hold() { DEBUG("sflphone_off_hold"); - callable_obj_t * selectedCall = calltab_get_selected_call(current_calls); - conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree); + callable_obj_t * selectedCall = calltab_get_selected_call(current_calls_tab); + conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree_tab); if (selectedCall) { switch (selectedCall->_state) { @@ -527,7 +527,7 @@ void sflphone_fail(callable_obj_t * c) { c->_state = CALL_STATE_FAILURE; - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); update_actions(); } @@ -535,7 +535,7 @@ void sflphone_busy(callable_obj_t * c) { c->_state = CALL_STATE_BUSY; - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); update_actions(); } @@ -547,7 +547,7 @@ sflphone_current(callable_obj_t * c) time(&c->_time_start); c->_state = CALL_STATE_CURRENT; - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); update_actions(); } @@ -558,20 +558,20 @@ sflphone_record(callable_obj_t * c) time(&c->_time_start); c->_state = CALL_STATE_RECORD; - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); update_actions(); } void sflphone_set_transfer() { - callable_obj_t * c = calltab_get_selected_call(current_calls); + callable_obj_t * c = calltab_get_selected_call(current_calls_tab); if (c) { c->_state = CALL_STATE_TRANSFER; g_free(c->_trsft_to); c->_trsft_to = g_strdup(""); - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); } update_actions(); @@ -580,13 +580,13 @@ sflphone_set_transfer() void sflphone_unset_transfer() { - callable_obj_t * c = calltab_get_selected_call(current_calls); + callable_obj_t * c = calltab_get_selected_call(current_calls_tab); if (c) { c->_state = CALL_STATE_CURRENT; g_free(c->_trsft_to); c->_trsft_to = g_strdup(""); - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); } update_actions(); @@ -602,11 +602,11 @@ void sflphone_incoming_call(callable_obj_t * c) { c->_history_state = MISSED; - calllist_add_call(current_calls, c); - calltree_add_call(current_calls, c, NULL); + calllist_add_call(current_calls_tab, c); + calltree_add_call(current_calls_tab, c, NULL); update_actions(); - calltree_display(current_calls); + calltree_display(current_calls_tab); // Change the status bar if we are dealing with a direct SIP call if (_is_direct_call(c)) { @@ -639,7 +639,7 @@ process_dialing(callable_obj_t *c, guint keyval, gchar *key) if (len) { len--; // delete one character num[len] = '\0'; - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); /* If number is now empty, hang up immediately */ if (c->_state != CALL_STATE_TRANSFER && len == 0) @@ -670,7 +670,7 @@ process_dialing(callable_obj_t *c, guint keyval, gchar *key) c->_peer_number = new_peer_number; } - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); } break; @@ -681,21 +681,21 @@ process_dialing(callable_obj_t *c, guint keyval, gchar *key) callable_obj_t * sflphone_new_call() { - callable_obj_t *current_selected_call = calltab_get_selected_call(current_calls); + callable_obj_t *current_selected_call = calltab_get_selected_call(current_calls_tab); if ((current_selected_call != NULL) && (current_selected_call->_confID == NULL)) sflphone_on_hold(); // Play a tone when creating a new call - if (calllist_get_size(current_calls) == 0) + if (calllist_get_size(current_calls_tab) == 0) dbus_start_tone(TRUE , (current_account_has_new_message() > 0) ? TONE_WITH_MESSAGE : TONE_WITHOUT_MESSAGE) ; callable_obj_t *c = create_new_call(CALL, CALL_STATE_DIALING, "", "", "", ""); c->_history_state = OUTGOING; - calllist_add_call(current_calls, c); - calltree_add_call(current_calls, c, NULL); + calllist_add_call(current_calls_tab, c); + calltree_add_call(current_calls_tab, c, NULL); update_actions(); return c; @@ -705,9 +705,9 @@ sflphone_new_call() void sflphone_keypad(guint keyval, gchar * key) { - callable_obj_t * c = calltab_get_selected_call(current_calls); + callable_obj_t * c = calltab_get_selected_call(current_calls_tab); - if ((active_calltree != current_calls) || (active_calltree == current_calls && !c)) { + if ((active_calltree_tab != current_calls_tab) || (active_calltree_tab == current_calls_tab && !c)) { switch (keyval) { case GDK_Return: case GDK_KP_Enter: @@ -715,7 +715,7 @@ sflphone_keypad(guint keyval, gchar * key) case GDK_BackSpace: break; default: - calltree_display(current_calls); + calltree_display(current_calls_tab); process_dialing(sflphone_new_call(), keyval, key); break; } @@ -731,7 +731,7 @@ sflphone_keypad(guint keyval, gchar * key) case GDK_Escape: dbus_hang_up(c); time(&c->_time_stop); - calltree_update_call(history, c, NULL); + calltree_update_call(history_tab, c); break; default: // To play the dtmf when calling mail box for instance @@ -746,7 +746,7 @@ sflphone_keypad(guint keyval, gchar * key) case GDK_Return: case GDK_KP_Enter: c->_history_state = INCOMING; - calltree_update_call(history, c, NULL); + calltree_update_call(history_tab, c); dbus_accept(c); break; case GDK_Escape: @@ -762,7 +762,7 @@ sflphone_keypad(guint keyval, gchar * key) case GDK_KP_Enter: dbus_transfer(c); time(&c->_time_stop); - calltree_remove_call(current_calls, c); + calltree_remove_call(current_calls_tab, c); break; case GDK_Escape: sflphone_unset_transfer(); @@ -796,7 +796,7 @@ sflphone_keypad(guint keyval, gchar * key) switch (keyval) { case GDK_Escape: dbus_hang_up(c); - calltree_update_call(history, c, NULL); + calltree_update_call(history_tab, c); break; } @@ -899,9 +899,9 @@ sflphone_detach_participant(const gchar* callID) callable_obj_t * selectedCall; if (callID == NULL) - selectedCall = calltab_get_selected_call(current_calls); + selectedCall = calltab_get_selected_call(current_calls_tab); else - selectedCall = calllist_get_call(current_calls, callID); + selectedCall = calllist_get_call(current_calls_tab, callID); DEBUG("Action: Detach participant %s", selectedCall->_callID); @@ -911,8 +911,8 @@ sflphone_detach_participant(const gchar* callID) } im_widget_update_state(IM_WIDGET(selectedCall->_im_widget), TRUE); - calltree_remove_call(current_calls, selectedCall); - calltree_add_call(current_calls, selectedCall, NULL); + calltree_remove_call(current_calls_tab, selectedCall); + calltree_add_call(current_calls_tab, selectedCall, NULL); dbus_detach_participant(selectedCall->_callID); } @@ -921,7 +921,7 @@ sflphone_add_participant(const gchar* callID, const gchar* confID) { DEBUG(">SFLphone: Add participant %s to conference %s", callID, confID); - callable_obj_t *call = calllist_get_call(current_calls, callID); + callable_obj_t *call = calllist_get_call(current_calls_tab, callID); if (call == NULL) { ERROR("SFLphone: Error: Could not find call"); @@ -930,7 +930,7 @@ sflphone_add_participant(const gchar* callID, const gchar* confID) time(&call->_time_added); - calltree_add_call_to_conference(history, call, confID); + calltree_add_call_to_conference_in_history(call, confID); dbus_add_participant(callID, confID); } @@ -944,8 +944,8 @@ sflphone_add_main_participant(const conference_obj_t * c) void sflphone_rec_call() { - callable_obj_t * selectedCall = calltab_get_selected_call(current_calls); - conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls); + callable_obj_t * selectedCall = calltab_get_selected_call(current_calls_tab); + conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls_tab); if (selectedCall) { DEBUG("SFLphone: Set record for selected call"); @@ -963,7 +963,7 @@ sflphone_rec_call() break; } - calltree_update_call(current_calls, selectedCall, NULL); + calltree_update_call(current_calls_tab, selectedCall); } else if (selectedConf) { DEBUG("SFLphone: Set record for selected conf"); dbus_set_record(selectedConf->_confID); @@ -987,8 +987,8 @@ sflphone_rec_call() } DEBUG("Actions: Remove and add conference %s", selectedConf->_confID); - calltree_remove_conference(current_calls, selectedConf); - calltree_add_conference(current_calls, selectedConf); + calltree_remove_conference(current_calls_tab, selectedConf); + calltree_add_conference_to_current_calls(selectedConf); } update_actions(); @@ -1053,8 +1053,8 @@ void sflphone_fill_call_list(void) callable_obj_t *c = create_new_call_from_details(*calls, dbus_get_call_details(*calls)); g_free(callID); c->_zrtp_confirmed = FALSE; - calllist_add_call(current_calls, c); - calltree_add_call(current_calls, c, NULL); + calllist_add_call(current_calls_tab, c); + calltree_add_call(current_calls_tab, c, NULL); } g_free(list); @@ -1073,8 +1073,8 @@ void sflphone_fill_conference_list(void) GHashTable *conference_details = dbus_get_conference_details(conf_id); conference_obj_t *conf = create_new_conference_from_details(conf_id, conference_details); - conferencelist_add(current_calls, conf); - calltree_add_conference(current_calls, conf); + conferencelist_add(current_calls_tab, conf); + calltree_add_conference_to_current_calls(conf); } g_strfreev(conferences); @@ -1098,11 +1098,11 @@ void sflphone_fill_history(void) conference_obj_t *history_conf = create_conference_history_entry_from_serialized(current_entry); // verify if this conference has been already created yet - conference_obj_t *conf = conferencelist_get(history, history_conf->_confID); + conference_obj_t *conf = conferencelist_get(history_tab, history_conf->_confID); // if this conference hasn't been created yet, add it to the conference list if (!conf) - conferencelist_add(history, history_conf); + conferencelist_add(history_tab, history_conf); else { // if this conference was already created since one of the participant have already // been unserialized, update the recordfile value @@ -1113,17 +1113,17 @@ void sflphone_fill_history(void) history_call = create_history_entry_from_serialized_form(current_entry); // Add it and update the GUI - calllist_add_call(history, history_call); + calllist_add_call(history_tab, history_call); if (history_call->_confID && g_strcmp0(history_call->_confID, "") != 0) { // process conference - conference_obj_t *conf = conferencelist_get(history, history_call->_confID); + conference_obj_t *conf = conferencelist_get(history_tab, history_call->_confID); if (!conf) { // conference does not exist yet, create it conf = create_new_conference(CONFERENCE_STATE_ACTIVE_ATTACHED, history_call->_confID); - conferencelist_add(history, conf); + conferencelist_add(history_tab, conf); } // add this participant to the conference @@ -1141,27 +1141,26 @@ void sflphone_fill_history(void) g_free(entries_orig); // fill the treeview with calls - n = calllist_get_size(history); + n = calllist_get_size(history_tab); for (i = 0; i < n; i++) { - element = calllist_get_nth(history, i); + element = calllist_get_nth(history_tab, i); if (element->type == HIST_CALL) { call = element->elem.call; - calltree_add_call(history, call, NULL); + calltree_add_history_entry(call, NULL); } } // fill the treeview with conferences - n = conferencelist_get_size(history); + n = conferencelist_get_size(history_tab); for (i = 0; i < n; i++) { - conference_obj_t *conf = conferencelist_get_nth(history, i); - + conference_obj_t *conf = conferencelist_get_nth(history_tab, i); if (!conf) DEBUG("SFLphone: Error: Could not find conference"); - - calltree_add_conference(history, conf); + else + calltree_add_conference_to_history(conf); } } @@ -1188,10 +1187,10 @@ void sflphone_save_history(void) GHashTable *result = g_hash_table_new_full(NULL, g_str_equal, g_free, hist_free_elt); - gint size = calllist_get_size(history); + gint size = calllist_get_size(history_tab); for (gint i = 0; i < size; i++) { - current = calllist_get_nth(history, i); + current = calllist_get_nth(history_tab, i); if (!current) { WARN("SFLphone: Warning: %dth element is null", i); @@ -1215,10 +1214,10 @@ void sflphone_save_history(void) g_slist_append(g_hash_table_lookup(result, key),(gpointer) value)); } - size = conferencelist_get_size(history); + size = conferencelist_get_size(history_tab); for (gint i = 0; i < size; i++) { - conf = conferencelist_get_nth(history, i); + conf = conferencelist_get_nth(history_tab, i); if (!conf) { DEBUG("SFLphone: Error: Could not get %dth conference", i); @@ -1243,7 +1242,7 @@ sflphone_srtp_sdes_on(callable_obj_t * c) { c->_srtp_state = SRTP_STATE_SDES_SUCCESS; - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); update_actions(); } @@ -1252,7 +1251,7 @@ sflphone_srtp_sdes_off(callable_obj_t * c) { c->_srtp_state = SRTP_STATE_UNLOCKED; - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); update_actions(); } @@ -1262,7 +1261,7 @@ sflphone_srtp_zrtp_on(callable_obj_t * c) { c->_srtp_state = SRTP_STATE_ZRTP_SAS_UNCONFIRMED; - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); update_actions(); } @@ -1270,7 +1269,7 @@ void sflphone_srtp_zrtp_off(callable_obj_t * c) { c->_srtp_state = SRTP_STATE_UNLOCKED; - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); update_actions(); } @@ -1280,14 +1279,14 @@ sflphone_srtp_zrtp_show_sas(callable_obj_t * c, const gchar* sas, const gboolean c->_sas = g_strdup(sas); c->_srtp_state = verified ? SRTP_STATE_ZRTP_SAS_CONFIRMED : SRTP_STATE_ZRTP_SAS_UNCONFIRMED; - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); update_actions(); } void sflphone_request_go_clear(void) { - callable_obj_t * selectedCall = calltab_get_selected_call(current_calls); + callable_obj_t * selectedCall = calltab_get_selected_call(current_calls_tab); if (selectedCall) dbus_request_go_clear(selectedCall); @@ -1307,7 +1306,7 @@ sflphone_call_state_changed(callable_obj_t * c, const gchar * description, const c->_state_code_description = g_strdup(description); c->_state_code = code; - calltree_update_call(current_calls, c, NULL); + calltree_update_call(current_calls_tab, c); update_actions(); } diff --git a/gnome/src/callable_obj.c b/gnome/src/callable_obj.c index 4c0724bc16b8330a7a49be3547ab834db785da32..d6e3771c481417289596e30dca8bb3b2c77eba3d 100644 --- a/gnome/src/callable_obj.c +++ b/gnome/src/callable_obj.c @@ -289,16 +289,15 @@ gchar* serialize_history_call_entry(callable_obj_t *entry) // "0|514-276-5468|Savoir-faire Linux|144562458" for instance gchar *peer_number, *peer_name, *account_id; static const gchar * const separator = "|"; - gchar *time_start, *time_stop ; gchar *record_file; - gchar *confID , *time_added; + gchar *confID; // Need the string form for the history state const gchar *history_state = get_history_id_from_state(entry->_history_state); // and the timestamps - time_start = g_strdup_printf("%i", (int) entry->_time_start); - time_stop = g_strdup_printf("%i", (int) entry->_time_stop); - time_added = g_strdup_printf("%i", (int) entry->_time_added); + gchar *time_start = g_strdup_printf("%i", (int) entry->_time_start); + gchar *time_stop = g_strdup_printf("%i", (int) entry->_time_stop); + gchar *time_added = g_strdup_printf("%i", (int) entry->_time_added); peer_number = entry->_peer_number ? entry->_peer_number : ""; peer_name = (entry->_peer_name && *entry->_peer_name) ? entry->_peer_name : "empty"; @@ -308,7 +307,7 @@ gchar* serialize_history_call_entry(callable_obj_t *entry) record_file = entry->_recordfile ? entry->_recordfile : ""; gchar *result = g_strconcat(history_state, separator, - entry->_peer_number, separator, + peer_number, separator, peer_name, separator, time_start, separator, time_stop, separator, diff --git a/gnome/src/conference_obj.c b/gnome/src/conference_obj.c index ab11c83c97adc9f2626d28eacbcde369bac04aaf..a755d6d80efb0bd6d668cfcaf4120bff0b44f05d 100644 --- a/gnome/src/conference_obj.c +++ b/gnome/src/conference_obj.c @@ -110,7 +110,7 @@ void free_conference_obj_t (conference_obj_t *c) static void conference_add_participant_number(const gchar *call_id, conference_obj_t *conf) { - callable_obj_t *call = calllist_get_call(current_calls, call_id); + callable_obj_t *call = calllist_get_call(current_calls_tab, call_id); if (!call) { ERROR("Conference: Error: Could not find %s", call_id); @@ -156,7 +156,7 @@ void conference_participant_list_update(gchar** participants, conference_obj_t* for (gchar **part = participants; part && *part; part++) { gchar *call_id = (gchar *)(*part); - callable_obj_t *call = calllist_get_call(current_calls, call_id); + callable_obj_t *call = calllist_get_call(current_calls_tab, call_id); if (call->_confID != NULL) { g_free(call->_confID); @@ -171,7 +171,7 @@ void conference_participant_list_update(gchar** participants, conference_obj_t* for (gchar **part = participants; part && *part; part++) { gchar *call_id = (gchar*)(*part); - callable_obj_t *call = calllist_get_call(current_calls, call_id); + callable_obj_t *call = calllist_get_call(current_calls_tab, call_id); call->_confID = g_strdup(conf->_confID); conference_add_participant(call_id, conf); } @@ -179,48 +179,44 @@ void conference_participant_list_update(gchar** participants, conference_obj_t* gchar *serialize_history_conference_entry(conference_obj_t *entry) { - gchar *result = ""; - static const gchar * const separator = "|"; - gchar *time_start = ""; - gchar *time_stop = ""; - gchar *peer_name = ""; - gchar *participantstr = ""; - gchar *confID = ""; - GSList *participant_list; - gint length = 0; - gint i; - - confID = entry->_confID; + gchar *confID = entry->_confID; - time_start = g_strdup_printf("%i", (int) entry->_time_start); - time_stop = g_strdup_printf("%i", (int) entry->_time_stop); + gchar *time_start = g_strdup_printf("%i", (int) entry->_time_start); + gchar *time_stop = g_strdup_printf("%i", (int) entry->_time_stop); - peer_name = (entry->_confID == NULL || (strlen(entry->_confID) == 0)) ? "empty": entry->_confID; + gchar *peer_name = (entry->_confID == NULL || (strlen(entry->_confID) == 0)) ? "empty": entry->_confID; - length = g_slist_length(entry->participant_list); - participant_list = entry->participant_list; + gint length = g_slist_length(entry->participant_list); + GSList *participant_list = entry->participant_list; - for (i = 0; i < length; i++) { + gchar *participantstr = NULL; + for (gint i = 0; i < length; ++i) { const gchar * const tmp = g_slist_nth_data(participant_list, i); if (!tmp) WARN("Conference: Peer number is NULL in conference list"); - - participantstr = g_strconcat(participantstr, tmp, ";", NULL); + + gchar *old = participantstr; + participantstr = g_strconcat(old, tmp, ";", NULL); + g_free(old); DEBUG("Conference: Participant number: %s, concatenation: %s", tmp, participantstr); } - result = g_strconcat("9999", separator, - participantstr, separator, // peer number - peer_name, separator, - time_start, separator, - time_stop, separator, - confID, separator, - "empty", separator, // peer AccountID - entry->_recordfile ? entry->_recordfile : "", separator, - "empty", separator, - "empty", NULL); + static const gchar * const separator = "|"; + gchar *result = g_strconcat("9999", separator, + participantstr, separator, // peer number + peer_name, separator, + time_start, separator, + time_stop, separator, + confID, separator, + "empty", separator, // peer AccountID + entry->_recordfile ? entry->_recordfile : "", separator, + "empty", separator, + "empty", NULL); + g_free(participantstr); + g_free(time_stop); + g_free(time_start); return result; } diff --git a/gnome/src/conference_obj.h b/gnome/src/conference_obj.h index 3637999bd742b5666aaf913016525a27452c503e..9e6eaefd4303077ab4373eb288f85510e2481905 100644 --- a/gnome/src/conference_obj.h +++ b/gnome/src/conference_obj.h @@ -63,7 +63,6 @@ typedef struct { GtkWidget *_im_widget; // associated instant messaging widget time_t _time_start; time_t _time_stop; - time_t _time_current; gchar *_recordfile; gboolean _record_is_playing; } conference_obj_t; diff --git a/gnome/src/contacts/addrbookfactory.c b/gnome/src/contacts/addrbookfactory.c index ae0b42830a7589541c0904464659d6d55d6398e3..3db2562ffcbaa58fe557f69a28c800107b780d47 100644 --- a/gnome/src/contacts/addrbookfactory.c +++ b/gnome/src/contacts/addrbookfactory.c @@ -48,8 +48,8 @@ handler_async_search(GList *hits, gpointer user_data) { AddressBook_Config *addressbook_config = user_data; - gtk_tree_store_clear(contacts->store); - calllist_reset(contacts); + gtk_tree_store_clear(contacts_tab->store); + calllist_reset(contacts_tab); for (GList *i = hits; i != NULL; i = i->next) { GdkPixbuf *photo = NULL; @@ -85,7 +85,7 @@ handler_async_search(GList *hits, gpointer user_data) } g_list_free(hits); - gtk_widget_grab_focus(GTK_WIDGET(contacts->view)); + gtk_widget_grab_focus(GTK_WIDGET(contacts_tab->view)); } void abook_init() diff --git a/gnome/src/contacts/calllist.c b/gnome/src/contacts/calllist.c index 9d51ffa19d214ceb2ee3d985d09389ce0ceeec8d..76f74d61b68a2a63c0cefb436da6c8a2f495f70f 100644 --- a/gnome/src/contacts/calllist.c +++ b/gnome/src/contacts/calllist.c @@ -79,8 +79,8 @@ void calllist_add_contact(gchar *contact_name, gchar *contact_phone, contact_typ new_call->_contact_thumbnail = pixbuf; } - calllist_add_call(contacts, new_call); - calltree_add_call(contacts, new_call, NULL); + calllist_add_call(contacts_tab, new_call); + calltree_add_call(contacts_tab, new_call, NULL); } /* @@ -119,8 +119,8 @@ void calllist_add_history_call(callable_obj_t *obj) QueueElement *element = g_new0(QueueElement, 1); element->type = HIST_CALL; element->elem.call = obj; - g_queue_push_tail(history->callQueue, (gpointer) element); - calltree_add_call(history, obj, NULL); + g_queue_push_tail(history_tab->callQueue, (gpointer) element); + calltree_add_history_entry(obj, NULL); } } @@ -130,8 +130,8 @@ void calllist_add_history_conference(conference_obj_t *obj) QueueElement *element = g_new0(QueueElement, 1); element->type = HIST_CONFERENCE; element->elem.conf = obj; - g_queue_push_tail(history->callQueue, (gpointer) element); - calltree_add_conference(history, obj); + g_queue_push_tail(history_tab->callQueue, (gpointer) element); + calltree_add_conference_to_history(obj); } } @@ -147,25 +147,25 @@ calllist_add_call(calltab_t* tab, callable_obj_t * c) void calllist_clean_history(void) { - guint size = calllist_get_size(history); + guint size = calllist_get_size(history_tab); for (guint i = 0; i < size; i++) { - QueueElement* c = calllist_get_nth(history, i); + QueueElement* c = calllist_get_nth(history_tab, i); if (c->type == HIST_CALL) - calltree_remove_call(history, c->elem.call); + calltree_remove_call(history_tab, c->elem.call); else if (c->type == HIST_CONFERENCE) - calltree_remove_conference(history, c->elem.conf); + calltree_remove_conference(history_tab, c->elem.conf); } - calllist_reset(history); + calllist_reset(history_tab); } void calllist_remove_from_history(callable_obj_t* c) { - calllist_remove_call(history, c->_callID); - calltree_remove_call(history, c); + calllist_remove_call(history_tab, c->_callID); + calltree_remove_call(history_tab, c); } void @@ -185,8 +185,8 @@ calllist_remove_call(calltab_t* tab, const gchar * callID) g_queue_remove(tab->callQueue, element); - calllist_add_call(history, element->elem.call); - calltree_add_call(history, element->elem.call, NULL); + calllist_add_call(history_tab, element->elem.call); + calltree_add_history_entry(element->elem.call, NULL); } diff --git a/gnome/src/contacts/calltab.h b/gnome/src/contacts/calltab.h index 34ba8d3db9f905d437257ba1975ae5dccb677f88..4b2edca9c8c0f8d97798088cfd51d7e233f4c338 100644 --- a/gnome/src/contacts/calltab.h +++ b/gnome/src/contacts/calltab.h @@ -35,10 +35,10 @@ #include "conferencelist.h" #include <gtk/gtk.h> -calltab_t* active_calltree; -calltab_t* current_calls; -calltab_t* history; -calltab_t* contacts; +calltab_t* active_calltree_tab; +calltab_t* current_calls_tab; +calltab_t* history_tab; +calltab_t* contacts_tab; calltab_t* calltab_init (gboolean, const gchar * const); diff --git a/gnome/src/contacts/calltree.c b/gnome/src/contacts/calltree.c index fcf6452b793fb0127105814f28f6eb36d2ff02e6..ba29af85b3e8a95066633846fbbc274fabd4b03e 100644 --- a/gnome/src/contacts/calltree.c +++ b/gnome/src/contacts/calltree.c @@ -63,11 +63,10 @@ static GtkWidget *calltree_menu_items = NULL; static CallType calltree_dragged_type = A_INVALID; static CallType calltree_selected_type = A_INVALID; -static gchar *calltree_dragged_call_id = NULL; -static gchar *calltree_selected_call_id; - -static gchar *calltree_dragged_path = NULL; -static gchar *calltree_selected_path = NULL; +static const gchar *calltree_dragged_call_id = NULL; +static const gchar *calltree_selected_call_id = NULL; +static const gchar *calltree_dragged_path = NULL; +static const gchar *calltree_selected_path = NULL; static gint calltree_dragged_path_depth = -1; static gint calltree_selected_path_depth = -1; @@ -78,8 +77,6 @@ static callable_obj_t *calltree_selected_call = NULL; static conference_obj_t *calltree_dragged_conf = NULL; static conference_obj_t *calltree_selected_conf = NULL; -static void calltree_add_history_conference(conference_obj_t *); - static void drag_end_cb(GtkWidget *, GdkDragContext *, gpointer); static void drag_data_received_cb(GtkWidget *, GdkDragContext *, gint, gint, GtkSelectionData *, guint, guint, gpointer); static void drag_history_received_cb(GtkWidget *, GdkDragContext *, gint, gint, GtkSelectionData *, guint, guint, gpointer); @@ -109,16 +106,16 @@ static void call_selected_cb(GtkTreeSelection *sel, void* data UNUSED) { DEBUG("CallTree: Selection callback"); - GtkTreeModel *model = GTK_TREE_MODEL(active_calltree->store); + GtkTreeModel *model = GTK_TREE_MODEL(active_calltree_tab->store); GtkTreeIter iter; if (!gtk_tree_selection_get_selected(sel, &model, &iter)) return; - if (active_calltree == history) + if (active_calltree_tab == history_tab) DEBUG("CallTree: Current call tree is history"); - else if (active_calltree == current_calls) + else if (active_calltree_tab == current_calls_tab) DEBUG("CallTree: Current call tree is current calls"); // store info for dragndrop @@ -138,7 +135,7 @@ call_selected_cb(GtkTreeSelection *sel, void* data UNUSED) g_value_unset(&val); if (calltree_selected_conf) { - calltab_select_conf(active_calltree, calltree_selected_conf); + calltab_select_conf(active_calltree_tab, calltree_selected_conf); calltree_selected_call_id = calltree_selected_conf->_confID; calltree_selected_path = string_path; calltree_selected_call = NULL; @@ -161,7 +158,7 @@ call_selected_cb(GtkTreeSelection *sel, void* data UNUSED) g_value_unset(&val); if (calltree_selected_call) { - calltab_select_call(active_calltree, calltree_selected_call); + calltab_select_call(active_calltree_tab, calltree_selected_call); calltree_selected_call_id = calltree_selected_call->_callID; calltree_selected_path = string_path; calltree_selected_conf = NULL; @@ -186,13 +183,13 @@ row_activated(GtkTreeView *tree_view UNUSED, { DEBUG("CallTree: Double click action"); - if (calltab_get_selected_type(active_calltree) == A_CALL) { + if (calltab_get_selected_type(active_calltree_tab) == A_CALL) { DEBUG("CallTree: Selected a call"); - callable_obj_t *selectedCall = calltab_get_selected_call(active_calltree); + callable_obj_t *selectedCall = calltab_get_selected_call(active_calltree_tab); if (selectedCall) { // Get the right event from the right calltree - if (active_calltree == current_calls) { + if (active_calltree_tab == current_calls_tab) { switch (selectedCall->_state) { case CALL_STATE_INCOMING: dbus_accept(selectedCall); @@ -216,18 +213,18 @@ row_activated(GtkTreeView *tree_view UNUSED, // If history or contact: double click action places a new call callable_obj_t* new_call = create_new_call(CALL, CALL_STATE_DIALING, "", selectedCall->_accountID, selectedCall->_peer_name, selectedCall->_peer_number); - calllist_add_call(current_calls, new_call); - calltree_add_call(current_calls, new_call, NULL); + calllist_add_call(current_calls_tab, new_call); + calltree_add_call(current_calls_tab, new_call, NULL); // Function sflphone_place_call (new_call) is processed in process_dialing sflphone_place_call(new_call); - calltree_display(current_calls); + calltree_display(current_calls_tab); } } - } else if (calltab_get_selected_type(active_calltree) == A_CONFERENCE) { + } else if (calltab_get_selected_type(active_calltree_tab) == A_CONFERENCE) { DEBUG("CallTree: Selected a conference"); - if (active_calltree == current_calls) { - conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls); + if (active_calltree_tab == current_calls_tab) { + conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls_tab); if (selectedConf) { @@ -246,8 +243,8 @@ row_activated(GtkTreeView *tree_view UNUSED, break; } } - } else if (active_calltree == history) { - conference_obj_t* selectedConf = calltab_get_selected_conf(history); + } else if (active_calltree_tab == history_tab) { + conference_obj_t* selectedConf = calltab_get_selected_conf(history_tab); if (selectedConf == NULL) { ERROR("CallTree: Error: Could not get selected conference from history"); @@ -255,7 +252,7 @@ row_activated(GtkTreeView *tree_view UNUSED, } calltree_create_conf_from_participant_list(selectedConf->participant_list); - calltree_display(current_calls); + calltree_display(current_calls_tab); } } } @@ -265,31 +262,26 @@ calltree_create_conf_from_participant_list(GSList *list) { gint list_length = g_slist_length(list); - DEBUG("CallTree: Create conference from participant list"); - - gchar **participant_list = (void *) malloc(sizeof(void*)); - - // concatenate - gint i, c; + /* create an array of gchar pointers */ + gchar *participant_list[list_length + 1]; - for (i = 0, c = 0; i < list_length; i++, c++) { - gchar *number; + /* build the list up */ + for (gint i = 0; i < list_length; ++i) { gchar *participant_id = g_slist_nth_data(list, i); - callable_obj_t *call = calllist_get_call(history, participant_id); + callable_obj_t *call = calllist_get_call(history_tab, participant_id); - if (c != 0) - participant_list = (void *) realloc(participant_list, (c + 1) * sizeof(void *)); - - // allocate memory for the participant number - number = g_strconcat(call->_peer_number, ",", call->_accountID, NULL); - - *(participant_list + c) = number; + /* allocate memory for the participant number */ + participant_list[i] = g_strconcat(call->_peer_number, ",", + call->_accountID, NULL); } - - participant_list = (void *) realloc(participant_list, (c + 1) * sizeof(void*)); - *(participant_list + c) = NULL; + /* NULL terminate it */ + participant_list[list_length] = NULL; dbus_create_conf_from_participant_list((const gchar **)participant_list); + /* free it, note we can't do this with g_strfreev since the array itself + * was created on the stack */ + for (gint i = 0; i < list_length; ++i) + g_free(participant_list[i]); } /* Catch cursor-activated signal. That is, when the entry is single clicked */ @@ -300,15 +292,15 @@ row_single_click(GtkTreeView *tree_view UNUSED, void * data UNUSED) DEBUG("CallTree: Single click action"); - callable_obj_t *selectedCall = calltab_get_selected_call(active_calltree); - conference_obj_t *selectedConf = calltab_get_selected_conf(active_calltree); + callable_obj_t *selectedCall = calltab_get_selected_call(active_calltree_tab); + conference_obj_t *selectedConf = calltab_get_selected_conf(active_calltree_tab); - if (active_calltree == current_calls) + if (active_calltree_tab == current_calls_tab) DEBUG("CallTree: Active calltree is current_calls"); - else if (active_calltree == history) + else if (active_calltree_tab == history_tab) DEBUG("CallTree: Active calltree is history"); - if (calltab_get_selected_type(active_calltree) == A_CALL) { + if (calltab_get_selected_type(active_calltree_tab) == A_CALL) { DEBUG("CallTree: Selected a call"); if (selectedCall) { @@ -330,7 +322,7 @@ row_single_click(GtkTreeView *tree_view UNUSED, void * data UNUSED) /* Make sure that we are not in the history tab since * nothing is defined for it yet */ - if (active_calltree == current_calls) { + if (active_calltree_tab == current_calls_tab) { switch (selectedCall->_srtp_state) { case SRTP_STATE_ZRTP_SAS_UNCONFIRMED: selectedCall->_srtp_state = SRTP_STATE_ZRTP_SAS_CONFIRMED; @@ -339,12 +331,12 @@ row_single_click(GtkTreeView *tree_view UNUSED, void * data UNUSED) selectedCall->_zrtp_confirmed = TRUE; dbus_confirm_sas(selectedCall); - calltree_update_call(current_calls, selectedCall, NULL); + calltree_update_call(current_calls_tab, selectedCall); 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); + calltree_update_call(current_calls_tab, selectedCall); break; default: DEBUG("Single click but no action"); @@ -352,13 +344,12 @@ row_single_click(GtkTreeView *tree_view UNUSED, void * data UNUSED) } } } - } else if (calltab_get_selected_type(active_calltree) == A_CONFERENCE) { + } else if (calltab_get_selected_type(active_calltree_tab) == A_CONFERENCE) { DEBUG("CallTree: Selected a conference"); - if (selectedConf) DEBUG("CallTree: There is actually a selected conf"); } else - WARN("CallTree: Warning: Unknow selection type"); + WARN("CallTree: Warning: Unknown selection type"); } static gboolean @@ -367,10 +358,10 @@ button_pressed(GtkWidget* widget, GdkEventButton *event, gpointer user_data UNUS if (event->button != 3 || event->type != GDK_BUTTON_PRESS) return FALSE; - if (active_calltree == current_calls) - show_popup_menu(widget, event); - else if (active_calltree == history) - show_popup_menu_history(widget, event); + if (active_calltree_tab == current_calls_tab) + show_popup_menu(widget, event); + else if (active_calltree_tab == history_tab) + show_popup_menu_history(widget, event); else show_popup_menu_contacts(widget, event); @@ -409,10 +400,8 @@ calltree_display_call_info(callable_obj_t * c, CallDisplayType display_type, con switch (display_type) { case DISPLAY_TYPE_CALL: - if (c->_state_code) suffix = g_markup_printf_escaped("\n<i>%s (%d)</i>", c->_state_code_description, c->_state_code); - break; case DISPLAY_TYPE_STATE_CODE : @@ -485,8 +474,7 @@ calltree_create(calltab_t* tab, int searchbar_type) G_CALLBACK(button_pressed), NULL); - if (tab != history && tab != contacts) { - + if (tab != history_tab && tab != contacts_tab) { // Make calltree reordable for drag n drop gtk_tree_view_set_reorderable(GTK_TREE_VIEW(tab->view), TRUE); @@ -509,7 +497,7 @@ calltree_create(calltab_t* tab, int searchbar_type) G_CALLBACK(menuitem_response), (gpointer) g_strdup(SFL_CREATE_CONFERENCE)); gtk_menu_shell_append(GTK_MENU_SHELL(calltree_popupmenu), calltree_menu_items); gtk_widget_show(calltree_menu_items); - } else if (tab == history) { + } else if (tab == history_tab) { gtk_tree_view_set_show_expanders(GTK_TREE_VIEW(tab->view), TRUE); g_signal_connect(G_OBJECT(tab->view), "drag_data_received", G_CALLBACK(drag_history_received_cb), NULL); } @@ -613,8 +601,8 @@ calltree_remove_call(calltab_t* tab, callable_obj_t * c) calltree_remove_call_recursive(tab, c, NULL); } -void -calltree_update_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) +static void +calltree_update_call_recursive(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) { GdkPixbuf *pixbuf = NULL; GdkPixbuf *pixbuf_security = NULL; @@ -627,7 +615,6 @@ calltree_update_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) account_t* account_details=NULL; int nbChild = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), parent); - int i; if (c) { account_details = account_list_get_by_id(c->_accountID); @@ -649,12 +636,12 @@ calltree_update_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) } } - for (i = 0; i < nbChild; i++) { + for (gint i = 0; i < nbChild; i++) { if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, parent, i)) { if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(store), &iter)) - calltree_update_call(tab, c, &iter); + calltree_update_call_recursive(tab, c, &iter); val.g_type = 0; gtk_tree_model_get_value(GTK_TREE_MODEL(store), &iter, COLUMN_ACCOUNT_PTR, &val); @@ -671,17 +658,16 @@ calltree_update_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) if (c->_state == CALL_STATE_TRANSFER) description = calltree_display_call_info(c, DISPLAY_TYPE_CALL_TRANSFER, ""); - else { + else if (c->_sas && display_sas && c->_srtp_state == SRTP_STATE_ZRTP_SAS_UNCONFIRMED && !c->_zrtp_confirmed) description = calltree_display_call_info(c, DISPLAY_TYPE_SAS, ""); else description = calltree_display_call_info(c, DISPLAY_TYPE_STATE_CODE, audio_codec); - } g_free(audio_codec); /* Update icons */ - if (tab == current_calls) { + if (tab == current_calls_tab) { DEBUG("Receiving in state %d", c->_state); switch (c->_state) { @@ -716,41 +702,30 @@ calltree_update_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) switch (c->_srtp_state) { case SRTP_STATE_SDES_SUCCESS: - DEBUG("SDES negotiation succes"); pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_confirmed.svg", NULL); break; case SRTP_STATE_ZRTP_SAS_UNCONFIRMED: - DEBUG("Secure is ON"); pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_unconfirmed.svg", NULL); - - if (c->_sas != NULL) { + if (c->_sas != NULL) DEBUG("SAS is ready with value %s", c->_sas); - } - break; case SRTP_STATE_ZRTP_SAS_CONFIRMED: - DEBUG("SAS is confirmed"); pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_confirmed.svg", NULL); break; case SRTP_STATE_ZRTP_SAS_SIGNED: - DEBUG("Secure is ON with SAS signed and verified"); pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_certified.svg", NULL); break; case SRTP_STATE_UNLOCKED: - DEBUG("Secure is off calltree %d", c->_state); - if (g_strcasecmp(srtp_enabled,"true") == 0) pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_off.svg", NULL); - break; default: WARN("Update calltree srtp state #%d- Should not happen!", c->_srtp_state); - if (g_strcasecmp(srtp_enabled, "true") == 0) pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_off.svg", NULL); } - } else if (tab == history) { + } else if (tab == history_tab) { if (parent == NULL) { // parent is NULL this is not a conference participant switch (c->_history_state) { @@ -769,9 +744,7 @@ calltree_update_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) } else // parent is not NULL this is a conference participant pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/current.svg", NULL); - gchar *old_description = description; - g_free(old_description); - + g_free(description); description = calltree_display_call_info(c, DISPLAY_TYPE_HISTORY, ""); gchar * date = get_formatted_start_timestamp(c->_time_start); gchar *duration = get_call_duration(c); @@ -779,7 +752,7 @@ calltree_update_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) g_free(date); g_free(duration); - old_description = description; + gchar *old_description = description; description = g_strconcat(old_description , full_duration, NULL); g_free(full_duration); g_free(old_description); @@ -796,19 +769,22 @@ calltree_update_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); + if (pixbuf_security != NULL) + g_object_unref(G_OBJECT(pixbuf_security)); } } update_actions(); } +void calltree_update_call(calltab_t* tab, callable_obj_t * c) +{ + return calltree_update_call_recursive(tab, c, NULL); +} void calltree_add_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) { - if (tab == history) { - calltree_add_history_entry(c, parent); - return; - } + g_assert(tab != history_tab); account_t* account_details = NULL; @@ -835,7 +811,7 @@ void calltree_add_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) DEBUG("Added call key exchange is %s", key_exchange); - if (tab == current_calls) { + if (tab == current_calls_tab) { switch (c->_state) { case CALL_STATE_INCOMING: pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/ring.svg", NULL); @@ -868,26 +844,23 @@ void calltree_add_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) if (srtp_enabled && g_strcasecmp(srtp_enabled, "true") == 0) pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/secure_off.svg", NULL); - } else if (tab == contacts) { + } else if (tab == contacts_tab) pixbuf = c->_contact_thumbnail; - } else { + else WARN("CallTree: This widget doesn't exist - This is a bug in the application."); - } //Resize it - if (pixbuf) - if (gdk_pixbuf_get_width(pixbuf) > 32 || gdk_pixbuf_get_height(pixbuf) > 32) { - GdkPixbuf *new = gdk_pixbuf_scale_simple(pixbuf, 32, 32, GDK_INTERP_BILINEAR); - g_object_unref(pixbuf); - pixbuf = new; - } + if (pixbuf && (gdk_pixbuf_get_width(pixbuf) > 32 || gdk_pixbuf_get_height(pixbuf) > 32)) { + GdkPixbuf *new = gdk_pixbuf_scale_simple(pixbuf, 32, 32, GDK_INTERP_BILINEAR); + g_object_unref(pixbuf); + pixbuf = new; + } - if (pixbuf_security) - if (gdk_pixbuf_get_width(pixbuf_security) > 32 || gdk_pixbuf_get_height(pixbuf_security) > 32) { - GdkPixbuf *new = gdk_pixbuf_scale_simple(pixbuf_security, 32, 32, GDK_INTERP_BILINEAR); - g_object_unref(pixbuf_security); - pixbuf_security = new; - } + if (pixbuf_security && (gdk_pixbuf_get_width(pixbuf_security) > 32 || gdk_pixbuf_get_height(pixbuf_security) > 32)) { + GdkPixbuf *new = gdk_pixbuf_scale_simple(pixbuf_security, 32, 32, GDK_INTERP_BILINEAR); + g_object_unref(pixbuf_security); + pixbuf_security = new; + } gtk_tree_store_set(tab->store, &iter, COLUMN_ACCOUNT_PIXBUF, pixbuf, @@ -904,11 +877,9 @@ void calltree_add_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) if (pixbuf_security != NULL) g_object_unref(G_OBJECT(pixbuf)); - gtk_tree_view_set_model(GTK_TREE_VIEW(history->view), GTK_TREE_MODEL(history->store)); + gtk_tree_view_set_model(GTK_TREE_VIEW(history_tab->view), GTK_TREE_MODEL(history_tab->store)); gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(tab->view)), &iter); - - //history_init(); } void calltree_add_history_entry(callable_obj_t *c, GtkTreeIter *parent) @@ -924,12 +895,12 @@ void calltree_add_history_entry(callable_obj_t *c, GtkTreeIter *parent) gchar * description = calltree_display_call_info(c, DISPLAY_TYPE_HISTORY, ""); - gtk_tree_store_prepend(history->store, &iter, parent); + gtk_tree_store_prepend(history_tab->store, &iter, parent); GdkPixbuf *pixbuf = NULL; if (parent == NULL) { - // this is a first level call not participating to a conference + DEBUG("CallTree: This is a first level call not participating in a conference"); switch (c->_history_state) { case INCOMING: pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/incoming.svg", NULL); @@ -948,22 +919,21 @@ void calltree_add_history_entry(callable_obj_t *c, GtkTreeIter *parent) date = get_formatted_start_timestamp(c->_time_start); duration = get_call_duration(c); - gchar * full_duration = g_strconcat(date , duration , NULL); + gchar * full_duration = g_strconcat(date, duration, NULL); g_free(date); g_free(duration); - gchar * full_description = g_strconcat(description , full_duration, NULL); + gchar * full_description = g_strconcat(description, full_duration, NULL); g_free(description); g_free(full_duration); //Resize it - if (pixbuf) - if (gdk_pixbuf_get_width(pixbuf) > 32 || gdk_pixbuf_get_height(pixbuf) > 32) { - GdkPixbuf *new = gdk_pixbuf_scale_simple(pixbuf, 32, 32, GDK_INTERP_BILINEAR); - g_object_unref(pixbuf); - pixbuf = new; - } + if (pixbuf && (gdk_pixbuf_get_width(pixbuf) > 32 || gdk_pixbuf_get_height(pixbuf) > 32)) { + GdkPixbuf *new = gdk_pixbuf_scale_simple(pixbuf, 32, 32, GDK_INTERP_BILINEAR); + g_object_unref(pixbuf); + pixbuf = new; + } - gtk_tree_store_set(history->store, &iter, + gtk_tree_store_set(history_tab->store, &iter, COLUMN_ACCOUNT_PIXBUF, pixbuf, COLUMN_ACCOUNT_DESC, full_description, COLUMN_ACCOUNT_SECURITY_PIXBUF, NULL, @@ -975,13 +945,13 @@ void calltree_add_history_entry(callable_obj_t *c, GtkTreeIter *parent) if (pixbuf != NULL) g_object_unref(G_OBJECT(pixbuf)); - gtk_tree_view_set_model(GTK_TREE_VIEW(history->view), GTK_TREE_MODEL(history->store)); + gtk_tree_view_set_model(GTK_TREE_VIEW(history_tab->view), GTK_TREE_MODEL(history_tab->store)); history_search(); } -void calltree_add_conference(calltab_t* tab, conference_obj_t* conf) +void calltree_add_conference_to_current_calls(conference_obj_t* conf) { account_t *account_details = NULL; @@ -992,39 +962,31 @@ void calltree_add_conference(calltab_t* tab, conference_obj_t* conf) DEBUG("Calltree: Add conference %s", conf->_confID); - if (tab == history) { - calltree_add_history_conference(conf); - return; - } - gchar *description = g_markup_printf_escaped("<b>%s</b>", ""); GtkTreeIter iter; - gtk_tree_store_append(tab->store, &iter, NULL); + gtk_tree_store_append(current_calls_tab->store, &iter, NULL); GdkPixbuf *pixbuf = NULL; - if (tab == current_calls) { - switch (conf->_state) { - case CONFERENCE_STATE_ACTIVE_ATTACHED: - pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersAttached.svg", NULL); - break; - case CONFERENCE_STATE_ACTIVE_DETACHED: - case CONFERENCE_STATE_HOLD: - case CONFERENCE_STATE_HOLD_RECORD: - pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersDetached.svg", NULL); - break; - case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD: - pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersAttachedRec.svg", NULL); - break; - case CONFERENCE_STATE_ACTIVE_DETACHED_RECORD: - pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersDetachedRec.svg", NULL); - break; - default: - WARN("Update conference add - Should not happen!"); - } - } else if (tab == history) - pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersAttached.svg", NULL); + switch (conf->_state) { + case CONFERENCE_STATE_ACTIVE_ATTACHED: + pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersAttached.svg", NULL); + break; + case CONFERENCE_STATE_ACTIVE_DETACHED: + case CONFERENCE_STATE_HOLD: + case CONFERENCE_STATE_HOLD_RECORD: + pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersDetached.svg", NULL); + break; + case CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD: + pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersAttachedRec.svg", NULL); + break; + case CONFERENCE_STATE_ACTIVE_DETACHED_RECORD: + pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/usersDetachedRec.svg", NULL); + break; + default: + WARN("Update conference add - Should not happen!"); + } //Resize it if (pixbuf) { @@ -1038,84 +1000,73 @@ void calltree_add_conference(calltab_t* tab, conference_obj_t* conf) GdkPixbuf *pixbuf_security = NULL; - if (tab == current_calls) { + // Used to determine if at least one participant use a security feature + // If true (at least on call use a security feature) we need to display security icons + conf->_conf_srtp_enabled = FALSE; - // Used to determine if at least one participant use a security feature - // If true (at least on call use a security feature) we need to display security icons - conf->_conf_srtp_enabled = FALSE; + // Used to determine if the conference is secured + // Every participant to a conference must be secured, the conference is not secured elsewhere + conf->_conference_secured = TRUE; - // Used to determine if the conference is secured - // Every participant to a conference must be secured, the conference is not secured elsewhere - conf->_conference_secured = TRUE; + if (conf->participant_list) { + DEBUG("Calltree: Determine if at least one participant uses SRTP"); - GSList *conference_participant = conf->participant_list; + for (GSList *part = conf->participant_list; part; part = conference_next_participant(part)) { + const gchar * const call_id = part->data; + callable_obj_t *call = calllist_get_call(current_calls_tab, call_id); - if (conference_participant) { - DEBUG("Calltree: Determine if at least one participant uses SRTP"); + if (call == NULL) + ERROR("Calltree: Error: Could not find call %s in call list", call_id); + else { + account_details = account_list_get_by_id(call->_accountID); + gchar *srtp_enabled = ""; - while (conference_participant) { - const gchar * const call_id = conference_participant->data; - callable_obj_t *call = calllist_get_call(tab, call_id); + if (!account_details) + ERROR("Calltree: Error: Could not find account %s in account list", call->_accountID); + else + srtp_enabled = g_hash_table_lookup(account_details->properties, ACCOUNT_SRTP_ENABLED); - if (call == NULL) - ERROR("Calltree: Error: Could not find call %s in call list", call_id); - else { - account_details = account_list_get_by_id(call->_accountID); - gchar *srtp_enabled = ""; + if (g_strcasecmp(srtp_enabled, "true") == 0) { + DEBUG("Calltree: SRTP enabled for participant %s", call_id); + conf->_conf_srtp_enabled = TRUE; + break; + } else + DEBUG("Calltree: SRTP is not enabled for participant %s", call_id); + } + } - if (!account_details) - ERROR("Calltree: Error: Could not find account %s in account list", call->_accountID); - else - srtp_enabled = g_hash_table_lookup(account_details->properties, ACCOUNT_SRTP_ENABLED); + DEBUG("Calltree: Determine if all conference participants are secured"); - if (g_strcasecmp(srtp_enabled, "true") == 0) { - DEBUG("Calltree: SRTP enabled for participant %s", call_id); - conf->_conf_srtp_enabled = TRUE; + if (conf->_conf_srtp_enabled) { + for (GSList *part = conf->participant_list; part; part = conference_next_participant(part)) { + const gchar * const call_id = part->data; + callable_obj_t *call = calllist_get_call(current_calls_tab, call_id); + + if (call) { + if (call->_srtp_state == SRTP_STATE_UNLOCKED) { + DEBUG("Calltree: Participant %s is not secured", call_id); + conf->_conference_secured = FALSE; break; } else - DEBUG("Calltree: SRTP is not enabled for participant %s", call_id); - } - - conference_participant = conference_next_participant(conference_participant); - } - - DEBUG("Calltree: Determine if all conference participants are secured"); - - if (conf->_conf_srtp_enabled) { - conference_participant = conf->participant_list; - - while (conference_participant) { - const gchar * const call_id = conference_participant->data; - callable_obj_t *call = calllist_get_call(tab, call_id); - - if (call) { - if (call->_srtp_state == SRTP_STATE_UNLOCKED) { - DEBUG("Calltree: Participant %s is not secured", call_id); - conf->_conference_secured = FALSE; - break; - } else - DEBUG("Calltree: Participant %s is secured", call_id); - } - - conference_participant = conference_next_participant(conference_participant); + DEBUG("Calltree: Participant %s is secured", call_id); } } } + } - if (conf->_conf_srtp_enabled) { - if (conf->_conference_secured) { - DEBUG("Calltree: Conference is secured"); - pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_confirmed.svg", NULL); - } else { - DEBUG("Calltree: Conference is not secured"); - pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_off.svg", NULL); - } + if (conf->_conf_srtp_enabled) { + if (conf->_conference_secured) { + DEBUG("Calltree: Conference is secured"); + pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_confirmed.svg", NULL); + } else { + DEBUG("Calltree: Conference is not secured"); + pixbuf_security = gdk_pixbuf_new_from_file(ICONS_DIR "/lock_off.svg", NULL); } } DEBUG("Calltree: Add conference to tree store"); - gtk_tree_store_set(tab->store, &iter, + gtk_tree_store_set(current_calls_tab->store, &iter, COLUMN_ACCOUNT_PIXBUF, pixbuf, COLUMN_ACCOUNT_DESC, description, COLUMN_ACCOUNT_SECURITY_PIXBUF, pixbuf_security, @@ -1128,23 +1079,21 @@ void calltree_add_conference(calltab_t* tab, conference_obj_t* conf) if (pixbuf_security) g_object_unref(pixbuf_security); - GSList *conference_participant = conf->participant_list; - - while (conference_participant) { - const gchar * const call_id = conference_participant->data; - callable_obj_t *call = calllist_get_call(tab, call_id); - calltree_remove_call(tab, call); - calltree_add_call(tab, call, &iter); + for (GSList *part = conf->participant_list; part; part = conference_next_participant(part)) { + const gchar * const call_id = part->data; + callable_obj_t *call = calllist_get_call(current_calls_tab, call_id); - conference_participant = conference_next_participant(conference_participant); + calltree_remove_call(current_calls_tab, call); + calltree_add_call(current_calls_tab, call, &iter); } - gtk_tree_view_set_model(GTK_TREE_VIEW(tab->view), GTK_TREE_MODEL(tab->store)); + gtk_tree_view_set_model(GTK_TREE_VIEW(current_calls_tab->view), + GTK_TREE_MODEL(current_calls_tab->store)); - GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(tab->store), &iter); + GtkTreePath *path = gtk_tree_model_get_path(GTK_TREE_MODEL(current_calls_tab->store), &iter); - gtk_tree_view_expand_row(GTK_TREE_VIEW(tab->view), path, FALSE); + gtk_tree_view_expand_row(GTK_TREE_VIEW(current_calls_tab->view), path, FALSE); update_actions(); } @@ -1188,7 +1137,7 @@ void calltree_remove_conference_recursive(calltab_t* tab, const conference_obj_t g_value_unset(&callval); // do not add back call in history calltree when cleaning it - if (call && tab != history) + if (call && tab != history_tab) calltree_add_call(tab, call, NULL); } } @@ -1212,7 +1161,7 @@ void calltree_remove_conference(calltab_t* tab, const conference_obj_t* conf) DEBUG("CallTree: Finished Removing conference"); } -void calltree_add_history_conference(conference_obj_t *conf) +void calltree_add_conference_to_history(conference_obj_t *conf) { if (!conf) ERROR("CallTree: Error conference is NULL"); @@ -1220,63 +1169,60 @@ void calltree_add_history_conference(conference_obj_t *conf) DEBUG("CallTree: Add conference %s to history", conf->_confID); GtkTreeIter iter; - gtk_tree_store_prepend(history->store, &iter, NULL); + gtk_tree_store_prepend(history_tab->store, &iter, NULL); GdkPixbuf *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) { - GdkPixbuf *new = gdk_pixbuf_scale_simple(pixbuf, 32, 32, GDK_INTERP_BILINEAR); - g_object_unref(pixbuf); - pixbuf = new; - } + if (pixbuf && (gdk_pixbuf_get_width(pixbuf) > 32 || gdk_pixbuf_get_height(pixbuf) > 32)) { + GdkPixbuf *new = gdk_pixbuf_scale_simple(pixbuf, 32, 32, GDK_INTERP_BILINEAR); + g_object_unref(pixbuf); + pixbuf = new; + } const gchar * const date = get_formatted_start_timestamp(conf->_time_start); + gchar *description = g_strconcat("Conference: \n", date, NULL); - const gchar *description = g_strconcat("Conference: \n", date, NULL); - - gtk_tree_store_set(history->store, &iter, COLUMN_ACCOUNT_PIXBUF, pixbuf, + gtk_tree_store_set(history_tab->store, &iter, + COLUMN_ACCOUNT_PIXBUF, pixbuf, COLUMN_ACCOUNT_DESC, description, COLUMN_ACCOUNT_SECURITY_PIXBUF, NULL, COLUMN_ACCOUNT_PTR, conf, -1); - GSList *conference_participant = conf->participant_list; + g_free(description); + if (pixbuf != NULL) + g_object_unref(G_OBJECT(pixbuf)); - while (conference_participant) { - const gchar * const call_id = conference_participant->data; - callable_obj_t *call = calllist_get_call(history, call_id); + for (GSList *part = conf->participant_list; part; + part = conference_next_participant(part)) { + const gchar * const call_id = part->data; + callable_obj_t *call = calllist_get_call(history_tab, call_id); if (call) calltree_add_history_entry(call, &iter); else ERROR("ConferenceList: Error: Could not find call \"%s\"", call_id); - - conference_participant = conference_next_participant(conference_participant); } - - if (pixbuf != NULL) - g_object_unref(G_OBJECT(pixbuf)); } void calltree_display(calltab_t *tab) { /* If we already are displaying the specified calltree */ - if (active_calltree == tab) + if (active_calltree_tab == tab) return; - if (tab == current_calls) { - if (active_calltree == contacts) + if (tab == current_calls_tab) { + if (active_calltree_tab == contacts_tab) gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(contactButton_), FALSE); else gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton_), FALSE); - } else if (tab == history) { - if (active_calltree == contacts) + } else if (tab == history_tab) { + if (active_calltree_tab == contacts_tab) gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(contactButton_), FALSE); gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton_), TRUE); - } else if (tab == contacts) { - if (active_calltree == history) + } else if (tab == contacts_tab) { + if (active_calltree_tab == history_tab) gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton_), FALSE); gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(contactButton_), TRUE); @@ -1284,11 +1230,11 @@ void calltree_display(calltab_t *tab) } else ERROR("CallTree: Error: Not a valid call tab (%d, %s)", __LINE__, __FILE__); - gtk_widget_hide(active_calltree->tree); - active_calltree = tab; - gtk_widget_show(active_calltree->tree); + gtk_widget_hide(active_calltree_tab->tree); + active_calltree_tab = tab; + gtk_widget_show(active_calltree_tab->tree); - GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(active_calltree->view)); + GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(active_calltree_tab->view)); DEBUG("CallTree: Emit signal changed from calltree_display"); g_signal_emit_by_name(sel, "changed"); update_actions(); @@ -1300,7 +1246,7 @@ gboolean calltree_update_clock(gpointer data UNUSED) char timestr[20]; const gchar *msg = ""; long duration; - callable_obj_t *c = calltab_get_selected_call(current_calls); + callable_obj_t *c = calltab_get_selected_call(current_calls_tab); if (c) switch (c->_state) { @@ -1329,7 +1275,7 @@ gboolean calltree_update_clock(gpointer data UNUSED) static void drag_end_cb(GtkWidget * widget UNUSED, GdkDragContext * context UNUSED, gpointer data UNUSED) { - if (active_calltree == history) + if (active_calltree_tab == history_tab) return; DEBUG("CallTree: Drag end callback"); @@ -1338,7 +1284,7 @@ static void drag_end_cb(GtkWidget * widget UNUSED, GdkDragContext * context UNUS DEBUG("CallTree: dragged path %s, dragged_call_id %s, dragged_path_depth %d", calltree_dragged_path, calltree_dragged_call_id, calltree_dragged_path_depth); - GtkTreeModel *model = (GtkTreeModel*) current_calls->store; + GtkTreeModel *model = (GtkTreeModel*) current_calls_tab->store; GtkTreePath *path = gtk_tree_path_new_from_string(calltree_dragged_path); GtkTreePath *dpath = gtk_tree_path_new_from_string(calltree_dragged_path); GtkTreePath *spath = gtk_tree_path_new_from_string(calltree_selected_path); @@ -1348,8 +1294,6 @@ static void drag_end_cb(GtkWidget * widget UNUSED, GdkDragContext * context UNUS GValue val; - conference_obj_t* conf; - // Make sure drag n drop does not imply a dialing call for either selected and dragged call if (calltree_selected_call && (calltree_selected_type == A_CALL)) { DEBUG("CallTree: Selected a call"); @@ -1362,8 +1306,8 @@ static void drag_end_cb(GtkWidget * widget UNUSED, GdkDragContext * context UNUS DEBUG("CallTree: Selected an invalid call"); - calltree_remove_call(current_calls, calltree_selected_call); - calltree_add_call(current_calls, calltree_selected_call, NULL); + calltree_remove_call(current_calls_tab, calltree_selected_call); + calltree_add_call(current_calls_tab, calltree_selected_call, NULL); calltree_dragged_call = NULL; return; @@ -1382,16 +1326,16 @@ static void drag_end_cb(GtkWidget * widget UNUSED, GdkDragContext * context UNUS DEBUG("CallTree: Dragged on an invalid call"); - calltree_remove_call(current_calls, calltree_selected_call); + calltree_remove_call(current_calls_tab, calltree_selected_call); if (calltree_selected_call->_confID) { gtk_tree_path_up(spath); gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &parent_conference, spath); - calltree_add_call(current_calls, calltree_selected_call, &parent_conference); + calltree_add_call(current_calls_tab, calltree_selected_call, &parent_conference); } else - calltree_add_call(current_calls, calltree_selected_call, NULL); + calltree_add_call(current_calls_tab, calltree_selected_call, NULL); calltree_dragged_call = NULL; return; @@ -1407,11 +1351,10 @@ static void drag_end_cb(GtkWidget * widget UNUSED, GdkDragContext * context UNUS if (!calltree_dragged_conf && (calltree_dragged_type == A_CALL)) { DEBUG("CallTree: Dragged on a call"); + conference_obj_t* conf = calltree_selected_conf; - conf = calltree_selected_conf; - - calltree_remove_conference(current_calls, conf); - calltree_add_conference(current_calls, conf); + calltree_remove_conference(current_calls_tab, conf); + calltree_add_conference_to_current_calls(conf); calltree_dragged_call = NULL; return; @@ -1425,8 +1368,8 @@ static void drag_end_cb(GtkWidget * widget UNUSED, GdkDragContext * context UNUS if (gtk_tree_path_compare(dpath, spath) != 0) { // dragged a single call on a single call if (calltree_selected_call != NULL && calltree_dragged_call != NULL) { - calltree_remove_call(current_calls, calltree_selected_call); - calltree_add_call(current_calls, calltree_selected_call, NULL); + calltree_remove_call(current_calls_tab, calltree_selected_call); + calltree_add_call(current_calls_tab, calltree_selected_call, NULL); gtk_menu_popup(GTK_MENU(calltree_popupmenu), NULL, NULL, NULL, NULL, 0, 0); } @@ -1449,23 +1392,23 @@ static void drag_end_cb(GtkWidget * widget UNUSED, GdkDragContext * context UNUS } else if (calltree_selected_type == A_CONFERENCE && calltree_dragged_type == A_CALL) { // dragged a conference on a single call - conf = calltree_selected_conf; + conference_obj_t* conf = calltree_selected_conf; - calltree_remove_conference(current_calls, conf); - calltree_add_conference(current_calls, conf); + calltree_remove_conference(current_calls_tab, conf); + calltree_add_conference_to_current_calls(conf); } else if (calltree_selected_type == A_CONFERENCE && calltree_dragged_type == A_CONFERENCE) { // dragged a conference on a conference if (gtk_tree_path_compare(dpath, spath) == 0) { - if (!current_calls) { + if (!current_calls_tab) { DEBUG("Error while joining the same conference\n"); return; } DEBUG("Joined the same conference!\n"); - gtk_tree_view_expand_row(GTK_TREE_VIEW(current_calls->view), path, FALSE); + gtk_tree_view_expand_row(GTK_TREE_VIEW(current_calls_tab->view), path, FALSE); } else { if (!calltree_selected_conf) DEBUG("Error: selected conference is null while joining 2 conference"); @@ -1485,13 +1428,13 @@ static void drag_end_cb(GtkWidget * widget UNUSED, GdkDragContext * context UNUS // dragged_path_depth == 2 if (calltree_selected_type == A_CALL && calltree_dragged_type == A_CALL) { // TODO: dragged a call on a conference call - calltree_remove_call(current_calls, calltree_selected_call); - calltree_add_call(current_calls, calltree_selected_call, NULL); + calltree_remove_call(current_calls_tab, calltree_selected_call); + calltree_add_call(current_calls_tab, calltree_selected_call, NULL); } else if (calltree_selected_type == A_CONFERENCE && calltree_dragged_type == A_CALL) { // TODO: dragged a conference on a conference call - calltree_remove_conference(current_calls, calltree_selected_conf); - calltree_add_conference(current_calls, calltree_selected_conf); + calltree_remove_conference(current_calls_tab, calltree_selected_conf); + calltree_add_conference_to_current_calls(calltree_selected_conf); } // TODO: dragged a single call on a NULL element @@ -1523,7 +1466,6 @@ static void drag_end_cb(GtkWidget * widget UNUSED, GdkDragContext * context UNUS } } else { - // dragged_path_depth == 2 // dragged a conference call on another conference call (same conference) // TODO: dragged a conference call on another conference call (different conference) @@ -1537,15 +1479,15 @@ static void drag_end_cb(GtkWidget * widget UNUSED, GdkDragContext * context UNUS if (gtk_tree_path_compare(dpath, spath) == 0) { DEBUG("Dragged a call in the same conference"); - calltree_remove_call(current_calls, calltree_selected_call); - calltree_add_call(current_calls, calltree_selected_call, &parent_conference); + calltree_remove_call(current_calls_tab, calltree_selected_call); + calltree_add_call(current_calls_tab, calltree_selected_call, &parent_conference); gtk_widget_hide(calltree_menu_items); gtk_menu_popup(GTK_MENU(calltree_popupmenu), NULL, NULL, NULL, NULL, 0, 0); } else { DEBUG("Dragged a conference call onto another conference call %s, %s", gtk_tree_path_to_string(dpath), gtk_tree_path_to_string(spath)); - conf = NULL; + conference_obj_t *conf = NULL; val.g_type = 0; if (gtk_tree_model_get_iter(model, &iter, dpath)) { @@ -1582,7 +1524,7 @@ void drag_data_received_cb(GtkWidget *widget, GdkDragContext *context UNUSED, gi GtkTreeViewDropPosition position; GValue val; - if (active_calltree == history) { + if (active_calltree_tab == history_tab) { g_signal_stop_emission_by_name(G_OBJECT(widget), "drag_data_received"); return; } @@ -1678,7 +1620,7 @@ static void menuitem_response(gchar *string) calltree_selected_call->_peer_number, calltree_dragged_call->_peer_number); dbus_attended_transfer(calltree_selected_call, calltree_dragged_call); - calltree_remove_call(current_calls, calltree_selected_call); + calltree_remove_call(current_calls_tab, calltree_selected_call); } else DEBUG("CallTree: Error unknown option selected in menu %s", string); @@ -1689,10 +1631,10 @@ static void menuitem_response(gchar *string) DEBUG("%s", string); } -void calltree_add_call_to_conference(calltab_t *tab, callable_obj_t *call, const gchar * const confID) +void calltree_add_call_to_conference_in_history(callable_obj_t *call, const gchar * const confID) { GtkTreeIter iter; - GtkTreeModel *tree_model = GTK_TREE_MODEL(tab->store); + GtkTreeModel *tree_model = GTK_TREE_MODEL(history_tab->store); gtk_tree_model_get_iter_first(tree_model, &iter); @@ -1714,5 +1656,5 @@ void calltree_add_call_to_conference(calltab_t *tab, callable_obj_t *call, const } } - calltree_add_call(tab, call, &iter); + calltree_add_history_entry(call, &iter); } diff --git a/gnome/src/contacts/calltree.h b/gnome/src/contacts/calltree.h index 3f3c340103ba69f2a2b2c254778ab75e0004a4f6..d0a7fe903407ccd5bd320a07f5555b6528c80ebc 100644 --- a/gnome/src/contacts/calltree.h +++ b/gnome/src/contacts/calltree.h @@ -72,14 +72,14 @@ void calltree_add_call (calltab_t *, callable_obj_t *, GtkTreeIter *); void -calltree_add_call_to_conference(calltab_t *tab, callable_obj_t *call, const gchar * const confID); +calltree_add_call_to_conference_in_history(callable_obj_t *call, const gchar * const confID); /* * Update the call tree if the call state changes * @param c The call to update */ void -calltree_update_call (calltab_t *, callable_obj_t *, GtkTreeIter *); +calltree_update_call (calltab_t *, callable_obj_t *); /** * Remove a call from the call tree @@ -97,7 +97,10 @@ void calltree_add_history_entry (callable_obj_t *, GtkTreeIter *); void -calltree_add_conference (calltab_t *, conference_obj_t *); +calltree_add_conference_to_current_calls(conference_obj_t *); + +void +calltree_add_conference_to_history(conference_obj_t *); void calltree_remove_conference(calltab_t *, const conference_obj_t *); diff --git a/gnome/src/contacts/conferencelist.c b/gnome/src/contacts/conferencelist.c index 1730ef1374b1b6c7abd86c53a21414b663fe734d..65ddf2fe14636061ab764019f99143c2ede15047 100644 --- a/gnome/src/contacts/conferencelist.c +++ b/gnome/src/contacts/conferencelist.c @@ -63,11 +63,11 @@ void conferencelist_clean(calltab_t *tab) void conferencelist_clean_history(void) { - while (conferencelist_get_size(history) > 0) { - conference_obj_t *conf = conferencelist_pop_head(history); + while (conferencelist_get_size(history_tab) > 0) { + conference_obj_t *conf = conferencelist_pop_head(history_tab); if (conf) - calltree_remove_conference(history, conf); + calltree_remove_conference(history_tab, conf); else ERROR("ConferenceList: Conference pointer is NULL"); } diff --git a/gnome/src/contacts/history.c b/gnome/src/contacts/history.c index acc89b2ee14a60b1bcdf42cc758d2e60a0ac387c..e311978e465cec93b0e21098ccfd32f85cd3aa78 100644 --- a/gnome/src/contacts/history.c +++ b/gnome/src/contacts/history.c @@ -95,8 +95,8 @@ void history_search(void) void history_search_init(void) { - history_filter = history_create_filter(GTK_TREE_MODEL(history->store)); - gtk_tree_view_set_model(GTK_TREE_VIEW(history->view), GTK_TREE_MODEL(history_filter)); + history_filter = history_create_filter(GTK_TREE_MODEL(history_tab->store)); + gtk_tree_view_set_model(GTK_TREE_VIEW(history_tab->view), GTK_TREE_MODEL(history_filter)); } void history_set_searchbar_widget(GtkWidget *searchbar) diff --git a/gnome/src/contacts/searchbar.c b/gnome/src/contacts/searchbar.c index 39edf7844188e64eba2318b31470377e52ce12e7..aa39c8d7393eafd8a266ada5f6f142dd6c991828 100644 --- a/gnome/src/contacts/searchbar.c +++ b/gnome/src/contacts/searchbar.c @@ -66,11 +66,7 @@ void searchbar_addressbook_activated(GtkEntry *entry, gchar *arg1 UNUSED, gpoint void searchbar_entry_changed(GtkEntry* entry UNUSED, gchar* arg1 UNUSED, gpointer data UNUSED) { DEBUG("Searchbar: Entry changed"); - - if (active_calltree == contacts) { - // Search made only when text entry is activated - // addressbook_search (entry); - } else if (active_calltree == history) + if (active_calltree_tab == history_tab) history_search(); } @@ -234,10 +230,10 @@ static void icon_press_cb(GtkEntry *entry, gint position, GdkEventButton *event, { DEBUG("Searchbar: Icon pressed"); - if (position == GTK_ENTRY_ICON_PRIMARY && active_calltree == history) + if (position == GTK_ENTRY_ICON_PRIMARY && active_calltree_tab == history_tab) gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event->button, event->time); - else if (position == GTK_ENTRY_ICON_PRIMARY && active_calltree == contacts) { + else if (position == GTK_ENTRY_ICON_PRIMARY && active_calltree_tab == contacts_tab) { GtkWidget *addrbook_menu = addressbook_menu_new(); gtk_menu_popup(GTK_MENU(addrbook_menu), NULL, NULL, NULL, NULL, event->button, event->time); @@ -259,7 +255,7 @@ GtkWidget *addressbook_menu_new(void) { // Create the menu GtkWidget *menu_widget = gtk_menu_new(); - gtk_menu_attach_to_widget(GTK_MENU(menu_widget), contacts->searchbar, NULL); + gtk_menu_attach_to_widget(GTK_MENU(menu_widget), contacts_tab->searchbar, NULL); // Populate menu GtkWidget *item = gtk_menu_item_new_with_label("Search is"); diff --git a/gnome/src/dbus/dbus.c b/gnome/src/dbus/dbus.c index e0a3a653113d46c550b488956e967c9c14a80876..f6196c81fff9f95cd81ee91416c18e3ec403e84e 100644 --- a/gnome/src/dbus/dbus.c +++ b/gnome/src/dbus/dbus.c @@ -60,11 +60,11 @@ new_call_created_cb(DBusGProxy *proxy UNUSED, const gchar *accountID, { callable_obj_t *c = create_new_call(CALL, CALL_STATE_RINGING, callID, accountID, to, to); - calllist_add_call(current_calls, c); - calltree_add_call(current_calls, c, NULL); + calllist_add_call(current_calls_tab, c); + calltree_add_call(current_calls_tab, c, NULL); update_actions(); - calltree_display(current_calls); + calltree_display(current_calls_tab); } static void @@ -92,7 +92,7 @@ zrtp_negotiation_failed_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* reason, const gchar* severity, void * foo UNUSED) { main_window_zrtp_negotiation_failed(callID, reason, severity); - callable_obj_t *c = calllist_get_call(current_calls, callID); + callable_obj_t *c = calllist_get_call(current_calls_tab, callID); if (c) notify_zrtp_negotiation_failed(c); @@ -121,13 +121,13 @@ incoming_message_cb(DBusGProxy *proxy UNUSED, const gchar* callID UNUSED, const GtkWidget **widget; gchar *id; - callable_obj_t *call = calllist_get_call(current_calls, callID); + callable_obj_t *call = calllist_get_call(current_calls_tab, callID); if (call) { widget = &call->_im_widget; id = call->_callID; } else { - conference_obj_t *conf = conferencelist_get(current_calls, callID); + conference_obj_t *conf = conferencelist_get(current_calls_tab, callID); if (!conf) { ERROR("Message received, but no recipient found"); @@ -148,16 +148,16 @@ static void call_state_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* state, void * foo UNUSED) { - callable_obj_t *c = calllist_get_call(current_calls, callID); + callable_obj_t *c = calllist_get_call(current_calls_tab, callID); if (c) { if (g_strcmp0(state, "HUNGUP") == 0) { if (c->_state == CALL_STATE_CURRENT) { time(&c->_time_stop); - calltree_update_call(history, c, NULL); + calltree_update_call(history_tab, c); } - calltree_update_call(history, c, NULL); + calltree_update_call(history_tab, c); status_bar_display_account(); sflphone_hung_up(c); } else if (g_strcmp0(state, "UNHOLD_CURRENT") == 0) { @@ -196,10 +196,10 @@ call_state_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* state, new_call->_history_state = (g_strcasecmp(g_hash_table_lookup(call_details, "CALL_TYPE"), "0") == 0) ? INCOMING : OUTGOING; - calllist_add_call(current_calls, new_call); - calltree_add_call(current_calls, new_call, NULL); + calllist_add_call(current_calls_tab, new_call); + calltree_add_call(current_calls_tab, new_call, NULL); update_actions(); - calltree_display(current_calls); + calltree_display(current_calls_tab); } } } @@ -207,7 +207,7 @@ call_state_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* state, static void toggle_im(conference_obj_t *conf, gboolean activate) { for (GSList *part = conf->participant_list; part; part = g_slist_next(part)) { - callable_obj_t *call = calllist_get_call(current_calls, part->data); + callable_obj_t *call = calllist_get_call(current_calls_tab, part->data); if (call) im_widget_update_state(IM_WIDGET(call->_im_widget), activate); @@ -220,7 +220,7 @@ conference_changed_cb(DBusGProxy *proxy UNUSED, const gchar* confID, { DEBUG("DBUS: Conference state changed: %s\n", state); - conference_obj_t* changed_conf = conferencelist_get(current_calls, confID); + conference_obj_t* changed_conf = conferencelist_get(current_calls_tab, confID); if (changed_conf == NULL) { ERROR("DBUS: Conference is NULL in conference state changed"); @@ -228,7 +228,7 @@ conference_changed_cb(DBusGProxy *proxy UNUSED, const gchar* confID, } // remove old conference from calltree - calltree_remove_conference(current_calls, changed_conf); + calltree_remove_conference(current_calls_tab, changed_conf); // update conference state if (g_strcmp0(state, "ACTIVE_ATTACHED") == 0) @@ -255,7 +255,7 @@ conference_changed_cb(DBusGProxy *proxy UNUSED, const gchar* confID, // deactivate instant messaging window for new participants toggle_im(changed_conf, FALSE); - calltree_add_conference(current_calls, changed_conf); + calltree_add_conference_to_current_calls(changed_conf); } static void @@ -272,9 +272,9 @@ conference_created_cb(DBusGProxy *proxy UNUSED, const gchar* confID, void * foo // Add conference ID in in each calls for (gchar **part = participants; part && *part; ++part) { - callable_obj_t *call = calllist_get_call(current_calls, *part); + callable_obj_t *call = calllist_get_call(current_calls_tab, *part); - // set when this call have been added to the conference + /* set when this call has been added to the conference */ time(&call->_time_added); im_widget_update_state(IM_WIDGET(call->_im_widget), FALSE); @@ -291,10 +291,10 @@ conference_created_cb(DBusGProxy *proxy UNUSED, const gchar* confID, void * foo time(&new_conf->_time_start); - conferencelist_add(current_calls, new_conf); - conferencelist_add(history, new_conf); - calltree_add_conference(current_calls, new_conf); - calltree_add_conference(history, new_conf); + conferencelist_add(current_calls_tab, new_conf); + conferencelist_add(history_tab, new_conf); + calltree_add_conference_to_current_calls(new_conf); + calltree_add_conference_to_history(new_conf); } static void @@ -302,14 +302,14 @@ conference_removed_cb(DBusGProxy *proxy UNUSED, const gchar* confID, void * foo { DEBUG("DBUS: Conference removed %s", confID); - conference_obj_t * c = conferencelist_get(current_calls, confID); - calltree_remove_conference(current_calls, c); + conference_obj_t * c = conferencelist_get(current_calls_tab, confID); + calltree_remove_conference(current_calls_tab, c); im_widget_update_state(IM_WIDGET(c->_im_widget), FALSE); // remove all participants for this conference for (GSList *p = c->participant_list; p; p = conference_next_participant(p)) { - callable_obj_t *call = calllist_get_call(current_calls, p->data); + callable_obj_t *call = calllist_get_call(current_calls_tab, p->data); if (call) { g_free(call->_confID); @@ -318,7 +318,7 @@ conference_removed_cb(DBusGProxy *proxy UNUSED, const gchar* confID, void * foo } } - conferencelist_remove(current_calls, c->_confID); + conferencelist_remove(current_calls_tab, c->_confID); } static void @@ -326,8 +326,8 @@ record_playback_filepath_cb(DBusGProxy *proxy UNUSED, const gchar *id, const gch { DEBUG("DBUS: Filepath for %s: %s", id, filepath); - callable_obj_t *call = calllist_get_call(current_calls, id); - conference_obj_t *conf = conferencelist_get(current_calls, id); + callable_obj_t *call = calllist_get_call(current_calls_tab, id); + conference_obj_t *conf = conferencelist_get(current_calls_tab, id); if (call && conf) { ERROR("DBUS: Two objects for this callid"); @@ -350,10 +350,10 @@ record_playback_stopped_cb(DBusGProxy *proxy UNUSED, const gchar *filepath) { DEBUG("DBUS: Playback stopped for %s", filepath); - const gint calllist_size = calllist_get_size(history); + const gint calllist_size = calllist_get_size(history_tab); for (gint i = 0; i < calllist_size; i++) { - QueueElement *element = calllist_get_nth(history, i); + QueueElement *element = calllist_get_nth(history_tab, i); if (element == NULL) { ERROR("DBUS: ERROR: Could not find %dth call", i); @@ -363,10 +363,10 @@ record_playback_stopped_cb(DBusGProxy *proxy UNUSED, const gchar *filepath) element->elem.call->_record_is_playing = FALSE; } - const gint conflist_size = conferencelist_get_size(history); + const gint conflist_size = conferencelist_get_size(history_tab); for (gint i = 0; i < conflist_size; i++) { - conference_obj_t *conf = conferencelist_get_nth(history, i); + conference_obj_t *conf = conferencelist_get_nth(history_tab, i); if (conf == NULL) { ERROR("DBUS: ERROR: Could not find %dth conf", i); @@ -407,7 +407,7 @@ static void secure_sdes_on_cb(DBusGProxy *proxy UNUSED, const gchar *callID, void *foo UNUSED) { DEBUG("DBUS: SRTP using SDES is on"); - callable_obj_t *c = calllist_get_call(current_calls, callID); + callable_obj_t *c = calllist_get_call(current_calls_tab, callID); if (c) { sflphone_srtp_sdes_on(c); @@ -420,7 +420,7 @@ static void secure_sdes_off_cb(DBusGProxy *proxy UNUSED, const gchar *callID, void *foo UNUSED) { DEBUG("DBUS: SRTP using SDES is off"); - callable_obj_t *c = calllist_get_call(current_calls, callID); + callable_obj_t *c = calllist_get_call(current_calls_tab, callID); if (c) { sflphone_srtp_sdes_off(c); @@ -433,7 +433,7 @@ secure_zrtp_on_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* ci void * foo UNUSED) { DEBUG("DBUS: SRTP using ZRTP is ON secure_on_cb"); - callable_obj_t *c = calllist_get_call(current_calls, callID); + callable_obj_t *c = calllist_get_call(current_calls_tab, callID); if (c) { c->_srtp_cipher = g_strdup(cipher); @@ -446,7 +446,7 @@ static void secure_zrtp_off_cb(DBusGProxy *proxy UNUSED, const gchar* callID, void * foo UNUSED) { DEBUG("DBUS: SRTP using ZRTP is OFF"); - callable_obj_t *c = calllist_get_call(current_calls, callID); + callable_obj_t *c = calllist_get_call(current_calls_tab, callID); if (c) { sflphone_srtp_zrtp_off(c); @@ -459,7 +459,7 @@ show_zrtp_sas_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* sas const gboolean verified, void * foo UNUSED) { DEBUG("DBUS: Showing SAS"); - callable_obj_t * c = calllist_get_call(current_calls, callID); + callable_obj_t * c = calllist_get_call(current_calls_tab, callID); if (c) sflphone_srtp_zrtp_show_sas(c, sas, verified); @@ -469,7 +469,7 @@ static void confirm_go_clear_cb(DBusGProxy *proxy UNUSED, const gchar* callID, void * foo UNUSED) { DEBUG("DBUS: Confirm Go Clear request"); - callable_obj_t * c = calllist_get_call(current_calls, callID); + callable_obj_t * c = calllist_get_call(current_calls_tab, callID); if (c) main_window_confirm_go_clear(c); @@ -479,7 +479,7 @@ static void zrtp_not_supported_cb(DBusGProxy *proxy UNUSED, const gchar* callID, void * foo UNUSED) { DEBUG("ZRTP not supported on the other end"); - callable_obj_t * c = calllist_get_call(current_calls, callID); + callable_obj_t * c = calllist_get_call(current_calls_tab, callID); if (c) { main_window_zrtp_not_supported(c); @@ -492,7 +492,7 @@ sip_call_state_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* description, const guint code, void * foo UNUSED) { DEBUG("DBUS: Sip call state changed %s", callID); - callable_obj_t *c = calllist_get_call(current_calls, callID); + callable_obj_t *c = calllist_get_call(current_calls_tab, callID); if (c) sflphone_call_state_changed(c, description, code); diff --git a/gnome/src/dialpad.c b/gnome/src/dialpad.c index d5bedd506a6d0f0466930e25ae53936534533a20..c7a02b988a2fc1aaa6efad6ba253010e47d4d814 100644 --- a/gnome/src/dialpad.c +++ b/gnome/src/dialpad.c @@ -38,7 +38,7 @@ static void dialpad_pressed(GtkWidget * widget UNUSED, gpointer data) { - gtk_widget_grab_focus(GTK_WIDGET(current_calls->view)); + gtk_widget_grab_focus(GTK_WIDGET(current_calls_tab->view)); sflphone_keypad(0, (gchar*) data); } diff --git a/gnome/src/imwindow.c b/gnome/src/imwindow.c index 55bfd19ef25daf1acc25b9f947de5c0f49f17b07..32940ff323c2769a73e8cb65fbf0fedd9cfec478 100644 --- a/gnome/src/imwindow.c +++ b/gnome/src/imwindow.c @@ -196,8 +196,8 @@ void im_window_add_tab(IMWidget *im) { /* Fetch the call */ - callable_obj_t *im_widget_call = calllist_get_call(current_calls, im->call_id); - conference_obj_t *im_widget_conf = conferencelist_get(current_calls, im->call_id); + callable_obj_t *im_widget_call = calllist_get_call(current_calls_tab, im->call_id); + conference_obj_t *im_widget_conf = conferencelist_get(current_calls_tab, im->call_id); /* A container to include the tab label and the close button */ GtkWidget *tab_Container = gtk_hbox_new(FALSE, 3); @@ -257,8 +257,8 @@ im_window_remove_tab(GtkWidget *widget) /* Need to do some memory clean up, so that we could re-open an Im widget for this call later. */ IMWidget *im = IM_WIDGET(widget); - callable_obj_t *call = calllist_get_call(current_calls, im->call_id); - conference_obj_t *conf = conferencelist_get(current_calls, im->call_id); + callable_obj_t *call = calllist_get_call(current_calls_tab, im->call_id); + conference_obj_t *conf = conferencelist_get(current_calls_tab, im->call_id); if (call) call->_im_widget = NULL; diff --git a/gnome/src/mainwindow.c b/gnome/src/mainwindow.c index 8e1849097a2dbe2d830599c8989a49f25751ecf6..dd1b1c316043163f837bc655b69a0d876781c42d 100644 --- a/gnome/src/mainwindow.c +++ b/gnome/src/mainwindow.c @@ -129,7 +129,7 @@ main_window_ask_quit() { gchar * question; - if (calllist_get_size(current_calls) == 1) + if (calllist_get_size(current_calls_tab) == 1) question = _("There is one call in progress."); else question = _("There are calls in progress."); @@ -152,10 +152,10 @@ on_key_released(GtkWidget *widget UNUSED, GdkEventKey *event, gpointer user_data return TRUE; if (event->keyval == GDK_Return) { - if (active_calltree == current_calls) { + if (active_calltree_tab == current_calls_tab) { sflphone_keypad(event->keyval, event->string); return TRUE; - } else if (active_calltree == history) + } else if (active_calltree_tab == history_tab) return FALSE; } @@ -239,11 +239,11 @@ create_main_window() gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE /*expand*/, TRUE /*fill*/, 0 /*padding*/); - gtk_box_pack_start(GTK_BOX(vbox), current_calls->tree, TRUE /*expand*/, + gtk_box_pack_start(GTK_BOX(vbox), current_calls_tab->tree, TRUE /*expand*/, TRUE /*fill*/, 0 /*padding*/); - gtk_box_pack_start(GTK_BOX(vbox), history->tree, TRUE /*expand*/, + gtk_box_pack_start(GTK_BOX(vbox), history_tab->tree, TRUE /*expand*/, TRUE /*fill*/, 0 /*padding*/); - gtk_box_pack_start(GTK_BOX(vbox), contacts->tree, TRUE /*expand*/, + gtk_box_pack_start(GTK_BOX(vbox), contacts_tab->tree, TRUE /*expand*/, TRUE /*fill*/, 0 /*padding*/); g_signal_connect_object(G_OBJECT(window), "configure-event", @@ -282,10 +282,10 @@ create_main_window() gtk_widget_show_all(window); /* dont't show the history */ - gtk_widget_hide(history->tree); + gtk_widget_hide(history_tab->tree); /* dont't show the contact list */ - gtk_widget_hide(contacts->tree); + gtk_widget_hide(contacts_tab->tree); /* don't show waiting layer */ gtk_widget_hide(waitingLayer); @@ -448,7 +448,7 @@ main_window_zrtp_negotiation_failed(const gchar* const callID, const gchar* cons { gchar* peer_number = "(number unknown)"; callable_obj_t * c = NULL; - c = calllist_get_call(current_calls, callID); + c = calllist_get_call(current_calls_tab, callID); if (c != NULL) peer_number = c->_peer_number; diff --git a/gnome/src/shortcuts.c b/gnome/src/shortcuts.c index cba8e5899d47683b798ac44fd5e56406674a3518..737b917a918ec4648daea2728f55f9b0cf263610 100644 --- a/gnome/src/shortcuts.c +++ b/gnome/src/shortcuts.c @@ -110,8 +110,8 @@ filter_keys(const GdkXEvent *xevent, const GdkEvent *event UNUSED, gpointer data static void toggle_pick_up_hang_up_callback() { - callable_obj_t * selectedCall = calltab_get_selected_call(active_calltree); - conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree); + callable_obj_t * selectedCall = calltab_get_selected_call(active_calltree_tab); + conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree_tab); DEBUG("Shortcuts: Toggle pickup/hangup callback"); @@ -152,8 +152,8 @@ hang_up_callback() static void toggle_hold_callback() { - callable_obj_t * selectedCall = calltab_get_selected_call(current_calls); - conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree); + callable_obj_t * selectedCall = calltab_get_selected_call(current_calls_tab); + conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree_tab); if (selectedCall) { switch (selectedCall->_state) { diff --git a/gnome/src/uimanager.c b/gnome/src/uimanager.c index b818f74a1da196a4dcb3fb1b757316bc6c92de7e..7e573bd0e82846651e1bc5e5503a531da1d26dc6 100644 --- a/gnome/src/uimanager.c +++ b/gnome/src/uimanager.c @@ -176,8 +176,8 @@ update_actions() } } - callable_obj_t * selectedCall = calltab_get_selected_call(active_calltree); - conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree); + callable_obj_t * selectedCall = calltab_get_selected_call(active_calltree_tab); + conference_obj_t * selectedConf = calltab_get_selected_conf(active_calltree_tab); gboolean instant_messaging_enabled = TRUE; @@ -233,16 +233,16 @@ update_actions() DEBUG("UIManager: Call State Dialing"); gtk_action_set_sensitive(pickUpAction_, TRUE); - if (active_calltree == current_calls) + if (active_calltree_tab == current_calls_tab) gtk_action_set_sensitive(hangUpAction_, TRUE); g_object_ref(newCallWidget_); gtk_container_remove(GTK_CONTAINER(toolbar_), newCallWidget_); gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(pickUpWidget_), 0); - if (active_calltree == current_calls) + if (active_calltree_tab == current_calls_tab) gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(hangUpWidget_), 1); - else if (active_calltree == history) { + else if (active_calltree_tab == history_tab) { if (selectedCall->_recordfile &&(g_strcmp0(selectedCall->_recordfile, "") != 0)) { if (selectedCall->_record_is_playing) gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(stopRecordWidget_), 3); @@ -339,7 +339,7 @@ update_actions() case CONFERENCE_STATE_ACTIVE_DETACHED: DEBUG("UIManager: Conference State Active"); - if (active_calltree == current_calls) { + if (active_calltree_tab == current_calls_tab) { int pos = 1; gtk_action_set_sensitive(hangUpAction_, TRUE); gtk_widget_set_sensitive(holdToolbar_, TRUE); @@ -352,7 +352,7 @@ update_actions() gtk_action_set_sensitive(imAction_, TRUE); gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(imToolbar_), pos); } - } else if (active_calltree == history) { + } else if (active_calltree_tab == history_tab) { if (selectedConf->_recordfile &&(g_strcmp0(selectedConf->_recordfile, "") != 0)) { if (selectedConf->_record_is_playing) gtk_toolbar_insert(GTK_TOOLBAR(toolbar_), GTK_TOOL_ITEM(stopRecordWidget_), 3); @@ -541,8 +541,8 @@ switch_account(GtkWidget* item, gpointer data UNUSED) 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(current_calls); + callable_obj_t * selectedCall = calltab_get_selected_call(current_calls_tab); + conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls_tab); DEBUG("UIManager: Hold button pressed"); @@ -581,10 +581,10 @@ call_hold(void* foo UNUSED) 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(current_calls); + callable_obj_t *selectedCall = calltab_get_selected_call(current_calls_tab); + conference_obj_t *selectedConf = calltab_get_selected_conf(current_calls_tab); - if (calltab_get_selected_type(current_calls) == A_CALL) { + if (calltab_get_selected_type(current_calls_tab) == A_CALL) { if (selectedCall) { if (!selectedCall->_im_widget) selectedCall->_im_widget = im_widget_display(selectedCall->_callID); @@ -602,7 +602,7 @@ call_im(void* foo UNUSED) static void conference_hold(void* foo UNUSED) { - conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls); + conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls_tab); DEBUG("UIManager: Hold button pressed for conference"); @@ -639,25 +639,25 @@ call_pick_up(void * foo UNUSED) { DEBUG("UIManager: Pick up"); - if (calllist_get_size(current_calls) > 0) { + if (calllist_get_size(current_calls_tab) > 0) { sflphone_pick_up(); - } else if (calllist_get_size(active_calltree) > 0) { - callable_obj_t *selectedCall = calltab_get_selected_call(active_calltree); + } else if (calllist_get_size(active_calltree_tab) > 0) { + callable_obj_t *selectedCall = calltab_get_selected_call(active_calltree_tab); if (selectedCall) { callable_obj_t *new_call = create_new_call(CALL, CALL_STATE_DIALING, "", "", "", selectedCall->_peer_number); - calllist_add_call(current_calls, new_call); - calltree_add_call(current_calls, new_call, NULL); + calllist_add_call(current_calls_tab, new_call); + calltree_add_call(current_calls_tab, new_call, NULL); sflphone_place_call(new_call); - calltree_display(current_calls); + calltree_display(current_calls_tab); } else { sflphone_new_call(); - calltree_display(current_calls); + calltree_display(current_calls_tab); } } else { sflphone_new_call(); - calltree_display(current_calls); + calltree_display(current_calls_tab); } } @@ -677,7 +677,7 @@ static void conference_hang_up(void) { DEBUG("UIManager: Hang up button pressed(conference)"); - conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls); + conference_obj_t * selectedConf = calltab_get_selected_conf(current_calls_tab); if (selectedConf) dbus_hang_up_conference(selectedConf); @@ -695,8 +695,8 @@ start_playback_record_cb(void) { DEBUG("UIManager: Start playback button pressed"); - callable_obj_t *selectedCall = calltab_get_selected_call(history); - conference_obj_t *selectedConf = calltab_get_selected_conf(history); + callable_obj_t *selectedCall = calltab_get_selected_call(history_tab); + conference_obj_t *selectedConf = calltab_get_selected_conf(history_tab); if (selectedCall == NULL && selectedConf == NULL) { ERROR("UIManager: Error: No selected object in playback record callback"); @@ -724,8 +724,8 @@ stop_playback_record_cb(void) { DEBUG("UIManager: Stop playback button pressed"); - callable_obj_t *selectedCall = calltab_get_selected_call(history); - conference_obj_t *selectedConf = calltab_get_selected_conf(history); + callable_obj_t *selectedCall = calltab_get_selected_call(history_tab); + conference_obj_t *selectedConf = calltab_get_selected_conf(history_tab); if (selectedCall && selectedConf) { ERROR("UIManager: Error: Two selected object in history treeview"); @@ -769,7 +769,7 @@ call_configuration_assistant(void * foo UNUSED) static void remove_from_history(void * foo UNUSED) { - callable_obj_t* call = calltab_get_selected_call(history); + callable_obj_t* call = calltab_get_selected_call(history_tab); DEBUG("UIManager: Remove the call from the history"); @@ -784,7 +784,7 @@ remove_from_history(void * foo UNUSED) static void call_back(void * foo UNUSED) { - callable_obj_t *selected_call = calltab_get_selected_call(active_calltree); + callable_obj_t *selected_call = calltab_get_selected_call(active_calltree_tab); DEBUG("UIManager: Call back"); @@ -797,10 +797,10 @@ call_back(void * foo UNUSED) "", selected_call->_peer_name, selected_call->_peer_number); - calllist_add_call(current_calls, new_call); - calltree_add_call(current_calls, new_call, NULL); + calllist_add_call(current_calls_tab, new_call); + calltree_add_call(current_calls_tab, new_call, NULL); sflphone_place_call(new_call); - calltree_display(current_calls); + calltree_display(current_calls_tab); } static void @@ -820,7 +820,7 @@ static void edit_copy(void * foo UNUSED) { GtkClipboard* clip = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); - callable_obj_t * selectedCall = calltab_get_selected_call(current_calls); + callable_obj_t * selectedCall = calltab_get_selected_call(current_calls_tab); DEBUG("UIManager: Edit/Copy"); @@ -839,7 +839,7 @@ static void edit_paste(void * foo UNUSED) { GtkClipboard* clip = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); - callable_obj_t * selectedCall = calltab_get_selected_call(current_calls); + callable_obj_t * selectedCall = calltab_get_selected_call(current_calls_tab); gchar * no = gtk_clipboard_wait_for_text(clip); if (no && selectedCall) { @@ -856,7 +856,7 @@ edit_paste(void * foo UNUSED) selectedCall->_peer_info = g_strconcat("\"\" <", selectedCall->_peer_number, ">", NULL); - calltree_update_call(current_calls, selectedCall, NULL); + calltree_update_call(current_calls_tab, selectedCall); } break; case CALL_STATE_RINGING: @@ -875,7 +875,7 @@ edit_paste(void * foo UNUSED) selectedCall->_peer_info = g_strconcat("\"\" <", selectedCall->_peer_number, ">", NULL); - calltree_update_call(current_calls, selectedCall, NULL); + calltree_update_call(current_calls_tab, selectedCall); } break; case CALL_STATE_CURRENT: @@ -892,7 +892,7 @@ edit_paste(void * foo UNUSED) selectedCall->_peer_info = get_peer_info(temp, selectedCall->_peer_name); g_free(temp); g_free(oneNo); - calltree_update_call(current_calls, selectedCall, NULL); + calltree_update_call(current_calls_tab, selectedCall); } } break; @@ -908,7 +908,7 @@ edit_paste(void * foo UNUSED) g_free(selectedCall->_peer_info); selectedCall->_peer_info = g_strconcat("\"\" <", selectedCall->_peer_number, ">", NULL); - calltree_update_call(current_calls, selectedCall, NULL); + calltree_update_call(current_calls_tab, selectedCall); } g_free(no); @@ -917,10 +917,10 @@ edit_paste(void * foo UNUSED) static void clear_history(void) { - if (conferencelist_get_size(history) != 0) + if (conferencelist_get_size(history_tab) != 0) conferencelist_clean_history(); - if (calllist_get_size(history) != 0) + if (calllist_get_size(history_tab) != 0) calllist_clean_history(); } @@ -951,29 +951,29 @@ call_mailbox_cb(void) "", account_id, _("Voicemail"), to); DEBUG("TO : %s" , mailbox_call->_peer_number); - calllist_add_call(current_calls, mailbox_call); - calltree_add_call(current_calls, mailbox_call, NULL); + calllist_add_call(current_calls_tab, mailbox_call); + calltree_add_call(current_calls_tab, mailbox_call, NULL); update_actions(); sflphone_place_call(mailbox_call); - calltree_display(current_calls); + calltree_display(current_calls_tab); } static void toggle_history_cb(GtkToggleAction *action, gpointer user_data UNUSED) { if (gtk_toggle_action_get_active(action)) - calltree_display(history); + calltree_display(history_tab); else - calltree_display(current_calls); + calltree_display(current_calls_tab); } static void toggle_addressbook_cb(GtkToggleAction *action, gpointer user_data UNUSED) { if (gtk_toggle_action_get_active(action)) - calltree_display(contacts); + calltree_display(contacts_tab); else - calltree_display(current_calls); + calltree_display(current_calls_tab); } static const GtkActionEntry menu_entries[] = { @@ -1207,9 +1207,9 @@ show_popup_menu(GtkWidget *my_widget, GdkEventButton *event) callable_obj_t * selectedCall = NULL; conference_obj_t * selectedConf; - if (calltab_get_selected_type(current_calls) == A_CALL) { + if (calltab_get_selected_type(current_calls_tab) == A_CALL) { DEBUG("UIManager: Menus: Selected a call"); - selectedCall = calltab_get_selected_call(current_calls); + selectedCall = calltab_get_selected_call(current_calls_tab); if (selectedCall) { copy = TRUE; @@ -1250,7 +1250,7 @@ show_popup_menu(GtkWidget *my_widget, GdkEventButton *event) } } else { DEBUG("UIManager: Menus: selected a conf"); - selectedConf = calltab_get_selected_conf(active_calltree); + selectedConf = calltab_get_selected_conf(active_calltree_tab); if (selectedConf) { switch (selectedConf->_state) { @@ -1276,7 +1276,7 @@ show_popup_menu(GtkWidget *my_widget, GdkEventButton *event) GtkWidget *menu = gtk_menu_new(); - if (calltab_get_selected_type(current_calls) == A_CALL) { + if (calltab_get_selected_type(current_calls_tab) == A_CALL) { DEBUG("UIManager: Build call menu"); if (copy) { @@ -1408,7 +1408,7 @@ show_popup_menu_history(GtkWidget *my_widget, GdkEventButton *event) gboolean edit = FALSE; gboolean accounts = FALSE; - callable_obj_t * selectedCall = calltab_get_selected_call(history); + callable_obj_t * selectedCall = calltab_get_selected_call(history_tab); if (selectedCall) { add_remove_button = TRUE; @@ -1458,8 +1458,7 @@ show_popup_menu_history(GtkWidget *my_widget, GdkEventButton *event) void show_popup_menu_contacts(GtkWidget *my_widget, GdkEventButton *event) { - callable_obj_t * selectedCall = calltab_get_selected_call(contacts); - + callable_obj_t * selectedCall = calltab_get_selected_call(contacts_tab); GtkWidget *menu = gtk_menu_new(); @@ -1495,10 +1494,10 @@ ok_cb(GtkWidget *widget UNUSED, gpointer userdata) original->_peer_name, new_number); // Update the internal data structure and the GUI - calllist_add_call(current_calls, modified_call); - calltree_add_call(current_calls, modified_call, NULL); + calllist_add_call(current_calls_tab, modified_call); + calltree_add_call(current_calls_tab, modified_call, NULL); sflphone_place_call(modified_call); - calltree_display(current_calls); + calltree_display(current_calls_tab); // Close the contextual menu gtk_widget_destroy(edit_dialog_); @@ -1632,7 +1631,7 @@ create_toolbar_actions(GtkUIManager *ui_manager) // Set the handler ID for the transfer transferButtonConnId_ = g_signal_connect(G_OBJECT(transferToolbar_), "toggled", G_CALLBACK(call_transfer_cb), NULL); recordButtonConnId_ = g_signal_connect(G_OBJECT(recordWidget_), "toggled", G_CALLBACK(call_record), NULL); - active_calltree = current_calls; + active_calltree_tab = current_calls_tab; return toolbar_; } diff --git a/gnome/src/widget/imwidget.c b/gnome/src/widget/imwidget.c index f414e1bfca2f94fd85bbcf118cd6dd8f50aa34d8..baf85d9eb54ed2e44807658ad5411badf07192b2 100644 --- a/gnome/src/widget/imwidget.c +++ b/gnome/src/widget/imwidget.c @@ -57,10 +57,10 @@ on_frame_loading_done(GObject *gobject UNUSED, GParamSpec *pspec UNUSED, gpointe break; case WEBKIT_LOAD_FINISHED: - if (calllist_get_call(current_calls, im->call_id)) + if (calllist_get_call(current_calls_tab, im->call_id)) im_widget_add_message(im, im->first_message_from, im->first_message, 0); - if (conferencelist_get(current_calls, im->call_id)) + if (conferencelist_get(current_calls_tab, im->call_id)) im_widget_add_message(im, im->first_message_from, im->first_message, 0); g_free(im->first_message); @@ -196,14 +196,13 @@ on_Textview_changed(GtkWidget *widget UNUSED, GdkEventKey *event, gpointer user_ void im_widget_send_message(const gchar *id, const gchar *message) { - callable_obj_t *im_widget_call = calllist_get_call(current_calls, id); - conference_obj_t *im_widget_conf = conferencelist_get(current_calls, id); + callable_obj_t *im_widget_call = calllist_get_call(current_calls_tab, id); + conference_obj_t *im_widget_conf = conferencelist_get(current_calls_tab, id); /* If the call has been hungup, it is not anymore in the current_calls calltab */ - if (!im_widget_call) { - /* So try the history tab */ - im_widget_call = calllist_get_call(history, id); - } + /* So try the history tab */ + if (!im_widget_call) + im_widget_call = calllist_get_call(history_tab, id); if (im_widget_conf) dbus_send_text_message(id, message); @@ -333,8 +332,8 @@ im_widget_infobar(IMWidget *im) GtkWidget *content_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(infobar)); /* Fetch call/conference information */ - callable_obj_t *im_widget_call = calllist_get_call(current_calls, im->call_id); - conference_obj_t *im_widget_conf = conferencelist_get(current_calls, im->call_id); + callable_obj_t *im_widget_call = calllist_get_call(current_calls_tab, im->call_id); + conference_obj_t *im_widget_conf = conferencelist_get(current_calls_tab, im->call_id); /* Create the label widgets with the call information saved in the IM Widget struct */ gchar *msg1;