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

* #10736: calltree: detach participants, don't detach non-participants

parent 71bf3bc6
Branches
Tags
No related merge requests found
...@@ -1166,20 +1166,24 @@ static void cleanup_popup_data(PopupData **data) ...@@ -1166,20 +1166,24 @@ static void cleanup_popup_data(PopupData **data)
} }
} }
static gboolean
has_parent(GtkTreeModel *model, GtkTreeIter *child)
{
GtkTreeIter parent;
return gtk_tree_model_iter_parent(model, &parent, child);
}
static gboolean try_detach(GtkTreeModel *model, GtkTreeIter *source_iter, GtkTreeIter *dest_iter) static gboolean try_detach(GtkTreeModel *model, GtkTreeIter *source_iter, GtkTreeIter *dest_iter)
{ {
gboolean result = FALSE;
if (has_parent(model, source_iter) && !has_parent(model, dest_iter)) {
GValue source_val = G_VALUE_INIT; GValue source_val = G_VALUE_INIT;
gtk_tree_model_get_value(model, source_iter, COLUMN_ID, &source_val); gtk_tree_model_get_value(model, source_iter, COLUMN_ID, &source_val);
const gchar *source_ID = g_value_get_string(&source_val); const gchar *source_ID = g_value_get_string(&source_val);
callable_obj_t *source_call = calllist_get_call(current_calls_tab, source_ID);
gboolean result = FALSE;
GtkTreeIter iter_parent;
if (source_call && source_call->_confID && !gtk_tree_model_iter_parent(model, &iter_parent, dest_iter)) {
sflphone_detach_participant(source_ID); sflphone_detach_participant(source_ID);
result = TRUE; result = TRUE;
}
g_value_unset(&source_val); g_value_unset(&source_val);
}
return result; return result;
} }
...@@ -1194,9 +1198,12 @@ handle_drop_into(GtkTreeModel *model, GtkTreeIter *source_iter, GtkTreeIter *des ...@@ -1194,9 +1198,12 @@ handle_drop_into(GtkTreeModel *model, GtkTreeIter *source_iter, GtkTreeIter *des
gtk_tree_model_get_value(model, dest_iter, COLUMN_ID, &dest_val); gtk_tree_model_get_value(model, dest_iter, COLUMN_ID, &dest_val);
const gchar *dest_ID = g_value_get_string(&dest_val); const gchar *dest_ID = g_value_get_string(&dest_val);
GtkTreeIter iter_parent;
gboolean result = FALSE; gboolean result = FALSE;
if (!gtk_tree_model_iter_parent(model, &iter_parent, dest_iter)) {
if (has_parent(model, source_iter)) {
DEBUG("Source is participant, should only be detached");
result = FALSE;
} else if (!has_parent(model, dest_iter)) {
if (is_conference(model, dest_iter)) { if (is_conference(model, dest_iter)) {
if (is_conference(model, source_iter)) { if (is_conference(model, source_iter)) {
DEBUG("dropped conference on conference, merging conferences"); DEBUG("dropped conference on conference, merging conferences");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment