Commit 19793ffa authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin

Better transfert button

parent d61e3719
......@@ -171,6 +171,9 @@ sflphone_hang_up()
case CALL_STATE_INCOMING:
dbus_refuse (selectedCall);
break;
case CALL_STATE_TRANSFERT:
dbus_hang_up (selectedCall);
break;
default:
g_warning("Should not happen!");
break;
......@@ -196,6 +199,9 @@ sflphone_pick_up()
case CALL_STATE_HOLD:
dbus_unhold (selectedCall);
break;
case CALL_STATE_TRANSFERT:
dbus_transfert (selectedCall);
break;
default:
g_warning("Should not happen!");
break;
......@@ -279,8 +285,23 @@ sflphone_set_transfert()
update_call_tree(c);
update_menus();
}
toolbar_update_buttons();
}
void
sflphone_unset_transfert()
{
call_t * c = call_get_selected();
if(c)
{
c->state = CALL_STATE_CURRENT;
c->to = g_strdup("");
screen_set_call(c);
update_call_tree(c);
update_menus();
}
toolbar_update_buttons();
}
void
sflphone_incoming_call (call_t * c)
{
......@@ -432,7 +453,7 @@ sflphone_keypad( guint keyval, gchar * key)
dbus_transfert(c);
break;
case 65307: /* ESCAPE */
sflphone_current(c); // Quit transfert
sflphone_hang_up(c);
break;
default: // When a call is on transfert, typing new numbers will add it to c->to
process_dialing(c, keyval, key);
......
......@@ -52,6 +52,7 @@ void sflphone_off_hold ();
call_t * sflphone_new_call();
void sflphone_notify_voice_mail (guint count);
void sflphone_set_transfert();
void sflphone_unset_transfert();
/**
* Accept / dial the current call
*/
......
......@@ -33,6 +33,7 @@ GtkToolItem * hangupButton;
GtkToolItem * holdButton;
GtkToolItem * transfertButton;
GtkToolItem * unholdButton;
guint transfertButtonConnId; //The button toggled signal connection ID
/**
* Make a call
......@@ -74,9 +75,18 @@ hold( GtkWidget *widget, gpointer data )
* Transfert the line
*/
static void
transfert( GtkWidget *widget, gpointer data )
transfert (GtkToggleToolButton *toggle_tool_button,
gpointer user_data)
{
sflphone_set_transfert();
gboolean up = gtk_toggle_tool_button_get_active(toggle_tool_button);
if(up)
{
sflphone_set_transfert();
}
else
{
sflphone_unset_transfert();
}
}
/**
......@@ -103,6 +113,10 @@ toolbar_update_buttons ()
gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(unholdButton));
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), holdButton, 3);
gtk_signal_handler_block(GTK_OBJECT(transfertButton),transfertButtonConnId);
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transfertButton), FALSE);
gtk_signal_handler_unblock(transfertButton, transfertButtonConnId);
call_t * selectedCall = call_get_selected();
if (selectedCall)
{
......@@ -138,6 +152,16 @@ toolbar_update_buttons ()
case CALL_STATE_FAILURE:
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
break;
case CALL_STATE_TRANSFERT:
gtk_signal_handler_block(GTK_OBJECT(transfertButton),transfertButtonConnId);
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transfertButton), TRUE);
gtk_signal_handler_unblock(transfertButton, transfertButtonConnId);
gtk_widget_set_sensitive( GTK_WIDGET(callButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(pickupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(holdButton), TRUE);
gtk_widget_set_sensitive( GTK_WIDGET(transfertButton), TRUE);
break;
default:
g_warning("Should not happen!");
break;
......@@ -252,9 +276,11 @@ create_toolbar (){
gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(holdButton), -1);
image = gtk_image_new_from_file( ICONS_DIR "/transfert.svg");
transfertButton = gtk_tool_button_new (image, "Transfert");
transfertButton = gtk_toggle_tool_button_new ();
gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(transfertButton), image);
gtk_tool_button_set_label(GTK_TOOL_BUTTON(transfertButton), "Transfert");
gtk_widget_set_state( GTK_WIDGET(transfertButton), GTK_STATE_INSENSITIVE);
g_signal_connect (G_OBJECT (transfertButton), "clicked",
transfertButtonConnId = g_signal_connect (G_OBJECT (transfertButton), "toggled",
G_CALLBACK (transfert), NULL);
gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(transfertButton), -1);
......
Markdown is supported
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