summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErnestas Kulik <ernestask@src.gnome.org>2016-06-27 15:55:58 +0300
committerErnestas Kulik <ernestask@src.gnome.org>2016-06-27 16:46:04 +0300
commitfc25f7ecd682bb65404f1a21259269c0a473c31c (patch)
tree0271334cf4a568e693f3f9fbb7ce62d82fe4edad
parenta59000e106ae35110393e1e342ec2e0f26808ee8 (diff)
downloadnautilus-fc25f7ecd682bb65404f1a21259269c0a473c31c.tar.gz
file: repurpose compare_display_name()
nautilus_file_compare_display_name() is only used by nautilus_directory_get_file_by_name() nowadays and it was written with sorting in mind. As g_utf8_collate() and its locale dependence does not work well with finding matching files by name, it makes sense to replace the call to g_strcmp0(). That, however, makes the function less suitable for sorting. This commit changes its purpose as described. https://bugzilla.gnome.org/show_bug.cgi?id=768074
-rw-r--r--src/nautilus-file.c11
-rw-r--r--src/nautilus-file.h6
2 files changed, 9 insertions, 8 deletions
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index a238d6998..e85ffa355 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -3297,22 +3297,21 @@ nautilus_file_compare_for_sort_by_attribute (NautilusFile
/**
* nautilus_file_compare_name:
* @file: A file object
- * @pattern: A string we are comparing it with
+ * @string: A string we are comparing it with
*
- * Return value: result of a comparison of the file name and the given pattern,
- * using the same sorting order as sort by name.
+ * Return value: result of a comparison of the file name and the given string.
**/
int
nautilus_file_compare_display_name (NautilusFile *file,
- const char *pattern)
+ const char *string)
{
const char *name;
int result;
- g_return_val_if_fail (pattern != NULL, -1);
+ g_return_val_if_fail (string != NULL, -1);
name = nautilus_file_peek_display_name (file);
- result = g_utf8_collate (name, pattern);
+ result = g_strcmp0 (name, string);
return result;
}
diff --git a/src/nautilus-file.h b/src/nautilus-file.h
index 10505753f..fe226c072 100644
--- a/src/nautilus-file.h
+++ b/src/nautilus-file.h
@@ -427,11 +427,13 @@ int nautilus_file_compare_for_sort_by_attribute_q (Nautilu
gboolean reversed);
gboolean nautilus_file_is_date_sort_attribute_q (GQuark attribute);
-int nautilus_file_compare_display_name (NautilusFile *file_1,
- const char *pattern);
int nautilus_file_compare_location (NautilusFile *file_1,
NautilusFile *file_2);
+/* Compare display name of file with string for equality */
+int nautilus_file_compare_display_name (NautilusFile *file,
+ const char *string);
+
/* filtering functions for use by various directory views */
gboolean nautilus_file_is_hidden_file (NautilusFile *file);
gboolean nautilus_file_should_show (NautilusFile *file,