aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-03-16 03:06:20 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-03-16 03:21:28 +0800
commit15761dfafa40dce3e5acb2f9fecc5b808fa11e47 (patch)
tree5b1774c1f3a1c479a63841364a989e60606461bd
parentd07f730181b12a13b7af86f9095a7b6c86648e10 (diff)
downloadgsoc2013-empathy-15761dfafa40dce3e5acb2f9fecc5b808fa11e47.tar
gsoc2013-empathy-15761dfafa40dce3e5acb2f9fecc5b808fa11e47.tar.gz
gsoc2013-empathy-15761dfafa40dce3e5acb2f9fecc5b808fa11e47.tar.bz2
gsoc2013-empathy-15761dfafa40dce3e5acb2f9fecc5b808fa11e47.tar.lz
gsoc2013-empathy-15761dfafa40dce3e5acb2f9fecc5b808fa11e47.tar.xz
gsoc2013-empathy-15761dfafa40dce3e5acb2f9fecc5b808fa11e47.tar.zst
gsoc2013-empathy-15761dfafa40dce3e5acb2f9fecc5b808fa11e47.zip
Don't start the Call when the streams start
Since that can happen before the call is accepted. Instead of that, wait for the Call state to be ACCEPTED.
-rw-r--r--src/empathy-call-handler.c9
-rw-r--r--src/empathy-call-window.c28
2 files changed, 24 insertions, 13 deletions
diff --git a/src/empathy-call-handler.c b/src/empathy-call-handler.c
index 752405727..e35afbde7 100644
--- a/src/empathy-call-handler.c
+++ b/src/empathy-call-handler.c
@@ -51,6 +51,7 @@ enum {
SINK_PAD_REMOVED,
CLOSED,
CANDIDATES_CHANGED,
+ STATE_CHANGED,
LAST_SIGNAL
};
@@ -176,6 +177,8 @@ on_call_state_changed_cb (TpyCallChannel *call,
{
if (state == TPY_CALL_STATE_ENDED)
tp_channel_close_async (TP_CHANNEL (call), NULL, NULL);
+
+ g_signal_emit (handler, signals[STATE_CHANGED], 0, state);
}
static void
@@ -469,6 +472,12 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass)
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
g_cclosure_marshal_VOID__UINT,
G_TYPE_NONE, 1, G_TYPE_UINT);
+
+ signals[STATE_CHANGED] =
+ g_signal_new ("state-changed", G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST, 0, NULL, NULL,
+ g_cclosure_marshal_VOID__UINT,
+ G_TYPE_NONE, 1, G_TYPE_UINT);
}
EmpathyCallHandler *
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 6db01d2ef..282e0f9a9 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -2297,16 +2297,25 @@ empathy_call_window_video_stream_error (TpyCallChannel *call,
}
#endif
-static gboolean
-empathy_call_window_connected (gpointer user_data)
+static void
+empathy_call_window_state_changed_cb (EmpathyCallHandler *handler,
+ TpyCallState state,
+ EmpathyCallWindow *self)
{
- EmpathyCallWindow *self = EMPATHY_CALL_WINDOW (user_data);
EmpathyCallWindowPriv *priv = GET_PRIV (self);
TpyCallChannel *call;
gboolean can_send_video;
- empathy_sound_stop (EMPATHY_SOUND_PHONE_OUTGOING);
+ if (state != TPY_CALL_STATE_ACCEPTED)
+ return;
+
+ if (priv->call_state == CONNECTED)
+ return;
+ g_timer_start (priv->timer);
+ priv->call_state = CONNECTED;
+
+ empathy_sound_stop (EMPATHY_SOUND_PHONE_OUTGOING);
can_send_video = priv->video_input != NULL &&
empathy_contact_can_voip_video (priv->contact);
@@ -2348,8 +2357,6 @@ empathy_call_window_connected (gpointer user_data)
empathy_call_window_update_timer (self);
gtk_action_set_sensitive (priv->menu_fullscreen, TRUE);
-
- return FALSE;
}
static gboolean
@@ -2376,13 +2383,6 @@ empathy_call_window_src_added_cb (EmpathyCallHandler *handler,
g_mutex_lock (priv->lock);
- if (priv->call_state != CONNECTED)
- {
- g_timer_start (priv->timer);
- priv->timer_id = g_idle_add (empathy_call_window_connected, self);
- priv->call_state = CONNECTED;
- }
-
switch (media_type)
{
case TP_MEDIA_STREAM_TYPE_AUDIO:
@@ -2671,6 +2671,8 @@ empathy_call_window_realized_cb (GtkWidget *widget, EmpathyCallWindow *window)
EmpathyCallWindowPriv *priv = GET_PRIV (window);
TpyCallChannel *call;
+ g_signal_connect (priv->handler, "state-changed",
+ G_CALLBACK (empathy_call_window_state_changed_cb), window);
g_signal_connect (priv->handler, "conference-added",
G_CALLBACK (empathy_call_window_conference_added_cb), window);
g_signal_connect (priv->handler, "conference-removed",