]> git.0d.be Git - empathy.git/commitdiff
Move a couple of call-related functions to empathy-utils.h
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Wed, 9 Feb 2011 16:48:34 +0000 (16:48 +0000)
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Thu, 10 Feb 2011 09:24:55 +0000 (09:24 +0000)
Since the rest of the call stuff will only be compiled for
empathy-av so we don't link every binary against farsight.

libempathy-gtk/empathy-contact-menu.c
libempathy-gtk/empathy-individual-menu.c
libempathy/empathy-streamed-media-factory.c
libempathy/empathy-streamed-media-factory.h
libempathy/empathy-streamed-media-handler.c
libempathy/empathy-utils.c
libempathy/empathy-utils.h

index ac5d98f48c03caef8210560e178e41fbd2ee3d33..cff1bf4e5b405044afc952355e4b0d5ecc3c7067 100644 (file)
@@ -27,7 +27,6 @@
 #include <gtk/gtk.h>
 #include <telepathy-logger/log-manager.h>
 
-#include <libempathy/empathy-streamed-media-factory.h>
 #include <libempathy/empathy-contact-manager.h>
 #include <libempathy/empathy-dispatcher.h>
 #include <libempathy/empathy-utils.h>
@@ -248,8 +247,8 @@ empathy_contact_audio_call_menu_item_activated (GtkMenuItem *item,
        EmpathyContact *contact)
 {
 
-       empathy_streamed_media_factory_new_call_with_streams (contact, TRUE, FALSE,
-               gtk_get_current_event_time (), NULL);
+       empathy_call_new_with_streams (contact, TRUE, FALSE,
+               gtk_get_current_event_time ());
 }
 
 GtkWidget *
@@ -279,8 +278,8 @@ static void
 empathy_contact_video_call_menu_item_activated (GtkMenuItem *item,
        EmpathyContact *contact)
 {
-       empathy_streamed_media_factory_new_call_with_streams (contact, TRUE, TRUE,
-               gtk_get_current_event_time (), NULL);
+       empathy_call_new_with_streams (contact, TRUE, TRUE,
+               gtk_get_current_event_time ());
 }
 
 GtkWidget *
index faa4ff6aaa7073c07a1649d60388a9bfb416de19..1dc4633307271f7459fb782b4eb6ffdd6d2526ac 100644 (file)
@@ -31,7 +31,6 @@
 #include <folks/folks.h>
 #include <folks/folks-telepathy.h>
 
-#include <libempathy/empathy-streamed-media-factory.h>
 #include <libempathy/empathy-dispatcher.h>
 #include <libempathy/empathy-individual-manager.h>
 #include <libempathy/empathy-chatroom-manager.h>
@@ -543,8 +542,8 @@ empathy_individual_audio_call_menu_item_activated (GtkMenuItem *item,
 {
   g_return_if_fail (EMPATHY_IS_CONTACT (contact));
 
-  empathy_streamed_media_factory_new_call_with_streams (contact, TRUE, FALSE,
-      gtk_get_current_event_time (), NULL);
+  empathy_call_new_with_streams (contact, TRUE, FALSE,
+      gtk_get_current_event_time ());
 }
 
 GtkWidget *
@@ -585,8 +584,8 @@ empathy_individual_video_call_menu_item_activated (GtkMenuItem *item,
 {
   g_return_if_fail (EMPATHY_IS_CONTACT (contact));
 
-  empathy_streamed_media_factory_new_call_with_streams (contact, TRUE, TRUE,
-      gtk_get_current_event_time (), NULL);
+  empathy_call_new_with_streams (contact, TRUE, TRUE,
+      gtk_get_current_event_time ());
 }
 
 GtkWidget *
index 7e77855469e6553f8ad614d9d1c3c3b9fd732778..7c4dca763a729ac3290629eb981eb24d6fcb1501 100644 (file)
@@ -192,73 +192,6 @@ empathy_streamed_media_factory_get (void)
   return EMPATHY_STREAMED_MEDIA_FACTORY (call_factory);
 }
 
-GHashTable *
-empathy_streamed_media_factory_create_request (EmpathyContact *contact,
-    gboolean initial_audio,
-    gboolean initial_video)
-{
-  return 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_HANDLE, G_TYPE_UINT,
-        empathy_contact_get_handle (contact),
-      TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_AUDIO, G_TYPE_BOOLEAN,
-        initial_audio,
-      TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_VIDEO, G_TYPE_BOOLEAN,
-        initial_video,
-      NULL);
-}
-
-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);
-    }
-}
-
-/**
- * empathy_streamed_media_factory_new_call_with_streams:
- * @factory: an #EmpathyStreamedMediaFactory
- * @contact: an #EmpathyContact
- * @initial_audio: if %TRUE the call will be started with audio
- * @initial_video: if %TRUE the call will be started with video
- *
- * Initiate a new call with @contact.
- */
-void
-empathy_streamed_media_factory_new_call_with_streams (EmpathyContact *contact,
-    gboolean initial_audio,
-    gboolean initial_video,
-    gint64 timestamp,
-    gpointer user_data)
-{
-  GHashTable *request;
-  TpAccount *account;
-  TpAccountChannelRequest *req;
-
-  request = empathy_streamed_media_factory_create_request (contact, initial_audio,
-      initial_video);
-
-  account = empathy_contact_get_account (contact);
-
-  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_hash_table_unref (request);
-  g_object_unref (req);
-}
-
 static void
 create_streamed_media_handler (EmpathyStreamedMediaFactory *factory,
   EmpathyTpStreamedMedia *call)
index ab433bb48336d3dfa19b5569cb9b649d3994612a..b1fbfaf1e7764ea53e3cce0e8cfffb5f62015253 100644 (file)
@@ -64,19 +64,9 @@ EmpathyStreamedMediaFactory *empathy_streamed_media_factory_initialise (void);
 
 EmpathyStreamedMediaFactory *empathy_streamed_media_factory_get (void);
 
-void empathy_streamed_media_factory_new_call_with_streams (EmpathyContact *contact,
-  gboolean initial_audio,
-  gboolean initial_video,
-  gint64 timestamp,
-  gpointer user_data);
-
 gboolean empathy_streamed_media_factory_register (EmpathyStreamedMediaFactory *self,
     GError **error);
 
-GHashTable * empathy_streamed_media_factory_create_request (EmpathyContact *contact,
-    gboolean initial_audio,
-    gboolean initial_video);
-
 G_END_DECLS
 
 #endif /* #ifndef __EMPATHY_STREAMED_MEDIA_FACTORY_H__*/
index 152cf644ecd3d8a18cd59aae70a4c681f9d7be7b..6172376a00873e7b2f9431a840cff85d73bc898a 100644 (file)
@@ -30,7 +30,6 @@
 #include <telepathy-farsight/stream.h>
 
 #include "empathy-streamed-media-handler.h"
-#include "empathy-streamed-media-factory.h"
 #include "empathy-marshal.h"
 #include "empathy-utils.h"
 
@@ -806,7 +805,7 @@ empathy_streamed_media_handler_start_call (EmpathyStreamedMediaHandler *handler,
   g_assert (priv->contact != NULL);
 
   account = empathy_contact_get_account (priv->contact);
-  request = empathy_streamed_media_factory_create_request (priv->contact,
+  request = empathy_call_create_streamed_media_request (priv->contact,
       priv->initial_audio, priv->initial_video);
 
   req = tp_account_channel_request_new (account, request, timestamp);
index d089c6fd55b3c6459c59bfc0731cfd87243252c5..b23071a2985ecf873efcd0b2a49c19ddb63fc7c8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2003-2007 Imendio AB
- * Copyright (C) 2007-2008 Collabora Ltd.
+ * Copyright (C) 2007-2011 Collabora Ltd.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -237,6 +237,66 @@ empathy_xml_node_find_child_prop_value (xmlNodePtr   node,
        return found;
 }
 
+GHashTable *
+empathy_call_create_streamed_media_request (EmpathyContact *contact,
+                                           gboolean initial_audio,
+                                           gboolean initial_video)
+{
+       return 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_HANDLE, G_TYPE_UINT,
+                       empathy_contact_get_handle (contact),
+               TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_AUDIO, G_TYPE_BOOLEAN,
+                       initial_audio,
+               TP_PROP_CHANNEL_TYPE_STREAMED_MEDIA_INITIAL_VIDEO, G_TYPE_BOOLEAN,
+                       initial_video,
+               NULL);
+}
+
+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 StreamedMedia channel: %s", error->message);
+               g_error_free (error);
+       }
+}
+
+void
+empathy_call_new_with_streams (EmpathyContact *contact,
+                              gboolean initial_audio,
+                              gboolean initial_video,
+                              gint64 timestamp)
+{
+       GHashTable *request;
+       TpAccount *account;
+       TpAccountChannelRequest *req;
+
+       request = empathy_call_create_streamed_media_request (contact,
+                                                             initial_audio,
+                                                             initial_video);
+
+       account = empathy_contact_get_account (contact);
+
+       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_hash_table_unref (request);
+       g_object_unref (req);
+}
+
 const gchar *
 empathy_presence_get_default_message (TpConnectionPresenceType presence)
 {
index f0ac666ede4c179abeacd28d245c39825eaa1c11..0f5f968a55526e5c4da1798a79451d66b19c2ff7 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
 /*
  * Copyright (C) 2003-2007 Imendio AB
- * Copyright (C) 2007-2008 Collabora Ltd.
+ * Copyright (C) 2007-2011 Collabora Ltd.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -66,6 +66,15 @@ xmlNodePtr   empathy_xml_node_find_child_prop_value (xmlNodePtr       node,
                                                    const gchar     *prop_name,
                                                    const gchar     *prop_value);
 
+/* Calls */
+void         empathy_call_new_with_streams             (EmpathyContact *contact,
+                                                        gboolean initial_audio,
+                                                        gboolean initial_video,
+                                                        gint64 timestamp);
+GHashTable * empathy_call_create_streamed_media_request (EmpathyContact *contact,
+                                                        gboolean initial_audio,
+                                                        gboolean initial_video);
+
 /* Others */
 const gchar * empathy_presence_get_default_message  (TpConnectionPresenceType presence);
 const gchar * empathy_presence_to_str               (TpConnectionPresenceType presence);