1998-10-30 18:21:33 +08:00
|
|
|
/* parasitelist.c: Copyright 1998 Jay Cox <jaycox@earthlink.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2000-12-17 05:37:03 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
1999-02-21 07:20:54 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2000-12-17 05:37:03 +08:00
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-05-21 21:58:46 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
|
|
|
|
2001-07-10 03:48:30 +08:00
|
|
|
#include "core-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-07-10 03:48:30 +08:00
|
|
|
#include "gimpparasitelist.h"
|
2000-05-27 06:28:40 +08:00
|
|
|
|
|
|
|
|
1998-10-30 18:21:33 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ADD,
|
|
|
|
REMOVE,
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
static void gimp_parasite_list_class_init (GimpParasiteListClass *klass);
|
|
|
|
static void gimp_parasite_list_init (GimpParasiteList *list);
|
|
|
|
static void gimp_parasite_list_destroy (GtkObject *list);
|
2001-01-10 08:36:54 +08:00
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
static gint free_a_parasite (gpointer key,
|
|
|
|
gpointer parasite,
|
|
|
|
gpointer unused);
|
2001-01-10 08:36:54 +08:00
|
|
|
|
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
static guint parasite_list_signals[LAST_SIGNAL] = { 0 };
|
1998-10-30 18:21:33 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
2001-07-05 06:59:25 +08:00
|
|
|
gimp_parasite_list_class_init (GimpParasiteListClass *klass)
|
1998-10-30 18:21:33 +08:00
|
|
|
{
|
2001-01-10 08:36:54 +08:00
|
|
|
GtkObjectClass *object_class;
|
1998-10-30 18:21:33 +08:00
|
|
|
|
2001-01-10 08:36:54 +08:00
|
|
|
object_class = (GtkObjectClass *) klass;
|
1998-10-30 18:21:33 +08:00
|
|
|
|
|
|
|
parasite_list_signals[ADD] =
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_signal_new ("add",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpParasiteListClass, add),
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__POINTER,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
G_TYPE_POINTER);
|
2000-05-27 06:28:40 +08:00
|
|
|
|
2001-01-10 08:36:54 +08:00
|
|
|
parasite_list_signals[REMOVE] =
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
g_signal_new ("remove",
|
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpParasiteListClass, remove),
|
|
|
|
NULL, NULL,
|
|
|
|
g_cclosure_marshal_VOID__POINTER,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GTK_TYPE_POINTER);
|
2001-01-10 08:36:54 +08:00
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
object_class->destroy = gimp_parasite_list_destroy;
|
2001-01-10 08:36:54 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
klass->add = NULL;
|
|
|
|
klass->remove = NULL;
|
1998-10-30 18:21:33 +08:00
|
|
|
}
|
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
static void
|
|
|
|
gimp_parasite_list_init (GimpParasiteList *list)
|
|
|
|
{
|
|
|
|
list->table = NULL;
|
|
|
|
}
|
|
|
|
|
1998-10-30 18:21:33 +08:00
|
|
|
GtkType
|
2001-07-05 06:59:25 +08:00
|
|
|
gimp_parasite_list_get_type (void)
|
1998-10-30 18:21:33 +08:00
|
|
|
{
|
|
|
|
static GtkType type = 0;
|
2000-01-11 07:27:25 +08:00
|
|
|
|
2001-01-10 08:36:54 +08:00
|
|
|
if (! type)
|
1998-10-30 18:21:33 +08:00
|
|
|
{
|
2000-01-11 07:27:25 +08:00
|
|
|
GtkTypeInfo info =
|
|
|
|
{
|
2001-07-05 06:59:25 +08:00
|
|
|
"GimpParasiteList",
|
|
|
|
sizeof (GimpParasiteList),
|
|
|
|
sizeof (GimpParasiteListClass),
|
|
|
|
(GtkClassInitFunc) gimp_parasite_list_class_init,
|
|
|
|
(GtkObjectInitFunc) gimp_parasite_list_init,
|
2000-01-11 07:27:25 +08:00
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
(GtkClassInitFunc) NULL
|
|
|
|
};
|
2001-01-10 08:36:54 +08:00
|
|
|
|
2000-01-11 07:27:25 +08:00
|
|
|
type = gtk_type_unique (GIMP_TYPE_OBJECT, &info);
|
|
|
|
}
|
2001-01-10 08:36:54 +08:00
|
|
|
|
1998-10-30 18:21:33 +08:00
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
GimpParasiteList *
|
|
|
|
gimp_parasite_list_new (void)
|
1998-10-30 18:21:33 +08:00
|
|
|
{
|
2001-07-05 06:59:25 +08:00
|
|
|
GimpParasiteList *list = gtk_type_new (GIMP_TYPE_PARASITE_LIST);
|
|
|
|
|
|
|
|
list = gtk_type_new (GIMP_TYPE_PARASITE_LIST);
|
|
|
|
|
1998-10-30 18:21:33 +08:00
|
|
|
return list;
|
|
|
|
}
|
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
static gint
|
2000-01-11 07:27:25 +08:00
|
|
|
free_a_parasite (void *key,
|
|
|
|
void *parasite,
|
|
|
|
void *unused)
|
1998-10-30 18:21:33 +08:00
|
|
|
{
|
2000-05-27 06:28:40 +08:00
|
|
|
gimp_parasite_free ((GimpParasite *) parasite);
|
2001-07-05 06:59:25 +08:00
|
|
|
|
1998-10-30 18:21:33 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-07-05 06:59:25 +08:00
|
|
|
gimp_parasite_list_destroy (GtkObject *object)
|
1998-10-30 18:21:33 +08:00
|
|
|
{
|
2001-07-05 06:59:25 +08:00
|
|
|
GimpParasiteList *list;
|
1998-10-30 18:21:33 +08:00
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
g_return_if_fail (object != NULL);
|
|
|
|
g_return_if_fail (GIMP_IS_PARASITE_LIST (object));
|
1998-10-30 18:21:33 +08:00
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
list = GIMP_PARASITE_LIST (object);
|
1998-10-30 18:21:33 +08:00
|
|
|
|
|
|
|
if (list->table)
|
2000-01-11 07:27:25 +08:00
|
|
|
{
|
|
|
|
g_hash_table_foreach_remove (list->table, free_a_parasite, NULL);
|
|
|
|
g_hash_table_destroy (list->table);
|
|
|
|
}
|
1998-10-30 18:21:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-01-11 07:27:25 +08:00
|
|
|
parasite_copy_one (void *key,
|
|
|
|
void *p,
|
|
|
|
void *data)
|
1998-10-30 18:21:33 +08:00
|
|
|
{
|
2001-07-05 06:59:25 +08:00
|
|
|
GimpParasiteList *list = (GimpParasiteList *) data;
|
|
|
|
GimpParasite *parasite = (GimpParasite *) p;
|
2000-05-27 06:28:40 +08:00
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
gimp_parasite_list_add (list, parasite);
|
1998-10-30 18:21:33 +08:00
|
|
|
}
|
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
GimpParasiteList *
|
|
|
|
gimp_parasite_list_copy (const GimpParasiteList *list)
|
1998-10-30 18:21:33 +08:00
|
|
|
{
|
2001-07-05 06:59:25 +08:00
|
|
|
GimpParasiteList *newlist;
|
2000-01-11 07:27:25 +08:00
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
newlist = gimp_parasite_list_new ();
|
1998-10-30 18:21:33 +08:00
|
|
|
if (list->table)
|
2000-01-11 07:27:25 +08:00
|
|
|
g_hash_table_foreach (list->table, parasite_copy_one, newlist);
|
|
|
|
|
1998-10-30 18:21:33 +08:00
|
|
|
return newlist;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-07-05 06:59:25 +08:00
|
|
|
gimp_parasite_list_add (GimpParasiteList *list,
|
|
|
|
GimpParasite *parasite)
|
1998-10-30 18:21:33 +08:00
|
|
|
{
|
2000-01-11 07:27:25 +08:00
|
|
|
g_return_if_fail (list != NULL);
|
|
|
|
|
1998-10-30 18:21:33 +08:00
|
|
|
if (list->table == NULL)
|
2000-01-11 07:27:25 +08:00
|
|
|
list->table = g_hash_table_new (g_str_hash, g_str_equal);
|
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
g_return_if_fail (parasite != NULL);
|
|
|
|
g_return_if_fail (parasite->name != NULL);
|
2000-01-11 07:27:25 +08:00
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
gimp_parasite_list_remove (list, parasite->name);
|
|
|
|
parasite = gimp_parasite_copy (parasite);
|
|
|
|
g_hash_table_insert (list->table, parasite->name, parasite);
|
|
|
|
|
|
|
|
gtk_signal_emit (GTK_OBJECT (list), parasite_list_signals[ADD], parasite);
|
1998-10-30 18:21:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-07-05 06:59:25 +08:00
|
|
|
gimp_parasite_list_remove (GimpParasiteList *list,
|
|
|
|
const gchar *name)
|
1998-10-30 18:21:33 +08:00
|
|
|
{
|
2001-07-05 06:59:25 +08:00
|
|
|
GimpParasite *parasite;
|
2000-01-11 07:27:25 +08:00
|
|
|
|
|
|
|
g_return_if_fail (list != NULL);
|
|
|
|
|
1998-10-30 18:21:33 +08:00
|
|
|
if (list->table)
|
|
|
|
{
|
2001-07-05 06:59:25 +08:00
|
|
|
parasite = gimp_parasite_list_find (list, name);
|
|
|
|
|
|
|
|
if (parasite)
|
2000-01-11 07:27:25 +08:00
|
|
|
{
|
|
|
|
g_hash_table_remove (list->table, name);
|
2001-07-05 06:59:25 +08:00
|
|
|
|
|
|
|
gtk_signal_emit (GTK_OBJECT (list), parasite_list_signals[REMOVE],
|
|
|
|
parasite);
|
|
|
|
|
|
|
|
gimp_parasite_free (parasite);
|
2000-01-11 07:27:25 +08:00
|
|
|
}
|
1998-10-30 18:21:33 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-12-16 19:23:30 +08:00
|
|
|
gint
|
2001-07-05 06:59:25 +08:00
|
|
|
gimp_parasite_list_length (GimpParasiteList *list)
|
1998-12-16 19:23:30 +08:00
|
|
|
{
|
2000-01-11 07:27:25 +08:00
|
|
|
g_return_val_if_fail (list != NULL, 0);
|
|
|
|
|
1998-12-16 19:23:30 +08:00
|
|
|
if (!list->table)
|
|
|
|
return 0;
|
2001-07-05 06:59:25 +08:00
|
|
|
|
2000-01-11 07:27:25 +08:00
|
|
|
return g_hash_table_size (list->table);
|
1998-12-16 19:23:30 +08:00
|
|
|
}
|
|
|
|
|
2000-01-11 07:27:25 +08:00
|
|
|
static void
|
2000-05-27 06:28:40 +08:00
|
|
|
ppcount_func (gchar *key,
|
|
|
|
GimpParasite *p,
|
|
|
|
gint *count)
|
1998-12-16 19:23:30 +08:00
|
|
|
{
|
2000-05-27 06:28:40 +08:00
|
|
|
if (gimp_parasite_is_persistent (p))
|
1998-12-16 19:23:30 +08:00
|
|
|
*count = *count + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
2001-07-05 06:59:25 +08:00
|
|
|
gimp_parasite_list_persistent_length (GimpParasiteList *list)
|
1998-12-16 19:23:30 +08:00
|
|
|
{
|
2000-05-27 06:28:40 +08:00
|
|
|
gint ppcount = 0;
|
2000-01-11 07:27:25 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (list != NULL, 0);
|
|
|
|
|
1998-12-16 19:23:30 +08:00
|
|
|
if (!list->table)
|
|
|
|
return 0;
|
2000-01-11 07:27:25 +08:00
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
gimp_parasite_list_foreach (list, (GHFunc) ppcount_func, &ppcount);
|
2000-05-27 06:28:40 +08:00
|
|
|
|
1998-12-16 19:23:30 +08:00
|
|
|
return ppcount;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-07-05 06:59:25 +08:00
|
|
|
gimp_parasite_list_foreach (GimpParasiteList *list,
|
|
|
|
GHFunc function,
|
|
|
|
gpointer user_data)
|
1998-12-16 19:23:30 +08:00
|
|
|
{
|
2000-01-11 07:27:25 +08:00
|
|
|
g_return_if_fail (list != NULL);
|
|
|
|
|
1998-12-16 19:23:30 +08:00
|
|
|
if (!list->table)
|
|
|
|
return;
|
2000-01-11 07:27:25 +08:00
|
|
|
|
|
|
|
g_hash_table_foreach (list->table, function, user_data);
|
1998-12-16 19:23:30 +08:00
|
|
|
}
|
|
|
|
|
2000-05-27 06:28:40 +08:00
|
|
|
GimpParasite *
|
2001-07-05 06:59:25 +08:00
|
|
|
gimp_parasite_list_find (GimpParasiteList *list,
|
|
|
|
const gchar *name)
|
1998-10-30 18:21:33 +08:00
|
|
|
{
|
2000-01-11 07:27:25 +08:00
|
|
|
g_return_val_if_fail (list != NULL, NULL);
|
|
|
|
|
1998-10-30 18:21:33 +08:00
|
|
|
if (list->table)
|
2000-05-27 06:28:40 +08:00
|
|
|
return (GimpParasite *) g_hash_table_lookup (list->table, name);
|
1998-10-30 18:21:33 +08:00
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1998-12-16 19:23:30 +08:00
|
|
|
void
|
2001-07-05 06:59:25 +08:00
|
|
|
gimp_parasite_shift_parent (GimpParasite *parasite)
|
1998-12-16 19:23:30 +08:00
|
|
|
{
|
2001-07-05 06:59:25 +08:00
|
|
|
if (parasite == NULL)
|
1998-12-16 19:23:30 +08:00
|
|
|
return;
|
2000-01-11 07:27:25 +08:00
|
|
|
|
2001-07-05 06:59:25 +08:00
|
|
|
parasite->flags = (parasite->flags >> 8);
|
1998-12-16 19:23:30 +08:00
|
|
|
}
|