diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-04-19 17:40:17 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2010-04-19 17:44:12 +0100 |
commit | 1ba295688e1bb4773cd4438b38c4296677da27c3 (patch) | |
tree | f077361cbb3161db6105a83e0f896475324464aa | |
parent | f0e97846fff0d92d9901fece9cc76f8b61d6e672 (diff) |
Use tp_dbus_daemon_register_object in examples
This also fixes a reference leak in ExampleCallStream's constructed().
-rw-r--r-- | examples/cm/callable/media-channel.c | 11 | ||||
-rw-r--r-- | examples/cm/channelspecific/room.c | 11 | ||||
-rw-r--r-- | examples/cm/contactlist/contact-list.c | 11 | ||||
-rw-r--r-- | examples/cm/echo-message-parts/chan.c | 11 | ||||
-rw-r--r-- | examples/cm/echo/chan.c | 11 | ||||
-rw-r--r-- | examples/future/call-cm/call-channel.c | 13 | ||||
-rw-r--r-- | examples/future/call-cm/call-content.c | 13 | ||||
-rw-r--r-- | examples/future/call-cm/call-stream.c | 16 |
8 files changed, 24 insertions, 73 deletions
diff --git a/examples/cm/callable/media-channel.c b/examples/cm/callable/media-channel.c index 8516a6595..d65c3c4ad 100644 --- a/examples/cm/callable/media-channel.c +++ b/examples/cm/callable/media-channel.c @@ -161,10 +161,8 @@ constructed (GObject *object) ExampleCallableMediaChannel *self = EXAMPLE_CALLABLE_MEDIA_CHANNEL (object); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (self->priv->conn, TP_HANDLE_TYPE_CONTACT); - DBusGConnection *bus; TpIntSet *members; TpIntSet *local_pending; - TpDBusDaemon *dbus_daemon; if (chain_up != NULL) chain_up (object); @@ -172,12 +170,9 @@ constructed (GObject *object) tp_handle_ref (contact_repo, self->priv->handle); tp_handle_ref (contact_repo, self->priv->initiator); - /* we're running under tp_run_connection_manager(), so t_d_d_d can't fail */ - dbus_daemon = tp_dbus_daemon_dup (NULL); - g_assert (dbus_daemon != NULL); - bus = tp_proxy_get_dbus_connection (dbus_daemon); - dbus_g_connection_register_g_object (bus, self->priv->object_path, object); - g_object_unref (dbus_daemon); + tp_dbus_daemon_register_object ( + tp_base_connection_get_dbus_daemon (self->priv->conn), + self->priv->object_path, self); tp_group_mixin_init (object, G_STRUCT_OFFSET (ExampleCallableMediaChannel, group), diff --git a/examples/cm/channelspecific/room.c b/examples/cm/channelspecific/room.c index 611c9435f..b1aff16c2 100644 --- a/examples/cm/channelspecific/room.c +++ b/examples/cm/channelspecific/room.c @@ -250,21 +250,16 @@ constructor (GType type, (self->priv->conn, TP_HANDLE_TYPE_CONTACT); TpHandleRepoIface *room_repo = tp_base_connection_get_handles (self->priv->conn, TP_HANDLE_TYPE_ROOM); - DBusGConnection *bus; TpHandle self_handle; - TpDBusDaemon *dbus_daemon; tp_handle_ref (room_repo, self->priv->handle); if (self->priv->initiator != 0) tp_handle_ref (contact_repo, self->priv->initiator); - /* we're running under tp_run_connection_manager(), so t_d_d_d can't fail */ - dbus_daemon = tp_dbus_daemon_dup (NULL); - g_assert (dbus_daemon != NULL); - bus = tp_proxy_get_dbus_connection (dbus_daemon); - dbus_g_connection_register_g_object (bus, self->priv->object_path, object); - g_object_unref (dbus_daemon); + tp_dbus_daemon_register_object ( + tp_base_connection_get_dbus_daemon (self->priv->conn), + self->priv->object_path, self); tp_text_mixin_init (object, G_STRUCT_OFFSET (ExampleCSHRoomChannel, text), contact_repo); diff --git a/examples/cm/contactlist/contact-list.c b/examples/cm/contactlist/contact-list.c index 20ddb8602..4a70fb896 100644 --- a/examples/cm/contactlist/contact-list.c +++ b/examples/cm/contactlist/contact-list.c @@ -122,8 +122,6 @@ constructed (GObject *object) TpHandle self_handle = self->priv->conn->self_handle; TpHandleRepoIface *handle_repo = tp_base_connection_get_handles (self->priv->conn, self->priv->handle_type); - DBusGConnection *bus; - TpDBusDaemon *dbus_daemon; if (chain_up != NULL) chain_up (object); @@ -131,12 +129,9 @@ constructed (GObject *object) g_assert (TP_IS_BASE_CONNECTION (self->priv->conn)); g_assert (EXAMPLE_IS_CONTACT_LIST_MANAGER (self->priv->manager)); - /* we're running under tp_run_connection_manager(), so t_d_d_d can't fail */ - dbus_daemon = tp_dbus_daemon_dup (NULL); - g_assert (dbus_daemon != NULL); - bus = tp_proxy_get_dbus_connection (dbus_daemon); - dbus_g_connection_register_g_object (bus, self->priv->object_path, object); - g_object_unref (dbus_daemon); + tp_dbus_daemon_register_object ( + tp_base_connection_get_dbus_daemon (self->priv->conn), + self->priv->object_path, self); tp_handle_ref (handle_repo, self->priv->handle); tp_group_mixin_init (object, G_STRUCT_OFFSET (ExampleContactListBase, group), diff --git a/examples/cm/echo-message-parts/chan.c b/examples/cm/echo-message-parts/chan.c index 7018a25ac..34b6f0bfc 100644 --- a/examples/cm/echo-message-parts/chan.c +++ b/examples/cm/echo-message-parts/chan.c @@ -194,8 +194,6 @@ constructor (GType type, ExampleEcho2Channel *self = EXAMPLE_ECHO_2_CHANNEL (object); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (self->priv->conn, TP_HANDLE_TYPE_CONTACT); - DBusGConnection *bus; - TpDBusDaemon *dbus_daemon; static TpChannelTextMessageType const types[] = { TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL, TP_CHANNEL_TEXT_MESSAGE_TYPE_ACTION, @@ -208,12 +206,9 @@ constructor (GType type, if (self->priv->initiator != 0) tp_handle_ref (contact_repo, self->priv->initiator); - /* we're running under tp_run_connection_manager(), so t_d_d_d can't fail */ - dbus_daemon = tp_dbus_daemon_dup (NULL); - g_assert (dbus_daemon != NULL); - bus = tp_proxy_get_dbus_connection (dbus_daemon); - dbus_g_connection_register_g_object (bus, self->priv->object_path, object); - g_object_unref (dbus_daemon); + tp_dbus_daemon_register_object ( + tp_base_connection_get_dbus_daemon (self->priv->conn), + self->priv->object_path, self); tp_message_mixin_init (object, G_STRUCT_OFFSET (ExampleEcho2Channel, text), self->priv->conn); diff --git a/examples/cm/echo/chan.c b/examples/cm/echo/chan.c index cc2f2e854..90f52e0d1 100644 --- a/examples/cm/echo/chan.c +++ b/examples/cm/echo/chan.c @@ -87,20 +87,15 @@ constructor (GType type, ExampleEchoChannel *self = EXAMPLE_ECHO_CHANNEL (object); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (self->priv->conn, TP_HANDLE_TYPE_CONTACT); - DBusGConnection *bus; - TpDBusDaemon *dbus_daemon; tp_handle_ref (contact_repo, self->priv->handle); if (self->priv->initiator != 0) tp_handle_ref (contact_repo, self->priv->initiator); - /* we're running under tp_run_connection_manager(), so t_d_d_d can't fail */ - dbus_daemon = tp_dbus_daemon_dup (NULL); - g_assert (dbus_daemon != NULL); - bus = tp_proxy_get_dbus_connection (dbus_daemon); - dbus_g_connection_register_g_object (bus, self->priv->object_path, object); - g_object_unref (dbus_daemon); + tp_dbus_daemon_register_object ( + tp_base_connection_get_dbus_daemon (self->priv->conn), + self->priv->object_path, self); tp_text_mixin_init (object, G_STRUCT_OFFSET (ExampleEchoChannel, text), contact_repo); diff --git a/examples/future/call-cm/call-channel.c b/examples/future/call-cm/call-channel.c index d096fd699..ca69b673d 100644 --- a/examples/future/call-cm/call-channel.c +++ b/examples/future/call-cm/call-channel.c @@ -244,23 +244,16 @@ constructed (GObject *object) ExampleCallChannel *self = EXAMPLE_CALL_CHANNEL (object); TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (self->priv->conn, TP_HANDLE_TYPE_CONTACT); - TpDBusDaemon *dbus_daemon; if (chain_up != NULL) chain_up (object); - dbus_daemon = tp_dbus_daemon_dup (NULL); - g_return_if_fail (dbus_daemon != NULL); - tp_handle_ref (contact_repo, self->priv->handle); tp_handle_ref (contact_repo, self->priv->initiator); - dbus_g_connection_register_g_object ( - tp_proxy_get_dbus_connection (dbus_daemon), - self->priv->object_path, object); - - g_object_unref (dbus_daemon); - dbus_daemon = NULL; + tp_dbus_daemon_register_object ( + tp_base_connection_get_dbus_daemon (self->priv->conn), + self->priv->object_path, self); if (self->priv->locally_requested) { diff --git a/examples/future/call-cm/call-content.c b/examples/future/call-cm/call-content.c index b6097acef..62e588d8d 100644 --- a/examples/future/call-cm/call-content.c +++ b/examples/future/call-cm/call-content.c @@ -72,20 +72,13 @@ constructed (GObject *object) void (*chain_up) (GObject *) = ((GObjectClass *) example_call_content_parent_class)->constructed; TpHandleRepoIface *contact_repo; - TpDBusDaemon *dbus_daemon; if (chain_up != NULL) chain_up (object); - dbus_daemon = tp_dbus_daemon_dup (NULL); - g_return_if_fail (dbus_daemon != NULL); - - dbus_g_connection_register_g_object ( - tp_proxy_get_dbus_connection (dbus_daemon), - self->priv->object_path, object); - - g_object_unref (dbus_daemon); - dbus_daemon = NULL; + tp_dbus_daemon_register_object ( + tp_base_connection_get_dbus_daemon (self->priv->conn), + self->priv->object_path, self); contact_repo = tp_base_connection_get_handles (self->priv->conn, TP_HANDLE_TYPE_CONTACT); diff --git a/examples/future/call-cm/call-stream.c b/examples/future/call-cm/call-stream.c index cf7e49c02..fb41030a8 100644 --- a/examples/future/call-cm/call-stream.c +++ b/examples/future/call-cm/call-stream.c @@ -91,25 +91,15 @@ static void constructed (GObject *object) { ExampleCallStream *self = EXAMPLE_CALL_STREAM (object); - TpDBusDaemon *dbus_daemon; void (*chain_up) (GObject *) = ((GObjectClass *) example_call_stream_parent_class)->constructed; - dbus_daemon = tp_dbus_daemon_dup (NULL); - g_return_if_fail (dbus_daemon != NULL); - if (chain_up != NULL) chain_up (object); - dbus_daemon = tp_dbus_daemon_dup (NULL); - g_return_if_fail (dbus_daemon != NULL); - - dbus_g_connection_register_g_object ( - tp_proxy_get_dbus_connection (dbus_daemon), - self->priv->object_path, object); - - g_object_unref (dbus_daemon); - dbus_daemon = NULL; + tp_dbus_daemon_register_object ( + tp_base_connection_get_dbus_daemon (self->priv->conn), + self->priv->object_path, self); if (self->priv->locally_requested) { |