Commit 80d4bf2b authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

Add built marshaller files to support GdkPixbufLoader signals

2001-01-22  Havoc Pennington  <hp@redhat.com>

	* Makefile.am: Add built marshaller files to support
	GdkPixbufLoader signals

	* gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
	GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
	module location, rather than acting as a fallback, because we are
	using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.

	* gdk-pixbuf.h: include gdk-pixbuf-loader.h

        * gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
	from gtk, and add error to close(), because stop_load may do
	parsing of the image.

	* pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file

        * io-*.c: make individual operations static, and add fill_vtable
	functions which are exported. Fix the collection of type warnings
	that surfaced, including a number of functions that didn't
	properly take a GError and some that weren't
	const-correct. Involved adding error handling for a few loaders.

	* gdk-pixbuf-io.h: Add error reporting to stop_load function

	* gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
	a function that fills in the GdkPixbufModule vtable, instead of
	looking up all the image functions individually; this means we
	can get type safety within modules for the loader functions.
	Also it means you don't have to keep the statically compiled and
	GModule versions in sync.

	* test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()

	* make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()

	* gdk-pixbuf.h: nuke gdk_pixbuf_init()

	* gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
	() here

	* gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here

	* gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
	g_type_init() here


2001-01-22  Havoc Pennington  <hp@redhat.com>

	* demos/testanimation.c: fix to reflect gdk-pixbuf changes

	* demos/testpixbuf.c: fix to reflect gdk-pixbuf changes

	* gtk/gdk-pixbuf-loader.c, gtk/gdk-pixbuf-loader.h:
	Remove, move back to gdk-pixbuf

	* gtk/gtktextiter.c, gtk/gtktextiter.h: add sentence equivalents
	to all the word functions

	* gtk/gtktextview.c (gtk_text_view_start_cursor_blink): return
	before doing anything on NULL layout or if we don't have the focus

	* gtk/testtext.c (fill_example_buffer): "justification"

	* gtk/gtktexttag.h, gtk/gtktexttag.c: change the tag attribute
	to be called "justification" not "justify"

	* demos/gtk-demo/textview.c (create_tags): "justification"

	* gtk/gtktextlayout.c (set_para_values): Handle char-wise wrapping
parent 90a5f4ca
...@@ -166,7 +166,7 @@ INCLUDES = -I$(top_srcdir) -I$(top_builddir) \ ...@@ -166,7 +166,7 @@ INCLUDES = -I$(top_srcdir) -I$(top_builddir) \
-I$(top_srcdir)/gdk-pixbuf \ -I$(top_srcdir)/gdk-pixbuf \
-I$(top_builddir)/gdk-pixbuf \ -I$(top_builddir)/gdk-pixbuf \
@INCLUDED_LOADER_DEFINE@ \ @INCLUDED_LOADER_DEFINE@ \
$(GLIB_CFLAGS) @GLIB_CFLAGS@
AM_CPPFLAGS = "-DPIXBUF_LIBDIR=\"$(loaderdir)\"" AM_CPPFLAGS = "-DPIXBUF_LIBDIR=\"$(loaderdir)\""
LDADDS = libgdk_pixbuf-1.3.la $(GLIB_LIBS) $(STATIC_LIB_DEPS) LDADDS = libgdk_pixbuf-1.3.la $(GLIB_LIBS) $(STATIC_LIB_DEPS)
...@@ -185,6 +185,8 @@ GDK_PIXBUF_LIBS = $(GLIB_LIBS) $(INTLLIBS) ...@@ -185,6 +185,8 @@ GDK_PIXBUF_LIBS = $(GLIB_LIBS) $(INTLLIBS)
# The GdkPixBuf library # The GdkPixBuf library
# #
BUILT_SOURCES=gdk-pixbuf-marshal.h gdk-pixbuf-marshal.c
libgdk_pixbufincludedir = $(includedir)/gtk-2.0/gdk-pixbuf libgdk_pixbufincludedir = $(includedir)/gtk-2.0/gdk-pixbuf
libgdk_pixbuf_1_3_la_SOURCES = \ libgdk_pixbuf_1_3_la_SOURCES = \
...@@ -193,6 +195,8 @@ libgdk_pixbuf_1_3_la_SOURCES = \ ...@@ -193,6 +195,8 @@ libgdk_pixbuf_1_3_la_SOURCES = \
gdk-pixbuf-animation.c \ gdk-pixbuf-animation.c \
gdk-pixbuf-data.c \ gdk-pixbuf-data.c \
gdk-pixbuf-io.c \ gdk-pixbuf-io.c \
gdk-pixbuf-loader.c \
gdk-pixbuf-marshal.h \
gdk-pixbuf-scale.c \ gdk-pixbuf-scale.c \
gdk-pixbuf-util.c gdk-pixbuf-util.c
...@@ -205,6 +209,7 @@ libgdk_pixbuf_1_3_la_DEPENDENCIES = $(builtin_objs) ...@@ -205,6 +209,7 @@ libgdk_pixbuf_1_3_la_DEPENDENCIES = $(builtin_objs)
libgdk_pixbufinclude_HEADERS = \ libgdk_pixbufinclude_HEADERS = \
gdk-pixbuf.h \ gdk-pixbuf.h \
gdk-pixbuf-loader.h \
gdk-pixbuf-features.h gdk-pixbuf-features.h
noinst_HEADERS = \ noinst_HEADERS = \
...@@ -227,3 +232,15 @@ EXTRA_DIST = \ ...@@ -227,3 +232,15 @@ EXTRA_DIST = \
pixbufloader_wbmp.def \ pixbufloader_wbmp.def \
pixbufloader_xbm.def pixbufloader_xbm.def
gdk-pixbuf-marshal.h: gdk-pixbuf-marshal.list
cd $(srcdir) \
&& glib-genmarshal --prefix=gdk_pixbuf_marshal gdk-pixbuf-marshal.list --header >> xgen-gmh \
&& (cmp -s xgen-gmh gdk-pixbuf-marshal.h || cp xgen-gmh gdk-pixbuf-marshal.h) \
&& rm -f xgen-gmh xgen-gmh~
gdk-pixbuf-marshal.c: gdk-pixbuf-marshal.list
cd $(srcdir) \
&& glib-genmarshal --prefix=gdk_pixbuf_marshal gdk-pixbuf-marshal.list --body >> xgen-gmh \
&& (cmp -s xgen-gmh gdk-pixbuf-marshal.c || cp xgen-gmh gdk-pixbuf-marshal.c) \
&& rm -f xgen-gmh xgen-gmh~
...@@ -50,7 +50,9 @@ gdk_pixbuf_animation_get_type (void) ...@@ -50,7 +50,9 @@ gdk_pixbuf_animation_get_type (void)
0, /* n_preallocs */ 0, /* n_preallocs */
(GInstanceInitFunc) NULL, (GInstanceInitFunc) NULL,
}; };
g_type_init ();
object_type = g_type_register_static (G_TYPE_OBJECT, object_type = g_type_register_static (G_TYPE_OBJECT,
"GdkPixbufAnimation", "GdkPixbufAnimation",
&object_info, 0); &object_info, 0);
...@@ -457,6 +459,8 @@ gdk_pixbuf_frame_get_type (void) ...@@ -457,6 +459,8 @@ gdk_pixbuf_frame_get_type (void)
if (our_type == 0) if (our_type == 0)
{ {
g_type_init ();
our_type = g_boxed_type_register_static ("GdkPixbufFrame", our_type = g_boxed_type_register_static ("GdkPixbufFrame",
gdk_pixbuf_frame_copy, gdk_pixbuf_frame_copy,
gdk_pixbuf_frame_free); gdk_pixbuf_frame_free);
......
...@@ -260,281 +260,173 @@ gdk_pixbuf_load_module (GdkPixbufModule *image_module, ...@@ -260,281 +260,173 @@ gdk_pixbuf_load_module (GdkPixbufModule *image_module,
char *module_name; char *module_name;
char *path; char *path;
GModule *module; GModule *module;
gpointer load_sym; gpointer sym;
gpointer save_sym;
char *name; char *name;
gboolean retval;
char *dir;
g_return_val_if_fail (image_module->module == NULL, FALSE); g_return_val_if_fail (image_module->module == NULL, FALSE);
name = image_module->module_name; name = image_module->module_name;
module_name = g_strconcat ("pixbufloader-", name, NULL); module_name = g_strconcat ("pixbufloader-", name, NULL);
path = g_module_build_path (PIXBUF_LIBDIR, module_name);
/* This would be an exploit in an suid binary using gdk-pixbuf,
module = g_module_open (path, G_MODULE_BIND_LAZY); * but see http://www.gtk.org/setuid.html or the BugTraq
if (!module) { * archives for why you should report this as a bug against
/* Debug feature, check in GDK_PIXBUF_MODULEDIR, or working directory */ * setuid apps using this library rather than the library
char *dir = g_getenv ("GDK_PIXBUF_MODULEDIR"); * itself.
if (!dir) */
dir = ""; dir = g_getenv ("GDK_PIXBUF_MODULEDIR");
g_free (path); if (dir == NULL || *dir == '\0') {
path = g_module_build_path (dir, module_name);
path = g_module_build_path (PIXBUF_LIBDIR, module_name);
module = g_module_open (path, G_MODULE_BIND_LAZY); module = g_module_open (path, G_MODULE_BIND_LAZY);
} else {
path = g_module_build_path (dir, module_name);
module = g_module_open (path, G_MODULE_BIND_LAZY);
}
if (!module) { if (!module) {
g_set_error (error, g_set_error (error,
GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED, GDK_PIXBUF_ERROR_FAILED,
_("Unable to load image-loading module: %s: %s"), _("Unable to load image-loading module: %s: %s"),
path, g_module_error ()); path, g_module_error ());
g_free (module_name); g_free (module_name);
g_free (path);
return FALSE;
}
g_free (path);
} else {
g_free (path); g_free (path);
return FALSE;
} }
g_free (module_name); g_free (module_name);
image_module->module = module; image_module->module = module;
if (pixbuf_module_symbol (module, name, "image_load", &load_sym)) if (pixbuf_module_symbol (module, name, "fill_vtable", &sym)) {
image_module->load = load_sym; ModuleFillVtableFunc func = sym;
(* func) (image_module);
if (pixbuf_module_symbol (module, name, "image_load_xpm_data", &load_sym)) retval = TRUE;
image_module->load_xpm_data = load_sym; } else {
g_set_error (error,
if (pixbuf_module_symbol (module, name, "image_begin_load", &load_sym)) GDK_PIXBUF_ERROR,
image_module->begin_load = load_sym; GDK_PIXBUF_ERROR_FAILED,
_("Image-loading module %s does not export the proper interface; perhaps it's from a different GTK version?"),
if (pixbuf_module_symbol (module, name, "image_stop_load", &load_sym)) path);
image_module->stop_load = load_sym; retval = FALSE;
}
if (pixbuf_module_symbol (module, name, "image_load_increment", &load_sym))
image_module->load_increment = load_sym;
if (pixbuf_module_symbol (module, name, "image_load_animation", &load_sym))
image_module->load_animation = load_sym;
if (pixbuf_module_symbol (module, name, "image_save", &save_sym)) g_free (path);
image_module->save = save_sym;
return TRUE; return retval;
} }
#else #else
#define mname(type,fn) gdk_pixbuf__ ## type ## _image_ ##fn #define mname(type,fn) gdk_pixbuf__ ## type ## _image_ ##fn
#define m_load(type) extern GdkPixbuf * mname(type,load) (FILE *f, GError **error); #define m_fill_vtable(type) extern void mname(type,fill_vtable) (GdkPixbufModule *module)
#define m_load_xpm_data(type) extern GdkPixbuf * mname(type,load_xpm_data) (const char **data);
#define m_begin_load(type) \ m_fill_vtable (png);
extern gpointer mname(type,begin_load) (ModulePreparedNotifyFunc prepare_func, \ m_fill_vtable (bmp);
ModuleUpdatedNotifyFunc update_func, \ m_fill_vtable (wbmp);
ModuleFrameDoneNotifyFunc frame_done_func,\ m_fill_vtable (gif);
ModuleAnimationDoneNotifyFunc anim_done_func,\ m_fill_vtable (ico);
gpointer user_data,\ m_fill_vtable (jpeg);
GError **error); m_fill_vtable (pnm);
#define m_stop_load(type) extern void mname(type,stop_load) (gpointer context); m_fill_vtable (ras);
#define m_load_increment(type) extern gboolean mname(type,load_increment) (gpointer context, const guchar *buf, guint size, GError **error); m_fill_vtable (tiff);
#define m_load_animation(type) extern GdkPixbufAnimation * mname(type,load_animation) (FILE *f, GError **error); m_fill_vtable (xpm);
#define m_save(type) \ m_fill_vtable (xbm);
extern gboolean mname(type,save) (FILE *f, \
GdkPixbuf *pixbuf, \
gchar **keys, \
gchar **values, \
GError **error);
/* PNG */
m_load (png);
m_begin_load (png);
m_load_increment (png);
m_stop_load (png);
m_save (png);
/* BMP */
m_load (bmp);
m_begin_load (bmp);
m_load_increment (bmp);
m_stop_load (bmp);
/* WBMP */
m_load (wbmp);
m_begin_load (wbmp);
m_load_increment (wbmp);
m_stop_load (wbmp);
/* GIF */
m_load (gif);
m_begin_load (gif);
m_load_increment (gif);
m_stop_load (gif);
m_load_animation (gif);
/* ICO */
m_load (ico);
m_begin_load (ico);
m_load_increment (ico);
m_stop_load (ico);
/* JPEG */
m_load (jpeg);
m_begin_load (jpeg);
m_load_increment (jpeg);
m_stop_load (jpeg);
m_save (jpeg);
/* PNM */
m_load (pnm);
m_begin_load (pnm);
m_load_increment (pnm);
m_stop_load (pnm);
/* RAS */
m_load (ras);
m_begin_load (ras);
m_load_increment (ras);
m_stop_load (ras);
/* TIFF */
m_load (tiff);
m_begin_load (tiff);
m_load_increment (tiff);
m_stop_load (tiff);
/* XPM */
m_load (xpm);
m_load_xpm_data (xpm);
/* XBM */
m_load (xbm);
m_begin_load (xbm);
m_load_increment (xbm);
m_stop_load (xbm);
gboolean gboolean
gdk_pixbuf_load_module (GdkPixbufModule *image_module, gdk_pixbuf_load_module (GdkPixbufModule *image_module,
GError **error) GError **error)
{ {
ModuleFillVtableFunc fill_vtable = NULL;
image_module->module = (void *) 1; image_module->module = (void *) 1;
if (FALSE) {
/* Ugly hack so we can use else if unconditionally below ;-) */
}
#ifdef INCLUDE_png #ifdef INCLUDE_png
if (strcmp (image_module->module_name, "png") == 0){ else if (strcmp (image_module->module_name, "png") == 0){
image_module->load = mname (png,load); fill_vtable = mname (png, fill_vtable);
image_module->begin_load = mname (png,begin_load);
image_module->load_increment = mname (png,load_increment);
image_module->stop_load = mname (png,stop_load);
image_module->save = mname (png,save);
return TRUE;
} }
#endif #endif
#ifdef INCLUDE_bmp #ifdef INCLUDE_bmp
if (strcmp (image_module->module_name, "bmp") == 0){ else if (strcmp (image_module->module_name, "bmp") == 0){
image_module->load = mname (bmp,load); fill_vtable = mname (bmp, fill_vtable);
image_module->begin_load = mname (bmp,begin_load);
image_module->load_increment = mname (bmp,load_increment);
image_module->stop_load = mname (bmp,stop_load);
return TRUE;
} }
#endif #endif
#ifdef INCLUDE_wbmp #ifdef INCLUDE_wbmp
if (strcmp (image_module->module_name, "wbmp") == 0){ else if (strcmp (image_module->module_name, "wbmp") == 0){
image_module->load = mname (wbmp,load); fill_vtable = mname (wbmp, fill_vtable);
image_module->begin_load = mname (wbmp,begin_load);
image_module->load_increment = mname (wbmp,load_increment);
image_module->stop_load = mname (wbmp,stop_load);
return TRUE;
} }
#endif #endif
#ifdef INCLUDE_gif #ifdef INCLUDE_gif
if (strcmp (image_module->module_name, "gif") == 0){ else if (strcmp (image_module->module_name, "gif") == 0){
image_module->load = mname (gif,load); fill_vtable = mname (gif, fill_vtable);
image_module->begin_load = mname (gif,begin_load);
image_module->load_increment = mname (gif,load_increment);
image_module->stop_load = mname (gif,stop_load);
image_module->load_animation = mname (gif,load_animation);
return TRUE;
} }
#endif #endif
#ifdef INCLUDE_ico #ifdef INCLUDE_ico
if (strcmp (image_module->module_name, "ico") == 0){ else if (strcmp (image_module->module_name, "ico") == 0){
image_module->load = mname (ico,load); fill_vtable = mname (ico, fill_vtable);
image_module->begin_load = mname (ico,begin_load);
image_module->load_increment = mname (ico,load_increment);
image_module->stop_load = mname (ico,stop_load);
return TRUE;
} }
#endif #endif
#ifdef INCLUDE_jpeg #ifdef INCLUDE_jpeg
if (strcmp (image_module->module_name, "jpeg") == 0){ else if (strcmp (image_module->module_name, "jpeg") == 0){
image_module->load = mname (jpeg,load); fill_vtable = mname (jpeg, fill_vtable);
image_module->begin_load = mname (jpeg,begin_load);
image_module->load_increment = mname (jpeg,load_increment);
image_module->stop_load = mname (jpeg,stop_load);
image_module->save = mname (jpeg,save);
return TRUE;
} }
#endif #endif
#ifdef INCLUDE_pnm #ifdef INCLUDE_pnm
if (strcmp (image_module->module_name, "pnm") == 0){ else if (strcmp (image_module->module_name, "pnm") == 0){
image_module->load = mname (pnm,load); fill_vtable = mname (pnm, fill_vtable);
image_module->begin_load = mname (pnm,begin_load);
image_module->load_increment = mname (pnm,load_increment);
image_module->stop_load = mname (pnm,stop_load);
return TRUE;
} }
#endif #endif
#ifdef INCLUDE_ras #ifdef INCLUDE_ras
if (strcmp (image_module->module_name, "ras") == 0){ else if (strcmp (image_module->module_name, "ras") == 0){
image_module->load = mname (ras,load); fill_vtable = mname (ras, fill_vtable);
image_module->begin_load = mname (ras,begin_load);
image_module->load_increment = mname (ras,load_increment);
image_module->stop_load = mname (ras,stop_load);
return TRUE;
} }
#endif #endif
#ifdef INCLUDE_tiff #ifdef INCLUDE_tiff
if (strcmp (image_module->module_name, "tiff") == 0){ else if (strcmp (image_module->module_name, "tiff") == 0){
image_module->load = mname (tiff,load); fill_vtable = mname (tiff, fill_vtable);
image_module->begin_load = mname (tiff,begin_load);
image_module->load_increment = mname (tiff,load_increment);
image_module->stop_load = mname (tiff,stop_load);
return TRUE;
}
#endif
#ifdef INCLUDE_xpm
if (strcmp (image_module->module_name, "xpm") == 0){
image_module->load = mname (xpm,load);
image_module->load_xpm_data = mname (xpm,load_xpm_data);
return TRUE;
} }
#endif #endif
#ifdef INCLUDE_xpm #ifdef INCLUDE_xpm
if (strcmp (image_module->module_name, "xpm") == 0){ else if (strcmp (image_module->module_name, "xpm") == 0){
image_module->load = mname (xpm,load); fill_vtable = mname (xpm, fill_vtable);
image_module->load_xpm_data = mname (xpm,load_xpm_data);
return TRUE;
} }
#endif #endif
#ifdef INCLUDE_tiff #ifdef INCLUDE_xbm
if (strcmp (image_module->module_name, "xbm") == 0){ else if (strcmp (image_module->module_name, "xbm") == 0){
image_module->load = mname (xbm,load); fill_vtable = mname (xbm, fill_vtable);
image_module->begin_load = mname (xbm,begin_load);
image_module->load_increment = mname (xbm,load_increment);
image_module->stop_load = mname (xbm,stop_load);
return TRUE;
} }
#endif #endif
g_set_error (error,
GDK_PIXBUF_ERROR, if (fill_vtable) {
GDK_PIXBUF_ERROR_UNKNOWN_TYPE, (* fill_vtable) (image_module);
_("Image type '%s' is not supported"), return TRUE;
image_module->module_name); } else {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
_("Image type '%s' is not supported"),
image_module->module_name);
return FALSE; return FALSE;
}
} }
......
...@@ -61,13 +61,14 @@ struct _GdkPixbufModule { ...@@ -61,13 +61,14 @@ struct _GdkPixbufModule {
/* Incremental loading */ /* Incremental loading */
gpointer (* begin_load) (ModulePreparedNotifyFunc prepare_func, gpointer (* begin_load) (ModulePreparedNotifyFunc prepare_func,
ModuleUpdatedNotifyFunc update_func, ModuleUpdatedNotifyFunc update_func,
ModuleFrameDoneNotifyFunc frame_done_func, ModuleFrameDoneNotifyFunc frame_done_func,
ModuleAnimationDoneNotifyFunc anim_done_func, ModuleAnimationDoneNotifyFunc anim_done_func,
gpointer user_data, gpointer user_data,
GError **error); GError **error);
void (* stop_load) (gpointer context); gboolean (* stop_load) (gpointer context,
GError **error);
gboolean (* load_increment) (gpointer context, gboolean (* load_increment) (gpointer context,
const guchar *buf, const guchar *buf,
guint size, guint size,
...@@ -84,6 +85,7 @@ struct _GdkPixbufModule { ...@@ -84,6 +85,7 @@ struct _GdkPixbufModule {
GError **error); GError **error);
}; };
typedef void (* ModuleFillVtableFunc) (GdkPixbufModule *module);
GdkPixbufModule *gdk_pixbuf_get_module (guchar *buffer, guint size, GdkPixbufModule *gdk_pixbuf_get_module (guchar *buffer, guint size,
const gchar *filename, const gchar *filename,
......
...@@ -28,8 +28,9 @@ ...@@ -28,8 +28,9 @@
#include "gdk-pixbuf-private.h" #include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-loader.h" #include "gdk-pixbuf-loader.h"
#include "gdk-pixbuf-io.h" #include "gdk-pixbuf-io.h"
#include "gdk-pixbuf-marshal.h"
#include "gtksignal.h" #include <gobject/gsignal.h>
enum { enum {
AREA_UPDATED, AREA_UPDATED,
...@@ -92,6 +93,8 @@ gdk_pixbuf_loader_get_type (void) ...@@ -92,6 +93,8 @@ gdk_pixbuf_loader_get_type (void)
0, /* n_preallocs */ 0, /* n_preallocs */
(GInstanceInitFunc) gdk_pixbuf_loader_init (GInstanceInitFunc) gdk_pixbuf_loader_init
}; };
g_type_init ();
loader_type = g_type_register_static (G_TYPE_OBJECT, loader_type = g_type_register_static (G_TYPE_OBJECT,
"GdkPixbufLoader", "GdkPixbufLoader",
...@@ -119,7 +122,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class) ...@@ -119,7 +122,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkPixbufLoaderClass, area_prepared), G_STRUCT_OFFSET (GdkPixbufLoaderClass, area_prepared),
NULL, NULL,
gtk_marshal_VOID__VOID, gdk_pixbuf_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
pixbuf_loader_signals[AREA_UPDATED] = pixbuf_loader_signals[AREA_UPDATED] =
...@@ -128,7 +131,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class) ...@@ -128,7 +131,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkPixbufLoaderClass, area_updated), G_STRUCT_OFFSET (GdkPixbufLoaderClass, area_updated),
NULL, NULL,
gtk_marshal_VOID__INT_INT_INT_INT, gdk_pixbuf_marshal_VOID__INT_INT_INT_INT,
G_TYPE_NONE, 4, G_TYPE_NONE, 4,
G_TYPE_INT, G_TYPE_INT,
G_TYPE_INT, G_TYPE_INT,
...@@ -141,7 +144,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class) ...@@ -141,7 +144,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkPixbufLoaderClass, frame_done), G_STRUCT_OFFSET (GdkPixbufLoaderClass, frame_done),
NULL, NULL,
gtk_marshal_VOID__POINTER, gdk_pixbuf_marshal_VOID__POINTER,
G_TYPE_NONE, 1, G_TYPE_NONE, 1,
GDK_TYPE_PIXBUF_FRAME); GDK_TYPE_PIXBUF_FRAME);
...@@ -151,7 +154,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class) ...@@ -151,7 +154,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkPixbufLoaderClass, animation_done), G_STRUCT_OFFSET (GdkPixbufLoaderClass, animation_done),
NULL, NULL,
gtk_marshal_VOID__VOID, gdk_pixbuf_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
pixbuf_loader_signals[CLOSED] = pixbuf_loader_signals[CLOSED] =
...@@ -160,7 +163,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class) ...@@ -160,7 +163,7 @@ gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
G_SIGNAL_RUN_LAST, G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GdkPixbufLoaderClass, closed), G_STRUCT_OFFSET (GdkPixbufLoaderClass, closed),
NULL, NULL,
gtk_marshal_VOID__VOID, gdk_pixbuf_marshal_VOID__VOID,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
} }
...@@ -421,7 +424,7 @@ gdk_pixbuf_loader_eat_header_write (GdkPixbufLoader *loader, ...@@ -421,7 +424,7 @@ gdk_pixbuf_loader_eat_header_write (GdkPixbufLoader *loader,
* and FALSE if an error occurred. In the latter case, the loader * and FALSE if an error occurred. In the latter case, the loader
* will be closed, and will not accept further writes. If FALSE is * will be closed, and will not accept further writes. If FALSE is
* returned, @error will be set to an error from the #GDK_PIXBUF_ERROR * returned, @error will be set to an error from the #GDK_PIXBUF_ERROR
* domain. * or #G_FILE_ERROR domains.
* *
* Return value: #TRUE if the write was successful, or #FALSE if the loader * Return value: #TRUE if the write was successful, or #FALSE if the loader
* cannot parse the buffer. * cannot parse the buffer.
...@@ -595,31 +598,46 @@ gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader) ...@@ -595,31 +598,46 @@ gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader)
/** /**
* gdk_pixbuf_loader_close: * gdk_pixbuf_loader_close:
* @loader: A pixbuf loader. * @loader: A pixbuf loader.
* @error: return location for a #GError, or %NULL to ignore errors
*
* Informs a pixbuf loader that no further writes with
* gdk_pixbuf_loader_write() will occur, so that it can free its
* internal loading structures. Also, tries to parse any data that
* hasn't yet been parsed; if the remaining data is partial or
* corrupt, an error will be returned. If FALSE is returned, @error
* will be set to an error from the #GDK_PIXBUF_ERROR or #G_FILE_ERROR
* domains. If you're just cancelling a load rather than expecting it
* to be finished, passing %NULL for @error to ignore it is
* reasonable.
* *
* Informs a pixbuf loader that no further writes with gdk_pixbuf_loader_write() * Returns: %TRUE if all image data written so far was successfully
* will occur, so that it can free its internal loading structures. passed out via the update_area signal
**/ **/
void gboolean
gdk_pixbuf_loader_close (GdkPixbufLoader *loader) gdk_pixbuf_loader_close (GdkPixbufLoader *loader,
GError **error)
{ {
GdkPixbufLoaderPrivate *priv; GdkPixbufLoaderPrivate *priv;
gboolean retval = TRUE;
g_return_if_fail (loader != NULL); g_return_val_if_fail (loader != NULL, TRUE);
g_return_if_fail (GDK_IS_PIXBUF_LOADER (loader)); g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), TRUE);
priv = loader->private; priv = loader->private;
/* we expect it's not closed */ /* we expect it's not closed */
g_return_if_fail (priv->closed == FALSE); g_return_val_if_fail (priv->closed == FALSE, TRUE);
/* We have less the 128 bytes in the image. Flush it, and keep going. */ /* We have less the 128 bytes in the image. Flush it, and keep going. */
if (priv->image_module == NULL) if (priv->image_module == NULL)
gdk_pixbuf_loader_load_module (loader, NULL, NULL); gdk_pixbuf_loader_load_module (loader, NULL, NULL);
if (priv->image_module && priv->image_module->stop_load) if (priv->image_module && priv->image_module->stop_load)
priv->image_module->stop_load (priv->context); retval = priv->image_module->stop_load (priv->context, error);
priv->closed = TRUE; priv->closed = TRUE;