[nautilus/gnome-3-20] file: repurpose compare_display_name()



commit 38cec1bd4d8799bed0d7c5dcad95fd6243a82fc6
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

 libnautilus-private/nautilus-file.c |   11 +++++------
 libnautilus-private/nautilus-file.h |    6 ++++--
 2 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 7e8d8c5..a65c065 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -3317,22 +3317,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/libnautilus-private/nautilus-file.h b/libnautilus-private/nautilus-file.h
index 0ce3dab..f696864 100644
--- a/libnautilus-private/nautilus-file.h
+++ b/libnautilus-private/nautilus-file.h
@@ -400,11 +400,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]