diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index adcbbcc52a7d444690b8301198e7c23ede9ae1e2..f4471f97cf1368075b023cd688d60086af2b99a3 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -257,11 +257,17 @@ sflphone_current( call_t * c ) } void -sflphone_transfert( call_t * c, gchar * to ) +sflphone_set_transfert() { - screen_clear(); - update_call_tree_remove(c); - update_menus(); + call_t * c = call_get_selected(); + if(c) + { + c->state = CALL_STATE_TRANSFERT; + c->to = g_strdup(""); + screen_set_call(c); + update_call_tree(c); + update_menus(); + } } void @@ -301,8 +307,11 @@ void process_dialing(call_t * c, guint keyval, gchar * key) g_free(before); g_print("TO: %s\n", c->to); - g_free(c->from); - c->from = g_strconcat("\"\" <", c->to, ">", NULL); + if(c->state == CALL_STATE_DIALING) + { + g_free(c->from); + c->from = g_strconcat("\"\" <", c->to, ">", NULL); + } screen_set_call(c); update_call_tree(c); } @@ -326,8 +335,11 @@ void process_dialing(call_t * c, guint keyval, gchar * key) g_free(before); g_print("TO: %s\n", c->to); - g_free(c->from); - c->from = g_strconcat("\"\" <", c->to, ">", NULL); + if(c->state == CALL_STATE_DIALING) + { + g_free(c->from); + c->from = g_strconcat("\"\" <", c->to, ">", NULL); + } screen_set_call(c); update_call_tree(c); } @@ -401,6 +413,21 @@ sflphone_keypad( guint keyval, gchar * key) break; } break; + case CALL_STATE_TRANSFERT: + switch (keyval) + { + case 65293: /* ENTER */ + case 65421: /* ENTER numpad */ + dbus_transfert(c); + break; + case 65307: /* ESCAPE */ + sflphone_current(c); // Quit transfert + break; + default: // When a call is on transfert, typing new numbers will add it to c->to + process_dialing(c, keyval, key); + break; + } + break; case CALL_STATE_HOLD: switch (keyval) { diff --git a/sflphone-gtk/src/actions.h b/sflphone-gtk/src/actions.h index d5f10a21aaf6ebec3f88480c73ce9b1d40058f6c..b3fa14953c653e07e0b05ba16e6d720277c55cd3 100644 --- a/sflphone-gtk/src/actions.h +++ b/sflphone-gtk/src/actions.h @@ -51,17 +51,12 @@ void sflphone_on_hold (); void sflphone_off_hold (); call_t * sflphone_new_call(); void sflphone_notify_voice_mail (guint count); - +void sflphone_set_transfert(); /** * Accept / dial the current call */ void sflphone_pick_up (); -/** - * Transfert the call - */ -void sflphone_transfert ( call_t * c, gchar * to ); - /** * Put the call on hold state */ diff --git a/sflphone-gtk/src/calllist.h b/sflphone-gtk/src/calllist.h index fb5620e8e00f920f0760591d2b9733eebe8c878e..5ee5f793e7a1b65b993eb36a074cfe9f1120d569 100644 --- a/sflphone-gtk/src/calllist.h +++ b/sflphone-gtk/src/calllist.h @@ -44,7 +44,9 @@ typedef enum /** Call has failed */ CALL_STATE_FAILURE, /** Call is busy */ - CALL_STATE_BUSY + CALL_STATE_BUSY, + /** Call is being transfert. During this state, the user can enter the new number. */ + CALL_STATE_TRANSFERT } call_state_t; diff --git a/sflphone-gtk/src/calltree.c b/sflphone-gtk/src/calltree.c index 16184409332a7e3f0ea9bcd735b93ea3326d4045..506fc2f76ce2eb80bc00dd384c13ceb683684e58 100644 --- a/sflphone-gtk/src/calltree.c +++ b/sflphone-gtk/src/calltree.c @@ -75,11 +75,7 @@ hold( GtkWidget *widget, gpointer data ) static void transfert( GtkWidget *widget, gpointer data ) { - call_t * c = (call_t*) call_list_get_by_state (CALL_STATE_CURRENT); - if(c) - { - dbus_transfert(c,"124"); - } + sflphone_set_transfert(); } /** @@ -135,7 +131,7 @@ update_buttons () gtk_widget_set_sensitive( GTK_WIDGET(hangupButton), TRUE); break; default: - g_error("Should not happen!"); + g_warning("Should not happen!"); break; } } @@ -189,7 +185,7 @@ void row_activated(GtkTreeView *tree_view, sflphone_place_call (selectedCall); break; default: - g_error("Should not happen!"); + g_warning("Should not happen!"); break; } } @@ -363,10 +359,22 @@ update_call_tree (call_t * c) { // Existing call in the list gchar * markup; - markup = g_markup_printf_escaped("<b>%s</b>\n" + if(c->state == CALL_STATE_TRANSFERT) + { + markup = g_markup_printf_escaped("<b>%s</b>\n" + "%s\n<i>Transfert to:</i> %s", + call_get_name(c), + call_get_number(c), + c->to); + } + else + { + markup = g_markup_printf_escaped("<b>%s</b>\n" "%s", call_get_name(c), call_get_number(c)); + } + switch(c->state) { @@ -388,8 +396,11 @@ update_call_tree (call_t * c) case CALL_STATE_BUSY: pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/busy.svg", NULL); break; + case CALL_STATE_TRANSFERT: + pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/transfert.svg", NULL); + break; default: - g_error("Should not happen!"); + g_warning("Should not happen!"); } //Resize it if(pixbuf) @@ -444,7 +455,7 @@ update_call_tree_add (call_t * c) pixbuf = gdk_pixbuf_new_from_file(ICONS_DIR "/ring.svg", NULL); break; default: - g_error("Should not happen!"); + g_warning("Should not happen!"); } //Resize it diff --git a/sflphone-gtk/src/dbus.c b/sflphone-gtk/src/dbus.c index 96df7384ce0a87b93dd922d62fe304e732e6c453..89ac1fae4039c0477de5341dc039939ff4dc6bdc 100644 --- a/sflphone-gtk/src/dbus.c +++ b/sflphone-gtk/src/dbus.c @@ -295,10 +295,10 @@ dbus_hang_up (const call_t * c) } void -dbus_transfert (const call_t * c, gchar * to ) +dbus_transfert (const call_t * c) { GError *error = NULL; - org_sflphone_SFLphone_CallManager_transfert ( callManagerProxy, c->callID, to, &error); + org_sflphone_SFLphone_CallManager_transfert ( callManagerProxy, c->callID, c->to, &error); if (error) { g_printerr ("Failed to call transfert() on CallManager: %s\n", diff --git a/sflphone-gtk/src/dbus.h b/sflphone-gtk/src/dbus.h index 1da6c7af1208fda589d7649314f919fc5ff34f68..ff22f9d29c5ae1151c2ea9ecd9cb88e0636f27f5 100644 --- a/sflphone-gtk/src/dbus.h +++ b/sflphone-gtk/src/dbus.h @@ -35,7 +35,7 @@ void dbus_clean (); void dbus_hold (const call_t * c ); void dbus_unhold (const call_t * c ); void dbus_hang_up (const call_t * c ); -void dbus_transfert (const call_t * c, gchar * to ); +void dbus_transfert (const call_t * c); void dbus_accept (const call_t * c); void dbus_refuse (const call_t * c); void dbus_place_call (const call_t * c); diff --git a/sflphone-gtk/src/menus.c b/sflphone-gtk/src/menus.c index 62264b2208ac90da9077f49b4cd8363e074427da..5b89997688cab555a7c2aaa237ba8c9f7bb4bf1a 100644 --- a/sflphone-gtk/src/menus.c +++ b/sflphone-gtk/src/menus.c @@ -75,7 +75,7 @@ void update_menus() gtk_widget_set_sensitive( GTK_WIDGET(hangUpMenu), TRUE); break; default: - g_error("Should not happen!"); + g_warning("Should not happen!"); break; } }