summaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@src.gnome.org>2007-09-13 13:25:26 +0000
committerAlexander Larsson <alexl@src.gnome.org>2007-09-13 13:25:26 +0000
commit82fa73ce3b1463c051ead839cdde2e19f80efdbc (patch)
tree42ad7545e950bbe837dee0fdd363fb52a7c571eb /daemon
parentccf4d4b3de139bc8c142e57ccc9adcb36a184467 (diff)
downloadgvfs-82fa73ce3b1463c051ead839cdde2e19f80efdbc.tar.gz
Rename dbus gerror helpers and use the best one in each case
Original git commit by Alexander Larsson <alexl@redhat.com> at 1178537880 +0200 svn path=/trunk/; revision=524
Diffstat (limited to 'daemon')
-rw-r--r--daemon/gvfsjobdbus.c2
-rw-r--r--daemon/gvfsjobenumerate.c2
-rw-r--r--daemon/gvfsjobopenforread.c2
-rw-r--r--daemon/gvfsjobopenforwrite.c2
-rw-r--r--daemon/mounttracker.c44
5 files changed, 22 insertions, 30 deletions
diff --git a/daemon/gvfsjobdbus.c b/daemon/gvfsjobdbus.c
index 53dd5729..7008cb47 100644
--- a/daemon/gvfsjobdbus.c
+++ b/daemon/gvfsjobdbus.c
@@ -139,7 +139,7 @@ send_reply (GVfsJob *job)
class = G_VFS_JOB_DBUS_GET_CLASS (job);
if (job->failed)
- reply = _dbus_message_new_error_from_gerror (dbus_job->message, job->error);
+ reply = _dbus_message_new_from_gerror (dbus_job->message, job->error);
else
reply = class->create_reply (job, dbus_job->connection, dbus_job->message);
diff --git a/daemon/gvfsjobenumerate.c b/daemon/gvfsjobenumerate.c
index 5090eb1c..aeba4f68 100644
--- a/daemon/gvfsjobenumerate.c
+++ b/daemon/gvfsjobenumerate.c
@@ -211,7 +211,7 @@ send_reply (GVfsJob *job)
class = G_VFS_JOB_DBUS_GET_CLASS (job);
if (job->failed)
- reply = _dbus_message_new_error_from_gerror (dbus_job->message, job->error);
+ reply = _dbus_message_new_from_gerror (dbus_job->message, job->error);
else
reply = class->create_reply (job, dbus_job->connection, dbus_job->message);
diff --git a/daemon/gvfsjobopenforread.c b/daemon/gvfsjobopenforread.c
index f2db2386..db1baa34 100644
--- a/daemon/gvfsjobopenforread.c
+++ b/daemon/gvfsjobopenforread.c
@@ -162,7 +162,7 @@ create_reply (GVfsJob *job,
&fd_id, &error))
{
close (remote_fd);
- reply = _dbus_message_new_error_from_gerror (message, error);
+ reply = _dbus_message_new_from_gerror (message, error);
g_error_free (error);
g_object_unref (channel);
return reply;
diff --git a/daemon/gvfsjobopenforwrite.c b/daemon/gvfsjobopenforwrite.c
index 0744999e..4e927be9 100644
--- a/daemon/gvfsjobopenforwrite.c
+++ b/daemon/gvfsjobopenforwrite.c
@@ -228,7 +228,7 @@ create_reply (GVfsJob *job,
&fd_id, &error))
{
close (remote_fd);
- reply = _dbus_message_new_error_from_gerror (message, error);
+ reply = _dbus_message_new_from_gerror (message, error);
g_error_free (error);
g_object_unref (channel);
return reply;
diff --git a/daemon/mounttracker.c b/daemon/mounttracker.c
index 1aee7cf4..de5af3f8 100644
--- a/daemon/mounttracker.c
+++ b/daemon/mounttracker.c
@@ -251,11 +251,9 @@ automount_done (GMountOperation *op,
if (!succeeded)
{
- GError *mount_error = NULL;
- g_set_error (&mount_error, G_IO_ERROR, G_IO_ERROR_NOT_MOUNTED,
- _("Automount failed: %s"), error->message);
- reply = _dbus_message_new_error_from_gerror (data->message, mount_error);
- g_error_free (mount_error);
+ reply = _dbus_message_new_gerror (data->message,
+ G_IO_ERROR, G_IO_ERROR_NOT_MOUNTED,
+ _("Automount failed: %s"), error->message);
dbus_connection_send (data->connection, reply, NULL);
}
else
@@ -280,7 +278,6 @@ maybe_automount (GMountTracker *tracker,
{
Mountable *mountable;
DBusMessage *reply;
- GError *error;
mountable = lookup_mountable (spec);
@@ -310,13 +307,11 @@ maybe_automount (GMountTracker *tracker,
}
else
{
- error = NULL;
- g_set_error (&error, G_IO_ERROR, G_IO_ERROR_NOT_MOUNTED,
- (mountable == NULL) ?
- _("Location is not mountable") :
- _("Location is not mounted"));
- reply = _dbus_message_new_error_from_gerror (message, error);
- g_error_free (error);
+ reply = _dbus_message_new_gerror (message,
+ G_IO_ERROR, G_IO_ERROR_NOT_MOUNTED,
+ (mountable == NULL) ?
+ _("Location is not mountable") :
+ _("Location is not mounted"));
}
return reply;
@@ -432,7 +427,6 @@ mount_location (GMountTracker *tracker,
DBusError derror;
GMountSpec *spec;
const char *obj_path, *dbus_id;
- GError *error;
Mountable *mountable;
dbus_bool_t automount;
@@ -440,6 +434,7 @@ mount_location (GMountTracker *tracker,
mountable = NULL;
spec = NULL;
+ reply = NULL;
dbus_error_init (&derror);
if (_g_dbus_message_iter_get_args (&iter,
&derror,
@@ -455,11 +450,9 @@ mount_location (GMountTracker *tracker,
mount = match_vfs_mount (tracker, spec);
if (mount != NULL)
{
- error = NULL;
- g_set_error (&error, G_IO_ERROR, G_IO_ERROR_ALREADY_MOUNTED,
- _("Location is already mounted"));
- reply = _dbus_message_new_error_from_gerror (message, error);
- g_error_free (error);
+ reply = _dbus_message_new_gerror (message,
+ G_IO_ERROR, G_IO_ERROR_ALREADY_MOUNTED,
+ _("Location is already mounted"));
}
else
{
@@ -467,11 +460,9 @@ mount_location (GMountTracker *tracker,
if (mountable == NULL)
{
- error = NULL;
- g_set_error (&error, G_IO_ERROR, G_IO_ERROR_NOT_MOUNTED,
- _("Location is not mountable"));
- reply = _dbus_message_new_error_from_gerror (message, error);
- g_error_free (error);
+ reply = _dbus_message_new_gerror (message,
+ G_IO_ERROR, G_IO_ERROR_NOT_MOUNTED,
+ _("Location is not mountable"));
}
}
}
@@ -487,8 +478,9 @@ mount_location (GMountTracker *tracker,
if (reply == NULL)
_g_dbus_oom ();
-
- dbus_connection_send (connection, reply, NULL);
+
+ if (reply)
+ dbus_connection_send (connection, reply, NULL);
if (mountable)
{