[gimp] app: move some stuff out of app/file/



commit 5455b8bfd023cfc8f3ae6fc4a7dd8eb632f80297
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jan 3 20:05:27 2016 +0100

    app: move some stuff out of app/file/
    
    file-procedure.[ch] is gone and its functions moved to
    GimpPlugInManager where they belong (the manager keeps around the
    lists of load, save and export procedures).
    
    Utility functions from file-utils.[ch] that have nothing to do with
    image files moved to core/gimp-utils.[ch].

 app/actions/file-actions.c                         |    5 +-
 app/actions/file-commands.c                        |   13 +-
 app/core/gimp-utils.c                              |   84 +++++++++++
 app/core/gimp-utils.h                              |    3 +
 app/core/gimpimage.c                               |    5 +-
 app/dialogs/file-open-dialog.c                     |    1 -
 app/dialogs/file-save-dialog.c                     |   56 ++++----
 app/file/Makefile.am                               |   18 +--
 app/file/file-open.c                               |   34 +++---
 app/file/file-save.c                               |    1 -
 app/file/file-utils.c                              |   92 +------------
 app/file/file-utils.h                              |    4 -
 app/gui/gui-vtable.c                               |    9 +-
 app/pdb/fileops-cmds.c                             |   17 ++-
 app/plug-in/Makefile.am                            |    2 +
 .../gimppluginmanager-file-procedure.c}            |   46 +------
 .../gimppluginmanager-file-procedure.h}            |   37 ++---
 app/plug-in/gimppluginmanager-file.c               |  147 +++++++++++++++++++-
 app/plug-in/gimppluginmanager-file.h               |   20 +++-
 app/plug-in/plug-in-enums.c                        |   33 +++++
 app/plug-in/plug-in-enums.h                        |   13 ++
 app/tests/test-save-and-export.c                   |   59 ++++----
 app/tests/test-xcf.c                               |   24 ++--
 app/widgets/gimpdnd-xds.c                          |   17 ++-
 app/widgets/gimpexportdialog.c                     |    4 +-
 app/widgets/gimpimagepropview.c                    |   16 +--
 app/widgets/gimpsavedialog.c                       |    4 +-
 app/widgets/gimpthumbbox.c                         |    9 +-
 po/POTFILES.in                                     |    2 +-
 tools/pdbgen/pdb/fileops.pdb                       |   17 ++-
 30 files changed, 474 insertions(+), 318 deletions(-)
---
diff --git a/app/actions/file-actions.c b/app/actions/file-actions.c
index e3cb208..7b6c209 100644
--- a/app/actions/file-actions.c
+++ b/app/actions/file-actions.c
@@ -284,8 +284,9 @@ file_actions_update (GimpActionGroup *group,
 
   show_overwrite =
     (source &&
-     gimp_plug_in_manager_file_has_exporter (gimp->plug_in_manager,
-                                             source));
+     gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+                                               GIMP_FILE_PROCEDURE_GROUP_EXPORT,
+                                               source, NULL));
 
 #define SET_VISIBLE(action,condition) \
         gimp_action_group_set_action_visible (group, action, (condition) != 0)
diff --git a/app/actions/file-commands.c b/app/actions/file-commands.c
index 8a26a12..4a48030 100644
--- a/app/actions/file-commands.c
+++ b/app/actions/file-commands.c
@@ -36,10 +36,9 @@
 #include "core/gimpprogress.h"
 #include "core/gimptemplate.h"
 
-#include "plug-in/gimppluginmanager.h"
+#include "plug-in/gimppluginmanager-file.h"
 
 #include "file/file-open.h"
-#include "file/file-procedure.h"
 #include "file/file-save.h"
 #include "file/gimp-file.h"
 
@@ -258,8 +257,9 @@ file_save_cmd_callback (GtkAction *action,
           if (file && ! save_proc)
             {
               save_proc =
-                file_procedure_find (image->gimp->plug_in_manager->save_procs,
-                                     file, NULL);
+                gimp_plug_in_manager_file_procedure_find (image->gimp->plug_in_manager,
+                                                          GIMP_FILE_PROCEDURE_GROUP_SAVE,
+                                                          file, NULL);
             }
 
           if (file && save_proc)
@@ -357,8 +357,9 @@ file_save_cmd_callback (GtkAction *action,
         if (file && ! export_proc)
           {
             export_proc =
-              file_procedure_find (image->gimp->plug_in_manager->export_procs,
-                                   file, NULL);
+              gimp_plug_in_manager_file_procedure_find (image->gimp->plug_in_manager,
+                                                        GIMP_FILE_PROCEDURE_GROUP_EXPORT,
+                                                        file, NULL);
           }
 
         if (file && export_proc)
diff --git a/app/core/gimp-utils.c b/app/core/gimp-utils.c
index 5e448f8..fc0694d 100644
--- a/app/core/gimp-utils.c
+++ b/app/core/gimp-utils.c
@@ -745,6 +745,90 @@ gimp_file_is_executable (GFile *file)
   return executable;
 }
 
+/**
+ * gimp_file_get_extension:
+ * @file: A #GFile
+ *
+ * Returns @file's extension (including the .), or NULL if there is no
+ * extension. Note that this function handles compressed files too,
+ * e.g. for "file.png.gz" it will return ".png.gz".
+ *
+ * Returns: The @file's extension. Free with g_free() when no longer needed.
+ **/
+gchar *
+gimp_file_get_extension (GFile *file)
+{
+  gchar *uri;
+  gint   uri_len;
+  gchar *ext = NULL;
+  gint   search_len;
+
+  g_return_val_if_fail (G_IS_FILE (file), NULL);
+
+  uri     = g_file_get_uri (file);
+  uri_len = strlen (uri);
+
+  if (g_str_has_suffix (uri, ".gz"))
+    search_len = uri_len - 3;
+  else if (g_str_has_suffix (uri, ".bz2"))
+    search_len = uri_len - 4;
+  else if (g_str_has_suffix (uri, ".xz"))
+    search_len = uri_len - 3;
+  else
+    search_len = uri_len;
+
+  ext = g_strrstr_len (uri, search_len, ".");
+
+  if (ext)
+    ext = g_strdup (ext);
+
+  g_free (uri);
+
+  return ext;
+}
+
+GFile *
+gimp_file_with_new_extension (GFile *file,
+                              GFile *ext_file)
+{
+  gchar *uri;
+  gchar *file_ext;
+  gint   file_ext_len = 0;
+  gchar *ext_file_ext = NULL;
+  gchar *uri_without_ext;
+  gchar *new_uri;
+  GFile *ret;
+
+  g_return_val_if_fail (G_IS_FILE (file), NULL);
+  g_return_val_if_fail (ext_file == NULL || G_IS_FILE (ext_file), NULL);
+
+  uri      = g_file_get_uri (file);
+  file_ext = gimp_file_get_extension (file);
+
+  if (file_ext)
+    {
+      file_ext_len = strlen (file_ext);
+      g_free (file_ext);
+    }
+
+  if (ext_file)
+    ext_file_ext = gimp_file_get_extension (ext_file);
+
+  uri_without_ext = g_strndup (uri, strlen (uri) - file_ext_len);
+
+  g_free (uri);
+
+  new_uri = g_strconcat (uri_without_ext, ext_file_ext, NULL);
+
+  ret = g_file_new_for_uri (new_uri);
+
+  g_free (ext_file_ext);
+  g_free (uri_without_ext);
+  g_free (new_uri);
+
+  return ret;
+}
+
 
 /*  debug stuff  */
 
diff --git a/app/core/gimp-utils.h b/app/core/gimp-utils.h
index 707faca..5e3c1ee 100644
--- a/app/core/gimp-utils.h
+++ b/app/core/gimp-utils.h
@@ -76,6 +76,9 @@ void         gimp_constrain_line                   (gdouble          start_x,
 gint         gimp_file_compare                     (GFile           *file1,
                                                     GFile           *file2);
 gboolean     gimp_file_is_executable               (GFile           *file);
+gchar      * gimp_file_get_extension               (GFile           *file);
+GFile      * gimp_file_with_new_extension          (GFile           *file,
+                                                    GFile           *ext_file);
 
 GimpImage  * gimp_create_image_from_buffer         (Gimp            *gimp,
                                                     GeglBuffer      *buffer,
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index b117af1..c0a8e4d 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -39,6 +39,7 @@
 #include "gimp.h"
 #include "gimp-memsize.h"
 #include "gimp-parasites.h"
+#include "gimp-utils.h"
 #include "gimpcontext.h"
 #include "gimpdrawablestack.h"
 #include "gimpgrid.h"
@@ -72,8 +73,6 @@
 #include "gimptemplate.h"
 #include "gimpundostack.h"
 
-#include "file/file-utils.h"
-
 #include "vectors/gimpvectors.h"
 
 #include "gimp-log.h"
@@ -2168,7 +2167,7 @@ gimp_image_format_display_uri (GimpImage *image,
         }
 
       if (display_file)
-        display_file = file_utils_file_with_new_ext (display_file, NULL);
+        display_file = gimp_file_with_new_extension (display_file, NULL);
 
       uri_format = "[%s]";
     }
diff --git a/app/dialogs/file-open-dialog.c b/app/dialogs/file-open-dialog.c
index 919ef3a..abddf71 100644
--- a/app/dialogs/file-open-dialog.c
+++ b/app/dialogs/file-open-dialog.c
@@ -35,7 +35,6 @@
 #include "core/gimpprogress.h"
 
 #include "file/file-open.h"
-#include "file/file-utils.h"
 #include "file/gimp-file.h"
 
 #include "widgets/gimpfiledialog.h"
diff --git a/app/dialogs/file-save-dialog.c b/app/dialogs/file-save-dialog.c
index e936f71..f43aa56 100644
--- a/app/dialogs/file-save-dialog.c
+++ b/app/dialogs/file-save-dialog.c
@@ -32,10 +32,9 @@
 #include "core/gimpimage.h"
 #include "core/gimpprogress.h"
 
-#include "plug-in/gimppluginmanager.h"
+#include "plug-in/gimppluginmanager-file.h"
 #include "plug-in/gimppluginprocedure.h"
 
-#include "file/file-procedure.h"
 #include "file/file-save.h"
 #include "file/gimp-file.h"
 
@@ -78,8 +77,9 @@ static CheckUriResult file_save_dialog_check_file           (GtkWidget
                                                              GimpPlugInProcedure **ret_save_proc);
 static gboolean  file_save_dialog_no_overwrite_confirmation (GimpFileDialog       *dialog,
                                                              Gimp                 *gimp);
-static GSList *  file_save_dialog_get_procs                 (GimpFileDialog       *dialog,
-                                                             Gimp                 *gimp);
+static GimpPlugInProcedure *
+                 file_save_dialog_find_procedure            (GimpFileDialog       *dialog,
+                                                             GFile                *file);
 static gboolean  file_save_dialog_switch_dialogs            (GimpFileDialog       *file_dialog,
                                                              Gimp                 *gimp,
                                                              const gchar          *basename);
@@ -295,12 +295,8 @@ file_save_dialog_check_file (GtkWidget            *dialog,
   basename_file = g_file_new_for_uri (basename);
 
   save_proc     = file_dialog->file_proc;
-  uri_proc      = file_procedure_find (file_save_dialog_get_procs (file_dialog,
-                                                                   gimp),
-                                       file, NULL);
-  basename_proc = file_procedure_find (file_save_dialog_get_procs (file_dialog,
-                                                                   gimp),
-                                       basename_file, NULL);
+  uri_proc      = file_save_dialog_find_procedure (file_dialog, file);
+  basename_proc = file_save_dialog_find_procedure (file_dialog, basename_file);
 
   g_object_unref (basename_file);
 
@@ -539,9 +535,7 @@ file_save_dialog_no_overwrite_confirmation (GimpFileDialog *file_dialog,
   basename_file = g_file_new_for_uri (basename);
 
   save_proc     = file_dialog->file_proc;
-  basename_proc = file_procedure_find (file_save_dialog_get_procs (file_dialog,
-                                                                   gimp),
-                                       basename_file, NULL);
+  basename_proc = file_save_dialog_find_procedure (file_dialog, basename_file);
 
   g_object_unref (basename_file);
 
@@ -558,13 +552,19 @@ file_save_dialog_no_overwrite_confirmation (GimpFileDialog *file_dialog,
   return uri_will_change || unknown_ext;
 }
 
-static GSList *
-file_save_dialog_get_procs (GimpFileDialog *file_dialog,
-                            Gimp           *gimp)
+static GimpPlugInProcedure *
+file_save_dialog_find_procedure (GimpFileDialog *file_dialog,
+                                 GFile          *file)
 {
-  return (GIMP_IS_SAVE_DIALOG (file_dialog) ?
-          gimp->plug_in_manager->save_procs :
-          gimp->plug_in_manager->export_procs);
+  GimpPlugInManager      *manager = file_dialog->gimp->plug_in_manager;
+  GimpFileProcedureGroup  group;
+
+  if (GIMP_IS_SAVE_DIALOG (file_dialog))
+    group = GIMP_FILE_PROCEDURE_GROUP_SAVE;
+  else
+    group = GIMP_FILE_PROCEDURE_GROUP_EXPORT;
+
+  return gimp_plug_in_manager_file_procedure_find (manager, group, file, NULL);
 }
 
 static gboolean
@@ -582,17 +582,21 @@ file_save_dialog_switch_dialogs (GimpFileDialog *file_dialog,
                                  Gimp           *gimp,
                                  const gchar    *basename)
 {
-  GimpPlugInProcedure *proc_in_other_group;
-  GFile               *file;
-  gboolean             switch_dialogs = FALSE;
+  GimpPlugInProcedure    *proc_in_other_group;
+  GimpFileProcedureGroup  other_group;
+  GFile                  *file;
+  gboolean                switch_dialogs = FALSE;
 
   file = g_file_new_for_uri (basename);
 
+  if (GIMP_IS_EXPORT_DIALOG (file_dialog))
+    other_group = GIMP_FILE_PROCEDURE_GROUP_SAVE;
+  else
+    other_group = GIMP_FILE_PROCEDURE_GROUP_EXPORT;
+
   proc_in_other_group =
-    file_procedure_find (GIMP_IS_EXPORT_DIALOG (file_dialog) ?
-                         gimp->plug_in_manager->save_procs :
-                         gimp->plug_in_manager->export_procs,
-                         file, NULL);
+    gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+                                              other_group, file, NULL);
 
   g_object_unref (file);
 
diff --git a/app/file/Makefile.am b/app/file/Makefile.am
index 2ce23af..71bc528 100644
--- a/app/file/Makefile.am
+++ b/app/file/Makefile.am
@@ -13,14 +13,12 @@ AM_CPPFLAGS = \
 noinst_LIBRARIES = libappfile.a
 
 libappfile_a_SOURCES = \
-       file-open.c             \
-       file-open.h             \
-       file-procedure.c        \
-       file-procedure.h        \
-       file-remote.c           \
-       file-remote.h           \
-       file-save.c             \
-       file-save.h             \
-       file-utils.c            \
-       file-utils.h            \
+       file-open.c     \
+       file-open.h     \
+       file-remote.c   \
+       file-remote.h   \
+       file-save.c     \
+       file-save.h     \
+       file-utils.c    \
+       file-utils.h    \
        gimp-file.h
diff --git a/app/file/file-open.c b/app/file/file-open.c
index 74bbca4..6484f73 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -46,27 +46,25 @@
 
 #include "pdb/gimppdb.h"
 
-#include "plug-in/gimppluginmanager.h"
+#include "plug-in/gimppluginmanager-file.h"
 #include "plug-in/gimppluginprocedure.h"
 
 #include "file-open.h"
-#include "file-procedure.h"
 #include "file-remote.h"
-#include "file-utils.h"
 #include "gimp-file.h"
 
 #include "gimp-intl.h"
 
 
-static void     file_open_sanitize_image       (GimpImage                 *image,
-                                                gboolean                   as_new);
-static void     file_open_convert_items        (GimpImage                 *dest_image,
-                                                const gchar               *basename,
-                                                GList                     *items);
-static GList *  file_open_get_layers           (const GimpImage           *image,
-                                                gboolean                   merge_visible,
-                                                gint                      *n_visible);
-static gboolean file_open_file_proc_is_import  (const GimpPlugInProcedure *file_proc);
+static void     file_open_sanitize_image       (GimpImage           *image,
+                                                gboolean             as_new);
+static void     file_open_convert_items        (GimpImage           *dest_image,
+                                                const gchar         *basename,
+                                                GList               *items);
+static GList *  file_open_get_layers           (const GimpImage     *image,
+                                                gboolean             merge_visible,
+                                                gint                *n_visible);
+static gboolean file_open_file_proc_is_import  (GimpPlugInProcedure *file_proc);
 
 
 /*  public functions  */
@@ -136,8 +134,9 @@ file_open_image (Gimp                *gimp,
     }
 
   if (! file_proc)
-    file_proc = file_procedure_find (gimp->plug_in_manager->load_procs, file,
-                                     error);
+    file_proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+                                                          GIMP_FILE_PROCEDURE_GROUP_OPEN,
+                                                          file, error);
 
   if (! file_proc)
     return NULL;
@@ -320,8 +319,9 @@ file_open_thumbnail (Gimp           *gimp,
   *format       = NULL;
   *num_layers   = -1;
 
-  file_proc = file_procedure_find (gimp->plug_in_manager->load_procs, file,
-                                   NULL);
+  file_proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+                                                        GIMP_FILE_PROCEDURE_GROUP_OPEN,
+                                                        file, NULL);
 
   if (! file_proc || ! file_proc->thumb_loader)
     return NULL;
@@ -791,7 +791,7 @@ file_open_get_layers (const GimpImage *image,
 }
 
 static gboolean
-file_open_file_proc_is_import (const GimpPlugInProcedure *file_proc)
+file_open_file_proc_is_import (GimpPlugInProcedure *file_proc)
 {
   return !(file_proc &&
            file_proc->mime_type &&
diff --git a/app/file/file-save.c b/app/file/file-save.c
index 5768ea9..069c96f 100644
--- a/app/file/file-save.c
+++ b/app/file/file-save.c
@@ -44,7 +44,6 @@
 
 #include "file-remote.h"
 #include "file-save.h"
-#include "file-utils.h"
 #include "gimp-file.h"
 
 #include "gimp-intl.h"
diff --git a/app/file/file-utils.c b/app/file/file-utils.c
index a195dd2..bb907b2 100644
--- a/app/file/file-utils.c
+++ b/app/file/file-utils.c
@@ -35,9 +35,8 @@
 #include "core/gimpimage.h"
 #include "core/gimpimagefile.h"
 
-#include "plug-in/gimppluginmanager.h"
+#include "plug-in/gimppluginmanager-file.h"
 
-#include "file-procedure.h"
 #include "file-utils.h"
 
 #include "gimp-intl.h"
@@ -105,8 +104,9 @@ file_utils_filename_to_file (Gimp         *gimp,
   file = g_file_new_for_uri (filename);
 
   /*  check for prefixes like http or ftp  */
-  if (file_procedure_find_by_prefix (gimp->plug_in_manager->load_procs,
-                                     file))
+  if (gimp_plug_in_manager_file_procedure_find_by_prefix (gimp->plug_in_manager,
+                                                          GIMP_FILE_PROCEDURE_GROUP_OPEN,
+                                                          file))
     {
       if (g_utf8_validate (filename, -1, NULL))
         {
@@ -155,90 +155,6 @@ file_utils_filename_to_file (Gimp         *gimp,
   return file;
 }
 
-GFile *
-file_utils_file_with_new_ext (GFile *file,
-                              GFile *ext_file)
-{
-  gchar *uri;
-  gchar *file_ext;
-  gint   file_ext_len = 0;
-  gchar *ext_file_ext = NULL;
-  gchar *uri_without_ext;
-  gchar *new_uri;
-  GFile *ret;
-
-  g_return_val_if_fail (G_IS_FILE (file), NULL);
-  g_return_val_if_fail (ext_file == NULL || G_IS_FILE (ext_file), NULL);
-
-  uri      = g_file_get_uri (file);
-  file_ext = file_utils_file_get_ext (file);
-
-  if (file_ext)
-    {
-      file_ext_len = strlen (file_ext);
-      g_free (file_ext);
-    }
-
-  if (ext_file)
-    ext_file_ext = file_utils_file_get_ext (ext_file);
-
-  uri_without_ext = g_strndup (uri, strlen (uri) - file_ext_len);
-
-  g_free (uri);
-
-  new_uri = g_strconcat (uri_without_ext, ext_file_ext, NULL);
-
-  ret = g_file_new_for_uri (new_uri);
-
-  g_free (ext_file_ext);
-  g_free (uri_without_ext);
-  g_free (new_uri);
-
-  return ret;
-}
-
-
-/**
- * file_utils_file_get_ext:
- * @file:
- *
- * Returns the position of the extension (including the .), or NULL
- * if there is no extension.
- *
- * Returns:
- **/
-gchar *
-file_utils_file_get_ext (GFile *file)
-{
-  gchar *uri;
-  gint   uri_len;
-  gchar *ext = NULL;
-  gint   search_len;
-
-  g_return_val_if_fail (G_IS_FILE (file), NULL);
-
-  uri     = g_file_get_uri (file);
-  uri_len = strlen (uri);
-
-  if (g_str_has_suffix (uri, ".gz"))
-    search_len = uri_len - 3;
-  else if (g_str_has_suffix (uri, ".bz2"))
-    search_len = uri_len - 4;
-  else if (g_str_has_suffix (uri, ".xz"))
-    search_len = uri_len - 3;
-  else
-    search_len = uri_len;
-
-  ext = g_strrstr_len (uri, search_len, ".");
-
-  if (ext)
-    ext = g_strdup (ext);
-
-  g_free (uri);
-
-  return ext;
-}
-
 GdkPixbuf *
 file_utils_load_thumbnail (const gchar *filename)
 {
diff --git a/app/file/file-utils.h b/app/file/file-utils.h
index 950dab1..222e470 100644
--- a/app/file/file-utils.h
+++ b/app/file/file-utils.h
@@ -25,10 +25,6 @@ GFile     * file_utils_filename_to_file  (Gimp         *gimp,
                                           const gchar  *filename,
                                           GError      **error);
 
-GFile     * file_utils_file_with_new_ext (GFile        *file,
-                                          GFile        *ext_file);
-gchar     * file_utils_file_get_ext      (GFile        *file);
-
 GdkPixbuf * file_utils_load_thumbnail    (const gchar  *filename);
 gboolean    file_utils_save_thumbnail    (GimpImage    *image,
                                           const gchar  *filename);
diff --git a/app/gui/gui-vtable.c b/app/gui/gui-vtable.c
index 6a2d292..25f3e2c 100644
--- a/app/gui/gui-vtable.c
+++ b/app/gui/gui-vtable.c
@@ -47,9 +47,7 @@
 
 #include "text/gimpfont.h"
 
-#include "plug-in/gimppluginmanager.h"
-
-#include "file/file-procedure.h"
+#include "plug-in/gimppluginmanager-file.h"
 
 #include "widgets/gimpactiongroup.h"
 #include "widgets/gimpbrushselect.h"
@@ -734,8 +732,9 @@ gui_recent_list_load (Gimp *gimp)
           const gchar *mime_type = gtk_recent_info_get_mime_type (info);
 
           if (mime_type &&
-              file_procedure_find_by_mime_type (gimp->plug_in_manager->load_procs,
-                                                mime_type))
+              gimp_plug_in_manager_file_procedure_find_by_mime_type (gimp->plug_in_manager,
+                                                                     GIMP_FILE_PROCEDURE_GROUP_OPEN,
+                                                                     mime_type))
             {
               GimpImagefile *imagefile;
               GFile         *file;
diff --git a/app/pdb/fileops-cmds.c b/app/pdb/fileops-cmds.c
index df8ac4d..3fe31ea 100644
--- a/app/pdb/fileops-cmds.c
+++ b/app/pdb/fileops-cmds.c
@@ -38,11 +38,9 @@
 #include "core/gimplayer.h"
 #include "core/gimpparamspecs.h"
 #include "file/file-open.h"
-#include "file/file-procedure.h"
 #include "file/file-save.h"
 #include "file/file-utils.h"
 #include "plug-in/gimppluginmanager-file.h"
-#include "plug-in/gimppluginmanager.h"
 #include "plug-in/gimppluginprocedure.h"
 
 #include "gimppdb.h"
@@ -73,8 +71,9 @@ file_load_invoker (GimpProcedure         *procedure,
     return gimp_procedure_get_return_values (procedure, FALSE,
                                              error ? *error : NULL);
 
-  file_proc = file_procedure_find (gimp->plug_in_manager->load_procs,
-                                   file, error);
+  file_proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+                                                        GIMP_FILE_PROCEDURE_GROUP_OPEN,
+                                                        file, error);
 
   if (! file_proc)
     {
@@ -279,12 +278,14 @@ file_save_invoker (GimpProcedure         *procedure,
     return gimp_procedure_get_return_values (procedure, FALSE,
                                              error ? *error : NULL);
 
-  file_proc = file_procedure_find (gimp->plug_in_manager->save_procs,
-                                   file, NULL);
+  file_proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+                                                        GIMP_FILE_PROCEDURE_GROUP_SAVE,
+                                                        file, NULL);
 
   if (! file_proc)
-    file_proc = file_procedure_find (gimp->plug_in_manager->export_procs,
-                                     file, error);
+    file_proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+                                                          GIMP_FILE_PROCEDURE_GROUP_EXPORT,
+                                                          file, error);
 
   if (! file_proc)
     {
diff --git a/app/plug-in/Makefile.am b/app/plug-in/Makefile.am
index b8585f4..4b0b1b3 100644
--- a/app/plug-in/Makefile.am
+++ b/app/plug-in/Makefile.am
@@ -46,6 +46,8 @@ libappplug_in_a_SOURCES = \
        gimppluginmanager-data.h                \
        gimppluginmanager-file.c                \
        gimppluginmanager-file.h                \
+       gimppluginmanager-file-procedure.c      \
+       gimppluginmanager-file-procedure.h      \
        gimppluginmanager-help-domain.c         \
        gimppluginmanager-help-domain.h         \
        gimppluginmanager-locale-domain.c       \
diff --git a/app/file/file-procedure.c b/app/plug-in/gimppluginmanager-file-procedure.c
similarity index 94%
rename from app/file/file-procedure.c
rename to app/plug-in/gimppluginmanager-file-procedure.c
index f2d9eb2..24e9956 100644
--- a/app/file/file-procedure.c
+++ b/app/plug-in/gimppluginmanager-file-procedure.c
@@ -2,7 +2,7 @@
  * Copyright (C) 1995, 1996, 1997 Spencer Kimball and Peter Mattis
  * Copyright (C) 1997 Josh MacDonald
  *
- * file-procedure.c
+ * gimppluginmanager-file-procedure.c
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,12 +28,12 @@
 
 #include "libgimpbase/gimpbase.h"
 
-#include "core/core-types.h"
+#include "plug-in-types.h"
 
-#include "plug-in/gimppluginprocedure.h"
+#include "core/gimp-utils.h"
 
-#include "file-procedure.h"
-#include "file-utils.h"
+#include "gimppluginmanager-file-procedure.h"
+#include "gimppluginprocedure.h"
 
 #include "gimp-intl.h"
 
@@ -252,40 +252,6 @@ file_procedure_find_by_mime_type (GSList      *procs,
   return NULL;
 }
 
-gboolean
-file_procedure_in_group (GimpPlugInProcedure *file_proc,
-                         FileProcedureGroup   group)
-{
-  const gchar *name        = gimp_object_get_name (file_proc);
-  gboolean     is_xcf_save = FALSE;
-  gboolean     is_filter   = FALSE;
-
-  is_xcf_save = (strcmp (name, "gimp-xcf-save") == 0);
-
-  is_filter   = (strcmp (name, "file-gz-save")  == 0 ||
-                 strcmp (name, "file-bz2-save") == 0 ||
-                 strcmp (name, "file-xz-save")  == 0);
-
-  switch (group)
-    {
-    case FILE_PROCEDURE_GROUP_SAVE:
-      /* Only .xcf shall pass */
-      return is_xcf_save || is_filter;
-
-    case FILE_PROCEDURE_GROUP_EXPORT:
-      /* Anything but .xcf shall pass */
-      return ! is_xcf_save;
-
-    case FILE_PROCEDURE_GROUP_OPEN:
-      /* No filter applied for Open */
-      return TRUE;
-
-    default:
-    case FILE_PROCEDURE_GROUP_ANY:
-      return TRUE;
-    }
-}
-
 
 /*  private functions  */
 
@@ -328,7 +294,7 @@ file_proc_find_by_extension (GSList   *procs,
                              gboolean  skip_magic,
                              gboolean  uri_procs_only)
 {
-  gchar *ext = file_utils_file_get_ext (file);
+  gchar *ext = gimp_file_get_extension (file);
 
   if (ext)
     {
diff --git a/app/file/file-procedure.h b/app/plug-in/gimppluginmanager-file-procedure.h
similarity index 68%
rename from app/file/file-procedure.h
rename to app/plug-in/gimppluginmanager-file-procedure.h
index 1d4862f..1e2e0cd 100644
--- a/app/file/file-procedure.h
+++ b/app/plug-in/gimppluginmanager-file-procedure.h
@@ -1,7 +1,7 @@
 /* GIMP - The GNU Image Manipulation Program
  * Copyright (C) 1995 Spencer Kimball and Peter Mattis
  *
- * file-procedure.h
+ * gimppluginmanager-file-procedure.h
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -17,32 +17,21 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __FILE_PROCEDURE_H__
-#define __FILE_PROCEDURE_H__
+#ifndef __GIMP_PLUG_IN_MANAGER_FILE_PROCEDURE_H__
+#define __GIMP_PLUG_IN_MANAGER_FILE_PROCEDURE_H__
 
 
-typedef enum
-{
-  FILE_PROCEDURE_GROUP_ANY,
-  FILE_PROCEDURE_GROUP_OPEN,
-  FILE_PROCEDURE_GROUP_SAVE,
-  FILE_PROCEDURE_GROUP_EXPORT
-} FileProcedureGroup;
 
+GimpPlugInProcedure *file_procedure_find              (GSList      *procs,
+                                                       GFile       *file,
+                                                       GError     **error);
+GimpPlugInProcedure *file_procedure_find_by_prefix    (GSList      *procs,
+                                                       GFile       *file);
+GimpPlugInProcedure *file_procedure_find_by_extension (GSList      *procs,
+                                                       GFile       *file);
 
-GimpPlugInProcedure *file_procedure_find              (GSList               *procs,
-                                                       GFile                *file,
-                                                       GError              **error);
-GimpPlugInProcedure *file_procedure_find_by_prefix    (GSList               *procs,
-                                                       GFile                *file);
-GimpPlugInProcedure *file_procedure_find_by_extension (GSList               *procs,
-                                                       GFile                *file);
+GimpPlugInProcedure *file_procedure_find_by_mime_type (GSList      *procs,
+                                                       const gchar *mime_type);
 
-GimpPlugInProcedure *file_procedure_find_by_mime_type (GSList               *procs,
-                                                       const gchar          *mime_type);
 
-gboolean             file_procedure_in_group          (GimpPlugInProcedure  *file_proc,
-                                                       FileProcedureGroup    group);
-
-
-#endif /* __FILE_PROCEDURE_H__ */
+#endif /* __GIMP_PLUG_IN_MANAGER_FILE_PROCEDURE_H__ */
diff --git a/app/plug-in/gimppluginmanager-file.c b/app/plug-in/gimppluginmanager-file.c
index dc4e951..84fd4aa 100644
--- a/app/plug-in/gimppluginmanager-file.c
+++ b/app/plug-in/gimppluginmanager-file.c
@@ -19,6 +19,8 @@
 
 #include "config.h"
 
+#include <string.h>
+
 #include <gdk-pixbuf/gdk-pixbuf.h>
 #include <gegl.h>
 
@@ -27,15 +29,18 @@
 #include "core/gimp.h"
 #include "core/gimpparamspecs.h"
 
-#include "file/file-procedure.h"
-
 #include "gimpplugin.h"
 #include "gimpplugindef.h"
 #include "gimppluginmanager.h"
 #include "gimppluginmanager-file.h"
+#include "gimppluginmanager-file-procedure.h"
 #include "gimppluginprocedure.h"
 
 
+static gboolean   file_procedure_in_group (GimpPlugInProcedure    *file_proc,
+                                           GimpFileProcedureGroup  group);
+
+
 /*  public functions  */
 
 gboolean
@@ -137,13 +142,13 @@ gimp_plug_in_manager_register_save_handler (GimpPlugInManager *manager,
   gimp_plug_in_procedure_set_file_proc (file_proc,
                                         extensions, prefixes, NULL);
 
-  if (file_procedure_in_group (file_proc, FILE_PROCEDURE_GROUP_SAVE))
+  if (file_procedure_in_group (file_proc, GIMP_FILE_PROCEDURE_GROUP_SAVE))
     {
       if (! g_slist_find (manager->save_procs, file_proc))
         manager->save_procs = g_slist_prepend (manager->save_procs, file_proc);
     }
 
-  if (file_procedure_in_group (file_proc, FILE_PROCEDURE_GROUP_EXPORT))
+  if (file_procedure_in_group (file_proc, GIMP_FILE_PROCEDURE_GROUP_EXPORT))
     {
       if (! g_slist_find (manager->export_procs, file_proc))
         manager->export_procs = g_slist_prepend (manager->export_procs, file_proc);
@@ -231,9 +236,137 @@ gimp_plug_in_manager_register_thumb_loader (GimpPlugInManager *manager,
   return TRUE;
 }
 
+GimpPlugInProcedure *
+gimp_plug_in_manager_file_procedure_find (GimpPlugInManager      *manager,
+                                          GimpFileProcedureGroup  group,
+                                          GFile                  *file,
+                                          GError                **error)
+{
+  g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
+  g_return_val_if_fail (G_IS_FILE (file), NULL);
+  g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+  switch (group)
+    {
+    case GIMP_FILE_PROCEDURE_GROUP_OPEN:
+      return file_procedure_find (manager->load_procs, file, error);
+
+    case GIMP_FILE_PROCEDURE_GROUP_SAVE:
+      return file_procedure_find (manager->save_procs, file, error);
+
+    case GIMP_FILE_PROCEDURE_GROUP_EXPORT:
+      return file_procedure_find (manager->export_procs, file, error);
+
+    default:
+      g_return_val_if_reached (NULL);
+    }
+}
+
+GimpPlugInProcedure *
+gimp_plug_in_manager_file_procedure_find_by_prefix (GimpPlugInManager      *manager,
+                                                    GimpFileProcedureGroup  group,
+                                                    GFile                  *file)
+{
+  g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
+  g_return_val_if_fail (G_IS_FILE (file), NULL);
+
+  switch (group)
+    {
+    case GIMP_FILE_PROCEDURE_GROUP_OPEN:
+      return file_procedure_find_by_prefix (manager->load_procs, file);
+
+    case GIMP_FILE_PROCEDURE_GROUP_SAVE:
+      return file_procedure_find_by_prefix (manager->save_procs, file);
+
+    case GIMP_FILE_PROCEDURE_GROUP_EXPORT:
+      return file_procedure_find_by_prefix (manager->export_procs, file);
+
+    default:
+      g_return_val_if_reached (NULL);
+    }
+}
+
+GimpPlugInProcedure *
+gimp_plug_in_manager_file_procedure_find_by_extension (GimpPlugInManager      *manager,
+                                                       GimpFileProcedureGroup  group,
+                                                       GFile                  *file)
+{
+  g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
+  g_return_val_if_fail (G_IS_FILE (file), NULL);
+
+  switch (group)
+    {
+    case GIMP_FILE_PROCEDURE_GROUP_OPEN:
+      return file_procedure_find_by_extension (manager->load_procs, file);
+
+    case GIMP_FILE_PROCEDURE_GROUP_SAVE:
+      return file_procedure_find_by_extension (manager->save_procs, file);
+
+    case GIMP_FILE_PROCEDURE_GROUP_EXPORT:
+      return file_procedure_find_by_extension (manager->export_procs, file);
+
+    default:
+      g_return_val_if_reached (NULL);
+    }
+}
+
+GimpPlugInProcedure *
+gimp_plug_in_manager_file_procedure_find_by_mime_type (GimpPlugInManager      *manager,
+                                                       GimpFileProcedureGroup  group,
+                                                       const gchar            *mime_type)
+{
+  g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), NULL);
+  g_return_val_if_fail (mime_type != NULL, NULL);
+
+  switch (group)
+    {
+    case GIMP_FILE_PROCEDURE_GROUP_OPEN:
+      return file_procedure_find_by_mime_type (manager->load_procs, mime_type);
+
+    case GIMP_FILE_PROCEDURE_GROUP_SAVE:
+      return file_procedure_find_by_mime_type (manager->save_procs, mime_type);
+
+    case GIMP_FILE_PROCEDURE_GROUP_EXPORT:
+      return file_procedure_find_by_mime_type (manager->export_procs, mime_type);
+
+    default:
+      g_return_val_if_reached (NULL);
+    }
+}
+
+
+/*  private functions  */
+
 gboolean
-gimp_plug_in_manager_file_has_exporter (GimpPlugInManager *manager,
-                                        GFile             *file)
+file_procedure_in_group (GimpPlugInProcedure    *file_proc,
+                         GimpFileProcedureGroup  group)
 {
-  return file_procedure_find (manager->export_procs, file, NULL) != NULL;
+  const gchar *name        = gimp_object_get_name (file_proc);
+  gboolean     is_xcf_save = FALSE;
+  gboolean     is_filter   = FALSE;
+
+  is_xcf_save = (strcmp (name, "gimp-xcf-save") == 0);
+
+  is_filter   = (strcmp (name, "file-gz-save")  == 0 ||
+                 strcmp (name, "file-bz2-save") == 0 ||
+                 strcmp (name, "file-xz-save")  == 0);
+
+  switch (group)
+    {
+    case GIMP_FILE_PROCEDURE_GROUP_SAVE:
+      /* Only .xcf shall pass */
+      return is_xcf_save || is_filter;
+
+    case GIMP_FILE_PROCEDURE_GROUP_EXPORT:
+      /* Anything but .xcf shall pass */
+      return ! is_xcf_save;
+
+    case GIMP_FILE_PROCEDURE_GROUP_OPEN:
+      /* No filter applied for Open */
+      return TRUE;
+
+    default:
+    case GIMP_FILE_PROCEDURE_GROUP_ANY:
+      return TRUE;
+    }
 }
diff --git a/app/plug-in/gimppluginmanager-file.h b/app/plug-in/gimppluginmanager-file.h
index f1dcc6f..aa08980 100644
--- a/app/plug-in/gimppluginmanager-file.h
+++ b/app/plug-in/gimppluginmanager-file.h
@@ -41,8 +41,24 @@ gboolean   gimp_plug_in_manager_register_handles_uri  (GimpPlugInManager *manage
 gboolean   gimp_plug_in_manager_register_thumb_loader (GimpPlugInManager *manager,
                                                        const gchar       *load_proc,
                                                        const gchar       *thumb_proc);
-gboolean   gimp_plug_in_manager_file_has_exporter     (GimpPlugInManager *manager,
-                                                       GFile             *file);
+
+GimpPlugInProcedure *
+gimp_plug_in_manager_file_procedure_find              (GimpPlugInManager      *manager,
+                                                       GimpFileProcedureGroup  group,
+                                                       GFile                  *file,
+                                                       GError                **error);
+GimpPlugInProcedure *
+gimp_plug_in_manager_file_procedure_find_by_prefix    (GimpPlugInManager      *manager,
+                                                       GimpFileProcedureGroup  group,
+                                                       GFile                  *file);
+GimpPlugInProcedure *
+gimp_plug_in_manager_file_procedure_find_by_extension (GimpPlugInManager      *manager,
+                                                       GimpFileProcedureGroup  group,
+                                                       GFile                  *file);
+GimpPlugInProcedure *
+gimp_plug_in_manager_file_procedure_find_by_mime_type (GimpPlugInManager      *manager,
+                                                       GimpFileProcedureGroup  group,
+                                                       const gchar            *mime_type);
 
 
 #endif /* __GIMP_PLUG_IN_MANAGER_FILE_H__ */
diff --git a/app/plug-in/plug-in-enums.c b/app/plug-in/plug-in-enums.c
index 0bc8eaa..6c264e9 100644
--- a/app/plug-in/plug-in-enums.c
+++ b/app/plug-in/plug-in-enums.c
@@ -78,6 +78,39 @@ gimp_plug_in_call_mode_get_type (void)
   return type;
 }
 
+GType
+gimp_file_procedure_group_get_type (void)
+{
+  static const GEnumValue values[] =
+  {
+    { GIMP_FILE_PROCEDURE_GROUP_ANY, "GIMP_FILE_PROCEDURE_GROUP_ANY", "any" },
+    { GIMP_FILE_PROCEDURE_GROUP_OPEN, "GIMP_FILE_PROCEDURE_GROUP_OPEN", "open" },
+    { GIMP_FILE_PROCEDURE_GROUP_SAVE, "GIMP_FILE_PROCEDURE_GROUP_SAVE", "save" },
+    { GIMP_FILE_PROCEDURE_GROUP_EXPORT, "GIMP_FILE_PROCEDURE_GROUP_EXPORT", "export" },
+    { 0, NULL, NULL }
+  };
+
+  static const GimpEnumDesc descs[] =
+  {
+    { GIMP_FILE_PROCEDURE_GROUP_ANY, "GIMP_FILE_PROCEDURE_GROUP_ANY", NULL },
+    { GIMP_FILE_PROCEDURE_GROUP_OPEN, "GIMP_FILE_PROCEDURE_GROUP_OPEN", NULL },
+    { GIMP_FILE_PROCEDURE_GROUP_SAVE, "GIMP_FILE_PROCEDURE_GROUP_SAVE", NULL },
+    { GIMP_FILE_PROCEDURE_GROUP_EXPORT, "GIMP_FILE_PROCEDURE_GROUP_EXPORT", NULL },
+    { 0, NULL, NULL }
+  };
+
+  static GType type = 0;
+
+  if (G_UNLIKELY (! type))
+    {
+      type = g_enum_register_static ("GimpFileProcedureGroup", values);
+      gimp_type_set_translation_context (type, "file-procedure-group");
+      gimp_enum_set_value_descriptions (type, descs);
+    }
+
+  return type;
+}
+
 
 /* Generated data ends here */
 
diff --git a/app/plug-in/plug-in-enums.h b/app/plug-in/plug-in-enums.h
index 9f0f124..82626b1 100644
--- a/app/plug-in/plug-in-enums.h
+++ b/app/plug-in/plug-in-enums.h
@@ -47,4 +47,17 @@ typedef enum /*< pdb-skip >*/
 } GimpPlugInCallMode;
 
 
+#define GIMP_TYPE_FILE_PROCEDURE_GROUP (gimp_file_procedure_group_get_type ())
+
+GType gimp_file_procedure_group_get_type (void) G_GNUC_CONST;
+
+typedef enum /*< pdb-skip >*/
+{
+  GIMP_FILE_PROCEDURE_GROUP_ANY,
+  GIMP_FILE_PROCEDURE_GROUP_OPEN,
+  GIMP_FILE_PROCEDURE_GROUP_SAVE,
+  GIMP_FILE_PROCEDURE_GROUP_EXPORT
+} GimpFileProcedureGroup;
+
+
 #endif /* __PLUG_IN_ENUMS_H__ */
diff --git a/app/tests/test-save-and-export.c b/app/tests/test-save-and-export.c
index 1c81d87..da47a90 100644
--- a/app/tests/test-save-and-export.c
+++ b/app/tests/test-save-and-export.c
@@ -15,6 +15,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "config.h"
+
 #include <stdlib.h>
 #include <string.h>
 
@@ -28,11 +30,18 @@
 
 #include "dialogs/dialogs-types.h"
 
-#include "display/gimpdisplay.h"
-#include "display/gimpdisplayshell.h"
-#include "display/gimpdisplayshell-scale.h"
-#include "display/gimpdisplayshell-transform.h"
-#include "display/gimpimagewindow.h"
+#include "core/gimp.h"
+#include "core/gimpchannel.h"
+#include "core/gimpcontext.h"
+#include "core/gimpimage.h"
+#include "core/gimplayer.h"
+#include "core/gimptoolinfo.h"
+#include "core/gimptooloptions.h"
+
+#include "plug-in/gimppluginmanager-file.h"
+
+#include "file/file-open.h"
+#include "file/file-save.h"
 
 #include "widgets/gimpdialogfactory.h"
 #include "widgets/gimpdock.h"
@@ -47,20 +56,11 @@
 #include "widgets/gimpuimanager.h"
 #include "widgets/gimpwidgets-utils.h"
 
-#include "file/file-open.h"
-#include "file/file-procedure.h"
-#include "file/file-save.h"
-#include "file/file-utils.h"
-
-#include "plug-in/gimppluginmanager.h"
-
-#include "core/gimp.h"
-#include "core/gimpchannel.h"
-#include "core/gimpcontext.h"
-#include "core/gimpimage.h"
-#include "core/gimplayer.h"
-#include "core/gimptoolinfo.h"
-#include "core/gimptooloptions.h"
+#include "display/gimpdisplay.h"
+#include "display/gimpdisplayshell.h"
+#include "display/gimpdisplayshell-scale.h"
+#include "display/gimpdisplayshell-transform.h"
+#include "display/gimpimagewindow.h"
 
 #include "tests.h"
 
@@ -218,9 +218,10 @@ saved_imported_file_files (gconstpointer data)
   g_object_unref (import_file);
 
   /* Save */
-  proc = file_procedure_find (image->gimp->plug_in_manager->save_procs,
-                              save_file,
-                              NULL /*error*/);
+  proc = gimp_plug_in_manager_file_procedure_find (image->gimp->plug_in_manager,
+                                                   GIMP_FILE_PROCEDURE_GROUP_SAVE,
+                                                   save_file,
+                                                   NULL /*error*/);
   file_save (gimp,
              image,
              NULL /*progress*/,
@@ -261,9 +262,10 @@ exported_file_files (gconstpointer data)
   save_file = g_file_new_for_path (save_filename);
   g_free (save_filename);
 
-  proc = file_procedure_find (image->gimp->plug_in_manager->export_procs,
-                              save_file,
-                              NULL /*error*/);
+  proc = gimp_plug_in_manager_file_procedure_find (image->gimp->plug_in_manager,
+                                                   GIMP_FILE_PROCEDURE_GROUP_EXPORT,
+                                                   save_file,
+                                                   NULL /*error*/);
   file_save (gimp,
              image,
              NULL /*progress*/,
@@ -331,9 +333,10 @@ clear_import_file_after_export (gconstpointer data)
   save_file = g_file_new_for_path (save_filename);
   g_free (save_filename);
 
-  proc = file_procedure_find (image->gimp->plug_in_manager->export_procs,
-                              save_file,
-                              NULL /*error*/);
+  proc = gimp_plug_in_manager_file_procedure_find (image->gimp->plug_in_manager,
+                                                   GIMP_FILE_PROCEDURE_GROUP_EXPORT,
+                                                   save_file,
+                                                   NULL /*error*/);
   file_save (gimp,
              image,
              NULL /*progress*/,
diff --git a/app/tests/test-xcf.c b/app/tests/test-xcf.c
index ba54931..1e27a70 100644
--- a/app/tests/test-xcf.c
+++ b/app/tests/test-xcf.c
@@ -15,10 +15,11 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "config.h"
+
 #include <string.h>
 
 #include <gegl.h>
-
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
@@ -47,12 +48,11 @@
 #include "vectors/gimpbezierstroke.h"
 #include "vectors/gimpvectors.h"
 
+#include "plug-in/gimppluginmanager-file.h"
+
 #include "file/file-open.h"
-#include "file/file-procedure.h"
 #include "file/file-save.h"
 
-#include "plug-in/gimppluginmanager.h"
-
 #include "tests.h"
 
 #include "gimp-app-test-utils.h"
@@ -254,9 +254,10 @@ gimp_test_load_image (Gimp  *gimp,
   GimpImage           *image;
   GimpPDBStatusType    unused;
 
-  proc = file_procedure_find (gimp->plug_in_manager->load_procs,
-                              file,
-                              NULL /*error*/);
+  proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+                                                   GIMP_FILE_PROCEDURE_GROUP_OPEN,
+                                                   file,
+                                                   NULL /*error*/);
   image = file_open_image (gimp,
                            gimp_get_user_context (gimp),
                            NULL /*progress*/,
@@ -309,9 +310,10 @@ gimp_write_and_read_file (Gimp     *gimp,
   file = g_file_new_for_path (filename);
   g_free (filename);
 
-  proc = file_procedure_find (image->gimp->plug_in_manager->save_procs,
-                              file,
-                              NULL /*error*/);
+  proc = gimp_plug_in_manager_file_procedure_find (image->gimp->plug_in_manager,
+                                                   GIMP_FILE_PROCEDURE_GROUP_SAVE,
+                                                   file,
+                                                   NULL /*error*/);
   file_save (gimp,
              image,
              NULL /*progress*/,
@@ -807,7 +809,7 @@ gimp_assert_mainimage (GimpImage *image,
   g_assert (iter == NULL);
 
   /* Sample points, we rely on the same ordering as when we added
-   * them, although this ordering is not a necessaity
+   * them, although this ordering is not a necessity
    */
   iter = gimp_image_get_sample_points (image);
   g_assert (iter != NULL);
diff --git a/app/widgets/gimpdnd-xds.c b/app/widgets/gimpdnd-xds.c
index 7e45a8c..45d26b2 100644
--- a/app/widgets/gimpdnd-xds.c
+++ b/app/widgets/gimpdnd-xds.c
@@ -39,13 +39,12 @@
 #include "widgets-types.h"
 
 #include "core/gimp.h"
+#include "core/gimp-utils.h"
 #include "core/gimpimage.h"
 
-#include "plug-in/gimppluginmanager.h"
+#include "plug-in/gimppluginmanager-file.h"
 
-#include "file/file-procedure.h"
 #include "file/file-save.h"
-#include "file/file-utils.h"
 
 #include "gimpdnd-xds.h"
 #include "gimpfiledialog.h"
@@ -95,7 +94,7 @@ gimp_dnd_xds_source_set (GdkDragContext *context,
 
       if (file)
         {
-          GFile *xcf_file = file_utils_file_with_new_ext (file, untitled);
+          GFile *xcf_file = gimp_file_with_new_extension (file, untitled);
           basename = g_file_get_basename (xcf_file);
           g_object_unref (xcf_file);
         }
@@ -153,12 +152,14 @@ gimp_dnd_xds_save_image (GdkDragContext   *context,
 
   file = g_file_new_for_uri (uri);
 
-  proc = file_procedure_find (image->gimp->plug_in_manager->save_procs,
-                              file, NULL);
+  proc = gimp_plug_in_manager_file_procedure_find (image->gimp->plug_in_manager,
+                                                   GIMP_FILE_PROCEDURE_GROUP_SAVE,
+                                                   file, NULL);
   if (! proc)
     {
-      proc = file_procedure_find (image->gimp->plug_in_manager->export_procs,
-                                  file, NULL);
+      proc = gimp_plug_in_manager_file_procedure_find (image->gimp->plug_in_manager,
+                                                       GIMP_FILE_PROCEDURE_GROUP_EXPORT,
+                                                       file, NULL);
       export = TRUE;
     }
 
diff --git a/app/widgets/gimpexportdialog.c b/app/widgets/gimpexportdialog.c
index 545c07f..5cb5143 100644
--- a/app/widgets/gimpexportdialog.c
+++ b/app/widgets/gimpexportdialog.c
@@ -31,9 +31,9 @@
 #include "widgets-types.h"
 
 #include "core/gimp.h"
+#include "core/gimp-utils.h"
 #include "core/gimpimage.h"
 
-#include "file/file-utils.h"
 #include "file/gimp-file.h"
 
 #include "pdb/gimppdb.h"
@@ -191,7 +191,7 @@ gimp_export_dialog_set_image (GimpExportDialog *dialog,
 
   if (ext_file)
     {
-      GFile *tmp_file = file_utils_file_with_new_ext (name_file, ext_file);
+      GFile *tmp_file = gimp_file_with_new_extension (name_file, ext_file);
       basename = g_path_get_basename (gimp_file_get_utf8_name (tmp_file));
       g_object_unref (tmp_file);
       g_object_unref (ext_file);
diff --git a/app/widgets/gimpimagepropview.c b/app/widgets/gimpimagepropview.c
index 9579a72..9b28e76 100644
--- a/app/widgets/gimpimagepropview.c
+++ b/app/widgets/gimpimagepropview.c
@@ -37,9 +37,7 @@
 #include "core/gimpundostack.h"
 #include "core/gimp-utils.h"
 
-#include "file/file-procedure.h"
-
-#include "plug-in/gimppluginmanager.h"
+#include "plug-in/gimppluginmanager-file.h"
 #include "plug-in/gimppluginprocedure.h"
 
 #include "gimpimagepropview.h"
@@ -356,20 +354,20 @@ static void
 gimp_image_prop_view_label_set_filetype (GtkWidget *label,
                                          GimpImage *image)
 {
-  GimpPlugInManager   *manager = image->gimp->plug_in_manager;
-  GimpPlugInProcedure *proc;
-
-  proc = gimp_image_get_save_proc (image);
+  GimpPlugInProcedure *proc = gimp_image_get_save_proc (image);
 
   if (! proc)
     proc = gimp_image_get_load_proc (image);
 
   if (! proc)
     {
-      GFile *file = gimp_image_get_file (image);
+      GimpPlugInManager *manager = image->gimp->plug_in_manager;
+      GFile             *file    = gimp_image_get_file (image);
 
       if (file)
-        proc = file_procedure_find (manager->load_procs, file, NULL);
+        proc = gimp_plug_in_manager_file_procedure_find (manager,
+                                                         GIMP_FILE_PROCEDURE_GROUP_OPEN,
+                                                         file, NULL);
     }
 
   gtk_label_set_text (GTK_LABEL (label),
diff --git a/app/widgets/gimpsavedialog.c b/app/widgets/gimpsavedialog.c
index 38820a6..0d0e25a 100644
--- a/app/widgets/gimpsavedialog.c
+++ b/app/widgets/gimpsavedialog.c
@@ -31,10 +31,10 @@
 #include "widgets-types.h"
 
 #include "core/gimp.h"
+#include "core/gimp-utils.h"
 #include "core/gimpimage.h"
 #include "core/gimpimage-metadata.h"
 
-#include "file/file-utils.h"
 #include "file/gimp-file.h"
 
 #include "pdb/gimppdb.h"
@@ -311,7 +311,7 @@ gimp_save_dialog_set_image (GimpSaveDialog *dialog,
 
   if (ext_file)
     {
-      GFile *tmp_file = file_utils_file_with_new_ext (name_file, ext_file);
+      GFile *tmp_file = gimp_file_with_new_extension (name_file, ext_file);
       basename = g_path_get_basename (gimp_file_get_utf8_name (tmp_file));
       g_object_unref (tmp_file);
       g_object_unref (ext_file);
diff --git a/app/widgets/gimpthumbbox.c b/app/widgets/gimpthumbbox.c
index 345fb4b..78ab83b 100644
--- a/app/widgets/gimpthumbbox.c
+++ b/app/widgets/gimpthumbbox.c
@@ -36,9 +36,7 @@
 #include "core/gimpprogress.h"
 #include "core/gimpsubprogress.h"
 
-#include "plug-in/gimppluginmanager.h"
-
-#include "file/file-procedure.h"
+#include "plug-in/gimppluginmanager-file.h"
 
 #include "gimpfiledialog.h" /* eek */
 #include "gimpthumbbox.h"
@@ -727,8 +725,9 @@ gimp_thumb_box_auto_thumbnail (GimpThumbBox *box)
     case GIMP_THUMB_STATE_OLD:
       if (thumb->image_filesize < gimp->config->thumbnail_filesize_limit &&
           ! gimp_thumbnail_has_failed (thumb)                            &&
-          file_procedure_find_by_extension (gimp->plug_in_manager->load_procs,
-                                            file))
+          gimp_plug_in_manager_file_procedure_find_by_extension (gimp->plug_in_manager,
+                                                                 GIMP_FILE_PROCEDURE_GROUP_OPEN,
+                                                                 file))
         {
           if (thumb->image_filesize > 0)
             {
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a1f1fc2..9979dfd 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -238,7 +238,6 @@ app/display/gimpnavigationeditor.c
 app/display/gimpstatusbar.c
 
 app/file/file-open.c
-app/file/file-procedure.c
 app/file/file-remote.c
 app/file/file-save.c
 app/file/file-utils.c
@@ -324,6 +323,7 @@ app/plug-in/gimpplugin-message.c
 app/plug-in/gimpplugin-progress.c
 app/plug-in/gimppluginmanager.c
 app/plug-in/gimppluginmanager-call.c
+app/plug-in/gimppluginmanager-file-procedure.c
 app/plug-in/gimppluginmanager-restore.c
 app/plug-in/gimppluginprocedure.c
 app/plug-in/gimppluginprocframe.c
diff --git a/tools/pdbgen/pdb/fileops.pdb b/tools/pdbgen/pdb/fileops.pdb
index 5fa4a70..02eac06 100644
--- a/tools/pdbgen/pdb/fileops.pdb
+++ b/tools/pdbgen/pdb/fileops.pdb
@@ -65,8 +65,9 @@ HELP
     return gimp_procedure_get_return_values (procedure, FALSE,
                                              error ? *error : NULL);
 
-  file_proc = file_procedure_find (gimp->plug_in_manager->load_procs,
-                                   file, error);
+  file_proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+                                                        GIMP_FILE_PROCEDURE_GROUP_OPEN,
+                                                        file, error);
 
   if (! file_proc)
     {
@@ -300,12 +301,14 @@ HELP
     return gimp_procedure_get_return_values (procedure, FALSE,
                                              error ? *error : NULL);
 
-  file_proc = file_procedure_find (gimp->plug_in_manager->save_procs,
-                                   file, NULL);
+  file_proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+                                                        GIMP_FILE_PROCEDURE_GROUP_SAVE,
+                                                        file, NULL);
 
   if (! file_proc)
-    file_proc = file_procedure_find (gimp->plug_in_manager->export_procs,
-                                     file, error);
+    file_proc = gimp_plug_in_manager_file_procedure_find (gimp->plug_in_manager,
+                                                          GIMP_FILE_PROCEDURE_GROUP_EXPORT,
+                                                          file, error);
 
   if (! file_proc)
     {
@@ -688,12 +691,10 @@ CODE
               "libgimpconfig/gimpconfig.h"
               "core/gimp.h"
               "core/gimp-utils.h"
-              "plug-in/gimppluginmanager.h"
               "plug-in/gimppluginmanager-file.h"
               "plug-in/gimppluginprocedure.h"
               "file/file-open.h"
               "file/file-save.h"
-             "file/file-procedure.h"
               "file/file-utils.h");
 
 @procs = qw(file_load


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