diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-05-02 06:02:45 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-05-02 06:02:45 +0800 |
commit | 16bb46bc5b1efb53ea813e3e1351fbbdc8b02fe3 (patch) | |
tree | 580679ed3b5fcb1f878534a82fa848c806639aa5 | |
parent | 462dafe161910a7f7f82a05caf6a0b8949158e44 (diff) | |
download | gsoc2013-empathy-16bb46bc5b1efb53ea813e3e1351fbbdc8b02fe3.tar gsoc2013-empathy-16bb46bc5b1efb53ea813e3e1351fbbdc8b02fe3.tar.gz gsoc2013-empathy-16bb46bc5b1efb53ea813e3e1351fbbdc8b02fe3.tar.bz2 gsoc2013-empathy-16bb46bc5b1efb53ea813e3e1351fbbdc8b02fe3.tar.lz gsoc2013-empathy-16bb46bc5b1efb53ea813e3e1351fbbdc8b02fe3.tar.xz gsoc2013-empathy-16bb46bc5b1efb53ea813e3e1351fbbdc8b02fe3.tar.zst gsoc2013-empathy-16bb46bc5b1efb53ea813e3e1351fbbdc8b02fe3.zip |
Implement DTMF.
svn path=/trunk/; revision=1071
-rw-r--r-- | libempathy/empathy-tp-call.c | 36 | ||||
-rw-r--r-- | libempathy/empathy-tp-call.h | 2 | ||||
-rw-r--r-- | src/empathy-call-window.c | 52 |
3 files changed, 88 insertions, 2 deletions
diff --git a/libempathy/empathy-tp-call.c b/libempathy/empathy-tp-call.c index 4c3779f28..32debb8b3 100644 --- a/libempathy/empathy-tp-call.c +++ b/libempathy/empathy-tp-call.c @@ -348,9 +348,7 @@ tp_call_async_cb (TpProxy *proxy, GObject *call) { if (error) - { DEBUG ("Error %s: %s", (gchar*) user_data, error->message); - } } static void @@ -813,3 +811,37 @@ empathy_tp_call_mute_input (EmpathyTpCall *call, G_OBJECT (call)); } +void +empathy_tp_call_start_tone (EmpathyTpCall *call, TpDTMFEvent event) +{ + EmpathyTpCallPriv *priv = GET_PRIV (call); + + g_return_if_fail (EMPATHY_IS_TP_CALL (call)); + g_return_if_fail (priv->status != EMPATHY_TP_CALL_STATUS_ACCEPTED); + + if (!priv->audio->exists) + return; + + tp_cli_channel_interface_dtmf_call_start_tone (priv->channel, -1, + priv->audio->id, event, + (tp_cli_channel_interface_dtmf_callback_for_start_tone) tp_call_async_cb, + "starting tone", NULL, G_OBJECT (call)); +} + +void +empathy_tp_call_stop_tone (EmpathyTpCall *call) +{ + EmpathyTpCallPriv *priv = GET_PRIV (call); + + g_return_if_fail (EMPATHY_IS_TP_CALL (call)); + g_return_if_fail (priv->status != EMPATHY_TP_CALL_STATUS_ACCEPTED); + + if (!priv->audio->exists) + return; + + tp_cli_channel_interface_dtmf_call_stop_tone (priv->channel, -1, + priv->audio->id, + (tp_cli_channel_interface_dtmf_callback_for_stop_tone) tp_call_async_cb, + "stoping tone", NULL, G_OBJECT (call)); +} + diff --git a/libempathy/empathy-tp-call.h b/libempathy/empathy-tp-call.h index 17c5abd25..18378baa3 100644 --- a/libempathy/empathy-tp-call.h +++ b/libempathy/empathy-tp-call.h @@ -83,6 +83,8 @@ void empathy_tp_call_add_output_video (EmpathyTpCall *call, void empathy_tp_call_set_output_volume (EmpathyTpCall *call, guint volume); void empathy_tp_call_mute_output (EmpathyTpCall *call, gboolean is_muted); void empathy_tp_call_mute_input (EmpathyTpCall *call, gboolean is_muted); +void empathy_tp_call_start_tone (EmpathyTpCall *call, TpDTMFEvent event); +void empathy_tp_call_stop_tone (EmpathyTpCall *call); G_END_DECLS diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 7c1f7e66f..cddb11433 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -418,6 +418,44 @@ call_window_update (EmpathyCallWindow *window) g_object_unref (contact); } +static gboolean +call_window_dtmf_button_release_event_cb (GtkWidget *widget, + GdkEventButton *event, + EmpathyCallWindow *window) +{ + empathy_tp_call_stop_tone (window->call); + return FALSE; +} + +static gboolean +call_window_dtmf_button_press_event_cb (GtkWidget *widget, + GdkEventButton *event, + EmpathyCallWindow *window) +{ + TpDTMFEvent dtmf_event; + + dtmf_event = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (widget), "code")); + empathy_tp_call_start_tone (window->call, dtmf_event); + return FALSE; +} + +static void +call_window_dtmf_connect (GladeXML *glade, + EmpathyCallWindow *window, + const gchar *name, + TpDTMFEvent event) +{ + GtkWidget *widget; + + widget = glade_xml_get_widget (glade, name); + g_object_set_data (G_OBJECT (widget), "code", GUINT_TO_POINTER (event)); + g_signal_connect (widget, "button-press-event", + G_CALLBACK (call_window_dtmf_button_press_event_cb), window); + g_signal_connect (widget, "button-release-event", + G_CALLBACK (call_window_dtmf_button_release_event_cb), window); + /* FIXME: Connect "key-[press/release]-event" to*/ +} + GtkWidget * empathy_call_window_new (EmpathyTpCall *call) { @@ -453,6 +491,20 @@ empathy_call_window_new (EmpathyTpCall *call) "video_button", "toggled", call_window_video_button_toggled_cb, NULL); + /* Setup DTMF buttons */ + call_window_dtmf_connect (glade, window, "button_0", TP_DTMF_EVENT_DIGIT_0); + call_window_dtmf_connect (glade, window, "button_1", TP_DTMF_EVENT_DIGIT_1); + call_window_dtmf_connect (glade, window, "button_2", TP_DTMF_EVENT_DIGIT_2); + call_window_dtmf_connect (glade, window, "button_3", TP_DTMF_EVENT_DIGIT_3); + call_window_dtmf_connect (glade, window, "button_4", TP_DTMF_EVENT_DIGIT_4); + call_window_dtmf_connect (glade, window, "button_5", TP_DTMF_EVENT_DIGIT_5); + call_window_dtmf_connect (glade, window, "button_6", TP_DTMF_EVENT_DIGIT_6); + call_window_dtmf_connect (glade, window, "button_7", TP_DTMF_EVENT_DIGIT_7); + call_window_dtmf_connect (glade, window, "button_8", TP_DTMF_EVENT_DIGIT_8); + call_window_dtmf_connect (glade, window, "button_9", TP_DTMF_EVENT_DIGIT_9); + call_window_dtmf_connect (glade, window, "button_asterisk", TP_DTMF_EVENT_ASTERISK); + call_window_dtmf_connect (glade, window, "button_hash", TP_DTMF_EVENT_HASH); + g_object_unref (glade); /* Output volume button */ |