diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-01-20 21:32:43 +0800 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-01-27 17:46:39 +0800 |
commit | 1af2b9b657046268d0a44fd2aa588ea281ad1f20 (patch) | |
tree | 58dd291b5604ddaabe7bb61a941eead306ab89c8 /src | |
parent | 25a44d2984058a38f54ab6bd68027e524342e34b (diff) | |
download | gsoc2013-empathy-1af2b9b657046268d0a44fd2aa588ea281ad1f20.tar gsoc2013-empathy-1af2b9b657046268d0a44fd2aa588ea281ad1f20.tar.gz gsoc2013-empathy-1af2b9b657046268d0a44fd2aa588ea281ad1f20.tar.bz2 gsoc2013-empathy-1af2b9b657046268d0a44fd2aa588ea281ad1f20.tar.lz gsoc2013-empathy-1af2b9b657046268d0a44fd2aa588ea281ad1f20.tar.xz gsoc2013-empathy-1af2b9b657046268d0a44fd2aa588ea281ad1f20.tar.zst gsoc2013-empathy-1af2b9b657046268d0a44fd2aa588ea281ad1f20.zip |
Port DTMF code to new tp-glib API
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-call-window.c | 71 |
1 files changed, 8 insertions, 63 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 1802b01a8..dc3c65358 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -202,10 +202,6 @@ struct _EmpathyCallWindowPriv gulong video_output_motion_handler_id; guint bus_message_source_id; - /* String that contains the queued tones to send after the current ones - are sent */ - GString *tones; - gboolean sending_tones; GtkWidget *dtmf_panel; /* Details vbox */ @@ -348,60 +344,20 @@ empathy_call_window_video_call_cb (GtkToggleToolButton *button, } static void -empathy_call_window_emit_tones (EmpathyCallWindow *self) -{ - TpChannel *channel; - - if (tp_str_empty (self->priv->tones->str)) - return; - - g_object_get (self->priv->handler, "call-channel", &channel, NULL); - - DEBUG ("Emitting multiple tones: %s", self->priv->tones->str); - - tp_cli_channel_interface_dtmf_call_multiple_tones (channel, -1, - self->priv->tones->str, - NULL, NULL, NULL, NULL); - - self->priv->sending_tones = TRUE; - - g_string_set_size (self->priv->tones, 0); - - g_object_unref (channel); -} - -static void -empathy_call_window_maybe_emit_tones (EmpathyCallWindow *self) -{ - if (self->priv->sending_tones) - return; - - empathy_call_window_emit_tones (self); -} - -static void -empathy_call_window_tones_stopped_cb (TpChannel *proxy, - gboolean arg_cancelled, - gpointer user_data, - GObject *weak_object) -{ - EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data); - - self->priv->sending_tones = FALSE; - - empathy_call_window_emit_tones (self); -} - -static void dtmf_start_tone_cb (EmpathyDialpadWidget *dialpad, TpDTMFEvent event, EmpathyCallWindow *self) { - EmpathyCallWindowPriv *priv = GET_PRIV (self); + TpCallChannel *call; + gchar tones[2]; - g_string_append_c (priv->tones, tp_dtmf_event_to_char (event)); + g_object_get (self->priv->handler, "call-channel", &call, NULL); - empathy_call_window_maybe_emit_tones (self); + tones[0] = tp_dtmf_event_to_char (event); + tones[1] = '\0'; + tp_call_channel_send_tones_async (call, tones, NULL, NULL, NULL); + + g_object_unref (call); } static void @@ -1819,8 +1775,6 @@ empathy_call_window_init (EmpathyCallWindow *self) g_signal_connect (priv->dtmf_panel, "start-tone", G_CALLBACK (dtmf_start_tone_cb), self); - priv->tones = g_string_new (""); - gtk_box_pack_start (GTK_BOX (priv->pane), priv->dtmf_panel, FALSE, FALSE, 6); @@ -2445,8 +2399,6 @@ empathy_call_window_finalize (GObject *object) g_timer_destroy (priv->timer); - g_string_free (priv->tones, TRUE); - G_OBJECT_CLASS (empathy_call_window_parent_class)->finalize (object); } @@ -2598,9 +2550,6 @@ empathy_call_window_disconnected (EmpathyCallWindow *self, gtk_action_set_sensitive (priv->menu_fullscreen, FALSE); gtk_widget_set_sensitive (priv->dtmf_panel, FALSE); - priv->sending_tones = FALSE; - g_string_set_size (priv->tones, 0); - could_reset_pipeline = empathy_call_window_reset_pipeline (self); if (priv->call_state == CONNECTING) @@ -3779,10 +3728,6 @@ call_handler_notify_call_cb (EmpathyCallHandler *handler, tp_g_signal_connect_object (call, "members-changed", G_CALLBACK (empathy_call_window_members_changed_cb), self, 0); - tp_cli_channel_interface_dtmf_connect_to_stopped_tones (TP_CHANNEL (call), - empathy_call_window_tones_stopped_cb, self, NULL, - G_OBJECT (call), NULL); - g_object_unref (call); } |