summaryrefslogtreecommitdiff
path: root/src/eom-jobs.h
blob: df2283e847574181a7280dc26cf16bf608acf1fe (plain)
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
/* Eye Of Mate - Jobs
 *
 * Copyright (C) 2006 The Free Software Foundation
 *
 * Author: Lucas Rocha <lucasr@gnome.org>
 *
 * Based on evince code (shell/ev-jobs.h) by:
 * 	- Martin Kretzschmar <martink@gnome.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#ifndef __EOM_JOBS_H__
#define __EOM_JOBS_H__

#include "eom-list-store.h"
#include "eom-transform.h"
#include "eom-enums.h"

#include <glib.h>
#include <gio/gio.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

G_BEGIN_DECLS

#ifndef __EOM_IMAGE_DECLR__
#define __EOM_IMAGE_DECLR__
  typedef struct _EomImage EomImage;
#endif

#ifndef __EOM_URI_CONVERTER_DECLR__
#define __EOM_URI_CONVERTER_DECLR__
typedef struct _EomURIConverter EomURIConverter;
#endif

#ifndef __EOM_JOB_DECLR__
#define __EOM_JOB_DECLR__
typedef struct _EomJob EomJob;
#endif
typedef struct _EomJobClass EomJobClass;

typedef struct _EomJobThumbnail EomJobThumbnail;
typedef struct _EomJobThumbnailClass EomJobThumbnailClass;

typedef struct _EomJobLoad EomJobLoad;
typedef struct _EomJobLoadClass EomJobLoadClass;

typedef struct _EomJobModel EomJobModel;
typedef struct _EomJobModelClass EomJobModelClass;

typedef struct _EomJobTransform EomJobTransform;
typedef struct _EomJobTransformClass EomJobTransformClass;

typedef struct _EomJobSave EomJobSave;
typedef struct _EomJobSaveClass EomJobSaveClass;

typedef struct _EomJobSaveAs EomJobSaveAs;
typedef struct _EomJobSaveAsClass EomJobSaveAsClass;

typedef struct _EomJobCopy EomJobCopy;
typedef struct _EomJobCopyClass EomJobCopyClass;

#define EOM_TYPE_JOB		       (eom_job_get_type())
#define EOM_JOB(obj)		       (G_TYPE_CHECK_INSTANCE_CAST((obj), EOM_TYPE_JOB, EomJob))
#define EOM_JOB_CLASS(klass)	       (G_TYPE_CHECK_CLASS_CAST((klass),  EOM_TYPE_JOB, EomJobClass))
#define EOM_IS_JOB(obj)	               (G_TYPE_CHECK_INSTANCE_TYPE((obj), EOM_TYPE_JOB))
#define EOM_JOB_GET_CLASS(obj)         (G_TYPE_INSTANCE_GET_CLASS ((obj), EOM_TYPE_JOB, EomJobClass))

#define EOM_TYPE_JOB_THUMBNAIL	       (eom_job_thumbnail_get_type())
#define EOM_JOB_THUMBNAIL(obj)	       (G_TYPE_CHECK_INSTANCE_CAST((obj), EOM_TYPE_JOB_THUMBNAIL, EomJobThumbnail))
#define EOM_JOB_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),  EOM_TYPE_JOB_THUMBNAIL, EomJobThumbnailClass))
#define EOM_IS_JOB_THUMBNAIL(obj)      (G_TYPE_CHECK_INSTANCE_TYPE((obj), EOM_TYPE_JOB_THUMBNAIL))

#define EOM_TYPE_JOB_LOAD	       (eom_job_load_get_type())
#define EOM_JOB_LOAD(obj)	       (G_TYPE_CHECK_INSTANCE_CAST((obj), EOM_TYPE_JOB_LOAD, EomJobLoad))
#define EOM_JOB_LOAD_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass),  EOM_TYPE_JOB_LOAD, EomJobLoadClass))
#define EOM_IS_JOB_LOAD(obj)	       (G_TYPE_CHECK_INSTANCE_TYPE((obj), EOM_TYPE_JOB_LOAD))

#define EOM_TYPE_JOB_MODEL	       (eom_job_model_get_type())
#define EOM_JOB_MODEL(obj)	       (G_TYPE_CHECK_INSTANCE_CAST((obj), EOM_TYPE_JOB_MODEL, EomJobModel))
#define EOM_JOB_MODEL_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST((klass),  EOM_TYPE_JOB_MODEL, EomJobModelClass))
#define EOM_IS_JOB_MODEL(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj), EOM_TYPE_JOB_MODEL))

#define EOM_TYPE_JOB_TRANSFORM	       (eom_job_transform_get_type())
#define EOM_JOB_TRANSFORM(obj)	       (G_TYPE_CHECK_INSTANCE_CAST((obj), EOM_TYPE_JOB_TRANSFORM, EomJobTransform))
#define EOM_JOB_TRANSFORM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),  EOM_TYPE_JOB_TRANSFORM, EomJobTransformClass))
#define EOM_IS_JOB_TRANSFORM(obj)      (G_TYPE_CHECK_INSTANCE_TYPE((obj), EOM_TYPE_JOB_TRANSFORM))

#define EOM_TYPE_JOB_SAVE              (eom_job_save_get_type())
#define EOM_JOB_SAVE(obj)              (G_TYPE_CHECK_INSTANCE_CAST((obj), EOM_TYPE_JOB_SAVE, EomJobSave))
#define EOM_JOB_SAVE_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), EOM_TYPE_JOB_SAVE, EomJobSaveClass))
#define EOM_IS_JOB_SAVE(obj)           (G_TYPE_CHECK_INSTANCE_TYPE((obj), EOM_TYPE_JOB_SAVE))
#define EOM_JOB_SAVE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), EOM_TYPE_JOB_SAVE, EomJobSaveClass))

#define EOM_TYPE_JOB_SAVE_AS           (eom_job_save_as_get_type())
#define EOM_JOB_SAVE_AS(obj)           (G_TYPE_CHECK_INSTANCE_CAST((obj), EOM_TYPE_JOB_SAVE_AS, EomJobSaveAs))
#define EOM_JOB_SAVE_AS_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST((klass), EOM_TYPE_JOB_SAVE_AS, EomJobSaveAsClass))
#define EOM_IS_JOB_SAVE_AS(obj)        (G_TYPE_CHECK_INSTANCE_TYPE((obj), EOM_TYPE_JOB_SAVE_AS))

#define EOM_TYPE_JOB_COPY	       (eom_job_copy_get_type())
#define EOM_JOB_COPY(obj)	       (G_TYPE_CHECK_INSTANCE_CAST((obj), EOM_TYPE_JOB_COPY, EomJobCopy))
#define EOM_JOB_COPY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),  EOM_TYPE_JOB_COPY, EomJobCopyClass))
#define EOM_IS_JOB_COPY(obj)      (G_TYPE_CHECK_INSTANCE_TYPE((obj), EOM_TYPE_JOB_COPY))

struct _EomJob
{
	GObject  parent;

	GError   *error;
	GMutex   *mutex;
	float     progress;
	gboolean  finished;
};

struct _EomJobClass
{
	GObjectClass parent_class;

	void    (* finished) (EomJob *job);
	void    (* progress) (EomJob *job, float progress);
	void    (*run)       (EomJob *job);
};

struct _EomJobThumbnail
{
	EomJob       parent;
	EomImage    *image;
	GdkPixbuf   *thumbnail;
};

struct _EomJobThumbnailClass
{
	EomJobClass parent_class;
};

struct _EomJobLoad
{
	EomJob        parent;
	EomImage     *image;
	EomImageData  data;
};

struct _EomJobLoadClass
{
	EomJobClass parent_class;
};

struct _EomJobModel
{
	EomJob        parent;
	EomListStore *store;
	GSList       *file_list;
};

struct _EomJobModelClass
{
        EomJobClass parent_class;
};

struct _EomJobTransform
{
	EomJob        parent;
	GList        *images;
	EomTransform *trans;
};

struct _EomJobTransformClass
{
        EomJobClass parent_class;
};

typedef enum {
	EOM_SAVE_RESPONSE_NONE,
	EOM_SAVE_RESPONSE_RETRY,
	EOM_SAVE_RESPONSE_SKIP,
	EOM_SAVE_RESPONSE_OVERWRITE,
	EOM_SAVE_RESPONSE_CANCEL,
	EOM_SAVE_RESPONSE_LAST
} EomJobSaveResponse;

struct _EomJobSave
{
	EomJob    parent;
	GList	 *images;
	guint      current_pos;
	EomImage *current_image;
};

struct _EomJobSaveClass
{
	EomJobClass parent_class;
};

struct _EomJobSaveAs
{
	EomJobSave       parent;
	EomURIConverter *converter;
	GFile           *file;
};

struct _EomJobSaveAsClass
{
	EomJobSaveClass parent;
};

struct _EomJobCopy
{
	EomJob parent;
	GList *images;
	guint current_pos;
	gchar *dest;
};

struct _EomJobCopyClass
{
	EomJobClass parent_class;
};

/* base job class */
GType           eom_job_get_type           (void) G_GNUC_CONST;
void            eom_job_finished           (EomJob          *job);
void            eom_job_run                (EomJob          *job);
void            eom_job_set_progress       (EomJob          *job,
					    float            progress);

/* EomJobThumbnail */
GType           eom_job_thumbnail_get_type (void) G_GNUC_CONST;
EomJob         *eom_job_thumbnail_new      (EomImage     *image);

/* EomJobLoad */
GType           eom_job_load_get_type      (void) G_GNUC_CONST;
EomJob 	       *eom_job_load_new 	   (EomImage        *image,
					    EomImageData     data);

/* EomJobModel */
GType 		eom_job_model_get_type     (void) G_GNUC_CONST;
EomJob 	       *eom_job_model_new          (GSList          *file_list);

/* EomJobTransform */
GType 		eom_job_transform_get_type (void) G_GNUC_CONST;
EomJob 	       *eom_job_transform_new      (GList           *images,
					    EomTransform    *trans);

/* EomJobSave */
GType		eom_job_save_get_type      (void) G_GNUC_CONST;
EomJob         *eom_job_save_new           (GList           *images);

/* EomJobSaveAs */
GType		eom_job_save_as_get_type   (void) G_GNUC_CONST;
EomJob         *eom_job_save_as_new        (GList           *images,
					    EomURIConverter *converter,
					    GFile           *file);

/* EomJobCopy */
GType          eom_job_copy_get_type      (void) G_GNUC_CONST;
EomJob        *eom_job_copy_new           (GList            *images,
					   const gchar      *dest);

G_END_DECLS

#endif /* __EOM_JOBS_H__ */