]> git.0d.be Git - empathy.git/blobdiff - src/empathy-call-handler.c
Updated Spanish translation
[empathy.git] / src / empathy-call-handler.c
index 33ae9c709f8e05b1dbc49a020c572de03c683260..2935c2a7ca2b1bd1382a06e302d05805b382a527 100644 (file)
  */
 
 #include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <telepathy-glib/account-channel-request.h>
-#include <telepathy-glib/util.h>
-#include <telepathy-glib/interfaces.h>
+#include "empathy-call-handler.h"
 
 #include <telepathy-farstream/telepathy-farstream.h>
 
-#include <libempathy/empathy-utils.h>
-#include <libempathy/empathy-tp-contact-factory.h>
-
-#include <libempathy-gtk/empathy-call-utils.h>
-
-#include "empathy-call-handler.h"
+#include "empathy-call-utils.h"
+#include "empathy-utils.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_VOIP
-#include <libempathy/empathy-debug.h>
+#include "empathy-debug.h"
 
 G_DEFINE_TYPE(EmpathyCallHandler, empathy_call_handler, G_TYPE_OBJECT)
 
@@ -62,7 +52,6 @@ enum {
   PROP_CALL_CHANNEL = 1,
   PROP_GST_BUS,
   PROP_CONTACT,
-  PROP_INITIAL_AUDIO,
   PROP_INITIAL_VIDEO,
   PROP_SEND_AUDIO_CODEC,
   PROP_SEND_VIDEO_CODEC,
@@ -81,7 +70,6 @@ struct _EmpathyCallHandlerPriv {
 
   EmpathyContact *contact;
   TfChannel *tfchannel;
-  gboolean initial_audio;
   gboolean initial_video;
 
   FsCodec *send_audio_codec;
@@ -180,6 +168,20 @@ on_call_state_changed_cb (TpCallChannel *call,
 {
   EmpathyCallHandlerPriv *priv = handler->priv;
 
+  /* Clean up the TfChannel before bubbling the state-change signal
+   * further up. This ensures that the conference-removed signal is
+   * emitted before state-changed so that the client gets a chance
+   * to remove the conference from the pipeline before resetting the
+   * pipeline itself.
+   */
+  if (state == TP_CALL_STATE_ENDED)
+    {
+      tp_channel_close_async (TP_CHANNEL (call), NULL, NULL);
+      priv->accept_when_initialised = FALSE;
+      tp_clear_object (&priv->call);
+      tp_clear_object (&priv->tfchannel);
+    }
+
   g_signal_emit (handler, signals[STATE_CHANGED], 0, state,
       reason->dbus_reason);
 
@@ -189,14 +191,6 @@ on_call_state_changed_cb (TpCallChannel *call,
       tp_call_channel_accept_async (priv->call, on_call_accepted_cb, NULL);
       priv->accept_when_initialised = FALSE;
     }
-
-  if (state == TP_CALL_STATE_ENDED)
-    {
-      tp_channel_close_async (TP_CHANNEL (call), NULL, NULL);
-      priv->accept_when_initialised = FALSE;
-      tp_clear_object (&priv->call);
-      tp_clear_object (&priv->tfchannel);
-    }
 }
 
 static void
@@ -220,9 +214,6 @@ empathy_call_handler_set_property (GObject *object,
         tp_g_signal_connect_object (priv->call, "invalidated",
           G_CALLBACK (on_call_invalidated_cb), object, 0);
         break;
-      case PROP_INITIAL_AUDIO:
-        priv->initial_audio = g_value_get_boolean (value);
-        break;
       case PROP_INITIAL_VIDEO:
         priv->initial_video = g_value_get_boolean (value);
         break;
@@ -245,9 +236,6 @@ empathy_call_handler_get_property (GObject *object,
       case PROP_CALL_CHANNEL:
         g_value_set_object (value, priv->call);
         break;
-      case PROP_INITIAL_AUDIO:
-        g_value_set_boolean (value, priv->initial_audio);
-        break;
       case PROP_INITIAL_VIDEO:
         g_value_set_boolean (value, priv->initial_video);
         break;
@@ -306,13 +294,6 @@ empathy_call_handler_class_init (EmpathyCallHandlerClass *klass)
     G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
   g_object_class_install_property (object_class, PROP_CALL_CHANNEL, param_spec);
 
-  param_spec = g_param_spec_boolean ("initial-audio",
-    "initial-audio", "Whether the call should start with audio",
-    TRUE,
-    G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
-  g_object_class_install_property (object_class, PROP_INITIAL_AUDIO,
-      param_spec);
-
   param_spec = g_param_spec_boolean ("initial-video",
     "initial-video", "Whether the call should start with video",
     FALSE,
@@ -906,7 +887,6 @@ empathy_call_handler_start_call (EmpathyCallHandler *handler,
   EmpathyCallHandlerPriv *priv = GET_PRIV (handler);
   TpAccountChannelRequest *req;
   TpAccount *account;
-  GHashTable *request;
 
   if (priv->call != NULL)
     {
@@ -936,17 +916,14 @@ empathy_call_handler_start_call (EmpathyCallHandler *handler,
   g_assert (priv->contact != NULL);
 
   account = empathy_contact_get_account (priv->contact);
-  request = empathy_call_create_call_request (
-      empathy_contact_get_id (priv->contact),
-      priv->initial_audio, priv->initial_video);
 
-  req = tp_account_channel_request_new (account, request, timestamp);
+  req = empathy_call_create_call_request (account,
+      empathy_contact_get_id (priv->contact), priv->initial_video, timestamp);
 
   tp_account_channel_request_create_and_handle_channel_async (req, NULL,
       empathy_call_handler_request_cb, handler);
 
   g_object_unref (req);
-  g_hash_table_unref (request);
 }
 
 /**