diff options
30 files changed, 200 insertions, 199 deletions
diff --git a/client/gdaemonfile.c b/client/gdaemonfile.c index 351d564b..a6cf6d34 100644 --- a/client/gdaemonfile.c +++ b/client/gdaemonfile.c @@ -537,7 +537,7 @@ g_daemon_file_get_info (GFile *file, if (!dbus_message_iter_init (reply, &iter) || (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_STRUCT)) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Invalid return value from get_info")); goto out; } @@ -567,7 +567,7 @@ read_async_get_fd_cb (int fd, if (fd == -1) { error = NULL; - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Didn't get stream file descriptor")); data->read_callback (data->file, NULL, data->callback_data, error); g_error_free (error); @@ -609,7 +609,7 @@ read_async_cb (DBusMessage *reply, DBUS_TYPE_INVALID)) { error = NULL; - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Invalid return value from open")); read_callback (file, NULL, op_callback_data, error); g_error_free (error); @@ -665,7 +665,7 @@ g_daemon_file_read (GFile *file, DBUS_TYPE_INVALID)) { dbus_message_unref (reply); - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Invalid return value from open")); return NULL; } @@ -675,7 +675,7 @@ g_daemon_file_read (GFile *file, fd = _g_dbus_connection_get_fd_sync (connection, fd_id); if (fd == -1) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Didn't get stream file descriptor")); return NULL; } @@ -718,7 +718,7 @@ g_daemon_file_append_to (GFile *file, DBUS_TYPE_INVALID)) { dbus_message_unref (reply); - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Invalid return value from open")); return NULL; } @@ -728,7 +728,7 @@ g_daemon_file_append_to (GFile *file, fd = _g_dbus_connection_get_fd_sync (connection, fd_id); if (fd == -1) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Didn't get stream file descriptor")); return NULL; } @@ -771,7 +771,7 @@ g_daemon_file_create (GFile *file, DBUS_TYPE_INVALID)) { dbus_message_unref (reply); - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Invalid return value from open")); return NULL; } @@ -781,7 +781,7 @@ g_daemon_file_create (GFile *file, fd = _g_dbus_connection_get_fd_sync (connection, fd_id); if (fd == -1) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Didn't get stream file descriptor")); return NULL; } @@ -826,7 +826,7 @@ g_daemon_file_replace (GFile *file, DBUS_TYPE_INVALID)) { dbus_message_unref (reply); - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Invalid return value from open")); return NULL; } @@ -836,7 +836,7 @@ g_daemon_file_replace (GFile *file, fd = _g_dbus_connection_get_fd_sync (connection, fd_id); if (fd == -1) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Didn't get stream file descriptor")); return NULL; } diff --git a/client/gdaemonfileinputstream.c b/client/gdaemonfileinputstream.c index 89478404..d7fe7d04 100644 --- a/client/gdaemonfileinputstream.c +++ b/client/gdaemonfileinputstream.c @@ -383,7 +383,7 @@ run_sync_state_machine (GDaemonFileInputStream *file, } else { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Error in stream protocol: %s"), io_error->message); g_error_free (io_error); return FALSE; @@ -391,7 +391,7 @@ run_sync_state_machine (GDaemonFileInputStream *file, } else if (res == 0 && io_data.io_size != 0) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Error in stream protocol: %s"), _("End of stream")); return FALSE; } @@ -1246,7 +1246,7 @@ async_op_handle (AsyncIterator *iterator, else { error = NULL; - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Error in stream protocol: %s"), io_error->message); async_iterator_done (iterator, error); g_error_free (error); @@ -1256,7 +1256,7 @@ async_op_handle (AsyncIterator *iterator, else if (res == 0 && io_data->io_size != 0) { error = NULL; - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Error in stream protocol: %s"), _("End of stream")); async_iterator_done (iterator, error); g_error_free (error); diff --git a/client/gdaemonfileoutputstream.c b/client/gdaemonfileoutputstream.c index db626877..7fffcb8a 100644 --- a/client/gdaemonfileoutputstream.c +++ b/client/gdaemonfileoutputstream.c @@ -357,7 +357,7 @@ run_sync_state_machine (GDaemonFileOutputStream *file, } else { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Error in stream protocol: %s"), io_error->message); g_error_free (io_error); return FALSE; @@ -365,7 +365,7 @@ run_sync_state_machine (GDaemonFileOutputStream *file, } else if (res == 0 && io_data.io_size != 0) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Error in stream protocol: %s"), _("End of stream")); return FALSE; } @@ -1002,7 +1002,7 @@ async_op_handle (AsyncIterator *iterator, else { error = NULL; - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Error in stream protocol: %s"), io_error->message); async_iterator_done (iterator, error); g_error_free (error); @@ -1012,7 +1012,7 @@ async_op_handle (AsyncIterator *iterator, else if (res == 0 && io_data->io_size != 0) { error = NULL; - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Error in stream protocol: %s"), _("End of stream")); async_iterator_done (iterator, error); g_error_free (error); diff --git a/client/gdaemonvfs.c b/client/gdaemonvfs.c index fbd83090..7da4642b 100644 --- a/client/gdaemonvfs.c +++ b/client/gdaemonvfs.c @@ -343,7 +343,7 @@ handler_lookup_mount_reply (DBusMessage *reply, mount_spec = g_mount_spec_from_dbus (&iter); if (mount_spec == NULL) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Error while getting mount info: %s", "Invalid reply"); return NULL; @@ -497,7 +497,7 @@ _g_daemon_vfs_get_mount_info_sync (GMountSpec *spec, if (!reply) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Error while getting mount info: %s", derror.message); dbus_error_free (&derror); diff --git a/client/gvfsdaemondbus.c b/client/gvfsdaemondbus.c index 3125e5c5..88e6920c 100644 --- a/client/gvfsdaemondbus.c +++ b/client/gvfsdaemondbus.c @@ -495,7 +495,7 @@ async_get_connection_response (DBusMessage *reply, extra_fd = _g_socket_connect (address2, &error); if (extra_fd == -1) { - g_set_error (&async_call->io_error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (&async_call->io_error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Error connecting to daemon: %s"), error->message); g_error_free (error); async_call_finish (async_call, NULL); @@ -510,7 +510,7 @@ async_get_connection_response (DBusMessage *reply, close (extra_fd); dbus_message_unref (reply); - g_set_error (&async_call->io_error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (&async_call->io_error, G_IO_ERROR, G_IO_ERROR_FAILED, "Error while getting peer-to-peer dbus connection: %s", derror.message); dbus_error_free (&derror); @@ -655,7 +655,7 @@ _g_vfs_daemon_call_sync (DBusMessage *message, if (pending == NULL) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Error while getting peer-to-peer dbus connection: %s", "Connection is closed"); return NULL; @@ -667,7 +667,7 @@ _g_vfs_daemon_call_sync (DBusMessage *message, if (!dbus_connection_get_unix_fd (connection, &dbus_fd)) { dbus_pending_call_unref (pending); - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Error while getting peer-to-peer dbus connection: %s", "No fd"); return NULL; @@ -692,7 +692,7 @@ _g_vfs_daemon_call_sync (DBusMessage *message, if (poll_ret == -1) { dbus_pending_call_unref (pending); - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Error while getting peer-to-peer dbus connection: %s", "poll error"); return NULL; @@ -824,7 +824,7 @@ _g_dbus_connection_get_sync (const char *dbus_id, bus = dbus_bus_get_private (DBUS_BUS_SESSION, &derror); if (bus == NULL) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Couldn't get main dbus connection: %s\n", derror.message); dbus_error_free (&derror); @@ -847,7 +847,7 @@ _g_dbus_connection_get_sync (const char *dbus_id, if (!reply) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Error while getting peer-to-peer dbus connection: %s", derror.message); dbus_error_free (&derror); @@ -866,7 +866,7 @@ _g_dbus_connection_get_sync (const char *dbus_id, extra_fd = _g_socket_connect (address2, &local_error); if (extra_fd == -1) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Error connecting to daemon: %s"), local_error->message); g_error_free (local_error); dbus_message_unref (reply); @@ -877,7 +877,7 @@ _g_dbus_connection_get_sync (const char *dbus_id, connection = dbus_connection_open_private (address1, &derror); if (!connection) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Error while getting peer-to-peer dbus connection: %s", derror.message); close (extra_fd); @@ -986,7 +986,7 @@ _g_dbus_get_file_info (DBusMessageIter *iter, error: g_object_unref (info); - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Invalid file info format")); return NULL; } diff --git a/common/gdbusutils.c b/common/gdbusutils.c index b4b7af3f..710155ca 100644 --- a/common/gdbusutils.c +++ b/common/gdbusutils.c @@ -529,7 +529,6 @@ _g_error_from_dbus (DBusError *derror, GError **error) { const char *name, *end;; - char *m; GString *str; GQuark domain; int code; @@ -557,11 +556,8 @@ _g_error_from_dbus (DBusError *derror, } /* TODO: Special case other types, like DBUS_ERROR_NO_MEMORY etc? */ else - { - m = g_strdup_printf ("DBus error %s: %s", derror->name, derror->message); - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_IO, "%s", m); - g_free (m); - } + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "DBus error %s: %s", derror->name, derror->message); } GList * @@ -1272,7 +1268,7 @@ _g_dbus_connection_call_async (DBusConnection *connection, if (pending_call == NULL) { - g_set_error (&data->io_error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (&data->io_error, G_IO_ERROR, G_IO_ERROR_FAILED, "Error while getting peer-to-peer dbus connection: %s", "Connection is closed"); g_idle_add (async_call_error_at_idle, data); diff --git a/common/gmountsource.c b/common/gmountsource.c index ebcf520c..c6bc2147 100644 --- a/common/gmountsource.c +++ b/common/gmountsource.c @@ -263,7 +263,7 @@ g_mount_source_request_mount_spec (GMountSource *source, dbus_message_unref (reply); if (source->mount_spec == NULL) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, "No mount spec gotten from mount source"); return NULL; } @@ -297,7 +297,7 @@ request_mount_spec_reply (DBusMessage *reply, if (data->source->mount_spec == NULL) { error = NULL; - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_INVAL, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, "No mount spec gotten from mount source"); data->callback (data->source, NULL, error, data->user_data); g_error_free (error); diff --git a/common/gsysutils.c b/common/gsysutils.c index d9a04e85..1e25ffba 100644 --- a/common/gsysutils.c +++ b/common/gsysutils.c @@ -5,6 +5,7 @@ #include <stdio.h> #include <errno.h> #include <unistd.h> +#include <gio/gioerror.h> #include <glib/gi18n-lib.h> @@ -92,8 +93,8 @@ _g_socket_connect (const char *address, fd = socket (PF_UNIX, SOCK_STREAM, 0); if (fd == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error creating socket: %s"), g_strerror (errno)); return -1; @@ -128,8 +129,8 @@ _g_socket_connect (const char *address, if (connect (fd, (struct sockaddr*) &addr, G_STRUCT_OFFSET (struct sockaddr_un, sun_path) + path_len) < 0) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error connecting to socket: %s"), g_strerror (errno)); close (fd); diff --git a/daemon/daemon-main.c b/daemon/daemon-main.c index 87938a71..47127a71 100644 --- a/daemon/daemon-main.c +++ b/daemon/daemon-main.c @@ -146,8 +146,8 @@ daemon_main (int argc, if (res == -1) _g_error_from_dbus (&derror, &error); else - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_IO, - "mountpoint for %s already running", mountable_name); + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("mountpoint for %s already running"), mountable_name); g_mount_source_failed (mount_source, error); exit (1); } @@ -156,8 +156,8 @@ daemon_main (int argc, daemon = g_vfs_daemon_new (FALSE, FALSE); if (daemon == NULL) { - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_IO, - "error starting mount daemon"); + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, + _("error starting mount daemon")); g_mount_source_failed (mount_source, error); exit (1); } diff --git a/daemon/gvfsbackendsmb.c b/daemon/gvfsbackendsmb.c index 1d9fb364..03a1ade1 100644 --- a/daemon/gvfsbackendsmb.c +++ b/daemon/gvfsbackendsmb.c @@ -398,8 +398,8 @@ do_mount (GVfsBackend *backend, if (smb_context == NULL) { g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_IO, - "Failed to allocate smb context"); + G_IO_ERROR, G_IO_ERROR_FAILED, + _("Failed to allocate smb context")); return; } smbc_option_set (smb_context, "user_data", backend); @@ -433,8 +433,8 @@ do_mount (GVfsBackend *backend, if (!smbc_init_context (smb_context)) { g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_IO, - "Failed to initialize smb context"); + G_IO_ERROR, G_IO_ERROR_FAILED, + _("Failed to initialize smb context")); smbc_free_context (smb_context, FALSE); return; } @@ -484,8 +484,8 @@ do_mount (GVfsBackend *backend, /* TODO: Error from errno? */ op_backend->mount_source = NULL; g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_IO, - "Failed to mount smb share"); + G_IO_ERROR, G_IO_ERROR_FAILED, + _("Failed to mount smb share")); return; } @@ -507,7 +507,7 @@ try_mount (GVfsBackend *backend, if (server == NULL || share == NULL) { g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_INVAL, + G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Invalid mount spec")); return TRUE; } @@ -858,8 +858,8 @@ do_replace (GVfsBackend *backend, O_CREAT|O_WRONLY|O_EXCL, 0); if (file == NULL && errno != EEXIST) { - g_set_error (&error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (&error, G_IO_ERROR, + g_io_error_from_errno (errno), g_strerror (errno)); goto error; } @@ -919,8 +919,8 @@ do_replace (GVfsBackend *backend, O_CREAT|O_WRONLY|O_TRUNC, 0); if (file == NULL) { - g_set_error (&error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (&error, G_IO_ERROR, + g_io_error_from_errno (errno), g_strerror (errno)); goto error; } @@ -1187,8 +1187,8 @@ do_enumerate (GVfsBackend *backend, if (dir == NULL) { error = NULL; - g_set_error (&error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (&error, G_IO_ERROR, + g_io_error_from_errno (errno), g_strerror (errno)); goto error; } diff --git a/daemon/gvfsbackendsmbbrowse.c b/daemon/gvfsbackendsmbbrowse.c index 192d739d..9847fb5e 100644 --- a/daemon/gvfsbackendsmbbrowse.c +++ b/daemon/gvfsbackendsmbbrowse.c @@ -483,7 +483,7 @@ do_mount (GVfsBackend *backend, if (smb_context == NULL) { g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_IO, + G_IO_ERROR, G_IO_ERROR_FAILED, "Failed to allocate smb context"); return; } @@ -518,7 +518,7 @@ do_mount (GVfsBackend *backend, if (!smbc_init_context (smb_context)) { g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_IO, + G_IO_ERROR, G_IO_ERROR_FAILED, "Failed to initialize smb context"); smbc_free_context (smb_context, FALSE); return; @@ -572,7 +572,7 @@ try_mount (GVfsBackend *backend, if (server == NULL) { g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_INVAL, + G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, "No server specified for smb-server share"); return TRUE; } @@ -585,7 +585,7 @@ try_mount (GVfsBackend *backend, ((user != NULL) || (domain != NULL))) { g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_INVAL, + G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, "Can't automount smb browsing with specified user or domain"); return TRUE; } @@ -604,11 +604,11 @@ run_open_for_read (GVfsBackendSmbBrowse *backend, { if (has_name (backend, filename)) g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_ISDIR, + G_IO_ERROR, G_IO_ERROR_IS_DIRECTORY, _("Not a regular file")); else g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_NOENT, + G_IO_ERROR, G_IO_ERROR_NOT_FOUND, _("File doesn't exist")); } @@ -647,7 +647,7 @@ try_read (GVfsBackend *backend, gsize bytes_requested) { g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_INVAL, + G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, "Invalid argument"); return TRUE; @@ -661,7 +661,7 @@ try_seek_on_read (GVfsBackend *backend, GSeekType type) { g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_INVAL, + G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, "Invalid argument"); return TRUE; } @@ -672,7 +672,7 @@ try_close_read (GVfsBackend *backend, GVfsBackendHandle handle) { g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_INVAL, + G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, "Invalid argument"); return TRUE; } @@ -723,7 +723,7 @@ run_get_info (GVfsBackendSmbBrowse *backend, else { g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_NOENT, + G_IO_ERROR, G_IO_ERROR_NOT_FOUND, _("File doesn't exist")); } } @@ -785,11 +785,11 @@ run_enumerate (GVfsBackendSmbBrowse *backend, { if (has_name (backend, filename)) g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_NOTDIR, + G_IO_ERROR, G_IO_ERROR_NOT_DIRECTORY, _("Not a directory")); else g_vfs_job_failed (G_VFS_JOB (job), - G_FILE_ERROR, G_FILE_ERROR_NOENT, + G_IO_ERROR, G_IO_ERROR_NOT_FOUND, _("File doesn't exist")); return; } diff --git a/daemon/gvfsbackendtest.c b/daemon/gvfsbackendtest.c index 5c02df4b..0f1dbfd0 100644 --- a/daemon/gvfsbackendtest.c +++ b/daemon/gvfsbackendtest.c @@ -74,8 +74,8 @@ open_idle_cb (gpointer data) fd = g_open (job->filename, O_RDONLY); if (fd == -1) { - g_vfs_job_failed (G_VFS_JOB (job), G_FILE_ERROR, - g_file_error_from_errno (errno), + g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, + g_io_error_from_errno (errno), "Error opening file %s: %s", job->filename, g_strerror (errno)); } @@ -112,7 +112,7 @@ try_open_for_read (GVfsBackend *backend, if (strcmp (filename, "/fail") == 0) { - error = g_error_new (G_FILE_ERROR, G_FILE_ERROR_IO, "Test error"); + error = g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED, "Test error"); g_vfs_job_failed_from_error (G_VFS_JOB (job), error); } else @@ -137,8 +137,8 @@ read_idle_cb (gpointer data) if (res == -1) { - g_vfs_job_failed (G_VFS_JOB (job), G_FILE_ERROR, - g_file_error_from_errno (errno), + g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, + g_io_error_from_errno (errno), "Error reading from file: %s", g_strerror (errno)); } @@ -214,8 +214,8 @@ do_seek_on_read (GVfsBackend *backend, if (final_offset == (off_t)-1) { - g_vfs_job_failed (G_VFS_JOB (job), G_FILE_ERROR, - g_file_error_from_errno (errno), + g_vfs_job_failed (G_VFS_JOB (job), G_IO_ERROR, + g_io_error_from_errno (errno), "Error seeking in file: %s", g_strerror (errno)); } diff --git a/daemon/gvfsdaemon.c b/daemon/gvfsdaemon.c index 6fca997d..0aabb86b 100644 --- a/daemon/gvfsdaemon.c +++ b/daemon/gvfsdaemon.c @@ -960,7 +960,7 @@ mount_got_spec (GMountSource *mount_source, if (backend_type == G_TYPE_INVALID) { io_error = NULL; - g_set_error (&io_error, G_FILE_ERROR, G_FILE_ERROR_INVAL, + g_set_error (&io_error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, "Unsupported mount type"); g_mount_source_failed (mount_source, io_error); g_error_free (io_error); diff --git a/daemon/gvfsdaemonutils.c b/daemon/gvfsdaemonutils.c index 1cd86dff..5dc7d3b0 100644 --- a/daemon/gvfsdaemonutils.c +++ b/daemon/gvfsdaemonutils.c @@ -9,6 +9,8 @@ #include <glib/gthread.h> #include <glib/gi18n.h> + +#include <gio/gioerror.h> #include "gdbusutils.h" #include "gsysutils.h" #include "gvfsdaemonutils.h" @@ -61,8 +63,8 @@ dbus_connection_send_fd (DBusConnection *connection, if (extra->extra_fd == -1) { - g_set_error (error, G_FILE_ERROR, - G_FILE_ERROR_IO, + g_set_error (error, G_IO_ERROR, + G_IO_ERROR_FAILED, _("No fd passing socket availible")); return FALSE; } @@ -71,8 +73,8 @@ dbus_connection_send_fd (DBusConnection *connection, if (_g_socket_send_fd (extra->extra_fd, fd) == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error sending fd: %s"), g_strerror (errno)); g_static_mutex_unlock (&extra_lock); diff --git a/daemon/gvfsjob.c b/daemon/gvfsjob.c index 40e6a49f..a5423cd2 100644 --- a/daemon/gvfsjob.c +++ b/daemon/gvfsjob.c @@ -8,6 +8,7 @@ #include <glib.h> #include <dbus/dbus.h> #include <glib/gi18n.h> +#include <gio/gioerror.h> #include "gvfsjob.h" #include "gvfsjobsource.h" @@ -216,8 +217,8 @@ g_vfs_job_failed_from_errno (GVfsJob *job, { GError *error = NULL; - g_set_error (&error, G_FILE_ERROR, - g_file_error_from_errno (errno_arg), + g_set_error (&error, G_IO_ERROR, + g_io_error_from_errno (errno_arg), g_strerror (errno_arg)); g_vfs_job_failed_from_error (job, error); g_error_free (error); diff --git a/daemon/gvfsjobopenforwrite.c b/daemon/gvfsjobopenforwrite.c index 06f16a52..0744999e 100644 --- a/daemon/gvfsjobopenforwrite.c +++ b/daemon/gvfsjobopenforwrite.c @@ -172,7 +172,7 @@ try (GVfsJob *job) else { GError *error = NULL; - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_INVAL, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, "Wrong open for write type"); g_vfs_job_failed_from_error (job, error); g_error_free (error); diff --git a/daemon/mount.c b/daemon/mount.c index a135ea68..edd18f34 100644 --- a/daemon/mount.c +++ b/daemon/mount.c @@ -9,6 +9,7 @@ #include "gmountoperationdbus.h" #include "gvfsdaemonprotocol.h" #include "gdbusutils.h" +#include <gio/gioerror.h> struct _Mountable { char *type; @@ -111,7 +112,7 @@ exec_mount (Mountable *mountable, error = NULL; if (mountable->exec == NULL) { - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "No exec key defined for mountpoint"); g_mount_source_failed (source, error); g_error_free (error); @@ -176,7 +177,7 @@ mountable_mount (Mountable *mountable, conn = dbus_bus_get (DBUS_BUS_SESSION, NULL); if (conn == NULL) { - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "Error while getting peer-to-peer dbus connection"); g_mount_source_failed (source, error); g_error_free (error); @@ -199,7 +200,7 @@ mountable_mount (Mountable *mountable, if (pending == NULL) { - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_IO, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_FAILED, "Error while getting peer-to-peer dbus connection: %s", "Connection is closed"); g_mount_source_failed (source, error); diff --git a/gio/ginputstream.c b/gio/ginputstream.c index e3a4c1e8..298a8123 100644 --- a/gio/ginputstream.c +++ b/gio/ginputstream.c @@ -87,7 +87,7 @@ g_input_stream_init (GInputStream *stream) * @buffer. Will block during this read. * * If count is zero returns zero and does nothing. A value of @count - * larger than %G_MAXSSIZE will cause a %G_FILE_ERROR_INVAL error. + * larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error. * * On success, the number of bytes read into the buffer is returned. * It is not an error if this is not the same as the requested size, as it @@ -123,7 +123,7 @@ g_input_stream_read (GInputStream *stream, if (((gssize) count) < 0) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Too large count value passed to g_input_stream_read")); return -1; } @@ -261,7 +261,7 @@ g_input_stream_skip (GInputStream *stream, if (((gssize) count) < 0) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Too large count value passed to g_input_stream_skip")); return -1; } @@ -468,7 +468,7 @@ read_async_callback_wrapper (GInputStream *stream, * During an async request no other sync and async calls are allowed, and will * result in %G_IO_ERROR_PENDING errors. * - * A value of @count larger than %G_MAXSSIZE will cause a %G_FILE_ERROR_INVAL error. + * A value of @count larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error. * * On success, the number of bytes read into the buffer will be passed to the * callback. It is not an error if this is not the same as the requested size, as it @@ -510,7 +510,7 @@ g_input_stream_read_async (GInputStream *stream, if (((gssize) count) < 0) { error = NULL; - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_INVAL, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Too large count value passed to g_input_stream_read_async")); queue_read_async_result (stream, buffer, count, -1, error, callback, data); @@ -618,7 +618,7 @@ skip_async_callback_wrapper (GInputStream *stream, * During an async request no other sync and async calls are allowed, and will * result in %G_IO_ERROR_PENDING errors. * - * A value of @count larger than %G_MAXSSIZE will cause a %G_FILE_ERROR_INVAL error. + * A value of @count larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error. * * On success, the number of bytes skipped will be passed to the * callback. It is not an error if this is not the same as the requested size, as it @@ -658,7 +658,7 @@ g_input_stream_skip_async (GInputStream *stream, if (((gssize) count) < 0) { error = NULL; - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_INVAL, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Too large count value passed to g_input_stream_skip_async")); queue_skip_async_result (stream, count, -1, error, callback, data); diff --git a/gio/gioerror.c b/gio/gioerror.c index 22b7245a..12a7a0d7 100644 --- a/gio/gioerror.c +++ b/gio/gioerror.c @@ -18,7 +18,7 @@ g_io_error_from_errno (gint err_no) { #ifdef EEXIST case EEXIST: - return G_IO_ERROR_FILE_EXIST; + return G_IO_ERROR_EXIST; break; #endif diff --git a/gio/gioerror.h b/gio/gioerror.h index 68730c51..030ee507 100644 --- a/gio/gioerror.h +++ b/gio/gioerror.h @@ -20,7 +20,7 @@ typedef enum G_IO_ERROR_FAILED, G_IO_ERROR_INTERNAL_ERROR, G_IO_ERROR_NOT_FOUND, - G_IO_ERROR_FILE_EXISTS, + G_IO_ERROR_EXISTS, G_IO_ERROR_IS_DIRECTORY, G_IO_ERROR_NOT_DIRECTORY, G_IO_ERROR_NOT_EMPTY, diff --git a/gio/glocalfile.c b/gio/glocalfile.c index 5afb8093..63547125 100644 --- a/gio/glocalfile.c +++ b/gio/glocalfile.c @@ -379,16 +379,16 @@ g_local_file_set_display_name (GFile *file, if (!(g_stat (new_local->filename, &statbuf) == -1 && errno == ENOENT)) { - g_set_error (error, G_FILE_ERROR, - G_FILE_ERROR_EXIST, + g_set_error (error, G_IO_ERROR, + G_IO_ERROR_EXISTS, _("Can't rename file, filename already exist")); return NULL; } if (rename (local->filename, new_local->filename) == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error renaming file: %s"), g_strerror (errno)); g_object_unref (new_file); @@ -433,7 +433,7 @@ get_uint32 (GFileAttributeType type, { if (type != G_FILE_ATTRIBUTE_TYPE_UINT32) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Invalid attribute type (uint32 expected)")); return FALSE; } @@ -451,7 +451,7 @@ get_byte_string (GFileAttributeType type, { if (type != G_FILE_ATTRIBUTE_TYPE_BYTE_STRING) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Invalid attribute type (byte string expected)")); return FALSE; } @@ -483,8 +483,8 @@ g_local_file_set_attribute (GFile *file, if (g_chmod (local->filename, val) == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error setting permissions: %s"), g_strerror (errno)); return FALSE; @@ -505,8 +505,8 @@ g_local_file_set_attribute (GFile *file, if (res == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error setting owner: %s"), g_strerror (errno)); return FALSE; @@ -527,8 +527,8 @@ g_local_file_set_attribute (GFile *file, if (res == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error setting owner: %s"), g_strerror (errno)); return FALSE; @@ -546,15 +546,15 @@ g_local_file_set_attribute (GFile *file, if (val == NULL) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("symlink must be non-NULL")); return FALSE; } if (g_lstat (local->filename, &statbuf)) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error setting symlink: %s"), g_strerror (errno)); return FALSE; @@ -570,8 +570,8 @@ g_local_file_set_attribute (GFile *file, if (g_unlink (local->filename)) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error setting symlink: %s"), g_strerror (errno)); return FALSE; @@ -579,8 +579,8 @@ g_local_file_set_attribute (GFile *file, if (symlink (local->filename, val) != 0) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error setting symlink: %s"), g_strerror (errno)); return FALSE; @@ -604,8 +604,8 @@ g_local_file_read (GFile *file, fd = g_open (local->filename, O_RDONLY, 0); if (fd == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error opening file: %s"), g_strerror (errno)); return NULL; @@ -654,8 +654,8 @@ g_local_file_delete (GFile *file, if (g_remove (local->filename) == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error removing file: %s"), g_strerror (errno)); return FALSE; @@ -673,8 +673,8 @@ g_local_file_make_directory (GFile *file, if (g_mkdir (local->filename, 0755) == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error removing file: %s"), g_strerror (errno)); return FALSE; @@ -693,8 +693,8 @@ g_local_file_make_symbolic_link (GFile *file, if (symlink (local->filename, symlink_value) == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error making symbolic link: %s"), g_strerror (errno)); return FALSE; @@ -745,8 +745,8 @@ g_local_file_move (GFile *source, if ((flags & G_FILE_COPY_OVERWRITE) == 0 && destination_exist) { g_set_error (error, - G_FILE_ERROR, - G_FILE_ERROR_EXIST, + G_IO_ERROR, + G_IO_ERROR_EXISTS, _("Target file already exists")); return FALSE; } @@ -771,8 +771,8 @@ g_local_file_move (GFile *source, if (errno == EXDEV) goto fallback; else - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error moving file: %s"), g_strerror (errno)); return FALSE; diff --git a/gio/glocalfileenumerator.c b/gio/glocalfileenumerator.c index 5e790891..fb093544 100644 --- a/gio/glocalfileenumerator.c +++ b/gio/glocalfileenumerator.c @@ -126,8 +126,8 @@ g_local_file_enumerator_next_file (GFileEnumerator *enumerator, /* If the file does not exist there might have been a race where * the file was removed between the readdir and the stat, so we * ignore the file. */ - if (my_error->domain == G_FILE_ERROR && - my_error->code == G_FILE_ERROR_NOENT) + if (my_error->domain == G_IO_ERROR && + my_error->code == G_IO_ERROR_NOT_FOUND) { g_error_free (my_error); goto next_file; diff --git a/gio/glocalfileinfo.c b/gio/glocalfileinfo.c index 34fa1be3..c3387ddb 100644 --- a/gio/glocalfileinfo.c +++ b/gio/glocalfileinfo.c @@ -511,8 +511,8 @@ g_local_file_info_get (const char *basename, if (res == -1) { g_object_unref (info); - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error stating file '%s': %s"), path, g_strerror (errno)); return NULL; @@ -615,8 +615,8 @@ g_local_file_info_get_from_fd (int fd, if (fstat (fd, &stat_buf) == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error stating file descriptor: %s"), g_strerror (errno)); return NULL; diff --git a/gio/glocalfileinputstream.c b/gio/glocalfileinputstream.c index 85403523..e83bc894 100644 --- a/gio/glocalfileinputstream.c +++ b/gio/glocalfileinputstream.c @@ -112,8 +112,8 @@ g_local_file_input_stream_read (GInputStream *stream, if (errno == EINTR) continue; - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error reading from file: %s"), g_strerror (errno)); } @@ -147,8 +147,8 @@ g_local_file_input_stream_skip (GInputStream *stream, start = lseek (file->priv->fd, 0, SEEK_CUR); if (start == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error seeking in file: %s"), g_strerror (errno)); return -1; @@ -157,8 +157,8 @@ g_local_file_input_stream_skip (GInputStream *stream, res = lseek (file->priv->fd, count, SEEK_CUR); if (res == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error seeking in file: %s"), g_strerror (errno)); return -1; @@ -185,8 +185,8 @@ g_local_file_input_stream_close (GInputStream *stream, res = close (file->priv->fd); if (res == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error closing file: %s"), g_strerror (errno)); } diff --git a/gio/glocalfileoutputstream.c b/gio/glocalfileoutputstream.c index 2719bb4a..fba70a3a 100644 --- a/gio/glocalfileoutputstream.c +++ b/gio/glocalfileoutputstream.c @@ -110,8 +110,8 @@ g_local_file_output_stream_write (GOutputStream *stream, if (errno == EINTR) continue; - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error writing to file': %s"), g_strerror (errno)); } @@ -153,8 +153,8 @@ g_local_file_output_stream_close (GOutputStream *stream, /* create original -> backup link, the original is then renamed over */ if (link (file->priv->original_filename, file->priv->backup_filename) != 0) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error creating backup link: %s"), g_strerror (errno)); goto err_out; @@ -174,8 +174,8 @@ g_local_file_output_stream_close (GOutputStream *stream, /* tmp -> original */ if (rename (file->priv->tmp_filename, file->priv->original_filename) != 0) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error renamining temporary file: %s"), g_strerror (errno)); goto err_out; @@ -214,8 +214,8 @@ g_local_file_output_stream_close (GOutputStream *stream, res = close (file->priv->fd); if (res == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error closing file: %s"), g_strerror (errno)); } @@ -276,8 +276,8 @@ g_local_file_output_stream_create (const char *filename, 0666); if (fd == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error opening file '%s': %s"), filename, g_strerror (errno)); return NULL; @@ -310,8 +310,8 @@ g_local_file_output_stream_append (const char *filename, 0666); if (fd == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error opening file '%s': %s"), filename, g_strerror (errno)); return NULL; @@ -353,8 +353,8 @@ copy_file_data (gint sfd, if (errno == EINTR) continue; - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error reading from file': %s"), g_strerror (errno)); ret = FALSE; @@ -372,8 +372,8 @@ copy_file_data (gint sfd, if (errno == EINTR) continue; - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error writing to file: %s"), g_strerror (errno)); ret = FALSE; @@ -432,8 +432,8 @@ handle_overwrite_open (const char *filename, if (fd == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error opening file '%s': %s"), filename, g_strerror (errno)); return -1; @@ -441,8 +441,8 @@ handle_overwrite_open (const char *filename, if (fstat (fd, &original_stat) != 0) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error stating file '%s': %s"), filename, g_strerror (errno)); goto err_out; @@ -453,8 +453,8 @@ handle_overwrite_open (const char *filename, { if (S_ISDIR (original_stat.st_mode)) g_set_error (error, - G_FILE_ERROR, - G_FILE_ERROR_ISDIR, + G_IO_ERROR, + G_IO_ERROR_IS_DIRECTORY, _("Target file is a directory")); else g_set_error (error, @@ -589,8 +589,8 @@ handle_overwrite_open (const char *filename, /* Seek back to the start of the file after the backup copy */ if (lseek (fd, 0, SEEK_SET) == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error seeking in file: %s"), g_strerror (errno)); goto err_out; @@ -600,8 +600,8 @@ handle_overwrite_open (const char *filename, /* Truncate the file at the start */ if (ftruncate (fd, 0) == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error truncating file: %s"), g_strerror (errno)); goto err_out; @@ -651,8 +651,8 @@ g_local_file_output_stream_replace (const char *filename, } else if (fd == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error opening file '%s': %s"), filename, g_strerror (errno)); return NULL; diff --git a/gio/goutputstream.c b/gio/goutputstream.c index be08880e..5cd309f6 100644 --- a/gio/goutputstream.c +++ b/gio/goutputstream.c @@ -81,7 +81,7 @@ g_output_stream_init (GOutputStream *stream) * during the operation. * * If count is zero returns zero and does nothing. A value of @count - * larger than %G_MAXSSIZE will cause a %G_FILE_ERROR_INVAL error. + * larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error. * * On success, the number of bytes written to the stream is returned. * It is not an error if this is not the same as the requested size, as it @@ -118,7 +118,7 @@ g_output_stream_write (GOutputStream *stream, if (((gssize) count) < 0) { - g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL, + g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Too large count value passed to g_output_stream_write")); return -1; } @@ -447,7 +447,7 @@ write_async_callback_wrapper (GOutputStream *stream, * During an async request no other sync and async calls are allowed, and will * result in %G_IO_ERROR_PENDING errors. * - * A value of @count larger than %G_MAXSSIZE will cause a %G_FILE_ERROR_INVAL error. + * A value of @count larger than %G_MAXSSIZE will cause a %G_IO_ERROR_INVALID_ARGUMENT error. * * On success, the number of bytes written will be passed to the * callback. It is not an error if this is not the same as the requested size, as it @@ -488,7 +488,7 @@ g_output_stream_write_async (GOutputStream *stream, if (((gssize) count) < 0) { error = NULL; - g_set_error (&error, G_FILE_ERROR, G_FILE_ERROR_INVAL, + g_set_error (&error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT, _("Too large count value passed to g_input_stream_read_async")); queue_write_async_result (stream, buffer, count, -1, error, callback, data); diff --git a/gio/gsocketinputstream.c b/gio/gsocketinputstream.c index 7afa1237..094299a2 100644 --- a/gio/gsocketinputstream.c +++ b/gio/gsocketinputstream.c @@ -130,8 +130,8 @@ g_socket_input_stream_read (GInputStream *stream, if (poll_ret == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error reading from socket: %s"), g_strerror (errno)); return -1; @@ -154,8 +154,8 @@ g_socket_input_stream_read (GInputStream *stream, if (errno == EINTR) continue; - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error reading from socket: %s"), g_strerror (errno)); } @@ -185,8 +185,8 @@ g_socket_input_stream_close (GInputStream *stream, res = close (socket_stream->priv->fd); if (res == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error closing socket: %s"), g_strerror (errno)); } @@ -231,8 +231,8 @@ read_async_cb (ReadAsyncData *data, if (errno == EINTR) continue; - g_set_error (&error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (&error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error reading from socket: %s"), g_strerror (errno)); } @@ -339,8 +339,8 @@ close_async_cb (CloseAsyncData *data) res = close (socket_stream->priv->fd); if (res == -1) { - g_set_error (&error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (&error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error closing socket: %s"), g_strerror (errno)); } diff --git a/gio/gsocketoutputstream.c b/gio/gsocketoutputstream.c index ffa1071f..0c6a0af9 100644 --- a/gio/gsocketoutputstream.c +++ b/gio/gsocketoutputstream.c @@ -130,8 +130,8 @@ g_socket_output_stream_write (GOutputStream *stream, if (poll_ret == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error writing to socket: %s"), g_strerror (errno)); return -1; @@ -154,8 +154,8 @@ g_socket_output_stream_write (GOutputStream *stream, if (errno == EINTR) continue; - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error writing to socket: %s"), g_strerror (errno)); } @@ -185,8 +185,8 @@ g_socket_output_stream_close (GOutputStream *stream, res = close (socket_stream->priv->fd); if (res == -1) { - g_set_error (error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error closing socket: %s"), g_strerror (errno)); } @@ -231,8 +231,8 @@ write_async_cb (WriteAsyncData *data, if (errno == EINTR) continue; - g_set_error (&error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (&error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error reading from socket: %s"), g_strerror (errno)); } @@ -338,8 +338,8 @@ close_async_cb (CloseAsyncData *data) res = close (socket_stream->priv->fd); if (res == -1) { - g_set_error (&error, G_FILE_ERROR, - g_file_error_from_errno (errno), + g_set_error (&error, G_IO_ERROR, + g_io_error_from_errno (errno), _("Error closing socket: %s"), g_strerror (errno)); } diff --git a/programs/gvfs-copy.c b/programs/gvfs-copy.c index 4bc72e36..8fc98b30 100644 --- a/programs/gvfs-copy.c +++ b/programs/gvfs-copy.c @@ -91,7 +91,7 @@ main (int argc, char *argv[]) error = NULL; if (!g_file_copy (source, target, flags, NULL, NULL, NULL, &error)) { - if (interactive && g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_EXIST)) + if (interactive && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS)) { char line[16]; diff --git a/programs/gvfs-move.c b/programs/gvfs-move.c index 3755d080..c4f0e5c7 100644 --- a/programs/gvfs-move.c +++ b/programs/gvfs-move.c @@ -91,7 +91,7 @@ main (int argc, char *argv[]) error = NULL; if (!g_file_move (source, target, flags, NULL, NULL, NULL, &error)) { - if (interactive && g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_EXIST)) + if (interactive && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS)) { char line[16]; |