]> git.0d.be Git - empathy.git/commitdiff
call-window: display candidates info (#599166)
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 3 Aug 2010 15:00:49 +0000 (17:00 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 5 Aug 2010 09:08:22 +0000 (11:08 +0200)
src/empathy-call-window.c
src/empathy-call-window.ui

index ffdcb5c719dec19a8e99515705a7ab14d33e0085..1d2b0f50934fa9690f5121e2d610c1f14ec09f76 100644 (file)
@@ -173,6 +173,10 @@ struct _EmpathyCallWindowPriv
   GtkWidget *acodec_encoding_label;
   GtkWidget *vcodec_decoding_label;
   GtkWidget *acodec_decoding_label;
+  GtkWidget *audio_remote_candidate_label;
+  GtkWidget *audio_local_candidate_label;
+  GtkWidget *video_remote_candidate_label;
+  GtkWidget *video_local_candidate_label;
 
   GstElement *video_input;
   GstElement *audio_input;
@@ -1051,6 +1055,10 @@ empathy_call_window_init (EmpathyCallWindow *self)
     "acodec_encoding_label", &priv->acodec_encoding_label,
     "acodec_decoding_label", &priv->acodec_decoding_label,
     "vcodec_decoding_label", &priv->vcodec_decoding_label,
+    "audio_remote_candidate_label", &priv->audio_remote_candidate_label,
+    "audio_local_candidate_label", &priv->audio_local_candidate_label,
+    "video_remote_candidate_label", &priv->video_remote_candidate_label,
+    "video_local_candidate_label", &priv->video_local_candidate_label,
     NULL);
   g_free (filename);
 
@@ -1450,6 +1458,119 @@ recv_video_codecs_notify_cb (GObject *object,
   update_recv_codec (self, FALSE);
 }
 
+static const gchar *
+candidate_type_to_str (FsCandidate *candidate)
+{
+  switch (candidate->type)
+    {
+      case FS_CANDIDATE_TYPE_HOST:
+        return "host";
+      case FS_CANDIDATE_TYPE_SRFLX:
+        return "server reflexive";
+      case FS_CANDIDATE_TYPE_PRFLX:
+        return "peer reflexive";
+      case FS_CANDIDATE_TYPE_RELAY:
+        return "relay";
+      case FS_CANDIDATE_TYPE_MULTICAST:
+        return "multicast";
+    }
+
+  return NULL;
+}
+
+static void
+update_candidate (EmpathyCallWindow *self,
+    gboolean video,
+    gboolean remote)
+{
+  EmpathyCallWindowPriv *priv = GET_PRIV (self);
+  GtkWidget *widget;
+  gchar *str;
+  FsCandidate *candidate = NULL;
+
+  if (video)
+    {
+      if (remote)
+        {
+          widget = priv->video_remote_candidate_label;
+
+          candidate = empathy_call_handler_get_video_remote_candidate (
+              priv->handler);
+        }
+      else
+        {
+          widget = priv->video_local_candidate_label;
+
+          candidate = empathy_call_handler_get_video_local_candidate (
+              priv->handler);
+        }
+    }
+  else
+    {
+      if (remote)
+        {
+          widget = priv->audio_remote_candidate_label;
+
+          candidate = empathy_call_handler_get_audio_remote_candidate (
+              priv->handler);
+        }
+      else
+        {
+          widget = priv->audio_local_candidate_label;
+
+          candidate = empathy_call_handler_get_audio_local_candidate (
+              priv->handler);
+        }
+    }
+
+  g_assert (candidate != NULL);
+  str = g_strdup_printf ("%s:%u (%s)", candidate->ip,
+      candidate->port, candidate_type_to_str (candidate));
+
+  gtk_label_set_text (GTK_LABEL (widget), str);
+  g_free (str);
+}
+
+static void
+audio_remote_candidate_notify_cb (GObject *object,
+    GParamSpec *pspec,
+    gpointer user_data)
+{
+  EmpathyCallWindow *self = user_data;
+
+  update_candidate (self, FALSE, TRUE);
+}
+
+static void
+audio_local_candidate_notify_cb (GObject *object,
+    GParamSpec *pspec,
+    gpointer user_data)
+{
+  EmpathyCallWindow *self = user_data;
+
+  update_candidate (self, FALSE, FALSE);
+}
+
+static void
+video_remote_candidate_notify_cb (GObject *object,
+    GParamSpec *pspec,
+    gpointer user_data)
+{
+  EmpathyCallWindow *self = user_data;
+
+  update_candidate (self, TRUE, TRUE);
+}
+
+static void
+video_local_candidate_notify_cb (GObject *object,
+    GParamSpec *pspec,
+    gpointer user_data)
+{
+  EmpathyCallWindow *self = user_data;
+
+  update_candidate (self, TRUE, FALSE);
+}
+
 static void
 empathy_call_window_constructed (GObject *object)
 {
@@ -1488,6 +1609,14 @@ empathy_call_window_constructed (GObject *object)
       G_CALLBACK (recv_audio_codecs_notify_cb), self, 0);
   tp_g_signal_connect_object (priv->handler, "notify::recv-video-codecs",
       G_CALLBACK (recv_video_codecs_notify_cb), self, 0);
+  tp_g_signal_connect_object (priv->handler, "notify::audio-remote-candidate",
+      G_CALLBACK (audio_remote_candidate_notify_cb), self, 0);
+  tp_g_signal_connect_object (priv->handler, "notify::audio-local-candidate",
+      G_CALLBACK (audio_local_candidate_notify_cb), self, 0);
+  tp_g_signal_connect_object (priv->handler, "notify::video-remote-candidate",
+      G_CALLBACK (video_remote_candidate_notify_cb), self, 0);
+  tp_g_signal_connect_object (priv->handler, "notify::video-local-candidate",
+      G_CALLBACK (video_local_candidate_notify_cb), self, 0);
 }
 
 static void empathy_call_window_dispose (GObject *object);
index 781de76d9e53c81bcec00d2ab9a5f135a51ea269..dccabea3584c280835067498b00759dfe1aa7ecb 100644 (file)
       </packing>
           </child>
 
+          <child>
+      <object class="GtkLabel" id="vrc_label">
+        <property name="visible">True</property>
+        <property name="label" translatable="yes">Remote Candidate:</property>
+        <property name="use_underline">False</property>
+        <property name="use_markup">True</property>
+        <property name="justify">GTK_JUSTIFY_LEFT</property>
+        <property name="wrap">False</property>
+        <property name="selectable">False</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0.5</property>
+        <property name="xpad">0</property>
+        <property name="ypad">0</property>
+        <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+        <property name="width_chars">-1</property>
+        <property name="single_line_mode">False</property>
+        <property name="angle">0</property>
+        <attributes>
+                <attribute name="style" value="PANGO_STYLE_ITALIC"/>
+              </attributes>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="right_attach">1</property>
+        <property name="top_attach">3</property>
+        <property name="bottom_attach">4</property>
+        <property name="x_options">fill</property>
+        <property name="y_options"/>
+      </packing>
+          </child>
+
+          <child>
+      <object class="GtkLabel" id="video_remote_candidate_label">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="label" translatable="yes">Unknown</property>
+        <property name="use_underline">False</property>
+        <property name="use_markup">False</property>
+        <property name="justify">GTK_JUSTIFY_LEFT</property>
+        <property name="wrap">False</property>
+        <property name="selectable">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0.5</property>
+        <property name="xpad">0</property>
+        <property name="ypad">0</property>
+        <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
+        <property name="width_chars">-1</property>
+        <property name="single_line_mode">False</property>
+        <property name="angle">0</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="top_attach">3</property>
+        <property name="bottom_attach">4</property>
+        <property name="x_options">expand|shrink|fill</property>
+        <property name="y_options"/>
+      </packing>
+          </child>
+
+          <child>
+      <object class="GtkLabel" id="vlc_label">
+        <property name="visible">True</property>
+        <property name="label" translatable="yes">Local Candidate:</property>
+        <property name="use_underline">False</property>
+        <property name="use_markup">True</property>
+        <property name="justify">GTK_JUSTIFY_LEFT</property>
+        <property name="wrap">False</property>
+        <property name="selectable">False</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0.5</property>
+        <property name="xpad">0</property>
+        <property name="ypad">0</property>
+        <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+        <property name="width_chars">-1</property>
+        <property name="single_line_mode">False</property>
+        <property name="angle">0</property>
+        <attributes>
+                <attribute name="style" value="PANGO_STYLE_ITALIC"/>
+              </attributes>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="right_attach">1</property>
+        <property name="top_attach">4</property>
+        <property name="bottom_attach">5</property>
+        <property name="x_options">fill</property>
+        <property name="y_options"/>
+      </packing>
+          </child>
+
+          <child>
+      <object class="GtkLabel" id="video_local_candidate_label">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="label" translatable="yes">Unknown</property>
+        <property name="use_underline">False</property>
+        <property name="use_markup">False</property>
+        <property name="justify">GTK_JUSTIFY_LEFT</property>
+        <property name="wrap">False</property>
+        <property name="selectable">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0.5</property>
+        <property name="xpad">0</property>
+        <property name="ypad">0</property>
+        <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
+        <property name="width_chars">-1</property>
+        <property name="single_line_mode">False</property>
+        <property name="angle">0</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="top_attach">4</property>
+        <property name="bottom_attach">5</property>
+        <property name="x_options">expand|shrink|fill</property>
+        <property name="y_options"/>
+      </packing>
+          </child>
+
         </object>
       </child>
     </object>
       </packing>
           </child>
 
+          <child>
+      <object class="GtkLabel" id="arc_label">
+        <property name="visible">True</property>
+        <property name="label" translatable="yes">Remote Candidate:</property>
+        <property name="use_underline">False</property>
+        <property name="use_markup">True</property>
+        <property name="justify">GTK_JUSTIFY_LEFT</property>
+        <property name="wrap">False</property>
+        <property name="selectable">False</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0.5</property>
+        <property name="xpad">0</property>
+        <property name="ypad">0</property>
+        <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+        <property name="width_chars">-1</property>
+        <property name="single_line_mode">False</property>
+        <property name="angle">0</property>
+        <attributes>
+                <attribute name="style" value="PANGO_STYLE_ITALIC"/>
+              </attributes>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="right_attach">1</property>
+        <property name="top_attach">2</property>
+        <property name="bottom_attach">3</property>
+        <property name="x_options">fill</property>
+        <property name="y_options"/>
+      </packing>
+          </child>
+
+          <child>
+      <object class="GtkLabel" id="audio_remote_candidate_label">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="label" translatable="yes">Unknown</property>
+        <property name="use_underline">False</property>
+        <property name="use_markup">False</property>
+        <property name="justify">GTK_JUSTIFY_LEFT</property>
+        <property name="wrap">False</property>
+        <property name="selectable">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0.5</property>
+        <property name="xpad">0</property>
+        <property name="ypad">0</property>
+        <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
+        <property name="width_chars">-1</property>
+        <property name="single_line_mode">False</property>
+        <property name="angle">0</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="top_attach">2</property>
+        <property name="bottom_attach">3</property>
+        <property name="x_options">expand|shrink|fill</property>
+        <property name="y_options"/>
+      </packing>
+          </child>
+
+          <child>
+      <object class="GtkLabel" id="alc_label">
+        <property name="visible">True</property>
+        <property name="label" translatable="yes">Local Candidate:</property>
+        <property name="use_underline">False</property>
+        <property name="use_markup">True</property>
+        <property name="justify">GTK_JUSTIFY_LEFT</property>
+        <property name="wrap">False</property>
+        <property name="selectable">False</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0.5</property>
+        <property name="xpad">0</property>
+        <property name="ypad">0</property>
+        <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+        <property name="width_chars">-1</property>
+        <property name="single_line_mode">False</property>
+        <property name="angle">0</property>
+        <attributes>
+                <attribute name="style" value="PANGO_STYLE_ITALIC"/>
+              </attributes>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="right_attach">1</property>
+        <property name="top_attach">3</property>
+        <property name="bottom_attach">4</property>
+        <property name="x_options">fill</property>
+        <property name="y_options"/>
+      </packing>
+          </child>
+
+          <child>
+      <object class="GtkLabel" id="audio_local_candidate_label">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="label" translatable="yes">Unknown</property>
+        <property name="use_underline">False</property>
+        <property name="use_markup">False</property>
+        <property name="justify">GTK_JUSTIFY_LEFT</property>
+        <property name="wrap">False</property>
+        <property name="selectable">True</property>
+        <property name="xalign">0</property>
+        <property name="yalign">0.5</property>
+        <property name="xpad">0</property>
+        <property name="ypad">0</property>
+        <property name="ellipsize">PANGO_ELLIPSIZE_END</property>
+        <property name="width_chars">-1</property>
+        <property name="single_line_mode">False</property>
+        <property name="angle">0</property>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="right_attach">2</property>
+        <property name="top_attach">3</property>
+        <property name="bottom_attach">4</property>
+        <property name="x_options">expand|shrink|fill</property>
+        <property name="y_options"/>
+      </packing>
+          </child>
+
+
         </object>
       </child>
     </object>