[Telepathy-commits] [telepathy-gabble/master] Add and use gabble_jingle_transport_iface_new()

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Feb 25 04:42:52 PST 2009


---
 src/jingle-content.c         |   10 ++++------
 src/jingle-transport-iface.c |   14 ++++++++++++++
 src/jingle-transport-iface.h |    3 +++
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/jingle-content.c b/src/jingle-content.c
index 065c45e..68a639d 100644
--- a/src/jingle-content.c
+++ b/src/jingle-content.c
@@ -241,8 +241,8 @@ gabble_jingle_content_set_property (GObject *object,
 
           g_assert (transport_type != 0);
 
-          priv->transport = g_object_new (transport_type,
-              "content", self, "transport-ns", priv->transport_ns, NULL);
+          priv->transport = gabble_jingle_transport_iface_new (transport_type,
+              self, priv->transport_ns);
 
           g_signal_connect (priv->transport, "new-candidates",
               (GCallback) new_transport_candidates_cb, self);
@@ -558,10 +558,8 @@ gabble_jingle_content_parse_add (GabbleJingleContent *c,
 
   DEBUG ("content creating new transport type %s", g_type_name (transport_type));
 
-  trans = g_object_new (transport_type,
-                       "content", c,
-                       "transport-ns", priv->transport_ns,
-                       NULL);
+  trans = gabble_jingle_transport_iface_new (transport_type,
+      c, priv->transport_ns);
 
   g_signal_connect (trans, "new-candidates",
       (GCallback) new_transport_candidates_cb, c);
diff --git a/src/jingle-transport-iface.c b/src/jingle-transport-iface.c
index 5fa10ab..e32ca25 100644
--- a/src/jingle-transport-iface.c
+++ b/src/jingle-transport-iface.c
@@ -25,6 +25,20 @@
 #include "jingle-content.h"
 #include "jingle-session.h"
 
+GabbleJingleTransportIface *
+gabble_jingle_transport_iface_new (GType type,
+                                   GabbleJingleContent *content,
+                                   const gchar *transport_ns)
+{
+  g_return_val_if_fail (g_type_is_a (type, GABBLE_TYPE_JINGLE_TRANSPORT_IFACE),
+      NULL);
+
+  return g_object_new (type,
+      "content", content,
+      "transport-ns", transport_ns,
+      NULL);
+}
+
 void
 gabble_jingle_transport_iface_parse_candidates (GabbleJingleTransportIface *self,
     LmMessageNode *node, GError **error)
diff --git a/src/jingle-transport-iface.h b/src/jingle-transport-iface.h
index b2c860a..998b91d 100644
--- a/src/jingle-transport-iface.h
+++ b/src/jingle-transport-iface.h
@@ -68,6 +68,9 @@ void gabble_jingle_transport_iface_add_candidates (GabbleJingleTransportIface *,
 void gabble_jingle_transport_iface_retransmit_candidates (GabbleJingleTransportIface *, gboolean);
 GList *gabble_jingle_transport_iface_get_remote_candidates (GabbleJingleTransportIface *);
 
+GabbleJingleTransportIface *gabble_jingle_transport_iface_new (
+    GType type, GabbleJingleContent *content, const gchar *transport_ns);
+
 JingleCandidate *jingle_candidate_new (guint component, const gchar *address,
     guint port, JingleTransportProtocol proto, gdouble pref,
     JingleCandidateType type, const gchar *user, const gchar *pass, guint net,
-- 
1.5.6.5




More information about the telepathy-commits mailing list