diff options
author | Matthias Clasen <maclas@gmx.de> | 2004-07-08 03:56:36 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2004-07-08 03:56:36 +0000 |
commit | 2c08beafcfe608ce2deaae36339c7592e639497f (patch) | |
tree | 2a0a462372fa40c834098d269d4a4abe2c5e68e2 | |
parent | f141bf2b9fd624f822d74754dfdd9995a3092720 (diff) | |
download | gtk+-2c08beafcfe608ce2deaae36339c7592e639497f.tar.gz |
New functions to disable/enable individual loaders and to obtain license
Wed Jul 7 23:53:58 2004 Matthias Clasen <maclas@gmx.de>
* gdk-pixbuf-io.h:
* gdk-pixbuf-io.c (gdk_pixbuf_format_is_disabled):
* gdk-pixbuf-io.c (gdk_pixbuf_format_set_disabled):
* gdk-pixbuf-io.c (gdk_pixbuf_format_get_license):
New functions to disable/enable individual loaders and to
obtain license information about loaders.
* gdk-pixbuf-io.h (GdkPixbufFormat): Add disabled and
license fields.
* gdk-pixbuf-io.c (_gdk_pixbuf_get_module):
* gdk-pixbuf-io.c (_gdk_pixbuf_get_named_module): Skip
disabled loaders.
* io-*.c: Add license information in the fill_info
functions.
-rw-r--r-- | gdk-pixbuf/ChangeLog | 19 | ||||
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-io.c | 69 | ||||
-rw-r--r-- | gdk-pixbuf/gdk-pixbuf-io.h | 14 | ||||
-rw-r--r-- | gdk-pixbuf/io-ani.c | 1 | ||||
-rw-r--r-- | gdk-pixbuf/io-bmp.c | 1 | ||||
-rw-r--r-- | gdk-pixbuf/io-gif.c | 1 | ||||
-rw-r--r-- | gdk-pixbuf/io-ico.c | 1 | ||||
-rw-r--r-- | gdk-pixbuf/io-jpeg.c | 1 | ||||
-rw-r--r-- | gdk-pixbuf/io-pcx.c | 1 | ||||
-rw-r--r-- | gdk-pixbuf/io-png.c | 1 | ||||
-rw-r--r-- | gdk-pixbuf/io-pnm.c | 1 | ||||
-rw-r--r-- | gdk-pixbuf/io-ras.c | 1 | ||||
-rw-r--r-- | gdk-pixbuf/io-tga.c | 1 | ||||
-rw-r--r-- | gdk-pixbuf/io-tiff.c | 1 | ||||
-rw-r--r-- | gdk-pixbuf/io-wbmp.c | 1 | ||||
-rw-r--r-- | gdk-pixbuf/io-xbm.c | 1 | ||||
-rw-r--r-- | gdk-pixbuf/io-xpm.c | 1 |
17 files changed, 112 insertions, 4 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index b343174029..dcc570264c 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,22 @@ +Wed Jul 7 23:53:58 2004 Matthias Clasen <maclas@gmx.de> + + * gdk-pixbuf-io.h: + * gdk-pixbuf-io.c (gdk_pixbuf_format_is_disabled): + * gdk-pixbuf-io.c (gdk_pixbuf_format_set_disabled): + * gdk-pixbuf-io.c (gdk_pixbuf_format_get_license): + New functions to disable/enable individual loaders and to + obtain license information about loaders. + + * gdk-pixbuf-io.h (GdkPixbufFormat): Add disabled and + license fields. + + * gdk-pixbuf-io.c (_gdk_pixbuf_get_module): + * gdk-pixbuf-io.c (_gdk_pixbuf_get_named_module): Skip + disabled loaders. + + * io-*.c: Add license information in the fill_info + functions. + 2004-07-07 Matthias Clasen <mclasen@redhat.com> * gdk-pixbuf-features.h.in: Fix the build. diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c index 7cd9184569..c6a3ea1a2c 100644 --- a/gdk-pixbuf/gdk-pixbuf-io.c +++ b/gdk-pixbuf/gdk-pixbuf-io.c @@ -615,6 +615,10 @@ _gdk_pixbuf_get_named_module (const char *name, for (modules = get_file_formats (); modules; modules = g_slist_next (modules)) { GdkPixbufModule *module = (GdkPixbufModule *)modules->data; + + if (module->info->disabled) + continue; + if (!strcmp (name, module->module_name)) return module; } @@ -641,6 +645,10 @@ _gdk_pixbuf_get_module (guchar *buffer, guint size, for (modules = get_file_formats (); modules; modules = g_slist_next (modules)) { GdkPixbufModule *module = (GdkPixbufModule *)modules->data; + + if (module->info->disabled) + continue; + score = format_check (module, buffer, size); if (score > best) { best = score; @@ -1843,6 +1851,67 @@ gdk_pixbuf_format_is_scalable (GdkPixbufFormat *format) return (format->flags & GDK_PIXBUF_FORMAT_SCALABLE) != 0; } +/** + * gdk_pixbuf_format_is_disabled: + * @format: a #GdkPixbufFormat + * + * Returns whether this image format is disabled. See + * gdk_pixbuf_format_set_disabled(). + * + * Return value: whether this image format is disabled. + * + * Since: 2.6 + */ +gboolean +gdk_pixbuf_format_is_disabled (GdkPixbufFormat *format) +{ + g_return_val_if_fail (format != NULL, FALSE); + + return format->disabled; +} + +/** + * gdk_pixbuf_format_set_disabled: + * @format: a #GdkPixbufFormat + * @disabled: %TRUE to disable the format @format + * + * Disables or enables an image format. If a format is disabled, + * gdk-pixbuf won't use the image loader for this format to load + * images. Applications can use this to avoid using image loaders + * with an inappropriate license, see gdk_pixbuf_format_get_license(). + * + * Since: 2.6 + */ +void +gdk_pixbuf_format_set_disabled (GdkPixbufFormat *format, + gboolean disabled) +{ + g_return_val_if_fail (format != NULL, FALSE); + + format->disabled = disabled != FALSE; +} + +/** + * gdk_pixbuf_format_get_license: + * @format: a #GdkPixbufFormat + * + * Returns information about the license of the image loader + * for the format. The returned string should be a shorthand for + * a wellknown license, e.g. "LGPL", "GPL", "QPL", "GPL/QPL", + * or "other" to indicate some other license. + * + * Returns: a string describing the license of @format. + * + * Since: 2.6 + */ +gchar* +gdk_pixbuf_format_get_license (GdkPixbufFormat *format) +{ + g_return_val_if_fail (format != NULL, FALSE); + + return g_strdup (format->license); +} + GdkPixbufFormat * _gdk_pixbuf_get_format (GdkPixbufModule *module) { diff --git a/gdk-pixbuf/gdk-pixbuf-io.h b/gdk-pixbuf/gdk-pixbuf-io.h index 27a17b3a4b..3eafd5f82e 100644 --- a/gdk-pixbuf/gdk-pixbuf-io.h +++ b/gdk-pixbuf/gdk-pixbuf-io.h @@ -39,17 +39,21 @@ G_BEGIN_DECLS typedef struct _GdkPixbufFormat GdkPixbufFormat; -GSList *gdk_pixbuf_get_formats (void); +GSList *gdk_pixbuf_get_formats (void); gchar *gdk_pixbuf_format_get_name (GdkPixbufFormat *format); gchar *gdk_pixbuf_format_get_description (GdkPixbufFormat *format); gchar **gdk_pixbuf_format_get_mime_types (GdkPixbufFormat *format); gchar **gdk_pixbuf_format_get_extensions (GdkPixbufFormat *format); gboolean gdk_pixbuf_format_is_writable (GdkPixbufFormat *format); gboolean gdk_pixbuf_format_is_scalable (GdkPixbufFormat *format); +gboolean gdk_pixbuf_format_is_disabled (GdkPixbufFormat *format); +void gdk_pixbuf_format_set_disabled (GdkPixbufFormat *format, + gboolean disabled); +gchar *gdk_pixbuf_format_get_license (GdkPixbufFormat *format); -GdkPixbufFormat *gdk_pixbuf_get_file_info (const gchar *filename, - gint *width, - gint *height); +GdkPixbufFormat *gdk_pixbuf_get_file_info (const gchar *filename, + gint *width, + gint *height); #ifdef GDK_PIXBUF_ENABLE_BACKEND @@ -151,6 +155,8 @@ struct _GdkPixbufFormat { gchar **mime_types; gchar **extensions; guint32 flags; + gboolean disabled; + gchar *license; }; diff --git a/gdk-pixbuf/io-ani.c b/gdk-pixbuf/io-ani.c index 00a9fc11b3..5e7b6beb91 100644 --- a/gdk-pixbuf/io-ani.c +++ b/gdk-pixbuf/io-ani.c @@ -677,6 +677,7 @@ MODULE_ENTRY (ani, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = 0; + info->license = "LGPL"; } diff --git a/gdk-pixbuf/io-bmp.c b/gdk-pixbuf/io-bmp.c index d43bed95a5..d79e5be03c 100644 --- a/gdk-pixbuf/io-bmp.c +++ b/gdk-pixbuf/io-bmp.c @@ -1119,5 +1119,6 @@ MODULE_ENTRY (bmp, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = 0; + info->license = "LGPL"; } diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c index 8dd73bde05..7df855d9e5 100644 --- a/gdk-pixbuf/io-gif.c +++ b/gdk-pixbuf/io-gif.c @@ -1651,4 +1651,5 @@ MODULE_ENTRY (gif, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = 0; + info->license = "LGPL"; } diff --git a/gdk-pixbuf/io-ico.c b/gdk-pixbuf/io-ico.c index e19f86f8f7..a7bcbb4c71 100644 --- a/gdk-pixbuf/io-ico.c +++ b/gdk-pixbuf/io-ico.c @@ -1203,6 +1203,7 @@ MODULE_ENTRY (ico, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = GDK_PIXBUF_FORMAT_WRITABLE; + info->license = "LGPL"; } diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c index 82acc7d139..1a42feeb6b 100644 --- a/gdk-pixbuf/io-jpeg.c +++ b/gdk-pixbuf/io-jpeg.c @@ -1070,4 +1070,5 @@ MODULE_ENTRY (jpeg, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = GDK_PIXBUF_FORMAT_WRITABLE; + info->license = "LGPL"; } diff --git a/gdk-pixbuf/io-pcx.c b/gdk-pixbuf/io-pcx.c index 4904f3acf8..6b44174033 100644 --- a/gdk-pixbuf/io-pcx.c +++ b/gdk-pixbuf/io-pcx.c @@ -759,4 +759,5 @@ MODULE_ENTRY (pcx, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = 0; + info->license = "LGPL"; } diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c index 669cb7bfc5..df5417db30 100644 --- a/gdk-pixbuf/io-png.c +++ b/gdk-pixbuf/io-png.c @@ -995,4 +995,5 @@ MODULE_ENTRY (png, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = GDK_PIXBUF_FORMAT_WRITABLE; + info->license = "LGPL"; } diff --git a/gdk-pixbuf/io-pnm.c b/gdk-pixbuf/io-pnm.c index d65bb3da55..7d94014501 100644 --- a/gdk-pixbuf/io-pnm.c +++ b/gdk-pixbuf/io-pnm.c @@ -1083,4 +1083,5 @@ MODULE_ENTRY (pnm, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = 0; + info->license = "LGPL"; } diff --git a/gdk-pixbuf/io-ras.c b/gdk-pixbuf/io-ras.c index 40ba370d53..9fe936161e 100644 --- a/gdk-pixbuf/io-ras.c +++ b/gdk-pixbuf/io-ras.c @@ -544,5 +544,6 @@ MODULE_ENTRY (ras, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = 0; + info->license = "LGPL"; } diff --git a/gdk-pixbuf/io-tga.c b/gdk-pixbuf/io-tga.c index ef49e79315..f4102bdf20 100644 --- a/gdk-pixbuf/io-tga.c +++ b/gdk-pixbuf/io-tga.c @@ -996,4 +996,5 @@ MODULE_ENTRY (tga, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = 0; + info->license = "LGPL"; } diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c index 0acdd091da..72c50fc61f 100644 --- a/gdk-pixbuf/io-tiff.c +++ b/gdk-pixbuf/io-tiff.c @@ -626,4 +626,5 @@ MODULE_ENTRY (tiff, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = 0; + info->license = "LGPL"; } diff --git a/gdk-pixbuf/io-wbmp.c b/gdk-pixbuf/io-wbmp.c index afcad336f5..098c8c805d 100644 --- a/gdk-pixbuf/io-wbmp.c +++ b/gdk-pixbuf/io-wbmp.c @@ -369,4 +369,5 @@ MODULE_ENTRY (wbmp, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = 0; + info->license = "LGPL"; } diff --git a/gdk-pixbuf/io-xbm.c b/gdk-pixbuf/io-xbm.c index 060339d156..45d4be79ed 100644 --- a/gdk-pixbuf/io-xbm.c +++ b/gdk-pixbuf/io-xbm.c @@ -477,4 +477,5 @@ MODULE_ENTRY (xbm, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = 0; + info->license = "LGPL"; } diff --git a/gdk-pixbuf/io-xpm.c b/gdk-pixbuf/io-xpm.c index 40cd525f39..636d759e9a 100644 --- a/gdk-pixbuf/io-xpm.c +++ b/gdk-pixbuf/io-xpm.c @@ -1544,4 +1544,5 @@ MODULE_ENTRY (xpm, fill_info) (GdkPixbufFormat *info) info->mime_types = mime_types; info->extensions = extensions; info->flags = 0; + info->license = "LGPL"; } |