diff options
author | Alexander Larsson <alexl@src.gnome.org> | 2007-09-13 11:03:09 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2007-09-13 11:03:09 +0000 |
commit | f043c47e0efb3c443f040d5238d657ea6a0ed26b (patch) | |
tree | 8618fbd14ab34bea70dc4a2606be0fdaa604101a /daemon/gvfsjobopenforread.c | |
parent | 44fce9a8d15caf9c660ccc30eb8046727a54152c (diff) | |
download | gvfs-f043c47e0efb3c443f040d5238d657ea6a0ed26b.tar.gz |
New thread model for GVfsDaemon
Original git commit by Alexander Larsson <alex@greebo.(none)> at 1169224526 +0100
svn path=/trunk/; revision=259
Diffstat (limited to 'daemon/gvfsjobopenforread.c')
-rw-r--r-- | daemon/gvfsjobopenforread.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/daemon/gvfsjobopenforread.c b/daemon/gvfsjobopenforread.c index b6de7fcb..c36b965c 100644 --- a/daemon/gvfsjobopenforread.c +++ b/daemon/gvfsjobopenforread.c @@ -14,7 +14,8 @@ G_DEFINE_TYPE (GVfsJobOpenForRead, g_vfs_job_open_for_read, G_TYPE_VFS_JOB_DBUS); -static gboolean start (GVfsJob *job); +static void run (GVfsJob *job); +static gboolean try (GVfsJob *job); static void finished (GVfsJob *job); static DBusMessage *create_reply (GVfsJob *job, DBusConnection *connection, @@ -46,7 +47,8 @@ g_vfs_job_open_for_read_class_init (GVfsJobOpenForReadClass *klass) GVfsJobDBusClass *job_dbus_class = G_VFS_JOB_DBUS_CLASS (klass); gobject_class->finalize = g_vfs_job_open_for_read_finalize; - job_class->start = start; + job_class->run = run; + job_class->try = try; job_class->finished = finished; job_dbus_class->create_reply = create_reply; } @@ -93,16 +95,32 @@ g_vfs_job_open_for_read_new (DBusConnection *connection, return G_VFS_JOB (job); } +static void +run (GVfsJob *job) +{ + GVfsJobOpenForRead *op_job = G_VFS_JOB_OPEN_FOR_READ (job); + GVfsBackendClass *class = G_VFS_BACKEND_GET_CLASS (op_job->backend); + + class->open_for_read (op_job->backend, + op_job, + op_job->filename); +} + static gboolean -start (GVfsJob *job) +try (GVfsJob *job) { GVfsJobOpenForRead *op_job = G_VFS_JOB_OPEN_FOR_READ (job); + GVfsBackendClass *class = G_VFS_BACKEND_GET_CLASS (op_job->backend); - return g_vfs_backend_open_for_read (op_job->backend, - op_job, - op_job->filename); + if (class->try_open_for_read == NULL) + return FALSE; + + return class->try_open_for_read (op_job->backend, + op_job, + op_job->filename); } + void g_vfs_job_open_for_read_set_handle (GVfsJobOpenForRead *job, GVfsBackendHandle handle) |