aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-call.c
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-09-07 22:54:29 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-09-08 19:26:25 +0800
commitee02c5c89132db72e5cd987cd443cd09202b6f5b (patch)
tree183b2e2e378e63ba453f2ef8ff756a0b2ffa840e /src/empathy-call.c
parentd5136f90339362d53d780700808dc055fc0a7121 (diff)
downloadgsoc2013-empathy-ee02c5c89132db72e5cd987cd443cd09202b6f5b.tar
gsoc2013-empathy-ee02c5c89132db72e5cd987cd443cd09202b6f5b.tar.gz
gsoc2013-empathy-ee02c5c89132db72e5cd987cd443cd09202b6f5b.tar.bz2
gsoc2013-empathy-ee02c5c89132db72e5cd987cd443cd09202b6f5b.tar.lz
gsoc2013-empathy-ee02c5c89132db72e5cd987cd443cd09202b6f5b.tar.xz
gsoc2013-empathy-ee02c5c89132db72e5cd987cd443cd09202b6f5b.tar.zst
gsoc2013-empathy-ee02c5c89132db72e5cd987cd443cd09202b6f5b.zip
Let the existing call window know about new incoming calls
https://bugzilla.gnome.org/show_bug.cgi?id=580794
Diffstat (limited to 'src/empathy-call.c')
-rw-r--r--src/empathy-call.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/empathy-call.c b/src/empathy-call.c
index a5e463ba3..1b643dec1 100644
--- a/src/empathy-call.c
+++ b/src/empathy-call.c
@@ -70,6 +70,42 @@ call_window_destroyed_cb (GtkWidget *window,
g_application_release (G_APPLICATION (app));
}
+static gboolean
+find_window_for_handle (gpointer key,
+ gpointer value,
+ gpointer user_data)
+{
+ EmpathyContact *contact = key;
+ guint handle = GPOINTER_TO_UINT (user_data);
+
+ if (handle == empathy_contact_get_handle (contact))
+ return TRUE;
+
+ return FALSE;
+}
+
+static gboolean
+incoming_call_cb (EmpathyCallFactory *factory,
+ guint handle,
+ TpyCallChannel *channel,
+ TpChannelDispatchOperation *dispatch_operation,
+ TpAddDispatchOperationContext *context,
+ gpointer user_data)
+{
+ EmpathyCallWindow *window = g_hash_table_find (call_windows,
+ find_window_for_handle, GUINT_TO_POINTER (handle));
+
+ if (window != NULL)
+ {
+ /* The window takes care of accepting or rejecting the context. */
+ empathy_call_window_start_ringing (window,
+ channel, dispatch_operation, context);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
new_call_handler_cb (EmpathyCallFactory *factory,
EmpathyCallHandler *handler,
@@ -123,6 +159,8 @@ activate_cb (GApplication *application)
g_signal_connect (G_OBJECT (call_factory), "new-call-handler",
G_CALLBACK (new_call_handler_cb), NULL);
+ g_signal_connect (G_OBJECT (call_factory), "incoming-call",
+ G_CALLBACK (incoming_call_cb), NULL);
if (!empathy_call_factory_register (call_factory, &error))
{