diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-02-09 13:17:55 +0100 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-02-09 13:17:55 +0100 |
commit | 6229e83759a5e6adf5117a5b49ae59f97cc77cad (patch) | |
tree | 9493ba581c8d3d89037ee67361f27243af7aaeee | |
parent | d80b5439c05c4770d7e400a361e3ee88620278fb (diff) | |
parent | 5e062418e06f83064e814fdb0c154154209df159 (diff) |
Merge branch 'chan-request-33761'
-rw-r--r-- | docs/reference/telepathy-glib-sections.txt | 1 | ||||
-rw-r--r-- | telepathy-glib/account-channel-request.c | 45 | ||||
-rw-r--r-- | telepathy-glib/account-channel-request.h | 4 | ||||
-rw-r--r-- | tests/dbus/account-channel-request.c | 12 |
4 files changed, 62 insertions, 0 deletions
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index ada0c874..a7550027 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -5053,6 +5053,7 @@ tp_account_channel_request_create_channel_finish tp_account_channel_request_ensure_channel_async tp_account_channel_request_ensure_channel_finish tp_account_channel_request_set_channel_factory +tp_account_channel_request_get_channel_request <SUBSECTION Standard> tp_account_channel_request_get_type TP_ACCOUNT_CHANNEL_REQUEST diff --git a/telepathy-glib/account-channel-request.c b/telepathy-glib/account-channel-request.c index f3adb62a..d8c53022 100644 --- a/telepathy-glib/account-channel-request.c +++ b/telepathy-glib/account-channel-request.c @@ -87,6 +87,7 @@ enum { PROP_ACCOUNT = 1, PROP_REQUEST, PROP_USER_ACTION_TIME, + PROP_CHANNEL_REQUEST, N_PROPS }; @@ -196,6 +197,10 @@ tp_account_channel_request_get_property (GObject *object, g_value_set_int64 (value, self->priv->user_action_time); break; + case PROP_CHANNEL_REQUEST: + g_value_set_object (value, self->priv->chan_request); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -334,6 +339,30 @@ tp_account_channel_request_class_init ( g_object_class_install_property (object_class, PROP_USER_ACTION_TIME, param_spec); + /** + * TpAccountChannelRequest:channel-request: + * + * The #TpChannelRequest used to request the channel, or %NULL if the + * channel has not be requested yet. + * + * This can be useful for example to compare with the #TpChannelRequest + * objects received from the requests_satisfied argument of + * #TpSimpleHandlerHandleChannelsImpl to check if the client is asked to + * handle the channel it just requested. + * + * Note that the #TpChannelRequest objects may be different while still + * representing the same ChannelRequest on D-Bus. You have to compare + * them using their object paths (tp_proxy_get_object_path()). + * + * Since 0.11.UNRELEASED + */ + param_spec = g_param_spec_object ("channel-request", "channel request", + "TpChannelRequest", + TP_TYPE_CHANNEL_REQUEST, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_CHANNEL_REQUEST, + param_spec); + /** * TpAccountChannelRequest::re-handled: * @self: a #TpAccountChannelRequest @@ -1182,3 +1211,19 @@ tp_account_channel_request_set_channel_factory (TpAccountChannelRequest *self, tp_clear_object (&self->priv->factory); self->priv->factory = g_object_ref (factory); } + +/** + * tp_account_channel_request_get_user_action_time: + * @self: a #TpAccountChannelRequest + * + * Return the #TpAccountChannelRequest:channel-request property + * + * Returns: the value of #TpAccountChannelRequest:channel-request + * + * Since: 0.11.UNRELEASED + */ +TpChannelRequest * +tp_account_channel_request_get_channel_request (TpAccountChannelRequest *self) +{ + return self->priv->chan_request; +} diff --git a/telepathy-glib/account-channel-request.h b/telepathy-glib/account-channel-request.h index 7327fdf0..19ca0784 100644 --- a/telepathy-glib/account-channel-request.h +++ b/telepathy-glib/account-channel-request.h @@ -27,6 +27,7 @@ #include <telepathy-glib/account.h> #include <telepathy-glib/channel.h> +#include <telepathy-glib/channel-request.h> #include <telepathy-glib/client-channel-factory.h> #include <telepathy-glib/handle-channels-context.h> @@ -74,6 +75,9 @@ void tp_account_channel_request_set_channel_factory ( TpAccountChannelRequest *self, TpClientChannelFactory *factory); +TpChannelRequest * tp_account_channel_request_get_channel_request ( + TpAccountChannelRequest *self); + /* Request and handle API */ void tp_account_channel_request_create_and_handle_channel_async ( diff --git a/tests/dbus/account-channel-request.c b/tests/dbus/account-channel-request.c index e322ae4a..b92217ae 100644 --- a/tests/dbus/account-channel-request.c +++ b/tests/dbus/account-channel-request.c @@ -191,10 +191,16 @@ test_handle_create_success (Test *test, { GHashTable *request; TpAccountChannelRequest *req; + TpChannelRequest *chan_req; request = create_request (); req = tp_account_channel_request_new (test->account, request, 0); + /* We didn't start requesting the channel yet, so there is no + * ChannelRequest */ + chan_req = tp_account_channel_request_get_channel_request (req); + g_assert (chan_req == NULL); + tp_account_channel_request_create_and_handle_channel_async (req, NULL, create_and_handle_cb, test); @@ -203,6 +209,12 @@ test_handle_create_success (Test *test, g_main_loop_run (test->mainloop); g_assert_no_error (test->error); + + /* The ChannelRequest has been defined */ + g_object_get (req, "channel-request", &chan_req, NULL); + g_assert (TP_IS_CHANNEL_REQUEST (chan_req)); + g_assert (tp_account_channel_request_get_channel_request (req) == chan_req); + g_object_unref (chan_req); } /* ChannelDispatcher.CreateChannel() call fails */ |