2001-05-07 15:58:47 +00:00
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
|
2000-01-02 03:59:22 +00:00
|
|
|
/* GdkPixbuf library - Simple animation support
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999 The Free Software Foundation
|
|
|
|
*
|
|
|
|
* Authors: Jonathan Blandford <jrb@redhat.com>
|
|
|
|
* Havoc Pennington <hp@redhat.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
2000-01-02 03:59:22 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
2000-01-02 03:59:22 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2000-01-02 03:59:22 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
2000-10-18 18:42:54 +00:00
|
|
|
#include <errno.h>
|
2000-04-11 07:03:25 +00:00
|
|
|
#include "gdk-pixbuf-private.h"
|
2002-10-03 22:39:51 +00:00
|
|
|
#include "gdk-pixbuf-io.h"
|
|
|
|
#include "gdk-pixbuf-i18n.h"
|
|
|
|
#include "gdk-pixbuf-animation.h"
|
2005-03-14 19:37:00 +00:00
|
|
|
#include "gdk-pixbuf-alias.h"
|
2000-01-02 03:59:22 +00:00
|
|
|
|
2004-12-05 12:43:47 +00:00
|
|
|
#include <glib/gstdio.h>
|
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
typedef struct _GdkPixbufNonAnim GdkPixbufNonAnim;
|
|
|
|
typedef struct _GdkPixbufNonAnimClass GdkPixbufNonAnimClass;
|
|
|
|
|
|
|
|
#define GDK_TYPE_PIXBUF_NON_ANIM (gdk_pixbuf_non_anim_get_type ())
|
|
|
|
#define GDK_PIXBUF_NON_ANIM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_NON_ANIM, GdkPixbufNonAnim))
|
|
|
|
#define GDK_IS_PIXBUF_NON_ANIM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_NON_ANIM))
|
|
|
|
|
|
|
|
#define GDK_PIXBUF_NON_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_NON_ANIM, GdkPixbufNonAnimClass))
|
|
|
|
#define GDK_IS_PIXBUF_NON_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_NON_ANIM))
|
|
|
|
#define GDK_PIXBUF_NON_ANIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_NON_ANIM, GdkPixbufNonAnimClass))
|
|
|
|
|
|
|
|
/* Private part of the GdkPixbufNonAnim structure */
|
|
|
|
struct _GdkPixbufNonAnim {
|
|
|
|
GdkPixbufAnimation parent_instance;
|
|
|
|
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GdkPixbufNonAnimClass {
|
|
|
|
GdkPixbufAnimationClass parent_class;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2000-06-22 15:36:12 +00:00
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
typedef struct _GdkPixbufNonAnimIter GdkPixbufNonAnimIter;
|
|
|
|
typedef struct _GdkPixbufNonAnimIterClass GdkPixbufNonAnimIterClass;
|
|
|
|
|
|
|
|
|
|
|
|
#define GDK_TYPE_PIXBUF_NON_ANIM_ITER (gdk_pixbuf_non_anim_iter_get_type ())
|
|
|
|
#define GDK_PIXBUF_NON_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_NON_ANIM_ITER, GdkPixbufNonAnimIter))
|
|
|
|
#define GDK_IS_PIXBUF_NON_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_NON_ANIM_ITER))
|
|
|
|
|
|
|
|
#define GDK_PIXBUF_NON_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_NON_ANIM_ITER, GdkPixbufNonAnimIterClass))
|
|
|
|
#define GDK_IS_PIXBUF_NON_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_NON_ANIM_ITER))
|
|
|
|
#define GDK_PIXBUF_NON_ANIM_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_NON_ANIM_ITER, GdkPixbufNonAnimIterClass))
|
|
|
|
|
|
|
|
struct _GdkPixbufNonAnimIter {
|
|
|
|
GdkPixbufAnimationIter parent_instance;
|
|
|
|
|
|
|
|
GdkPixbufNonAnim *non_anim;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GdkPixbufNonAnimIterClass {
|
|
|
|
GdkPixbufAnimationIterClass parent_class;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
static GType gdk_pixbuf_non_anim_iter_get_type (void) G_GNUC_CONST;
|
|
|
|
|
2007-11-21 04:12:13 +00:00
|
|
|
G_DEFINE_TYPE (GdkPixbufAnimation, gdk_pixbuf_animation, G_TYPE_OBJECT);
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_pixbuf_animation_class_init (GdkPixbufAnimationClass *klass)
|
|
|
|
{
|
2000-06-22 15:36:12 +00:00
|
|
|
}
|
|
|
|
|
2007-11-21 04:12:13 +00:00
|
|
|
static void
|
|
|
|
gdk_pixbuf_animation_init (GdkPixbufAnimation *animation)
|
|
|
|
{
|
|
|
|
}
|
2000-01-02 03:59:22 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gdk_pixbuf_animation_new_from_file:
|
2004-12-05 12:43:47 +00:00
|
|
|
* @filename: Name of file to load, in the GLib file name encoding
|
2000-10-18 18:42:54 +00:00
|
|
|
* @error: return location for error
|
2000-01-02 03:59:22 +00:00
|
|
|
*
|
|
|
|
* Creates a new animation by loading it from a file. The file format is
|
|
|
|
* detected automatically. If the file's format does not support multi-frame
|
2000-10-18 18:42:54 +00:00
|
|
|
* images, then an animation with a single frame will be created. Possible errors
|
|
|
|
* are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
|
2000-01-02 03:59:22 +00:00
|
|
|
*
|
More precise documentation about underscores and mnemonics. (#66380)
* gtk/gtklabel.c (gtk_label_new_with_mnemonic),
gtk/gtkbutton.c (gtk_button_new_with_mnemonic): More precise
documentation about underscores and mnemonics. (#66380)
* gtk/gtktextiter.c (gtk_text_iter_backward_word_starts): Fix
cyclic reference in docs.
* gtk/gtklabel.c (gtk_label_set_justify): Correct documentation
of default value. (#65402)
* gtk/gtkmain.c (gtk_set_locale, gtk_disable_set_locale):
Markup fixes.
* gdk-pixbuf-io.c, gdk-pixbuf-animation.c, gdk-pixbuf-data.c,
gdk-pixbuf-loader.c, gdk-pixbuf-scale.c, gdk-pixbuf-util.c,
gdk-pixdata.c: Markup fixes.
* gtk/text_widget.sgml: More precise wording. (#63388)
* gtk/tmpl/gtksignal.sgml (GTK_SIGNAL_OFFSET): Add docs.
* gtk/resources.sgml: Fix markup of mail URLs.
* gtk/tmpl/gtkpaned.sgml, gtk/tmpl/gtkobject.sgml: Markup fixes.
* gtk/tmpl/gtktoolbar.sgml (gtk_toolbar_{prepend,append}_element):
Expand documentation. (#60471)
* gtk/tmpl/gtkmain.sgml: Remove misleading information about
gtk_set_locale(). (#65758)
2001-12-20 23:09:29 +00:00
|
|
|
* Return value: A newly-created animation with a reference count of 1, or %NULL
|
2000-01-02 03:59:22 +00:00
|
|
|
* if any of several error conditions ocurred: the file could not be opened,
|
|
|
|
* there was no loader for the file's format, there was not enough memory to
|
|
|
|
* allocate the image buffer, or the image file contained invalid data.
|
|
|
|
**/
|
|
|
|
GdkPixbufAnimation *
|
2000-10-18 18:42:54 +00:00
|
|
|
gdk_pixbuf_animation_new_from_file (const char *filename,
|
|
|
|
GError **error)
|
2000-01-02 03:59:22 +00:00
|
|
|
{
|
|
|
|
GdkPixbufAnimation *animation;
|
|
|
|
int size;
|
|
|
|
FILE *f;
|
2005-10-03 15:07:35 +00:00
|
|
|
guchar buffer [1024];
|
2000-01-02 03:59:22 +00:00
|
|
|
GdkPixbufModule *image_module;
|
2004-11-11 03:12:25 +00:00
|
|
|
gchar *display_name;
|
2004-12-27 22:50:45 +00:00
|
|
|
gboolean locked = FALSE;
|
2000-01-02 03:59:22 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (filename != NULL, NULL);
|
2003-04-24 18:51:07 +00:00
|
|
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
2000-01-02 03:59:22 +00:00
|
|
|
|
2004-11-11 03:12:25 +00:00
|
|
|
display_name = g_filename_display_name (filename);
|
2004-12-05 12:43:47 +00:00
|
|
|
f = g_fopen (filename, "rb");
|
2000-10-18 18:42:54 +00:00
|
|
|
if (!f) {
|
2006-03-20 20:09:51 +00:00
|
|
|
gint save_errno = errno;
|
2000-10-18 18:42:54 +00:00
|
|
|
g_set_error (error,
|
|
|
|
G_FILE_ERROR,
|
2006-03-20 20:09:51 +00:00
|
|
|
g_file_error_from_errno (save_errno),
|
2000-10-18 18:42:54 +00:00
|
|
|
_("Failed to open file '%s': %s"),
|
2004-11-11 03:12:25 +00:00
|
|
|
display_name,
|
2006-03-20 20:09:51 +00:00
|
|
|
g_strerror (save_errno));
|
2004-11-11 03:12:25 +00:00
|
|
|
g_free (display_name);
|
2000-01-02 03:59:22 +00:00
|
|
|
return NULL;
|
2000-10-18 18:42:54 +00:00
|
|
|
}
|
2000-01-02 03:59:22 +00:00
|
|
|
|
|
|
|
size = fread (&buffer, 1, sizeof (buffer), f);
|
|
|
|
|
|
|
|
if (size == 0) {
|
2000-10-18 18:42:54 +00:00
|
|
|
g_set_error (error,
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
|
|
|
_("Image file '%s' contains no data"),
|
2004-11-11 03:12:25 +00:00
|
|
|
display_name);
|
|
|
|
g_free (display_name);
|
2000-01-02 03:59:22 +00:00
|
|
|
fclose (f);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2001-02-20 02:59:30 +00:00
|
|
|
image_module = _gdk_pixbuf_get_module (buffer, size, filename, error);
|
2000-01-02 03:59:22 +00:00
|
|
|
if (!image_module) {
|
2004-11-11 03:12:25 +00:00
|
|
|
g_free (display_name);
|
2000-01-02 03:59:22 +00:00
|
|
|
fclose (f);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (image_module->module == NULL)
|
2001-02-20 02:59:30 +00:00
|
|
|
if (!_gdk_pixbuf_load_module (image_module, error)) {
|
2004-11-11 03:12:25 +00:00
|
|
|
g_free (display_name);
|
2000-10-18 18:42:54 +00:00
|
|
|
fclose (f);
|
|
|
|
return NULL;
|
|
|
|
}
|
2000-01-02 03:59:22 +00:00
|
|
|
|
|
|
|
if (image_module->load_animation == NULL) {
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
|
|
|
|
/* Keep this logic in sync with gdk_pixbuf_new_from_file() */
|
|
|
|
|
|
|
|
fseek (f, 0, SEEK_SET);
|
2002-08-22 21:32:06 +00:00
|
|
|
pixbuf = _gdk_pixbuf_generic_image_load (image_module, f, error);
|
2000-01-02 03:59:22 +00:00
|
|
|
fclose (f);
|
|
|
|
|
2000-10-18 18:42:54 +00:00
|
|
|
if (pixbuf == NULL && error != NULL && *error == NULL) {
|
|
|
|
/* I don't trust these crufty longjmp()'ing image libs
|
|
|
|
* to maintain proper error invariants, and I don't
|
|
|
|
* want user code to segfault as a result. We need to maintain
|
|
|
|
* the invariant that error gets set if NULL is returned.
|
|
|
|
*/
|
|
|
|
|
|
|
|
g_warning ("Bug! gdk-pixbuf loader '%s' didn't set an error on failure.",
|
|
|
|
image_module->module_name);
|
|
|
|
g_set_error (error,
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
_("Failed to load image '%s': reason not known, probably a corrupt image file"),
|
2004-11-11 03:12:25 +00:00
|
|
|
display_name);
|
2000-10-18 18:42:54 +00:00
|
|
|
}
|
|
|
|
|
2004-11-11 03:12:25 +00:00
|
|
|
if (pixbuf == NULL) {
|
|
|
|
g_free (display_name);
|
Changes to make gdk-pixbuf threadsafe (#157310, #157306, Colin Walters):
2004-11-12 Matthias Clasen <mclasen@redhat.com>
Changes to make gdk-pixbuf threadsafe (#157310, #157306,
Colin Walters):
* gdk-pixbuf-io.h (enum GdkPixbufFormatFlags): Add
GDK_PIXBUF_FORMAT_THREADSAFE to indicate that an image loader
is threadsafe.
* gdk-pixbuf-io.c (get_file_formats, _gdk_pixbuf_load_module):
Use a lock to make initialization of global data structures
threadsafe.
* gdk-pixbuf-private.h:
* gdk-pixbuf-io.c (_gdk_pixbuf_lock, _gdk_pixbuf_unlock):
Auxiliary functions which use another lock to protect
threadunsafe image loaders.
* gdk-pixbuf-io.c (gdk_pixbuf_real_save):
(save_to_callback_with_tmp_file):
(gdk_pixbuf_real_save_to_callback):
(gdk_pixbuf_new_from_xpm_data):
(_gdk_pixbuf_generic_image_load):
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file):
* gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module):
(gdk_pixbuf_loader_close):
(gdk_pixbuf_loader_finalize):
Use _gdk_pixbuf_lock() and _gdk_pixbuf_unlock().
* io-ani.c, io-bmp.c, io-gif.c, io-ico.c:
* io-jpeg.c, io-pcx.c, io-png.c, io-pnm.c:
* io-ras.c, io-tga.c, io-wbmp.c, io-xbm.c:
* io-xpm.c: Mark as threadsafe.
* io-tiff.c: Remove pointless locking, mark as
threadunsafe.
2004-11-12 05:34:31 +00:00
|
|
|
animation = NULL;
|
|
|
|
goto out_unlock;
|
2004-11-11 03:12:25 +00:00
|
|
|
}
|
2000-01-02 03:59:22 +00:00
|
|
|
|
2002-09-19 21:00:52 +00:00
|
|
|
animation = gdk_pixbuf_non_anim_new (pixbuf);
|
2000-01-02 03:59:22 +00:00
|
|
|
|
Remove assorted G_OBJECT casts where unnecessary.
2001-12-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk-pixbuf-animation.c, gdk-pixbuf-loader.c, gdk-pixpuf.c,
io-gif-animation.c, io-gif.c, io-tiff.c, test-loaders.c: Remove
assorted G_OBJECT casts where unnecessary.
* gdk-pixbuf-loader.c: Call g_object_ref and g_object_unref
instead of gdk_pixbuf_animation_ref and gdk_pixbuf_animation_unref
resp.
* gdk-pixbuf-csource.c, io-bmp.c, io-gif-animation.c, io-ico.c,
io-jpeg.c, io-png.c, io-pnm.c, io-ras.c, io-tga.c, io-wbmp.c,
io-xbm.c, io-xpm.c, test-gdk-pixbuf.c: Dito for gdk_pixbuf_ref and
gdk_pixbuf_unref.
* Makefile.am, pixops/Makefile.am: Compile everything with
-DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
* gdk-pixdata.c: Use g_ascii_strup() instead of g_strup().
* io-xpm.c: Use g_ascii_strcasecmp() instead of g_strcasecmp().
* demos/testpixbuf-drawable.c, demos/testpixbuf-save.c,
demos/testpixbuf-scale.c, demos/testpixbuf.c: Call g_object_ref
and g_object_unref instead of gdk_pixbuf_ref and gdk_pixbuf_unref
resp.
2001-12-13 21:22:12 +00:00
|
|
|
g_object_unref (pixbuf);
|
2000-01-02 03:59:22 +00:00
|
|
|
} else {
|
2004-12-27 22:50:45 +00:00
|
|
|
locked = _gdk_pixbuf_lock (image_module);
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
fseek (f, 0, SEEK_SET);
|
2000-10-18 18:42:54 +00:00
|
|
|
animation = (* image_module->load_animation) (f, error);
|
|
|
|
|
|
|
|
if (animation == NULL && error != NULL && *error == NULL) {
|
|
|
|
/* I don't trust these crufty longjmp()'ing
|
|
|
|
* image libs to maintain proper error
|
|
|
|
* invariants, and I don't want user code to
|
|
|
|
* segfault as a result. We need to maintain
|
|
|
|
* the invariant that error gets set if NULL
|
|
|
|
* is returned.
|
|
|
|
*/
|
|
|
|
|
|
|
|
g_warning ("Bug! gdk-pixbuf loader '%s' didn't set an error on failure.",
|
|
|
|
image_module->module_name);
|
|
|
|
g_set_error (error,
|
|
|
|
GDK_PIXBUF_ERROR,
|
|
|
|
GDK_PIXBUF_ERROR_FAILED,
|
|
|
|
_("Failed to load animation '%s': reason not known, probably a corrupt animation file"),
|
2004-11-11 03:12:25 +00:00
|
|
|
display_name);
|
2000-10-18 18:42:54 +00:00
|
|
|
}
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
fclose (f);
|
|
|
|
}
|
|
|
|
|
2004-11-11 03:12:25 +00:00
|
|
|
g_free (display_name);
|
|
|
|
|
Changes to make gdk-pixbuf threadsafe (#157310, #157306, Colin Walters):
2004-11-12 Matthias Clasen <mclasen@redhat.com>
Changes to make gdk-pixbuf threadsafe (#157310, #157306,
Colin Walters):
* gdk-pixbuf-io.h (enum GdkPixbufFormatFlags): Add
GDK_PIXBUF_FORMAT_THREADSAFE to indicate that an image loader
is threadsafe.
* gdk-pixbuf-io.c (get_file_formats, _gdk_pixbuf_load_module):
Use a lock to make initialization of global data structures
threadsafe.
* gdk-pixbuf-private.h:
* gdk-pixbuf-io.c (_gdk_pixbuf_lock, _gdk_pixbuf_unlock):
Auxiliary functions which use another lock to protect
threadunsafe image loaders.
* gdk-pixbuf-io.c (gdk_pixbuf_real_save):
(save_to_callback_with_tmp_file):
(gdk_pixbuf_real_save_to_callback):
(gdk_pixbuf_new_from_xpm_data):
(_gdk_pixbuf_generic_image_load):
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file):
* gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module):
(gdk_pixbuf_loader_close):
(gdk_pixbuf_loader_finalize):
Use _gdk_pixbuf_lock() and _gdk_pixbuf_unlock().
* io-ani.c, io-bmp.c, io-gif.c, io-ico.c:
* io-jpeg.c, io-pcx.c, io-png.c, io-pnm.c:
* io-ras.c, io-tga.c, io-wbmp.c, io-xbm.c:
* io-xpm.c: Mark as threadsafe.
* io-tiff.c: Remove pointless locking, mark as
threadunsafe.
2004-11-12 05:34:31 +00:00
|
|
|
out_unlock:
|
2004-11-16 02:51:19 +00:00
|
|
|
if (locked)
|
|
|
|
_gdk_pixbuf_unlock (image_module);
|
2000-01-02 03:59:22 +00:00
|
|
|
return animation;
|
|
|
|
}
|
|
|
|
|
2004-12-05 12:43:47 +00:00
|
|
|
#ifdef G_OS_WIN32
|
|
|
|
|
|
|
|
#undef gdk_pixbuf_animation_new_from_file
|
|
|
|
|
|
|
|
GdkPixbufAnimation *
|
|
|
|
gdk_pixbuf_animation_new_from_file (const char *filename,
|
|
|
|
GError **error)
|
|
|
|
{
|
|
|
|
gchar *utf8_filename =
|
|
|
|
g_locale_to_utf8 (filename, -1, NULL, NULL, error);
|
|
|
|
GdkPixbufAnimation *retval;
|
|
|
|
|
|
|
|
if (utf8_filename == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
retval = gdk_pixbuf_animation_new_from_file_utf8 (utf8_filename, error);
|
|
|
|
|
|
|
|
g_free (utf8_filename);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2000-01-02 03:59:22 +00:00
|
|
|
/**
|
|
|
|
* gdk_pixbuf_animation_ref:
|
|
|
|
* @animation: An animation.
|
|
|
|
*
|
2002-11-29 20:36:26 +00:00
|
|
|
* Adds a reference to an animation.
|
2000-01-21 22:54:44 +00:00
|
|
|
*
|
|
|
|
* Return value: The same as the @animation argument.
|
2002-11-29 20:36:26 +00:00
|
|
|
*
|
|
|
|
* Deprecated: Use g_object_ref().
|
2000-01-02 03:59:22 +00:00
|
|
|
**/
|
2000-01-21 22:54:44 +00:00
|
|
|
GdkPixbufAnimation *
|
2000-01-02 03:59:22 +00:00
|
|
|
gdk_pixbuf_animation_ref (GdkPixbufAnimation *animation)
|
|
|
|
{
|
2002-09-29 21:24:24 +00:00
|
|
|
return (GdkPixbufAnimation*) g_object_ref (animation);
|
2000-01-02 03:59:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gdk_pixbuf_animation_unref:
|
|
|
|
* @animation: An animation.
|
|
|
|
*
|
2002-11-29 20:36:26 +00:00
|
|
|
* Removes a reference from an animation.
|
|
|
|
*
|
|
|
|
* Deprecated: Use g_object_unref().
|
2000-01-02 03:59:22 +00:00
|
|
|
**/
|
|
|
|
void
|
|
|
|
gdk_pixbuf_animation_unref (GdkPixbufAnimation *animation)
|
|
|
|
{
|
2002-09-29 21:24:24 +00:00
|
|
|
g_object_unref (animation);
|
2000-01-02 03:59:22 +00:00
|
|
|
}
|
2000-04-04 04:50:39 +00:00
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
/**
|
|
|
|
* gdk_pixbuf_animation_is_static_image:
|
|
|
|
* @animation: a #GdkPixbufAnimation
|
|
|
|
*
|
|
|
|
* If you load a file with gdk_pixbuf_animation_new_from_file() and it turns
|
|
|
|
* out to be a plain, unanimated image, then this function will return
|
|
|
|
* %TRUE. Use gdk_pixbuf_animation_get_static_image() to retrieve
|
|
|
|
* the image.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the "animation" was really just an image
|
|
|
|
**/
|
|
|
|
gboolean
|
|
|
|
gdk_pixbuf_animation_is_static_image (GdkPixbufAnimation *animation)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), FALSE);
|
|
|
|
|
|
|
|
return GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->is_static_image (animation);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gdk_pixbuf_animation_get_static_image:
|
|
|
|
* @animation: a #GdkPixbufAnimation
|
|
|
|
*
|
|
|
|
* If an animation is really just a plain image (has only one frame),
|
|
|
|
* this function returns that image. If the animation is an animation,
|
|
|
|
* this function returns a reasonable thing to display as a static
|
|
|
|
* unanimated image, which might be the first frame, or something more
|
|
|
|
* sophisticated. If an animation hasn't loaded any frames yet, this
|
|
|
|
* function will return %NULL.
|
|
|
|
*
|
|
|
|
* Return value: unanimated image representing the animation
|
|
|
|
**/
|
|
|
|
GdkPixbuf*
|
|
|
|
gdk_pixbuf_animation_get_static_image (GdkPixbufAnimation *animation)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), NULL);
|
|
|
|
|
|
|
|
return GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_static_image (animation);
|
|
|
|
}
|
|
|
|
|
2000-04-04 04:50:39 +00:00
|
|
|
/**
|
|
|
|
* gdk_pixbuf_animation_get_width:
|
|
|
|
* @animation: An animation.
|
2000-04-13 01:18:41 +00:00
|
|
|
*
|
|
|
|
* Queries the width of the bounding box of a pixbuf animation.
|
2000-04-04 04:50:39 +00:00
|
|
|
*
|
2000-04-13 01:18:41 +00:00
|
|
|
* Return value: Width of the bounding box of the animation.
|
2000-04-04 04:50:39 +00:00
|
|
|
**/
|
|
|
|
int
|
|
|
|
gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation)
|
|
|
|
{
|
2001-05-07 15:58:47 +00:00
|
|
|
int width;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), 0);
|
|
|
|
|
|
|
|
width = 0;
|
|
|
|
GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_size (animation,
|
|
|
|
&width, NULL);
|
|
|
|
|
2000-04-04 04:50:39 +00:00
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
return width;
|
2000-04-04 04:50:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gdk_pixbuf_animation_get_height:
|
|
|
|
* @animation: An animation.
|
2000-04-13 01:18:41 +00:00
|
|
|
*
|
|
|
|
* Queries the height of the bounding box of a pixbuf animation.
|
2000-04-04 04:50:39 +00:00
|
|
|
*
|
2000-04-13 01:18:41 +00:00
|
|
|
* Return value: Height of the bounding box of the animation.
|
2000-04-04 04:50:39 +00:00
|
|
|
**/
|
|
|
|
int
|
|
|
|
gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation)
|
|
|
|
{
|
2001-05-07 15:58:47 +00:00
|
|
|
int height;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), 0);
|
2000-04-04 04:50:39 +00:00
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
height = 0;
|
|
|
|
GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_size (animation,
|
|
|
|
NULL, &height);
|
|
|
|
|
2000-04-04 04:50:39 +00:00
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
return height;
|
2000-04-04 04:50:39 +00:00
|
|
|
}
|
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
|
2000-04-04 04:50:39 +00:00
|
|
|
/**
|
2001-05-07 15:58:47 +00:00
|
|
|
* gdk_pixbuf_animation_get_iter:
|
|
|
|
* @animation: a #GdkPixbufAnimation
|
|
|
|
* @start_time: time when the animation starts playing
|
|
|
|
*
|
|
|
|
* Get an iterator for displaying an animation. The iterator provides
|
|
|
|
* the frames that should be displayed at a given time.
|
|
|
|
* It should be freed after use with g_object_unref().
|
|
|
|
*
|
|
|
|
* @start_time would normally come from g_get_current_time(), and
|
|
|
|
* marks the beginning of animation playback. After creating an
|
|
|
|
* iterator, you should immediately display the pixbuf returned by
|
|
|
|
* gdk_pixbuf_animation_iter_get_pixbuf(). Then, you should install a
|
|
|
|
* timeout (with g_timeout_add()) or by some other mechanism ensure
|
|
|
|
* that you'll update the image after
|
|
|
|
* gdk_pixbuf_animation_iter_get_delay_time() milliseconds. Each time
|
|
|
|
* the image is updated, you should reinstall the timeout with the new,
|
|
|
|
* possibly-changed delay time.
|
|
|
|
*
|
|
|
|
* As a shortcut, if @start_time is %NULL, the result of
|
|
|
|
* g_get_current_time() will be used automatically.
|
2000-04-13 01:18:41 +00:00
|
|
|
*
|
2001-05-07 15:58:47 +00:00
|
|
|
* To update the image (i.e. possibly change the result of
|
|
|
|
* gdk_pixbuf_animation_iter_get_pixbuf() to a new frame of the animation),
|
|
|
|
* call gdk_pixbuf_animation_iter_advance().
|
|
|
|
*
|
|
|
|
* If you're using #GdkPixbufLoader, in addition to updating the image
|
|
|
|
* after the delay time, you should also update it whenever you
|
|
|
|
* receive the area_updated signal and
|
|
|
|
* gdk_pixbuf_animation_iter_on_currently_loading_frame() returns
|
|
|
|
* %TRUE. In this case, the frame currently being fed into the loader
|
|
|
|
* has received new data, so needs to be refreshed. The delay time for
|
|
|
|
* a frame may also be modified after an area_updated signal, for
|
|
|
|
* example if the delay time for a frame is encoded in the data after
|
|
|
|
* the frame itself. So your timeout should be reinstalled after any
|
|
|
|
* area_updated signal.
|
|
|
|
*
|
|
|
|
* A delay time of -1 is possible, indicating "infinite."
|
2000-04-04 04:50:39 +00:00
|
|
|
*
|
2001-05-07 15:58:47 +00:00
|
|
|
* Return value: an iterator to move over the animation
|
2000-04-04 04:50:39 +00:00
|
|
|
**/
|
2001-05-07 15:58:47 +00:00
|
|
|
GdkPixbufAnimationIter*
|
|
|
|
gdk_pixbuf_animation_get_iter (GdkPixbufAnimation *animation,
|
|
|
|
const GTimeVal *start_time)
|
2000-04-04 04:50:39 +00:00
|
|
|
{
|
2001-05-07 15:58:47 +00:00
|
|
|
GTimeVal val;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), NULL);
|
|
|
|
|
2000-04-04 04:50:39 +00:00
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
if (start_time)
|
|
|
|
val = *start_time;
|
|
|
|
else
|
|
|
|
g_get_current_time (&val);
|
|
|
|
|
|
|
|
return GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_iter (animation, &val);
|
2000-04-04 04:50:39 +00:00
|
|
|
}
|
2000-04-11 07:03:25 +00:00
|
|
|
|
2007-11-21 04:12:13 +00:00
|
|
|
G_DEFINE_TYPE (GdkPixbufAnimationIter, gdk_pixbuf_animation_iter, G_TYPE_OBJECT);
|
2000-04-11 07:03:25 +00:00
|
|
|
|
2007-11-21 04:12:13 +00:00
|
|
|
static void
|
|
|
|
gdk_pixbuf_animation_iter_class_init (GdkPixbufAnimationIterClass *klass)
|
2000-04-11 07:03:25 +00:00
|
|
|
{
|
2007-11-21 04:12:13 +00:00
|
|
|
}
|
2000-04-11 07:03:25 +00:00
|
|
|
|
2007-11-21 04:12:13 +00:00
|
|
|
static void
|
|
|
|
gdk_pixbuf_animation_iter_init (GdkPixbufAnimationIter *iter)
|
|
|
|
{
|
2000-04-11 07:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-07 15:58:47 +00:00
|
|
|
* gdk_pixbuf_animation_iter_get_delay_time:
|
|
|
|
* @iter: an animation iterator
|
2000-04-11 07:03:25 +00:00
|
|
|
*
|
2001-05-07 15:58:47 +00:00
|
|
|
* Gets the number of milliseconds the current pixbuf should be displayed,
|
|
|
|
* or -1 if the current pixbuf should be displayed forever. g_timeout_add()
|
|
|
|
* conveniently takes a timeout in milliseconds, so you can use a timeout
|
|
|
|
* to schedule the next update.
|
|
|
|
*
|
|
|
|
* Return value: delay time in milliseconds (thousandths of a second)
|
2000-04-11 07:03:25 +00:00
|
|
|
**/
|
|
|
|
int
|
2001-05-07 15:58:47 +00:00
|
|
|
gdk_pixbuf_animation_iter_get_delay_time (GdkPixbufAnimationIter *iter)
|
2000-04-11 07:03:25 +00:00
|
|
|
{
|
2001-05-07 15:58:47 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), -1);
|
|
|
|
|
|
|
|
return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_delay_time (iter);
|
2000-04-11 07:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-07 15:58:47 +00:00
|
|
|
* gdk_pixbuf_animation_iter_get_pixbuf:
|
|
|
|
* @iter: an animation iterator
|
2000-04-11 07:03:25 +00:00
|
|
|
*
|
2001-05-07 15:58:47 +00:00
|
|
|
* Gets the current pixbuf which should be displayed; the pixbuf will
|
|
|
|
* be the same size as the animation itself
|
2004-11-30 13:31:04 +00:00
|
|
|
* (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()).
|
|
|
|
* This pixbuf should be displayed for
|
|
|
|
* gdk_pixbuf_animation_iter_get_delay_time() milliseconds. The caller
|
2001-05-07 15:58:47 +00:00
|
|
|
* of this function does not own a reference to the returned pixbuf;
|
|
|
|
* the returned pixbuf will become invalid when the iterator advances
|
|
|
|
* to the next frame, which may happen anytime you call
|
|
|
|
* gdk_pixbuf_animation_iter_advance(). Copy the pixbuf to keep it
|
|
|
|
* (don't just add a reference), as it may get recycled as you advance
|
|
|
|
* the iterator.
|
|
|
|
*
|
|
|
|
* Return value: the pixbuf to be displayed
|
2000-04-11 07:03:25 +00:00
|
|
|
**/
|
2001-05-07 15:58:47 +00:00
|
|
|
GdkPixbuf*
|
|
|
|
gdk_pixbuf_animation_iter_get_pixbuf (GdkPixbufAnimationIter *iter)
|
2000-04-11 07:03:25 +00:00
|
|
|
{
|
2001-05-07 15:58:47 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), NULL);
|
|
|
|
|
|
|
|
return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_pixbuf (iter);
|
2000-04-11 07:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-07 15:58:47 +00:00
|
|
|
* gdk_pixbuf_animation_iter_on_currently_loading_frame:
|
|
|
|
* @iter: a #GdkPixbufAnimationIter
|
|
|
|
*
|
|
|
|
* Used to determine how to respond to the area_updated signal on
|
|
|
|
* #GdkPixbufLoader when loading an animation. area_updated is emitted
|
|
|
|
* for an area of the frame currently streaming in to the loader. So if
|
|
|
|
* you're on the currently loading frame, you need to redraw the screen for
|
|
|
|
* the updated area.
|
2000-04-11 07:03:25 +00:00
|
|
|
*
|
2001-05-07 15:58:47 +00:00
|
|
|
* Return value: %TRUE if the frame we're on is partially loaded, or the last frame
|
2000-04-11 07:03:25 +00:00
|
|
|
**/
|
2001-05-07 15:58:47 +00:00
|
|
|
gboolean
|
|
|
|
gdk_pixbuf_animation_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter)
|
2000-04-11 07:03:25 +00:00
|
|
|
{
|
2001-05-07 15:58:47 +00:00
|
|
|
g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), FALSE);
|
|
|
|
|
|
|
|
return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->on_currently_loading_frame (iter);
|
2000-04-11 07:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2001-05-07 15:58:47 +00:00
|
|
|
* gdk_pixbuf_animation_iter_advance:
|
|
|
|
* @iter: a #GdkPixbufAnimationIter
|
|
|
|
* @current_time: current time
|
|
|
|
*
|
|
|
|
* Possibly advances an animation to a new frame. Chooses the frame based
|
|
|
|
* on the start time passed to gdk_pixbuf_animation_get_iter().
|
2000-04-11 07:03:25 +00:00
|
|
|
*
|
2001-05-07 15:58:47 +00:00
|
|
|
* @current_time would normally come from g_get_current_time(), and
|
|
|
|
* must be greater than or equal to the time passed to
|
|
|
|
* gdk_pixbuf_animation_get_iter(), and must increase or remain
|
|
|
|
* unchanged each time gdk_pixbuf_animation_iter_get_pixbuf() is
|
|
|
|
* called. That is, you can't go backward in time; animations only
|
|
|
|
* play forward.
|
|
|
|
*
|
|
|
|
* As a shortcut, pass %NULL for the current time and g_get_current_time()
|
|
|
|
* will be invoked on your behalf. So you only need to explicitly pass
|
|
|
|
* @current_time if you're doing something odd like playing the animation
|
|
|
|
* at double speed.
|
|
|
|
*
|
|
|
|
* If this function returns %FALSE, there's no need to update the animation
|
|
|
|
* display, assuming the display had been rendered prior to advancing;
|
|
|
|
* if %TRUE, you need to call gdk_animation_iter_get_pixbuf() and update the
|
|
|
|
* display with the new pixbuf.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE if the image may need updating
|
2000-04-11 07:03:25 +00:00
|
|
|
*
|
|
|
|
**/
|
2001-05-07 15:58:47 +00:00
|
|
|
gboolean
|
|
|
|
gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter,
|
|
|
|
const GTimeVal *current_time)
|
2000-04-11 07:03:25 +00:00
|
|
|
{
|
2001-05-07 15:58:47 +00:00
|
|
|
GTimeVal val;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), FALSE);
|
2000-04-11 07:03:25 +00:00
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
if (current_time)
|
|
|
|
val = *current_time;
|
|
|
|
else
|
|
|
|
g_get_current_time (&val);
|
|
|
|
|
|
|
|
return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->advance (iter, &val);
|
2000-04-11 07:03:25 +00:00
|
|
|
}
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
2007-11-21 04:12:13 +00:00
|
|
|
static void gdk_pixbuf_non_anim_finalize (GObject *object);
|
2001-05-07 15:58:47 +00:00
|
|
|
static gboolean gdk_pixbuf_non_anim_is_static_image (GdkPixbufAnimation *animation);
|
|
|
|
static GdkPixbuf* gdk_pixbuf_non_anim_get_static_image (GdkPixbufAnimation *animation);
|
|
|
|
static void gdk_pixbuf_non_anim_get_size (GdkPixbufAnimation *anim,
|
|
|
|
int *width,
|
|
|
|
int *height);
|
|
|
|
static GdkPixbufAnimationIter* gdk_pixbuf_non_anim_get_iter (GdkPixbufAnimation *anim,
|
|
|
|
const GTimeVal *start_time);
|
|
|
|
|
2007-11-21 04:12:13 +00:00
|
|
|
G_DEFINE_TYPE (GdkPixbufNonAnim, gdk_pixbuf_non_anim, GDK_TYPE_PIXBUF_ANIMATION);
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
static void
|
|
|
|
gdk_pixbuf_non_anim_class_init (GdkPixbufNonAnimClass *klass)
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
{
|
2001-05-07 15:58:47 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GdkPixbufAnimationClass *anim_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->finalize = gdk_pixbuf_non_anim_finalize;
|
|
|
|
|
|
|
|
anim_class->is_static_image = gdk_pixbuf_non_anim_is_static_image;
|
|
|
|
anim_class->get_static_image = gdk_pixbuf_non_anim_get_static_image;
|
|
|
|
anim_class->get_size = gdk_pixbuf_non_anim_get_size;
|
|
|
|
anim_class->get_iter = gdk_pixbuf_non_anim_get_iter;
|
|
|
|
}
|
|
|
|
|
2007-11-21 04:12:13 +00:00
|
|
|
static void
|
|
|
|
gdk_pixbuf_non_anim_init (GdkPixbufNonAnim *non_anim)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
static void
|
|
|
|
gdk_pixbuf_non_anim_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GdkPixbufNonAnim *non_anim = GDK_PIXBUF_NON_ANIM (object);
|
|
|
|
|
|
|
|
if (non_anim->pixbuf)
|
Remove assorted G_OBJECT casts where unnecessary.
2001-12-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk-pixbuf-animation.c, gdk-pixbuf-loader.c, gdk-pixpuf.c,
io-gif-animation.c, io-gif.c, io-tiff.c, test-loaders.c: Remove
assorted G_OBJECT casts where unnecessary.
* gdk-pixbuf-loader.c: Call g_object_ref and g_object_unref
instead of gdk_pixbuf_animation_ref and gdk_pixbuf_animation_unref
resp.
* gdk-pixbuf-csource.c, io-bmp.c, io-gif-animation.c, io-ico.c,
io-jpeg.c, io-png.c, io-pnm.c, io-ras.c, io-tga.c, io-wbmp.c,
io-xbm.c, io-xpm.c, test-gdk-pixbuf.c: Dito for gdk_pixbuf_ref and
gdk_pixbuf_unref.
* Makefile.am, pixops/Makefile.am: Compile everything with
-DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
* gdk-pixdata.c: Use g_ascii_strup() instead of g_strup().
* io-xpm.c: Use g_ascii_strcasecmp() instead of g_strcasecmp().
* demos/testpixbuf-drawable.c, demos/testpixbuf-save.c,
demos/testpixbuf-scale.c, demos/testpixbuf.c: Call g_object_ref
and g_object_unref instead of gdk_pixbuf_ref and gdk_pixbuf_unref
resp.
2001-12-13 21:22:12 +00:00
|
|
|
g_object_unref (non_anim->pixbuf);
|
2001-05-07 15:58:47 +00:00
|
|
|
|
2007-11-21 04:12:13 +00:00
|
|
|
G_OBJECT_CLASS (gdk_pixbuf_non_anim_parent_class)->finalize (object);
|
2001-05-07 15:58:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GdkPixbufAnimation*
|
2002-09-19 21:00:52 +00:00
|
|
|
gdk_pixbuf_non_anim_new (GdkPixbuf *pixbuf)
|
2001-05-07 15:58:47 +00:00
|
|
|
{
|
|
|
|
GdkPixbufNonAnim *non_anim;
|
|
|
|
|
|
|
|
non_anim = g_object_new (GDK_TYPE_PIXBUF_NON_ANIM, NULL);
|
|
|
|
|
|
|
|
non_anim->pixbuf = pixbuf;
|
|
|
|
|
|
|
|
if (pixbuf)
|
Remove assorted G_OBJECT casts where unnecessary.
2001-12-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk-pixbuf-animation.c, gdk-pixbuf-loader.c, gdk-pixpuf.c,
io-gif-animation.c, io-gif.c, io-tiff.c, test-loaders.c: Remove
assorted G_OBJECT casts where unnecessary.
* gdk-pixbuf-loader.c: Call g_object_ref and g_object_unref
instead of gdk_pixbuf_animation_ref and gdk_pixbuf_animation_unref
resp.
* gdk-pixbuf-csource.c, io-bmp.c, io-gif-animation.c, io-ico.c,
io-jpeg.c, io-png.c, io-pnm.c, io-ras.c, io-tga.c, io-wbmp.c,
io-xbm.c, io-xpm.c, test-gdk-pixbuf.c: Dito for gdk_pixbuf_ref and
gdk_pixbuf_unref.
* Makefile.am, pixops/Makefile.am: Compile everything with
-DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
* gdk-pixdata.c: Use g_ascii_strup() instead of g_strup().
* io-xpm.c: Use g_ascii_strcasecmp() instead of g_strcasecmp().
* demos/testpixbuf-drawable.c, demos/testpixbuf-save.c,
demos/testpixbuf-scale.c, demos/testpixbuf.c: Call g_object_ref
and g_object_unref instead of gdk_pixbuf_ref and gdk_pixbuf_unref
resp.
2001-12-13 21:22:12 +00:00
|
|
|
g_object_ref (pixbuf);
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
return GDK_PIXBUF_ANIMATION (non_anim);
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
}
|
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_pixbuf_non_anim_is_static_image (GdkPixbufAnimation *animation)
|
|
|
|
{
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GdkPixbuf*
|
|
|
|
gdk_pixbuf_non_anim_get_static_image (GdkPixbufAnimation *animation)
|
|
|
|
{
|
|
|
|
GdkPixbufNonAnim *non_anim;
|
|
|
|
|
|
|
|
non_anim = GDK_PIXBUF_NON_ANIM (animation);
|
|
|
|
|
|
|
|
return non_anim->pixbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_pixbuf_non_anim_get_size (GdkPixbufAnimation *anim,
|
|
|
|
int *width,
|
|
|
|
int *height)
|
|
|
|
{
|
|
|
|
GdkPixbufNonAnim *non_anim;
|
|
|
|
|
|
|
|
non_anim = GDK_PIXBUF_NON_ANIM (anim);
|
|
|
|
|
|
|
|
if (width)
|
|
|
|
*width = gdk_pixbuf_get_width (non_anim->pixbuf);
|
|
|
|
|
|
|
|
if (height)
|
|
|
|
*height = gdk_pixbuf_get_height (non_anim->pixbuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GdkPixbufAnimationIter*
|
|
|
|
gdk_pixbuf_non_anim_get_iter (GdkPixbufAnimation *anim,
|
|
|
|
const GTimeVal *start_time)
|
|
|
|
{
|
|
|
|
GdkPixbufNonAnimIter *iter;
|
|
|
|
|
|
|
|
iter = g_object_new (GDK_TYPE_PIXBUF_NON_ANIM_ITER, NULL);
|
|
|
|
|
|
|
|
iter->non_anim = GDK_PIXBUF_NON_ANIM (anim);
|
|
|
|
|
Remove assorted G_OBJECT casts where unnecessary.
2001-12-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk-pixbuf-animation.c, gdk-pixbuf-loader.c, gdk-pixpuf.c,
io-gif-animation.c, io-gif.c, io-tiff.c, test-loaders.c: Remove
assorted G_OBJECT casts where unnecessary.
* gdk-pixbuf-loader.c: Call g_object_ref and g_object_unref
instead of gdk_pixbuf_animation_ref and gdk_pixbuf_animation_unref
resp.
* gdk-pixbuf-csource.c, io-bmp.c, io-gif-animation.c, io-ico.c,
io-jpeg.c, io-png.c, io-pnm.c, io-ras.c, io-tga.c, io-wbmp.c,
io-xbm.c, io-xpm.c, test-gdk-pixbuf.c: Dito for gdk_pixbuf_ref and
gdk_pixbuf_unref.
* Makefile.am, pixops/Makefile.am: Compile everything with
-DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
* gdk-pixdata.c: Use g_ascii_strup() instead of g_strup().
* io-xpm.c: Use g_ascii_strcasecmp() instead of g_strcasecmp().
* demos/testpixbuf-drawable.c, demos/testpixbuf-save.c,
demos/testpixbuf-scale.c, demos/testpixbuf.c: Call g_object_ref
and g_object_unref instead of gdk_pixbuf_ref and gdk_pixbuf_unref
resp.
2001-12-13 21:22:12 +00:00
|
|
|
g_object_ref (iter->non_anim);
|
2001-05-07 15:58:47 +00:00
|
|
|
|
|
|
|
return GDK_PIXBUF_ANIMATION_ITER (iter);
|
|
|
|
}
|
|
|
|
|
2007-11-21 04:12:13 +00:00
|
|
|
static void gdk_pixbuf_non_anim_iter_finalize (GObject *object);
|
2001-05-07 15:58:47 +00:00
|
|
|
static int gdk_pixbuf_non_anim_iter_get_delay_time (GdkPixbufAnimationIter *iter);
|
|
|
|
static GdkPixbuf* gdk_pixbuf_non_anim_iter_get_pixbuf (GdkPixbufAnimationIter *iter);
|
|
|
|
static gboolean gdk_pixbuf_non_anim_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter);
|
|
|
|
static gboolean gdk_pixbuf_non_anim_iter_advance (GdkPixbufAnimationIter *iter,
|
|
|
|
const GTimeVal *current_time);
|
|
|
|
|
2007-11-21 04:12:13 +00:00
|
|
|
G_DEFINE_TYPE (GdkPixbufNonAnimIter,
|
|
|
|
gdk_pixbuf_non_anim_iter,
|
|
|
|
GDK_TYPE_PIXBUF_ANIMATION_ITER);
|
2001-05-07 15:58:47 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gdk_pixbuf_non_anim_iter_class_init (GdkPixbufNonAnimIterClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GdkPixbufAnimationIterClass *anim_iter_class =
|
|
|
|
GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->finalize = gdk_pixbuf_non_anim_iter_finalize;
|
|
|
|
|
|
|
|
anim_iter_class->get_delay_time = gdk_pixbuf_non_anim_iter_get_delay_time;
|
|
|
|
anim_iter_class->get_pixbuf = gdk_pixbuf_non_anim_iter_get_pixbuf;
|
|
|
|
anim_iter_class->on_currently_loading_frame = gdk_pixbuf_non_anim_iter_on_currently_loading_frame;
|
|
|
|
anim_iter_class->advance = gdk_pixbuf_non_anim_iter_advance;
|
|
|
|
}
|
|
|
|
|
2007-11-21 04:12:13 +00:00
|
|
|
static void
|
|
|
|
gdk_pixbuf_non_anim_iter_init (GdkPixbufNonAnimIter *non_iter)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
static void
|
|
|
|
gdk_pixbuf_non_anim_iter_finalize (GObject *object)
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
{
|
2001-05-07 15:58:47 +00:00
|
|
|
GdkPixbufNonAnimIter *iter = GDK_PIXBUF_NON_ANIM_ITER (object);
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
Remove assorted G_OBJECT casts where unnecessary.
2001-12-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* gdk-pixbuf-animation.c, gdk-pixbuf-loader.c, gdk-pixpuf.c,
io-gif-animation.c, io-gif.c, io-tiff.c, test-loaders.c: Remove
assorted G_OBJECT casts where unnecessary.
* gdk-pixbuf-loader.c: Call g_object_ref and g_object_unref
instead of gdk_pixbuf_animation_ref and gdk_pixbuf_animation_unref
resp.
* gdk-pixbuf-csource.c, io-bmp.c, io-gif-animation.c, io-ico.c,
io-jpeg.c, io-png.c, io-pnm.c, io-ras.c, io-tga.c, io-wbmp.c,
io-xbm.c, io-xpm.c, test-gdk-pixbuf.c: Dito for gdk_pixbuf_ref and
gdk_pixbuf_unref.
* Makefile.am, pixops/Makefile.am: Compile everything with
-DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
* gdk-pixdata.c: Use g_ascii_strup() instead of g_strup().
* io-xpm.c: Use g_ascii_strcasecmp() instead of g_strcasecmp().
* demos/testpixbuf-drawable.c, demos/testpixbuf-save.c,
demos/testpixbuf-scale.c, demos/testpixbuf.c: Call g_object_ref
and g_object_unref instead of gdk_pixbuf_ref and gdk_pixbuf_unref
resp.
2001-12-13 21:22:12 +00:00
|
|
|
g_object_unref (iter->non_anim);
|
2001-05-07 15:58:47 +00:00
|
|
|
|
2007-11-21 04:12:13 +00:00
|
|
|
G_OBJECT_CLASS (gdk_pixbuf_non_anim_iter_parent_class)->finalize (object);
|
2001-05-07 15:58:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
gdk_pixbuf_non_anim_iter_get_delay_time (GdkPixbufAnimationIter *iter)
|
|
|
|
{
|
|
|
|
return -1; /* show only frame forever */
|
|
|
|
}
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
2001-05-07 15:58:47 +00:00
|
|
|
static GdkPixbuf*
|
|
|
|
gdk_pixbuf_non_anim_iter_get_pixbuf (GdkPixbufAnimationIter *iter)
|
|
|
|
{
|
|
|
|
return GDK_PIXBUF_NON_ANIM_ITER (iter)->non_anim->pixbuf;
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
}
|
2001-05-07 15:58:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gdk_pixbuf_non_anim_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gdk_pixbuf_non_anim_iter_advance (GdkPixbufAnimationIter *iter,
|
|
|
|
const GTimeVal *current_time)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Advancing never requires a refresh */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-03-14 19:37:00 +00:00
|
|
|
#define __GDK_PIXBUF_ANIMATION_C__
|
|
|
|
#include "gdk-pixbuf-aliasdef.c"
|