aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-02-19 00:26:28 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2011-02-23 22:50:43 +0800
commit93bb7636ec40f000d7de9ae97fe888a9427b0868 (patch)
treeff3514293d5444e6d1b42e5a49e59c9a966716c7
parentc605f0006a5a08743fbbf4279e7df9d858381d01 (diff)
downloadgsoc2013-empathy-93bb7636ec40f000d7de9ae97fe888a9427b0868.tar
gsoc2013-empathy-93bb7636ec40f000d7de9ae97fe888a9427b0868.tar.gz
gsoc2013-empathy-93bb7636ec40f000d7de9ae97fe888a9427b0868.tar.bz2
gsoc2013-empathy-93bb7636ec40f000d7de9ae97fe888a9427b0868.tar.lz
gsoc2013-empathy-93bb7636ec40f000d7de9ae97fe888a9427b0868.tar.xz
gsoc2013-empathy-93bb7636ec40f000d7de9ae97fe888a9427b0868.tar.zst
gsoc2013-empathy-93bb7636ec40f000d7de9ae97fe888a9427b0868.zip
NewCallDialog: support Calls
-rw-r--r--libempathy-gtk/Makefile.am2
-rw-r--r--libempathy-gtk/empathy-new-call-dialog.c77
2 files changed, 43 insertions, 36 deletions
diff --git a/libempathy-gtk/Makefile.am b/libempathy-gtk/Makefile.am
index 9e2671cd4..058ca8569 100644
--- a/libempathy-gtk/Makefile.am
+++ b/libempathy-gtk/Makefile.am
@@ -11,6 +11,7 @@ AM_CPPFLAGS = \
$(GTK_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
$(CANBERRA_CFLAGS) \
+ $(YELL_CFLAGS) \
$(ENCHANT_CFLAGS) \
$(LIBCHAMPLAIN_CFLAGS) \
$(GEOCLUE_CFLAGS) \
@@ -163,6 +164,7 @@ nodist_libempathy_gtk_la_SOURCES =\
libempathy_gtk_la_LIBADD = \
$(EMPATHY_LIBS) \
+ $(EMPATHY_LIBS) \
$(GTK_LIBS) \
$(LIBNOTIFY_LIBS) \
$(CANBERRA_LIBS) \
diff --git a/libempathy-gtk/empathy-new-call-dialog.c b/libempathy-gtk/empathy-new-call-dialog.c
index 2d35fadec..3f0264660 100644
--- a/libempathy-gtk/empathy-new-call-dialog.c
+++ b/libempathy-gtk/empathy-new-call-dialog.c
@@ -28,6 +28,10 @@
#include <telepathy-glib/interfaces.h>
+#if HAVE_CALL
+#include <telepathy-yell/telepathy-yell.h>
+#endif
+
#include <libempathy/empathy-tp-contact-factory.h>
#include <libempathy/empathy-contact-manager.h>
#include <libempathy/empathy-utils.h>
@@ -53,6 +57,11 @@ typedef struct {
gpointer user_data;
} FilterCallbackData;
+typedef struct {
+ gboolean video;
+ gint64 timestamp;
+} ContactCallbackData;
+
struct _EmpathyNewCallDialogPriv {
GtkWidget *check_video;
};
@@ -61,21 +70,6 @@ struct _EmpathyNewCallDialogPriv {
(G_TYPE_INSTANCE_GET_PRIVATE ((o), EMPATHY_TYPE_NEW_CALL_DIALOG, \
EmpathyNewCallDialogPriv))
-static void
-create_media_channel_cb (GObject *source,
- GAsyncResult *result,
- gpointer user_data)
-{
- GError *error = NULL;
-
- if (!tp_account_channel_request_create_channel_finish (
- TP_ACCOUNT_CHANNEL_REQUEST (source), result, &error))
- {
- DEBUG ("Failed to create media channel: %s", error->message);
- g_error_free (error);
- }
-}
-
/**
* SECTION:empathy-new-call-dialog
* @title: EmpathyNewCallDialog
@@ -87,31 +81,38 @@ create_media_channel_cb (GObject *source,
*/
static void
+got_contact_cb (TpConnection *connection,
+ EmpathyContact *contact,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ ContactCallbackData *data = user_data;
+
+ if (error != NULL)
+ g_warning ("Could not get contact: %s", error->message);
+ else
+ empathy_call_new_with_streams (contact,
+ TRUE, data->video, data->timestamp);
+
+ g_slice_free (ContactCallbackData, data);
+}
+
+static void
call_contact (TpAccount *account,
const gchar *contact_id,
gboolean video,
gint64 timestamp)
{
- GHashTable *request;
- TpAccountChannelRequest *req;
-
- 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);
-
- req = tp_account_channel_request_new (account, request, timestamp);
-
- tp_account_channel_request_create_channel_async (req, NULL, NULL,
- create_media_channel_cb, NULL);
-
- g_object_unref (req);
+ ContactCallbackData *data = g_slice_new0 (ContactCallbackData);
+
+ data->video = video;
+ data->timestamp = timestamp;
+
+ empathy_tp_contact_factory_get_from_id (tp_account_get_connection (account),
+ contact_id,
+ got_contact_cb, data,
+ NULL, NULL);
}
static void
@@ -167,7 +168,11 @@ conn_prepared_cb (GObject *conn,
chan_type = tp_asv_get_string (fixed, TP_PROP_CHANNEL_CHANNEL_TYPE);
- if (tp_strdiff (chan_type, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA))
+ if (tp_strdiff (chan_type, TP_IFACE_CHANNEL_TYPE_STREAMED_MEDIA)
+#if HAVE_CALL
+ && tp_strdiff (chan_type, TPY_IFACE_CHANNEL_TYPE_CALL)
+#endif
+ )
continue;
if (tp_asv_get_uint32 (fixed, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL) !=