/*
- * Geeqie
- * (C) 2004 John Ellis
- * Copyright (C) 2008 The Geeqie Team
+ * Copyright (C) 2004 John Ellis
+ * Copyright (C) 2008 - 2016 The Geeqie Team
*
* Author: John Ellis
*
- * This software is released under the GNU General Public License (GNU GPL).
- * Please read the included file COPYING for more information.
- * This software comes with no warranty of any kind, use at your own risk!
+ * 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
#ifndef CACHE_H
#define CACHE_H
+#include <sys/types.h>
-#include "similar.h"
+#include <glib.h>
+struct ImageSimilarityData;
-#define GQ_CACHE_RC_THUMB GQ_RC_DIR G_DIR_SEPARATOR_S "thumbnails"
-#define GQ_CACHE_RC_METADATA GQ_RC_DIR G_DIR_SEPARATOR_S "metadata"
+#define GQ_CACHE_THUMB "thumbnails"
+#define GQ_CACHE_METADATA "metadata"
#define GQ_CACHE_LOCAL_THUMB ".thumbnails"
#define GQ_CACHE_LOCAL_METADATA ".metadata"
#define GQ_CACHE_EXT_THUMB ".png"
#define GQ_CACHE_EXT_SIM ".sim"
#define GQ_CACHE_EXT_METADATA ".meta"
+#define GQ_CACHE_EXT_XMP_METADATA ".gq.xmp"
-typedef enum {
+enum CacheType {
CACHE_TYPE_THUMB,
CACHE_TYPE_SIM,
- CACHE_TYPE_METADATA
-} CacheType;
+ CACHE_TYPE_METADATA,
+ CACHE_TYPE_XMP_METADATA
+};
-typedef struct _CacheData CacheData;
-struct _CacheData
+struct CacheData
{
gchar *path;
gint width;
gint height;
time_t date;
- glong checksum;
guchar md5sum[16];
ImageSimilarityData *sim;
- gint dimensions;
- gint have_date;
- gint have_checksum;
- gint have_md5sum;
- gint similarity;
+ gboolean dimensions;
+ gboolean have_date;
+ gboolean have_md5sum;
+ gboolean similarity;
};
-gint cache_time_valid(const gchar *cache, const gchar *path);
+gboolean cache_time_valid(const gchar *cache, const gchar *path);
-CacheData *cache_sim_data_new(void);
+CacheData *cache_sim_data_new();
void cache_sim_data_free(CacheData *cd);
-gint cache_sim_data_save(CacheData *cd);
+gboolean cache_sim_data_save(CacheData *cd);
CacheData *cache_sim_data_load(const gchar *path);
void cache_sim_data_set_dimensions(CacheData *cd, gint w, gint h);
-void cache_sim_data_set_date(CacheData *cd, time_t date);
-void cache_sim_data_set_checksum(CacheData *cd, glong checksum);
-void cache_sim_data_set_md5sum(CacheData *cd, guchar digest[16]);
+void cache_sim_data_set_md5sum(CacheData *cd, const guchar digest[16]);
void cache_sim_data_set_similarity(CacheData *cd, ImageSimilarityData *sd);
gint cache_sim_data_filled(ImageSimilarityData *sd);
-
-gint cache_ensure_dir_exists(gchar *path, mode_t mode);
gchar *cache_get_location(CacheType type, const gchar *source, gint include_name, mode_t *mode);
gchar *cache_find_location(CacheType type, const gchar *source);
+const gchar *get_thumbnails_cache_dir();
+const gchar *get_thumbnails_standard_cache_dir();
+const gchar *get_metadata_cache_dir();
#endif
/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */