2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
2001-02-04 00:51:10 +08:00
|
|
|
* Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2001-04-22 08:38:56 +08:00
|
|
|
* gimpcontainer.c
|
|
|
|
* Copyright (C) 2001 Michael Natterer <mitch@gimp.org>
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
2001-02-04 00:51:10 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
2001-02-04 00:51:10 +08:00
|
|
|
* (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
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2001-02-04 00:51:10 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2014-07-01 07:54:31 +08:00
|
|
|
#include <gio/gio.h>
|
2012-03-22 04:58:40 +08:00
|
|
|
#include <gegl.h>
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2005-01-26 03:11:26 +08:00
|
|
|
#include "libgimpconfig/gimpconfig.h"
|
|
|
|
|
2001-05-10 06:34:59 +08:00
|
|
|
#include "core-types.h"
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2002-05-27 22:04:21 +08:00
|
|
|
#include "gimp.h"
|
2014-08-12 19:57:57 +08:00
|
|
|
#include "gimp-memsize.h"
|
2001-02-04 00:51:10 +08:00
|
|
|
#include "gimpcontainer.h"
|
2001-02-06 01:48:50 +08:00
|
|
|
#include "gimpmarshal.h"
|
2001-02-04 00:51:10 +08:00
|
|
|
|
|
|
|
|
2002-05-10 20:38:41 +08:00
|
|
|
/* #define DEBUG_CONTAINER */
|
|
|
|
|
|
|
|
#ifdef DEBUG_CONTAINER
|
2002-09-07 06:25:19 +08:00
|
|
|
#define D(stmnt) stmnt
|
2002-05-10 20:38:41 +08:00
|
|
|
#else
|
2002-09-07 06:25:19 +08:00
|
|
|
#define D(stmnt)
|
2002-05-10 20:38:41 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2001-02-04 00:51:10 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ADD,
|
|
|
|
REMOVE,
|
2001-02-18 05:20:10 +08:00
|
|
|
REORDER,
|
2001-02-12 05:08:04 +08:00
|
|
|
FREEZE,
|
|
|
|
THAW,
|
2001-02-04 00:51:10 +08:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2001-10-18 20:43:31 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_CHILDREN_TYPE,
|
|
|
|
PROP_POLICY
|
|
|
|
};
|
|
|
|
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2008-11-21 03:19:54 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gchar *signame;
|
|
|
|
GCallback callback;
|
|
|
|
gpointer callback_data;
|
|
|
|
|
|
|
|
GQuark quark; /* used to attach the signal id's of child signals */
|
|
|
|
} GimpContainerHandler;
|
|
|
|
|
app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()
g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58. Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.
This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.
Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-19 00:09:39 +08:00
|
|
|
struct _GimpContainerPrivate
|
2008-11-21 03:19:54 +08:00
|
|
|
{
|
2008-11-21 07:51:39 +08:00
|
|
|
GType children_type;
|
|
|
|
GimpContainerPolicy policy;
|
|
|
|
gint n_children;
|
|
|
|
|
|
|
|
GList *handlers;
|
|
|
|
gint freeze_count;
|
2008-11-21 03:19:54 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-02-04 00:51:10 +08:00
|
|
|
/* local function prototypes */
|
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
static void gimp_container_config_iface_init (GimpConfigInterface *iface);
|
2001-08-12 23:39:23 +08:00
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
static void gimp_container_dispose (GObject *object);
|
2001-08-12 23:39:23 +08:00
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
static void gimp_container_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gimp_container_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2001-10-18 20:43:31 +08:00
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
static gint64 gimp_container_get_memsize (GimpObject *object,
|
|
|
|
gint64 *gui_size);
|
2002-05-24 10:53:20 +08:00
|
|
|
|
2008-10-11 18:14:21 +08:00
|
|
|
static void gimp_container_real_add (GimpContainer *container,
|
|
|
|
GimpObject *object);
|
|
|
|
static void gimp_container_real_remove (GimpContainer *container,
|
|
|
|
GimpObject *object);
|
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
static gboolean gimp_container_serialize (GimpConfig *config,
|
|
|
|
GimpConfigWriter *writer,
|
|
|
|
gpointer data);
|
|
|
|
static gboolean gimp_container_deserialize (GimpConfig *config,
|
|
|
|
GScanner *scanner,
|
|
|
|
gint nest_level,
|
|
|
|
gpointer data);
|
2002-01-31 00:14:26 +08:00
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
static void gimp_container_disconnect_callback (GimpObject *object,
|
2006-04-12 20:49:29 +08:00
|
|
|
gpointer data);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (GimpContainer, gimp_container, GIMP_TYPE_OBJECT,
|
app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()
g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58. Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.
This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.
Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-19 00:09:39 +08:00
|
|
|
G_ADD_PRIVATE (GimpContainer)
|
2005-12-11 03:24:36 +08:00
|
|
|
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
|
2006-05-15 17:46:31 +08:00
|
|
|
gimp_container_config_iface_init))
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
#define parent_class gimp_container_parent_class
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2005-12-11 03:24:36 +08:00
|
|
|
static guint container_signals[LAST_SIGNAL] = { 0, };
|
2001-02-04 00:51:10 +08:00
|
|
|
|
|
|
|
|
|
|
|
static void
|
2001-08-12 23:39:23 +08:00
|
|
|
gimp_container_class_init (GimpContainerClass *klass)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
2005-12-11 03:24:36 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
|
|
|
container_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",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContainerClass, add),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__OBJECT,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_OBJECT);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
|
|
|
container_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",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContainerClass, remove),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__OBJECT,
|
|
|
|
G_TYPE_NONE, 1,
|
|
|
|
GIMP_TYPE_OBJECT);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2001-02-18 05:20:10 +08:00
|
|
|
container_signals[REORDER] =
|
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 ("reorder",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpContainerClass, reorder),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__OBJECT_INT,
|
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
GIMP_TYPE_OBJECT,
|
|
|
|
G_TYPE_INT);
|
2001-02-18 05:20:10 +08:00
|
|
|
|
2001-02-12 05:08:04 +08:00
|
|
|
container_signals[FREEZE] =
|
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 ("freeze",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GimpContainerClass, freeze),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
2001-02-12 05:08:04 +08:00
|
|
|
|
|
|
|
container_signals[THAW] =
|
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 ("thaw",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GimpContainerClass, thaw),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__VOID,
|
|
|
|
G_TYPE_NONE, 0);
|
2001-02-12 05:08:04 +08:00
|
|
|
|
2002-01-31 00:14:26 +08:00
|
|
|
object_class->dispose = gimp_container_dispose;
|
|
|
|
object_class->set_property = gimp_container_set_property;
|
|
|
|
object_class->get_property = gimp_container_get_property;
|
|
|
|
|
|
|
|
gimp_object_class->get_memsize = gimp_container_get_memsize;
|
2001-10-18 20:43:31 +08:00
|
|
|
|
2008-10-11 18:14:21 +08:00
|
|
|
klass->add = gimp_container_real_add;
|
|
|
|
klass->remove = gimp_container_real_remove;
|
2002-01-31 00:14:26 +08:00
|
|
|
klass->reorder = NULL;
|
|
|
|
klass->freeze = NULL;
|
|
|
|
klass->thaw = NULL;
|
2001-10-18 20:43:31 +08:00
|
|
|
|
2003-08-26 05:25:13 +08:00
|
|
|
klass->clear = NULL;
|
2002-01-31 00:14:26 +08:00
|
|
|
klass->have = NULL;
|
|
|
|
klass->foreach = NULL;
|
|
|
|
klass->get_child_by_name = NULL;
|
|
|
|
klass->get_child_by_index = NULL;
|
|
|
|
klass->get_child_index = NULL;
|
2001-10-18 20:43:31 +08:00
|
|
|
|
2006-01-19 04:29:40 +08:00
|
|
|
g_object_class_install_property (object_class, PROP_CHILDREN_TYPE,
|
2006-09-24 20:20:22 +08:00
|
|
|
g_param_spec_gtype ("children-type",
|
|
|
|
NULL, NULL,
|
|
|
|
GIMP_TYPE_OBJECT,
|
|
|
|
GIMP_PARAM_READWRITE |
|
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
2001-10-18 20:43:31 +08:00
|
|
|
|
2006-01-19 04:29:40 +08:00
|
|
|
g_object_class_install_property (object_class, PROP_POLICY,
|
2006-04-12 20:49:29 +08:00
|
|
|
g_param_spec_enum ("policy",
|
2001-10-18 20:43:31 +08:00
|
|
|
NULL, NULL,
|
|
|
|
GIMP_TYPE_CONTAINER_POLICY,
|
|
|
|
GIMP_CONTAINER_POLICY_STRONG,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_READWRITE |
|
|
|
|
G_PARAM_CONSTRUCT_ONLY));
|
2001-08-12 23:39:23 +08:00
|
|
|
}
|
|
|
|
|
2006-09-24 20:20:22 +08:00
|
|
|
static void
|
|
|
|
gimp_container_config_iface_init (GimpConfigInterface *iface)
|
|
|
|
{
|
|
|
|
iface->serialize = gimp_container_serialize;
|
|
|
|
iface->deserialize = gimp_container_deserialize;
|
|
|
|
}
|
|
|
|
|
2001-08-12 23:39:23 +08:00
|
|
|
static void
|
|
|
|
gimp_container_init (GimpContainer *container)
|
|
|
|
{
|
app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()
g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58. Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.
This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.
Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-19 00:09:39 +08:00
|
|
|
container->priv = gimp_container_get_instance_private (container);
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->handlers = NULL;
|
|
|
|
container->priv->freeze_count = 0;
|
2008-11-21 03:19:54 +08:00
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->children_type = G_TYPE_NONE;
|
|
|
|
container->priv->policy = GIMP_CONTAINER_POLICY_STRONG;
|
|
|
|
container->priv->n_children = 0;
|
2001-02-04 00:51:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-08-11 22:39:19 +08:00
|
|
|
gimp_container_dispose (GObject *object)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
2004-02-18 21:43:50 +08:00
|
|
|
GimpContainer *container = GIMP_CONTAINER (object);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2004-03-16 21:03:24 +08:00
|
|
|
gimp_container_clear (container);
|
|
|
|
|
2008-11-21 03:19:54 +08:00
|
|
|
while (container->priv->handlers)
|
2003-08-26 05:25:13 +08:00
|
|
|
gimp_container_remove_handler (container,
|
|
|
|
((GimpContainerHandler *)
|
2008-11-21 03:19:54 +08:00
|
|
|
container->priv->handlers->data)->quark);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
if (container->priv->children_type != G_TYPE_NONE)
|
2001-10-18 20:43:31 +08:00
|
|
|
{
|
2008-11-21 07:51:39 +08:00
|
|
|
g_type_class_unref (g_type_class_peek (container->priv->children_type));
|
|
|
|
container->priv->children_type = G_TYPE_NONE;
|
2001-10-18 20:43:31 +08:00
|
|
|
}
|
|
|
|
|
2001-08-11 22:39:19 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
2001-02-04 00:51:10 +08:00
|
|
|
}
|
|
|
|
|
2001-10-18 20:43:31 +08:00
|
|
|
static void
|
|
|
|
gimp_container_set_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2004-02-18 21:43:50 +08:00
|
|
|
GimpContainer *container = GIMP_CONTAINER (object);
|
2001-10-18 20:43:31 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_CHILDREN_TYPE:
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->children_type = g_value_get_gtype (value);
|
|
|
|
g_type_class_ref (container->priv->children_type);
|
2001-10-18 20:43:31 +08:00
|
|
|
break;
|
|
|
|
case PROP_POLICY:
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->policy = g_value_get_enum (value);
|
2001-10-18 20:43:31 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_container_get_property (GObject *object,
|
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2004-02-18 21:43:50 +08:00
|
|
|
GimpContainer *container = GIMP_CONTAINER (object);
|
2001-10-18 20:43:31 +08:00
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_CHILDREN_TYPE:
|
2008-11-21 07:51:39 +08:00
|
|
|
g_value_set_gtype (value, container->priv->children_type);
|
2001-10-18 20:43:31 +08:00
|
|
|
break;
|
|
|
|
case PROP_POLICY:
|
2008-11-21 07:51:39 +08:00
|
|
|
g_value_set_enum (value, container->priv->policy);
|
2001-10-18 20:43:31 +08:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-17 01:51:36 +08:00
|
|
|
static gint64
|
2003-08-25 18:49:33 +08:00
|
|
|
gimp_container_get_memsize (GimpObject *object,
|
2003-11-17 01:51:36 +08:00
|
|
|
gint64 *gui_size)
|
2002-01-31 00:14:26 +08:00
|
|
|
{
|
2004-02-18 21:43:50 +08:00
|
|
|
GimpContainer *container = GIMP_CONTAINER (object);
|
|
|
|
gint64 memsize = 0;
|
2002-01-31 00:14:26 +08:00
|
|
|
GList *list;
|
|
|
|
|
2008-11-21 03:19:54 +08:00
|
|
|
for (list = container->priv->handlers; list; list = g_list_next (list))
|
2002-01-31 00:14:26 +08:00
|
|
|
{
|
2003-08-26 05:25:13 +08:00
|
|
|
GimpContainerHandler *handler = list->data;
|
2002-01-31 00:14:26 +08:00
|
|
|
|
|
|
|
memsize += (sizeof (GList) +
|
|
|
|
sizeof (GimpContainerHandler) +
|
2007-11-17 02:19:30 +08:00
|
|
|
gimp_string_get_memsize (handler->signame));
|
2002-01-31 00:14:26 +08:00
|
|
|
}
|
|
|
|
|
2003-08-25 18:49:33 +08:00
|
|
|
return memsize + GIMP_OBJECT_CLASS (parent_class)->get_memsize (object,
|
|
|
|
gui_size);
|
2002-01-31 00:14:26 +08:00
|
|
|
}
|
|
|
|
|
2008-10-11 18:14:21 +08:00
|
|
|
static void
|
|
|
|
gimp_container_real_add (GimpContainer *container,
|
|
|
|
GimpObject *object)
|
|
|
|
{
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->n_children++;
|
2008-10-11 18:14:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_container_real_remove (GimpContainer *container,
|
|
|
|
GimpObject *object)
|
|
|
|
{
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->n_children--;
|
2008-10-11 18:14:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-05-24 10:53:20 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
2003-03-06 04:21:50 +08:00
|
|
|
GimpConfigWriter *writer;
|
|
|
|
gpointer data;
|
|
|
|
gboolean success;
|
2002-05-24 10:53:20 +08:00
|
|
|
} SerializeData;
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_container_serialize_foreach (GObject *object,
|
|
|
|
SerializeData *serialize_data)
|
|
|
|
{
|
|
|
|
GimpConfigInterface *config_iface;
|
2002-10-23 22:55:07 +08:00
|
|
|
const gchar *name;
|
2002-05-24 10:53:20 +08:00
|
|
|
|
2003-10-11 22:30:18 +08:00
|
|
|
config_iface = GIMP_CONFIG_GET_INTERFACE (object);
|
2002-05-24 10:53:20 +08:00
|
|
|
|
|
|
|
if (! config_iface)
|
|
|
|
serialize_data->success = FALSE;
|
|
|
|
|
|
|
|
if (! serialize_data->success)
|
|
|
|
return;
|
|
|
|
|
2003-03-06 04:21:50 +08:00
|
|
|
gimp_config_writer_open (serialize_data->writer,
|
2006-04-12 20:49:29 +08:00
|
|
|
g_type_name (G_TYPE_FROM_INSTANCE (object)));
|
2002-05-24 10:53:20 +08:00
|
|
|
|
2009-09-01 04:47:18 +08:00
|
|
|
name = gimp_object_get_name (object);
|
2002-05-24 10:53:20 +08:00
|
|
|
|
|
|
|
if (name)
|
2003-03-17 22:23:42 +08:00
|
|
|
gimp_config_writer_string (serialize_data->writer, name);
|
2002-05-24 10:53:20 +08:00
|
|
|
else
|
2003-03-17 22:23:42 +08:00
|
|
|
gimp_config_writer_print (serialize_data->writer, "NULL", 4);
|
2002-05-24 10:53:20 +08:00
|
|
|
|
2003-10-11 22:30:18 +08:00
|
|
|
serialize_data->success = config_iface->serialize (GIMP_CONFIG (object),
|
2003-03-06 04:21:50 +08:00
|
|
|
serialize_data->writer,
|
2002-05-24 10:53:20 +08:00
|
|
|
serialize_data->data);
|
2003-03-06 04:21:50 +08:00
|
|
|
gimp_config_writer_close (serialize_data->writer);
|
2002-05-24 10:53:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-10-11 22:30:18 +08:00
|
|
|
gimp_container_serialize (GimpConfig *config,
|
2003-03-06 04:21:50 +08:00
|
|
|
GimpConfigWriter *writer,
|
|
|
|
gpointer data)
|
2002-05-24 10:53:20 +08:00
|
|
|
{
|
2003-10-11 23:18:44 +08:00
|
|
|
GimpContainer *container = GIMP_CONTAINER (config);
|
2002-05-24 10:53:20 +08:00
|
|
|
SerializeData serialize_data;
|
|
|
|
|
2003-03-06 04:21:50 +08:00
|
|
|
serialize_data.writer = writer;
|
|
|
|
serialize_data.data = data;
|
|
|
|
serialize_data.success = TRUE;
|
2002-05-24 10:53:20 +08:00
|
|
|
|
|
|
|
gimp_container_foreach (container,
|
|
|
|
(GFunc) gimp_container_serialize_foreach,
|
|
|
|
&serialize_data);
|
|
|
|
|
|
|
|
return serialize_data.success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-10-11 22:30:18 +08:00
|
|
|
gimp_container_deserialize (GimpConfig *config,
|
|
|
|
GScanner *scanner,
|
|
|
|
gint nest_level,
|
|
|
|
gpointer data)
|
2002-05-24 10:53:20 +08:00
|
|
|
{
|
2003-10-11 23:18:44 +08:00
|
|
|
GimpContainer *container = GIMP_CONTAINER (config);
|
2002-05-27 22:04:21 +08:00
|
|
|
GTokenType token;
|
2002-05-24 10:53:20 +08:00
|
|
|
|
2002-05-27 22:04:21 +08:00
|
|
|
token = G_TOKEN_LEFT_PAREN;
|
|
|
|
|
|
|
|
while (g_scanner_peek_next_token (scanner) == token)
|
|
|
|
{
|
|
|
|
token = g_scanner_get_next_token (scanner);
|
|
|
|
|
|
|
|
switch (token)
|
|
|
|
{
|
|
|
|
case G_TOKEN_LEFT_PAREN:
|
|
|
|
token = G_TOKEN_IDENTIFIER;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case G_TOKEN_IDENTIFIER:
|
|
|
|
{
|
|
|
|
GimpObject *child;
|
|
|
|
GType type;
|
2004-06-18 00:25:36 +08:00
|
|
|
gchar *name = NULL;
|
|
|
|
gboolean add_child = FALSE;
|
2002-05-27 22:04:21 +08:00
|
|
|
|
|
|
|
type = g_type_from_name (scanner->value.v_identifier);
|
|
|
|
|
|
|
|
if (! type)
|
|
|
|
{
|
|
|
|
g_scanner_error (scanner,
|
2002-06-09 20:53:42 +08:00
|
|
|
"unable to determine type of '%s'",
|
2002-05-27 22:04:21 +08:00
|
|
|
scanner->value.v_identifier);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
if (! g_type_is_a (type, container->priv->children_type))
|
2002-05-27 22:04:21 +08:00
|
|
|
{
|
|
|
|
g_scanner_error (scanner,
|
2002-06-09 20:53:42 +08:00
|
|
|
"'%s' is not a subclass of '%s'",
|
2002-05-27 22:04:21 +08:00
|
|
|
scanner->value.v_identifier,
|
2008-11-21 07:51:39 +08:00
|
|
|
g_type_name (container->priv->children_type));
|
2002-05-27 22:04:21 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-10-11 22:30:18 +08:00
|
|
|
if (! g_type_is_a (type, GIMP_TYPE_CONFIG))
|
2002-05-27 22:04:21 +08:00
|
|
|
{
|
|
|
|
g_scanner_error (scanner,
|
2002-06-09 20:53:42 +08:00
|
|
|
"'%s' does not implement GimpConfigInterface",
|
2002-05-27 22:04:21 +08:00
|
|
|
scanner->value.v_identifier);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! gimp_scanner_parse_string (scanner, &name))
|
|
|
|
{
|
|
|
|
token = G_TOKEN_STRING;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-04-13 20:27:44 +08:00
|
|
|
if (! name)
|
|
|
|
name = g_strdup ("");
|
|
|
|
|
2002-05-27 22:04:21 +08:00
|
|
|
child = gimp_container_get_child_by_name (container, name);
|
|
|
|
|
2002-05-29 00:41:56 +08:00
|
|
|
if (! child)
|
2002-05-27 22:04:21 +08:00
|
|
|
{
|
|
|
|
if (GIMP_IS_GIMP (data))
|
2007-02-11 20:48:41 +08:00
|
|
|
child = g_object_new (type, "gimp", data, NULL);
|
2002-05-27 22:04:21 +08:00
|
|
|
else
|
2007-02-11 20:48:41 +08:00
|
|
|
child = g_object_new (type, NULL);
|
2002-05-27 22:04:21 +08:00
|
|
|
|
2004-06-18 00:25:36 +08:00
|
|
|
add_child = TRUE;
|
2002-05-27 22:04:21 +08:00
|
|
|
}
|
2007-02-11 20:48:41 +08:00
|
|
|
|
|
|
|
/* always use the deserialized name. while it normally
|
|
|
|
* doesn't make a difference there are obscure case like
|
|
|
|
* template migration.
|
|
|
|
*/
|
|
|
|
gimp_object_take_name (child, name);
|
2003-04-13 20:27:44 +08:00
|
|
|
|
2003-10-11 23:18:44 +08:00
|
|
|
if (! GIMP_CONFIG_GET_INTERFACE (child)->deserialize (GIMP_CONFIG (child),
|
|
|
|
scanner,
|
|
|
|
nest_level + 1,
|
2004-11-14 10:50:33 +08:00
|
|
|
NULL))
|
2003-10-11 22:30:18 +08:00
|
|
|
{
|
2004-06-18 00:25:36 +08:00
|
|
|
if (add_child)
|
|
|
|
g_object_unref (child);
|
|
|
|
|
2003-10-11 22:30:18 +08:00
|
|
|
/* warning should be already set by child */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2004-06-18 00:25:36 +08:00
|
|
|
|
|
|
|
if (add_child)
|
|
|
|
{
|
|
|
|
gimp_container_add (container, child);
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
if (container->priv->policy == GIMP_CONTAINER_POLICY_STRONG)
|
2004-06-18 00:25:36 +08:00
|
|
|
g_object_unref (child);
|
|
|
|
}
|
2002-05-27 22:04:21 +08:00
|
|
|
}
|
|
|
|
token = G_TOKEN_RIGHT_PAREN;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case G_TOKEN_RIGHT_PAREN:
|
|
|
|
token = G_TOKEN_LEFT_PAREN;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: /* do nothing */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-18 03:36:33 +08:00
|
|
|
return gimp_config_deserialize_return (scanner, token, nest_level);
|
2002-05-24 10:53:20 +08:00
|
|
|
}
|
|
|
|
|
2001-02-04 00:51:10 +08:00
|
|
|
static void
|
2001-08-12 03:53:35 +08:00
|
|
|
gimp_container_disconnect_callback (GimpObject *object,
|
2006-04-12 20:49:29 +08:00
|
|
|
gpointer data)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
2003-10-11 23:18:44 +08:00
|
|
|
GimpContainer *container = GIMP_CONTAINER (data);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2001-08-12 03:53:35 +08:00
|
|
|
gimp_container_remove (container, object);
|
2001-02-04 00:51:10 +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
|
|
|
GType
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_container_get_children_type (GimpContainer *container)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
2001-08-10 22:41:39 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), G_TYPE_NONE);
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
return container->priv->children_type;
|
2001-02-04 00:51:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GimpContainerPolicy
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_container_get_policy (GimpContainer *container)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
2001-08-10 22:41:39 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), 0);
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
return container->priv->policy;
|
2001-02-04 00:51:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gint
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_container_get_n_children (GimpContainer *container)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
2001-08-10 22:41:39 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), 0);
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
return container->priv->n_children;
|
2001-02-04 00:51:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_container_add (GimpContainer *container,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpObject *object)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
2008-10-11 18:14:21 +08:00
|
|
|
GList *list;
|
|
|
|
gint n_children;
|
2001-02-04 00:51:10 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
|
|
|
g_return_val_if_fail (object != NULL, FALSE);
|
2001-11-15 11:21:20 +08:00
|
|
|
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (object,
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->children_type),
|
2006-04-12 20:49:29 +08:00
|
|
|
FALSE);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2001-02-04 22:10:03 +08:00
|
|
|
if (gimp_container_have (container, object))
|
|
|
|
{
|
2004-05-12 16:13:33 +08:00
|
|
|
g_warning ("%s: container %p already contains object %p",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_STRFUNC, container, object);
|
2001-02-04 22:10:03 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2008-11-21 03:19:54 +08:00
|
|
|
for (list = container->priv->handlers; list; list = g_list_next (list))
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
2008-10-11 18:14:21 +08:00
|
|
|
GimpContainerHandler *handler = list->data;
|
|
|
|
gulong handler_id;
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
handler_id = g_signal_connect (object,
|
2006-04-12 20:49:29 +08:00
|
|
|
handler->signame,
|
|
|
|
handler->callback,
|
|
|
|
handler->callback_data);
|
2001-02-04 00:51:10 +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
|
|
|
g_object_set_qdata (G_OBJECT (object), handler->quark,
|
2006-04-12 20:49:29 +08:00
|
|
|
GUINT_TO_POINTER (handler_id));
|
2001-02-04 00:51:10 +08:00
|
|
|
}
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
switch (container->priv->policy)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
|
|
|
case GIMP_CONTAINER_POLICY_STRONG:
|
2003-01-06 06:07:10 +08:00
|
|
|
g_object_ref (object);
|
2001-02-04 00:51:10 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CONTAINER_POLICY_WEAK:
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_connect (object, "disconnect",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_CALLBACK (gimp_container_disconnect_callback),
|
|
|
|
container);
|
2001-02-04 00:51:10 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
n_children = container->priv->n_children;
|
2001-02-04 22:10:03 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_emit (container, container_signals[ADD], 0, object);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
if (n_children == container->priv->n_children)
|
2008-10-11 18:14:21 +08:00
|
|
|
{
|
|
|
|
g_warning ("%s: GimpContainer::add() implementation did not "
|
2018-05-03 06:24:08 +08:00
|
|
|
"chain up. Please report this at https://www.gimp.org/bugs/",
|
2008-10-11 18:14:21 +08:00
|
|
|
G_STRFUNC);
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->n_children++;
|
2008-10-11 18:14:21 +08:00
|
|
|
}
|
|
|
|
|
2001-02-04 00:51:10 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_container_remove (GimpContainer *container,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpObject *object)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
2008-10-11 18:14:21 +08:00
|
|
|
GList *list;
|
|
|
|
gint n_children;
|
2001-02-04 00:51:10 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
|
|
|
g_return_val_if_fail (object != NULL, FALSE);
|
2001-11-15 11:21:20 +08:00
|
|
|
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (object,
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->children_type),
|
2006-04-12 20:49:29 +08:00
|
|
|
FALSE);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2001-02-04 22:10:03 +08:00
|
|
|
if (! gimp_container_have (container, object))
|
|
|
|
{
|
2004-05-12 16:13:33 +08:00
|
|
|
g_warning ("%s: container %p does not contain object %p",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_STRFUNC, container, object);
|
2001-02-04 22:10:03 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2008-11-21 03:19:54 +08:00
|
|
|
for (list = container->priv->handlers; list; list = g_list_next (list))
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
2008-10-11 18:14:21 +08:00
|
|
|
GimpContainerHandler *handler = list->data;
|
|
|
|
gulong handler_id;
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2003-08-26 05:25:13 +08:00
|
|
|
handler_id = GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (object),
|
|
|
|
handler->quark));
|
2001-02-04 00:51:10 +08:00
|
|
|
|
|
|
|
if (handler_id)
|
2006-04-12 20:49:29 +08:00
|
|
|
{
|
|
|
|
g_signal_handler_disconnect (object, handler_id);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2006-04-12 20:49:29 +08:00
|
|
|
g_object_set_qdata (G_OBJECT (object), handler->quark, NULL);
|
|
|
|
}
|
2001-02-04 00:51:10 +08:00
|
|
|
}
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
n_children = container->priv->n_children;
|
2008-10-11 18:14:21 +08:00
|
|
|
|
|
|
|
g_signal_emit (container, container_signals[REMOVE], 0, object);
|
2001-08-12 23:39:23 +08:00
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
if (n_children == container->priv->n_children)
|
2008-10-11 18:14:21 +08:00
|
|
|
{
|
|
|
|
g_warning ("%s: GimpContainer::remove() implementation did not "
|
2018-07-14 20:13:22 +08:00
|
|
|
"chain up. Please report this at https://www.gimp.org/bugs/",
|
2008-10-11 18:14:21 +08:00
|
|
|
G_STRFUNC);
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->n_children--;
|
2008-10-11 18:14:21 +08:00
|
|
|
}
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
switch (container->priv->policy)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
|
|
|
case GIMP_CONTAINER_POLICY_STRONG:
|
2003-01-06 06:07:10 +08:00
|
|
|
g_object_unref (object);
|
2001-02-04 00:51:10 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_CONTAINER_POLICY_WEAK:
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handlers_disconnect_by_func (object,
|
2002-08-12 02:45:24 +08:00
|
|
|
gimp_container_disconnect_callback,
|
|
|
|
container);
|
2001-02-04 00:51:10 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-02-19 11:35:55 +08:00
|
|
|
gboolean
|
|
|
|
gimp_container_insert (GimpContainer *container,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpObject *object,
|
|
|
|
gint index)
|
2001-02-19 11:35:55 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
|
|
|
g_return_val_if_fail (object != NULL, FALSE);
|
2001-11-15 11:21:20 +08:00
|
|
|
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (object,
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->children_type),
|
2006-04-12 20:49:29 +08:00
|
|
|
FALSE);
|
2001-02-19 11:35:55 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (index >= -1 &&
|
2008-11-21 07:51:39 +08:00
|
|
|
index <= container->priv->n_children, FALSE);
|
2001-02-19 11:35:55 +08:00
|
|
|
|
|
|
|
if (gimp_container_have (container, object))
|
|
|
|
{
|
2004-05-12 16:13:33 +08:00
|
|
|
g_warning ("%s: container %p already contains object %p",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_STRFUNC, container, object);
|
2001-02-19 11:35:55 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gimp_container_add (container, object))
|
|
|
|
{
|
|
|
|
return gimp_container_reorder (container, object, index);
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2001-02-18 05:20:10 +08:00
|
|
|
gboolean
|
|
|
|
gimp_container_reorder (GimpContainer *container,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpObject *object,
|
|
|
|
gint new_index)
|
2001-02-18 05:20:10 +08:00
|
|
|
{
|
2013-10-12 05:09:30 +08:00
|
|
|
gint index;
|
|
|
|
|
2001-02-18 05:20:10 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
|
|
|
g_return_val_if_fail (object != NULL, FALSE);
|
2001-11-15 11:21:20 +08:00
|
|
|
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (object,
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->children_type),
|
2006-04-12 20:49:29 +08:00
|
|
|
FALSE);
|
2001-02-18 05:20:10 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (new_index >= -1 &&
|
2008-11-21 07:51:39 +08:00
|
|
|
new_index < container->priv->n_children, FALSE);
|
2001-02-18 05:20:10 +08:00
|
|
|
|
2013-10-12 05:09:30 +08:00
|
|
|
if (new_index == -1)
|
|
|
|
new_index = container->priv->n_children - 1;
|
|
|
|
|
|
|
|
index = gimp_container_get_child_index (container, object);
|
|
|
|
|
|
|
|
if (index == -1)
|
2001-02-18 05:20:10 +08:00
|
|
|
{
|
2004-05-12 16:13:33 +08:00
|
|
|
g_warning ("%s: container %p does not contain object %p",
|
2006-04-12 20:49:29 +08:00
|
|
|
G_STRFUNC, container, object);
|
2001-02-18 05:20:10 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2013-10-12 05:09:30 +08:00
|
|
|
if (index != new_index)
|
|
|
|
g_signal_emit (container, container_signals[REORDER], 0,
|
|
|
|
object, new_index);
|
2001-02-18 05:20:10 +08:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2001-08-11 22:39:19 +08:00
|
|
|
void
|
|
|
|
gimp_container_freeze (GimpContainer *container)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTAINER (container));
|
|
|
|
|
2008-11-21 03:19:54 +08:00
|
|
|
container->priv->freeze_count++;
|
2001-08-11 22:39:19 +08:00
|
|
|
|
2008-11-21 03:19:54 +08:00
|
|
|
if (container->priv->freeze_count == 1)
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_emit (container, container_signals[FREEZE], 0);
|
2001-08-11 22:39:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_container_thaw (GimpContainer *container)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTAINER (container));
|
|
|
|
|
2008-11-21 03:19:54 +08:00
|
|
|
if (container->priv->freeze_count > 0)
|
|
|
|
container->priv->freeze_count--;
|
2001-08-11 22:39:19 +08:00
|
|
|
|
2008-11-21 03:19:54 +08:00
|
|
|
if (container->priv->freeze_count == 0)
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_emit (container, container_signals[THAW], 0);
|
2001-08-11 22:39:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gimp_container_frozen (GimpContainer *container)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
|
|
|
|
2008-11-21 03:19:54 +08:00
|
|
|
return (container->priv->freeze_count > 0) ? TRUE : FALSE;
|
2001-08-11 22:39:19 +08:00
|
|
|
}
|
|
|
|
|
2018-05-07 16:25:45 +08:00
|
|
|
gint
|
|
|
|
gimp_container_freeze_count (GimpContainer *container)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), 0);
|
|
|
|
|
|
|
|
return container->priv->freeze_count;
|
|
|
|
}
|
|
|
|
|
2003-08-26 05:25:13 +08:00
|
|
|
void
|
|
|
|
gimp_container_clear (GimpContainer *container)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTAINER (container));
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
if (container->priv->n_children > 0)
|
2003-08-26 05:25:13 +08:00
|
|
|
{
|
|
|
|
gimp_container_freeze (container);
|
|
|
|
GIMP_CONTAINER_GET_CLASS (container)->clear (container);
|
|
|
|
gimp_container_thaw (container);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-13 05:36:54 +08:00
|
|
|
gboolean
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_container_is_empty (GimpContainer *container)
|
2005-04-13 05:36:54 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
return (container->priv->n_children == 0);
|
2005-04-13 05:36:54 +08:00
|
|
|
}
|
|
|
|
|
2001-02-04 22:10:03 +08:00
|
|
|
gboolean
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_container_have (GimpContainer *container,
|
|
|
|
GimpObject *object)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
2001-02-04 22:10:03 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
if (container->priv->n_children < 1)
|
2001-02-04 22:10:03 +08:00
|
|
|
return FALSE;
|
|
|
|
|
2001-08-11 22:39:19 +08:00
|
|
|
return GIMP_CONTAINER_GET_CLASS (container)->have (container, object);
|
2001-02-04 00:51:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_container_foreach (GimpContainer *container,
|
|
|
|
GFunc func,
|
|
|
|
gpointer user_data)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_CONTAINER (container));
|
|
|
|
g_return_if_fail (func != NULL);
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
if (container->priv->n_children > 0)
|
2003-08-26 05:25:13 +08:00
|
|
|
GIMP_CONTAINER_GET_CLASS (container)->foreach (container, func, user_data);
|
2001-02-04 22:10:03 +08:00
|
|
|
}
|
|
|
|
|
2001-02-06 01:48:50 +08:00
|
|
|
GimpObject *
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_container_get_child_by_name (GimpContainer *container,
|
|
|
|
const gchar *name)
|
2001-02-06 01:48:50 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
|
2002-11-18 07:39:46 +08:00
|
|
|
|
|
|
|
if (!name)
|
|
|
|
return NULL;
|
2001-02-06 01:48:50 +08:00
|
|
|
|
2001-08-11 22:39:19 +08:00
|
|
|
return GIMP_CONTAINER_GET_CLASS (container)->get_child_by_name (container,
|
2006-04-12 20:49:29 +08:00
|
|
|
name);
|
2001-02-06 01:48:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GimpObject *
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_container_get_child_by_index (GimpContainer *container,
|
|
|
|
gint index)
|
2001-02-06 01:48:50 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
|
2002-06-07 02:57:37 +08:00
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
if (index < 0 || index >= container->priv->n_children)
|
2002-06-07 02:57:37 +08:00
|
|
|
return NULL;
|
2001-02-06 01:48:50 +08:00
|
|
|
|
2001-08-11 22:39:19 +08:00
|
|
|
return GIMP_CONTAINER_GET_CLASS (container)->get_child_by_index (container,
|
2006-04-12 20:49:29 +08:00
|
|
|
index);
|
2001-02-06 01:48:50 +08:00
|
|
|
}
|
|
|
|
|
2008-04-09 17:50:29 +08:00
|
|
|
/**
|
|
|
|
* gimp_container_get_first_child:
|
|
|
|
* @container: a #GimpContainer
|
|
|
|
*
|
|
|
|
* Return value: the first child object stored in @container or %NULL if the
|
|
|
|
* container is empty
|
|
|
|
*/
|
|
|
|
GimpObject *
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_container_get_first_child (GimpContainer *container)
|
2008-04-09 17:50:29 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
if (container->priv->n_children > 0)
|
2008-04-09 17:50:29 +08:00
|
|
|
return GIMP_CONTAINER_GET_CLASS (container)->get_child_by_index (container,
|
|
|
|
0);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_container_get_last_child:
|
|
|
|
* @container: a #GimpContainer
|
|
|
|
*
|
|
|
|
* Return value: the last child object stored in @container or %NULL if the
|
|
|
|
* container is empty
|
|
|
|
*/
|
|
|
|
GimpObject *
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_container_get_last_child (GimpContainer *container)
|
2008-04-09 17:50:29 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
|
|
|
|
|
2008-11-21 07:51:39 +08:00
|
|
|
if (container->priv->n_children > 0)
|
2008-04-09 17:50:29 +08:00
|
|
|
return GIMP_CONTAINER_GET_CLASS (container)->get_child_by_index (container,
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->n_children - 1);
|
2008-04-09 17:50:29 +08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2001-02-06 01:48:50 +08:00
|
|
|
gint
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_container_get_child_index (GimpContainer *container,
|
|
|
|
GimpObject *object)
|
2001-02-06 01:48:50 +08:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), -1);
|
|
|
|
g_return_val_if_fail (object != NULL, -1);
|
2001-11-15 11:21:20 +08:00
|
|
|
g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (object,
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->children_type),
|
2006-04-12 20:49:29 +08:00
|
|
|
-1);
|
2001-02-06 01:48:50 +08:00
|
|
|
|
2001-08-11 22:39:19 +08:00
|
|
|
return GIMP_CONTAINER_GET_CLASS (container)->get_child_index (container,
|
2006-04-12 20:49:29 +08:00
|
|
|
object);
|
2001-02-12 05:08:04 +08:00
|
|
|
}
|
|
|
|
|
2011-03-13 09:14:44 +08:00
|
|
|
GimpObject *
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_container_get_neighbor_of (GimpContainer *container,
|
|
|
|
GimpObject *object)
|
2011-03-13 09:14:44 +08:00
|
|
|
{
|
|
|
|
gint index;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
|
|
|
|
g_return_val_if_fail (GIMP_IS_OBJECT (object), NULL);
|
|
|
|
|
|
|
|
index = gimp_container_get_child_index (container, object);
|
|
|
|
|
|
|
|
if (index != -1)
|
|
|
|
{
|
|
|
|
GimpObject *new;
|
|
|
|
|
|
|
|
new = gimp_container_get_child_by_index (container, index + 1);
|
|
|
|
|
|
|
|
if (! new && index > 0)
|
|
|
|
new = gimp_container_get_child_by_index (container, index - 1);
|
|
|
|
|
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-09-04 20:02:31 +08:00
|
|
|
static void
|
|
|
|
gimp_container_get_name_array_foreach_func (GimpObject *object,
|
2003-09-04 23:56:11 +08:00
|
|
|
gchar ***iter)
|
2003-09-04 20:02:31 +08:00
|
|
|
{
|
2003-09-04 23:56:11 +08:00
|
|
|
gchar **array = *iter;
|
2003-09-04 20:02:31 +08:00
|
|
|
|
2003-09-04 23:56:11 +08:00
|
|
|
*array = g_strdup (gimp_object_get_name (object));
|
|
|
|
(*iter)++;
|
2003-09-04 20:02:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gchar **
|
2016-05-20 05:51:44 +08:00
|
|
|
gimp_container_get_name_array (GimpContainer *container,
|
|
|
|
gint *length)
|
2003-09-04 20:02:31 +08:00
|
|
|
{
|
|
|
|
gchar **names;
|
2003-09-04 23:56:11 +08:00
|
|
|
gchar **iter;
|
2003-09-04 20:02:31 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), NULL);
|
|
|
|
g_return_val_if_fail (length != NULL, NULL);
|
|
|
|
|
2008-11-21 06:45:19 +08:00
|
|
|
*length = gimp_container_get_n_children (container);
|
2003-09-04 20:02:31 +08:00
|
|
|
if (*length == 0)
|
|
|
|
return NULL;
|
|
|
|
|
2003-09-04 23:56:11 +08:00
|
|
|
names = iter = g_new (gchar *, *length);
|
2003-09-04 20:02:31 +08:00
|
|
|
|
2003-09-04 23:56:11 +08:00
|
|
|
gimp_container_foreach (container,
|
|
|
|
(GFunc) gimp_container_get_name_array_foreach_func,
|
|
|
|
&iter);
|
2003-09-04 20:02:31 +08:00
|
|
|
|
|
|
|
return names;
|
|
|
|
}
|
|
|
|
|
2001-02-04 22:10:03 +08:00
|
|
|
static void
|
|
|
|
gimp_container_add_handler_foreach_func (GimpObject *object,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpContainerHandler *handler)
|
2001-02-04 22:10:03 +08:00
|
|
|
{
|
2002-07-11 19:37:41 +08:00
|
|
|
gulong handler_id;
|
2001-02-04 22:10:03 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
handler_id = g_signal_connect (object,
|
2006-04-12 20:49:29 +08:00
|
|
|
handler->signame,
|
|
|
|
handler->callback,
|
|
|
|
handler->callback_data);
|
2001-02-04 22:10:03 +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
|
|
|
g_object_set_qdata (G_OBJECT (object), handler->quark,
|
2006-04-12 20:49:29 +08:00
|
|
|
GUINT_TO_POINTER (handler_id));
|
2001-02-04 00:51:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GQuark
|
|
|
|
gimp_container_add_handler (GimpContainer *container,
|
2006-04-12 20:49:29 +08:00
|
|
|
const gchar *signame,
|
|
|
|
GCallback callback,
|
|
|
|
gpointer callback_data)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
|
|
|
GimpContainerHandler *handler;
|
|
|
|
gchar *key;
|
|
|
|
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
static gint handler_id = 0;
|
|
|
|
|
2001-02-04 00:51:10 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_CONTAINER (container), 0);
|
|
|
|
g_return_val_if_fail (signame != NULL, 0);
|
|
|
|
g_return_val_if_fail (callback != NULL, 0);
|
|
|
|
|
2006-11-13 04:30:50 +08:00
|
|
|
if (! g_str_has_prefix (signame, "notify::"))
|
2004-05-13 23:46:59 +08:00
|
|
|
g_return_val_if_fail (g_signal_lookup (signame,
|
2008-11-21 07:51:39 +08:00
|
|
|
container->priv->children_type), 0);
|
2004-05-13 23:46:59 +08:00
|
|
|
|
2007-05-22 18:43:48 +08:00
|
|
|
handler = g_slice_new0 (GimpContainerHandler);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
|
|
|
/* create a unique key for this handler */
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
key = g_strdup_printf ("%s-%d", signame, handler_id++);
|
2001-02-04 00:51:10 +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
|
|
|
handler->signame = g_strdup (signame);
|
|
|
|
handler->callback = callback;
|
|
|
|
handler->callback_data = callback_data;
|
|
|
|
handler->quark = g_quark_from_string (key);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2004-05-12 16:13:33 +08:00
|
|
|
D (g_print ("%s: key = %s, id = %d\n", G_STRFUNC, key, handler->quark));
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
2001-02-04 00:51:10 +08:00
|
|
|
g_free (key);
|
|
|
|
|
2008-11-21 03:19:54 +08:00
|
|
|
container->priv->handlers = g_list_prepend (container->priv->handlers, handler);
|
2001-02-04 06:05:41 +08:00
|
|
|
|
2001-02-04 22:10:03 +08:00
|
|
|
gimp_container_foreach (container,
|
2006-04-12 20:49:29 +08:00
|
|
|
(GFunc) gimp_container_add_handler_foreach_func,
|
|
|
|
handler);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2001-02-04 22:10:03 +08:00
|
|
|
return handler->quark;
|
|
|
|
}
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2001-02-04 22:10:03 +08:00
|
|
|
static void
|
|
|
|
gimp_container_remove_handler_foreach_func (GimpObject *object,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpContainerHandler *handler)
|
2001-02-04 22:10:03 +08:00
|
|
|
{
|
2002-07-11 19:37:41 +08:00
|
|
|
gulong handler_id;
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2003-08-26 05:25:13 +08:00
|
|
|
handler_id = GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (object),
|
|
|
|
handler->quark));
|
2001-02-04 22:10:03 +08:00
|
|
|
|
|
|
|
if (handler_id)
|
|
|
|
{
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_handler_disconnect (object, handler_id);
|
2001-02-04 22:10:03 +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
|
|
|
g_object_set_qdata (G_OBJECT (object), handler->quark, NULL);
|
2001-02-04 22:10:03 +08:00
|
|
|
}
|
2001-02-04 00:51:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_container_remove_handler (GimpContainer *container,
|
2006-04-12 20:49:29 +08:00
|
|
|
GQuark id)
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
|
|
|
GimpContainerHandler *handler;
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
g_return_if_fail (GIMP_IS_CONTAINER (container));
|
|
|
|
g_return_if_fail (id != 0);
|
|
|
|
|
2008-11-21 03:19:54 +08:00
|
|
|
for (list = container->priv->handlers; list; list = g_list_next (list))
|
2001-02-04 00:51:10 +08:00
|
|
|
{
|
|
|
|
handler = (GimpContainerHandler *) list->data;
|
|
|
|
|
|
|
|
if (handler->quark == id)
|
2006-04-12 20:49:29 +08:00
|
|
|
break;
|
2001-02-04 00:51:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (! list)
|
|
|
|
{
|
2002-08-12 02:45:24 +08:00
|
|
|
g_warning ("%s: tried to remove handler which unknown id %d",
|
2004-05-12 16:13:33 +08:00
|
|
|
G_STRFUNC, id);
|
2001-02-04 00:51:10 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-05-12 16:13:33 +08:00
|
|
|
D (g_print ("%s: id = %d\n", G_STRFUNC, handler->quark));
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
2001-02-04 22:10:03 +08:00
|
|
|
gimp_container_foreach (container,
|
2006-04-12 20:49:29 +08:00
|
|
|
(GFunc) gimp_container_remove_handler_foreach_func,
|
|
|
|
handler);
|
2001-02-04 00:51:10 +08:00
|
|
|
|
2008-11-21 03:19:54 +08:00
|
|
|
container->priv->handlers = g_list_remove (container->priv->handlers, handler);
|
2001-02-04 06:05:41 +08:00
|
|
|
|
2001-02-04 00:51:10 +08:00
|
|
|
g_free (handler->signame);
|
2007-05-22 18:43:48 +08:00
|
|
|
g_slice_free (GimpContainerHandler, handler);
|
2001-02-04 00:51:10 +08:00
|
|
|
}
|