[nautilus] file: repurpose compare_display_name()
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] file: repurpose compare_display_name()
- Date: Mon, 27 Jun 2016 13:46:23 +0000 (UTC)
commit fc25f7ecd682bb65404f1a21259269c0a473c31c
Author: Ernestas Kulik <ernestask src gnome org>
Date: Mon Jun 27 15:55:58 2016 +0300
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
src/nautilus-file.c | 11 +++++------
src/nautilus-file.h | 6 ++++--
2 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index a238d69..e85ffa3 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 1050575..fe226c0 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]