gimp r27568 - in trunk: . app/core
- From: mitch svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r27568 - in trunk: . app/core
- Date: Thu, 6 Nov 2008 19:09:59 +0000 (UTC)
Author: mitch
Date: Thu Nov 6 19:09:59 2008
New Revision: 27568
URL: http://svn.gnome.org/viewvc/gimp?rev=27568&view=rev
Log:
* app/core/Makefile.am
* app/core/core-types.h
* app/core/gimpitemstack.[ch]: new GimpList subclass which (for
now) does nothing but taking ownership of its children by the
means of g_object_ref_sink().
* app/core/gimpdrawablestack.[ch]: derive from GimpItemStack.
* app/core/gimpimage.c: use a GimpItemStack instead of a plain
GimpList for the list of vectors. Remove code which takes
ownerships of added items from gimp_image_add_layer(),
add_channel() and add_vectors().
Added:
trunk/app/core/gimpitemstack.c
trunk/app/core/gimpitemstack.h
Modified:
trunk/ChangeLog
trunk/app/core/Makefile.am
trunk/app/core/core-types.h
trunk/app/core/gimpdrawablestack.c
trunk/app/core/gimpdrawablestack.h
trunk/app/core/gimpimage.c
Modified: trunk/app/core/Makefile.am
==============================================================================
--- trunk/app/core/Makefile.am (original)
+++ trunk/app/core/Makefile.am Thu Nov 6 19:09:59 2008
@@ -244,6 +244,8 @@
gimpitem-preview.h \
gimpitempropundo.c \
gimpitempropundo.h \
+ gimpitemstack.c \
+ gimpitemstack.h \
gimpitemundo.c \
gimpitemundo.h \
gimplayer.c \
Modified: trunk/app/core/core-types.h
==============================================================================
--- trunk/app/core/core-types.h (original)
+++ trunk/app/core/core-types.h Thu Nov 6 19:09:59 2008
@@ -71,6 +71,7 @@
typedef struct _GimpList GimpList;
typedef struct _GimpDocumentList GimpDocumentList;
typedef struct _GimpDrawableStack GimpDrawableStack;
+typedef struct _GimpItemStack GimpItemStack;
typedef struct _GimpToolPresets GimpToolPresets;
Modified: trunk/app/core/gimpdrawablestack.c
==============================================================================
--- trunk/app/core/gimpdrawablestack.c (original)
+++ trunk/app/core/gimpdrawablestack.c Thu Nov 6 19:09:59 2008
@@ -85,7 +85,7 @@
GimpDrawableStack *stack);
-G_DEFINE_TYPE (GimpDrawableStack, gimp_drawable_stack, GIMP_TYPE_LIST)
+G_DEFINE_TYPE (GimpDrawableStack, gimp_drawable_stack, GIMP_TYPE_ITEM_STACK)
#define parent_class gimp_drawable_stack_parent_class
Modified: trunk/app/core/gimpdrawablestack.h
==============================================================================
--- trunk/app/core/gimpdrawablestack.h (original)
+++ trunk/app/core/gimpdrawablestack.h Thu Nov 6 19:09:59 2008
@@ -22,7 +22,7 @@
#ifndef __GIMP_DRAWABLE_STACK_H__
#define __GIMP_DRAWABLE_STACK_H__
-#include "core/gimplist.h"
+#include "gimpitemstack.h"
#define GIMP_TYPE_DRAWABLE_STACK (gimp_drawable_stack_get_type ())
@@ -36,14 +36,14 @@
struct _GimpDrawableStack
{
- GimpList parent_instance;
+ GimpItemStack parent_instance;
- GeglNode *graph;
+ GeglNode *graph;
};
struct _GimpDrawableStackClass
{
- GimpListClass parent_class;
+ GimpItemStackClass parent_class;
void (* update) (GimpDrawableStack *stack,
gint x,
Modified: trunk/app/core/gimpimage.c
==============================================================================
--- trunk/app/core/gimpimage.c (original)
+++ trunk/app/core/gimpimage.c Thu Nov 6 19:09:59 2008
@@ -611,7 +611,7 @@
image->layers = gimp_drawable_stack_new (GIMP_TYPE_LAYER);
image->channels = gimp_drawable_stack_new (GIMP_TYPE_CHANNEL);
- image->vectors = gimp_list_new (GIMP_TYPE_VECTORS, TRUE);
+ image->vectors = gimp_item_stack_new (GIMP_TYPE_VECTORS);
image->layer_stack = NULL;
g_signal_connect_swapped (image->layers, "update",
@@ -2947,9 +2947,7 @@
/* Don't add at a non-existing index */
position = MIN (position, gimp_container_num_children (image->layers));
- g_object_ref_sink (layer);
gimp_container_insert (image->layers, GIMP_OBJECT (layer), position);
- g_object_unref (layer);
/* notify the layers dialog of the currently active layer */
gimp_image_set_active_layer (image, layer);
@@ -3275,9 +3273,7 @@
/* Don't add at a non-existing index */
position = MIN (position, gimp_container_num_children (image->channels));
- g_object_ref_sink (channel);
gimp_container_insert (image->channels, GIMP_OBJECT (channel), position);
- g_object_unref (channel);
/* notify this image of the currently active channel */
gimp_image_set_active_channel (image, channel);
@@ -3507,9 +3503,7 @@
/* Don't add at a non-existing index */
position = MIN (position, gimp_container_num_children (image->vectors));
- g_object_ref_sink (vectors);
gimp_container_insert (image->vectors, GIMP_OBJECT (vectors), position);
- g_object_unref (vectors);
/* notify this image of the currently active vectors */
gimp_image_set_active_vectors (image, vectors);
Added: trunk/app/core/gimpitemstack.c
==============================================================================
--- (empty file)
+++ trunk/app/core/gimpitemstack.c Thu Nov 6 19:09:59 2008
@@ -0,0 +1,115 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimpitemstack.c
+ * Copyright (C) 2008 Michael Natterer <mitch gimp org>
+ *
+ * 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.
+ */
+
+#include "config.h"
+
+#include <gegl.h>
+
+#include "core-types.h"
+
+#include "gimpitem.h"
+#include "gimpitemstack.h"
+
+
+/* local function prototypes */
+
+static GObject * gimp_item_stack_constructor (GType type,
+ guint n_params,
+ GObjectConstructParam *params);
+
+static void gimp_item_stack_add (GimpContainer *container,
+ GimpObject *object);
+static void gimp_item_stack_remove (GimpContainer *container,
+ GimpObject *object);
+
+
+G_DEFINE_TYPE (GimpItemStack, gimp_item_stack, GIMP_TYPE_LIST)
+
+#define parent_class gimp_item_stack_parent_class
+
+
+static void
+gimp_item_stack_class_init (GimpItemStackClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GimpContainerClass *container_class = GIMP_CONTAINER_CLASS (klass);
+
+ object_class->constructor = gimp_item_stack_constructor;
+
+ container_class->add = gimp_item_stack_add;
+ container_class->remove = gimp_item_stack_remove;
+}
+
+static void
+gimp_item_stack_init (GimpItemStack *stack)
+{
+}
+
+static GObject *
+gimp_item_stack_constructor (GType type,
+ guint n_params,
+ GObjectConstructParam *params)
+{
+ GObject *object;
+ GimpContainer *container;
+
+ object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params);
+
+ container = GIMP_CONTAINER (object);
+
+ g_assert (g_type_is_a (container->children_type, GIMP_TYPE_ITEM));
+
+ return object;
+}
+
+static void
+gimp_item_stack_add (GimpContainer *container,
+ GimpObject *object)
+{
+ g_object_ref_sink (object);
+
+ GIMP_CONTAINER_CLASS (parent_class)->add (container, object);
+
+ g_object_unref (object);
+}
+
+static void
+gimp_item_stack_remove (GimpContainer *container,
+ GimpObject *object)
+{
+ GIMP_CONTAINER_CLASS (parent_class)->remove (container, object);
+}
+
+
+/* public functions */
+
+GimpContainer *
+gimp_item_stack_new (GType item_type)
+{
+ g_return_val_if_fail (g_type_is_a (item_type, GIMP_TYPE_ITEM), NULL);
+
+ return g_object_new (GIMP_TYPE_ITEM_STACK,
+ "name", g_type_name (item_type),
+ "children-type", item_type,
+ "policy", GIMP_CONTAINER_POLICY_STRONG,
+ "unique-names", TRUE,
+ NULL);
+}
Added: trunk/app/core/gimpitemstack.h
==============================================================================
--- (empty file)
+++ trunk/app/core/gimpitemstack.h Thu Nov 6 19:09:59 2008
@@ -0,0 +1,52 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-1997 Spencer Kimball and Peter Mattis
+ *
+ * gimpitemstack.h
+ * Copyright (C) 2008 Michael Natterer <mitch gimp org>
+ *
+ * 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.
+ */
+
+#ifndef __GIMP_ITEM_STACK_H__
+#define __GIMP_ITEM_STACK_H__
+
+#include "gimplist.h"
+
+
+#define GIMP_TYPE_ITEM_STACK (gimp_item_stack_get_type ())
+#define GIMP_ITEM_STACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_ITEM_STACK, GimpItemStack))
+#define GIMP_ITEM_STACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_ITEM_STACK, GimpItemStackClass))
+#define GIMP_IS_ITEM_STACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_ITEM_STACK))
+#define GIMP_IS_ITEM_STACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_ITEM_STACK))
+
+
+typedef struct _GimpItemStackClass GimpItemStackClass;
+
+struct _GimpItemStack
+{
+ GimpList parent_instance;
+};
+
+struct _GimpItemStackClass
+{
+ GimpListClass parent_class;
+};
+
+
+GType gimp_item_stack_get_type (void) G_GNUC_CONST;
+GimpContainer * gimp_item_stack_new (GType item_type);
+
+
+#endif /* __GIMP_ITEM_STACK_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]