diff options
author | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2012-07-13 18:11:24 +0300 |
---|---|---|
committer | George Kiagiadakis <george.kiagiadakis@collabora.com> | 2012-07-13 18:15:49 +0300 |
commit | 0418dd11219f3802e08980761a4bd6a1ca2e317b (patch) | |
tree | 9d44cb855ed67a14356a2502c5b8256b771d1f08 | |
parent | 492821581f2d9feae9b5fd5d71b5433630cbc7fb (diff) |
Farsight/Farstream: Use tp_simple_client_factory_ensure_connection() instead of the deprecated tp_connection_new()
Reviewed-by: Dario Freddi <dario.freddi@collabora.com>
-rw-r--r-- | TelepathyQt/Farsight/channel.cpp | 17 | ||||
-rw-r--r-- | 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 0cc5c0c9..99293634 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 b7ef29fa..20acee35 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); |