Commit 60a7e80b authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2006] Add multilayered capabilities to calltree (GtkTreeStore)

parent 41bc39dd
......@@ -476,7 +476,7 @@ sflphone_incoming_call (callable_obj_t * c)
c->_history_state = MISSED;
calllist_add ( current_calls, c );
calllist_add( history, c );
calltree_add_call( current_calls , c );
calltree_add_call( current_calls, c, NULL);
update_menus();
calltree_display (current_calls);
}
......@@ -578,7 +578,7 @@ sflphone_new_call()
create_new_call (CALL, CALL_STATE_DIALING, "", "", peer_name, peer_number, &c);
calllist_add (current_calls,c);
calltree_add_call (current_calls,c);
calltree_add_call (current_calls, c, NULL);
update_menus();
return c;
......@@ -967,7 +967,7 @@ void sflphone_fill_call_list (void)
DEBUG ("Add call retrieved from server side: %s\n", c->_callID);
calllist_add (current_calls, c);
// Update the GUI
calltree_add_call (current_calls, c);
calltree_add_call (current_calls, c, NULL);
}
}
}
......@@ -989,6 +989,7 @@ void sflphone_fill_conference_list(void)
{
c = g_new0(conference_obj_t, 1);
conf_id = (gchar*)(*conferences);
conference_details = dbus_get_conference_details(conf_id);
create_new_call_from_details (conf_id, conference_details, &c);
c->_confID = g_strdup(conf_id);
......
......@@ -34,7 +34,7 @@ gint is_confID_confstruct ( gconstpointer a, gconstpointer b)
}
}
void create_new_conference (conference_state_t state, gchar* confID, conference_obj_t ** new_conf)
void create_new_conference (conference_state_t state, const gchar* confID, conference_obj_t ** new_conf)
{
conference_obj_t *obj;
......
......@@ -48,7 +48,7 @@ typedef struct {
} conference_obj_t;
void create_new_conference (conference_state_t, gchar*, conference_obj_t **);
void create_new_conference (conference_state_t, const gchar*, conference_obj_t **);
void create_new_conference_from_details (const gchar *, GHashTable *, conference_obj_t *);
......
......@@ -54,7 +54,7 @@ void calllist_add_contact (gchar *contact_name, gchar *contact_phone, contact_ty
}
calllist_add (contacts, new_call);
calltree_add_call(contacts, new_call);
calltree_add_call(contacts, new_call, NULL);
}
}
......@@ -84,7 +84,7 @@ void calllist_add_history_entry (callable_obj_t *obj)
if (state == 1)
{
g_queue_push_tail (history->callQueue, (gpointer *) obj);
calltree_add_call (history, obj);
calltree_add_call (history, obj, NULL);
}
}
......
......@@ -28,7 +28,7 @@
*/
typedef struct {
GtkListStore* store;
GtkTreeStore* store;
GtkWidget* view;
GtkWidget* tree;
GtkWidget* searchbar;
......
......@@ -66,16 +66,20 @@ selected(GtkTreeSelection *sel, void* data UNUSED )
DEBUG("Selection Callback");
GtkTreeIter iter;
GtkTreeIter iter;
GValue val;
GtkTreeModel *model = (GtkTreeModel*)active_calltree->store;
GtkTreePath* path;
char* string_path;
char* type;
GValue typeval;
if (! gtk_tree_selection_get_selected (sel, &model, &iter))
return;
val.g_type = 0;
gtk_tree_model_get_value (model, &iter, 2, &val);
......@@ -153,7 +157,7 @@ void row_activated(GtkTreeView *tree_view UNUSED,
create_new_call (CALL, CALL_STATE_DIALING, "", account_id, selectedCall->_peer_name, selectedCall->_peer_number, &new_call);
calllist_add(current_calls, new_call);
calltree_add_call(current_calls, new_call);
calltree_add_call(current_calls, new_call, NULL);
sflphone_place_call(new_call);
calltree_display(current_calls);
}
......@@ -189,7 +193,7 @@ button_pressed(GtkWidget* widget, GdkEventButton *event, gpointer user_data UNUS
void
calltree_reset (calltab_t* tab)
{
gtk_list_store_clear (tab->store);
gtk_tree_store_clear (tab->store);
}
void
......@@ -225,10 +229,10 @@ calltree_create (calltab_t* tab, gboolean searchbar_type)
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
tab->store = gtk_list_store_new (3,
tab->store = gtk_tree_store_new (3,
GDK_TYPE_PIXBUF,// Icon
G_TYPE_STRING, // Description
G_TYPE_POINTER // Pointer to the Object
G_TYPE_POINTER // Pointer to the Object
);
tab->view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(tab->store));
......@@ -315,7 +319,7 @@ calltree_remove_call (calltab_t* tab, callable_obj_t * c)
GtkTreeIter iter;
GValue val;
callable_obj_t * iterCall;
GtkListStore* store = tab->store;
GtkTreeStore* store = tab->store;
int nbChild = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL);
int i;
......@@ -331,7 +335,7 @@ calltree_remove_call (calltab_t* tab, callable_obj_t * c)
if(iterCall == c)
{
gtk_list_store_remove(store, &iter);
gtk_tree_store_remove(store, &iter);
}
}
}
......@@ -348,7 +352,7 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c)
GtkTreeIter iter;
GValue val;
callable_obj_t * iterCall;
GtkListStore* store = tab->store;
GtkTreeStore* store = tab->store;
int nbChild = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL);
int i;
......@@ -450,7 +454,7 @@ calltree_update_call (calltab_t* tab, callable_obj_t * c)
pixbuf = gdk_pixbuf_scale_simple(pixbuf, 32, 32, GDK_INTERP_BILINEAR);
}
}
gtk_list_store_set(store, &iter,
gtk_tree_store_set(store, &iter,
0, pixbuf, // Icon
1, description, // Description
-1);
......@@ -480,7 +484,7 @@ void calltree_add_history_entry (callable_obj_t * c)
c->_peer_number,
c->_peer_name);
gtk_list_store_prepend (history->store, &iter);
gtk_tree_store_prepend (history->store, &iter, NULL);
switch(c->_history_state)
{
......@@ -510,7 +514,7 @@ void calltree_add_history_entry (callable_obj_t * c)
pixbuf = gdk_pixbuf_scale_simple(pixbuf, 32, 32, GDK_INTERP_BILINEAR);
}
}
gtk_list_store_set(history->store, &iter,
gtk_tree_store_set(history->store, &iter,
0, pixbuf, // Icon
1, description, // Description
2, c, // Pointer
......@@ -525,7 +529,7 @@ void calltree_add_history_entry (callable_obj_t * c)
}
void calltree_add_call (calltab_t* tab, callable_obj_t * c)
void calltree_add_call (calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
{
if (tab == history)
......@@ -545,7 +549,7 @@ void calltree_add_call (calltab_t* tab, callable_obj_t * c)
c->_peer_number,
c->_peer_name);
gtk_list_store_prepend (tab->store, &iter);
gtk_tree_store_prepend (tab->store, &iter, parent);
if( tab == current_calls )
......@@ -596,7 +600,7 @@ void calltree_add_call (calltab_t* tab, callable_obj_t * c)
pixbuf = gdk_pixbuf_scale_simple(pixbuf, 32, 32, GDK_INTERP_BILINEAR);
}
}
gtk_list_store_set(tab->store, &iter,
gtk_tree_store_set(tab->store, &iter,
0, pixbuf, // Icon
1, description, // Description
2, c, // Pointer
......@@ -634,12 +638,18 @@ void calltree_add_conference (calltab_t* tab, const conference_obj_t* conf)
GdkPixbuf *pixbuf=NULL;
GtkTreeIter iter;
gchar** participant = (gchar**)dbus_get_participant_list(conf->_confID);
gchar** pl;
gchar* call_id;
callable_obj_t * call;
// New call in the list
gchar * description;
description = g_markup_printf_escaped("<b>%s</b>", conf->_confID);
gtk_list_store_prepend (tab->store, &iter);
gtk_tree_store_prepend (tab->store, &iter, NULL);
if( tab == current_calls )
{
......@@ -650,7 +660,7 @@ void calltree_add_conference (calltab_t* tab, const conference_obj_t* conf)
WARN ("Conferences cannot be added in this widget - This is a bug in the application.");
}
/*
DEBUG("PIXWITH: %i\n", gdk_pixbuf_get_width(pixbuf));
//Resize it
if(pixbuf)
{
......@@ -659,8 +669,8 @@ void calltree_add_conference (calltab_t* tab, const conference_obj_t* conf)
pixbuf = gdk_pixbuf_scale_simple(pixbuf, 32, 32, GDK_INTERP_BILINEAR);
}
}
*/
gtk_list_store_set(tab->store, &iter,
gtk_tree_store_set(tab->store, &iter,
0, pixbuf, // Icon
1, description, // Description
2, conf, // Pointer
......@@ -670,23 +680,24 @@ void calltree_add_conference (calltab_t* tab, const conference_obj_t* conf)
if (pixbuf != NULL)
g_object_unref(G_OBJECT(pixbuf));
/*
// history_reinit (tab);
// sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tab->view));
// gtk_tree_selection_select_iter(GTK_TREE_SELECTION(sel), &iter);
// history_reinit (tab);
if(participant)
{
for (pl = participant; *participant; participant++)
{
call_id = (gchar*)(*participant);
call = calllist_get (tab, call_id);
// create_new_call_from_details (conf_id, conference_details, &c);
calltree_remove_call(tab, call);
calltree_add_call (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 (tab->view), GTK_TREE_MODEL (history_filter));
/*
gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(tab->view)), &iter);
*/
toolbar_update_buttons();
......@@ -709,7 +720,7 @@ void calltree_remove_conference (calltab_t* tab, const conference_obj_t* conf)
GtkTreeIter iter;
GValue val;
conference_obj_t * iterCall;
GtkListStore* store = tab->store;
GtkTreeStore* store = tab->store;
int nbChild = gtk_tree_model_iter_n_children(GTK_TREE_MODEL(store), NULL);
int i;
......@@ -725,7 +736,7 @@ void calltree_remove_conference (calltab_t* tab, const conference_obj_t* conf)
if(iterCall == conf)
{
gtk_list_store_remove(store, &iter);
gtk_tree_store_remove(store, &iter);
}
}
}
......
......@@ -40,7 +40,7 @@ calltree_create(calltab_t* tab, gboolean searchbar_type);
* @param c The call to add
*/
void
calltree_add_call (calltab_t* ct, callable_obj_t * c);
calltree_add_call (calltab_t* ct, callable_obj_t * c, GtkTreeIter *parent);
/*
* Update the call tree if the call state changes
......
......@@ -123,7 +123,12 @@
<signal name="conferenceChanged">
</signal>
<signal name="conferenceAdded">
<method name="getParticipantList">
<arg type="s" name="confID" direction="in"/>
<arg type="as" name="list" direction="out"/>
</method>
<signal name="conferenceCreated">
<arg type="s" name="confID" direction="out"/>
</signal>
......
......@@ -194,7 +194,7 @@ call_state_cb (DBusGProxy *proxy UNUSED,
calllist_add (current_calls, new_call);
calllist_add (history, new_call);
calltree_add_call (current_calls, new_call);
calltree_add_call (current_calls, new_call, NULL);
update_menus ();
calltree_display (current_calls);
......@@ -213,7 +213,7 @@ conference_changed_cb (DBusGProxy *proxy UNUSED,
static void
conference_added_cb (DBusGProxy *proxy UNUSED,
conference_created_cb (DBusGProxy *proxy UNUSED,
const gchar* confID,
void * foo UNUSED )
{
......@@ -399,17 +399,17 @@ dbus_connect ()
dbus_g_proxy_connect_signal (callManagerProxy,
"transferFailed", G_CALLBACK(transfer_failed_cb), NULL, NULL);
dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INVALID);
dbus_g_proxy_add_signal (callManagerProxy,
"conferenceChanged", G_TYPE_INVALID);
dbus_g_proxy_connect_signal (callManagerProxy,
"conferenceChanged", G_CALLBACK(conference_changed_cb), NULL, NULL);
dbus_g_object_register_marshaller(g_cclosure_user_marshal_VOID__STRING,
G_TYPE_NONE, G_TYPE_STRING, G_TYPE_INVALID);
dbus_g_proxy_add_signal (callManagerProxy,
"conferenceAdded", G_TYPE_STRING, G_TYPE_INVALID);
"conferenceCreated", G_TYPE_STRING, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (callManagerProxy,
"conferenceAdded", G_CALLBACK(conference_added_cb), NULL, NULL);
"conferenceCreated", G_CALLBACK(conference_created_cb), NULL, NULL);
dbus_g_proxy_add_signal (callManagerProxy,
"conferenceRemoved", G_TYPE_STRING, G_TYPE_INVALID);
......@@ -1850,6 +1850,22 @@ gchar** dbus_get_conference_list (void)
return list;
}
gchar** dbus_get_participant_list (const char * confID)
{
GError *error = NULL;
gchar **list = NULL;
org_sflphone_SFLphone_CallManager_get_participant_list (callManagerProxy, confID, &list, &error);
if (error){
ERROR ("Error calling org_sflphone_SFLphone_CallManager_get_participant_list");
g_error_free (error);
}
return list;
}
GHashTable* dbus_get_conference_details (const gchar *confID)
{
GError *error = NULL;
......
......@@ -278,7 +278,7 @@ call_back( void * foo UNUSED)
create_new_call (CALL, CALL_STATE_DIALING, "", "", selected_call->_peer_name, selected_call->_peer_number, &new_call);
calllist_add(current_calls, new_call);
calltree_add_call(current_calls, new_call);
calltree_add_call(current_calls, new_call, NULL);
sflphone_place_call(new_call);
calltree_display (current_calls);
}
......@@ -1020,7 +1020,7 @@ static void ok_cb (GtkWidget *widget UNUSED, gpointer userdata) {
// Update the internal data structure and the GUI
calllist_add(current_calls, modified_call);
calltree_add_call(current_calls, modified_call);
calltree_add_call(current_calls, modified_call, NULL);
sflphone_place_call(modified_call);
calltree_display (current_calls);
......
......@@ -61,7 +61,7 @@ call_mailbox( GtkWidget* widget UNUSED, gpointer data UNUSED)
create_new_call (CALL, CALL_STATE_DIALING, "", account_id, _("Voicemail"), to, &mailbox_call);
DEBUG("TO : %s" , mailbox_call->_peer_number);
calllist_add( current_calls , mailbox_call );
calltree_add_call( current_calls , mailbox_call );
calltree_add_call( current_calls, mailbox_call, NULL);
update_menus();
sflphone_place_call( mailbox_call );
calltree_display(current_calls);
......@@ -88,7 +88,7 @@ call_button( GtkWidget *widget UNUSED, gpointer data UNUSED)
create_new_call (CALL, CALL_STATE_DIALING, "", "", "", selectedCall->_peer_number, &new_call);
calllist_add(current_calls, new_call);
calltree_add_call(current_calls, new_call);
calltree_add_call(current_calls, new_call, NULL);
sflphone_place_call(new_call);
calltree_display (current_calls);
}
......
......@@ -123,7 +123,12 @@
<signal name="conferenceChanged">
</signal>
<signal name="conferenceAdded">
<method name="getParticipantList">
<arg type="s" name="confID" direction="in"/>
<arg type="as" name="list" direction="out"/>
</method>
<signal name="conferenceCreated">
<arg type="s" name="confID" direction="out"/>
</signal>
......
......@@ -145,6 +145,12 @@ CallManager::getConferenceList (void)
return Manager::instance().getConferenceList();
}
std::vector< std::string >
CallManager::getParticipantList (const std::string& confID)
{
return Manager::instance().getParticipantList(confID);
}
void
CallManager::setRecording (const std::string& callID)
{
......
......@@ -51,6 +51,7 @@ public:
void joinParticipant( const std::string& sel_callID, const std::string& drag_callID );
void detachParticipant( const std::string& callID );
std::vector< std::string > getConferenceList (void);
std::vector< std::string > getParticipantList (const std::string& confID);
std::map< std::string, std::string > getConferenceDetails ( const std::string& callID );
void setRecording( const std::string& callID );
bool getIsRecording(const std::string& callID);
......
......@@ -659,7 +659,7 @@ ManagerImpl::createConference(const CallID& id1, const CallID& id2)
conf->add(id2);
// broadcast a signal over dbus
_dbus->getCallManager()->conferenceAdded(default_conf);
_dbus->getCallManager()->conferenceCreated(default_conf);
}
......@@ -3497,7 +3497,7 @@ ManagerImpl::getConferenceDetails(const ConfID& confID)
iter_conf = _conferencemap.find(confID);
Conference *conf;
Conference *conf = NULL;
if(iter_conf != _conferencemap.end()) {
......@@ -3523,3 +3523,31 @@ ManagerImpl::getConferenceList (void)
return v;
}
std::vector< std::string >
ManagerImpl::getParticipantList (const std::string& confID)
{
_debug("ManagerImpl::getParticipantList\n");
std::vector< std::string > v;
ConferenceMap::iterator iter_conf = _conferencemap.find(confID);
Conference *conf = NULL;
if(iter_conf != _conferencemap.end())
conf = iter_conf->second;
ConferenceCallMap::iterator iter_call = _conferencecall.begin();
Conference *temp;
while (iter_call != _conferencecall.end ()) {
temp = iter_call->second;
if (conf == temp)
v.push_back (iter_call->first);
iter_call++;
}
return v;
}
......@@ -363,6 +363,13 @@ class ManagerImpl {
*/
std::vector< std::string > getConferenceList (void);
/**
* Get a list of participant to a conference
* @return std::vector<std::string> A list of call IDs
*/
std::vector< std::string > getParticipantList (const std::string& confID);
/**
* Save the details of an existing account, given the account ID
* This will load the configuration map with the given data.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment