Sync to GQview 1.5.9 release.
[geeqie.git] / src / thumb_standard.h
1 /*
2  * GQview
3  * (C) 2005 John Ellis
4  *
5  * Author: John Ellis
6  *
7  * This software is released under the GNU General Public License (GNU GPL).
8  * Please read the included file COPYING for more information.
9  * This software comes with no warranty of any kind, use at your own risk!
10  */
11
12
13 #ifndef THUMB_STANDARD_H
14 #define THUMB_STANDARD_H
15
16
17 #define THUMB_FOLDER        ".thumbnails"
18 #define THUMB_FOLDER_NORMAL "normal"
19 #define THUMB_FOLDER_LARGE  "large"
20 #define THUMB_FOLDER_FAIL   "fail/gqview-1.0"
21 #define THUMB_NAME_EXTENSION ".png"
22
23
24 typedef struct _ThumbLoaderStd ThumbLoaderStd;
25 typedef void (* ThumbLoaderStdFunc)(ThumbLoaderStd *tl, gpointer data);
26
27 struct _ThumbLoaderStd
28 {
29         gint standard_loader;
30
31         GdkPixbuf *pixbuf;
32         ImageLoader *il;
33
34         gchar *source_path;
35
36         time_t source_mtime;
37         off_t source_size;
38         mode_t source_mode;
39
40         gchar *thumb_path;
41         gchar *thumb_uri;
42         const gchar *local_uri;
43
44         gint thumb_path_local;
45
46         gint requested_width;
47         gint requested_height;
48
49         gint cache_enable;
50         gint cache_local;
51         gint cache_hit;
52         gint cache_retry;
53
54         gdouble progress;
55
56         ThumbLoaderStdFunc func_done;
57         ThumbLoaderStdFunc func_error;
58         ThumbLoaderStdFunc func_progress;
59
60         gpointer data;
61 };
62
63
64 ThumbLoaderStd *thumb_loader_std_new(gint width, gint height);
65 void thumb_loader_std_set_callbacks(ThumbLoaderStd *tl,
66                                     ThumbLoaderStdFunc func_done,
67                                     ThumbLoaderStdFunc func_error,
68                                     ThumbLoaderStdFunc func_progress,
69                                     gpointer data);
70 void thumb_loader_std_set_cache(ThumbLoaderStd *tl, gint enable_cache, gint local, gint retry_failed);
71 gint thumb_loader_std_start(ThumbLoaderStd *tl, const gchar *path);
72 void thumb_loader_std_free(ThumbLoaderStd *tl);
73
74 GdkPixbuf *thumb_loader_std_get_pixbuf(ThumbLoaderStd *tl, gint with_fallback);
75
76
77 /* validates a non local thumbnail file,
78  * calling func_valid with the information when app is idle
79  * for thumbnail's without a file: uri, validates against allowed_age in days
80  */
81 ThumbLoaderStd *thumb_loader_std_thumb_file_validate(const gchar *thumb_path, gint allowed_age,
82                                                      void (*func_valid)(const gchar *path, gint valid, gpointer data),
83                                                      gpointer data);
84 void thumb_loader_std_thumb_file_validate_cancel(ThumbLoaderStd *tl);
85
86
87 void thumb_std_maint_removed(const gchar *source);
88 void thumb_std_maint_moved(const gchar *source, const gchar *dest);
89
90
91 #endif