Fix missing translation
[geeqie.git] / src / collect.h
1 /*
2  * Copyright (C) 2004 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 COLLECT_H
23 #define COLLECT_H
24
25 #include <gtk/gtk.h>
26
27 #include "typedefs.h"
28
29 struct CollectTable;
30 struct FileData;
31 struct ThumbLoader;
32
33 struct CollectInfo
34 {
35         FileData *fd;
36         GdkPixbuf *pixbuf;
37         guint flag_mask;
38 };
39
40 CollectInfo *collection_info_new(FileData *fd, struct stat *st, GdkPixbuf *pixbuf);
41
42 void collection_info_free_thumb(CollectInfo *ci);
43 void collection_info_free(CollectInfo *ci);
44
45 void collection_info_set_thumb(CollectInfo *ci, GdkPixbuf *pixbuf);
46
47 GList *collection_list_sort(GList *list, SortType method);
48 GList *collection_list_add(GList *list, CollectInfo *ci, SortType method);
49 GList *collection_list_insert(GList *list, CollectInfo *ci, CollectInfo *insert_ci, SortType method);
50 GList *collection_list_remove(GList *list, CollectInfo *ci);
51 CollectInfo *collection_list_find_fd(GList *list, FileData *fd);
52 GList *collection_list_to_filelist(GList *list);
53
54 struct CollectionData
55 {
56         gchar *path;
57         gchar *name;
58         GList *list;
59         SortType sort_method;
60
61         ThumbLoader *thumb_loader;
62         CollectInfo *thumb_info;
63
64         void (*info_updated_func)(CollectionData *, CollectInfo *, gpointer);
65         gpointer info_updated_data;
66
67         gint ref;
68
69         /* geometry */
70         gboolean window_read;
71         GdkRectangle window;
72
73         gboolean changed; /**< contents changed since save flag */
74
75         GHashTable *existence;
76
77         GtkWidget *dialog_name_entry;
78         gchar *collection_path; /**< Full path to collection including extension */
79         gint collection_append_index;
80 };
81
82 CollectionData *collection_new(const gchar *path);
83 void collection_free(CollectionData *cd);
84
85 void collection_ref(CollectionData *cd);
86 void collection_unref(CollectionData *cd);
87
88 void collection_path_changed(CollectionData *cd);
89
90 gint collection_to_number(CollectionData *cd);
91 CollectionData *collection_from_number(gint n);
92
93 /**
94  * @headerfile collection_from_dnd_data
95  * pass a NULL pointer to whatever you don't need
96  * use free_selected_list to free list, and
97  * g_list_free to free info_list, which is a list of
98  * CollectInfo pointers into CollectionData
99  */
100 CollectionData *collection_from_dnd_data(const gchar *data, GList **list, GList **info_list);
101 gchar *collection_info_list_to_dnd_data(CollectionData *cd, GList *list, gint *length);
102
103 gint collection_info_valid(CollectionData *cd, CollectInfo *info);
104
105 CollectInfo *collection_next_by_info(CollectionData *cd, CollectInfo *info);
106 CollectInfo *collection_prev_by_info(CollectionData *cd, CollectInfo *info);
107 CollectInfo *collection_get_first(CollectionData *cd);
108 CollectInfo *collection_get_last(CollectionData *cd);
109
110 void collection_set_sort_method(CollectionData *cd, SortType method);
111 void collection_randomize(CollectionData *cd);
112 void collection_set_update_info_func(CollectionData *cd,
113                                      void (*func)(CollectionData *, CollectInfo *, gpointer), gpointer data);
114
115 gboolean collection_add(CollectionData *cd, FileData *fd, gboolean sorted);
116 gboolean collection_add_check(CollectionData *cd, FileData *fd, gboolean sorted, gboolean must_exist);
117 gboolean collection_insert(CollectionData *cd, FileData *fd, CollectInfo *insert_ci, gboolean sorted);
118 gboolean collection_remove(CollectionData *cd, FileData *fd);
119 void collection_remove_by_info_list(CollectionData *cd, GList *list);
120 gboolean collection_rename(CollectionData *cd, FileData *fd);
121
122 void collection_update_geometry(CollectionData *cd);
123
124 struct CollectWindow
125 {
126         GtkWidget *window;
127         CollectTable *table;
128         GtkWidget *status_box;
129
130         GtkWidget *close_dialog;
131
132         CollectionData *cd;
133 };
134
135 CollectWindow *collection_window_new(const gchar *path);
136 void collection_window_close_by_collection(CollectionData *cd);
137 CollectWindow *collection_window_find(CollectionData *cd);
138 CollectWindow *collection_window_find_by_path(const gchar *path);
139 gboolean collection_window_modified_exists();
140
141 gboolean is_collection(const gchar *param);
142 gchar *collection_path(const gchar *param);
143 void collection_contents(const gchar *name, GString **contents);
144 GList *collection_contents_fd(const gchar *name);
145
146 #endif
147 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */