app: fix file comparison.

g_list_find_custom() uses a GCompareFunc which has a return value
similar to strcmp(), i.e. with 0 for equality (and not a boolean, which
is basically the opposite).
This commit is contained in:
Jehan 2020-10-08 03:20:05 +02:00
parent 66dae000f9
commit c04c2d841d
1 changed files with 17 additions and 1 deletions

View File

@ -89,6 +89,8 @@ static void gimp_extension_get_property (GObject *object,
GParamSpec *pspec);
static void gimp_extension_clean (GimpExtension *extension);
static gint gimp_extension_file_cmp (GFile *a,
GFile *b);
static GList * gimp_extension_validate_paths (GimpExtension *extension,
const gchar *paths,
gboolean as_directories,
@ -722,6 +724,20 @@ gimp_extension_clean (GimpExtension *extension)
extension->p->theme_paths = NULL;
}
/**
* gimp_extension_file_cmp:
* @a:
* @b:
*
* A small g_file_equal() wrapper using GCompareFunc signature.
*/
static gint
gimp_extension_file_cmp (GFile *a,
GFile *b)
{
return g_file_equal (a, b) ? 0 : 1;
}
/**
* gimp_extension_validate_paths:
* @extension: the #GimpExtension
@ -840,7 +856,7 @@ gimp_extension_validate_paths (GimpExtension *extension,
}
g_return_val_if_fail (path != NULL, NULL);
if (g_list_find_custom (list, file, (GCompareFunc) g_file_equal))
if (g_list_find_custom (list, file, (GCompareFunc) gimp_extension_file_cmp))
{
/* Silently ignore duplicate paths. */
g_object_unref (file);