[gimp] app: prefer magic-less file procedures again when matching a filename



commit 6b4dd30fcad5c6a99a52efb575b465db58867469
Author: Michael Natterer <mitch gimp org>
Date:   Sun May 1 18:32:04 2016 +0200

    app: prefer magic-less file procedures again when matching a filename
    
    This essentially reverts 1bf8eef14f7678f77bd905cc1133d0fdf181ce4f
    which tried to prefer file procedured that are GIO-enabled over
    indirect loading via the file-uri plug-in. But file-uri is gone now so
    we can treat all file procedured the same again, restoring the
    original logic.
    
    Now a file procedure which specifies only an extension is again
    preferred over magic matching.

 app/plug-in/gimppluginmanager-file-procedure.c |   37 ++++-------------------
 1 files changed, 7 insertions(+), 30 deletions(-)
---
diff --git a/app/plug-in/gimppluginmanager-file-procedure.c b/app/plug-in/gimppluginmanager-file-procedure.c
index 499defd..581b89e 100644
--- a/app/plug-in/gimppluginmanager-file-procedure.c
+++ b/app/plug-in/gimppluginmanager-file-procedure.c
@@ -54,8 +54,7 @@ static GimpPlugInProcedure * file_proc_find_by_prefix    (GSList       *procs,
                                                           gboolean      skip_magic);
 static GimpPlugInProcedure * file_proc_find_by_extension (GSList       *procs,
                                                           GFile        *file,
-                                                          gboolean      skip_magic,
-                                                          gboolean      uri_procs_only);
+                                                          gboolean      skip_magic);
 static GimpPlugInProcedure * file_proc_find_by_name      (GSList       *procs,
                                                           GFile        *file,
                                                           gboolean      skip_magic);
@@ -93,23 +92,8 @@ file_procedure_find (GSList  *procs,
   g_return_val_if_fail (G_IS_FILE (file), NULL);
   g_return_val_if_fail (error == NULL || *error == NULL, NULL);
 
-  /* First, check magicless prefixes/suffixes: */
-
-  if (! file_proc_find_by_extension (procs, file, FALSE, TRUE))
-    {
-      /* If there is not any (with or without magic) file proc that
-       * can load the file by extension directly, try to find a proc
-       * that can load the prefix
-       */
-      file_proc = file_proc_find_by_prefix (procs, file, TRUE);
-    }
-  else
-    {
-      /* Otherwise try to find a magicless file proc that handles the
-       * extension
-       */
-      file_proc = file_proc_find_by_extension (procs, file, TRUE, FALSE);
-    }
+  /* First, check magicless prefixes/suffixes */
+  file_proc = file_proc_find_by_name (procs, file, TRUE);
 
   if (file_proc)
     return file_proc;
@@ -237,7 +221,7 @@ file_procedure_find_by_extension (GSList *procs,
 {
   g_return_val_if_fail (G_IS_FILE (file), NULL);
 
-  return file_proc_find_by_extension (procs, file, FALSE, FALSE);
+  return file_proc_find_by_extension (procs, file, FALSE);
 }
 
 GimpPlugInProcedure *
@@ -298,8 +282,7 @@ file_proc_find_by_prefix (GSList   *procs,
 static GimpPlugInProcedure *
 file_proc_find_by_extension (GSList   *procs,
                              GFile    *file,
-                             gboolean  skip_magic,
-                             gboolean  uri_procs_only)
+                             gboolean  skip_magic)
 {
   gchar *ext = gimp_file_get_extension (file);
 
@@ -311,9 +294,6 @@ file_proc_find_by_extension (GSList   *procs,
         {
           GimpPlugInProcedure *proc = p->data;
 
-          if (uri_procs_only && ! proc->handles_uri)
-            continue;
-
           if (skip_magic && proc->magics_list)
             continue;
 
@@ -340,13 +320,10 @@ file_proc_find_by_name (GSList   *procs,
 {
   GimpPlugInProcedure *proc;
 
-  proc = file_proc_find_by_extension (procs, file, skip_magic, TRUE);
-
-  if (! proc)
-    proc = file_proc_find_by_prefix (procs, file, skip_magic);
+  proc = file_proc_find_by_prefix (procs, file, skip_magic);
 
   if (! proc)
-    proc = file_proc_find_by_extension (procs, file, skip_magic, FALSE);
+    proc = file_proc_find_by_extension (procs, file, skip_magic);
 
   return proc;
 }


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