1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
2 
3    caja-file.h: Caja file model.
4 
5    Copyright (C) 1999, 2000, 2001 Eazel, Inc.
6 
7    This program is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License as
9    published by the Free Software Foundation; either version 2 of the
10    License, or (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 GNU
15    General Public License for more details.
16 
17    You should have received a copy of the GNU General Public
18    License along with this program; if not, write to the
19    Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20    Boston, MA 02110-1301, USA.
21 
22    Author: Darin Adler <darin@bentspoon.com>
23 */
24 
25 #ifndef CAJA_FILE_H
26 #define CAJA_FILE_H
27 
28 #include <gtk/gtk.h>
29 #include <gio/gio.h>
30 
31 #include "caja-file-attributes.h"
32 #include "caja-icon-info.h"
33 
34 G_BEGIN_DECLS
35 
36 /* CajaFile is an object used to represent a single element of a
37  * CajaDirectory. It's lightweight and relies on CajaDirectory
38  * to do most of the work.
39  */
40 
41 /* CajaFile is defined both here and in caja-directory.h. */
42 #ifndef CAJA_FILE_DEFINED
43 #define CAJA_FILE_DEFINED
44 typedef struct CajaFile CajaFile;
45 #endif
46 
47 #define CAJA_TYPE_FILE caja_file_get_type()
48 #define CAJA_FILE(obj) \
49   (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_FILE, CajaFile))
50 #define CAJA_FILE_CLASS(klass) \
51   (G_TYPE_CHECK_CLASS_CAST ((klass), CAJA_TYPE_FILE, CajaFileClass))
52 #define CAJA_IS_FILE(obj) \
53   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_FILE))
54 #define CAJA_IS_FILE_CLASS(klass) \
55   (G_TYPE_CHECK_CLASS_TYPE ((klass), CAJA_TYPE_FILE))
56 #define CAJA_FILE_GET_CLASS(obj) \
57   (G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_FILE, CajaFileClass))
58 
59 typedef enum
60 {
61     CAJA_FILE_SORT_NONE,
62     CAJA_FILE_SORT_BY_DISPLAY_NAME,
63     CAJA_FILE_SORT_BY_DIRECTORY,
64     CAJA_FILE_SORT_BY_SIZE,
65     CAJA_FILE_SORT_BY_TYPE,
66     CAJA_FILE_SORT_BY_MTIME,
67     CAJA_FILE_SORT_BY_BTIME,
68     CAJA_FILE_SORT_BY_ATIME,
69     CAJA_FILE_SORT_BY_EMBLEMS,
70     CAJA_FILE_SORT_BY_TRASHED_TIME,
71     CAJA_FILE_SORT_BY_SIZE_ON_DISK,
72     CAJA_FILE_SORT_BY_EXTENSION
73 } CajaFileSortType;
74 
75 typedef enum
76 {
77     CAJA_REQUEST_NOT_STARTED,
78     CAJA_REQUEST_IN_PROGRESS,
79     CAJA_REQUEST_DONE
80 } CajaRequestStatus;
81 
82 typedef enum
83 {
84     CAJA_FILE_ICON_FLAGS_NONE = 0,
85     CAJA_FILE_ICON_FLAGS_USE_THUMBNAILS = (1<<0),
86     CAJA_FILE_ICON_FLAGS_IGNORE_VISITING = (1<<1),
87     CAJA_FILE_ICON_FLAGS_EMBEDDING_TEXT = (1<<2),
88     CAJA_FILE_ICON_FLAGS_FOR_DRAG_ACCEPT = (1<<3),
89     CAJA_FILE_ICON_FLAGS_FOR_OPEN_FOLDER = (1<<4),
90     /* whether the thumbnail size must match the display icon size */
91     CAJA_FILE_ICON_FLAGS_FORCE_THUMBNAIL_SIZE = (1<<5),
92     /* uses the icon of the mount if present */
93     CAJA_FILE_ICON_FLAGS_USE_MOUNT_ICON = (1<<6),
94     /* render the mount icon as an emblem over the regular one */
95     CAJA_FILE_ICON_FLAGS_USE_MOUNT_ICON_AS_EMBLEM = (1<<7)
96 } CajaFileIconFlags;
97 
98 /* Emblems sometimes displayed for CajaFiles. Do not localize. */
99 #define CAJA_FILE_EMBLEM_NAME_SYMBOLIC_LINK "symbolic-link"
100 #define CAJA_FILE_EMBLEM_NAME_CANT_READ "noread"
101 #define CAJA_FILE_EMBLEM_NAME_CANT_WRITE "nowrite"
102 #define CAJA_FILE_EMBLEM_NAME_TRASH "trash"
103 #define CAJA_FILE_EMBLEM_NAME_NOTE "note"
104 #define CAJA_FILE_EMBLEM_NAME_DESKTOP "desktop"
105 #define CAJA_FILE_EMBLEM_NAME_SHARED "shared"
106 
107 typedef void (*CajaFileCallback)          (CajaFile  *file,
108         gpointer       callback_data);
109 typedef void (*CajaFileListCallback)      (GList         *file_list,
110         gpointer       callback_data);
111 typedef void (*CajaFileOperationCallback) (CajaFile  *file,
112         GFile         *result_location,
113         GError        *error,
114         gpointer       callback_data);
115 typedef int (*CajaWidthMeasureCallback)   (const char    *string,
116         void	     *context);
117 typedef char * (*CajaTruncateCallback)    (const char    *string,
118         int	      width,
119         void	     *context);
120 
121 
122 #define CAJA_FILE_ATTRIBUTES_FOR_ICON (CAJA_FILE_ATTRIBUTE_INFO | CAJA_FILE_ATTRIBUTE_LINK_INFO | CAJA_FILE_ATTRIBUTE_THUMBNAIL)
123 
124 typedef void CajaFileListHandle;
125 
126 /* GObject requirements. */
127 GType                   caja_file_get_type                          (void);
128 
129 /* Getting at a single file. */
130 CajaFile *          caja_file_get                               (GFile                          *location);
131 CajaFile *          caja_file_get_by_uri                        (const char                     *uri);
132 
133 /* Get a file only if the caja version already exists */
134 CajaFile *          caja_file_get_existing                      (GFile                          *location);
135 CajaFile *          caja_file_get_existing_by_uri               (const char                     *uri);
136 
137 /* Covers for g_object_ref and g_object_unref that provide two conveniences:
138  * 1) Using these is type safe.
139  * 2) You are allowed to call these with NULL,
140  */
141 CajaFile *          caja_file_ref                               (CajaFile                   *file);
142 void                    caja_file_unref                             (CajaFile                   *file);
143 
144 /* Monitor the file. */
145 void                    caja_file_monitor_add                       (CajaFile                   *file,
146         gconstpointer                   client,
147         CajaFileAttributes          attributes);
148 void                    caja_file_monitor_remove                    (CajaFile                   *file,
149         gconstpointer                   client);
150 
151 /* Synchronously refreshes file info from disk.
152  * This can call caja_file_changed, so don't call this function from any
153  * of the callbacks for that event.
154  */
155 void                     caja_file_refresh_info                     (CajaFile                   *file);
156 
157 /* Waiting for data that's read asynchronously.
158  * This interface currently works only for metadata, but could be expanded
159  * to other attributes as well.
160  */
161 void                    caja_file_call_when_ready                   (CajaFile                   *file,
162         CajaFileAttributes          attributes,
163         CajaFileCallback            callback,
164         gpointer                        callback_data);
165 void                    caja_file_cancel_call_when_ready            (CajaFile                   *file,
166         CajaFileCallback            callback,
167         gpointer                        callback_data);
168 gboolean                caja_file_check_if_ready                    (CajaFile                   *file,
169         CajaFileAttributes          attributes);
170 void                    caja_file_invalidate_attributes             (CajaFile                   *file,
171         CajaFileAttributes          attributes);
172 void                    caja_file_invalidate_all_attributes         (CajaFile                   *file);
173 
174 /* Basic attributes for file objects. */
175 gboolean                caja_file_contains_text                     (CajaFile                   *file);
176 gboolean                caja_file_is_binary                         (CajaFile                   *file);
177 char *                  caja_file_get_display_name                  (CajaFile                   *file);
178 char *                  caja_file_get_edit_name                     (CajaFile                   *file);
179 char *                  caja_file_get_name                          (CajaFile                   *file);
180 GFile *                 caja_file_get_location                      (CajaFile                   *file);
181 char *			 caja_file_get_description			 (CajaFile			 *file);
182 char *                  caja_file_get_uri                           (CajaFile                   *file);
183 char *                  caja_file_get_uri_scheme                    (CajaFile                   *file);
184 CajaFile *          caja_file_get_parent                        (CajaFile                   *file);
185 GFile *                 caja_file_get_parent_location               (CajaFile                   *file);
186 char *                  caja_file_get_parent_uri                    (CajaFile                   *file);
187 char *                  caja_file_get_parent_uri_for_display        (CajaFile                   *file);
188 gboolean                caja_file_can_get_size                      (CajaFile                   *file);
189 goffset                 caja_file_get_size                          (CajaFile                   *file);
190 goffset                 caja_file_get_size_on_disk                  (CajaFile                   *file);
191 time_t                  caja_file_get_mtime                         (CajaFile                   *file);
192 GFileType               caja_file_get_file_type                     (CajaFile                   *file);
193 char *                  caja_file_get_mime_type                     (CajaFile                   *file);
194 gboolean                caja_file_is_mime_type                      (CajaFile                   *file,
195         const char                     *mime_type);
196 gboolean                caja_file_is_launchable                     (CajaFile                   *file);
197 gboolean                caja_file_is_symbolic_link                  (CajaFile                   *file);
198 gboolean                caja_file_is_mountpoint                     (CajaFile                   *file);
199 GMount *                caja_file_get_mount                         (CajaFile                   *file);
200 char *                  caja_file_get_volume_free_space             (CajaFile                   *file);
201 char *                  caja_file_get_volume_name                   (CajaFile                   *file);
202 char *                  caja_file_get_symbolic_link_target_path     (CajaFile                   *file);
203 char *                  caja_file_get_symbolic_link_target_uri      (CajaFile                   *file);
204 gboolean                caja_file_is_broken_symbolic_link           (CajaFile                   *file);
205 gboolean                caja_file_is_caja_link                  (CajaFile                   *file);
206 gboolean                caja_file_is_executable                     (CajaFile                   *file);
207 gboolean                caja_file_is_directory                      (CajaFile                   *file);
208 gboolean                caja_file_is_user_special_directory         (CajaFile                   *file,
209         GUserDirectory                 special_directory);
210 gboolean		caja_file_is_archive			(CajaFile			*file);
211 gboolean                caja_file_is_in_trash                       (CajaFile                   *file);
212 gboolean                caja_file_is_in_desktop                     (CajaFile                   *file);
213 gboolean		caja_file_is_home				(CajaFile                   *file);
214 gboolean                caja_file_is_desktop_directory              (CajaFile                   *file);
215 GError *                caja_file_get_file_info_error               (CajaFile                   *file);
216 gboolean                caja_file_get_directory_item_count          (CajaFile                   *file,
217         guint                          *count,
218         gboolean                       *count_unreadable);
219 void                    caja_file_recompute_deep_counts             (CajaFile                   *file);
220 CajaRequestStatus   caja_file_get_deep_counts                   (CajaFile                   *file,
221         guint                          *directory_count,
222         guint                          *file_count,
223         guint                          *unreadable_directory_count,
224         goffset                        *total_size,
225         goffset                        *total_size_on_disk,
226         gboolean                        force);
227 gboolean                caja_file_should_show_thumbnail             (CajaFile                   *file);
228 gboolean                caja_file_should_show_directory_item_count  (CajaFile                   *file);
229 gboolean                caja_file_should_show_type                  (CajaFile                   *file);
230 GList *                 caja_file_get_keywords                      (CajaFile                   *file);
231 void                    caja_file_set_keywords                      (CajaFile                   *file,
232         GList                          *keywords);
233 GList *                 caja_file_get_emblem_icons                  (CajaFile                   *file,
234         char                          **exclude);
235 GList *                 caja_file_get_emblem_pixbufs                (CajaFile                   *file,
236         int                             size,
237         gboolean                        force_size,
238         char                          **exclude);
239 char *                  caja_file_get_top_left_text                 (CajaFile                   *file);
240 char *                  caja_file_peek_top_left_text                (CajaFile                   *file,
241         gboolean                        need_large_text,
242         gboolean                       *got_top_left_text);
243 
244 void                    caja_file_set_attributes                    (CajaFile                   *file,
245         GFileInfo                      *attributes,
246         CajaFileOperationCallback   callback,
247         gpointer                        callback_data);
248 GFilesystemPreviewType  caja_file_get_filesystem_use_preview        (CajaFile *file);
249 
250 char *                  caja_file_get_filesystem_id                 (CajaFile                   *file);
251 
252 CajaFile *          caja_file_get_trash_original_file           (CajaFile                   *file);
253 
254 /* Permissions. */
255 gboolean                caja_file_can_get_permissions               (CajaFile                   *file);
256 gboolean                caja_file_can_set_permissions               (CajaFile                   *file);
257 guint                   caja_file_get_permissions                   (CajaFile                   *file);
258 gboolean                caja_file_can_get_owner                     (CajaFile                   *file);
259 gboolean                caja_file_can_set_owner                     (CajaFile                   *file);
260 gboolean                caja_file_can_get_group                     (CajaFile                   *file);
261 gboolean                caja_file_can_set_group                     (CajaFile                   *file);
262 char *                  caja_file_get_owner_name                    (CajaFile                   *file);
263 char *                  caja_file_get_group_name                    (CajaFile                   *file);
264 GList *                 caja_get_user_names                         (void);
265 GList *                 caja_get_all_group_names                    (void);
266 GList *                 caja_file_get_settable_group_names          (CajaFile                   *file);
267 gboolean                caja_file_can_get_selinux_context           (CajaFile                   *file);
268 char *                  caja_file_get_selinux_context               (CajaFile                   *file);
269 
270 /* "Capabilities". */
271 gboolean                caja_file_can_read                          (CajaFile                   *file);
272 gboolean                caja_file_can_write                         (CajaFile                   *file);
273 gboolean                caja_file_can_execute                       (CajaFile                   *file);
274 gboolean                caja_file_can_rename                        (CajaFile                   *file);
275 gboolean                caja_file_can_delete                        (CajaFile                   *file);
276 gboolean                caja_file_can_trash                         (CajaFile                   *file);
277 
278 gboolean                caja_file_can_mount                         (CajaFile                   *file);
279 gboolean                caja_file_can_unmount                       (CajaFile                   *file);
280 gboolean                caja_file_can_eject                         (CajaFile                   *file);
281 gboolean                caja_file_can_start                         (CajaFile                   *file);
282 gboolean                caja_file_can_start_degraded                (CajaFile                   *file);
283 gboolean                caja_file_can_stop                          (CajaFile                   *file);
284 GDriveStartStopType     caja_file_get_start_stop_type               (CajaFile                   *file);
285 gboolean                caja_file_can_poll_for_media                (CajaFile                   *file);
286 gboolean                caja_file_is_media_check_automatic          (CajaFile                   *file);
287 
288 void                    caja_file_mount                             (CajaFile                   *file,
289         GMountOperation                *mount_op,
290         GCancellable                   *cancellable,
291         CajaFileOperationCallback   callback,
292         gpointer                        callback_data);
293 void                    caja_file_unmount                           (CajaFile                   *file,
294         GMountOperation                *mount_op,
295         GCancellable                   *cancellable,
296         CajaFileOperationCallback   callback,
297         gpointer                        callback_data);
298 void                    caja_file_eject                             (CajaFile                   *file,
299         GMountOperation                *mount_op,
300         GCancellable                   *cancellable,
301         CajaFileOperationCallback   callback,
302         gpointer                        callback_data);
303 
304 void                    caja_file_start                             (CajaFile                   *file,
305         GMountOperation                *start_op,
306         GCancellable                   *cancellable,
307         CajaFileOperationCallback   callback,
308         gpointer                        callback_data);
309 void                    caja_file_stop                              (CajaFile                   *file,
310         GMountOperation                *mount_op,
311         GCancellable                   *cancellable,
312         CajaFileOperationCallback   callback,
313         gpointer                        callback_data);
314 void                    caja_file_poll_for_media                    (CajaFile                   *file);
315 
316 /* Basic operations for file objects. */
317 void                    caja_file_set_owner                         (CajaFile                   *file,
318         const char                     *user_name_or_id,
319         CajaFileOperationCallback   callback,
320         gpointer                        callback_data);
321 void                    caja_file_set_group                         (CajaFile                   *file,
322         const char                     *group_name_or_id,
323         CajaFileOperationCallback   callback,
324         gpointer                        callback_data);
325 void                    caja_file_set_permissions                   (CajaFile                   *file,
326         guint32                         permissions,
327         CajaFileOperationCallback   callback,
328         gpointer                        callback_data);
329 void                    caja_file_rename                            (CajaFile                   *file,
330         const char                     *new_name,
331         CajaFileOperationCallback   callback,
332         gpointer                        callback_data);
333 void                    caja_file_cancel                            (CajaFile                   *file,
334         CajaFileOperationCallback   callback,
335         gpointer                        callback_data);
336 
337 /* Return true if this file has already been deleted.
338  * This object will be unref'd after sending the files_removed signal,
339  * but it could hang around longer if someone ref'd it.
340  */
341 gboolean                caja_file_is_gone                           (CajaFile                   *file);
342 
343 /* Return true if this file is not confirmed to have ever really
344  * existed. This is true when the CajaFile object has been created, but no I/O
345  * has yet confirmed the existence of a file by that name.
346  */
347 gboolean                caja_file_is_not_yet_confirmed              (CajaFile                   *file);
348 
349 /* Simple getting and setting top-level metadata. */
350 char *                  caja_file_get_metadata                      (CajaFile                   *file,
351         const char                     *key,
352         const char                     *default_metadata);
353 GList *                 caja_file_get_metadata_list                 (CajaFile                   *file,
354         const char                     *key);
355 void                    caja_file_set_metadata                      (CajaFile                   *file,
356         const char                     *key,
357         const char                     *default_metadata,
358         const char                     *metadata);
359 void                    caja_file_set_metadata_list                 (CajaFile                   *file,
360         const char                     *key,
361         GList                          *list);
362 
363 /* Covers for common data types. */
364 gboolean                caja_file_get_boolean_metadata              (CajaFile                   *file,
365         const char                     *key,
366         gboolean                        default_metadata);
367 void                    caja_file_set_boolean_metadata              (CajaFile                   *file,
368         const char                     *key,
369         gboolean                        default_metadata,
370         gboolean                        metadata);
371 int                     caja_file_get_integer_metadata              (CajaFile                   *file,
372         const char                     *key,
373         int                             default_metadata);
374 void                    caja_file_set_integer_metadata              (CajaFile                   *file,
375         const char                     *key,
376         int                             default_metadata,
377         int                             metadata);
378 
379 #define UNDEFINED_TIME ((time_t) (-1))
380 
381 time_t                  caja_file_get_time_metadata                 (CajaFile                  *file,
382         const char                    *key);
383 void                    caja_file_set_time_metadata                 (CajaFile                  *file,
384         const char                    *key,
385         time_t                         time);
386 
387 
388 /* Attributes for file objects as user-displayable strings. */
389 char *                  caja_file_get_string_attribute              (CajaFile                   *file,
390         const char                     *attribute_name);
391 char *                  caja_file_get_string_attribute_q            (CajaFile                   *file,
392         GQuark                          attribute_q);
393 char *                  caja_file_get_string_attribute_with_default (CajaFile                   *file,
394         const char                     *attribute_name);
395 char *                  caja_file_get_string_attribute_with_default_q (CajaFile                  *file,
396         GQuark                          attribute_q);
397 char *			caja_file_fit_modified_date_as_string	(CajaFile 			*file,
398         int				 width,
399         CajaWidthMeasureCallback    measure_callback,
400         CajaTruncateCallback	 truncate_callback,
401         void				*measure_truncate_context);
402 
403 /* Matching with another URI. */
404 gboolean                caja_file_matches_uri                       (CajaFile                   *file,
405         const char                     *uri);
406 
407 /* Is the file local? */
408 gboolean                caja_file_is_local                          (CajaFile                   *file);
409 
410 /* Comparing two file objects for sorting */
411 CajaFileSortType    caja_file_get_default_sort_type             (CajaFile                   *file,
412         gboolean                       *reversed);
413 const gchar *           caja_file_get_default_sort_attribute        (CajaFile                   *file,
414         gboolean                       *reversed);
415 
416 int                     caja_file_compare_for_sort                  (CajaFile                   *file_1,
417         CajaFile                   *file_2,
418         CajaFileSortType            sort_type,
419         gboolean			 directories_first,
420         gboolean		  	 reversed);
421 int                     caja_file_compare_for_sort_by_attribute     (CajaFile                   *file_1,
422         CajaFile                   *file_2,
423         const char                     *attribute,
424         gboolean                        directories_first,
425         gboolean                        reversed);
426 int                     caja_file_compare_for_sort_by_attribute_q   (CajaFile                   *file_1,
427         CajaFile                   *file_2,
428         GQuark                          attribute,
429         gboolean                        directories_first,
430         gboolean                        reversed);
431 gboolean                caja_file_is_date_sort_attribute_q          (GQuark                          attribute);
432 
433 int                     caja_file_compare_display_name              (CajaFile                   *file_1,
434         const char                     *pattern);
435 int                     caja_file_compare_location                  (CajaFile                    *file_1,
436         CajaFile                    *file_2);
437 
438 /* filtering functions for use by various directory views */
439 gboolean                caja_file_is_hidden_file                    (CajaFile                   *file);
440 gboolean                caja_file_should_show                       (CajaFile                   *file,
441         gboolean                        show_hidden,
442         gboolean                        show_foreign,
443         gboolean                        show_backup);
444 GList                  *caja_file_list_filter_hidden                (GList                          *files,
445         gboolean                        show_hidden);
446 
447 
448 /* Get the URI that's used when activating the file.
449  * Getting this can require reading the contents of the file.
450  */
451 gboolean                caja_file_is_launcher                       (CajaFile                   *file);
452 gboolean                caja_file_is_foreign_link                   (CajaFile                   *file);
453 gboolean                caja_file_is_trusted_link                   (CajaFile                   *file);
454 gboolean                caja_file_has_activation_uri                (CajaFile                   *file);
455 char *                  caja_file_get_activation_uri                (CajaFile                   *file);
456 GFile *                 caja_file_get_activation_location           (CajaFile                   *file);
457 
458 char *                  caja_file_get_drop_target_uri               (CajaFile                   *file);
459 
460 /* Get custom icon (if specified by metadata or link contents) */
461 char *                  caja_file_get_custom_icon                   (CajaFile                   *file);
462 
463 
464 GIcon           *caja_file_get_gicon        (CajaFile         *file,
465                                              CajaFileIconFlags flags);
466 CajaIconInfo    *caja_file_get_icon         (CajaFile         *file,
467                                              int               size,
468                                              int               scale,
469                                              CajaFileIconFlags flags);
470 cairo_surface_t *caja_file_get_icon_surface (CajaFile         *file,
471                                              int               size,
472                                              gboolean          force_size,
473                                              int               scale,
474                                              CajaFileIconFlags flags);
475 
476 gboolean                caja_file_has_open_window                   (CajaFile                   *file);
477 void                    caja_file_set_has_open_window               (CajaFile                   *file,
478         gboolean                        has_open_window);
479 
480 /* Thumbnailing handling */
481 gboolean                caja_file_is_thumbnailing                   (CajaFile                   *file);
482 
483 /* Convenience functions for dealing with a list of CajaFile objects that each have a ref.
484  * These are just convenient names for functions that work on lists of GtkObject *.
485  */
486 GList *                 caja_file_list_ref                          (GList                          *file_list);
487 void                    caja_file_list_unref                        (GList                          *file_list);
488 void                    caja_file_list_free                         (GList                          *file_list);
489 GList *                 caja_file_list_copy                         (GList                          *file_list);
490 GList *			caja_file_list_sort_by_display_name		(GList				*file_list);
491 void                    caja_file_list_call_when_ready              (GList                          *file_list,
492         CajaFileAttributes          attributes,
493         CajaFileListHandle        **handle,
494         CajaFileListCallback        callback,
495         gpointer                        callback_data);
496 void                    caja_file_list_cancel_call_when_ready       (CajaFileListHandle         *handle);
497 
498 /* Debugging */
499 void                    caja_file_dump                              (CajaFile                   *file);
500 
501 typedef struct _CajaFilePrivate CajaFilePrivate;
502 
503 struct CajaFile
504 {
505     GObject parent_slot;
506     CajaFilePrivate *details;
507 };
508 
509 /* This is actually a "protected" type, but it must be here so we can
510  * compile the get_date function pointer declaration below.
511  */
512 typedef enum
513 {
514     CAJA_DATE_TYPE_MODIFIED,
515     CAJA_DATE_TYPE_CREATED,
516     CAJA_DATE_TYPE_CHANGED,
517     CAJA_DATE_TYPE_ACCESSED,
518     CAJA_DATE_TYPE_PERMISSIONS_CHANGED,
519     CAJA_DATE_TYPE_TRASHED
520 } CajaDateType;
521 
522 typedef struct
523 {
524     GObjectClass parent_slot;
525 
526     /* Subclasses can set this to something other than G_FILE_TYPE_UNKNOWN and
527        it will be used as the default file type. This is useful when creating
528        a "virtual" CajaFile subclass that you can't actually get real
529        information about. For exaple CajaDesktopDirectoryFile. */
530     GFileType default_file_type;
531 
532     /* Called when the file notices any change. */
533     void                  (* changed)                (CajaFile *file);
534 
535     /* Called periodically while directory deep count is being computed. */
536     void                  (* updated_deep_count_in_progress) (CajaFile *file);
537 
538     /* Virtual functions (mainly used for trash directory). */
539     void                  (* monitor_add)            (CajaFile           *file,
540             gconstpointer           client,
541             CajaFileAttributes  attributes);
542     void                  (* monitor_remove)         (CajaFile           *file,
543             gconstpointer           client);
544     void                  (* call_when_ready)        (CajaFile           *file,
545             CajaFileAttributes  attributes,
546             CajaFileCallback    callback,
547             gpointer                callback_data);
548     void                  (* cancel_call_when_ready) (CajaFile           *file,
549             CajaFileCallback    callback,
550             gpointer                callback_data);
551     gboolean              (* check_if_ready)         (CajaFile           *file,
552             CajaFileAttributes  attributes);
553     gboolean              (* get_item_count)         (CajaFile           *file,
554             guint                  *count,
555             gboolean               *count_unreadable);
556     CajaRequestStatus (* get_deep_counts)        (CajaFile           *file,
557             guint                  *directory_count,
558             guint                  *file_count,
559             guint                  *unreadable_directory_count,
560             goffset                *total_size,
561             goffset                *total_size_on_disk);
562     gboolean              (* get_date)               (CajaFile           *file,
563             CajaDateType        type,
564             time_t                 *date);
565     char *                (* get_where_string)       (CajaFile           *file);
566 
567     void                  (* set_metadata)           (CajaFile           *file,
568             const char             *key,
569             const char             *value);
570     void                  (* set_metadata_as_list)   (CajaFile           *file,
571             const char             *key,
572             char                  **value);
573 
574     void                  (* mount)                  (CajaFile                   *file,
575             GMountOperation                *mount_op,
576             GCancellable                   *cancellable,
577             CajaFileOperationCallback   callback,
578             gpointer                        callback_data);
579     void                 (* unmount)                 (CajaFile                   *file,
580             GMountOperation                *mount_op,
581             GCancellable                   *cancellable,
582             CajaFileOperationCallback   callback,
583             gpointer                        callback_data);
584     void                 (* eject)                   (CajaFile                   *file,
585             GMountOperation                *mount_op,
586             GCancellable                   *cancellable,
587             CajaFileOperationCallback   callback,
588             gpointer                        callback_data);
589 
590     void                  (* start)                  (CajaFile                   *file,
591             GMountOperation                *start_op,
592             GCancellable                   *cancellable,
593             CajaFileOperationCallback   callback,
594             gpointer                        callback_data);
595     void                 (* stop)                    (CajaFile                   *file,
596             GMountOperation                *mount_op,
597             GCancellable                   *cancellable,
598             CajaFileOperationCallback   callback,
599             gpointer                        callback_data);
600 
601     void                 (* poll_for_media)          (CajaFile                   *file);
602 } CajaFileClass;
603 
604 G_END_DECLS
605 
606 #endif /* CAJA_FILE_H */
607