telepathy-qt: Farsight/Farstream: Use tp_simple_client_factory_ensure_connection() instead of the deprecated tp_connection_new()

George Kiagiadakis gkiagia at kemper.freedesktop.org
Fri Jul 13 08:23:50 PDT 2012


Module: telepathy-qt
Branch: master
Commit: 0418dd11219f3802e08980761a4bd6a1ca2e317b
URL:    http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=0418dd11219f3802e08980761a4bd6a1ca2e317b

Author: George Kiagiadakis <george.kiagiadakis at collabora.com>
Date:   Fri Jul 13 18:11:24 2012 +0300

Farsight/Farstream: Use tp_simple_client_factory_ensure_connection() instead of the deprecated tp_connection_new()

Reviewed-by: Dario Freddi <dario.freddi at collabora.com>

---

 TelepathyQt/Farsight/channel.cpp  |   17 +++++++++++++----
 TelepathyQt/Farstream/channel.cpp |   20 ++++++++++++++++----
 2 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/TelepathyQt/Farsight/channel.cpp b/TelepathyQt/Farsight/channel.cpp
index 0cc5c0c..9929363 100644
--- a/TelepathyQt/Farsight/channel.cpp
+++ b/TelepathyQt/Farsight/channel.cpp
@@ -28,6 +28,7 @@
 #include <TelepathyQt/Connection>
 #include <TelepathyQt/StreamedMediaChannel>
 
+#include <telepathy-glib/automatic-client-factory.h>
 #include <telepathy-glib/channel.h>
 #include <telepathy-glib/connection.h>
 #include <telepathy-glib/dbus.h>
@@ -53,10 +54,18 @@ TfChannel *createFarsightChannel(const StreamedMediaChannelPtr &channel)
 
     ConnectionPtr connection = channel->connection();
 
-    TpConnection *gconnection = tp_connection_new(dbus,
-            connection->busName().toAscii(),
-            connection->objectPath().toAscii(),
-            0);
+    TpSimpleClientFactory *factory = (TpSimpleClientFactory *)
+            tp_automatic_client_factory_new (dbus);
+    if (!factory) {
+        warning() << "Unable to construct TpAutomaticClientFactory";
+        g_object_unref(dbus);
+        return 0;
+    }
+
+    TpConnection *gconnection = tp_simple_client_factory_ensure_connection (factory,
+            connection->objectPath().toAscii(), NULL, 0);
+    g_object_unref(factory);
+    factory = 0;
     g_object_unref(dbus);
     dbus = 0;
 
diff --git a/TelepathyQt/Farstream/channel.cpp b/TelepathyQt/Farstream/channel.cpp
index b7ef29f..20acee3 100644
--- a/TelepathyQt/Farstream/channel.cpp
+++ b/TelepathyQt/Farstream/channel.cpp
@@ -29,6 +29,7 @@
 #include <TelepathyQt/Connection>
 
 #include <telepathy-farstream/telepathy-farstream.h>
+#include <telepathy-glib/automatic-client-factory.h>
 #include <telepathy-glib/call-channel.h>
 #include <telepathy-glib/connection.h>
 #include <telepathy-glib/dbus.h>
@@ -78,14 +79,23 @@ PendingChannel::PendingChannel(const CallChannelPtr &channel)
         return;
     }
 
-    TpConnection *gconnection = tp_connection_new(dbus,
-            connection->busName().toAscii(),
-            connection->objectPath().toAscii(),
-            0);
+    TpSimpleClientFactory *factory = (TpSimpleClientFactory *)
+            tp_automatic_client_factory_new (dbus);
+    if (!factory) {
+        warning() << "Unable to construct TpAutomaticClientFactory";
+        setFinishedWithError(TP_QT_ERROR_NOT_AVAILABLE,
+                QLatin1String("Unable to construct TpAutomaticClientFactory"));
+        g_object_unref(dbus);
+        return;
+    }
+
+    TpConnection *gconnection = tp_simple_client_factory_ensure_connection (factory,
+            connection->objectPath().toAscii(), NULL, 0);
     if (!gconnection) {
         warning() << "Unable to construct TpConnection";
         setFinishedWithError(TP_QT_ERROR_NOT_AVAILABLE,
                 QLatin1String("Unable to construct TpConnection"));
+        g_object_unref(factory);
         g_object_unref(dbus);
         return;
     }
@@ -96,6 +106,8 @@ PendingChannel::PendingChannel(const CallChannelPtr &channel)
             "dbus-daemon", dbus,
             "object-path", channel->objectPath().toAscii().constData(),
             NULL);
+    g_object_unref(factory);
+    factory = 0;
     g_object_unref(dbus);
     dbus = 0;
     g_object_unref(gconnection);



More information about the telepathy-commits mailing list