diff options
author | Alexander Larsson <alexl@src.gnome.org> | 2007-09-13 09:22:10 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2007-09-13 09:22:10 +0000 |
commit | fc23a9a11cbeb452f3a4d66d848e3e8725333650 (patch) | |
tree | 9061702b792c93f7d397231702444c077ab00a5c /daemon/gvfsjob.c | |
parent | 8bdb058cdbd55a5fe8e9a1c9c4438603267b292f (diff) | |
download | gvfs-fc23a9a11cbeb452f3a4d66d848e3e8725333650.tar.gz |
Rename DaemonOperation to Job
Original git commit by Alexander Larsson <alex@localhost.localdomain> at 1161345702 +0200
svn path=/trunk/; revision=118
Diffstat (limited to 'daemon/gvfsjob.c')
-rw-r--r-- | daemon/gvfsjob.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/daemon/gvfsjob.c b/daemon/gvfsjob.c new file mode 100644 index 00000000..4e488385 --- /dev/null +++ b/daemon/gvfsjob.c @@ -0,0 +1,78 @@ +#include <config.h> + +#include <unistd.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/un.h> + +#include <glib.h> +#include <dbus/dbus.h> +#include <glib/gi18n.h> +#include "gvfsjob.h" + +G_DEFINE_TYPE (GVfsJob, g_vfs_job, G_TYPE_VFS_JOB); + +enum { + CANCEL, + LAST_SIGNAL +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + +static void +g_vfs_job_finalize (GObject *object) +{ + GVfsJob *job; + + job = G_VFS_JOB (object); + + if (job->error) + g_error_free (job->error); + + if (G_OBJECT_CLASS (g_vfs_job_parent_class)->finalize) + (*G_OBJECT_CLASS (g_vfs_job_parent_class)->finalize) (object); +} + +static void +g_vfs_job_class_init (GVfsJobClass *klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->finalize = g_vfs_job_finalize; + + signals[CANCEL] = + g_signal_new ("done", + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GVfsJobClass, cancel), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + +} + +static void +g_vfs_job_init (GVfsJob *job) +{ +} + +void +g_vfs_job_cancel (GVfsJob *job) +{ + if (job->cancelled) + return; + + job->cancelled = TRUE; + g_signal_emit (job, signals[CANCEL], 0); +} + +void +g_vfs_job_set_failed (GVfsJob *job, + GError *error) +{ + if (job->failed) + return; + + job->failed = TRUE; + job->error = g_error_copy (error); +} |