File: gvfsjob.h

package info (click to toggle)
gvfs 1.30.4-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 22,580 kB
  • ctags: 12,211
  • sloc: ansic: 113,948; sh: 4,957; xml: 2,353; makefile: 1,601; python: 1,448; sed: 16
file content (108 lines) | stat: -rw-r--r-- 3,601 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* GIO - GLib Input, Output and Streaming Library
 * 
 * Copyright (C) 2006-2007 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General
 * Public License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 * Author: Alexander Larsson <alexl@redhat.com>
 */

#ifndef __G_VFS_JOB_H__
#define __G_VFS_JOB_H__

#include <glib-object.h>
#include <gio/gio.h>

G_BEGIN_DECLS

#define G_VFS_TYPE_JOB         (g_vfs_job_get_type ())
#define G_VFS_JOB(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_VFS_TYPE_JOB, GVfsJob))
#define G_VFS_JOB_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_VFS_TYPE_JOB, GVfsJobClass))
#define G_VFS_IS_JOB(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_VFS_TYPE_JOB))
#define G_VFS_IS_JOB_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_VFS_TYPE_JOB))
#define G_VFS_JOB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_VFS_TYPE_JOB, GVfsJobClass))

typedef struct _GVfsJob        GVfsJob;
typedef struct _GVfsJobPrivate GVfsJobPrivate;
typedef struct _GVfsJobClass   GVfsJobClass;

/* Defined here to avoid circular includes */
typedef struct _GVfsJobSource GVfsJobSource;

struct _GVfsJob
{
  GObject parent_instance;

  /* TODO: Move stuff to private */
  gpointer backend_data;
  GDestroyNotify backend_data_destroy;
  
  guint failed : 1;
  guint cancelled : 1;
  guint sent_reply : 1;
  guint finished : 1;
  GError *error;
  GCancellable *cancellable;
  
  GVfsJobPrivate *priv;
};

struct _GVfsJobClass
{
  GObjectClass parent_class;

  /* signals */
  void (*cancelled)  (GVfsJob *job);
  void (*send_reply) (GVfsJob *job);
  void (*new_source) (GVfsJob *job,
		      GVfsJobSource *job_source);
  void (*finished)   (GVfsJob *job);

  /* vtable */

  void     (*run)    (GVfsJob *job);
  gboolean (*try)    (GVfsJob *job);
};

GType g_vfs_job_get_type (void) G_GNUC_CONST;

void     g_vfs_job_set_backend_data  (GVfsJob     *job,
				      gpointer     backend_data,
				      GDestroyNotify destroy);
gboolean g_vfs_job_is_finished       (GVfsJob     *job);
gboolean g_vfs_job_is_cancelled      (GVfsJob     *job);
void     g_vfs_job_cancel            (GVfsJob     *job);
void     g_vfs_job_run               (GVfsJob     *job);
gboolean g_vfs_job_try               (GVfsJob     *job);
void     g_vfs_job_emit_finished     (GVfsJob     *job);
void     g_vfs_job_failed            (GVfsJob     *job,
				      GQuark       domain,
				      gint         code,
				      const gchar *format,
				      ...) G_GNUC_PRINTF (4, 5);
void     g_vfs_job_failed_literal    (GVfsJob     *job,
                                      GQuark       domain,
                                      gint         code,
                                      const gchar *message);
void     g_vfs_job_failed_from_error (GVfsJob     *job,
				      const GError*error);
void     g_vfs_job_failed_from_errno (GVfsJob     *job,
				      gint         errno_arg);
void     g_vfs_job_succeeded         (GVfsJob     *job);

G_END_DECLS

#endif /* __G_VFS_JOB_H__ */