From 75dda354d011b689cc2477cba6fcabb6db2e36e1 Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandre.savard@savoirfairelinux.net>
Date: Fri, 28 Aug 2009 14:22:56 -0400
Subject: [PATCH] [#2006] Detach participant by ID

---
 sflphone-client-gnome/src/actions.c           | 12 +++++++++---
 sflphone-client-gnome/src/actions.h           |  2 ++
 sflphone-client-gnome/src/contacts/calltree.c |  1 +
 sflphone-client-gnome/src/dbus/dbus.c         |  6 +++---
 sflphone-client-gnome/src/toolbar.c           |  2 +-
 5 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c
index 7e69cabc3b..5e65e88c0b 100644
--- a/sflphone-client-gnome/src/actions.c
+++ b/sflphone-client-gnome/src/actions.c
@@ -837,12 +837,18 @@ sflphone_get_current_codec_name()
 }
 
     void
-sflphone_detach_participant()
+sflphone_detach_participant(const gchar* callID)
 {
     DEBUG("sflphone detach participant from conference");
 
-    callable_obj_t * selectedCall = calltab_get_selected_call(current_calls);
-    dbus_detach_participant(selectedCall);
+    if(callID == NULL) {
+        callable_obj_t * selectedCall = calltab_get_selected_call(current_calls);
+        dbus_detach_participant(selectedCall->_callID);
+    }
+    else {
+	dbus_detach_participant(callID);	
+    }
+     
 }
 
     void
diff --git a/sflphone-client-gnome/src/actions.h b/sflphone-client-gnome/src/actions.h
index 975aead4c2..e984ac68dd 100644
--- a/sflphone-client-gnome/src/actions.h
+++ b/sflphone-client-gnome/src/actions.h
@@ -186,4 +186,6 @@ void sflphone_join_participant(const gchar* sel_callID, const gchar* drag_callID
 
 void sflphone_add_participant(const gchar* callID, const gchar* confID);
 
+void sflphone_detach_participant(const gchar* callID);
+
 #endif
diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c
index db5b7aa20c..2cf12eaaf0 100644
--- a/sflphone-client-gnome/src/contacts/calltree.c
+++ b/sflphone-client-gnome/src/contacts/calltree.c
@@ -926,6 +926,7 @@ static void drag_end_cb(GtkWidget * widget, GdkDragContext * context, gpointer d
 	    else if(selected_type == A_CONFERENCE && dragged_type == A_CALL)
 	    {
 		// TODO: dragged a conference on a single call
+		sflphone_add_participant(dragged_call_id, selected_call_id);
 		
 	    }
 	    else if(selected_type == A_CONFERENCE && dragged_type == A_CONFERENCE)
diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c
index f0c939b560..fce7413f83 100644
--- a/sflphone-client-gnome/src/dbus/dbus.c
+++ b/sflphone-client-gnome/src/dbus/dbus.c
@@ -1339,15 +1339,15 @@ dbus_add_participant(const gchar* callID, const gchar* confID)
 
 
     void
-dbus_detach_participant(const callable_obj_t * c)
+dbus_detach_participant(const gchar* callID)
 {
 
-    DEBUG("dbus_detach_participant %s\n", c->_callID);
+    DEBUG("dbus_detach_participant %s\n", callID);
 
     GError* error = NULL;
     org_sflphone_SFLphone_CallManager_detach_participant(
             callManagerProxy,
-            c->_callID,
+            callID,
             &error);
     if(error)
     {
diff --git a/sflphone-client-gnome/src/toolbar.c b/sflphone-client-gnome/src/toolbar.c
index 862c8ef04b..683018ca7e 100644
--- a/sflphone-client-gnome/src/toolbar.c
+++ b/sflphone-client-gnome/src/toolbar.c
@@ -32,7 +32,7 @@ is_inserted( GtkWidget* button )
     static void
 detach_button( GtkWidget *widget UNUSED, gpointer   data UNUSED)
 {
-    sflphone_detach_participant();
+    sflphone_detach_participant(NULL);
 }
 
 /**
-- 
GitLab