summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2010-09-22 14:52:09 (GMT)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2010-09-22 14:52:12 (GMT)
commitc586f0715933c3bc1b97b11decc75134fe729207 (patch)
tree3e9a25a68931a2288061707a81166dae21634ca3
parent21572078431fdac8b244366ca72fd59a46a57226 (diff)
parentdfdbf583d9bf6409e956c4e263dc4226dace5321 (diff)
downloadtelepathy-haze-c586f0715933c3bc1b97b11decc75134fe729207.tar.gz
telepathy-haze-c586f0715933c3bc1b97b11decc75134fe729207.tar.xz
Merge branch 'get-bus'
Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
-rw-r--r--configure.ac2
-rw-r--r--src/contact-list-channel.c6
-rw-r--r--src/im-channel.c6
-rw-r--r--src/media-backend.c17
-rw-r--r--src/media-channel.c6
-rw-r--r--src/media-stream.c23
-rw-r--r--src/media-stream.h4
7 files changed, 46 insertions, 18 deletions
diff --git a/configure.ac b/configure.ac
index 40876a1..55ad0f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,7 +72,7 @@ AC_ARG_ENABLE(leaky-request-stubs,
AC_SUBST(ENABLE_LEAKY_REQUEST_STUBS)
PKG_CHECK_MODULES(PURPLE,[purple >= 2.7])
-PKG_CHECK_MODULES(TP_GLIB,[telepathy-glib >= 0.9.2])
+PKG_CHECK_MODULES(TP_GLIB,[telepathy-glib >= 0.11.16])
PKG_CHECK_MODULES(GLIB,[glib-2.0 >= 2.22, gobject-2.0])
PKG_CHECK_MODULES(DBUS_GLIB,[dbus-glib-1 >= 0.73])
diff --git a/src/contact-list-channel.c b/src/contact-list-channel.c
index c82f099..7abd1ac 100644
--- a/src/contact-list-channel.c
+++ b/src/contact-list-channel.c
@@ -533,7 +533,7 @@ haze_contact_list_channel_constructor (GType type, guint n_props,
TpBaseConnection *conn;
TpHandle self_handle;
TpHandleRepoIface *handle_repo, *contact_repo;
- DBusGConnection *bus;
+ TpDBusDaemon *bus;
guint handle_type;
obj = G_OBJECT_CLASS (haze_contact_list_channel_parent_class)->
@@ -547,8 +547,8 @@ haze_contact_list_channel_constructor (GType type, guint n_props,
contact_repo = tp_base_connection_get_handles (conn,
TP_HANDLE_TYPE_CONTACT);
- bus = tp_get_bus ();
- dbus_g_connection_register_g_object (bus, priv->object_path, obj);
+ bus = tp_base_connection_get_dbus_daemon (conn);
+ tp_dbus_daemon_register_object (bus, priv->object_path, obj);
g_assert (handle_type == TP_HANDLE_TYPE_LIST ||
handle_type == TP_HANDLE_TYPE_GROUP);
diff --git a/src/im-channel.c b/src/im-channel.c
index c48ff50..d1d5265 100644
--- a/src/im-channel.c
+++ b/src/im-channel.c
@@ -564,7 +564,7 @@ haze_im_channel_constructor (GType type, guint n_props,
HazeIMChannelPrivate *priv;
TpHandleRepoIface *contact_handles;
TpBaseConnection *conn;
- DBusGConnection *bus;
+ TpDBusDaemon *bus;
obj = G_OBJECT_CLASS (haze_im_channel_parent_class)->
constructor (type, n_props, props);
@@ -583,8 +583,8 @@ haze_im_channel_constructor (GType type, guint n_props,
tp_message_mixin_implement_sending (obj, haze_im_channel_send, 3,
supported_message_types, 0, 0, supported_content_types);
- bus = tp_get_bus ();
- dbus_g_connection_register_g_object (bus, priv->object_path, obj);
+ bus = tp_base_connection_get_dbus_daemon (conn);
+ tp_dbus_daemon_register_object (bus, priv->object_path, obj);
priv->closed = FALSE;
priv->dispose_has_run = FALSE;
diff --git a/src/media-backend.c b/src/media-backend.c
index 6aa17aa..1d231e7 100644
--- a/src/media-backend.c
+++ b/src/media-backend.c
@@ -139,8 +139,14 @@ haze_media_backend_set_property (GObject *object,
priv->object_path = g_value_dup_string (value);
if (priv->object_path != NULL)
- dbus_g_connection_register_g_object (tp_get_bus (),
- priv->object_path, G_OBJECT(backend));
+ {
+ TpDBusDaemon *dbus_daemon = tp_dbus_daemon_dup (NULL);
+
+ g_return_if_fail (dbus_daemon != NULL);
+ tp_dbus_daemon_register_object (dbus_daemon,
+ priv->object_path, G_OBJECT (backend));
+ g_object_unref (dbus_daemon);
+ }
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -292,9 +298,12 @@ haze_media_backend_add_stream (PurpleMediaBackend *self,
gchar *object_path;
guint media_type, id, stun_port = 3478; /* default stun port */
const gchar *nat_traversal = NULL, *stun_server = NULL;
+ TpDBusDaemon *dbus_daemon = tp_dbus_daemon_dup (NULL);
DEBUG ("called");
+ g_return_val_if_fail (dbus_daemon != NULL, FALSE);
+
id = priv->next_stream_id++;
object_path = g_strdup_printf ("%s/MediaStream%u",
@@ -358,7 +367,7 @@ haze_media_backend_add_stream (PurpleMediaBackend *self,
g_assert_not_reached ();
}
- stream = haze_media_stream_new (object_path, priv->media,
+ stream = haze_media_stream_new (object_path, dbus_daemon, priv->media,
sid, who, media_type, id, initiator, nat_traversal, NULL, FALSE);
if (stun_server != NULL)
@@ -374,6 +383,8 @@ haze_media_backend_add_stream (PurpleMediaBackend *self,
if (priv->ready)
_emit_new_stream (HAZE_MEDIA_BACKEND (self), stream);
+ g_object_unref (dbus_daemon);
+
return TRUE;
}
diff --git a/src/media-channel.c b/src/media-channel.c
index 11e45ea..5e7f165 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -582,7 +582,7 @@ haze_media_channel_constructor (GType type, guint n_props,
GObject *obj;
HazeMediaChannelPrivate *priv;
TpBaseConnection *conn;
- DBusGConnection *bus;
+ TpDBusDaemon *bus;
TpIntSet *set;
TpHandleRepoIface *contact_handles;
@@ -595,8 +595,8 @@ haze_media_channel_constructor (GType type, guint n_props,
TP_HANDLE_TYPE_CONTACT);
/* register object on the bus */
- bus = tp_get_bus ();
- dbus_g_connection_register_g_object (bus, priv->object_path, obj);
+ bus = tp_base_connection_get_dbus_daemon (conn);
+ tp_dbus_daemon_register_object (bus, priv->object_path, obj);
tp_group_mixin_init (obj, G_STRUCT_OFFSET (HazeMediaChannel, group),
contact_handles, conn->self_handle);
diff --git a/src/media-stream.c b/src/media-stream.c
index 09e4c68..ea300b3 100644
--- a/src/media-stream.c
+++ b/src/media-stream.c
@@ -50,6 +50,7 @@ G_DEFINE_TYPE_WITH_CODE (HazeMediaStream,
enum
{
PROP_OBJECT_PATH = 1,
+ PROP_DBUS_DAEMON,
PROP_NAME,
PROP_PEER,
PROP_ID,
@@ -75,6 +76,7 @@ struct _HazeMediaStreamPrivate
PurpleMedia *media;
gchar *object_path;
+ TpDBusDaemon *dbus_daemon;
guint id;
guint media_type;
@@ -108,6 +110,7 @@ struct _HazeMediaStreamPrivate
HazeMediaStream *
haze_media_stream_new (const gchar *object_path,
+ TpDBusDaemon *dbus_daemon,
PurpleMedia *media,
const gchar *name,
const gchar *peer,
@@ -131,6 +134,7 @@ haze_media_stream_new (const gchar *object_path,
result = g_object_new (HAZE_TYPE_MEDIA_STREAM,
"object-path", object_path,
+ "dbus-daemon", dbus_daemon,
"media", media,
"name", name,
"peer", peer,
@@ -172,7 +176,6 @@ haze_media_stream_constructor (GType type, guint n_props,
GObject *obj;
HazeMediaStream *stream;
HazeMediaStreamPrivate *priv;
- DBusGConnection *bus;
/* call base class constructor */
obj = G_OBJECT_CLASS (haze_media_stream_parent_class)->
@@ -183,8 +186,7 @@ haze_media_stream_constructor (GType type, guint n_props,
g_assert (priv->media != NULL);
/* go for the bus */
- bus = tp_get_bus ();
- dbus_g_connection_register_g_object (bus, priv->object_path, obj);
+ tp_dbus_daemon_register_object (priv->dbus_daemon, priv->object_path, obj);
if (priv->created_locally)
{
@@ -216,6 +218,9 @@ haze_media_stream_get_property (GObject *object,
case PROP_OBJECT_PATH:
g_value_set_string (value, priv->object_path);
break;
+ case PROP_DBUS_DAEMON:
+ g_value_set_object (value, priv->dbus_daemon);
+ break;
case PROP_NAME:
g_value_set_string (value, stream->name);
break;
@@ -281,6 +286,10 @@ haze_media_stream_set_property (GObject *object,
g_free (priv->object_path);
priv->object_path = g_value_dup_string (value);
break;
+ case PROP_DBUS_DAEMON:
+ g_assert (priv->dbus_daemon == NULL); /* construct-only */
+ priv->dbus_daemon = g_value_dup_object (value);
+ break;
case PROP_NAME:
g_free (stream->name);
stream->name = g_value_dup_string (value);
@@ -378,6 +387,12 @@ haze_media_stream_class_init (HazeMediaStreamClass *haze_media_stream_class)
G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_OBJECT_PATH, param_spec);
+ param_spec = g_param_spec_object ("dbus-daemon", "D-Bus connection",
+ "Connection to D-Bus",
+ TP_TYPE_DBUS_DAEMON,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+ g_object_class_install_property (object_class, PROP_DBUS_DAEMON, param_spec);
+
param_spec = g_param_spec_string ("name", "Stream name",
"An opaque name for the stream used in the signalling.", NULL,
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_NAME |
@@ -519,6 +534,8 @@ haze_media_stream_dispose (GObject *object)
priv->dispose_has_run = TRUE;
+ tp_clear_object (&priv->dbus_daemon);
+
if (priv->local_candidates)
{
purple_media_candidate_list_free (priv->local_candidates);
diff --git a/src/media-stream.h b/src/media-stream.h
index 8066fcd..0d6f328 100644
--- a/src/media-stream.h
+++ b/src/media-stream.h
@@ -25,8 +25,7 @@
#include <glib-object.h>
#include <libpurple/media.h>
-#include <telepathy-glib/dbus-properties-mixin.h>
-#include <telepathy-glib/enums.h>
+#include <telepathy-glib/telepathy-glib.h>
G_BEGIN_DECLS
@@ -100,6 +99,7 @@ gboolean haze_media_stream_change_direction (HazeMediaStream *stream,
void haze_media_stream_accept_pending_local_send (HazeMediaStream *stream);
HazeMediaStream *haze_media_stream_new (const gchar *object_path,
+ TpDBusDaemon *dbus_daemon,
PurpleMedia *media,
const gchar *name,
const gchar *peer,