1677
1677
_tp_implement_finish_void (self, \
1678
1678
tp_channel_dispatch_operation_close_channels_async)
1683
TpChannelGroupChangeReason reason;
1687
static LeaveChannelsCtx *
1688
leave_channels_ctx_new (TpChannelGroupChangeReason reason,
1689
const gchar *message)
1691
LeaveChannelsCtx *ctx = g_slice_new (LeaveChannelsCtx);
1693
ctx->reason = reason;
1694
ctx->message = g_strdup (message);
1699
leave_channels_ctx_free (LeaveChannelsCtx *ctx)
1701
g_free (ctx->message);
1702
g_slice_free (LeaveChannelsCtx, ctx);
1706
channel_leave_cb (GObject *source,
1707
GAsyncResult *result,
1710
GError *error = NULL;
1712
if (!tp_channel_leave_finish (TP_CHANNEL (source), result, &error))
1714
DEBUG ("Failed to leave %s: %s", tp_proxy_get_object_path (source),
1717
g_error_free (error);
1722
claim_leave_channels_cb (TpChannelDispatchOperation *self,
1723
GSimpleAsyncResult *result)
1726
LeaveChannelsCtx *ctx;
1728
ctx = g_simple_async_result_get_op_res_gpointer (result);
1730
for (i = 0; i < self->priv->channels->len; i++)
1732
TpChannel *channel = g_ptr_array_index (self->priv->channels, i);
1734
tp_channel_leave_async (channel, ctx->reason, ctx->message,
1735
channel_leave_cb, NULL);
1738
g_simple_async_result_complete (result);
1739
g_object_unref (result);
1743
* tp_channel_dispatch_operation_leave_channels_async:
1744
* @self: a #TpChannelDispatchOperation
1745
* @reason: the leave reason
1746
* @message: the leave message
1747
* @callback: a callback to call when the request has been satisfied
1748
* @user_data: data to pass to @callback
1750
* Called by an approver to claim channels and leave them all right away.
1751
* If this method is called successfully, @self has been claimed and
1752
* tp_channel_leave_async() has been called on all of its channels.
1754
* If successful, this method will cause the #TpProxy::invalidated signal
1755
* to be emitted, in the same way as for
1756
* tp_channel_dispatch_operation_handle_with_async().
1758
* This method may fail because the dispatch operation has already
1759
* been completed. Again, see tp_channel_dispatch_operation_handle_with_async()
1765
tp_channel_dispatch_operation_leave_channels_async (
1766
TpChannelDispatchOperation *self,
1767
TpChannelGroupChangeReason reason,
1768
const gchar *message,
1769
GAsyncReadyCallback callback,
1772
GSimpleAsyncResult *result;
1774
result = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
1775
tp_channel_dispatch_operation_leave_channels_async);
1777
g_simple_async_result_set_op_res_gpointer (result,
1778
leave_channels_ctx_new (reason, message),
1779
(GDestroyNotify) leave_channels_ctx_free);
1781
prepare_core_and_claim (self, claim_leave_channels_cb, result);
1785
* tp_channel_dispatch_operation_leave_channels_finish:
1786
* @self: a #TpChannelDispatchOperation
1787
* @result: a #GAsyncResult
1788
* @error: a #GError to fill
1790
* Finishes an async operation initiated using
1791
* tp_channel_dispatch_operation_leave_channels_async().
1793
* Returns: %TRUE if the Claim() call was successful and
1794
* tp_channel_leave_async() has at least been attempted on all the
1795
* channels, otherwise %FALSE
1800
tp_channel_dispatch_operation_leave_channels_finish (
1801
TpChannelDispatchOperation *self,
1802
GAsyncResult *result,
1805
_tp_implement_finish_void (self, \
1806
tp_channel_dispatch_operation_leave_channels_async)
1810
channel_destroy_cb (GObject *source,
1811
GAsyncResult *result,
1814
GError *error = NULL;
1816
if (!tp_channel_destroy_finish (TP_CHANNEL (source), result, &error))
1818
DEBUG ("Failed to destroy %s: %s", tp_proxy_get_object_path (source),
1821
g_error_free (error);
1826
claim_destroy_channels_cb (TpChannelDispatchOperation *self,
1827
GSimpleAsyncResult *result)
1831
for (i = 0; i < self->priv->channels->len; i++)
1833
TpChannel *channel = g_ptr_array_index (self->priv->channels, i);
1835
tp_channel_destroy_async (channel, channel_destroy_cb, NULL);
1838
g_simple_async_result_complete (result);
1839
g_object_unref (result);
1843
* tp_channel_dispatch_operation_destroy_channels_async:
1844
* @self: a #TpChannelDispatchOperation
1845
* @callback: a callback to call when the request has been satisfied
1846
* @user_data: data to pass to @callback
1848
* Called by an approver to claim channels and destroy them all right away.
1849
* If this method is called successfully, @self has been claimed and
1850
* tp_channel_destroy_async() has been called on all of its channels.
1852
* If successful, this method will cause the #TpProxy::invalidated signal
1853
* to be emitted, in the same way as for
1854
* tp_channel_dispatch_operation_handle_with_async().
1856
* This method may fail because the dispatch operation has already
1857
* been completed. Again, see tp_channel_dispatch_operation_handle_with_async()
1863
tp_channel_dispatch_operation_destroy_channels_async (
1864
TpChannelDispatchOperation *self,
1865
GAsyncReadyCallback callback,
1868
GSimpleAsyncResult *result;
1870
result = g_simple_async_result_new (G_OBJECT (self), callback, user_data,
1871
tp_channel_dispatch_operation_destroy_channels_async);
1873
prepare_core_and_claim (self, claim_destroy_channels_cb, result);
1877
* tp_channel_dispatch_operation_destroy_channels_finish:
1878
* @self: a #TpChannelDispatchOperation
1879
* @result: a #GAsyncResult
1880
* @error: a #GError to fill
1882
* Finishes an async operation initiated using
1883
* tp_channel_dispatch_operation_destroy_channels_async().
1885
* Returns: %TRUE if the Claim() call was successful and
1886
* tp_channel_destroy_async() has at least been attempted on all the
1887
* channels, otherwise %FALSE
1892
tp_channel_dispatch_operation_destroy_channels_finish (
1893
TpChannelDispatchOperation *self,
1894
GAsyncResult *result,
1897
_tp_implement_finish_void (self, \
1898
tp_channel_dispatch_operation_destroy_channels_async)