aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-06-22 21:45:06 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-06-22 21:45:06 +0800
commit89ca74a938a753c1137cc9f008619805622e490c (patch)
tree2ca1af7a4cad99bbb60af904f210d0bc0f7a0ada /libempathy-gtk
parentd22972c5b30ef8b771a148e57d80a9f4d54424c8 (diff)
downloadgsoc2013-empathy-89ca74a938a753c1137cc9f008619805622e490c.tar
gsoc2013-empathy-89ca74a938a753c1137cc9f008619805622e490c.tar.gz
gsoc2013-empathy-89ca74a938a753c1137cc9f008619805622e490c.tar.bz2
gsoc2013-empathy-89ca74a938a753c1137cc9f008619805622e490c.tar.lz
gsoc2013-empathy-89ca74a938a753c1137cc9f008619805622e490c.tar.xz
gsoc2013-empathy-89ca74a938a753c1137cc9f008619805622e490c.tar.zst
gsoc2013-empathy-89ca74a938a753c1137cc9f008619805622e490c.zip
new-call-dialog: create the AV channel using the TargetID so we don't have to wait for the EmpathyContact
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-new-call-dialog.c65
1 files changed, 22 insertions, 43 deletions
diff --git a/libempathy-gtk/empathy-new-call-dialog.c b/libempathy-gtk/empathy-new-call-dialog.c
index c266f895a..27ec3a2cd 100644
--- a/libempathy-gtk/empathy-new-call-dialog.c
+++ b/libempathy-gtk/empathy-new-call-dialog.c
@@ -68,49 +68,32 @@ struct _EmpathyNewCallDialogPriv {
* to be started with any contact on any enabled account.
*/
-typedef struct
-{
- gboolean video;
- gint64 timestamp;
-} new_call_ctx;
-
-static new_call_ctx *
-new_call_ctx_new (gboolean video,
- gint64 timestamp)
-{
- new_call_ctx *ctx = g_slice_new (new_call_ctx);
-
- ctx->video = video;
- ctx->timestamp = timestamp;
- return ctx;
-}
-
static void
-new_call_ctx_free (new_call_ctx *ctx)
-{
- g_slice_free (new_call_ctx, ctx);
-}
-
-static void
-got_contact_cb (TpConnection *connection,
- EmpathyContact *contact,
- const GError *error,
- gpointer user_data,
- GObject *object)
+call_contact (TpConnection *connection,
+ const gchar *contact_id,
+ gboolean video,
+ gint64 timestamp)
{
- EmpathyCallFactory *call_factory;
- new_call_ctx *ctx = user_data;
+ EmpathyDispatcher *dispatcher;
+ GHashTable *request;
+
+ request = tp_asv_new (
+ TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
+ TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA,
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT,
+ TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, contact_id,
+ TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_AUDIO, G_TYPE_BOOLEAN,
+ TRUE,
+ TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_VIDEO, G_TYPE_BOOLEAN,
+ video,
+ NULL);
- if (error != NULL)
- {
- DEBUG ("Failed: %s", error->message);
- return;
- }
+ dispatcher = empathy_dispatcher_dup_singleton ();
- call_factory = empathy_call_factory_get ();
+ empathy_dispatcher_create_channel (dispatcher, connection, request,
+ timestamp, NULL, NULL);
- empathy_call_factory_new_call_with_streams (call_factory, contact, TRUE,
- ctx->video, ctx->timestamp, NULL, NULL);
+ g_object_unref (dispatcher);
}
static void
@@ -120,7 +103,6 @@ empathy_new_call_dialog_response (GtkDialog *dialog, int response_id)
gboolean video;
TpConnection *connection;
const gchar *contact_id;
- new_call_ctx *ctx;
if (response_id != GTK_RESPONSE_ACCEPT) goto out;
@@ -133,10 +115,7 @@ empathy_new_call_dialog_response (GtkDialog *dialog, int response_id)
* we return from this function. */
video = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->check_video));
- ctx = new_call_ctx_new (video, gtk_get_current_event_time ());
-
- empathy_tp_contact_factory_get_from_id (connection, contact_id,
- got_contact_cb, ctx, (GDestroyNotify) new_call_ctx_free, NULL);
+ call_contact (connection, contact_id, video, gtk_get_current_event_time ());
out:
gtk_widget_destroy (GTK_WIDGET (dialog));