[gegl] handlers: Rename gegl_extension_handler_register()



commit 70e7902c07af565fcbdef255324224e79402614b
Author: Martin Blanchard <tchaik gmx com>
Date:   Tue Dec 29 12:40:09 2015 +0100

    handlers: Rename gegl_extension_handler_register()
    
    Rename gegl_extension_handler_register() to
    gegl_extension_handler_register_loader() and
    gegl_extension_handler_get() to gegl_extension_handler_get_loader().
    Old function are kept for API compatibility reasons.
    
    Marked as TODO since May 2010. Remove todo.txt as it was the only/last
    identified entry.

 docs/todo.txt                           |    6 ------
 gegl/operation/gegl-extension-handler.c |   13 +++++++++++++
 gegl/operation/gegl-extension-handler.h |   26 ++++++++++++++++++++------
 operations/common/dcraw-load.c          |    6 +++---
 operations/common/gegl-buffer-load-op.c |    2 +-
 operations/common/load.c                |    4 ++--
 operations/external/exr-load.cpp        |    2 +-
 operations/external/jp2-load.c          |    4 ++--
 operations/external/jpg-load.c          |    4 ++--
 operations/external/png-load.c          |    2 +-
 operations/external/ppm-load.c          |    6 +++---
 operations/external/raw-load.c          |   16 ++++++++--------
 operations/external/rgbe-load.c         |    4 ++--
 operations/external/svg-load.c          |    4 ++--
 operations/external/tiff-load.c         |    4 ++--
 operations/external/webp-load.c         |    2 +-
 operations/workshop/rawbayer-load.c     |    4 ++--
 tests/simple/test-misc.c                |    4 ++--
 18 files changed, 67 insertions(+), 46 deletions(-)
---
diff --git a/gegl/operation/gegl-extension-handler.c b/gegl/operation/gegl-extension-handler.c
index 3cdf70a..6c080ce 100644
--- a/gegl/operation/gegl-extension-handler.c
+++ b/gegl/operation/gegl-extension-handler.c
@@ -42,6 +42,13 @@ void
 gegl_extension_handler_register (const gchar *extension,
                                  const gchar *handler)
 {
+  gegl_extension_handler_register_loader (extension, handler);
+}
+
+void
+gegl_extension_handler_register_loader (const gchar *extension,
+                                        const gchar *handler)
+{
   gegl_extension_handler_register_util (&load_handlers, extension, handler);
 }
 
@@ -81,6 +88,12 @@ gegl_extension_handler_get_util (GHashTable *handlers,
 const gchar *
 gegl_extension_handler_get (const gchar *extension)
 {
+  return gegl_extension_handler_get_loader (extension);
+}
+
+const gchar *
+gegl_extension_handler_get_loader (const gchar *extension)
+{
   return gegl_extension_handler_get_util (load_handlers,
                                           extension,
                                           "loader",
diff --git a/gegl/operation/gegl-extension-handler.h b/gegl/operation/gegl-extension-handler.h
index 1a86f3a..a32c2df 100644
--- a/gegl/operation/gegl-extension-handler.h
+++ b/gegl/operation/gegl-extension-handler.h
@@ -19,11 +19,25 @@
 #ifndef __GEGL_EXTENSION_HANDLER_H__
 #define __GEGL_EXTENSION_HANDLER_H__
 
-void          gegl_extension_handler_register       (const gchar *extension,
-                                                     const gchar *handler);
-void          gegl_extension_handler_register_saver (const gchar *extension,
-                                                     const gchar *handler);
-const gchar * gegl_extension_handler_get            (const gchar *extension);
-const gchar * gegl_extension_handler_get_saver      (const gchar *extension);
+/* similar to gegl_extension_handler_register_loader(), kept for
+ * compatibility reasons, do NOT use in newly written code.
+ * TODO: remove this function in future versions!
+ */
+void          gegl_extension_handler_register        (const gchar *extension,
+                                                      const gchar *handler);
+
+void          gegl_extension_handler_register_loader (const gchar *extension,
+                                                      const gchar *handler);
+void          gegl_extension_handler_register_saver  (const gchar *extension,
+                                                      const gchar *handler);
+
+/* similar to gegl_extension_handler_get_loader(), kept for
+ * compatibility reasons, do NOT use in newly written code.
+ * TODO: remove this function in future versions!
+ */
+const gchar * gegl_extension_handler_get             (const gchar *extension);
+
+const gchar * gegl_extension_handler_get_loader      (const gchar *extension);
+const gchar * gegl_extension_handler_get_saver       (const gchar *extension);
 
 #endif
diff --git a/operations/common/dcraw-load.c b/operations/common/dcraw-load.c
index ea57e55..832000c 100644
--- a/operations/common/dcraw-load.c
+++ b/operations/common/dcraw-load.c
@@ -183,9 +183,9 @@ gegl_op_class_init (GeglOpClass *klass)
           _("Raw image loader, wrapping dcraw with pipes."),
     NULL);
 
-  gegl_extension_handler_register (".raw", "gegl:dcraw-load");
-  gegl_extension_handler_register (".raf", "gegl:dcraw-load");
-  gegl_extension_handler_register (".nef", "gegl:dcraw-load");
+  gegl_extension_handler_register_loader (".raw", "gegl:dcraw-load");
+  gegl_extension_handler_register_loader (".raf", "gegl:dcraw-load");
+  gegl_extension_handler_register_loader (".nef", "gegl:dcraw-load");
 }
 
 #endif
diff --git a/operations/common/gegl-buffer-load-op.c b/operations/common/gegl-buffer-load-op.c
index bebff26..cc05860 100644
--- a/operations/common/gegl-buffer-load-op.c
+++ b/operations/common/gegl-buffer-load-op.c
@@ -89,7 +89,7 @@ gegl_op_class_init (GeglOpClass *klass)
     "description", _("GeglBuffer file loader."),
     NULL);
 
-  gegl_extension_handler_register (".gegl", "gegl:gegl-buffer-load");
+  gegl_extension_handler_register_loader (".gegl", "gegl:gegl-buffer-load");
 }
 
 #endif
diff --git a/operations/common/load.c b/operations/common/load.c
index 06060d5..317cab9 100644
--- a/operations/common/load.c
+++ b/operations/common/load.c
@@ -83,7 +83,7 @@ do_setup (GeglOperation *operation, const gchar *new_path, const gchar *new_uri)
             extension = g_strdup(strrchr (new_uri, '.'));
 
         if (extension)
-            handler = gegl_extension_handler_get (extension);
+            handler = gegl_extension_handler_get_loader (extension);
         gegl_node_set (self->load, "operation", handler, NULL);
         gegl_node_set (self->load, "uri", new_uri, NULL);
 
@@ -111,7 +111,7 @@ do_setup (GeglOperation *operation, const gchar *new_path, const gchar *new_uri)
       else
         {
           if (extension)
-            handler = gegl_extension_handler_get (extension);
+            handler = gegl_extension_handler_get_loader (extension);
           gegl_node_set (self->load,
                          "operation", handler,
                          NULL);
diff --git a/operations/external/exr-load.cpp b/operations/external/exr-load.cpp
index 0961ba8..4183d9c 100644
--- a/operations/external/exr-load.cpp
+++ b/operations/external/exr-load.cpp
@@ -684,7 +684,7 @@ gegl_op_class_init (GeglOpClass *klass)
     "categories"  , "hidden",
     "description" , "EXR image loader.", NULL);
 
-  gegl_extension_handler_register (".exr", "gegl:exr-load");
+  gegl_extension_handler_register_loader (".exr", "gegl:exr-load");
 }
 
 #endif
diff --git a/operations/external/jp2-load.c b/operations/external/jp2-load.c
index 6ee8461..12cb238 100644
--- a/operations/external/jp2-load.c
+++ b/operations/external/jp2-load.c
@@ -399,8 +399,8 @@ gegl_op_class_init (GeglOpClass *klass)
     "description", _("JPEG 2000 image loader using jasper."),
     NULL);
 
-  gegl_extension_handler_register (".jp2", "gegl:jp2-load");
-  gegl_extension_handler_register (".jpx", "gegl:jp2-load");
+  gegl_extension_handler_register_loader (".jp2", "gegl:jp2-load");
+  gegl_extension_handler_register_loader (".jpx", "gegl:jp2-load");
 }
 
 #endif
diff --git a/operations/external/jpg-load.c b/operations/external/jpg-load.c
index 93bb14c..80cfc35 100644
--- a/operations/external/jpg-load.c
+++ b/operations/external/jpg-load.c
@@ -370,8 +370,8 @@ gegl_op_class_init (GeglOpClass *klass)
 /*  static gboolean done=FALSE;
     if (done)
       return; */
-  gegl_extension_handler_register (".jpg", "gegl:jpg-load");
-  gegl_extension_handler_register (".jpeg", "gegl:jpg-load");
+  gegl_extension_handler_register_loader (".jpg", "gegl:jpg-load");
+  gegl_extension_handler_register_loader (".jpeg", "gegl:jpg-load");
 /*  done = TRUE; */
 }
 #endif
diff --git a/operations/external/png-load.c b/operations/external/png-load.c
index fd28da4..0761453 100644
--- a/operations/external/png-load.c
+++ b/operations/external/png-load.c
@@ -502,7 +502,7 @@ gegl_op_class_init (GeglOpClass *klass)
 /*  static gboolean done=FALSE;
     if (done)
       return; */
-  gegl_extension_handler_register (".png", "gegl:png-load");
+  gegl_extension_handler_register_loader (".png", "gegl:png-load");
 /*  done = TRUE; */
 }
 
diff --git a/operations/external/ppm-load.c b/operations/external/ppm-load.c
index fe6bf2d..1552e19 100644
--- a/operations/external/ppm-load.c
+++ b/operations/external/ppm-load.c
@@ -383,9 +383,9 @@ gegl_op_class_init (GeglOpClass *klass)
     "description",  _("PPM image loader."),
     NULL);
 
-  gegl_extension_handler_register (".ppm", "gegl:ppm-load");
-  gegl_extension_handler_register (".pgm", "gegl:ppm-load");
-  gegl_extension_handler_register (".pnm", "gegl:ppm-load");
+  gegl_extension_handler_register_loader (".ppm", "gegl:ppm-load");
+  gegl_extension_handler_register_loader (".pgm", "gegl:ppm-load");
+  gegl_extension_handler_register_loader (".pnm", "gegl:ppm-load");
 }
 
 #endif
diff --git a/operations/external/raw-load.c b/operations/external/raw-load.c
index 85eb7c1..8c48cbd 100644
--- a/operations/external/raw-load.c
+++ b/operations/external/raw-load.c
@@ -244,14 +244,14 @@ gegl_op_class_init (GeglOpClass *klass)
     return;
 
   /* query libopenraw instead. need a new API */
-  gegl_extension_handler_register (".pef", "gegl:raw-load");
-  gegl_extension_handler_register (".nef", "gegl:raw-load");
-  gegl_extension_handler_register (".raf", "gegl:raw-load");
-  gegl_extension_handler_register (".orf", "gegl:raw-load");
-  gegl_extension_handler_register (".erf", "gegl:raw-load");
-  gegl_extension_handler_register (".mrw", "gegl:raw-load");
-  gegl_extension_handler_register (".crw", "gegl:raw-load");
-  gegl_extension_handler_register (".cr2", "gegl:raw-load");
+  gegl_extension_handler_register_loader (".pef", "gegl:raw-load");
+  gegl_extension_handler_register_loader (".nef", "gegl:raw-load");
+  gegl_extension_handler_register_loader (".raf", "gegl:raw-load");
+  gegl_extension_handler_register_loader (".orf", "gegl:raw-load");
+  gegl_extension_handler_register_loader (".erf", "gegl:raw-load");
+  gegl_extension_handler_register_loader (".mrw", "gegl:raw-load");
+  gegl_extension_handler_register_loader (".crw", "gegl:raw-load");
+  gegl_extension_handler_register_loader (".cr2", "gegl:raw-load");
 
   done = TRUE;
 }
diff --git a/operations/external/rgbe-load.c b/operations/external/rgbe-load.c
index 2c07f45..f3af9da 100644
--- a/operations/external/rgbe-load.c
+++ b/operations/external/rgbe-load.c
@@ -137,8 +137,8 @@ gegl_op_class_init (GeglOpClass *klass)
     "description" , _("RGBE image loader (Radiance HDR format)."),
     NULL);
 
-  gegl_extension_handler_register (".hdr", "gegl:rgbe-load");
-  gegl_extension_handler_register (".pic", "gegl:rgbe-load");
+  gegl_extension_handler_register_loader (".hdr", "gegl:rgbe-load");
+  gegl_extension_handler_register_loader (".pic", "gegl:rgbe-load");
 }
 
 #endif
diff --git a/operations/external/svg-load.c b/operations/external/svg-load.c
index 058c7d4..cbfb838 100644
--- a/operations/external/svg-load.c
+++ b/operations/external/svg-load.c
@@ -182,8 +182,8 @@ gegl_op_class_init (GeglOpClass *klass)
     "description" , _("Load an SVG file using librsvg"),
     NULL);
 
-  gegl_extension_handler_register (".svg", "gegl:svg-load");
-  gegl_extension_handler_register (".svgz", "gegl:svg-load");
+  gegl_extension_handler_register_loader (".svg", "gegl:svg-load");
+  gegl_extension_handler_register_loader (".svgz", "gegl:svg-load");
 }
 
 #endif
diff --git a/operations/external/tiff-load.c b/operations/external/tiff-load.c
index 66a99e0..aaa6c10 100644
--- a/operations/external/tiff-load.c
+++ b/operations/external/tiff-load.c
@@ -839,8 +839,8 @@ gegl_op_class_init(GeglOpClass *klass)
     "description", _("TIFF image loader using libtiff"),
     NULL);
 
-  gegl_extension_handler_register(".tiff", "gegl:tiff-load");
-  gegl_extension_handler_register(".tif", "gegl:tiff-load");
+  gegl_extension_handler_register_loader(".tiff", "gegl:tiff-load");
+  gegl_extension_handler_register_loader(".tif", "gegl:tiff-load");
 }
 
 #endif
diff --git a/operations/external/webp-load.c b/operations/external/webp-load.c
index 17d35ff..c661cfd 100644
--- a/operations/external/webp-load.c
+++ b/operations/external/webp-load.c
@@ -144,7 +144,7 @@ gegl_op_class_init (GeglOpClass *klass)
     "description" , _("WebP image loader."),
     NULL);
 
-  gegl_extension_handler_register (".webp", "gegl:webp-load");
+  gegl_extension_handler_register_loader (".webp", "gegl:webp-load");
 }
 
 #endif
diff --git a/operations/workshop/rawbayer-load.c b/operations/workshop/rawbayer-load.c
index 7f088da..c059b82 100644
--- a/operations/workshop/rawbayer-load.c
+++ b/operations/workshop/rawbayer-load.c
@@ -159,8 +159,8 @@ gegl_op_class_init (GeglOpClass *klass)
           " is apparently buggy)"),
         NULL);
 
-  gegl_extension_handler_register (".rawbayer", "gegl:rawbayer-load");
-  gegl_extension_handler_register (".rawbayerS", "gegl:rawbayer-load");
+  gegl_extension_handler_register_loader (".rawbayer", "gegl:rawbayer-load");
+  gegl_extension_handler_register_loader (".rawbayerS", "gegl:rawbayer-load");
 }
 
 #endif
diff --git a/tests/simple/test-misc.c b/tests/simple/test-misc.c
index 09afce1..bf461f4 100644
--- a/tests/simple/test-misc.c
+++ b/tests/simple/test-misc.c
@@ -32,10 +32,10 @@ test_misc_case_insensitive_extension_handler (void)
   const gchar *uppercase = "FOOEXT";
   const gchar *received_handler = NULL;
 
-  gegl_extension_handler_register (lowercase, handler);
+  gegl_extension_handler_register_loader (lowercase, handler);
 
   /* Make sure comparisions are case insensitive */
-  received_handler = gegl_extension_handler_get (uppercase);
+  received_handler = gegl_extension_handler_get_loader (uppercase);
   if (! strcmp (received_handler, handler) == 0)
     result = FAILURE;
 


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