* #25572: gnome: only ask for codecs when meaningful

This commit is contained in:
Tristan Matthews
2013-06-06 16:59:18 -04:00
parent ba25a48531
commit 404fa030c2
5 changed files with 42 additions and 35 deletions

View File

@ -172,14 +172,14 @@ void
sflphone_hold(callable_obj_t * c, SFLPhoneClient *client)
{
c->_state = CALL_STATE_HOLD;
calltree_update_call(current_calls_tab, c, client);
calltree_update_call(current_calls_tab, c, client, FALSE);
}
void
sflphone_ringing(callable_obj_t * c, SFLPhoneClient *client)
{
c->_state = CALL_STATE_RINGING;
calltree_update_call(current_calls_tab, c, client);
calltree_update_call(current_calls_tab, c, client, TRUE);
}
void
@ -336,7 +336,7 @@ sflphone_hang_up(SFLPhoneClient *client)
}
}
calltree_update_call(history_tab, selectedCall, client);
calltree_update_call(history_tab, selectedCall, client, FALSE);
statusbar_update_clock("");
@ -367,7 +367,7 @@ sflphone_pick_up(SFLPhoneClient *client)
break;
case CALL_STATE_INCOMING:
selectedCall->_history_state = g_strdup(INCOMING_STRING);
calltree_update_call(history_tab, selectedCall, client);
calltree_update_call(history_tab, selectedCall, client, TRUE);
dbus_accept(selectedCall);
break;
@ -429,14 +429,14 @@ void
sflphone_fail(callable_obj_t * c, SFLPhoneClient *client)
{
c->_state = CALL_STATE_FAILURE;
calltree_update_call(current_calls_tab, c, client);
calltree_update_call(current_calls_tab, c, client, FALSE);
}
void
sflphone_busy(callable_obj_t * c, SFLPhoneClient *client)
{
c->_state = CALL_STATE_BUSY;
calltree_update_call(current_calls_tab, c, client);
calltree_update_call(current_calls_tab, c, client, FALSE);
}
void
@ -446,7 +446,7 @@ sflphone_current(callable_obj_t * c, SFLPhoneClient *client)
time(&c->_time_start);
c->_state = CALL_STATE_CURRENT;
calltree_update_call(current_calls_tab, c, client);
calltree_update_call(current_calls_tab, c, client, TRUE);
}
void
@ -458,7 +458,7 @@ sflphone_set_transfer(SFLPhoneClient *client)
c->_state = CALL_STATE_TRANSFER;
g_free(c->_trsft_to);
c->_trsft_to = g_strdup("");
calltree_update_call(current_calls_tab, c, client);
calltree_update_call(current_calls_tab, c, client, FALSE);
} else {
update_actions(client);
}
@ -473,7 +473,7 @@ sflphone_unset_transfer(SFLPhoneClient *client)
c->_state = CALL_STATE_CURRENT;
g_free(c->_trsft_to);
c->_trsft_to = g_strdup("");
calltree_update_call(current_calls_tab, c, client);
calltree_update_call(current_calls_tab, c, client, FALSE);
} else {
update_actions(client);
}
@ -533,7 +533,7 @@ process_dialing(callable_obj_t *c, guint keyval, const gchar *key, SFLPhoneClien
if (len) {
len--; // delete one character
num[len] = '\0';
calltree_update_call(current_calls_tab, c, client);
calltree_update_call(current_calls_tab, c, client, FALSE);
/* If number is now empty, hang up immediately */
if (c->_state != CALL_STATE_TRANSFER && len == 0)
@ -567,7 +567,7 @@ process_dialing(callable_obj_t *c, guint keyval, const gchar *key, SFLPhoneClien
c->_peer_number = new_peer_number;
}
calltree_update_call(current_calls_tab, c, client);
calltree_update_call(current_calls_tab, c, client, FALSE);
}
break;
@ -637,7 +637,7 @@ sflphone_keypad(guint keyval, const gchar * key, SFLPhoneClient *client)
case GDK_KEY_Escape:
dbus_hang_up(c);
time(&c->_time_stop);
calltree_update_call(history_tab, c, client);
calltree_update_call(history_tab, c, client, FALSE);
break;
default:
// To play the dtmf when calling mail box for instance
@ -652,7 +652,7 @@ sflphone_keypad(guint keyval, const gchar * key, SFLPhoneClient *client)
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
c->_history_state = g_strdup(INCOMING_STRING);
calltree_update_call(history_tab, c, client);
calltree_update_call(history_tab, c, client, TRUE);
dbus_accept(c);
break;
case GDK_KEY_Escape:
@ -700,7 +700,7 @@ sflphone_keypad(guint keyval, const gchar * key, SFLPhoneClient *client)
switch (keyval) {
case GDK_KEY_Escape:
dbus_hang_up(c);
calltree_update_call(history_tab, c, client);
calltree_update_call(history_tab, c, client, FALSE);
break;
}
@ -821,7 +821,7 @@ sflphone_rec_call(SFLPhoneClient *client)
if (selectedCall) {
g_debug("Set record for selected call");
dbus_set_record(selectedCall->_callID);
calltree_update_call(current_calls_tab, selectedCall, client);
calltree_update_call(current_calls_tab, selectedCall, client, TRUE);
} else if (selectedConf) {
g_debug("Set record for selected conf");
dbus_set_record(selectedConf->_confID);
@ -952,14 +952,14 @@ sflphone_srtp_sdes_on(callable_obj_t * c, SFLPhoneClient *client)
{
c->_srtp_state = SRTP_STATE_SDES_SUCCESS;
calltree_update_call(current_calls_tab, c, client);
calltree_update_call(current_calls_tab, c, client, TRUE);
}
void
sflphone_srtp_sdes_off(callable_obj_t * c, SFLPhoneClient *client)
{
c->_srtp_state = SRTP_STATE_UNLOCKED;
calltree_update_call(current_calls_tab, c, client);
calltree_update_call(current_calls_tab, c, client, TRUE);
}
@ -968,14 +968,14 @@ sflphone_srtp_zrtp_on(callable_obj_t * c, SFLPhoneClient *client)
{
c->_srtp_state = SRTP_STATE_ZRTP_SAS_UNCONFIRMED;
calltree_update_call(current_calls_tab, c, client);
calltree_update_call(current_calls_tab, c, client, TRUE);
}
void
sflphone_srtp_zrtp_off(callable_obj_t * c, SFLPhoneClient *client)
{
c->_srtp_state = SRTP_STATE_UNLOCKED;
calltree_update_call(current_calls_tab, c, client);
calltree_update_call(current_calls_tab, c, client, TRUE);
}
void
@ -984,7 +984,7 @@ 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_tab, c, client);
calltree_update_call(current_calls_tab, c, client, TRUE);
}
void
@ -1010,6 +1010,6 @@ 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_tab, c, client);
calltree_update_call(current_calls_tab, c, client, TRUE);
}

View File

@ -255,12 +255,12 @@ row_single_click(G_GNUC_UNUSED GtkTreeView *tree_view, SFLPhoneClient *client)
selectedCall->_zrtp_confirmed = TRUE;
dbus_confirm_sas(selectedCall);
calltree_update_call(current_calls_tab, selectedCall, client);
calltree_update_call(current_calls_tab, selectedCall, client, TRUE);
break;
case SRTP_STATE_ZRTP_SAS_CONFIRMED:
selectedCall->_srtp_state = SRTP_STATE_ZRTP_SAS_UNCONFIRMED;
dbus_reset_sas(selectedCall);
calltree_update_call(current_calls_tab, selectedCall, client);
calltree_update_call(current_calls_tab, selectedCall, client, TRUE);
break;
default:
g_debug("Single click but no action");
@ -579,6 +579,7 @@ static GdkPixbuf *history_state_to_pixbuf(callable_obj_t *call)
typedef struct {
calltab_t *tab;
callable_obj_t *call;
gboolean update_codecs;
} CallUpdateCtx;
typedef struct {
@ -628,13 +629,18 @@ update_call(GtkTreeModel *model, G_GNUC_UNUSED GtkTreePath *path, GtkTreeIter *i
gchar *audio_codec;
gchar *video_codec;
/* Don't get codec names if call does not yet exist */
audio_codec = call_get_audio_codec(call);
/* Don't get codec names if call does not exist */
if (ctx->update_codecs) {
audio_codec = call_get_audio_codec(call);
#ifdef SFL_VIDEO
video_codec = call_get_video_codec(call);
video_codec = call_get_video_codec(call);
#else
video_codec = g_strdup("");
video_codec = g_strdup("");
#endif
} else {
audio_codec = g_strdup("");
video_codec = g_strdup("");
}
if (call->_state == CALL_STATE_TRANSFER)
description = calltree_display_call_info(call, DISPLAY_TYPE_CALL_TRANSFER, "", "");
@ -740,13 +746,14 @@ update_call(GtkTreeModel *model, G_GNUC_UNUSED GtkTreePath *path, GtkTreeIter *i
return TRUE;
}
void calltree_update_call(calltab_t* tab, callable_obj_t * call, SFLPhoneClient *client)
void
calltree_update_call(calltab_t* tab, callable_obj_t * call, SFLPhoneClient *client, gboolean update_codecs)
{
if (!call) {
g_warning("Call is NULL, ignoring");
return;
}
CallUpdateCtx ctx = {tab, call};
CallUpdateCtx ctx = {tab, call, update_codecs};
GtkTreeStore *store = tab->store;
GtkTreeModel *model = GTK_TREE_MODEL(store);
gtk_tree_model_foreach(model, update_call, (gpointer) &ctx);

View File

@ -76,7 +76,7 @@ calltree_add_call (calltab_t *, callable_obj_t *, GtkTreeIter *);
* @param c The call to update
*/
void
calltree_update_call (calltab_t *, callable_obj_t *, SFLPhoneClient *client);
calltree_update_call(calltab_t *, callable_obj_t *, SFLPhoneClient *client, gboolean update_codecs);
/**
* Remove a call from the call tree

View File

@ -195,7 +195,7 @@ process_existing_call_state_change(callable_obj_t *c, const gchar *state, SFLPho
if (c->_state == CALL_STATE_CURRENT)
time(&c->_time_stop);
calltree_update_call(history_tab, c, client);
calltree_update_call(history_tab, c, client, FALSE);
status_bar_display_account();
sflphone_hung_up(c, client);
} else if (g_strcmp0(state, "UNHOLD") == 0 || g_strcmp0(state, "CURRENT") == 0)

View File

@ -843,7 +843,7 @@ edit_paste(G_GNUC_UNUSED GtkAction *action, SFLPhoneClient *client)
selectedCall->_peer_info = g_strconcat("\"\" <",
selectedCall->_peer_number, ">", NULL);
calltree_update_call(current_calls_tab, selectedCall, client);
calltree_update_call(current_calls_tab, selectedCall, client, FALSE);
}
break;
case CALL_STATE_RINGING:
@ -862,7 +862,7 @@ edit_paste(G_GNUC_UNUSED GtkAction *action, SFLPhoneClient *client)
selectedCall->_peer_info = g_strconcat("\"\" <",
selectedCall->_peer_number, ">", NULL);
calltree_update_call(current_calls_tab, selectedCall, client);
calltree_update_call(current_calls_tab, selectedCall, client, FALSE);
}
break;
case CALL_STATE_CURRENT:
@ -878,7 +878,7 @@ edit_paste(G_GNUC_UNUSED GtkAction *action, SFLPhoneClient *client)
selectedCall->_peer_info = get_peer_info(temp, selectedCall->_display_name);
g_free(temp);
g_free(oneNo);
calltree_update_call(current_calls_tab, selectedCall, client);
calltree_update_call(current_calls_tab, selectedCall, client, TRUE);
}
}
break;
@ -894,7 +894,7 @@ edit_paste(G_GNUC_UNUSED GtkAction *action, SFLPhoneClient *client)
g_free(selectedCall->_peer_info);
selectedCall->_peer_info = g_strconcat("\"\" <",
selectedCall->_peer_number, ">", NULL);
calltree_update_call(current_calls_tab, selectedCall, client);
calltree_update_call(current_calls_tab, selectedCall, client, FALSE);
}
g_free(no);