[gthumb] Make same_uri more elegant using gfile functions



commit ecd994d6e62696b8ae6235a751ec8d4140e885ae
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date:   Wed Jun 3 15:08:43 2009 -0400

    Make same_uri more elegant using gfile functions
---
 libgthumb/file-utils.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/libgthumb/file-utils.c b/libgthumb/file-utils.c
index 44d9188..007d13a 100644
--- a/libgthumb/file-utils.c
+++ b/libgthumb/file-utils.c
@@ -1290,23 +1290,24 @@ gboolean
 same_uri (const char *uri1,
 	  const char *uri2)
 {
-	char     *utf8_path1;
-	char     *utf8_path2;
+	GFile    *gfile1;
+	GFile	 *gfile2;
 	gboolean  result = FALSE;	
 
 	/* quick test */
 	if (strcmp_null_tolerant (uri1, uri2) == 0)
 		return TRUE;
+	if ((uri1 == NULL) || (uri2 == NULL))
+		return FALSE;
 
 	/* slow test */
-	utf8_path1 = get_utf8_display_name_from_uri (uri1);
-	utf8_path2 = get_utf8_display_name_from_uri (uri2);
+	gfile1 = gfile_new (uri1);
+	gfile2 = gfile_new (uri2);
 
-	if (strcmp_null_tolerant (utf8_path1, utf8_path2) == 0)
-		result = TRUE;
+	result = g_file_equal (gfile1, gfile2);
 
-	g_free (utf8_path1);
-	g_free (utf8_path2);
+	g_object_unref (gfile1);
+	g_object_unref (gfile2);
 
 	return result;
 }



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