From c94a9de5d5c2de75b0eb71d1b0744b059116cf7b Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 14 Jul 2011 13:43:04 +0200 Subject: [PATCH] Add tp_simple_client_factory_dup_channel_dispatch_operation() --- docs/reference/telepathy-glib-sections.txt | 1 + telepathy-glib/channel-dispatch-operation.c | 13 +++++++ telepathy-glib/simple-client-factory-internal.h | 5 +++ telepathy-glib/simple-client-factory.c | 42 +++++++++++++++++++++++ telepathy-glib/simple-client-factory.h | 6 +++ 5 files changed, 67 insertions(+), 0 deletions(-) diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index e5af863..1b83ec5 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -5702,6 +5702,7 @@ tp_simple_client_factory_dup_contact tp_simple_client_factory_dup_contact_features tp_simple_client_factory_add_contact_features tp_simple_client_factory_dup_channel_request +tp_simple_client_factory_dup_channel_dispatch_operation TP_IS_SIMPLE_CLIENT_FACTORY TP_IS_SIMPLE_CLIENT_FACTORY_CLASS diff --git a/telepathy-glib/channel-dispatch-operation.c b/telepathy-glib/channel-dispatch-operation.c index 8ccb652..c66496e 100644 --- a/telepathy-glib/channel-dispatch-operation.c +++ b/telepathy-glib/channel-dispatch-operation.c @@ -36,6 +36,7 @@ #define DEBUG_FLAG TP_DEBUG_DISPATCHER #include "telepathy-glib/dbus-internal.h" #include "telepathy-glib/debug-internal.h" +#include "telepathy-glib/simple-client-factory-internal.h" #include "telepathy-glib/_gen/signals-marshal.h" #include "telepathy-glib/_gen/tp-cli-channel-dispatch-operation-body.h" @@ -912,6 +913,17 @@ tp_channel_dispatch_operation_new (TpDBusDaemon *bus_daemon, GHashTable *immutable_properties, GError **error) { + return _tp_channel_dispatch_operation_new_with_factory (bus_daemon, + object_path, immutable_properties, error, NULL); +} + +TpChannelDispatchOperation * +_tp_channel_dispatch_operation_new_with_factory (TpDBusDaemon *bus_daemon, + const gchar *object_path, + GHashTable *immutable_properties, + GError **error, + TpSimpleClientFactory *factory) +{ TpChannelDispatchOperation *self; gchar *unique_name; @@ -932,6 +944,7 @@ tp_channel_dispatch_operation_new (TpDBusDaemon *bus_daemon, "bus-name", unique_name, "object-path", object_path, "cdo-properties", immutable_properties, + "factory", factory, NULL)); g_free (unique_name); diff --git a/telepathy-glib/simple-client-factory-internal.h b/telepathy-glib/simple-client-factory-internal.h index 00c67ff..d415300 100644 --- a/telepathy-glib/simple-client-factory-internal.h +++ b/telepathy-glib/simple-client-factory-internal.h @@ -49,6 +49,11 @@ TpChannelRequest *_tp_channel_request_new_with_factory ( void _tp_channel_request_ensure_immutable_properties (TpChannelRequest *self, GHashTable *immutable_properties); +TpChannelDispatchOperation *_tp_channel_dispatch_operation_new_with_factory ( + TpDBusDaemon *bus_daemon, const gchar *object_path, + GHashTable *immutable_properties, GError **error, + TpSimpleClientFactory *factory); + G_END_DECLS diff --git a/telepathy-glib/simple-client-factory.c b/telepathy-glib/simple-client-factory.c index 1bfa627..a2f4c19 100644 --- a/telepathy-glib/simple-client-factory.c +++ b/telepathy-glib/simple-client-factory.c @@ -907,3 +907,45 @@ tp_simple_client_factory_dup_channel_request (TpSimpleClientFactory *self, return request; } + +/** + * tp_simple_client_factory_dup_channel_dispatch_operation: + * @self: a #TpSimpleClientFactory object + * @object_path: the non-NULL object path of this connection + * @immutable_properties: (transfer none) (element-type utf8 GObject.Value): + * the immutable properties of the channel dispatch operation + * @error: Used to raise an error if @object_path is not valid + * + * If a #TpChannelDispatchOperation proxy has already been created using this + * method for the given @object_path, it will be returned. Otherwise a new one + * will be created. + * + * @self keeps only a weak-ref on the returned object, so it is the caller's + * responsability to keep a strong ref as long as needed. + * + * Returns: (transfer full): a new or existing #TpChannelDispatchOperation proxy; + * see tp_channel_dispatch_operation_new(). + * + * Since: 0.UNRELEASED + */ +TpChannelDispatchOperation * +tp_simple_client_factory_dup_channel_dispatch_operation (TpSimpleClientFactory *self, + const gchar *object_path, + GHashTable *immutable_properties, + GError **error) +{ + TpChannelDispatchOperation *dispatch; + + g_return_val_if_fail (TP_IS_SIMPLE_CLIENT_FACTORY (self), NULL); + g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); + + dispatch = lookup_proxy (self, object_path); + if (dispatch != NULL) + return g_object_ref (dispatch); + + dispatch = _tp_channel_dispatch_operation_new_with_factory (self->priv->dbus, + object_path, immutable_properties, error, self); + insert_proxy (self, dispatch); + + return dispatch; +} diff --git a/telepathy-glib/simple-client-factory.h b/telepathy-glib/simple-client-factory.h index 0f6e50b..7eb268a 100644 --- a/telepathy-glib/simple-client-factory.h +++ b/telepathy-glib/simple-client-factory.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -142,6 +143,11 @@ TpChannelRequest *tp_simple_client_factory_dup_channel_request ( TpSimpleClientFactory *self, const gchar *object_path, GHashTable *immutable_properties, GError **error); +/* TpChannelDispatchOperation */ +TpChannelDispatchOperation *tp_simple_client_factory_dup_channel_dispatch_operation ( + TpSimpleClientFactory *self, const gchar *object_path, + GHashTable *immutable_properties, GError **error); + G_END_DECLS #endif -- 1.7.4.1