4
* Description: Object used to present a directory
7
* Author: Hong Jen Yee (PCMan) <pcman.tw (AT) gmail.com>, (C) 2006
9
* Copyright: See COPYING file that comes with this distribution
17
#include <glib-object.h>
19
#include "vfs-file-monitor.h"
20
#include "vfs-file-info.h"
21
#include "vfs-async-task.h"
25
#define VFS_TYPE_DIR (vfs_dir_get_type())
26
#define VFS_DIR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), VFS_TYPE_DIR, VFSDir))
27
#define VFS_DIR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VFS_TYPE_DIR, VFSDirClass))
28
#define VFS_IS_DIR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VFS_TYPE_DIR))
29
#define VFS_IS_DIR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VFS_TYPE_DIR))
30
#define VFS_DIR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VFS_TYPE_DIR, VFSDirClass))
32
typedef struct _VFSDir VFSDir;
33
typedef struct _VFSDirClass VFSDirClass;
48
gboolean is_desktop : 1;
49
gboolean is_trash : 1;
50
gboolean is_mount_point : 1;
51
gboolean is_remote : 1;
52
gboolean is_virtual : 1;
57
VFSFileMonitor* monitor;
58
GMutex* mutex; /* Used to guard file_list */
60
gboolean file_listed : 1;
61
gboolean load_complete : 1;
63
gboolean show_hidden : 1;
65
struct _VFSThumbnailLoader* thumbnail_loader;
67
GSList* changed_files;
73
/* Default signal handlers */
74
void ( *file_created ) ( VFSDir* dir, VFSFileInfo* file );
75
void ( *file_deleted ) ( VFSDir* dir, VFSFileInfo* file );
76
void ( *file_changed ) ( VFSDir* dir, VFSFileInfo* file );
77
void ( *thumbnail_loaded ) ( VFSDir* dir, VFSFileInfo* file );
78
void ( *file_listed ) ( VFSDir* dir );
79
void ( *load_complete ) ( VFSDir* dir );
80
/* void (*need_reload) ( VFSDir* dir ); */
81
/* void (*update_mime) ( VFSDir* dir ); */
84
typedef void ( *VFSDirStateCallback ) ( VFSDir* dir, int state, gpointer user_data );
86
GType vfs_dir_get_type ( void );
88
VFSDir* vfs_dir_get_by_path( const char* path );
90
gboolean vfs_dir_is_loading( VFSDir* dir );
91
void vfs_dir_cancel_load( VFSDir* dir );
92
gboolean vfs_dir_is_file_listed( VFSDir* dir );
94
void vfs_dir_unload_thumbnails( VFSDir* dir, gboolean is_big );
97
void vfs_dir_emit_file_created( VFSDir* dir, const char* file_name, VFSFileInfo* file );
98
void vfs_dir_emit_file_deleted( VFSDir* dir, const char* file_name, VFSFileInfo* file );
99
void vfs_dir_emit_file_changed( VFSDir* dir, const char* file_name, VFSFileInfo* file );
100
void vfs_dir_emit_thumbnail_loaded( VFSDir* dir, VFSFileInfo* file );
102
/* get the path of desktop dir */
103
const char* vfs_get_desktop_dir();
105
/* Get the path of user's trash dir under home dir.
107
* According to the spec, there are many legal trash dirs on the system
108
* located at various places. However, because that spec is poor and try
109
* very hard to make simple things more complicated, we only support
110
* home trash dir instead. They are good at making things complicated and
111
* hard to implement. This time, they did it again.
113
const char* vfs_get_trash_dir();
115
/* call function "func" for every VFSDir instances */
116
void vfs_dir_foreach( GHFunc func, gpointer user_data );