aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-08-04 17:23:18 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-08-05 17:08:23 +0800
commit1b603a6d7dcc0a46544b8f34baa1610195e8f6c7 (patch)
tree762b2c90d3f6495ff1ccc9430c2187a189f69abd
parenta27087fda3a50d3454384bfa3664f79a17ac3f0a (diff)
downloadgsoc2013-empathy-1b603a6d7dcc0a46544b8f34baa1610195e8f6c7.tar
gsoc2013-empathy-1b603a6d7dcc0a46544b8f34baa1610195e8f6c7.tar.gz
gsoc2013-empathy-1b603a6d7dcc0a46544b8f34baa1610195e8f6c7.tar.bz2
gsoc2013-empathy-1b603a6d7dcc0a46544b8f34baa1610195e8f6c7.tar.lz
gsoc2013-empathy-1b603a6d7dcc0a46544b8f34baa1610195e8f6c7.tar.xz
gsoc2013-empathy-1b603a6d7dcc0a46544b8f34baa1610195e8f6c7.tar.zst
gsoc2013-empathy-1b603a6d7dcc0a46544b8f34baa1610195e8f6c7.zip
call-window: use candidates-changed signal
-rw-r--r--src/empathy-call-window.c116
1 files changed, 37 insertions, 79 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 67c13065d..16c93bb5b 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -1498,51 +1498,12 @@ candidate_type_to_desc (FsCandidate *candidate)
return NULL;
}
-
static void
-update_candidate (EmpathyCallWindow *self,
- gboolean video,
- gboolean remote)
+update_candidat_widget (EmpathyCallWindow *self,
+ GtkWidget *widget,
+ FsCandidate *candidate)
{
- EmpathyCallWindowPriv *priv = GET_PRIV (self);
- GtkWidget *widget;
gchar *str;
- FsCandidate *candidate = NULL;
-
- if (video)
- {
- if (remote)
- {
- widget = priv->video_remote_candidate_label;
-
- candidate = empathy_call_handler_get_video_remote_candidate (
- priv->handler);
- }
- else
- {
- widget = priv->video_local_candidate_label;
-
- candidate = empathy_call_handler_get_video_local_candidate (
- priv->handler);
- }
- }
- else
- {
- if (remote)
- {
- widget = priv->audio_remote_candidate_label;
-
- candidate = empathy_call_handler_get_audio_remote_candidate (
- priv->handler);
- }
- else
- {
- widget = priv->audio_local_candidate_label;
-
- candidate = empathy_call_handler_get_audio_local_candidate (
- priv->handler);
- }
- }
g_assert (candidate != NULL);
str = g_strdup_printf ("%s %u (%s)", candidate->ip,
@@ -1555,43 +1516,45 @@ update_candidate (EmpathyCallWindow *self,
}
static void
-audio_remote_candidate_notify_cb (GObject *object,
- GParamSpec *pspec,
- gpointer user_data)
+candidates_changed_cb (GObject *object,
+ FsMediaType type,
+ EmpathyCallWindow *self)
{
- EmpathyCallWindow *self = user_data;
+ EmpathyCallWindowPriv *priv = GET_PRIV (self);
+ FsCandidate *candidate = NULL;
- update_candidate (self, FALSE, TRUE);
-}
+ if (type == FS_MEDIA_TYPE_VIDEO)
+ {
+ /* Update remote candidate */
+ candidate = empathy_call_handler_get_video_remote_candidate (
+ priv->handler);
-static void
-audio_local_candidate_notify_cb (GObject *object,
- GParamSpec *pspec,
- gpointer user_data)
-{
- EmpathyCallWindow *self = user_data;
+ update_candidat_widget (self, priv->video_remote_candidate_label,
+ candidate);
- update_candidate (self, FALSE, FALSE);
-}
+ /* Update local candidate */
+ candidate = empathy_call_handler_get_video_local_candidate (
+ priv->handler);
-static void
-video_remote_candidate_notify_cb (GObject *object,
- GParamSpec *pspec,
- gpointer user_data)
-{
- EmpathyCallWindow *self = user_data;
+ update_candidat_widget (self, priv->video_local_candidate_label,
+ candidate);
+ }
+ else
+ {
+ /* Update remote candidate */
+ candidate = empathy_call_handler_get_audio_remote_candidate (
+ priv->handler);
- update_candidate (self, TRUE, TRUE);
-}
+ update_candidat_widget (self, priv->audio_remote_candidate_label,
+ candidate);
-static void
-video_local_candidate_notify_cb (GObject *object,
- GParamSpec *pspec,
- gpointer user_data)
-{
- EmpathyCallWindow *self = user_data;
+ /* Update local candidate */
+ candidate = empathy_call_handler_get_audio_local_candidate (
+ priv->handler);
- update_candidate (self, TRUE, FALSE);
+ update_candidat_widget (self, priv->audio_local_candidate_label,
+ candidate);
+ }
}
static void
@@ -1632,14 +1595,9 @@ empathy_call_window_constructed (GObject *object)
G_CALLBACK (recv_audio_codecs_notify_cb), self, 0);
tp_g_signal_connect_object (priv->handler, "notify::recv-video-codecs",
G_CALLBACK (recv_video_codecs_notify_cb), self, 0);
- tp_g_signal_connect_object (priv->handler, "notify::audio-remote-candidate",
- G_CALLBACK (audio_remote_candidate_notify_cb), self, 0);
- tp_g_signal_connect_object (priv->handler, "notify::audio-local-candidate",
- G_CALLBACK (audio_local_candidate_notify_cb), self, 0);
- tp_g_signal_connect_object (priv->handler, "notify::video-remote-candidate",
- G_CALLBACK (video_remote_candidate_notify_cb), self, 0);
- tp_g_signal_connect_object (priv->handler, "notify::video-local-candidate",
- G_CALLBACK (video_local_candidate_notify_cb), self, 0);
+
+ tp_g_signal_connect_object (priv->handler, "candidates-changed",
+ G_CALLBACK (candidates_changed_cb), self, 0);
}
static void empathy_call_window_dispose (GObject *object);