aboutsummaryrefslogtreecommitdiffstats
path: root/libgnomecanvas
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-10-07 01:26:08 +0800
committerMilan Crha <mcrha@redhat.com>2010-10-07 01:26:08 +0800
commit1c6f2d154e74f908e2c4a137de0233b5faf4f6b6 (patch)
tree77a33236e48ed59a7c7c65e8a1c91481dd09f3eb /libgnomecanvas
parent1b2fefb086c3e34089beb8b89b22d79005cc7725 (diff)
downloadgsoc2013-evolution-1c6f2d154e74f908e2c4a137de0233b5faf4f6b6.tar
gsoc2013-evolution-1c6f2d154e74f908e2c4a137de0233b5faf4f6b6.tar.gz
gsoc2013-evolution-1c6f2d154e74f908e2c4a137de0233b5faf4f6b6.tar.bz2
gsoc2013-evolution-1c6f2d154e74f908e2c4a137de0233b5faf4f6b6.tar.lz
gsoc2013-evolution-1c6f2d154e74f908e2c4a137de0233b5faf4f6b6.tar.xz
gsoc2013-evolution-1c6f2d154e74f908e2c4a137de0233b5faf4f6b6.tar.zst
gsoc2013-evolution-1c6f2d154e74f908e2c4a137de0233b5faf4f6b6.zip
Bug #631320 - GtkObject is gone in GTK3
Diffstat (limited to 'libgnomecanvas')
-rw-r--r--libgnomecanvas/gnome-canvas-bpath.c12
-rw-r--r--libgnomecanvas/gnome-canvas-clipgroup.c12
-rw-r--r--libgnomecanvas/gnome-canvas-line.c13
-rw-r--r--libgnomecanvas/gnome-canvas-pixbuf.c46
-rw-r--r--libgnomecanvas/gnome-canvas-polygon.c23
-rw-r--r--libgnomecanvas/gnome-canvas-rect-ellipse.c15
-rw-r--r--libgnomecanvas/gnome-canvas-rich-text.c8
-rw-r--r--libgnomecanvas/gnome-canvas-shape.c13
-rw-r--r--libgnomecanvas/gnome-canvas-text.c14
-rw-r--r--libgnomecanvas/gnome-canvas-widget.c46
-rw-r--r--libgnomecanvas/gnome-canvas-widget.h2
-rw-r--r--libgnomecanvas/gnome-canvas.c77
-rw-r--r--libgnomecanvas/gnome-canvas.h12
13 files changed, 101 insertions, 192 deletions
diff --git a/libgnomecanvas/gnome-canvas-bpath.c b/libgnomecanvas/gnome-canvas-bpath.c
index 0a59712de2..0aee2ece46 100644
--- a/libgnomecanvas/gnome-canvas-bpath.c
+++ b/libgnomecanvas/gnome-canvas-bpath.c
@@ -35,7 +35,6 @@ enum {
static void gnome_canvas_bpath_class_init (GnomeCanvasBpathClass *class);
static void gnome_canvas_bpath_init (GnomeCanvasBpath *bpath);
-static void gnome_canvas_bpath_destroy (GtkObject *object);
static void gnome_canvas_bpath_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -79,11 +78,9 @@ static void
gnome_canvas_bpath_class_init (GnomeCanvasBpathClass *class)
{
GObjectClass *gobject_class;
- GtkObjectClass *object_class;
GnomeCanvasItemClass *item_class;
gobject_class = (GObjectClass *) class;
- object_class = (GtkObjectClass *) class;
item_class = (GnomeCanvasItemClass *) class;
parent_class = g_type_class_peek_parent (class);
@@ -95,8 +92,6 @@ gnome_canvas_bpath_class_init (GnomeCanvasBpathClass *class)
gobject_class->set_property = gnome_canvas_bpath_set_property;
gobject_class->get_property = gnome_canvas_bpath_get_property;
- object_class->destroy = gnome_canvas_bpath_destroy;
-
g_object_class_install_property (gobject_class,
PROP_BPATH,
g_param_spec_boxed ("bpath", NULL, NULL,
@@ -113,13 +108,6 @@ gnome_canvas_bpath_init (GnomeCanvasBpath *bpath)
}
static void
-gnome_canvas_bpath_destroy (GtkObject *object)
-{
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
gnome_canvas_bpath_set_property (GObject *object,
guint param_id,
const GValue *value,
diff --git a/libgnomecanvas/gnome-canvas-clipgroup.c b/libgnomecanvas/gnome-canvas-clipgroup.c
index 6019d1cdf6..350cb643bb 100644
--- a/libgnomecanvas/gnome-canvas-clipgroup.c
+++ b/libgnomecanvas/gnome-canvas-clipgroup.c
@@ -44,7 +44,7 @@ enum {
static void gnome_canvas_clipgroup_class_init (GnomeCanvasClipgroupClass *klass);
static void gnome_canvas_clipgroup_init (GnomeCanvasClipgroup *clipgroup);
-static void gnome_canvas_clipgroup_destroy (GtkObject *object);
+static void gnome_canvas_clipgroup_destroy (GnomeCanvasItem *object);
static void gnome_canvas_clipgroup_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -119,17 +119,15 @@ static void
gnome_canvas_clipgroup_class_init (GnomeCanvasClipgroupClass *klass)
{
GObjectClass *gobject_class;
- GtkObjectClass *object_class;
GnomeCanvasItemClass *item_class;
gobject_class = (GObjectClass *) klass;
- object_class = (GtkObjectClass *) klass;
item_class = (GnomeCanvasItemClass *) klass;
parent_class = g_type_class_ref (GNOME_TYPE_CANVAS_GROUP);
- object_class->destroy = gnome_canvas_clipgroup_destroy;
gobject_class->set_property = gnome_canvas_clipgroup_set_property;
gobject_class->get_property = gnome_canvas_clipgroup_get_property;
+ item_class->destroy = gnome_canvas_clipgroup_destroy;
item_class->update = gnome_canvas_clipgroup_update;
item_class->render = gnome_canvas_clipgroup_render;
@@ -153,7 +151,7 @@ gnome_canvas_clipgroup_init (GnomeCanvasClipgroup *clipgroup)
}
static void
-gnome_canvas_clipgroup_destroy (GtkObject *object)
+gnome_canvas_clipgroup_destroy (GnomeCanvasItem *object)
{
GnomeCanvasClipgroup *clipgroup;
@@ -172,8 +170,8 @@ gnome_canvas_clipgroup_destroy (GtkObject *object)
clipgroup->svp = NULL;
}
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy)
+ GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy (object);
}
static void
diff --git a/libgnomecanvas/gnome-canvas-line.c b/libgnomecanvas/gnome-canvas-line.c
index fa9179d024..a55b298beb 100644
--- a/libgnomecanvas/gnome-canvas-line.c
+++ b/libgnomecanvas/gnome-canvas-line.c
@@ -84,7 +84,7 @@ enum {
static void gnome_canvas_line_class_init (GnomeCanvasLineClass *class);
static void gnome_canvas_line_init (GnomeCanvasLine *line);
-static void gnome_canvas_line_destroy (GtkObject *object);
+static void gnome_canvas_line_destroy (GnomeCanvasItem *object);
static void gnome_canvas_line_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -136,11 +136,9 @@ static void
gnome_canvas_line_class_init (GnomeCanvasLineClass *class)
{
GObjectClass *gobject_class;
- GtkObjectClass *object_class;
GnomeCanvasItemClass *item_class;
gobject_class = (GObjectClass *) class;
- object_class = (GtkObjectClass *) class;
item_class = (GnomeCanvasItemClass *) class;
parent_class = g_type_class_peek_parent (class);
@@ -254,8 +252,7 @@ gnome_canvas_line_class_init (GnomeCanvasLineClass *class)
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
- object_class->destroy = gnome_canvas_line_destroy;
-
+ item_class->destroy = gnome_canvas_line_destroy;
item_class->update = gnome_canvas_line_update;
item_class->realize = gnome_canvas_line_realize;
item_class->unrealize = gnome_canvas_line_unrealize;
@@ -280,7 +277,7 @@ gnome_canvas_line_init (GnomeCanvasLine *line)
}
static void
-gnome_canvas_line_destroy (GtkObject *object)
+gnome_canvas_line_destroy (GnomeCanvasItem *object)
{
GnomeCanvasLine *line;
@@ -319,8 +316,8 @@ gnome_canvas_line_destroy (GtkObject *object)
art_svp_free (line->last_svp);
line->last_svp = NULL;
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy)
+ GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy (object);
}
/* Computes the bounding box of the line, including its arrow points. Assumes that the number of
diff --git a/libgnomecanvas/gnome-canvas-pixbuf.c b/libgnomecanvas/gnome-canvas-pixbuf.c
index 5d290f1582..3ea3f647be 100644
--- a/libgnomecanvas/gnome-canvas-pixbuf.c
+++ b/libgnomecanvas/gnome-canvas-pixbuf.c
@@ -83,7 +83,7 @@ enum {
static void gnome_canvas_pixbuf_class_init (GnomeCanvasPixbufClass *class);
static void gnome_canvas_pixbuf_init (GnomeCanvasPixbuf *cpb);
-static void gnome_canvas_pixbuf_destroy (GtkObject *object);
+static void gnome_canvas_pixbuf_destroy (GnomeCanvasItem *object);
static void gnome_canvas_pixbuf_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -151,11 +151,9 @@ static void
gnome_canvas_pixbuf_class_init (GnomeCanvasPixbufClass *class)
{
GObjectClass *gobject_class;
- GtkObjectClass *object_class;
GnomeCanvasItemClass *item_class;
gobject_class = (GObjectClass *) class;
- object_class = (GtkObjectClass *) class;
item_class = (GnomeCanvasItemClass *) class;
parent_class = g_type_class_peek_parent (class);
@@ -237,8 +235,7 @@ gnome_canvas_pixbuf_class_init (GnomeCanvasPixbufClass *class)
GTK_ANCHOR_NW,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
- object_class->destroy = gnome_canvas_pixbuf_destroy;
-
+ item_class->destroy = gnome_canvas_pixbuf_destroy;
item_class->update = gnome_canvas_pixbuf_update;
item_class->draw = gnome_canvas_pixbuf_draw;
item_class->render = gnome_canvas_pixbuf_render;
@@ -264,7 +261,7 @@ gnome_canvas_pixbuf_init (GnomeCanvasPixbuf *gcp)
/* Destroy handler for the pixbuf canvas item */
static void
-gnome_canvas_pixbuf_destroy (GtkObject *object)
+gnome_canvas_pixbuf_destroy (GnomeCanvasItem *object)
{
GnomeCanvasItem *item;
GnomeCanvasPixbuf *gcp;
@@ -290,8 +287,8 @@ gnome_canvas_pixbuf_destroy (GtkObject *object)
gcp->priv = NULL;
}
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy)
+ GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy (object);
}
@@ -744,37 +741,7 @@ gnome_canvas_pixbuf_update (GnomeCanvasItem *item,
if (parent_class->update)
(* parent_class->update) (item, affine, clip_path, flags);
- /* the optimzations below cause rarely triggered redrawing bugs and
- * don't seem to actually save much performance. so it's probably
- * better to turn them off, than to chase subtle optimization bugs
- * throughgout all of gnome-canvas-pixbuf.c - TIMJ
- */
-#ifdef USE_BROKEN_OPTIMIZATIONS
- if (((flags & GNOME_CANVAS_UPDATE_VISIBILITY)
- && !(GTK_OBJECT_FLAGS (item) & GNOME_CANVAS_ITEM_VISIBLE))
- || (flags & GNOME_CANVAS_UPDATE_AFFINE)
- || priv->need_pixbuf_update
- || priv->need_xform_update) {
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
- }
-
- /* If we need a pixbuf update, or if the item changed visibility to
- * shown, recompute the bounding box.
- */
- if (priv->need_pixbuf_update
- || priv->need_xform_update
- || ((flags & GNOME_CANVAS_UPDATE_VISIBILITY)
- && (GTK_OBJECT_FLAGS (gcp) & GNOME_CANVAS_ITEM_VISIBLE))
- || (flags & GNOME_CANVAS_UPDATE_AFFINE)) {
- recompute_bounding_box (gcp, affine);
-#ifdef GNOME_CANVAS_PIXBUF_VERBOSE
- g_print ("BBox is %g %g %g %g\n", item->x1, item->y1, item->x2, item->y2);
-#endif
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
- priv->need_pixbuf_update = FALSE;
- priv->need_xform_update = FALSE;
- }
-#else /* ordinary update logic */
+ /* ordinary update logic */
gnome_canvas_request_redraw (
item->canvas, item->x1, item->y1, item->x2, item->y2);
recompute_bounding_box (gcp, affine);
@@ -782,7 +749,6 @@ gnome_canvas_pixbuf_update (GnomeCanvasItem *item,
item->canvas, item->x1, item->y1, item->x2, item->y2);
priv->need_pixbuf_update = FALSE;
priv->need_xform_update = FALSE;
-#endif
}
diff --git a/libgnomecanvas/gnome-canvas-polygon.c b/libgnomecanvas/gnome-canvas-polygon.c
index fe1d55b698..90ae40fe5e 100644
--- a/libgnomecanvas/gnome-canvas-polygon.c
+++ b/libgnomecanvas/gnome-canvas-polygon.c
@@ -51,7 +51,7 @@ enum {
static void gnome_canvas_polygon_class_init (GnomeCanvasPolygonClass *class);
static void gnome_canvas_polygon_init (GnomeCanvasPolygon *poly);
-static void gnome_canvas_polygon_destroy (GtkObject *object);
+static void gnome_canvas_polygon_destroy (GnomeCanvasItem *object);
static void gnome_canvas_polygon_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -94,28 +94,25 @@ gnome_canvas_polygon_get_type (void)
static void
gnome_canvas_polygon_class_init (GnomeCanvasPolygonClass *class)
{
- GObjectClass *gobject_class;
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
GnomeCanvasItemClass *item_class;
- gobject_class = (GObjectClass *) class;
- object_class = (GtkObjectClass *) class;
+ object_class = (GObjectClass *) class;
item_class = (GnomeCanvasItemClass *) class;
parent_class = g_type_class_peek_parent (class);
- gobject_class->set_property = gnome_canvas_polygon_set_property;
- gobject_class->get_property = gnome_canvas_polygon_get_property;
+ object_class->set_property = gnome_canvas_polygon_set_property;
+ object_class->get_property = gnome_canvas_polygon_get_property;
g_object_class_install_property
- (gobject_class,
+ (object_class,
PROP_POINTS,
g_param_spec_boxed ("points", NULL, NULL,
GNOME_TYPE_CANVAS_POINTS,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
- object_class->destroy = gnome_canvas_polygon_destroy;
-
+ item_class->destroy = gnome_canvas_polygon_destroy;
item_class->update = gnome_canvas_polygon_update;
}
@@ -126,7 +123,7 @@ gnome_canvas_polygon_init (GnomeCanvasPolygon *poly)
}
static void
-gnome_canvas_polygon_destroy (GtkObject *object)
+gnome_canvas_polygon_destroy (GnomeCanvasItem *object)
{
GnomeCanvasPolygon *poly;
@@ -142,8 +139,8 @@ gnome_canvas_polygon_destroy (GtkObject *object)
poly->path_def = NULL;
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy)
+ GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy (object);
}
static void
diff --git a/libgnomecanvas/gnome-canvas-rect-ellipse.c b/libgnomecanvas/gnome-canvas-rect-ellipse.c
index e086914bc4..a848d50f8e 100644
--- a/libgnomecanvas/gnome-canvas-rect-ellipse.c
+++ b/libgnomecanvas/gnome-canvas-rect-ellipse.c
@@ -57,7 +57,6 @@ enum {
static void gnome_canvas_re_class_init (GnomeCanvasREClass *class);
static void gnome_canvas_re_init (GnomeCanvasRE *re);
-static void gnome_canvas_re_destroy (GtkObject *object);
static void gnome_canvas_re_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -102,10 +101,8 @@ static void
gnome_canvas_re_class_init (GnomeCanvasREClass *class)
{
GObjectClass *gobject_class;
- GtkObjectClass *object_class;
gobject_class = (GObjectClass *) class;
- object_class = (GtkObjectClass *) class;
re_parent_class = g_type_class_peek_parent (class);
@@ -136,8 +133,6 @@ gnome_canvas_re_class_init (GnomeCanvasREClass *class)
g_param_spec_double ("y2", NULL, NULL,
-G_MAXDOUBLE, G_MAXDOUBLE, 0,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
-
- object_class->destroy = gnome_canvas_re_destroy;
}
static void
@@ -151,16 +146,6 @@ gnome_canvas_re_init (GnomeCanvasRE *re)
}
static void
-gnome_canvas_re_destroy (GtkObject *object)
-{
- g_return_if_fail (object != NULL);
- g_return_if_fail (GNOME_IS_CANVAS_RE (object));
-
- if (GTK_OBJECT_CLASS (re_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (re_parent_class)->destroy) (object);
-}
-
-static void
gnome_canvas_re_set_property (GObject *object,
guint param_id,
const GValue *value,
diff --git a/libgnomecanvas/gnome-canvas-rich-text.c b/libgnomecanvas/gnome-canvas-rich-text.c
index 8b5b2030a0..bd988ae3f5 100644
--- a/libgnomecanvas/gnome-canvas-rich-text.c
+++ b/libgnomecanvas/gnome-canvas-rich-text.c
@@ -199,13 +199,13 @@ static void
gnome_canvas_rich_text_class_init (GnomeCanvasRichTextClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
gobject_class->set_property = gnome_canvas_rich_text_set_property;
gobject_class->get_property = gnome_canvas_rich_text_get_property;
+ gobject_class->finalize = gnome_canvas_rich_text_finalize;
g_object_class_install_property (
gobject_class,
@@ -381,7 +381,7 @@ gnome_canvas_rich_text_class_init (GnomeCanvasRichTextClass *klass)
/* Signals */
signals[TAG_CHANGED] = g_signal_new (
"tag_changed",
- G_TYPE_FROM_CLASS (object_class),
+ G_TYPE_FROM_CLASS (gobject_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GnomeCanvasRichTextClass, tag_changed),
NULL, NULL,
@@ -389,8 +389,6 @@ gnome_canvas_rich_text_class_init (GnomeCanvasRichTextClass *klass)
G_TYPE_NONE, 1,
G_TYPE_OBJECT);
- gobject_class->finalize = gnome_canvas_rich_text_finalize;
-
item_class->update = gnome_canvas_rich_text_update;
item_class->realize = gnome_canvas_rich_text_realize;
item_class->unrealize = gnome_canvas_rich_text_unrealize;
@@ -405,7 +403,7 @@ static void
gnome_canvas_rich_text_init (GnomeCanvasRichText *text)
{
#if 0
- GtkObject *object = GTK_OBJECT (text);
+ GObject *object = G_OBJECT (text);
object->flags |= GNOME_CANVAS_ITEM_ALWAYS_REDRAW;
#endif
diff --git a/libgnomecanvas/gnome-canvas-shape.c b/libgnomecanvas/gnome-canvas-shape.c
index 2b606c1e5b..b1154975b2 100644
--- a/libgnomecanvas/gnome-canvas-shape.c
+++ b/libgnomecanvas/gnome-canvas-shape.c
@@ -62,7 +62,7 @@ enum {
static void gnome_canvas_shape_class_init (GnomeCanvasShapeClass *class);
static void gnome_canvas_shape_init (GnomeCanvasShape *bpath);
-static void gnome_canvas_shape_destroy (GtkObject *object);
+static void gnome_canvas_shape_destroy (GnomeCanvasItem *object);
static void gnome_canvas_shape_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -124,11 +124,9 @@ static void
gnome_canvas_shape_class_init (GnomeCanvasShapeClass *class)
{
GObjectClass *gobject_class;
- GtkObjectClass *object_class;
GnomeCanvasItemClass *item_class;
gobject_class = (GObjectClass *) class;
- object_class = (GtkObjectClass *) class;
item_class = (GnomeCanvasItemClass *) class;
parent_class = g_type_class_peek_parent (class);
@@ -217,8 +215,7 @@ gnome_canvas_shape_class_init (GnomeCanvasShapeClass *class)
g_param_spec_pointer ("dash", NULL, NULL,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
- object_class->destroy = gnome_canvas_shape_destroy;
-
+ item_class->destroy = gnome_canvas_shape_destroy;
item_class->update = gnome_canvas_shape_update;
item_class->realize = gnome_canvas_shape_realize;
item_class->unrealize = gnome_canvas_shape_unrealize;
@@ -261,7 +258,7 @@ gnome_canvas_shape_init (GnomeCanvasShape *shape)
}
static void
-gnome_canvas_shape_destroy (GtkObject *object)
+gnome_canvas_shape_destroy (GnomeCanvasItem *object)
{
GnomeCanvasShape *shape;
GnomeCanvasShapePriv *priv;
@@ -285,8 +282,8 @@ gnome_canvas_shape_destroy (GtkObject *object)
shape->priv = NULL;
}
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy)
+ GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy (object);
}
/**
diff --git a/libgnomecanvas/gnome-canvas-text.c b/libgnomecanvas/gnome-canvas-text.c
index c0c9acba2b..5f7679f3aa 100644
--- a/libgnomecanvas/gnome-canvas-text.c
+++ b/libgnomecanvas/gnome-canvas-text.c
@@ -105,7 +105,7 @@ struct _GnomeCanvasTextPrivate {
static void gnome_canvas_text_class_init (GnomeCanvasTextClass *class);
static void gnome_canvas_text_init (GnomeCanvasText *text);
-static void gnome_canvas_text_destroy (GtkObject *object);
+static void gnome_canvas_text_destroy (GnomeCanvasItem *object);
static void gnome_canvas_text_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -187,11 +187,9 @@ static void
gnome_canvas_text_class_init (GnomeCanvasTextClass *class)
{
GObjectClass *gobject_class;
- GtkObjectClass *object_class;
GnomeCanvasItemClass *item_class;
gobject_class = (GObjectClass *) class;
- object_class = (GtkObjectClass *) class;
item_class = (GnomeCanvasItemClass *) class;
parent_class = g_type_class_peek_parent (class);
@@ -199,6 +197,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class)
gobject_class->set_property = gnome_canvas_text_set_property;
gobject_class->get_property = gnome_canvas_text_get_property;
+
/* Text */
g_object_class_install_property
(gobject_class,
@@ -512,8 +511,7 @@ gnome_canvas_text_class_init (GnomeCanvasTextClass *class)
"Whether this tag affects font scaling");
#undef ADD_SET_PROP
- object_class->destroy = gnome_canvas_text_destroy;
-
+ item_class->destroy = gnome_canvas_text_destroy;
item_class->update = gnome_canvas_text_update;
item_class->realize = gnome_canvas_text_realize;
item_class->unrealize = gnome_canvas_text_unrealize;
@@ -554,7 +552,7 @@ gnome_canvas_text_init (GnomeCanvasText *text)
/* Destroy handler for the text item */
static void
-gnome_canvas_text_destroy (GtkObject *object)
+gnome_canvas_text_destroy (GnomeCanvasItem *object)
{
GnomeCanvasText *text;
@@ -590,8 +588,8 @@ gnome_canvas_text_destroy (GtkObject *object)
g_free (text->priv);
text->priv = NULL;
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy)
+ GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy (object);
}
static void
diff --git a/libgnomecanvas/gnome-canvas-widget.c b/libgnomecanvas/gnome-canvas-widget.c
index 23b687f899..fbcb0a6a53 100644
--- a/libgnomecanvas/gnome-canvas-widget.c
+++ b/libgnomecanvas/gnome-canvas-widget.c
@@ -49,7 +49,7 @@ enum {
static void gnome_canvas_widget_class_init (GnomeCanvasWidgetClass *class);
static void gnome_canvas_widget_init (GnomeCanvasWidget *witem);
-static void gnome_canvas_widget_destroy (GtkObject *object);
+static void gnome_canvas_widget_destroy (GnomeCanvasItem *object);
static void gnome_canvas_widget_get_property (GObject *object,
guint param_id,
GValue *value,
@@ -116,11 +116,9 @@ static void
gnome_canvas_widget_class_init (GnomeCanvasWidgetClass *class)
{
GObjectClass *gobject_class;
- GtkObjectClass *object_class;
GnomeCanvasItemClass *item_class;
gobject_class = (GObjectClass *) class;
- object_class = (GtkObjectClass *) class;
item_class = (GnomeCanvasItemClass *) class;
parent_class = g_type_class_peek_parent (class);
@@ -172,8 +170,7 @@ gnome_canvas_widget_class_init (GnomeCanvasWidgetClass *class)
FALSE,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
- object_class->destroy = gnome_canvas_widget_destroy;
-
+ item_class->destroy = gnome_canvas_widget_destroy;
item_class->update = gnome_canvas_widget_update;
item_class->point = gnome_canvas_widget_point;
item_class->bounds = gnome_canvas_widget_bounds;
@@ -182,6 +179,19 @@ gnome_canvas_widget_class_init (GnomeCanvasWidgetClass *class)
}
static void
+do_destroy (gpointer data, GObject *gone_object)
+{
+ GnomeCanvasWidget *witem;
+
+ witem = data;
+
+ if (!witem->in_destroy) {
+ witem->in_destroy = TRUE;
+ g_object_run_dispose (G_OBJECT (witem));
+ }
+}
+
+static void
gnome_canvas_widget_init (GnomeCanvasWidget *witem)
{
witem->x = 0.0;
@@ -193,7 +203,7 @@ gnome_canvas_widget_init (GnomeCanvasWidget *witem)
}
static void
-gnome_canvas_widget_destroy (GtkObject *object)
+gnome_canvas_widget_destroy (GnomeCanvasItem *object)
{
GnomeCanvasWidget *witem;
@@ -203,13 +213,13 @@ gnome_canvas_widget_destroy (GtkObject *object)
witem = GNOME_CANVAS_WIDGET (object);
if (witem->widget && !witem->in_destroy) {
- g_signal_handler_disconnect (witem->widget, witem->destroy_id);
+ g_object_weak_unref (G_OBJECT (witem->widget), do_destroy, witem);
gtk_widget_destroy (witem->widget);
witem->widget = NULL;
}
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy)
+ GNOME_CANVAS_ITEM_CLASS (parent_class)->destroy (object);
}
static void
@@ -290,18 +300,6 @@ recalc_bounds (GnomeCanvasWidget *witem)
}
static void
-do_destroy (GtkObject *object, gpointer data)
-{
- GnomeCanvasWidget *witem;
-
- witem = data;
-
- witem->in_destroy = TRUE;
-
- gtk_object_destroy (data);
-}
-
-static void
gnome_canvas_widget_set_property (GObject *object,
guint param_id,
const GValue *value,
@@ -325,16 +323,14 @@ gnome_canvas_widget_set_property (GObject *object,
switch (param_id) {
case PROP_WIDGET:
if (witem->widget) {
- g_signal_handler_disconnect (witem->widget, witem->destroy_id);
+ g_object_weak_unref (G_OBJECT (witem->widget), do_destroy, witem);
gtk_container_remove (GTK_CONTAINER (item->canvas), witem->widget);
}
obj = g_value_get_object (value);
if (obj) {
witem->widget = GTK_WIDGET (obj);
- witem->destroy_id = g_signal_connect (obj, "destroy",
- G_CALLBACK (do_destroy),
- witem);
+ g_object_weak_ref (obj, do_destroy, witem);
gtk_layout_put (GTK_LAYOUT (item->canvas), witem->widget,
witem->cx + item->canvas->zoom_xofs,
witem->cy + item->canvas->zoom_yofs);
diff --git a/libgnomecanvas/gnome-canvas-widget.h b/libgnomecanvas/gnome-canvas-widget.h
index 32514aad6e..62000299b1 100644
--- a/libgnomecanvas/gnome-canvas-widget.h
+++ b/libgnomecanvas/gnome-canvas-widget.h
@@ -78,8 +78,6 @@ struct _GnomeCanvasWidget {
gint cx, cy; /* Top-left canvas coordinates for widget */
gint cwidth, cheight; /* Size of widget in pixels */
- guint destroy_id; /* Signal connection id for destruction of child widget */
-
guint size_pixels : 1; /* Is size specified in (unchanging) pixels or units (get scaled)? */
guint in_destroy : 1; /* Is child widget being destroyed? */
};
diff --git a/libgnomecanvas/gnome-canvas.c b/libgnomecanvas/gnome-canvas.c
index adc18621f9..cacabff454 100644
--- a/libgnomecanvas/gnome-canvas.c
+++ b/libgnomecanvas/gnome-canvas.c
@@ -136,7 +136,7 @@ static gint emit_event (GnomeCanvas *canvas, GdkEvent *ev
static guint item_signals[ITEM_LAST_SIGNAL];
-static GtkObjectClass *item_parent_class;
+static GObjectClass *item_parent_class;
/**
* gnome_canvas_item_get_type:
@@ -165,7 +165,7 @@ gnome_canvas_item_get_type (void)
NULL /* value_table */
};
- canvas_item_type = g_type_register_static (GTK_TYPE_OBJECT, "GnomeCanvasItem",
+ canvas_item_type = g_type_register_static (G_TYPE_OBJECT, "GnomeCanvasItem",
&object_info, 0);
}
@@ -362,6 +362,9 @@ gnome_canvas_item_dispose (GObject *object)
g_free (item->xform);
item->xform = NULL;
+ if (GNOME_CANVAS_ITEM_GET_CLASS (item)->destroy)
+ GNOME_CANVAS_ITEM_GET_CLASS (item)->destroy (item);
+
G_OBJECT_CLASS (item_parent_class)->dispose (object);
/* items should remove any reference to item->canvas after the
first ::destroy */
@@ -1355,7 +1358,7 @@ static void gnome_canvas_group_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
-static void gnome_canvas_group_destroy (GtkObject *object);
+static void gnome_canvas_group_destroy (GnomeCanvasItem *object);
static void gnome_canvas_group_update (GnomeCanvasItem *item, gdouble *affine,
ArtSVP *clip_path, gint flags);
@@ -1418,36 +1421,33 @@ gnome_canvas_group_get_type (void)
static void
gnome_canvas_group_class_init (GnomeCanvasGroupClass *class)
{
- GObjectClass *gobject_class;
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
GnomeCanvasItemClass *item_class;
- gobject_class = (GObjectClass *) class;
- object_class = (GtkObjectClass *) class;
+ object_class = (GObjectClass *) class;
item_class = (GnomeCanvasItemClass *) class;
group_parent_class = g_type_class_peek_parent (class);
- gobject_class->set_property = gnome_canvas_group_set_property;
- gobject_class->get_property = gnome_canvas_group_get_property;
+ object_class->set_property = gnome_canvas_group_set_property;
+ object_class->get_property = gnome_canvas_group_get_property;
g_object_class_install_property
- (gobject_class, GROUP_PROP_X,
+ (object_class, GROUP_PROP_X,
g_param_spec_double ("x",
"X",
"X",
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
g_object_class_install_property
- (gobject_class, GROUP_PROP_Y,
+ (object_class, GROUP_PROP_Y,
g_param_spec_double ("y",
"Y",
"Y",
-G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
- object_class->destroy = gnome_canvas_group_destroy;
-
+ item_class->destroy = gnome_canvas_group_destroy;
item_class->update = gnome_canvas_group_update;
item_class->realize = gnome_canvas_group_realize;
item_class->unrealize = gnome_canvas_group_unrealize;
@@ -1553,7 +1553,7 @@ gnome_canvas_group_get_property (GObject *gobject, guint param_id,
/* Destroy handler for canvas groups */
static void
-gnome_canvas_group_destroy (GtkObject *object)
+gnome_canvas_group_destroy (GnomeCanvasItem *object)
{
GnomeCanvasGroup *group;
@@ -1562,12 +1562,12 @@ gnome_canvas_group_destroy (GtkObject *object)
group = GNOME_CANVAS_GROUP (object);
while (group->item_list) {
- // child is unref'ed by the child's group_remove ().
- gtk_object_destroy (GTK_OBJECT (group->item_list->data));
+ /* child is unref'ed by the child's group_remove (). */
+ g_object_run_dispose (G_OBJECT (group->item_list->data));
}
- if (GTK_OBJECT_CLASS (group_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (group_parent_class)->destroy) (object);
+ if (GNOME_CANVAS_ITEM_CLASS (group_parent_class)->destroy)
+ GNOME_CANVAS_ITEM_CLASS (group_parent_class)->destroy (object);
}
/* Update handler for canvas groups */
@@ -1941,7 +1941,7 @@ enum {
static void gnome_canvas_class_init (GnomeCanvasClass *class);
static void gnome_canvas_init (GnomeCanvas *canvas);
-static void gnome_canvas_destroy (GtkObject *object);
+static void gnome_canvas_dispose (GObject *object);
static void gnome_canvas_map (GtkWidget *widget);
static void gnome_canvas_unmap (GtkWidget *widget);
static void gnome_canvas_realize (GtkWidget *widget);
@@ -2055,20 +2055,17 @@ gnome_canvas_set_property (GObject *object,
static void
gnome_canvas_class_init (GnomeCanvasClass *klass)
{
- GObjectClass *gobject_class;
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
GtkWidgetClass *widget_class;
- gobject_class = (GObjectClass *)klass;
- object_class = (GtkObjectClass *) klass;
+ object_class = (GObjectClass *)klass;
widget_class = (GtkWidgetClass *) klass;
canvas_parent_class = g_type_class_peek_parent (klass);
- gobject_class->set_property = gnome_canvas_set_property;
- gobject_class->get_property = gnome_canvas_get_property;
-
- object_class->destroy = gnome_canvas_destroy;
+ object_class->set_property = gnome_canvas_set_property;
+ object_class->get_property = gnome_canvas_get_property;
+ object_class->dispose = gnome_canvas_dispose;
widget_class->map = gnome_canvas_map;
widget_class->unmap = gnome_canvas_unmap;
@@ -2098,7 +2095,7 @@ gnome_canvas_class_init (GnomeCanvasClass *klass)
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property (gobject_class, PROP_FOCUSED_ITEM,
+ g_object_class_install_property (object_class, PROP_FOCUSED_ITEM,
g_param_spec_object ("focused_item", NULL, NULL,
GNOME_TYPE_CANVAS_ITEM,
(G_PARAM_READABLE | G_PARAM_WRITABLE)));
@@ -2128,9 +2125,9 @@ gnome_canvas_class_init (GnomeCanvasClass *klass)
* never ever do this, so we panic if this happens.
*/
G_GNUC_NORETURN static void
-panic_root_destroyed (GtkObject *object, gpointer data)
+panic_root_finalized (gpointer data, GObject *gone_object)
{
- g_error ("Eeeek, root item %p of canvas %p was destroyed!", object, data);
+ g_error ("Eeeek, root item %p of canvas %p was destroyed!", gone_object, data);
}
/* Object initialization function for GnomeCanvas */
@@ -2182,9 +2179,7 @@ gnome_canvas_init (GnomeCanvas *canvas)
g_object_ref_sink (canvas->root);
- canvas->root_destroy_id = g_signal_connect (canvas->root, "destroy",
- G_CALLBACK (panic_root_destroyed),
- canvas);
+ g_object_weak_ref (G_OBJECT (canvas->root), panic_root_finalized, canvas);
canvas->need_repick = TRUE;
}
@@ -2227,32 +2222,28 @@ shutdown_transients (GnomeCanvas *canvas)
remove_idle (canvas);
}
-/* Destroy handler for GnomeCanvas */
+/* Dispose handler for GnomeCanvas */
static void
-gnome_canvas_destroy (GtkObject *object)
+gnome_canvas_dispose (GObject *object)
{
GnomeCanvas *canvas;
g_return_if_fail (GNOME_IS_CANVAS (object));
- /* remember, destroy can be run multiple times! */
+ /* remember, dispose can be run multiple times! */
canvas = GNOME_CANVAS (object);
- if (canvas->root_destroy_id) {
- g_signal_handler_disconnect (canvas->root, canvas->root_destroy_id);
- canvas->root_destroy_id = 0;
- }
if (canvas->root) {
- gtk_object_destroy (GTK_OBJECT (canvas->root));
+ g_object_weak_unref (G_OBJECT (canvas->root), panic_root_finalized, canvas);
g_object_unref (G_OBJECT (canvas->root));
canvas->root = NULL;
}
shutdown_transients (canvas);
- if (GTK_OBJECT_CLASS (canvas_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (canvas_parent_class)->destroy) (object);
+ if (G_OBJECT_CLASS (canvas_parent_class)->dispose)
+ G_OBJECT_CLASS (canvas_parent_class)->dispose (object);
}
/**
diff --git a/libgnomecanvas/gnome-canvas.h b/libgnomecanvas/gnome-canvas.h
index 66b9dba652..c5d6cffe3b 100644
--- a/libgnomecanvas/gnome-canvas.h
+++ b/libgnomecanvas/gnome-canvas.h
@@ -138,7 +138,7 @@ typedef struct {
#define GNOME_CANVAS_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GNOME_TYPE_CANVAS_ITEM, GnomeCanvasItemClass))
struct _GnomeCanvasItem {
- GtkObject object;
+ GObject object;
/* Parent canvas for this item */
GnomeCanvas *canvas;
@@ -156,13 +156,13 @@ struct _GnomeCanvasItem {
/* Bounding box for this item (in canvas coordinates) */
gdouble x1, y1, x2, y2;
- /* XXX GtkObject flags are sealed now, so we have to provide
+ /* XXX GObject flags are sealed now, so we have to provide
* our own. This breaks ABI compatibility with upstream. */
GnomeCanvasItemFlags flags;
};
struct _GnomeCanvasItemClass {
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
/* Tell the item to update itself. The flags are from the update flags
* defined above. The item should update its internal state from its
@@ -184,6 +184,9 @@ struct _GnomeCanvasItemClass {
/* Unmap an item */
void (* unmap) (GnomeCanvasItem *item);
+ /* Destroy item; called inside GObject's dispose of the base class */
+ void (* destroy) (GnomeCanvasItem *item);
+
/* Return the microtile coverage of the item */
ArtUta *(* coverage) (GnomeCanvasItem *item);
@@ -426,9 +429,6 @@ struct _GnomeCanvas {
/* Idle handler ID */
guint idle_id;
- /* Signal handler ID for destruction of the root item */
- guint root_destroy_id;
-
/* Area that is being redrawn. Contains (x1, y1) but not (x2, y2).
* Specified in canvas pixel coordinates.
*/