summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/gdaemonfileinputstream.c20
-rw-r--r--client/gdaemonfileoutputstream.c20
-rw-r--r--client/gvfsdaemondbus.c26
3 files changed, 13 insertions, 53 deletions
diff --git a/client/gdaemonfileinputstream.c b/client/gdaemonfileinputstream.c
index dd7d4624..f284fccf 100644
--- a/client/gdaemonfileinputstream.c
+++ b/client/gdaemonfileinputstream.c
@@ -665,14 +665,8 @@ g_daemon_file_input_stream_read (GInputStream *stream,
file = G_DAEMON_FILE_INPUT_STREAM (stream);
- if (g_cancellable_is_cancelled (cancellable))
- {
- g_set_error (error,
- G_IO_ERROR,
- G_IO_ERROR_CANCELLED,
- _("Operation was cancelled"));
- return -1;
- }
+ if (g_cancellable_set_error_if_cancelled (cancellable, error))
+ return -1;
/* Limit for sanity and to avoid 32bit overflow */
if (count > MAX_READ_SIZE)
@@ -1167,14 +1161,8 @@ g_daemon_file_input_stream_seek (GFileInputStream *stream,
return FALSE;
}
- if (g_cancellable_is_cancelled (cancellable))
- {
- g_set_error (error,
- G_IO_ERROR,
- G_IO_ERROR_CANCELLED,
- _("Operation was cancelled"));
- return FALSE;
- }
+ if (g_cancellable_set_error_if_cancelled (cancellable, error))
+ return FALSE;
memset (&op, 0, sizeof (op));
op.state = SEEK_STATE_INIT;
diff --git a/client/gdaemonfileoutputstream.c b/client/gdaemonfileoutputstream.c
index 1412a6a1..288616dc 100644
--- a/client/gdaemonfileoutputstream.c
+++ b/client/gdaemonfileoutputstream.c
@@ -560,14 +560,8 @@ g_daemon_file_output_stream_write (GOutputStream *stream,
file = G_DAEMON_FILE_OUTPUT_STREAM (stream);
- if (g_cancellable_is_cancelled (cancellable))
- {
- g_set_error (error,
- G_IO_ERROR,
- G_IO_ERROR_CANCELLED,
- _("Operation was cancelled"));
- return -1;
- }
+ if (g_cancellable_set_error_if_cancelled (cancellable, error))
+ return -1;
/* Limit for sanity and to avoid 32bit overflow */
if (count > MAX_WRITE_SIZE)
@@ -927,14 +921,8 @@ g_daemon_file_output_stream_seek (GFileOutputStream *stream,
return FALSE;
}
- if (g_cancellable_is_cancelled (cancellable))
- {
- g_set_error (error,
- G_IO_ERROR,
- G_IO_ERROR_CANCELLED,
- _("Operation was cancelled"));
- return FALSE;
- }
+ if (g_cancellable_set_error_if_cancelled (cancellable, error))
+ return FALSE;
memset (&op, 0, sizeof (op));
op.state = SEEK_STATE_INIT;
diff --git a/client/gvfsdaemondbus.c b/client/gvfsdaemondbus.c
index 50b32086..0b58807a 100644
--- a/client/gvfsdaemondbus.c
+++ b/client/gvfsdaemondbus.c
@@ -541,12 +541,8 @@ async_get_connection_response (DBusMessage *reply,
/* Maybe we were canceled while setting up connection, then
* avoid doing the operation */
- if (g_cancellable_is_cancelled (async_call->cancellable))
+ if (g_cancellable_set_error_if_cancelled (async_call->cancellable, &async_call->io_error))
{
- g_set_error (&async_call->io_error,
- G_IO_ERROR,
- G_IO_ERROR_CANCELLED,
- _("Operation was cancelled"));
async_call_finish (async_call, NULL);
return;
}
@@ -626,14 +622,8 @@ _g_vfs_daemon_call_sync (DBusMessage *message,
gboolean handle_callbacks;
const char *dbus_id = dbus_message_get_destination (message);
- if (g_cancellable_is_cancelled (cancellable))
- {
- g_set_error (error,
- G_IO_ERROR,
- G_IO_ERROR_CANCELLED,
- _("Operation was cancelled"));
- return NULL;
- }
+ if (g_cancellable_set_error_if_cancelled (cancellable, error))
+ return NULL;
connection = _g_dbus_connection_get_sync (dbus_id, error);
if (connection == NULL)
@@ -642,14 +632,8 @@ _g_vfs_daemon_call_sync (DBusMessage *message,
/* TODO: Handle errors below due to unmount and invalidate the
sync connection cache */
- if (g_cancellable_is_cancelled (cancellable))
- {
- g_set_error (error,
- G_IO_ERROR,
- G_IO_ERROR_CANCELLED,
- _("Operation was cancelled"));
- return NULL;
- }
+ if (g_cancellable_set_error_if_cancelled (cancellable, error))
+ return NULL;
handle_callbacks = FALSE;
if (callback_obj_path != NULL && callback != NULL)