[empathy/gnome-2-34] Use target-contact instead of members



commit ac766b706727ba8efdcb6132cd426d4882a82581
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Wed Feb 23 11:38:54 2011 +0000

    Use target-contact instead of members

 src/empathy-call-window.c |   74 +++++++++++----------------------------------
 1 files changed, 18 insertions(+), 56 deletions(-)
---
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 6ba257b..04da287 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -101,7 +101,6 @@ struct _EmpathyCallWindowPriv
   gboolean dispose_has_run;
   EmpathyCallHandler *handler;
 
-  GArray *members;
   EmpathyContact *contact;
 
   guint call_state;
@@ -1289,45 +1288,22 @@ empathy_call_window_setup_avatars (EmpathyCallWindow *self,
     EmpathyCallHandler *handler)
 {
   EmpathyCallWindowPriv *priv = GET_PRIV (self);
+  TpConnection *connection;
 
-  g_object_get (handler, "members", &(priv->members), NULL);
+  g_signal_connect (priv->contact, "notify::name",
+      G_CALLBACK (contact_name_changed_cb), self);
+  g_signal_connect (priv->contact, "notify::avatar",
+    G_CALLBACK (contact_avatar_changed_cb),
+    priv->remote_user_avatar_widget);
 
-  if (priv->members != NULL)
-    {
-      TpConnection *connection;
-
-      if (priv->members->len == 1)
-        {
-          priv->contact = g_array_index (priv->members, EmpathyContact *, 0);
-          g_signal_connect (priv->contact, "notify::name",
-              G_CALLBACK (contact_name_changed_cb), self);
-          g_signal_connect (priv->contact, "notify::avatar",
-              G_CALLBACK (contact_avatar_changed_cb),
-              priv->remote_user_avatar_widget);
-
-          /* Retreiving the self avatar */
-          connection = empathy_contact_get_connection (priv->contact);
-          empathy_tp_contact_factory_get_from_handle (connection,
-              tp_connection_get_self_handle (connection),
-              empathy_call_window_got_self_contact_cb, self, NULL,
-              G_OBJECT (self));
-        }
-
-      set_window_title (self);
-    }
-  else
-    {
-      g_warning ("call handler doesn't have a contact");
-      /* translators: Call is a noun. This string is used in the window
-       * title */
-      gtk_window_set_title (GTK_WINDOW (self), _("Call"));
+  /* Retrieving the self avatar */
+  connection = empathy_contact_get_connection (priv->contact);
+  empathy_tp_contact_factory_get_from_handle (connection,
+      tp_connection_get_self_handle (connection),
+      empathy_call_window_got_self_contact_cb, self, NULL,
+      G_OBJECT (self));
 
-      /* Since we can't access the remote contact, we can't get a connection
-         to it and can't get the self contact (and its avatar). This means
-         that we have to manually set the self avatar. */
-      init_contact_avatar_with_size (NULL, priv->self_user_avatar_widget,
-          MIN (SELF_VIDEO_SECTION_WIDTH, SELF_VIDEO_SECTION_HEIGTH));
-    }
+  set_window_title (self);
 
   init_contact_avatar_with_size (priv->contact,
       priv->remote_user_avatar_widget,
@@ -1562,6 +1538,9 @@ empathy_call_window_constructed (GObject *object)
   if (call != NULL)
     g_object_unref (call);
 
+  g_object_get (priv->handler, "target-contact", &priv->contact, NULL);
+  g_assert (priv->contact != NULL);
+
   empathy_call_window_setup_avatars (self, priv->handler);
   empathy_call_window_set_state_connecting (self);
 
@@ -1699,13 +1678,6 @@ empathy_call_window_dispose (GObject *object)
       priv->contact = NULL;
     }
 
-#if 0
-  if (priv->members != NULL)
-    {
-      g_list_free_full (priv->members, g_object_unref);
-      priv->members = NULL;
-    }
-#endif
 
   G_OBJECT_CLASS (empathy_call_window_parent_class)->dispose (object);
 }
@@ -2419,7 +2391,8 @@ empathy_call_window_connected (gpointer user_data)
 
   empathy_sound_stop (EMPATHY_SOUND_PHONE_OUTGOING);
 
-  can_send_video = priv->video_input != NULL && priv->members != NULL &&
+
+  can_send_video = priv->video_input != NULL &&
     empathy_contact_can_voip_video (priv->contact);
 
   g_object_get (priv->handler, "call-channel", &call, NULL);
@@ -2768,14 +2741,6 @@ call_handler_notify_call_cb (EmpathyCallHandler *handler,
 }
 
 static void
-on_call_members_changed_cb (EmpathyCallHandler *handler,
-    GParamSpec *spec,
-    EmpathyCallWindow *self)
-{
-  empathy_call_window_setup_avatars (self, handler);
-}
-
-static void
 empathy_call_window_realized_cb (GtkWidget *widget, EmpathyCallWindow *window)
 {
   EmpathyCallWindowPriv *priv = GET_PRIV (window);
@@ -2794,9 +2759,6 @@ empathy_call_window_realized_cb (GtkWidget *widget, EmpathyCallWindow *window)
   g_signal_connect (priv->handler, "sink-pad-removed",
     G_CALLBACK (empathy_call_window_sink_removed_cb), window);
 
-  g_signal_connect (priv->handler, "notify::members",
-    G_CALLBACK (on_call_members_changed_cb), window);
-
   g_object_get (priv->handler, "call-channel", &call, NULL);
   if (call != NULL)
     {



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