1 /* -*- Mode: C; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3 -*- */ 2 3 /* 4 * GImageView 5 * Copyright (C) 2001 Takuro Ashie 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 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 * 21 * $Id: gimv_thumb_cache.h,v 1.2 2004/09/21 08:44:32 makeinu Exp $ 22 */ 23 24 #ifndef __GIMV_THUMB_CACHE_H__ 25 #define __GIMV_THUMB_CACHE_H__ 26 27 #include "gimv_image.h" 28 #include <sys/types.h> 29 30 31 /* not completed yet */ 32 typedef enum { 33 GIMV_THUMB_CACHE_CLEAR_STATUS_NORMAL, 34 GIMV_THUMB_CACHE_CLEAR_STATUS_UNKNOWN_ERROR 35 } GimvThumbCacheClearStatus; 36 37 38 /* this feature is not implemented yet */ 39 typedef enum { 40 GIMV_THUMB_CACHE_CLEAR_TEST = 1 << 0, /* confirm whether the plugin can do it or not */ 41 GIMV_THUMB_CACHE_CLEAR_ALL = 1 << 1, /* clear thumbnails under specified directory */ 42 /* other flags will be ignored except 43 THUMB_CACHE_CLEAR_TEST */ 44 GIMV_THUMB_CACHE_CLEAR_OLD = 1 << 2, /* clear old thumbnails */ 45 GIMV_THUMB_CACHE_CLEAR_GARBAGE = 1 << 3, /* clear thumbnails for not existing images */ 46 GIMV_THUMB_CACHE_CLEAR_RECURSIVE = 1 << 4, /* also clear all sub directories */ 47 GIMV_THUMB_CACHE_CLEAR_ASYNC = 1 << 5 48 } GimvThumbCacheClearFlags; 49 50 51 #define GIMV_THUMB_CACHE_LOADER_IF_VERSION 2 52 53 54 typedef struct GimvThumbCacheLoader_Tag 55 { 56 const guint32 if_version; /* plugin interface version */ 57 gchar *label; 58 59 GimvImage *(*load) (const gchar *filename, 60 const gchar *cache_type, 61 GimvImageInfo *info); 62 GimvImage *(*save) (const gchar *filename, 63 const gchar *cache_type, 64 GimvImage *image, 65 GimvImageInfo *info); 66 gchar *(*get_path) (const gchar *filename, 67 const gchar *cache_type); 68 gboolean (*get_size) (gint width, 69 gint height, 70 const gchar *cache_type, 71 gint *width_ret, 72 gint *height_ret); 73 74 GimvImageInfo *(*get_info) (const gchar *filename, 75 const gchar *cache_type); 76 gboolean (*put_info) (const gchar *filename, 77 const gchar *cache_type, 78 GimvImageInfo *info); 79 80 GtkWidget *(*prefs_load) (gpointer data); 81 GtkWidget *(*prefs_save) (gpointer data); 82 83 /* if path is file, all flags will be ignored */ 84 GimvThumbCacheClearStatus (*clear) (const gchar *path, 85 const gchar *cache_type, 86 GimvThumbCacheClearFlags flags, 87 gpointer unused_yet); 88 } GimvThumbCacheLoader; 89 90 91 gchar *gimv_thumb_cache_get_path (const gchar *filename, 92 const gchar *type); 93 gboolean gimv_thumb_cache_exists (const gchar *filename, 94 const gchar *type); 95 GimvImage *gimv_thumb_cache_load (const gchar *filename, 96 const gchar *type, 97 GimvImageInfo *info); 98 GimvImage *gimv_thumb_cache_save (const gchar *filename, 99 const gchar *type, 100 GimvImage *image, 101 GimvImageInfo *info); 102 gboolean gimv_thumb_cache_get_size (gint width, 103 gint height, 104 const gchar *type, 105 gint *width_ret, 106 gint *height_ret); 107 gboolean gimv_thumb_cache_has_load_prefs (const gchar *type); 108 gboolean gimv_thumb_cache_has_save_prefs (const gchar *type); 109 GtkWidget *gimv_thumb_cache_get_load_prefs (const gchar *type, 110 gpointer data); 111 GtkWidget *gimv_thumb_cache_get_save_prefs (const gchar *type, 112 gpointer data); 113 114 GList *gimv_thumb_cache_get_loader_list (void); 115 GList *gimv_thumb_cache_get_saver_list (void); 116 117 /* currentry, only a directory will be accepted, 118 and all flags will be ignored */ 119 GimvThumbCacheClearStatus 120 gimv_thumb_cache_clear (const gchar *path, 121 const gchar *cache_type, 122 GimvThumbCacheClearFlags flags, 123 gpointer unused_yet); 124 gboolean gimv_thumb_cache_can_clear (const gchar *path, 125 const gchar *cache_type); 126 127 /* for plugin loader */ 128 gboolean gimv_thumb_cache_plugin_regist (const gchar *plugin_name, 129 const gchar *module_name, 130 gpointer impl, 131 gint size); 132 133 #endif /* __GIMV_THUMB_CACHE_H__ */ 134