summaryrefslogtreecommitdiff
path: root/libnautilus-extensions/nautilus-directory-async.c
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-10-24 20:24:35 +0000
committerDarin Adler <darin@src.gnome.org>2000-10-24 20:24:35 +0000
commit83cb6f4c4bd388dc4087acfe4ac757dd5a408fe6 (patch)
tree17426e93c486cd4839fe8a5ebd7ab8b0d0b1b8a1 /libnautilus-extensions/nautilus-directory-async.c
parenta86b53488ef8a199047e93f2661587f7a045b558 (diff)
downloadnautilus-83cb6f4c4bd388dc4087acfe4ac757dd5a408fe6.tar.gz
Some work towards reducing load_directory calls.
Also fixed bug 3978 (Many Bonobo warnings/errors on quit). * libnautilus-extensions/nautilus-directory-async.c: (set_up_request_by_file_attributes), (update_file_info_in_list_if_needed), (dequeue_pending_idle_callback), (request_is_satisfied), (get_info_callback), (file_info_start): * libnautilus-extensions/nautilus-directory-private.h: * libnautilus-extensions/nautilus-file-attributes.h: * libnautilus-extensions/nautilus-file-private.h: * libnautilus-extensions/nautilus-file.c: (nautilus_file_new_from_info), (destroy), (nautilus_file_update_info), (nautilus_file_update_name), (nautilus_file_compare_by_type), (nautilus_file_get_string_attribute), (get_description), (update_description_for_link), (nautilus_file_get_type_as_string), (nautilus_file_get_mime_type), (nautilus_file_is_mime_type), (nautilus_file_check_if_ready): * libnautilus-extensions/nautilus-file.h: * libnautilus-extensions/nautilus-mime-actions.c: (nautilus_mime_actions_get_required_file_attributes), (nautilus_mime_get_default_action_type_for_file), (nautilus_mime_get_default_application_for_file_internal), (nautilus_mime_get_default_component_for_file_internal), (nautilus_mime_get_short_list_applications_for_file), (nautilus_mime_get_short_list_components_for_file), (nautilus_mime_get_short_list_methods_for_file), (nautilus_mime_get_all_applications_for_file), (nautilus_mime_get_all_components_for_file), (nautilus_mime_set_short_list_applications_for_file), (nautilus_mime_set_short_list_components_for_file): Get rid of the distinction between slow and default MIME type once again. We (Pavel, Maciej, John, and I) decided it's better not to have multiple opinions on the MIME type, despite our original idea that we needed the slow MIME type for some things, even on remote file systems. * libnautilus-extensions/nautilus-glib-extensions.h: Fixed the formatting in this file. * src/file-manager/fm-directory-view.c: (load_location_callback): Only force a reload if we are reloading the same directory. This is needed to take advantage of the loading already done for us by the framework. (load_directory): Take a NautilusDirectory instead of a URI string. Also take a boolean parameter to control if we force a reload. (finish_loading_uri): Respect the boolean parameter that tells us whether to force a reload. (filtering_changed_callback): Use the new load_directory. * src/nautilus-applicable-views.c: (nautilus_navigation_info_new), (nautilus_navigation_info_cancel), (nautilus_navigation_info_free): Monitor the directory while we are loading the component. We already need to load the directory to get the MIME types, so this does no additional harm, and it prepares us to consolidate the loading done for different reasons. * src/nautilus-main.c: (main): Use nautilus_setenv instead of putenv, since it's more portable. * src/nautilus-window-manage-views.c: Quick simplification pass on state machine. Got rid of the use of varargs and renamed a bunch of things. * src/nautilus-window-manage-views.h: * src/nautilus-window-private.h: Moved external functions from nautilus-window-manage-views.c to all be in nautilus-window-manager-views.h. This is one step in reducing the number of clients that need access to private stuff in NautilusWindow. * src/nautilus-window-service-ui.c: (detach_service_ui), (nautilus_window_install_service_ui): Detach the service UI on "destroy" rather that using set_data_full, because finalize time is too late. * src/nautilus-view-frame.c: (nautilus_view_frame_destroy): Got rid of extra unref that was messing things up here.
Diffstat (limited to 'libnautilus-extensions/nautilus-directory-async.c')
-rw-r--r--libnautilus-extensions/nautilus-directory-async.c59
1 files changed, 6 insertions, 53 deletions
diff --git a/libnautilus-extensions/nautilus-directory-async.c b/libnautilus-extensions/nautilus-directory-async.c
index c7bdf3a40..7238e7521 100644
--- a/libnautilus-extensions/nautilus-directory-async.c
+++ b/libnautilus-extensions/nautilus-directory-async.c
@@ -83,7 +83,6 @@ typedef struct {
gboolean metafile;
gboolean file_list; /* always FALSE if file != NULL */
gboolean file_info;
- gboolean get_slow_mime_type; /* only relevant if file_info is "true" */
gboolean directory_count;
gboolean deep_count;
gboolean mime_list;
@@ -955,18 +954,11 @@ set_up_request_by_file_attributes (Request *request,
NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE,
nautilus_str_compare) != NULL;
if (g_list_find_custom (file_attributes,
- NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE,
- nautilus_str_compare) != NULL) {
- request->file_info |= TRUE;
- request->get_slow_mime_type = TRUE;
- }
- if (g_list_find_custom (file_attributes,
NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI,
nautilus_str_compare) != NULL) {
request->file_info = TRUE;
request->activation_uri = TRUE;
}
-
if (!request->metafile) {
request->metafile = g_list_find_custom
@@ -1082,7 +1074,7 @@ update_file_info_in_list_if_needed (GList *list,
}
/* the file is in the list already update the file info if needed */
- nautilus_file_update_info (NAUTILUS_FILE (list_entry->data), file_info, FALSE);
+ nautilus_file_update_info (NAUTILUS_FILE (list_entry->data), file_info);
return TRUE;
}
@@ -1146,7 +1138,7 @@ dequeue_pending_idle_callback (gpointer callback_data)
if (file != NULL) {
/* file already exists, check if it changed */
set_file_unconfirmed (file, FALSE);
- if (nautilus_file_update_info (file, file_info, FALSE)) {
+ if (nautilus_file_update_info (file, file_info)) {
/* File changed, notify about the change. */
nautilus_file_ref (file);
changed_files = g_list_prepend (changed_files, file);
@@ -1706,28 +1698,12 @@ lacks_info (NautilusFile *file)
}
static gboolean
-lacks_slow_mime_type (NautilusFile *file)
-{
- /* Don't try and get the the slow mime type
- if we couldn't get the file info in the first place */
- return file->details->slow_mime_type == NULL
- && !file->details->is_gone
- && !file->details->get_info_failed;
-}
-
-static gboolean
wants_info (const Request *request)
{
return request->file_info;
}
static gboolean
-wants_slow_mime_type (const Request *request)
-{
- return request->get_slow_mime_type;
-}
-
-static gboolean
lacks_deep_count (NautilusFile *file)
{
return nautilus_file_is_directory (file)
@@ -1812,12 +1788,6 @@ request_is_satisfied (NautilusDirectory *directory,
}
}
- if (request->get_slow_mime_type) {
- if (has_problem (directory, file, lacks_slow_mime_type)) {
- return FALSE;
- }
- }
-
if (request->deep_count) {
if (has_problem (directory, file, lacks_deep_count)) {
return FALSE;
@@ -2680,10 +2650,8 @@ get_info_callback (GnomeVFSAsyncHandle *handle,
NautilusDirectory *directory;
NautilusFile *get_info_file;
GnomeVFSGetFileInfoResult *result;
- gboolean got_slow_mime_type;
directory = NAUTILUS_DIRECTORY (callback_data);
- got_slow_mime_type = directory->details->get_slow_mime_type_for_file;
g_assert (handle == NULL || handle == directory->details->get_info_in_progress);
g_assert (nautilus_g_list_exactly_one_item (results));
get_info_file = directory->details->get_info_file;
@@ -2697,8 +2665,7 @@ get_info_callback (GnomeVFSAsyncHandle *handle,
get_info_file->details->get_info_failed = TRUE;
get_info_file->details->get_info_error = result->result;
} else {
- nautilus_file_update_info (get_info_file, result->file_info,
- got_slow_mime_type);
+ nautilus_file_update_info (get_info_file, result->file_info);
}
nautilus_file_changed (get_info_file);
@@ -2713,7 +2680,6 @@ file_info_start (NautilusDirectory *directory)
char *uri;
GnomeVFSURI *vfs_uri;
GList fake_list;
- gboolean get_slow_mime_type;
/* If there's already a file info fetch in progress, check to
* be sure it's still wanted.
@@ -2734,15 +2700,7 @@ file_info_start (NautilusDirectory *directory)
/* Figure out which file to get file info for. */
do {
- file = select_needy_file (directory, lacks_slow_mime_type, wants_slow_mime_type);
- if (file == NULL) {
- file = select_needy_file (directory, lacks_info, wants_info);
-
- get_slow_mime_type = FALSE;
- }
- else {
- get_slow_mime_type = TRUE;
- }
+ file = select_needy_file (directory, lacks_info, wants_info);
if (file == NULL) {
return;
}
@@ -2763,19 +2721,14 @@ file_info_start (NautilusDirectory *directory)
return;
}
directory->details->get_info_file = file;
- directory->details->get_slow_mime_type_for_file = get_slow_mime_type;
fake_list.data = vfs_uri;
fake_list.prev = NULL;
fake_list.next = NULL;
gnome_vfs_async_get_file_info
(&directory->details->get_info_in_progress,
&fake_list,
- get_slow_mime_type
- ? (GNOME_VFS_FILE_INFO_GET_MIME_TYPE
- | GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE
- | GNOME_VFS_FILE_INFO_FOLLOW_LINKS)
- : (GNOME_VFS_FILE_INFO_GET_MIME_TYPE
- | GNOME_VFS_FILE_INFO_FOLLOW_LINKS),
+ GNOME_VFS_FILE_INFO_GET_MIME_TYPE
+ | GNOME_VFS_FILE_INFO_FOLLOW_LINKS,
get_info_callback,
directory);
gnome_vfs_uri_unref (vfs_uri);