1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
3 nautilus-vfs-directory.c: Subclass of NautilusDirectory to help implement the
4 virtual trash directory.
6 Copyright (C) 1999, 2000 Eazel, Inc.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public
19 License along with this program; if not, write to the
20 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.
23 Author: Darin Adler <darin@bentspoon.com>
27 #include "nautilus-vfs-directory.h"
29 #include "nautilus-directory-private.h"
30 #include <eel/eel-gtk-macros.h>
31 #include "nautilus-file-private.h"
33 static void nautilus_vfs_directory_init (gpointer object
,
35 static void nautilus_vfs_directory_class_init (gpointer klass
);
37 EEL_CLASS_BOILERPLATE (NautilusVFSDirectory
,
38 nautilus_vfs_directory
,
39 NAUTILUS_TYPE_DIRECTORY
)
42 nautilus_vfs_directory_init (gpointer object
, gpointer klass
)
44 NautilusVFSDirectory
*directory
;
46 directory
= NAUTILUS_VFS_DIRECTORY (object
);
50 vfs_contains_file (NautilusDirectory
*directory
,
53 g_assert (NAUTILUS_IS_VFS_DIRECTORY (directory
));
54 g_assert (NAUTILUS_IS_FILE (file
));
56 return file
->details
->directory
== directory
;
60 vfs_call_when_ready (NautilusDirectory
*directory
,
61 NautilusFileAttributes file_attributes
,
62 gboolean wait_for_file_list
,
63 NautilusDirectoryCallback callback
,
64 gpointer callback_data
)
66 g_assert (NAUTILUS_IS_VFS_DIRECTORY (directory
));
68 nautilus_directory_call_when_ready_internal
79 vfs_cancel_callback (NautilusDirectory
*directory
,
80 NautilusDirectoryCallback callback
,
81 gpointer callback_data
)
83 g_assert (NAUTILUS_IS_VFS_DIRECTORY (directory
));
85 nautilus_directory_cancel_callback_internal
94 vfs_file_monitor_add (NautilusDirectory
*directory
,
96 gboolean monitor_hidden_files
,
97 gboolean monitor_backup_files
,
98 NautilusFileAttributes file_attributes
,
99 NautilusDirectoryCallback callback
,
100 gpointer callback_data
)
102 g_assert (NAUTILUS_IS_VFS_DIRECTORY (directory
));
103 g_assert (client
!= NULL
);
105 nautilus_directory_monitor_add_internal
108 monitor_hidden_files
,
109 monitor_backup_files
,
111 callback
, callback_data
);
115 vfs_file_monitor_remove (NautilusDirectory
*directory
,
116 gconstpointer client
)
118 g_assert (NAUTILUS_IS_VFS_DIRECTORY (directory
));
119 g_assert (client
!= NULL
);
121 nautilus_directory_monitor_remove_internal (directory
, NULL
, client
);
125 vfs_force_reload (NautilusDirectory
*directory
)
127 NautilusFileAttributes all_attributes
;
129 g_assert (NAUTILUS_IS_DIRECTORY (directory
));
131 all_attributes
= nautilus_file_get_all_attributes ();
132 nautilus_directory_force_reload_internal (directory
,
137 vfs_are_all_files_seen (NautilusDirectory
*directory
)
139 g_assert (NAUTILUS_IS_VFS_DIRECTORY (directory
));
141 return directory
->details
->directory_loaded
;
145 vfs_is_not_empty (NautilusDirectory
*directory
)
147 g_assert (NAUTILUS_IS_VFS_DIRECTORY (directory
));
148 g_assert (nautilus_directory_is_anyone_monitoring_file_list (directory
));
150 return directory
->details
->file_list
!= NULL
;
154 nautilus_vfs_directory_class_init (gpointer klass
)
156 GObjectClass
*object_class
;
157 NautilusDirectoryClass
*directory_class
;
159 object_class
= G_OBJECT_CLASS (klass
);
160 directory_class
= NAUTILUS_DIRECTORY_CLASS (klass
);
162 directory_class
->contains_file
= vfs_contains_file
;
163 directory_class
->call_when_ready
= vfs_call_when_ready
;
164 directory_class
->cancel_callback
= vfs_cancel_callback
;
165 directory_class
->file_monitor_add
= vfs_file_monitor_add
;
166 directory_class
->file_monitor_remove
= vfs_file_monitor_remove
;
167 directory_class
->force_reload
= vfs_force_reload
;
168 directory_class
->are_all_files_seen
= vfs_are_all_files_seen
;
169 directory_class
->is_not_empty
= vfs_is_not_empty
;