Skip to content
Snippets Groups Projects
Commit 74ac1b0b authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Merge branch 'history_addons' into search_bar

parents 75200cd8 54d8f076
No related branches found
No related tags found
No related merge requests found
......@@ -247,6 +247,7 @@ sflphone_hang_up()
break;
case CALL_STATE_TRANSFERT:
dbus_hang_up (selectedCall);
(void) time(&selectedCall->_stop);
break;
default:
g_warning("Should not happen in sflphone_hang_up()!");
......@@ -279,6 +280,7 @@ sflphone_pick_up()
break;
case CALL_STATE_TRANSFERT:
dbus_transfert (selectedCall);
(void) time(&selectedCall->_stop);
break;
case CALL_STATE_CURRENT:
sflphone_new_call();
......@@ -349,10 +351,11 @@ sflphone_busy( call_t * c )
void
sflphone_current( call_t * c )
{
c->state = CALL_STATE_CURRENT;
update_call_tree(current_calls,c);
update_menus();
if( c->state != CALL_STATE_HOLD )
(void) time(&c->_start);
c->state = CALL_STATE_CURRENT;
update_call_tree(current_calls,c);
update_menus();
}
void
......@@ -546,6 +549,7 @@ sflphone_keypad( guint keyval, gchar * key)
case 65293: /* ENTER */
case 65421: /* ENTER numpad */
dbus_transfert(c);
(void) time(&c->_stop);
break;
case 65307: /* ESCAPE */
sflphone_unset_transfert(c);
......
......@@ -57,6 +57,12 @@ popup_menu (GtkWidget *widget,
return TRUE;
}
static gboolean
is_inserted( GtkWidget* button )
{
return ( GTK_WIDGET(button)->parent == GTK_WIDGET( toolbar ) );
}
static gboolean
button_pressed(GtkWidget* widget, GdkEventButton *event, gpointer user_data)
{
......@@ -81,30 +87,41 @@ button_pressed(GtkWidget* widget, GdkEventButton *event, gpointer user_data)
static void
call_button( GtkWidget *widget, gpointer data )
{
call_t * selectedCall;
call_t * selectedCall = call_get_selected(active_calltree);
call_t* newCall = g_new0 (call_t, 1);
printf("Call button pressed\n");
if(call_list_get_size(current_calls)>0)
sflphone_pick_up();
else if(call_list_get_size(active_calltree) > 0){
printf("Calling a called num\n");
selectedCall = call_get_selected(active_calltree);
if( selectedCall)
{
printf("Calling a called num\n");
newCall->to = g_strdup(call_get_number(selectedCall));
newCall->from = g_strconcat("\"\" <", call_get_number(selectedCall), ">",NULL);
newCall->state = CALL_STATE_DIALING;
newCall->callID = g_new0(gchar, 30);
g_sprintf(newCall->callID, "%d", rand());
newCall->_start = 0;
newCall->_stop = 0;
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), FALSE);
printf("call : from : %s to %s\n", newCall->from, newCall->to);
call_list_add(current_calls, newCall);
update_call_tree_add(current_calls, newCall);
sflphone_place_call(newCall);
}else
newCall->to = g_strdup(call_get_number(selectedCall));
newCall->from = g_strconcat("\"\" <", call_get_number(selectedCall), ">",NULL);
newCall->state = CALL_STATE_DIALING;
newCall->callID = g_new0(gchar, 30);
g_sprintf(newCall->callID, "%d", rand());
newCall->_start = 0;
newCall->_stop = 0;
printf("call : from : %s to %s\n", newCall->from, newCall->to);
call_list_add(current_calls, newCall);
update_call_tree_add(current_calls, newCall);
sflphone_place_call(newCall);
if( active_calltree == history ) switch_tab();
}
else
{
sflphone_new_call();
if( active_calltree == history ) switch_tab();
}
}
else
{
sflphone_new_call();
if( active_calltree == history ) switch_tab();
}
}
/**
......@@ -196,6 +213,7 @@ call_mailbox( GtkWidget* widget , gpointer data )
update_call_tree_add( current_calls , mailboxCall );
update_menus();
sflphone_place_call( mailboxCall );
if( active_calltree == history ) switch_tab();
}
void
......@@ -209,13 +227,13 @@ toolbar_update_buttons ()
gtk_widget_set_sensitive( GTK_WIDGET(unholdButton), FALSE);
g_object_ref(holdButton);
g_object_ref(unholdButton);
gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(holdButton));
gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(unholdButton));
if( is_inserted( GTK_WIDGET(holdButton) ) ) gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(holdButton));
if( is_inserted( GTK_WIDGET(unholdButton) ) ) gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(unholdButton));
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), holdButton, 3);
g_object_ref(callButton);
g_object_ref(pickupButton);
gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton));
gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(pickupButton));
if( is_inserted( GTK_WIDGET(callButton) ) ) gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(callButton));
if( is_inserted( GTK_WIDGET(pickupButton) ) ) gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(pickupButton));
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), callButton, 0);
......
......@@ -112,7 +112,7 @@ call_state_cb (DBusGProxy *proxy,
(void) time(&c->_stop);
update_call_tree( history, c );
}
g_print("from dbus: "); stop_notification();
stop_notification();
sflphone_hung_up (c);
update_call_tree( history, c );
}
......
......@@ -239,21 +239,24 @@ remove_from_history( void * foo )
static void
call_back( void * foo )
{
call_t* c = call_get_selected( history );
if( c )
call_t* selectedCall = call_get_selected( history );
call_t* newCall = g_new0 (call_t, 1);
if( selectedCall )
{
if(!c->to){
c->to = call_get_number(c);
c->from = g_strconcat("\"\" <", c->to, ">",NULL);
}
newCall->to = g_strdup(call_get_number(selectedCall));
newCall->from = g_strconcat("\"\" <", call_get_number(selectedCall), ">",NULL);
newCall->state = CALL_STATE_DIALING;
newCall->callID = g_new0(gchar, 30);
g_sprintf(newCall->callID, "%d", rand());
newCall->_start = 0;
newCall->_stop = 0;
call_list_add(current_calls, newCall);
update_call_tree_add(current_calls, newCall);
sflphone_place_call(newCall);
switch_tab();
printf("call : from : %s to %s\n", c->from, c->to);
call_list_add(current_calls, c);
update_call_tree_add(current_calls, c);
sflphone_place_call(c);
}
}
GtkWidget *
create_call_menu()
{
......@@ -534,7 +537,6 @@ view_dialpad (GtkImageMenuItem *imagemenuitem,
{
gboolean state;
main_window_dialpad( &state );
g_print("State of the damn thing %i\n" , state);
if( state )
gtk_image_menu_item_set_image( GTK_IMAGE_MENU_ITEM ( dialpadMenu ),
gtk_image_new_from_file( ICONS_DIR "/icon_dialpad_off.svg"));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment