diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-05-10 11:36:27 +0200 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-05-10 11:37:55 +0200 |
commit | 4c3b73e98fbf88d24f3fd42a998511b055c89001 (patch) | |
tree | cb3e55cde37e36a5447528e9f45b1170b20fb6b9 | |
parent | db9240a129ae9af2cf56ec9aa9c7622be22f60d9 (diff) |
add _tp_channel_dispatch_operation_new_with_objects
This can be used by tp-glib to create a new CDO using existing proxies rather
than creating new ones.
-rw-r--r-- | docs/reference/Makefile.am | 1 | ||||
-rw-r--r-- | telepathy-glib/Makefile.am | 1 | ||||
-rw-r--r-- | telepathy-glib/channel-dispatch-operation-internal.h | 39 | ||||
-rw-r--r-- | telepathy-glib/channel-dispatch-operation.c | 43 |
4 files changed, 84 insertions, 0 deletions
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am index 9097afb7..a0601b8f 100644 --- a/docs/reference/Makefile.am +++ b/docs/reference/Makefile.am @@ -64,6 +64,7 @@ CFILE_GLOB=$(top_srcdir)/telepathy-glib/*.c $(top_builddir)/telepathy-glib/_gen/ # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h IGNORE_HFILES=\ add-dispatch-operation-context-internal.h \ + channel-dispatch-operation-internal.h \ channel-internal.h \ connection-internal.h \ debug-internal.h \ diff --git a/telepathy-glib/Makefile.am b/telepathy-glib/Makefile.am index 8a83d95b..b0252b9e 100644 --- a/telepathy-glib/Makefile.am +++ b/telepathy-glib/Makefile.am @@ -126,6 +126,7 @@ libtelepathy_glib_internal_la_SOURCES = \ channel-internal.h \ channel-dispatcher.c \ channel-dispatch-operation.c \ + channel-dispatch-operation-internal.h \ channel-manager.c \ channel-request.c \ client.c \ diff --git a/telepathy-glib/channel-dispatch-operation-internal.h b/telepathy-glib/channel-dispatch-operation-internal.h new file mode 100644 index 00000000..4e19acaa --- /dev/null +++ b/telepathy-glib/channel-dispatch-operation-internal.h @@ -0,0 +1,39 @@ +/* + * channel-dispatch-operation-internal.h - proxy for channels awaiting approval + * + * Copyright © 2010 Collabora Ltd. <http://www.collabora.co.uk/> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef TP_CHANNEL_DISPATCH_OPERATION_INTERNAL_H +#define TP_CHANNEL_DISPATCH_OPERATION_INTERNAL_H + +#include <telepathy-glib/channel-dispatch-operation.h> + +G_BEGIN_DECLS + +TpChannelDispatchOperation * _tp_channel_dispatch_operation_new_with_objects ( + TpDBusDaemon *bus_daemon, + const gchar *object_path, + GHashTable *immutable_properties, + TpAccount *account, + TpConnection *connection, + GPtrArray *channels, + GError **error); + +G_END_DECLS + +#endif diff --git a/telepathy-glib/channel-dispatch-operation.c b/telepathy-glib/channel-dispatch-operation.c index 3d00d0fc..afaa5e8d 100644 --- a/telepathy-glib/channel-dispatch-operation.c +++ b/telepathy-glib/channel-dispatch-operation.c @@ -20,6 +20,7 @@ */ #include "telepathy-glib/channel-dispatch-operation.h" +#include "telepathy-glib/channel-dispatch-operation-internal.h" #include <telepathy-glib/channel.h> #include <telepathy-glib/defs.h> @@ -1268,3 +1269,45 @@ tp_channel_dispatch_operation_claim_finish ( return TRUE; } + +/* This can be used by tp-glib to create a new CDO using existing proxies + * (account, connection, channels) rather than creating new ones. */ +TpChannelDispatchOperation * +_tp_channel_dispatch_operation_new_with_objects (TpDBusDaemon *bus_daemon, + const gchar *object_path, + GHashTable *immutable_properties, + TpAccount *account, + TpConnection *connection, + GPtrArray *channels, + GError **error) +{ + TpChannelDispatchOperation *self; + gchar *unique_name; + + g_return_val_if_fail (bus_daemon != NULL, NULL); + g_return_val_if_fail (object_path != NULL, NULL); + g_return_val_if_fail (error == NULL || *error == NULL, NULL); + + if (!tp_dbus_check_valid_object_path (object_path, error)) + return NULL; + + if (!_tp_dbus_daemon_get_name_owner (bus_daemon, -1, + TP_CHANNEL_DISPATCHER_BUS_NAME, &unique_name, error)) + return NULL; + + self = TP_CHANNEL_DISPATCH_OPERATION (g_object_new ( + TP_TYPE_CHANNEL_DISPATCH_OPERATION, + "dbus-daemon", bus_daemon, + "dbus-connection", ((TpProxy *) bus_daemon)->dbus_connection, + "bus-name", unique_name, + "object-path", object_path, + "cdo-properties", immutable_properties, + "account", account, + "connection", connection, + "channels", channels, + NULL)); + + g_free (unique_name); + + return self; +} |