diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2012-06-15 17:24:42 +0200 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2012-07-31 11:59:37 +0200 |
commit | 89a881c5bf8fcbaf027e276a302aefc11f8fca34 (patch) | |
tree | 3b6fbd0f38d0e657d1988b4139f84148097fd4ce /client/gvfsiconloadable.c | |
parent | 36635d44502b5c4e8f7e1341ad9ec912bb822e0d (diff) | |
download | gvfs-89a881c5bf8fcbaf027e276a302aefc11f8fca34.tar.gz |
gdbus: Make cancellation work
This mimics the old behaviour and works for sync and async.
Requires new glib for g_dbus_connection_get_last_serial().
Diffstat (limited to 'client/gvfsiconloadable.c')
-rw-r--r-- | client/gvfsiconloadable.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/client/gvfsiconloadable.c b/client/gvfsiconloadable.c index 049eac8b..b639adfb 100644 --- a/client/gvfsiconloadable.c +++ b/client/gvfsiconloadable.c @@ -92,6 +92,7 @@ g_vfs_icon_load (GLoadableIcon *icon, GUnixFDList *fd_list; int fd; guint32 fd_id; + GError *local_error = NULL; g_print ("gvfsiconloadable.c: g_vfs_icon_load\n"); @@ -106,10 +107,17 @@ g_vfs_icon_load (GLoadableIcon *icon, &can_seek, &fd_list, cancellable, - error); + &local_error); g_print ("gvfsiconloadable.c: g_vfs_icon_load: done, res = %d\n", res); + if (! res) + { + if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + _g_dbus_send_cancelled_sync (g_dbus_proxy_get_connection (G_DBUS_PROXY (proxy))); + g_propagate_error (error, local_error); + } + g_object_unref (proxy); if (! res) @@ -143,6 +151,7 @@ typedef struct { GCancellable *cancellable; CreateProxyAsyncCallback callback; gpointer callback_data; + gulong cancelled_tag; } AsyncPathCall; @@ -308,6 +317,7 @@ open_icon_read_cb (GVfsDBusMount *proxy, out: _g_simple_async_result_complete_with_cancellable (data->result, data->cancellable); + _g_dbus_async_unsubscribe_cancellable (data->cancellable, data->cancelled_tag); async_path_call_free (data); } @@ -327,6 +337,7 @@ load_async_cb (GVfsDBusMount *proxy, cancellable, (GAsyncReadyCallback) open_icon_read_cb, callback_data); + data->cancelled_tag = _g_dbus_async_subscribe_cancellable (data->connection, cancellable); } static void |