app: move gimp_file_compare() to gimp-utils.[ch]

It's a GCompareFunc to be used for finding GFiles in lists.
This commit is contained in:
Michael Natterer 2014-08-02 15:07:26 +02:00
parent 6821eb298c
commit 2b1735f784
7 changed files with 29 additions and 21 deletions

View File

@ -17,6 +17,7 @@
#include "config.h"
#include <gio/gio.h>
#include <gegl.h>
#include "libgimpmath/gimpmath.h"

View File

@ -926,6 +926,27 @@ gimp_constrain_line (gdouble start_x,
}
}
gint
gimp_file_compare (GFile *file1,
GFile *file2)
{
if (g_file_equal (file1, file2))
{
return 0;
}
else
{
gchar *uri1 = g_file_get_uri (file1);
gchar *uri2 = g_file_get_uri (file2);
gint result = strcmp (uri1, uri2);
g_free (uri1);
g_free (uri2);
return result;
}
}
/* debug stuff */

View File

@ -100,6 +100,9 @@ void gimp_constrain_line (gdouble start_x,
gdouble *end_y,
gint n_snap_lines);
gint gimp_file_compare (GFile *file1,
GFile *file2);
void gimp_create_image_from_buffer (Gimp *gimp,
GeglBuffer *buffer);

View File

@ -33,6 +33,7 @@
#include "core-types.h"
#include "gimp.h"
#include "gimp-utils.h"
#include "gimpcontext.h"
#include "gimpdata.h"
#include "gimpdatafactory.h"
@ -670,27 +671,6 @@ gimp_data_factory_has_data_new_func (GimpDataFactory *factory)
/* private functions */
static gint
gimp_file_compare (GFile *file1,
GFile *file2)
{
if (g_file_equal (file1, file2))
{
return 0;
}
else
{
gchar *uri1 = g_file_get_uri (file1);
gchar *uri2 = g_file_get_uri (file2);
gint result = strcmp (uri1, uri2);
g_free (uri1);
g_free (uri2);
return result;
}
}
static GFile *
gimp_data_factory_get_save_dir (GimpDataFactory *factory,
GError **error)

View File

@ -20,6 +20,7 @@
#include "config.h"
#include <gio/gio.h>
#include <gegl.h>
#include "core-types.h"

View File

@ -23,6 +23,7 @@
#include "config.h"
#include <cairo.h>
#include <gio/gio.h>
#include <gegl.h>
#include "gimp-gegl-types.h"

View File

@ -44,6 +44,7 @@
#endif /* USE_POSIX_SHM */
#include <gio/gio.h>
#include <gegl.h>
#if defined(G_OS_WIN32) || defined(G_WITH_CYGWIN)