summaryrefslogtreecommitdiff
path: root/daemon/gvfsbackendafpbrowse.c
diff options
context:
space:
mode:
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2011-07-17 23:39:08 +0200
committerChristian Kellner <gicmo@gnome.org>2011-08-25 21:19:51 +0200
commita39ab511180917bcab2ef21e125adaafaa654e91 (patch)
tree50042d410aff6c3ef9de2f31d0bcae4b31df189e /daemon/gvfsbackendafpbrowse.c
parent85403f7672a940dc8a9deceee0435c96466c85e4 (diff)
downloadgvfs-a39ab511180917bcab2ef21e125adaafaa654e91.tar.gz
afp: convert g_vfs_afp_connection_queue_command to the standard GIO async pattern
also rename it to g_vfs_afp_connection_send_command
Diffstat (limited to 'daemon/gvfsbackendafpbrowse.c')
-rw-r--r--daemon/gvfsbackendafpbrowse.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/daemon/gvfsbackendafpbrowse.c b/daemon/gvfsbackendafpbrowse.c
index b802a485..37e6236c 100644
--- a/daemon/gvfsbackendafpbrowse.c
+++ b/daemon/gvfsbackendafpbrowse.c
@@ -100,19 +100,23 @@ typedef struct
} UpdateCacheData;
static void
-get_srvr_parms_cb (GVfsAfpConnection *afp_connection,
- GVfsAfpReply *reply,
- GError *error,
- gpointer user_data)
+get_srvr_parms_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
+ GVfsAfpConnection *afp_conn = G_VFS_AFP_CONNECTION (source_object);
UpdateCacheData *data = (UpdateCacheData *)user_data;
+ GVfsAfpReply *reply;
+ GError *err = NULL;
AfpResultCode res_code;
+
guint8 num_volumes, i;
+ reply = g_vfs_afp_connection_send_command_finish (afp_conn, res, &err);
if (!reply)
{
- data->cb (data->afp_backend, error, data->user_data);
+ data->cb (data->afp_backend, err, data->user_data);
+
+ g_error_free (err);
g_slice_free (UpdateCacheData, data);
return;
}
@@ -120,10 +124,10 @@ get_srvr_parms_cb (GVfsAfpConnection *afp_connection,
res_code = g_vfs_afp_reply_get_result_code (reply);
if (res_code != AFP_RESULT_NO_ERROR)
{
- GError *err;
-
- err = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED,
- _("Retrieval of server parameters failed"));
+ g_object_unref (reply);
+
+ err = g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED,
+ _("Got error code: %d from server"), res_code);
data->cb (data->afp_backend, err, data->user_data);
g_error_free (err);
@@ -156,6 +160,7 @@ get_srvr_parms_cb (GVfsAfpConnection *afp_connection,
data->afp_backend->volumes = g_slist_prepend (data->afp_backend->volumes, volume_data);
}
+ g_object_unref (reply);
data->cb (data->afp_backend, NULL, data->user_data);
g_slice_free (UpdateCacheData, data);
@@ -177,9 +182,9 @@ update_cache (GVfsBackendAfpBrowse *afp_backend, GCancellable *cancellable,
/* pad byte */
g_vfs_afp_command_put_byte (comm, 0);
- g_vfs_afp_connection_queue_command (afp_backend->server->conn, comm,
- get_srvr_parms_cb,
- cancellable, data);
+ g_vfs_afp_connection_send_command (afp_backend->server->conn, comm,
+ get_srvr_parms_cb,
+ cancellable, data);
g_object_unref (comm);
}