summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-merged-directory.c
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2001-01-18 19:26:03 +0000
committerDarin Adler <darin@src.gnome.org>2001-01-18 19:26:03 +0000
commite82bab8c493c3d173622c18e5df07e3f36d982ea (patch)
tree1c763ef60fff7ef1197243c4f19ca0d332af35df /libnautilus-private/nautilus-merged-directory.c
parentaee3945efe11c38873effaa5aff0121163cd030e (diff)
downloadnautilus-e82bab8c493c3d173622c18e5df07e3f36d982ea.tar.gz
reviewed by: John Sullivan <sullivan@eazel.com>
Fixed bug 2147 (NautilusFile for trash needs non-empty values for more properties), bug 5652 (MIME type field appears but shouldn't in properties window for Trash), and bug 4620 (trash sidebar should show number of items). * libnautilus-extensions/nautilus-file.h: * libnautilus-extensions/nautilus-file-private.h: * libnautilus-extensions/nautilus-file.c: (nautilus_file_new_from_relative_uri): Create trash file subclass when appropriate. (nautilus_file_info_missing): Rename so it can be used in other source files. (nautilus_file_get_date): New method that returns numeric dates. (nautilus_file_get_date_as_string): Change to call nautilus_file_get_date to get the numeric date. (nautilus_file_get_file_type): Turn into a method. * libnautilus-extensions/nautilus-merged-directory.h: * libnautilus-extensions/nautilus-merged-directory.c: (merged_call_when_ready): Rolled in the old merged_callback_connect_directory function. (merged_contains_file): Moved down to a more appropriate part of the source file. (nautilus_merged_directory_get_real_directories): New public function for use by trash. * libnautilus-extensions/nautilus-trash-file.c: (trash_callback_hash), (trash_callback_equal), (trash_callback_destroy), (trash_callback_check_done), (trash_callback_remove_file), (ready_callback), (real_file_changed_callback), (monitor_add_file), (add_real_file), (trash_callback_remove_file_cover), (monitor_remove_file), (remove_real_file), (add_real_file_given_directory), (add_directory_callback), (remove_directory_callback), (trash_file_call_when_ready), (trash_file_cancel_call_when_ready), (trash_file_check_if_ready), (trash_file_monitor_add), (trash_file_monitor_remove), (trash_file_get_file_type), (trash_file_get_item_count), (trash_file_get_deep_counts), (trash_file_get_date), (remove_all_real_files), (nautilus_trash_file_initialize), (trash_destroy), (nautilus_trash_file_initialize_class): New code. First implementation of getting some attributes for the merged trash. Gets list of directories from the NautilusTrashDirectory object. The code in here is similar to the NautilusMergedDirectory class and at some point perhaps we can make the two share more. * libnautilus-extensions/nautilus-vfs-file.c: (vfs_file_get_file_type), (vfs_file_get_date), (nautilus_vfs_file_initialize_class): Implement the two new methods for the standard vfs case. Fixed various things that affect the properties window for the trash that showed up while I was testing the above work: * libnautilus-extensions/nautilus-icon-factory.c: (nautilus_icon_factory_get_icon_name_for_regular_file), (nautilus_icon_factory_get_icon_name_for_file): Move trash special case out so it doesn't matter what type the trash seems to be. The old code relied on trash not being a directory. * src/file-manager/fm-properties-window.c: (create_properties_window), (create_properties_window_callback), (cancel_create_properties_window_callback), (directory_view_destroyed_callback), (remove_pending_file): Rework code to fix problems where the timed wait or the signal handler wasn't properly cleaned up. Fixed remaining bit of bug 5631 (Tear-offs of right-click menus don't work.): * src/file-manager/nautilus-desktop-icon-view-ui.xml: Mark Disks right-click submenu so it won't get a tear-off item. Fixed bug 5650 (nautilus --quit fails to return to prompt sometimes): * src/nautilus-application.c: (nautilus_application_startup): Add special case so "nautilus --quit" doesn't hang waiting for a response from the (now quit) "server" instance of Nautilus. * src/nautilus-shell-interface.idl: Had to make the quit call no longer be "oneway" to get it to work right, otherwise the quit message could be lost when the sending application exited too fast. Fix bug 5675 (Nitpicks in new "could not be moved to new special location" dialog): * libnautilus-extensions/nautilus-file-operations.c: (handle_transfer_overwrite): Updated message wording as Eli (and Vera) suggest. Other changes: * libnautilus-extensions/nautilus-view-identifier.c: (get_lang_list): Fix comment and a small storage leak in the case where lang_with_locale is non-NULL but empty. * po/POTFILES.ignore: Obsolete file, no longer used. * src/file-manager/fm-desktop-icon-view.c: (update_home_link_and_delete_copies): Update comment to help translators understand better. * libnautilus-extensions/nautilus-directory-async.c: (directory_load_callback): Added a new assertion that could help in future gnome-vfs debugging. * libnautilus/nautilus-view-component.idl: Removed long-ago-fixed FIXME comment. * src/nautilus-window-manage-views.c: Tweak spacing.
Diffstat (limited to 'libnautilus-private/nautilus-merged-directory.c')
-rw-r--r--libnautilus-private/nautilus-merged-directory.c100
1 files changed, 48 insertions, 52 deletions
diff --git a/libnautilus-private/nautilus-merged-directory.c b/libnautilus-private/nautilus-merged-directory.c
index 2bea0815a..4d8bd3448 100644
--- a/libnautilus-private/nautilus-merged-directory.c
+++ b/libnautilus-private/nautilus-merged-directory.c
@@ -139,24 +139,6 @@ merged_callback_equal (gconstpointer merged_callback_as_pointer,
&& merged_callback->callback_data == merged_callback_2->callback_data;
}
-/* Return true if any directory in the list does. */
-static gboolean
-merged_contains_file (NautilusDirectory *directory,
- NautilusFile *file)
-{
- NautilusMergedDirectory *merged;
- GList *p;
-
- merged = NAUTILUS_MERGED_DIRECTORY (directory);
-
- for (p = merged->details->directories; p != NULL; p = p->next) {
- if (nautilus_directory_contains_file (p->data, file)) {
- return TRUE;
- }
- }
- return FALSE;
-}
-
static void
merged_callback_destroy (MergedCallback *merged_callback)
{
@@ -196,8 +178,6 @@ merged_callback_remove_directory (MergedCallback *merged_callback,
merged_callback->non_ready_directories = g_list_remove
(merged_callback->non_ready_directories,
directory);
-
- /* Check if we are ready. */
merged_callback_check_done (merged_callback);
}
@@ -220,18 +200,7 @@ directory_ready_callback (NautilusDirectory *directory,
nautilus_file_list_copy (files));
/* Check if we are ready. */
- merged_callback_remove_directory (merged_callback,
- directory);
-}
-
-static void
-merged_callback_connect_directory (MergedCallback *merged_callback,
- NautilusDirectory *real_merged)
-{
- nautilus_directory_call_when_ready
- (real_merged,
- merged_callback->wait_for_attributes,
- directory_ready_callback, merged_callback);
+ merged_callback_remove_directory (merged_callback, directory);
}
static void
@@ -242,7 +211,7 @@ merged_call_when_ready (NautilusDirectory *directory,
{
NautilusMergedDirectory *merged;
MergedCallback search_key, *merged_callback;
- GList *p;
+ GList *node;
merged = NAUTILUS_MERGED_DIRECTORY (directory);
@@ -260,9 +229,9 @@ merged_call_when_ready (NautilusDirectory *directory,
merged_callback->callback = callback;
merged_callback->callback_data = callback_data;
merged_callback->wait_for_attributes = nautilus_g_str_list_copy (file_attributes);
- for (p = merged->details->directories; p != NULL; p = p->next) {
+ for (node = merged->details->directories; node != NULL; node = node->next) {
merged_callback->non_ready_directories = g_list_prepend
- (merged_callback->non_ready_directories, p->data);
+ (merged_callback->non_ready_directories, node->data);
}
/* Put it in the hash table. */
@@ -275,8 +244,11 @@ merged_call_when_ready (NautilusDirectory *directory,
}
/* Now tell all the directories about it. */
- for (p = merged->details->directories; p != NULL; p = p->next) {
- merged_callback_connect_directory (merged_callback, p->data);
+ for (node = merged->details->directories; node != NULL; node = node->next) {
+ nautilus_directory_call_when_ready
+ (node->data,
+ merged_callback->wait_for_attributes,
+ directory_ready_callback, merged_callback);
}
}
@@ -287,7 +259,7 @@ merged_cancel_callback (NautilusDirectory *directory,
{
NautilusMergedDirectory *merged;
MergedCallback search_key, *merged_callback;
- GList *p;
+ GList *node;
merged = NAUTILUS_MERGED_DIRECTORY (directory);
@@ -303,9 +275,9 @@ merged_cancel_callback (NautilusDirectory *directory,
g_hash_table_remove (merged_callback->merged->details->callbacks, merged_callback);
/* Tell all the directories to cancel the call. */
- for (p = merged_callback->non_ready_directories; p != NULL; p = p->next) {
+ for (node = merged_callback->non_ready_directories; node != NULL; node = node->next) {
nautilus_directory_cancel_callback
- (p->data,
+ (node->data,
directory_ready_callback, merged_callback);
}
merged_callback_destroy (merged_callback);
@@ -322,7 +294,7 @@ merged_file_monitor_add (NautilusDirectory *directory,
{
NautilusMergedDirectory *merged;
MergedMonitor *monitor;
- GList *p;
+ GList *node;
merged = NAUTILUS_MERGED_DIRECTORY (directory);
@@ -345,9 +317,9 @@ merged_file_monitor_add (NautilusDirectory *directory,
monitor->force_reload = force_reload;
/* Call through to the real directory add calls. */
- for (p = merged->details->directories; p != NULL; p = p->next) {
+ for (node = merged->details->directories; node != NULL; node = node->next) {
nautilus_directory_file_monitor_add
- (p->data, monitor,
+ (node->data, monitor,
monitor_hidden_files, monitor_backup_files,
file_attributes, force_reload);
}
@@ -360,7 +332,7 @@ merged_file_monitor_remove (NautilusDirectory *directory,
{
NautilusMergedDirectory *merged;
MergedMonitor *monitor;
- GList *p;
+ GList *node;
merged = NAUTILUS_MERGED_DIRECTORY (directory);
@@ -372,26 +344,44 @@ merged_file_monitor_remove (NautilusDirectory *directory,
g_hash_table_remove (merged->details->monitors, client);
/* Call through to the real directory remove calls. */
- for (p = merged->details->directories; p != NULL; p = p->next) {
+ for (node = merged->details->directories; node != NULL; node = node->next) {
nautilus_directory_file_monitor_remove
- (p->data, monitor);
+ (node->data, monitor);
}
nautilus_g_list_free_deep (monitor->monitor_attributes);
g_free (monitor);
}
+/* Return true if any directory in the list does. */
+static gboolean
+merged_contains_file (NautilusDirectory *directory,
+ NautilusFile *file)
+{
+ NautilusMergedDirectory *merged;
+ GList *node;
+
+ merged = NAUTILUS_MERGED_DIRECTORY (directory);
+
+ for (node = merged->details->directories; node != NULL; node = node->next) {
+ if (nautilus_directory_contains_file (node->data, file)) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
/* Return true only if all directories in the list do. */
static gboolean
merged_are_all_files_seen (NautilusDirectory *directory)
{
NautilusMergedDirectory *merged;
- GList *p;
+ GList *node;
merged = NAUTILUS_MERGED_DIRECTORY (directory);
- for (p = merged->details->directories; p != NULL; p = p->next) {
- if (!nautilus_directory_are_all_files_seen (p->data)) {
+ for (node = merged->details->directories; node != NULL; node = node->next) {
+ if (!nautilus_directory_are_all_files_seen (node->data)) {
return FALSE;
}
}
@@ -403,12 +393,12 @@ static gboolean
merged_is_not_empty (NautilusDirectory *directory)
{
NautilusMergedDirectory *merged;
- GList *p;
+ GList *node;
merged = NAUTILUS_MERGED_DIRECTORY (directory);
- for (p = merged->details->directories; p != NULL; p = p->next) {
- if (nautilus_directory_is_not_empty (p->data)) {
+ for (node = merged->details->directories; node != NULL; node = node->next) {
+ if (nautilus_directory_is_not_empty (node->data)) {
return TRUE;
}
}
@@ -517,6 +507,12 @@ nautilus_merged_directory_add_real_directory (NautilusMergedDirectory *merged,
real_directory);
}
+GList *
+nautilus_merged_directory_get_real_directories (NautilusMergedDirectory *merged)
+{
+ return g_list_copy (merged->details->directories);
+}
+
static void
merged_callback_remove_directory_cover (gpointer key,
gpointer value,