summaryrefslogtreecommitdiff
path: root/libnautilus-extensions/nautilus-directory.c
diff options
context:
space:
mode:
authorMaciej Stachowiak <mstachow@src.gnome.org>2000-10-12 06:44:26 +0000
committerMaciej Stachowiak <mstachow@src.gnome.org>2000-10-12 06:44:26 +0000
commit9874534dcf9b15bb6da3297c740d556d9a4dadda (patch)
treec62fe37a4afc3c0919f7179515da0d223c556d33 /libnautilus-extensions/nautilus-directory.c
parentd3291cbec90ab9dbbb5b100b37d0360286b0c939 (diff)
downloadnautilus-9874534dcf9b15bb6da3297c740d556d9a4dadda.tar.gz
Use `nautilus_file_get_existing', not `nautilus_file_get', to check if a
* libnautilus-extensions/nautilus-directory.c: (nautilus_directory_notify_files_removed, nautilus_directory_notify_files_moved): Use `nautilus_file_get_existing', not `nautilus_file_get', to check if a file is already known. `nautilus_file_get' would have created new NautilusFiles and NautilusDirectories only to do redundant notification later in the function. Also, the old code was a bit silly because `nautilus_file_get' only returns NULL for a NULL URI. Work towards bug 3362, eliminate directory metadata. * libnautilus-extensions/nautilus-file-attributes.h: Added NAUTILUS_FILE_ATTRIBUTE_METADATA attribute. * libnautilus-extensions/nautilus-directory-async.c (set_up_request_by_file_attributes): * libnautilus-extensions/nautilus-wait-until-ready.h, libnautilus-extensions/nautilus-file.h, libnautilus-extensions/nautilus-directory.h, libnautilus-extensions/nautilus-directory.c, libnautilus-extensions/nautilus-file.c (nautilus_directory_call_when_ready, nautilus_directory_wait_until_ready, nautilus_directory_file_monitor_add, nautilus_self_check_directory, nautilus_file_monitor_add, nautilus_file_call_when_ready, nautilus_file_wait_until_ready): Remove monitor_metadata or wait_for_metadata attribtues from these calls; the new way to do it is to monitor or wait for the METADATA file attribute. * libnautilus-extensions/nautilus-directory-private.h libnautilus-extensions/nautilus-directory-async.c: (nautilus_directory_monitor_add_internal, nautilus_directory_call_when_ready_internal, nautilus_directory_check_if_ready_internal): Eliminate monitor_metadata, wait_for_metadata, etc arguments. * libnautilus-extensions/nautilus-merged-directory.c: (merged_callback_connect_directory), (merged_call_when_ready), (merged_file_monitor_add), (monitor_add_directory): * libnautilus-extensions/nautilus-vfs-directory.c: (vfs_call_when_ready), (vfs_file_monitor_add): * libnautilus-extensions/nautilus-directory-background.c (nautilus_connect_background_to_directory_metadata): Monitor metadata the new approved way. * libnautilus-extensions/nautilus-mime-actions.c (nautilus_directory_wait_for_metadata, nautilus_mime_get_default_component_for_uri_internal, nautilus_mime_get_short_list_components_for_uri, nautilus_mime_get_all_components_for_uri, get_mime_type_from_file): Wait for metadata the new approved way. * src/file-manager/fm-directory-view.c (fm_directory_view_activate_file, fm_directory_view_load_uri, finish_loading_uri, metadata_ready_callback): Monitor/call_when_ready using the new API. * src/file-manager/fm-properties-window.c: (create_properties_window, fm_properties_window_present): Monitor/call_when_ready using the new API. * src/file-manager/fm-search-list-view.c (real_adding_file): Monitor/call_when_ready using the new API. * src/file-manager/nautilus-trash-monitor.c (nautilus_trash_monitor_initialize): Monitor/call_when_ready using the new API. * src/nautilus-applicable-views.c (nautilus_navigation_info_new): Monitor/call_when_ready using the new API. * components/notes/nautilus-notes.c (notes_load_metainfo): Monitor/call_when_ready using the new API. * components/tree/nautilus-tree-model.c: (nautilus_tree_model_monitor_add, nautilus_tree_model_monitor_node): Monitor/call_when_ready using the new API. * src/nautilus-sidebar-title.c, src/nautilus-sidebar-title.h (nautilus_sidebar_title_set_uri): Monitor/call_when_ready using the new API, and use file metadata instead of directory metadata. * src/nautilus-sidebar.c (nautilus_sidebar_destroy, nautilus_sidebar_add_panel_items, nautilus_sidebar_background_is_default, receive_dropped_uri_list, receive_dropped_color, receive_dropped_keyword, (background_settings_changed_callback, background_appearance_changed_callback, background_reset_callback, open_with_callback, nautilus_sidebar_update_buttons, nautilus_sidebar_update_appearance, nautilus_sidebar_set_uri): Monitor/call_when_ready using the new API, and use file metadata instead of directory metadata. Keep around a NautilusFile representing the current sidebar location, simplifying bunches of code and hopefully eliminating potential redundant I/O. * src/nautilus-window-manage-views.c (viewed_file_changed_callback, position_and_show_window_callback, nautilus_window_end_location_change_callback): Monitor/call_when_ready using the new API, and use file metadata instead of directory metadata. Keep around a NautilusFile representing the current sidebar location, simplifying bunches of code and hopefully eliminating potential redundant I/O. * src/nautilus-window.c (nautilus_window_save_geometry): Use file metadata instead of directory metadata.
Diffstat (limited to 'libnautilus-extensions/nautilus-directory.c')
-rw-r--r--libnautilus-extensions/nautilus-directory.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/libnautilus-extensions/nautilus-directory.c b/libnautilus-extensions/nautilus-directory.c
index dc8463688..7ecbcf8af 100644
--- a/libnautilus-extensions/nautilus-directory.c
+++ b/libnautilus-extensions/nautilus-directory.c
@@ -915,7 +915,7 @@ nautilus_directory_notify_files_removed (GList *uris)
uri = (const char *) p->data;
/* Find the file. */
- file = nautilus_file_get (uri);
+ file = nautilus_file_get_existing (uri);
if (file == NULL) {
continue;
}
@@ -968,7 +968,7 @@ nautilus_directory_notify_files_moved (GList *uri_pairs)
pair = p->data;
/* Move an existing file. */
- file = nautilus_file_get (pair->from_uri);
+ file = nautilus_file_get_existing (pair->from_uri);
if (file == NULL) {
/* Handle this as if it was a new file. */
new_files_list = g_list_prepend (new_files_list,
@@ -1172,17 +1172,15 @@ nautilus_directory_contains_file (NautilusDirectory *directory,
void
nautilus_directory_call_when_ready (NautilusDirectory *directory,
GList *file_attributes,
- gboolean wait_for_metadata,
NautilusDirectoryCallback callback,
gpointer callback_data)
{
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
- g_return_if_fail (wait_for_metadata == FALSE || wait_for_metadata == TRUE);
g_return_if_fail (callback != NULL);
NAUTILUS_CALL_VIRTUAL
(NAUTILUS_DIRECTORY_CLASS, directory,
- call_when_ready, (directory, file_attributes, wait_for_metadata,
+ call_when_ready, (directory, file_attributes,
callback, callback_data));
}
@@ -1205,8 +1203,7 @@ wait_until_ready_callback (NautilusDirectory *directory,
GList *
nautilus_directory_wait_until_ready (NautilusDirectory *directory,
- GList *file_attributes,
- gboolean wait_for_metadata)
+ GList *file_attributes)
{
WaitUntilReadyCallbackData data;
@@ -1214,7 +1211,7 @@ nautilus_directory_wait_until_ready (NautilusDirectory *directory,
data.files_return = NULL;
nautilus_directory_call_when_ready
- (directory, file_attributes, wait_for_metadata,
+ (directory, file_attributes,
wait_until_ready_callback, &data);
while (!data.done) {
gtk_main_iteration ();
@@ -1240,7 +1237,6 @@ void
nautilus_directory_file_monitor_add (NautilusDirectory *directory,
gconstpointer client,
GList *file_attributes,
- gboolean monitor_metadata,
gboolean force_reload)
{
g_return_if_fail (NAUTILUS_IS_DIRECTORY (directory));
@@ -1249,7 +1245,7 @@ nautilus_directory_file_monitor_add (NautilusDirectory *directory,
NAUTILUS_CALL_VIRTUAL
(NAUTILUS_DIRECTORY_CLASS, directory,
file_monitor_add, (directory, client,
- file_attributes, monitor_metadata,
+ file_attributes,
force_reload));
}
@@ -1323,11 +1319,14 @@ nautilus_self_check_directory (void)
nautilus_directory_file_monitor_add
(directory, &data_dummy,
- NULL, FALSE, FALSE);
+ NULL, FALSE);
got_metadata_flag = FALSE;
- nautilus_directory_call_when_ready (directory, NULL, TRUE,
+
+ attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA);
+ nautilus_directory_call_when_ready (directory, attributes,
got_metadata_callback, &data_dummy);
+ g_list_free (attributes);
while (!got_metadata_flag) {
gtk_main_iteration ();
@@ -1373,8 +1372,10 @@ nautilus_self_check_directory (void)
directory = nautilus_directory_get ("file:///etc");
got_metadata_flag = FALSE;
- nautilus_directory_call_when_ready (directory, NULL, TRUE,
+ attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA);
+ nautilus_directory_call_when_ready (directory, attributes,
got_metadata_callback, &data_dummy);
+ g_list_free (attributes);
while (!got_metadata_flag) {
gtk_main_iteration ();
@@ -1386,7 +1387,7 @@ nautilus_self_check_directory (void)
attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS);
- nautilus_directory_call_when_ready (directory, attributes, FALSE,
+ nautilus_directory_call_when_ready (directory, attributes,
got_files_callback, &data_dummy);
g_list_free (attributes);