[empathy] Move the FsElementElementAddedNotifier over the main pipeline



commit 21be2be89095c754e8ddc96a666735eb48f7e7ee
Author: Olivier Crête <olivier crete collabora co uk>
Date:   Fri Jul 31 20:10:34 2009 -0400

    Move the FsElementElementAddedNotifier over the main pipeline

 libempathy/empathy-call-handler.c |   32 --------------------------------
 src/empathy-call-window.c         |   31 ++++++++++++++++++++++++++++++-
 2 files changed, 30 insertions(+), 33 deletions(-)
---
diff --git a/libempathy/empathy-call-handler.c b/libempathy/empathy-call-handler.c
index 09ea5a1..72c317b 100644
--- a/libempathy/empathy-call-handler.c
+++ b/libempathy/empathy-call-handler.c
@@ -27,8 +27,6 @@
 #include <telepathy-farsight/channel.h>
 #include <telepathy-farsight/stream.h>
 
-#include <gst/farsight/fs-element-added-notifier.h>
-
 #include "empathy-call-handler.h"
 #include "empathy-dispatcher.h"
 #include "empathy-marshal.h"
@@ -65,7 +63,6 @@ typedef struct {
   TfChannel *tfchannel;
   gboolean initial_audio;
   gboolean initial_video;
-  FsElementAddedNotifier *fsnotifier;
 } EmpathyCallHandlerPriv;
 
 #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyCallHandler)
@@ -98,12 +95,6 @@ empathy_call_handler_dispose (GObject *object)
 
   priv->call = NULL;
 
-  if (priv->fsnotifier != NULL)
-    {
-      g_object_unref (priv->fsnotifier);
-    }
-  priv->fsnotifier = NULL;
-
   /* release any references held by the object here */
   if (G_OBJECT_CLASS (empathy_call_handler_parent_class)->dispose)
     G_OBJECT_CLASS (empathy_call_handler_parent_class)->dispose (object);
@@ -326,29 +317,6 @@ empathy_call_handler_tf_channel_session_created_cb (TfChannel *tfchannel,
   FsConference *conference, FsParticipant *participant,
   EmpathyCallHandler *self)
 {
-  EmpathyCallHandlerPriv *priv = GET_PRIV (self);
-  GKeyFile *keyfile;
-  gchar *filename;
-  GError *error = NULL;
-
-  priv->fsnotifier = fs_element_added_notifier_new ();
-  fs_element_added_notifier_add (priv->fsnotifier, GST_BIN (conference));
-
-  keyfile = g_key_file_new ();
-  filename = empathy_file_lookup ("element-properties", "data");
-  if (g_key_file_load_from_file (keyfile, filename, G_KEY_FILE_NONE, &error))
-    {
-      fs_element_added_notifier_set_properties_from_keyfile (priv->fsnotifier,
-          keyfile);
-    }
-  else
-    {
-      g_warning ("Could not load element-properties file: %s", error->message);
-      g_key_file_free (keyfile);
-      g_clear_error (&error);
-    }
-  g_free (filename);
-
   g_signal_emit (G_OBJECT (self), signals[CONFERENCE_ADDED], 0,
     GST_ELEMENT (conference));
 }
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index bd958aa..f3219d4 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -31,6 +31,8 @@
 
 #include <telepathy-farsight/channel.h>
 
+#include <gst/farsight/fs-element-added-notifier.h>
+
 #include <libempathy/empathy-tp-contact-factory.h>
 #include <libempathy/empathy-call-factory.h>
 #include <libempathy/empathy-utils.h>
@@ -153,6 +155,8 @@ struct _EmpathyCallWindowPriv
   GstElement *funnel;
   GstElement *liveadder;
 
+  FsElementAddedNotifier *fsnotifier;
+
   guint context_id;
 
   GTimer *timer;
@@ -678,6 +682,8 @@ empathy_call_window_init (EmpathyCallWindow *self)
   GtkWidget *page;
   GstBus *bus;
   gchar *filename;
+  GKeyFile *keyfile;
+  GError *error = NULL;
 
   filename = empathy_file_lookup ("empathy-call-window.ui", "src");
   gui = empathy_builder_get_file (filename,
@@ -694,6 +700,7 @@ empathy_call_window_init (EmpathyCallWindow *self)
     "ui_manager", &priv->ui_manager,
     "menufullscreen", &priv->menu_fullscreen,
     NULL);
+  g_free (filename);
 
   empathy_builder_connect (gui, self,
     "menuhangup", "activate", empathy_call_window_hangup_cb,
@@ -722,6 +729,25 @@ empathy_call_window_init (EmpathyCallWindow *self)
   bus = gst_pipeline_get_bus (GST_PIPELINE (priv->pipeline));
   gst_bus_add_watch (bus, empathy_call_window_bus_message, self);
 
+  priv->fsnotifier = fs_element_added_notifier_new ();
+  fs_element_added_notifier_add (priv->fsnotifier, GST_BIN (priv->pipeline));
+
+  keyfile = g_key_file_new ();
+  filename = empathy_file_lookup ("element-properties", "data");
+  if (g_key_file_load_from_file (keyfile, filename, G_KEY_FILE_NONE, &error))
+    {
+      fs_element_added_notifier_set_properties_from_keyfile (priv->fsnotifier,
+          keyfile);
+    }
+  else
+    {
+      g_warning ("Could not load element-properties file: %s", error->message);
+      g_key_file_free (keyfile);
+      g_clear_error (&error);
+    }
+  g_free (filename);
+
+
   priv->remote_user_output_frame = gtk_frame_new (NULL);
   gtk_widget_set_size_request (priv->remote_user_output_frame,
       EMPATHY_VIDEO_WIDGET_DEFAULT_WIDTH, EMPATHY_VIDEO_WIDGET_DEFAULT_HEIGHT);
@@ -800,7 +826,6 @@ empathy_call_window_init (EmpathyCallWindow *self)
 
   g_object_ref (priv->ui_manager);
   g_object_unref (gui);
-  g_free (filename);
 }
 
 /* Instead of specifying a width and a height, we specify only one size. That's
@@ -1064,6 +1089,10 @@ empathy_call_window_dispose (GObject *object)
     g_object_unref (priv->video_tee);
   priv->video_tee = NULL;
 
+  if (priv->fsnotifier != NULL)
+    g_object_unref (priv->fsnotifier);
+  priv->fsnotifier = NULL;
+
   if (priv->timer_id != 0)
     g_source_remove (priv->timer_id);
   priv->timer_id = 0;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]