[nautilus/gnome-2-32: 102/283] Add an utility function to compare file locations.



commit 6a4919638a1e70b5c6fcaadf37b49f8c684a3df1
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu May 20 11:31:04 2010 +0200

    Add an utility function to compare file locations.

 libnautilus-private/nautilus-file.c |   18 ++++++++++++++++++
 libnautilus-private/nautilus-file.h |    2 ++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index d3f5fe9..ff986df 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -1987,6 +1987,24 @@ nautilus_file_matches_uri (NautilusFile *file, const char *match_uri)
 	return result;
 }
 
+int
+nautilus_file_compare_location (NautilusFile *file_1,
+                                NautilusFile *file_2)
+{
+	GFile *loc_a, *loc_b;
+	gboolean res;
+
+	loc_a = nautilus_file_get_location (file_1);
+	loc_b = nautilus_file_get_location (file_2);
+
+	res = !g_file_equal (loc_a, loc_b);
+
+	g_object_unref (loc_a);
+	g_object_unref (loc_b);
+
+	return (gint) res;
+}
+
 gboolean
 nautilus_file_is_local (NautilusFile *file)
 {
diff --git a/libnautilus-private/nautilus-file.h b/libnautilus-private/nautilus-file.h
index 8c86ae2..82865c4 100644
--- a/libnautilus-private/nautilus-file.h
+++ b/libnautilus-private/nautilus-file.h
@@ -409,6 +409,8 @@ gboolean                nautilus_file_is_date_sort_attribute_q          (GQuark
 
 int                     nautilus_file_compare_display_name              (NautilusFile                   *file_1,
 									 const char                     *pattern);
+int                     nautilus_file_compare_location                  (NautilusFile                    *file_1,
+                                                                         NautilusFile                    *file_2);
 
 /* filtering functions for use by various directory views */
 gboolean                nautilus_file_is_hidden_file                    (NautilusFile                   *file);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]