Skip to content
Snippets Groups Projects
Commit 32281ec8 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #10736: calltree: update call need not be recursive

parent b97b9cce
No related branches found
No related tags found
No related merge requests found
......@@ -545,21 +545,25 @@ GdkPixbuf *history_state_to_pixbuf(const gchar *history_state)
return pixbuf;
}
static void
calltree_update_call_recursive(calltab_t* tab, callable_obj_t * call, GtkTreeIter *parent)
typedef struct {
calltab_t *tab;
callable_obj_t *call;
} CallUpdateCtx;
static gboolean
update_call(GtkTreeModel *model, GtkTreePath *path UNUSED, GtkTreeIter *iter, gpointer data)
{
GdkPixbuf *pixbuf = NULL;
GdkPixbuf *pixbuf_security = NULL;
GtkTreeIter iter;
CallUpdateCtx *ctx = (CallUpdateCtx*) data;
calltab_t *tab = ctx->tab;
callable_obj_t *call = ctx->call;
GtkTreeStore* store = tab->store;
gchar* srtp_enabled = NULL;
gboolean display_sas = TRUE;
account_t* account = NULL;
int nbChild = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), parent);
if (call) {
account = account_list_get_by_id(call->_accountID);
if (account != NULL) {
......@@ -572,24 +576,15 @@ calltree_update_call_recursive(calltab_t* tab, callable_obj_t * call, GtkTreeIte
display_sas = utf8_case_equal(g_hash_table_lookup(properties, ACCOUNT_ZRTP_DISPLAY_SAS), "true");
}
}
}
for (gint i = 0; i < nbChild; i++) {
GtkTreeModel *model = GTK_TREE_MODEL(store);
if (gtk_tree_model_iter_nth_child(model, &iter, parent, i)) {
if (is_conference(model, &iter)) {
calltree_update_call_recursive(tab, call, &iter);
} else {
gchar *id;
gtk_tree_model_get(model, &iter, COLUMN_ID, &id, -1);
gtk_tree_model_get(model, iter, COLUMN_ID, &id, -1);
callable_obj_t * iterCall = calllist_get_call(tab, id);
g_free(id);
if (iterCall != call)
continue;
return FALSE;
/* Update text */
gchar * description = NULL;
......@@ -665,11 +660,7 @@ calltree_update_call_recursive(calltab_t* tab, callable_obj_t * call, GtkTreeIte
}
} else if (tab == history_tab) {
// parent is NULL this is not a conference participant
if (parent == NULL)
pixbuf = history_state_to_pixbuf(call->_history_state);
else // parent is not NULL this is a conference participant
pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/current.svg", NULL);
g_free(description);
description = calltree_display_call_info(call, DISPLAY_TYPE_HISTORY, "");
......@@ -685,7 +676,7 @@ calltree_update_call_recursive(calltab_t* tab, callable_obj_t * call, GtkTreeIte
g_free(old_description);
}
gtk_tree_store_set(store, &iter,
gtk_tree_store_set(store, iter,
COLUMN_ACCOUNT_PIXBUF, pixbuf,
COLUMN_ACCOUNT_DESC, description,
COLUMN_ACCOUNT_SECURITY_PIXBUF, pixbuf_security,
......@@ -699,14 +690,19 @@ calltree_update_call_recursive(calltab_t* tab, callable_obj_t * call, GtkTreeIte
g_object_unref(G_OBJECT(pixbuf));
if (pixbuf_security != NULL)
g_object_unref(G_OBJECT(pixbuf_security));
}
}
}
return TRUE;
}
void calltree_update_call(calltab_t* tab, callable_obj_t * c)
void calltree_update_call(calltab_t* tab, callable_obj_t * call)
{
calltree_update_call_recursive(tab, c, NULL);
if (!call) {
ERROR("Call is NULL, ignoring");
return;
}
CallUpdateCtx ctx = {tab, call};
GtkTreeStore *store = tab->store;
GtkTreeModel *model = GTK_TREE_MODEL(store);
gtk_tree_model_foreach(model, update_call, (gpointer) &ctx);
update_actions();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment