clang-tidy: modernize-redundant-void-arg
[geeqie.git] / src / thumb-standard.h
1 /*
2  * Copyright (C) 2006 John Ellis
3  * Copyright (C) 2008 - 2016 The Geeqie Team
4  *
5  * Author: John Ellis
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21
22 #ifndef THUMB_STANDARD_H
23 #define THUMB_STANDARD_H
24
25 struct FileData;
26 struct ImageLoader;
27
28 #if GLIB_CHECK_VERSION (2, 34, 0)
29 #define THUMB_FOLDER_GLOBAL "thumbnails"
30 #else
31 #define THUMB_FOLDER_GLOBAL ".thumbnails"
32 #endif
33 #define THUMB_FOLDER_LOCAL  ".thumblocal"
34 #define THUMB_FOLDER_NORMAL "normal"
35 #define THUMB_FOLDER_LARGE  "large"
36 #define THUMB_FOLDER_FAIL   "fail" G_DIR_SEPARATOR_S GQ_APPNAME_LC "-" VERSION
37 #define THUMB_NAME_EXTENSION ".png"
38
39
40 struct ThumbLoaderStd
41 {
42         gboolean standard_loader;
43
44         ImageLoader *il;
45         FileData *fd;
46
47         time_t source_mtime;
48         off_t source_size;
49         mode_t source_mode;
50
51         gchar *thumb_path;
52         gchar *thumb_uri;
53         const gchar *local_uri;
54
55         gboolean thumb_path_local;
56
57         gint requested_width;
58         gint requested_height;
59
60         gboolean cache_enable;
61         gboolean cache_local;
62         gboolean cache_hit;
63         gboolean cache_retry;
64
65         gdouble progress;
66
67         using Func = void (*)(ThumbLoaderStd *, gpointer);
68         Func func_done;
69         Func func_error;
70         Func func_progress;
71
72         gpointer data;
73 };
74
75
76 ThumbLoaderStd *thumb_loader_std_new(gint width, gint height);
77 void thumb_loader_std_set_callbacks(ThumbLoaderStd *tl,
78                                     ThumbLoaderStd::Func func_done,
79                                     ThumbLoaderStd::Func func_error,
80                                     ThumbLoaderStd::Func func_progress,
81                                     gpointer data);
82 void thumb_loader_std_set_cache(ThumbLoaderStd *tl, gboolean enable_cache, gboolean local, gboolean retry_failed);
83 gboolean thumb_loader_std_start(ThumbLoaderStd *tl, FileData *fd);
84 void thumb_loader_std_free(ThumbLoaderStd *tl);
85
86 GdkPixbuf *thumb_loader_std_get_pixbuf(ThumbLoaderStd *tl);
87
88 void thumb_loader_std_calibrate_pixbuf(FileData *fd, GdkPixbuf *pixbuf);
89
90 /**
91  * @headerfile thumb_loader_std_thumb_file_validate
92  * validates a non local thumbnail file,
93  * calling func_valid with the information when app is idle
94  * for thumbnail's without a file: uri, validates against allowed_age in days
95  */
96 ThumbLoaderStd *thumb_loader_std_thumb_file_validate(const gchar *thumb_path, gint allowed_days,
97                                                      void (*func_valid)(const gchar *path, gboolean valid, gpointer data),
98                                                      gpointer data);
99 void thumb_loader_std_thumb_file_validate_cancel(ThumbLoaderStd *tl);
100
101
102 void thumb_std_maint_removed(const gchar *source);
103 void thumb_std_maint_moved(const gchar *source, const gchar *dest);
104
105
106 #endif
107 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */