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