Skip to content

Commit

Permalink
handlers: Rename gegl_extension_handler_register()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
t-chaik authored and hodefoting committed Dec 29, 2015
1 parent 089f144 commit 70e7902
Show file tree
Hide file tree
Showing 18 changed files with 67 additions and 46 deletions.
6 changes: 0 additions & 6 deletions docs/todo.txt

This file was deleted.

13 changes: 13 additions & 0 deletions gegl/operation/gegl-extension-handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ gegl_extension_handler_register_util (GHashTable **handlers,
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);
}
Expand Down Expand Up @@ -80,6 +87,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,
Expand Down
26 changes: 20 additions & 6 deletions gegl/operation/gegl-extension-handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions operations/common/dcraw-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion operations/common/gegl-buffer-load-op.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions operations/common/load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion operations/external/exr-load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions operations/external/jp2-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions operations/external/jpg-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion operations/external/png-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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; */
}

Expand Down
6 changes: 3 additions & 3 deletions operations/external/ppm-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 8 additions & 8 deletions operations/external/raw-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions operations/external/rgbe-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions operations/external/svg-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions operations/external/tiff-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion operations/external/webp-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions operations/workshop/rawbayer-load.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions tests/simple/test-misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 70e7902

Please sign in to comment.