From 61164f530308a867663e17192614c729e9ec7758 Mon Sep 17 00:00:00 2001 From: pierre-luc <pierre-luc.bacon@savoirfairelinux.com> Date: Mon, 10 Aug 2009 17:43:43 -0400 Subject: [PATCH] [#2017] [#2019] Fix the inability to dial a number and place a registered call. Also, the pulseaudio layer is no more drained because of the time (useless) it could take in some circumstances. --- sflphone-client-gnome/src/actions.c | 24 +++++++++++++------ sflphone-client-gnome/src/contacts/calltree.c | 11 ++++----- .../src/audio/pulseaudio/pulselayer.cpp | 2 +- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/sflphone-client-gnome/src/actions.c b/sflphone-client-gnome/src/actions.c index bb1653f542..f0ab707444 100644 --- a/sflphone-client-gnome/src/actions.c +++ b/sflphone-client-gnome/src/actions.c @@ -602,7 +602,7 @@ sflphone_new_call() callable_obj_t *c; gchar *peer_name, *peer_number; - DEBUG("sflphone_new_call\n"); + DEBUG("sflphone_new_call"); sflphone_on_hold(); // Play a tone when creating a new call @@ -644,11 +644,11 @@ sflphone_keypad( guint keyval, gchar * key) } else if(c) { - DEBUG("call"); + DEBUG("Call is non-zero"); switch(c->_state) { case CALL_STATE_DIALING: // Currently dialing => edit number - DEBUG("Writing a number\n"); + DEBUG("Writing a number"); process_dialing(c, keyval, key); break; case CALL_STATE_RECORD: @@ -784,6 +784,11 @@ static int _place_registered_call(callable_obj_t * c) { account_t * current = NULL; + if(c == NULL) { + DEBUG("callable_obj_t is NULL in _place_registered_call"); + return -1; + } + if (c->_state != CALL_STATE_DIALING) { return -1; } @@ -804,12 +809,17 @@ static int _place_registered_call(callable_obj_t * c) { return -1; } - current = account_list_get_by_id(c->_accountID); + if(g_strcasecmp(c->_accountID, "") != 0) { + current = account_list_get_by_id(c->_accountID); + } else { + current = account_list_get_current(); + } + if(current == NULL) { - DEBUG("Unexpected condition: account_t is NULL in %s at %d", __FILE__, __LINE__); + DEBUG("Unexpected condition: account_t is NULL in %s at %d for accountID %s", __FILE__, __LINE__, c->_accountID); return -1; } - + if(g_strcasecmp(g_hash_table_lookup( current->properties, "Status"),"REGISTERED")==0) { /* The call is made with the current account */ c->_accountID = current->accountID; @@ -820,7 +830,7 @@ static int _place_registered_call(callable_obj_t * c) { * If we are here, we can be sure that there is at least one. */ current = account_list_get_by_state( ACCOUNT_STATE_REGISTERED ); - c->_accountID = current -> accountID; + c->_accountID = current->accountID; dbus_place_call(c); notify_current_account( current ); } diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c index 1bc4fa1ffe..7d3f1092a7 100644 --- a/sflphone-client-gnome/src/contacts/calltree.c +++ b/sflphone-client-gnome/src/contacts/calltree.c @@ -51,7 +51,7 @@ popup_menu (GtkWidget *widget, /* Call back when the user click on a call in the list */ static void -selected(GtkTreeSelection *sel, void* data UNUSED ) +call_selected_cb(GtkTreeSelection *sel, void* data UNUSED ) { GtkTreeIter iter; GValue val; @@ -231,10 +231,6 @@ focus_on_calltree_in(){ void calltree_create (calltab_t* tab, gboolean searchbar_type) { - // GtkWidget *sw; - // GtkCellRenderer *rend; - // GtkTreeViewColumn *col; - // GtkTreeSelection *sel; tab->tree = gtk_vbox_new(FALSE, 10); @@ -320,7 +316,7 @@ calltree_create (calltab_t* tab, gboolean searchbar_type) sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tab->view)); g_signal_connect (G_OBJECT (sel), "changed", - G_CALLBACK (selected), + G_CALLBACK (call_selected_cb), NULL); gtk_box_pack_start(GTK_BOX(tab->tree), sw, TRUE, TRUE, 0); @@ -672,6 +668,8 @@ void calltree_add_call (calltab_t* tab, callable_obj_t * c) { g_object_unref(G_OBJECT(pixbuf)); } gtk_tree_view_set_model (GTK_TREE_VIEW(history->view), GTK_TREE_MODEL(history->store)); + + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(tab->view)), &iter); history_reinit(history); } @@ -803,6 +801,7 @@ void calltree_display (calltab_t *tab) { gtk_widget_show (active_calltree->tree); sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (active_calltree->view)); + DEBUG("Emit signal changed from calltree_display"); g_signal_emit_by_name(sel, "changed"); toolbar_update_buttons(); } diff --git a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp index d383ddec4c..fb576f882c 100644 --- a/sflphone-common/src/audio/pulseaudio/pulselayer.cpp +++ b/sflphone-common/src/audio/pulseaudio/pulselayer.cpp @@ -57,7 +57,7 @@ PulseLayer::closeLayer (void) // PulseLayer to close immediately, not // waiting for the playback buffer to be // emptied. It should not hurt. - playback->drainStream(); + //playback->drainStream(); if (m) { pa_threaded_mainloop_stop (m); -- GitLab