summaryrefslogtreecommitdiff
path: root/libnautilus-extensions/nautilus-file.c
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-12-12 21:23:48 +0000
committerDarin Adler <darin@src.gnome.org>2000-12-12 21:23:48 +0000
commit47462dc1c2e5a8ca545b00a7eaf334c062557f76 (patch)
tree7e152a8de5931dbb1df40ba59a276323769b784d /libnautilus-extensions/nautilus-file.c
parent718bc535a341ea4a67e6da8fac049debbd648e0e (diff)
downloadnautilus-47462dc1c2e5a8ca545b00a7eaf334c062557f76.tar.gz
reviewed by: Pavel Cisler <pavel@eazel.com>
Fixed bug 650 (moving a large number of files is extremely slow) by using a hash table to find metafile nodes given a file name. Fixed bug 3410 (sorting not locale-sensitive) by making nautilus_strcoll suitable for wider use and using it a lot more. * libnautilus-extensions/nautilus-directory-private.h: Add a new hash table for locating metafile nodes by file name. * libnautilus-extensions/nautilus-directory-metafile.h: Add nautilus_directory_set_metafile_contents call so the metafile code will have a crack at the metafile contents right when they are first read in. * libnautilus-extensions/nautilus-directory-metafile.c: (get_file_node): Locate the file node using the hash table, and create a hash table entry when making a new file node. (destroy_xml_string_key), (nautilus_directory_metafile_destroy): Destroy the hash table when the directory is destroyed. (nautilus_directory_rename_file_metadata): Remove the old hash table entry and make a new one when the node's name is changed. (nautilus_directory_set_metafile_contents): Create the hash table and populate it when the metafile is read in. * libnautilus-extensions/nautilus-string.h: * libnautilus-extensions/nautilus-string.c: (nautilus_strcoll): Treat a locale that can't be fetched by setlocale the same as locale "C" and "POSIX", fall back on strcmp if strcoll says two strings are equal, so that only identical strings get a 0. (nautilus_strcmp_compare_func): New name for nautilus_str_compare. (nautilus_strcoll_compare_func): New function. (nautilus_strcasecmp_compare_func): New name for nautilus_istr_compare. * libnautilus-extensions/nautilus-glib-extensions.h: * libnautilus-extensions/nautilus-glib-extensions.c: (nautilus_g_str_list_copy): Removed an unnecessary check for NULL. (nautilus_g_str_list_alphabetize): Replaced the old sort calls with this single call. It sorts in a locale-sensitive way, using nautilus_strcoll. * libnautilus-extensions/nautilus-file.c: (compare_by_name), (compare_by_directory_name), (compare_by_emblems), (compare_by_type), (nautilus_file_compare_name): Use nautilus_strcoll instead of nautilus_strcmp_case_breaks_ties so we use local sorting conventions in locales other than "C" and "POSIX". (nautilus_get_user_names), (nautilus_get_group_names_including): (sort_keyword_list_and_remove_duplicates): Use the new nautilus_g_str_list_alphabetize to sort by locale-specific conventions. * libnautilus-extensions/nautilus-icon-container.c: (compare_icons_by_name): Use nautilus_strcoll instead of nautilus_strcmp_case_breaks_ties so we use local sorting conventions in locales other than "C" and "POSIX". * src/file-manager/fm-properties-window.c: (get_property_names): Use the new nautilus_g_str_list_alphabetize * src/nautilus-window-manage-views.c: (change_selection): Use the new nautilus_g_str_list_alphabetize * src/nautilus-window.c: (load_view_as_menu_callback): Use the new nautilus_g_str_list_alphabetize * libnautilus-extensions/nautilus-directory-async.c: (metafile_read_done_callback), (nautilus_directory_set_up_request): Use nautilus_str_compare under its new name, nautilus_strcmp_compare_func. * components/services/install/command-line/.cvsignore: Added eazel-test-types, a new generated file. * libnautilus-extensions/nautilus-string-list.c: (nautilus_string_list_new): Use nautilus_str_compare and nautilus_istr_compare under their new names, nautilus_strcmp_compare_func and nautilus_strcasecmp_compare_func. * libnautilus-extensions/nautilus-xml-extensions.c: (nautilus_xml_get_child_by_name): Fixed indenting.
Diffstat (limited to 'libnautilus-extensions/nautilus-file.c')
-rw-r--r--libnautilus-extensions/nautilus-file.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libnautilus-extensions/nautilus-file.c b/libnautilus-extensions/nautilus-file.c
index b515ff7e4..375e2928f 100644
--- a/libnautilus-extensions/nautilus-file.c
+++ b/libnautilus-extensions/nautilus-file.c
@@ -1414,7 +1414,7 @@ compare_by_name (NautilusFile *file_1, NautilusFile *file_2)
} else if (!sort_last_1 && sort_last_2) {
compare = -1;
} else {
- compare = nautilus_strcmp_case_breaks_ties (name_1, name_2);
+ compare = nautilus_strcoll (name_1, name_2);
}
g_free (name_1);
@@ -1436,7 +1436,7 @@ compare_by_directory_name (NautilusFile *file_1, NautilusFile *file_2)
directory_1 = nautilus_file_get_parent_uri_for_display (file_1);
directory_2 = nautilus_file_get_parent_uri_for_display (file_2);
- compare = nautilus_strcmp_case_breaks_ties (directory_1, directory_2);
+ compare = nautilus_strcoll (directory_1, directory_2);
g_free (directory_1);
g_free (directory_2);
@@ -1513,7 +1513,7 @@ compare_by_emblems (NautilusFile *file_1, NautilusFile *file_2)
node_1 != NULL && node_2 != NULL;
node_1 = node_1->next, node_2 = node_2->next) {
- compare_result = nautilus_strcmp_case_breaks_ties (node_1->data, node_2->data);
+ compare_result = nautilus_strcoll (node_1->data, node_2->data);
if (compare_result != 0) {
break;
}
@@ -1573,7 +1573,7 @@ compare_by_type (NautilusFile *file_1, NautilusFile *file_2)
type_string_1 = nautilus_file_get_type_as_string (file_1);
type_string_2 = nautilus_file_get_type_as_string (file_2);
- result = nautilus_strcmp_case_breaks_ties (type_string_1, type_string_2);
+ result = nautilus_strcoll (type_string_1, type_string_2);
g_free (type_string_1);
g_free (type_string_2);
@@ -1740,7 +1740,7 @@ nautilus_file_compare_name (NautilusFile *file,
g_return_val_if_fail (pattern != NULL, -1);
name = nautilus_file_get_name (file);
- result = nautilus_strcmp_case_breaks_ties (name, pattern);
+ result = nautilus_strcoll (name, pattern);
g_free (name);
return result;
}
@@ -2868,7 +2868,7 @@ nautilus_get_user_names (void)
endpwent ();
- return nautilus_g_str_list_sort (list);
+ return nautilus_g_str_list_alphabetize (list);
}
/**
@@ -3023,7 +3023,7 @@ nautilus_get_group_names_including (const char *username)
endgrent ();
- return nautilus_g_str_list_sort (list);
+ return nautilus_g_str_list_alphabetize (list);
}
/**
@@ -3783,9 +3783,9 @@ sort_keyword_list_and_remove_duplicates (GList *keywords)
GList *p;
GList *duplicate_link;
- keywords = g_list_sort (keywords, (GCompareFunc) nautilus_strcmp_case_breaks_ties);
-
if (keywords != NULL) {
+ keywords = nautilus_g_str_list_alphabetize (keywords);
+
p = keywords;
while (p->next != NULL) {
if (strcmp (p->data, p->next->data) == 0) {