Commit c04c2d84 authored by Jehan's avatar Jehan

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).
parent 66dae000
Pipeline #219626 passed with stages
in 66 minutes and 6 seconds
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment