[tracker] libtracker-common: New tracker_file_cmp() which returns 0 if files are equal



commit d6c6257bc89713a1cd90cdc47d88beea65b2bcec
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Mon Dec 13 18:48:23 2010 +0100

    libtracker-common: New tracker_file_cmp() which returns 0 if files are equal

 src/libtracker-common/tracker-file-utils.c |    9 +++++++++
 src/libtracker-common/tracker-file-utils.h |    2 ++
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-common/tracker-file-utils.c b/src/libtracker-common/tracker-file-utils.c
index f29279a..2ee5355 100644
--- a/src/libtracker-common/tracker-file-utils.c
+++ b/src/libtracker-common/tracker-file-utils.c
@@ -802,3 +802,12 @@ tracker_file_is_hidden (GFile *file)
 
 	return is_hidden;
 }
+
+gint
+tracker_file_cmp (GFile *file_a,
+                  GFile *file_b)
+{
+	/* Returns 0 if files are equal.
+	 * Useful to be used in g_list_find_custom() or g_queue_find_custom() */
+	return !g_file_equal (file_a, file_b);
+}
diff --git a/src/libtracker-common/tracker-file-utils.h b/src/libtracker-common/tracker-file-utils.h
index dd9e0fa..eebd360 100644
--- a/src/libtracker-common/tracker-file-utils.h
+++ b/src/libtracker-common/tracker-file-utils.h
@@ -44,6 +44,8 @@ gboolean tracker_file_lock          (GFile        *file);
 gboolean tracker_file_unlock        (GFile        *file);
 gboolean tracker_file_is_locked     (GFile        *file);
 gboolean tracker_file_is_hidden     (GFile        *file);
+gint     tracker_file_cmp           (GFile        *file_a,
+                                     GFile        *file_b);
 
 /* Path utils */
 gboolean tracker_path_is_in_path                      (const gchar  *path,



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