diff options
author | Darin Adler <darin@src.gnome.org> | 2000-12-07 01:55:39 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2000-12-07 01:55:39 +0000 |
commit | 8c198fce0a31fd7f0653c1d80d04342953b7944b (patch) | |
tree | 05f0b821af3be4694f1ff6c73b07783085a5b612 /libnautilus-extensions/nautilus-directory-async.c | |
parent | 9643a99a47fc3b597b44528bb09e2152a6d2fb96 (diff) | |
download | nautilus-8c198fce0a31fd7f0653c1d80d04342953b7944b.tar.gz |
reviewed by: John Sullivan <sullivan@eazel.com>
Fixed bug 4992 ("New folder" menu item enable state doesn't follow
permissions), bug 4965 (Dragging multiple items to location bar
crashes Nautilus), and bug 4995 (Rename a file to bad name ->
error cites wrong filename).
Fixed a bug jsh spotted where we were doing the mod. time checks
wrong in the icon factory for thumbnails.
Did some wording fixes after menthos pointed out some problems.
* libnautilus-extensions/nautilus-icon-factory.c:
(get_cache_time): Split out this function to get the mtime of a
file so we can check when it changed.
(load_specific_icon): Get the time when loading an icon.
(scale_icon): Copy the time when making a scaled icon from an
existing icon.
(remove_icons_if_file_changed): New renamed function uses
get_cache_time to check if the icon needs recomputing because of a
change in the underlying file.
(get_icon_from_cache): Call the new remove_icons_if_file_changed.
(load_icon_with_embedded_text): Copy the time when making an icon
with text from an existing icon.
* libnautilus-extensions/nautilus-file-attributes.h: Added
ATTRIBUTE_CAPABILITIES (and sorted in alphabetical order).
* libnautilus-extensions/nautilus-directory-async.c:
(nautilus_directory_set_up_request): Changed the name of this,
made it public, and added ATTRIBUTE_CAPABILITIES as another
way to ask for the file info.
(cancel_loading_attributes),
(nautilus_directory_cancel_loading_file_attributes): Set up a
request and use it to decide what to cancel.
* libnautilus-extensions/nautilus-directory-private.h: Moved the
request structure and call into here so it can be used by
NautilusFile and NautilusDirectory both.
* libnautilus-extensions/nautilus-file.c:
(nautilus_file_forget_attributes_internal): Set up a request and
use it to decide what to forget.
(nautilus_file_forget_all_attributes): Add ATTRIBUTE_CAPABILITIES
to the set of things in "all".
* src/file-manager/fm-directory-view.c:
(check_for_directory_hard_limit): Added a FIXME and made some
minor wording improvements.
(file_changed_callback): Helper to schedule a menu update when
the directory's NautilusFile reports a change.
(load_directory): Add monitoring of the directory's "capabilities"
since they affect whether "New Folder" is allowed. Fixes 4992.
(disconnect_handler): Helper for the two functions below.
(disconnect_directory_handler): Disconnect a NautilusDirectory
handler.
(disconnect_directory_as_file_handler): Disconnect a NautilusFile
handler.
(disconnect_model_handlers): Add code to stop monitoring the
directory's "capabilities".
* src/file-manager/fm-error-reporting.c:
(fm_report_error_renaming_file): Got rid of some unneeded "\n"
characters. Improved the error message in the "/"-forbidden case
with a specific special case message and the proper file name (was
using the old file name, not the new one). Fixes 4995.
(fm_rename_file): Added quotes to message.
* src/nautilus-location-bar.h: Removed unused fields.
* src/nautilus-location-bar.c: (nautilus_location_bar_get_window):
Find the window by looking for an ancestor instead of trying to
use gtk_object_get_data (on data no one was setting any
more!). Fixes 4965.
(nautilus_location_bar_initialize): Got rid of redundant
initialization to NULL.
(nautilus_location_bar_set_location): Got rid of gratuitous check
before calling g_free.
(nautilus_location_bar_update_label): Added a localization-related
FIXME here.
* libnautilus-extensions/nautilus-file-operations.c:
(handle_xfer_vfs_error): Corrected the "it's" to "its" even though
I know that John and Pavel were writing an improved version of the
entire message.
* libnautilus-extensions/nautilus-search-uri.c:
(get_translated_criterion), (nautilus_self_check_search_uri): Say
"folder" instead of "directory".
* src/nautilus-search-bar-criterion.c: Say "folder" instead of
"directory".
* src/nautilus-theme-selector.c: (add_theme_to_icons): Say
"folder" instead of "directory". Other minor wording improvements.
(make_theme_description): Minor wording improvement.
* src/nautilus-window-manage-views.c:
(window_set_title_with_timestamp): Added a FIXME.
Diffstat (limited to 'libnautilus-extensions/nautilus-directory-async.c')
-rw-r--r-- | libnautilus-extensions/nautilus-directory-async.c | 198 |
1 files changed, 47 insertions, 151 deletions
diff --git a/libnautilus-extensions/nautilus-directory-async.c b/libnautilus-extensions/nautilus-directory-async.c index c5cd5aa1f..7ee6a7de5 100644 --- a/libnautilus-extensions/nautilus-directory-async.c +++ b/libnautilus-extensions/nautilus-directory-async.c @@ -79,18 +79,6 @@ struct ActivationURIReadState { NautilusReadFileHandle *handle; }; -/* A request for information about one or more files. */ -typedef struct { - gboolean metafile; - gboolean file_list; /* always FALSE if file != NULL */ - gboolean file_info; - gboolean directory_count; - gboolean deep_count; - gboolean mime_list; - gboolean top_left_text; - gboolean activation_uri; -} Request; - typedef struct { NautilusFile *file; /* Which file, NULL means all. */ union { @@ -993,8 +981,8 @@ remove_monitor (NautilusDirectory *directory, remove_monitor_link (directory, find_monitor (directory, file, client)); } -static void -set_up_request_by_file_attributes (Request *request, +void +nautilus_directory_set_up_request (Request *request, GList *file_attributes) { memset (request, 0, sizeof (*request)); @@ -1021,16 +1009,20 @@ set_up_request_by_file_attributes (Request *request, nautilus_str_compare) != NULL; request->file_info |= g_list_find_custom (file_attributes, + NAUTILUS_FILE_ATTRIBUTE_CAPABILITIES, + nautilus_str_compare) != NULL; + request->file_info |= g_list_find_custom + (file_attributes, NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE, nautilus_str_compare) != NULL; - + if (g_list_find_custom (file_attributes, NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT, nautilus_str_compare) != NULL) { request->top_left_text = TRUE; request->file_info = TRUE; } - + if (g_list_find_custom (file_attributes, NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI, nautilus_str_compare) != NULL) { @@ -1038,12 +1030,10 @@ set_up_request_by_file_attributes (Request *request, request->activation_uri = TRUE; } - if (!request->metafile) { - request->metafile = g_list_find_custom - (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_METADATA, - nautilus_str_compare) != NULL; - } + request->metafile |= g_list_find_custom + (file_attributes, + NAUTILUS_FILE_ATTRIBUTE_METADATA, + nautilus_str_compare) != NULL; /* FIXME bugzilla.eazel.com 2435: * Some file attributes are really pieces of metadata. @@ -1056,12 +1046,10 @@ set_up_request_by_file_attributes (Request *request, * directly (would need some funky char trick to prevent * namespace collisions). */ - if (!request->metafile) { - request->metafile = g_list_find_custom - (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON, - nautilus_str_compare) != NULL; - } + request->metafile |= g_list_find_custom + (file_attributes, + NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON, + nautilus_str_compare) != NULL; } static gboolean @@ -1107,7 +1095,7 @@ nautilus_directory_monitor_add_internal (NautilusDirectory *directory, monitor = g_new (Monitor, 1); monitor->file = file; monitor->client = client; - set_up_request_by_file_attributes (&monitor->request, file_attributes); + nautilus_directory_set_up_request (&monitor->request, file_attributes); monitor->request.file_list = file == NULL; directory->details->monitor_list = @@ -1536,7 +1524,7 @@ nautilus_directory_call_when_ready_internal (NautilusDirectory *directory, callback.callback.file = file_callback; } callback.callback_data = callback_data; - set_up_request_by_file_attributes (&callback.request, file_attributes); + nautilus_directory_set_up_request (&callback.request, file_attributes); callback.request.file_list = file == NULL && file_attributes != NULL; /* Handle the NULL case. */ @@ -1570,7 +1558,7 @@ nautilus_directory_check_if_ready_internal (NautilusDirectory *directory, g_assert (NAUTILUS_IS_DIRECTORY (directory)); - set_up_request_by_file_attributes (&request, file_attributes); + nautilus_directory_set_up_request (&request, file_attributes); return request_is_satisfied (directory, file, &request); } @@ -3200,78 +3188,34 @@ cancel_activation_uri_for_file (NautilusDirectory *directory, static void cancel_loading_attributes (NautilusDirectory *directory, - GList *file_attributes) + GList *file_attributes) { - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT, - nautilus_str_compare) != NULL) { + Request request; + + nautilus_directory_set_up_request (&request, + file_attributes); + + if (request.directory_count) { directory_count_cancel (directory); } - - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS, - nautilus_str_compare) != NULL) { + if (request.deep_count) { deep_count_cancel (directory); } - - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES, - nautilus_str_compare) != NULL) { + if (request.mime_list) { mime_list_cancel (directory); } - - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT, - nautilus_str_compare) != NULL) { - /* clear file info, since applicability of top left - * text depends on it. - */ - file_info_cancel (directory); - - /* cancel top left text */ + if (request.top_left_text) { top_left_cancel (directory); } - - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE, - nautilus_str_compare) != NULL || - g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE, - nautilus_str_compare) != NULL || - g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_IS_DIRECTORY, - nautilus_str_compare) != NULL) { + if (request.file_info) { file_info_cancel (directory); } - - - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI, - nautilus_str_compare) != NULL) { - - /* clear file info, since applicability of activation - * URI depends on it - */ - file_info_cancel (directory); - - /* cancel activation URI */ + if (request.activation_uri) { file_info_cancel (directory); } - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_METADATA, - nautilus_str_compare) != NULL || - /* FIXME bugzilla.eazel.com 2435: - * Some file attributes are really pieces of metadata. - * This is a confusing/broken design, since other metadata - * pieces are handled separately from file attributes... - */ - g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON, - nautilus_str_compare) != NULL) { - /* FIXME: implement cancelling metadata when we - implement forgetting metadata */ - } + /* FIXME: implement cancelling metadata when we + implement forgetting metadata */ } void @@ -3279,78 +3223,30 @@ nautilus_directory_cancel_loading_file_attributes (NautilusDirectory *directory, NautilusFile *file, GList *file_attributes) { - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT, - nautilus_str_compare) != NULL) { + Request request; + + nautilus_directory_set_up_request (&request, + file_attributes); + + if (request.directory_count) { cancel_directory_count_for_file (directory, file); } - - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS, - nautilus_str_compare) != NULL) { + if (request.deep_count) { cancel_deep_counts_for_file (directory, file); } - - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES, - nautilus_str_compare) != NULL) { + if (request.mime_list) { cancel_mime_list_for_file (directory, file); } - - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT, - nautilus_str_compare) != NULL) { - /* clear file info, since applicability of top left - * text depends on it. - */ - cancel_file_info_for_file (directory, file); - - /* cancel top left text */ + if (request.top_left_text) { cancel_top_left_text_for_file (directory, file); } - - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE, - nautilus_str_compare) != NULL || - g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE, - nautilus_str_compare) != NULL || - g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_IS_DIRECTORY, - nautilus_str_compare) != NULL) { + if (request.file_info) { cancel_file_info_for_file (directory, file); } - - - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI, - nautilus_str_compare) != NULL) { - - /* clear file info, since applicability of activation - * URI depends on it - */ - cancel_file_info_for_file (directory, file); - - /* cancel activation URI */ + if (request.activation_uri) { cancel_activation_uri_for_file (directory, file); } - - if (g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_METADATA, - nautilus_str_compare) != NULL || - /* FIXME bugzilla.eazel.com 2435: - * Some file attributes are really pieces of metadata. - * This is a confusing/broken design, since other metadata - * pieces are handled separately from file attributes... - */ - g_list_find_custom (file_attributes, - NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON, - nautilus_str_compare) != NULL) { - /* FIXME: implement cancelling metadata when we - implement forgetting metadata */ - } -} - - - + /* FIXME: implement cancelling metadata when we + implement forgetting metadata */ +} |