From 031c61aaf911d52e15a78c882d5992a6c3b8b4f5 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 9 May 2014 15:43:34 +0200 Subject: [PATCH 01/11] base-client: be a GDBusObjectSkeleton --- telepathy-glib/base-client.c | 27 ++++++++++++++++++++++++++- telepathy-glib/base-client.h | 4 ++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/telepathy-glib/base-client.c b/telepathy-glib/base-client.c index a32b474..3235041 100644 --- a/telepathy-glib/base-client.c +++ b/telepathy-glib/base-client.c @@ -205,7 +205,8 @@ static void approver_iface_init (gpointer, gpointer); static void handler_iface_init (gpointer, gpointer); static void requests_iface_init (gpointer, gpointer); -G_DEFINE_ABSTRACT_TYPE_WITH_CODE(TpBaseClient, tp_base_client, G_TYPE_OBJECT, +G_DEFINE_ABSTRACT_TYPE_WITH_CODE(TpBaseClient, tp_base_client, + G_TYPE_DBUS_OBJECT_SKELETON, G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CLIENT, NULL); G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CLIENT_OBSERVER, observer_iface_init); G_IMPLEMENT_INTERFACE(TP_TYPE_SVC_CLIENT_APPROVER, approver_iface_init); @@ -1182,9 +1183,26 @@ tp_base_client_set_property (GObject *object, } static void +object_skeleton_take_interface (GDBusObjectSkeleton *skel, + GDBusInterfaceSkeleton *iface) +{ + g_dbus_object_skeleton_add_interface (skel, iface); + g_object_unref (iface); +} + +static void +object_skeleton_take_svc_interface (GDBusObjectSkeleton *skel, + GType type) +{ + object_skeleton_take_interface (skel, + tp_svc_interface_skeleton_new (skel, type)); +} + +static void tp_base_client_constructed (GObject *object) { TpBaseClient *self = TP_BASE_CLIENT (object); + GDBusObjectSkeleton *skel = G_DBUS_OBJECT_SKELETON (self); void (*chain_up) (GObject *) = ((GObjectClass *) tp_base_client_parent_class)->constructed; GString *string; @@ -1193,6 +1211,13 @@ tp_base_client_constructed (GObject *object) if (chain_up != NULL) chain_up (object); + object_skeleton_take_svc_interface (skel, TP_TYPE_SVC_CLIENT); + object_skeleton_take_svc_interface (skel, TP_TYPE_SVC_CLIENT_OBSERVER); + object_skeleton_take_svc_interface (skel, TP_TYPE_SVC_CLIENT_APPROVER); + object_skeleton_take_svc_interface (skel, TP_TYPE_SVC_CLIENT_HANDLER); + object_skeleton_take_svc_interface (skel, + TP_TYPE_SVC_CLIENT_INTERFACE_REQUESTS); + g_assert (self->priv->factory != NULL); /* Ensure we have a GDBusConnection */ diff --git a/telepathy-glib/base-client.h b/telepathy-glib/base-client.h index 0aabedd..639cd0b 100644 --- a/telepathy-glib/base-client.h +++ b/telepathy-glib/base-client.h @@ -76,7 +76,7 @@ typedef void (*TpBaseClientClassHandleChannelImpl) ( struct _TpBaseClientClass { /**/ - GObjectClass parent_class; + GDBusObjectSkeletonClass parent_class; TpBaseClientClassObserveChannelImpl observe_channel; TpBaseClientClassAddDispatchOperationImpl add_dispatch_operation; TpBaseClientClassHandleChannelImpl handle_channel; @@ -87,7 +87,7 @@ struct _TpBaseClientClass { struct _TpBaseClient { /**/ - GObject parent; + GDBusObjectSkeleton parent; TpBaseClientPrivate *priv; }; -- 1.9.0