[nautilus] Update to latest foocanvas



commit b4cd0d66db105822bfa5531a146428b548aff369
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Sep 7 20:49:29 2009 +0200

    Update to latest foocanvas
    
    This has some cleanups and fixes a memory leak that was introduced
    in the eel copy by removing gtk_object_sink.

 eel/eel-canvas-rect-ellipse.c |   94 ++++++++--------
 eel/eel-canvas-rect-ellipse.h |   57 ++++------
 eel/eel-canvas-util.c         |    3 +
 eel/eel-canvas.c              |  253 ++++++++++++++++++++++-------------------
 eel/eel-canvas.h              |   59 ++++------
 5 files changed, 236 insertions(+), 230 deletions(-)
---
diff --git a/eel/eel-canvas-rect-ellipse.c b/eel/eel-canvas-rect-ellipse.c
index fe86f62..84a1034 100644
--- a/eel/eel-canvas-rect-ellipse.c
+++ b/eel/eel-canvas-rect-ellipse.c
@@ -65,7 +65,7 @@ enum {
 };
 
 
-static void eel_canvas_re_class_init (EelCanvasREClass *class);
+static void eel_canvas_re_class_init (EelCanvasREClass *klass);
 static void eel_canvas_re_init       (EelCanvasRE      *re);
 static void eel_canvas_re_destroy    (GtkObject          *object);
 static void eel_canvas_re_set_property (GObject              *object,
@@ -126,17 +126,17 @@ eel_canvas_re_get_type (void)
 }
 
 static void
-eel_canvas_re_class_init (EelCanvasREClass *class)
+eel_canvas_re_class_init (EelCanvasREClass *klass)
 {
 	GObjectClass *gobject_class;
 	GtkObjectClass *object_class;
 	EelCanvasItemClass *item_class;
 
-	gobject_class = (GObjectClass *) class;
-	object_class = (GtkObjectClass *) class;
-	item_class = (EelCanvasItemClass *) class;
+	gobject_class = (GObjectClass *) klass;
+	object_class = (GtkObjectClass *) klass;
+	item_class = (EelCanvasItemClass *) klass;
 
-	re_parent_class = g_type_class_peek_parent (class);
+	re_parent_class = g_type_class_peek_parent (klass);
 
 	gobject_class->set_property = eel_canvas_re_set_property;
 	gobject_class->get_property = eel_canvas_re_get_property;
@@ -146,85 +146,85 @@ eel_canvas_re_class_init (EelCanvasREClass *class)
                  PROP_X1,
                  g_param_spec_double ("x1", NULL, NULL,
 				      -G_MAXDOUBLE, G_MAXDOUBLE, 0,
-				      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				      G_PARAM_READWRITE));
         g_object_class_install_property
                 (gobject_class,
                  PROP_Y1,
                  g_param_spec_double ("y1", NULL, NULL,
 				      -G_MAXDOUBLE, G_MAXDOUBLE, 0,
-				      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				      G_PARAM_READWRITE));
         g_object_class_install_property
                 (gobject_class,
                  PROP_X2,
                  g_param_spec_double ("x2", NULL, NULL,
 				      -G_MAXDOUBLE, G_MAXDOUBLE, 0,
-				      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				      G_PARAM_READWRITE));
         g_object_class_install_property
                 (gobject_class,
                  PROP_Y2,
                  g_param_spec_double ("y2", NULL, NULL,
 				      -G_MAXDOUBLE, G_MAXDOUBLE, 0,
-				      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				      G_PARAM_READWRITE));
         g_object_class_install_property
                 (gobject_class,
                  PROP_FILL_COLOR,
-                 g_param_spec_string ("fill_color", NULL, NULL,
+                 g_param_spec_string ("fill-color", NULL, NULL,
                                       NULL,
-                                      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+                                      G_PARAM_READWRITE));
         g_object_class_install_property
                 (gobject_class,
                  PROP_FILL_COLOR_GDK,
-                 g_param_spec_boxed ("fill_color_gdk", NULL, NULL,
+                 g_param_spec_boxed ("fill-color-gdk", NULL, NULL,
 				     GDK_TYPE_COLOR,
-				     (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				     G_PARAM_READWRITE));
         g_object_class_install_property
                 (gobject_class,
                  PROP_FILL_COLOR_RGBA,
-                 g_param_spec_uint ("fill_color_rgba", NULL, NULL,
+                 g_param_spec_uint ("fill-color-rgba", NULL, NULL,
 				    0, G_MAXUINT, 0,
-				    (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				    G_PARAM_READWRITE));
         g_object_class_install_property
                 (gobject_class,
                  PROP_FILL_STIPPLE,
-                 g_param_spec_object ("fill_stipple", NULL, NULL,
+                 g_param_spec_object ("fill-stipple", NULL, NULL,
                                       GDK_TYPE_DRAWABLE,
-                                      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+                                      G_PARAM_READWRITE));
         g_object_class_install_property
                 (gobject_class,
                  PROP_OUTLINE_COLOR,
-                 g_param_spec_string ("outline_color", NULL, NULL,
+                 g_param_spec_string ("outline-color", NULL, NULL,
                                       NULL,
-                                      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+                                      G_PARAM_READWRITE));
         g_object_class_install_property
                 (gobject_class,
                  PROP_OUTLINE_COLOR_GDK,
-                 g_param_spec_boxed ("outline_color_gdk", NULL, NULL,
+                 g_param_spec_boxed ("outline-color-gdk", NULL, NULL,
 				     GDK_TYPE_COLOR,
-				     (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				     G_PARAM_READWRITE));
         g_object_class_install_property
                 (gobject_class,
                  PROP_OUTLINE_COLOR_RGBA,
-                 g_param_spec_uint ("outline_color_rgba", NULL, NULL,
+                 g_param_spec_uint ("outline-color-rgba", NULL, NULL,
 				    0, G_MAXUINT, 0,
-				    (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				    G_PARAM_READWRITE));
         g_object_class_install_property
                 (gobject_class,
                  PROP_OUTLINE_STIPPLE,
-                 g_param_spec_object ("outline_stipple", NULL, NULL,
+                 g_param_spec_object ("outline-stipple", NULL, NULL,
                                       GDK_TYPE_DRAWABLE,
-                                      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+                                      G_PARAM_READWRITE));
         g_object_class_install_property
                 (gobject_class,
                  PROP_WIDTH_PIXELS,
-                 g_param_spec_uint ("width_pixels", NULL, NULL,
+                 g_param_spec_uint ("width-pixels", NULL, NULL,
 				    0, G_MAXUINT, 0,
-				    (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				    G_PARAM_READWRITE));
         g_object_class_install_property
                 (gobject_class,
                  PROP_WIDTH_UNITS,
-                 g_param_spec_double ("width_units", NULL, NULL,
+                 g_param_spec_double ("width-units", NULL, NULL,
 				      0.0, G_MAXDOUBLE, 0.0,
-				      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				      G_PARAM_READWRITE));
 
 	object_class->destroy = eel_canvas_re_destroy;
 
@@ -249,8 +249,8 @@ eel_canvas_re_destroy (GtkObject *object)
 {
 	EelCanvasRE *re;
 
-	g_assert (object != NULL);
-	g_assert (EEL_IS_CANVAS_RE (object));
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (EEL_IS_CANVAS_RE (object));
 
 	re = EEL_CANVAS_RE (object);
 
@@ -388,8 +388,8 @@ eel_canvas_re_set_property (GObject              *object,
 	GdkColor *pcolor;
 	int have_pixel;
 
-	g_assert (object != NULL);
-	g_assert (EEL_IS_CANVAS_RE (object));
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (EEL_IS_CANVAS_RE (object));
 
 	item = EEL_CANVAS_ITEM (object);
 	re = EEL_CANVAS_RE (object);
@@ -583,8 +583,8 @@ eel_canvas_re_get_property (GObject              *object,
 {
 	EelCanvasRE *re;
 
-	g_assert (object != NULL);
-	g_assert (EEL_IS_CANVAS_RE (object));
+	g_return_if_fail (object != NULL);
+	g_return_if_fail (EEL_IS_CANVAS_RE (object));
 
 	re = EEL_CANVAS_RE (object);
 
@@ -747,7 +747,7 @@ eel_canvas_re_bounds (EelCanvasItem *item, double *x1, double *y1, double *x2, d
 /* Rectangle item */
 
 
-static void eel_canvas_rect_class_init (EelCanvasRectClass *class);
+static void eel_canvas_rect_class_init (EelCanvasRectClass *klass);
 static void eel_canvas_rect_init (EelCanvasRect *rect);
 static void eel_canvas_rect_finalize (GObject *object);
 static void eel_canvas_rect_realize  (EelCanvasItem *item);
@@ -795,20 +795,20 @@ eel_canvas_rect_get_type (void)
 }
 
 static void
-eel_canvas_rect_class_init (EelCanvasRectClass *class)
+eel_canvas_rect_class_init (EelCanvasRectClass *klass)
 {
 	EelCanvasItemClass *item_class;
 
-	rect_parent_class = g_type_class_peek_parent (class);
+	rect_parent_class = g_type_class_peek_parent (klass);
 
-	item_class = (EelCanvasItemClass *) class;
+	item_class = (EelCanvasItemClass *) klass;
 
 	item_class->draw = eel_canvas_rect_draw;
 	item_class->point = eel_canvas_rect_point;
 	item_class->update = eel_canvas_rect_update;
 	item_class->realize = eel_canvas_rect_realize;
 
-	G_OBJECT_CLASS (class)->finalize = eel_canvas_rect_finalize;
+	G_OBJECT_CLASS (klass)->finalize = eel_canvas_rect_finalize;
 	
 }
 
@@ -836,17 +836,17 @@ eel_canvas_rect_realize  (EelCanvasItem *item)
 #ifdef HAVE_RENDER
 	EelCanvasRectPrivate *priv;
 	int event_base, error_base;
+	Display *dpy;
 
 	priv = EEL_CANVAS_RECT (item)->priv;
 
-	priv->use_render = XRenderQueryExtension (gdk_display, &event_base, &error_base);
+	dpy = gdk_x11_drawable_get_xdisplay (GTK_WIDGET (item->canvas)->window);
+	priv->use_render = XRenderQueryExtension (dpy, &event_base, &error_base);
 
 	if (priv->use_render) {
-		Display *dpy;
 		GdkVisual *gdk_visual;
 		Visual *visual;
 
-		dpy = gdk_x11_drawable_get_xdisplay (GTK_WIDGET (item->canvas)->window);
 		gdk_visual = gtk_widget_get_visual (GTK_WIDGET (item->canvas));
 		visual = gdk_x11_visual_get_xvisual (gdk_visual);
 
@@ -1224,7 +1224,7 @@ eel_canvas_rect_update (EelCanvasItem *item, double i2w_dx, double i2w_dy, gint
 /* Ellipse item */
 
 
-static void eel_canvas_ellipse_class_init (EelCanvasEllipseClass *class);
+static void eel_canvas_ellipse_class_init (EelCanvasEllipseClass *klass);
 
 static void   eel_canvas_ellipse_draw   (EelCanvasItem *item, GdkDrawable *drawable, GdkEventExpose *expose);
 static double eel_canvas_ellipse_point  (EelCanvasItem *item, double x, double y, int cx, int cy,
@@ -1260,11 +1260,11 @@ eel_canvas_ellipse_get_type (void)
 }
 
 static void
-eel_canvas_ellipse_class_init (EelCanvasEllipseClass *class)
+eel_canvas_ellipse_class_init (EelCanvasEllipseClass *klass)
 {
 	EelCanvasItemClass *item_class;
 
-	item_class = (EelCanvasItemClass *) class;
+	item_class = (EelCanvasItemClass *) klass;
 
 	item_class->draw = eel_canvas_ellipse_draw;
 	item_class->point = eel_canvas_ellipse_point;
diff --git a/eel/eel-canvas-rect-ellipse.h b/eel/eel-canvas-rect-ellipse.h
index 52b1a31..7fae4bc 100644
--- a/eel/eel-canvas-rect-ellipse.h
+++ b/eel/eel-canvas-rect-ellipse.h
@@ -63,17 +63,14 @@ G_BEGIN_DECLS
  *							will be scaled when the canvas zoom factor is changed.
  */
 
-#define EEL_TYPE_CANVAS_RE eel_canvas_re_get_type()
-#define EEL_CANVAS_RE(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEL_TYPE_CANVAS_RE, EelCanvasRE))
-#define EEL_CANVAS_RE_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), EEL_TYPE_CANVAS_RE, EelCanvasREClass))
-#define EEL_IS_CANVAS_RE(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEL_TYPE_CANVAS_RE))
-#define EEL_IS_CANVAS_RE_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), EEL_TYPE_CANVAS_RE))
-#define EEL_CANVAS_RE_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), EEL_TYPE_CANVAS_RE, EelCanvasREClass))
+
+#define EEL_TYPE_CANVAS_RE            (eel_canvas_re_get_type ())
+#define EEL_CANVAS_RE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEL_TYPE_CANVAS_RE, EelCanvasRE))
+#define EEL_CANVAS_RE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EEL_TYPE_CANVAS_RE, EelCanvasREClass))
+#define EEL_IS_CANVAS_RE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEL_TYPE_CANVAS_RE))
+#define EEL_IS_CANVAS_RE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEL_TYPE_CANVAS_RE))
+#define EEL_CANVAS_RE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EEL_TYPE_CANVAS_RE, EelCanvasREClass))
+
 
 typedef struct _EelCanvasRE      EelCanvasRE;
 typedef struct _EelCanvasREClass EelCanvasREClass;
@@ -116,17 +113,14 @@ GType eel_canvas_re_get_type (void) G_GNUC_CONST;
  * EelCanvasRE).
  */
 
-#define EEL_TYPE_CANVAS_RECT eel_canvas_rect_get_type()
-#define EEL_CANVAS_RECT(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEL_TYPE_CANVAS_RECT, EelCanvasRect))
-#define EEL_CANVAS_RECT_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), EEL_TYPE_CANVAS_RECT, EelCanvasRectClass))
-#define EEL_IS_CANVAS_RECT(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEL_TYPE_CANVAS_RECT))
-#define EEL_IS_CANVAS_RECT_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), EEL_TYPE_CANVAS_RECT))
-#define EEL_CANVAS_RECT_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), EEL_TYPE_CANVAS_RECT, EelCanvasRectClass))
+
+#define EEL_TYPE_CANVAS_RECT            (eel_canvas_rect_get_type ())
+#define EEL_CANVAS_RECT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEL_TYPE_CANVAS_RECT, EelCanvasRect))
+#define EEL_CANVAS_RECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EEL_TYPE_CANVAS_RECT, EelCanvasRectClass))
+#define EEL_IS_CANVAS_RECT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEL_TYPE_CANVAS_RECT))
+#define EEL_IS_CANVAS_RECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEL_TYPE_CANVAS_RECT))
+#define EEL_CANVAS_RECT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EEL_TYPE_CANVAS_RECT, EelCanvasRectClass))
+
 
 typedef struct _EelCanvasRect EelCanvasRect;
 typedef struct _EelCanvasRectPrivate EelCanvasRectPrivate;
@@ -150,17 +144,14 @@ GType eel_canvas_rect_get_type (void) G_GNUC_CONST;
  * EelCanvasRE).
  */
 
-#define EEL_TYPE_CANVAS_ELLIPSE eel_canvas_ellipse_get_type()
-#define EEL_CANVAS_ELLIPSE(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEL_TYPE_CANVAS_ELLIPSE, EelCanvasEllipse))
-#define EEL_CANVAS_ELLIPSE_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), EEL_TYPE_CANVAS_ELLIPSE, EelCanvasEllipseClass))
-#define EEL_IS_CANVAS_ELLIPSE(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEL_TYPE_CANVAS_ELLIPSE))
-#define EEL_IS_CANVAS_ELLIPSE_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), EEL_TYPE_CANVAS_ELLIPSE))
-#define EEL_CANVAS_ELLIPSE_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), EEL_TYPE_CANVAS_ELLIPSE, EelCanvasEllipseClass))
+
+#define EEL_TYPE_CANVAS_ELLIPSE            (eel_canvas_ellipse_get_type ())
+#define EEL_CANVAS_ELLIPSE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEL_TYPE_CANVAS_ELLIPSE, EelCanvasEllipse))
+#define EEL_CANVAS_ELLIPSE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EEL_TYPE_CANVAS_ELLIPSE, EelCanvasEllipseClass))
+#define EEL_IS_CANVAS_ELLIPSE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEL_TYPE_CANVAS_ELLIPSE))
+#define EEL_IS_CANVAS_ELLIPSE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEL_TYPE_CANVAS_ELLIPSE))
+#define EEL_CANVAS_ELLIPSE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EEL_TYPE_CANVAS_ELLIPSE, EelCanvasEllipseClass))
+
 
 typedef struct _EelCanvasEllipse EelCanvasEllipse;
 typedef struct _EelCanvasEllipseClass EelCanvasEllipseClass;
diff --git a/eel/eel-canvas-util.c b/eel/eel-canvas-util.c
index 724af76..313ca48 100644
--- a/eel/eel-canvas-util.c
+++ b/eel/eel-canvas-util.c
@@ -257,6 +257,9 @@ eel_canvas_polygon_to_point (double *poly, int num_points, double x, double y)
 	 */
 
 	best = 1.0e36;
+	if (poly == NULL)
+		return best;
+
 	intersections = 0;
 
 	for (i = num_points, p = poly; i > 1; i--, p += 2) {
diff --git a/eel/eel-canvas.c b/eel/eel-canvas.c
index 3ec2df5..e45cbdc 100644
--- a/eel/eel-canvas.c
+++ b/eel/eel-canvas.c
@@ -97,7 +97,7 @@ enum {
 	ITEM_LAST_SIGNAL
 };
 
-static void eel_canvas_item_class_init     (EelCanvasItemClass *class);
+static void eel_canvas_item_class_init     (EelCanvasItemClass *klass);
 static void eel_canvas_item_init           (EelCanvasItem      *item);
 static int  emit_event                       (EelCanvas *canvas, GdkEvent *event);
 
@@ -123,7 +123,7 @@ eel_canvas_item_get_type (void)
 	static GType canvas_item_type = 0;
 
 	if (!canvas_item_type) {
-		const GTypeInfo canvas_item_info = {
+		static const GTypeInfo canvas_item_info = {
 			sizeof (EelCanvasItemClass),
 			(GBaseInitFunc) NULL,
 			(GBaseFinalizeFunc) NULL,
@@ -205,7 +205,7 @@ eel_canvas_item_set_property (GObject *gobject, guint param_id,
 {
 	EelCanvasItem *item;
 
-	g_assert (EEL_IS_CANVAS_ITEM (gobject));
+	g_return_if_fail (EEL_IS_CANVAS_ITEM (gobject));
 
 	item = EEL_CANVAS_ITEM (gobject);
 
@@ -240,7 +240,7 @@ eel_canvas_item_get_property (GObject *gobject, guint param_id,
 {
 	EelCanvasItem *item;
 
-	g_assert (EEL_IS_CANVAS_ITEM (gobject));
+	g_return_if_fail (EEL_IS_CANVAS_ITEM (gobject));
 
 	item = EEL_CANVAS_ITEM (gobject);
 
@@ -288,54 +288,58 @@ redraw_and_repick_if_mapped (EelCanvasItem *item)
 	}
 }
 
-
-/* Standard object dispose function for canvas items */
+/* Dispose handler for canvas items */
 static void
 eel_canvas_item_dispose (GObject *object)
 {
 	EelCanvasItem *item;
 
-	g_assert (EEL_IS_CANVAS_ITEM (object));
+	g_return_if_fail (EEL_IS_CANVAS_ITEM (object));
 
 	item = EEL_CANVAS_ITEM (object);
 
-	eel_canvas_item_request_redraw (item);
+	if (item->canvas) {
+		eel_canvas_item_request_redraw (item);
 
-	/* Make the canvas forget about us */
+		/* Make the canvas forget about us */
 
-	if (item == item->canvas->current_item) {
-		item->canvas->current_item = NULL;
-		item->canvas->need_repick = TRUE;
-	}
+		if (item == item->canvas->current_item) {
+			item->canvas->current_item = NULL;
+			item->canvas->need_repick = TRUE;
+		}
 
-	if (item == item->canvas->new_current_item) {
-		item->canvas->new_current_item = NULL;
-		item->canvas->need_repick = TRUE;
-	}
+		if (item == item->canvas->new_current_item) {
+			item->canvas->new_current_item = NULL;
+			item->canvas->need_repick = TRUE;
+		}
 
-	if (item == item->canvas->grabbed_item) {
-		GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (item->canvas));
-		item->canvas->grabbed_item = NULL;
-		gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
-	}
+		if (item == item->canvas->grabbed_item) {
+			GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (item->canvas));
+			item->canvas->grabbed_item = NULL;
+			gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
+		}
 
-	if (item == item->canvas->focused_item)
-		item->canvas->focused_item = NULL;
+		if (item == item->canvas->focused_item)
+			item->canvas->focused_item = NULL;
 
-	/* Normal destroy stuff */
+		/* Normal destroy stuff */
 
-	if (item->object.flags & EEL_CANVAS_ITEM_MAPPED)
-		(* EEL_CANVAS_ITEM_GET_CLASS (item)->unmap) (item);
+		if (item->object.flags & EEL_CANVAS_ITEM_MAPPED)
+			(* EEL_CANVAS_ITEM_GET_CLASS (item)->unmap) (item);
 
-	if (item->object.flags & EEL_CANVAS_ITEM_REALIZED)
-		(* EEL_CANVAS_ITEM_GET_CLASS (item)->unrealize) (item);
+		if (item->object.flags & EEL_CANVAS_ITEM_REALIZED)
+			(* EEL_CANVAS_ITEM_GET_CLASS (item)->unrealize) (item);
 
-	if (item->parent)
-		group_remove (EEL_CANVAS_GROUP (item->parent), item);
+		if (item->parent)
+			group_remove (EEL_CANVAS_GROUP (item->parent), item);
+
+		item->canvas = NULL;
+	}
 
 	G_OBJECT_CLASS (item_parent_class)->dispose (object);
 }
 
+
 /* Realize handler for canvas items */
 static void
 eel_canvas_item_realize (EelCanvasItem *item)
@@ -422,7 +426,7 @@ eel_canvas_item_invoke_update (EelCanvasItem *item,
  
 	/* If this fail you probably forgot to chain up to
 	 * EelCanvasItem::update from a derived class */
- 	g_assert (!(item->object.flags & EEL_CANVAS_ITEM_NEED_UPDATE));
+ 	g_return_if_fail (!(item->object.flags & EEL_CANVAS_ITEM_NEED_UPDATE));
 }
 
 /*
@@ -974,19 +978,20 @@ eel_canvas_item_reparent (EelCanvasItem *item, EelCanvasGroup *new_group)
 
 	/* Everything is ok, now actually reparent the item */
 
-	g_object_ref (GTK_OBJECT (item)); /* protect it from the unref in group_remove */
+	g_object_ref (G_OBJECT (item)); /* protect it from the unref in group_remove */
 
 	eel_canvas_item_request_redraw (item);
 
 	group_remove (EEL_CANVAS_GROUP (item->parent), item);
 	item->parent = EEL_CANVAS_ITEM (new_group);
+	/* item->canvas is unchanged.  */
 	group_add (new_group, item);
 
 	/* Redraw and repick */
 
 	redraw_and_repick_if_mapped (item);
 
-	g_object_unref (GTK_OBJECT (item));
+	g_object_unref (G_OBJECT (item));
 }
 
 /**
@@ -1082,6 +1087,9 @@ eel_canvas_item_get_bounds (EelCanvasItem *item, double *x1, double *y1, double
 void
 eel_canvas_item_request_update (EelCanvasItem *item)
 {
+	if (NULL == item->canvas)
+		return;
+
 	g_return_if_fail (!item->canvas->doing_update);
 
 	if (item->object.flags & EEL_CANVAS_ITEM_NEED_UPDATE)
@@ -1126,7 +1134,7 @@ enum {
 };
 
 
-static void eel_canvas_group_class_init  (EelCanvasGroupClass *class);
+static void eel_canvas_group_class_init  (EelCanvasGroupClass *klass);
 static void eel_canvas_group_init        (EelCanvasGroup      *group);
 static void eel_canvas_group_set_property(GObject               *object, 
 					    guint                  param_id,
@@ -1158,6 +1166,7 @@ static void   eel_canvas_group_bounds      (EelCanvasItem *item, double *x1, dou
 
 static EelCanvasItemClass *group_parent_class;
 
+
 /**
  * eel_canvas_group_get_type:
  *
@@ -1172,7 +1181,7 @@ eel_canvas_group_get_type (void)
 	static GType group_type = 0;
 
 	if (!group_type) {
-		const GTypeInfo group_info = {
+		static const GTypeInfo group_info = {
 			sizeof (EelCanvasGroupClass),
 			(GBaseInitFunc) NULL,
 			(GBaseFinalizeFunc) NULL,
@@ -1197,17 +1206,17 @@ eel_canvas_group_get_type (void)
 
 /* Class initialization function for EelCanvasGroupClass */
 static void
-eel_canvas_group_class_init (EelCanvasGroupClass *class)
+eel_canvas_group_class_init (EelCanvasGroupClass *klass)
 {
 	GObjectClass *gobject_class;
 	GtkObjectClass *object_class;
 	EelCanvasItemClass *item_class;
 
-	gobject_class = (GObjectClass *) class;
-	object_class = (GtkObjectClass *) class;
-	item_class = (EelCanvasItemClass *) class;
+	gobject_class = (GObjectClass *) klass;
+	object_class = (GtkObjectClass *) klass;
+	item_class = (EelCanvasItemClass *) klass;
 
-	group_parent_class = g_type_class_peek (EEL_TYPE_CANVAS_ITEM);
+	group_parent_class = g_type_class_peek_parent (klass);
 
 	gobject_class->set_property = eel_canvas_group_set_property;
 	gobject_class->get_property = eel_canvas_group_get_property;
@@ -1218,14 +1227,14 @@ eel_canvas_group_class_init (EelCanvasGroupClass *class)
 				      _("X"),
 				      _("X"),
 				      -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
-				      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				      G_PARAM_READWRITE));
 	g_object_class_install_property
 		(gobject_class, GROUP_PROP_Y,
 		 g_param_spec_double ("y",
 				      _("Y"),
 				      _("Y"),
 				      -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
-				      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				      G_PARAM_READWRITE));
 
 	object_class->destroy = eel_canvas_group_destroy;
 
@@ -1257,7 +1266,7 @@ eel_canvas_group_set_property (GObject *gobject, guint param_id,
 	double old;
 	gboolean moved;
 
-	g_assert (EEL_IS_CANVAS_GROUP (gobject));
+	g_return_if_fail (EEL_IS_CANVAS_GROUP (gobject));
 
 	item = EEL_CANVAS_ITEM (gobject);
 	group = EEL_CANVAS_GROUP (gobject);
@@ -1297,10 +1306,12 @@ static void
 eel_canvas_group_get_property (GObject *gobject, guint param_id,
 				 GValue *value, GParamSpec *pspec)
 {
+	EelCanvasItem *item;
 	EelCanvasGroup *group;
 
-	g_assert (EEL_IS_CANVAS_GROUP (gobject));
+	g_return_if_fail (EEL_IS_CANVAS_GROUP (gobject));
 
+	item = EEL_CANVAS_ITEM (gobject);
 	group = EEL_CANVAS_GROUP (gobject);
 
 	switch (param_id) {
@@ -1326,7 +1337,7 @@ eel_canvas_group_destroy (GtkObject *object)
 	EelCanvasItem *child;
 	GList *list;
 
-	g_assert (EEL_IS_CANVAS_GROUP (object));
+	g_return_if_fail (EEL_IS_CANVAS_GROUP (object));
 
 	group = EEL_CANVAS_GROUP (object);
 
@@ -1538,7 +1549,7 @@ eel_canvas_group_point (EelCanvasItem *item, double x, double y, int cx, int cy,
 	return best;
 }
 
-static void
+void
 eel_canvas_group_translate (EelCanvasItem *item, double dx, double dy)
 {
         EelCanvasGroup *group;
@@ -1629,7 +1640,12 @@ eel_canvas_group_bounds (EelCanvasItem *item, double *x1, double *y1, double *x2
 static void
 group_add (EelCanvasGroup *group, EelCanvasItem *item)
 {
+#if GLIB_CHECK_VERSION(2,10,0) && GTK_CHECK_VERSION(2,8,14)
+	g_object_ref_sink (item);
+#else
 	g_object_ref (item);
+	gtk_object_sink (GTK_OBJECT (item));
+#endif
 
 	if (!group->item_list) {
 		group->item_list = g_list_append (group->item_list, item);
@@ -1653,8 +1669,8 @@ group_remove (EelCanvasGroup *group, EelCanvasItem *item)
 {
 	GList *children;
 
-	g_assert (EEL_IS_CANVAS_GROUP (group));
-	g_assert (EEL_IS_CANVAS_ITEM (item));
+	g_return_if_fail (EEL_IS_CANVAS_GROUP (group));
+	g_return_if_fail (EEL_IS_CANVAS_ITEM (item));
 
 	for (children = group->item_list; children; children = children->next)
 		if (children->data == item) {
@@ -1667,7 +1683,8 @@ group_remove (EelCanvasGroup *group, EelCanvasItem *item)
 			/* Unparent the child */
 
 			item->parent = NULL;
-			g_object_unref (GTK_OBJECT (item));
+			/* item->canvas = NULL; */
+			g_object_unref (G_OBJECT (item));
 
 			/* Remove it from the list */
 
@@ -1689,7 +1706,7 @@ enum {
 	LAST_SIGNAL
 };
 
-static void eel_canvas_class_init          (EelCanvasClass *class);
+static void eel_canvas_class_init          (EelCanvasClass *klass);
 static void eel_canvas_init                (EelCanvas      *canvas);
 static void eel_canvas_destroy             (GtkObject        *object);
 static void eel_canvas_map                 (GtkWidget        *widget);
@@ -1738,7 +1755,7 @@ eel_canvas_get_type (void)
 	static GType canvas_type = 0;
 
 	if (!canvas_type) {
-		const GTypeInfo canvas_info = {
+		static const GTypeInfo canvas_info = {
 			sizeof (EelCanvasClass),
 			(GBaseInitFunc) NULL,
 			(GBaseFinalizeFunc) NULL,
@@ -1834,11 +1851,11 @@ eel_canvas_accessible_get_n_children (AtkObject* obj)
 		return 0;
 	}
 
-	g_assert (EEL_IS_CANVAS (widget));
+	g_return_val_if_fail (EEL_IS_CANVAS (widget), 0);
 
 	canvas = EEL_CANVAS (widget);
 	root_group = eel_canvas_root (canvas);
-	g_assert (root_group != NULL);
+	g_return_val_if_fail (root_group, 0);
 	return 1;
 }
 
@@ -1866,7 +1883,7 @@ eel_canvas_accessible_ref_child (AtkObject *obj,
 
 	canvas = EEL_CANVAS (widget);
 	root_group = eel_canvas_root (canvas);
-	g_assert (root_group != NULL);
+	g_return_val_if_fail (root_group, NULL);
 	atk_object = atk_gobject_accessible_for_object (G_OBJECT (root_group));
 	g_object_ref (atk_object);
 	
@@ -1924,7 +1941,7 @@ eel_canvas_accessible_create (GObject *for_object)
 	EelCanvas *canvas;
 
 	canvas = EEL_CANVAS (for_object);
-	g_assert (canvas != NULL);
+	g_return_val_if_fail (canvas != NULL, NULL);
 
 	type = eel_canvas_accessible_get_type ();
 
@@ -1948,7 +1965,7 @@ eel_canvas_accessible_factory_create_accessible (GObject *obj)
 {
 	AtkObject *accessible;
 
-	g_assert (G_IS_OBJECT (obj));
+	g_return_val_if_fail (G_IS_OBJECT (obj), NULL);
 
 	accessible = eel_canvas_accessible_create (obj);
 
@@ -1968,7 +1985,7 @@ eel_canvas_accessible_factory_get_type (void)
 	static GType type = 0;
 
 	if (!type) {
-		const GTypeInfo tinfo = {
+		static const GTypeInfo tinfo = {
 			sizeof (AtkObjectFactoryClass),
 			(GBaseInitFunc) NULL,
 			(GBaseFinalizeFunc) NULL,
@@ -2000,7 +2017,7 @@ eel_canvas_class_init (EelCanvasClass *klass)
 	object_class  = (GtkObjectClass *) klass;
 	widget_class  = (GtkWidgetClass *) klass;
 
-	canvas_parent_class = g_type_class_peek (GTK_TYPE_LAYOUT);
+	canvas_parent_class = g_type_class_peek_parent (klass);
 
 	gobject_class->set_property = eel_canvas_set_property;
 	gobject_class->get_property = eel_canvas_get_property;
@@ -2077,11 +2094,15 @@ eel_canvas_init (EelCanvas *canvas)
 	canvas->root = EEL_CANVAS_ITEM (g_object_new (eel_canvas_group_get_type (), NULL));
 	canvas->root->canvas = canvas;
 
+#if GLIB_CHECK_VERSION(2,10,0) && GTK_CHECK_VERSION(2,8,14)
+	g_object_ref_sink (canvas->root);
+#else
 	g_object_ref (canvas->root);
+	gtk_object_sink (GTK_OBJECT (canvas->root));
+#endif
 
-	canvas->root_destroy_id = g_signal_connect (canvas->root, "destroy",
-						    G_CALLBACK (panic_root_destroyed),
-						    canvas);
+	canvas->root_destroy_id = g_signal_connect (G_OBJECT (canvas->root),
+		"destroy", G_CALLBACK (panic_root_destroyed), canvas);
 
 	canvas->need_repick = TRUE;
 	canvas->doing_update = FALSE;
@@ -2126,19 +2147,21 @@ eel_canvas_destroy (GtkObject *object)
 {
 	EelCanvas *canvas;
 
-	g_assert (EEL_IS_CANVAS (object));
+	g_return_if_fail (EEL_IS_CANVAS (object));
 
 	/* remember, destroy can be run multiple times! */
 
 	canvas = EEL_CANVAS (object);
 
 	if (canvas->root_destroy_id) {
-		g_signal_handler_disconnect (GTK_OBJECT (canvas->root), canvas->root_destroy_id);
+		g_signal_handler_disconnect (G_OBJECT (canvas->root), canvas->root_destroy_id);
 		canvas->root_destroy_id = 0;
 	}
 	if (canvas->root) {
-		g_object_unref (GTK_OBJECT (canvas->root));
+		EelCanvasItem *root = canvas->root;
 		canvas->root = NULL;
+		gtk_object_destroy (GTK_OBJECT (root));
+		g_object_unref (root);
 	}
 
 	shutdown_transients (canvas);
@@ -2170,7 +2193,7 @@ eel_canvas_map (GtkWidget *widget)
 {
 	EelCanvas *canvas;
 
-	g_assert (EEL_IS_CANVAS (widget));
+	g_return_if_fail (EEL_IS_CANVAS (widget));
 
 	/* Normal widget mapping stuff */
 
@@ -2193,7 +2216,7 @@ eel_canvas_unmap (GtkWidget *widget)
 {
 	EelCanvas *canvas;
 
-	g_assert (EEL_IS_CANVAS (widget));
+	g_return_if_fail (EEL_IS_CANVAS (widget));
 
 	canvas = EEL_CANVAS (widget);
 
@@ -2216,7 +2239,7 @@ eel_canvas_realize (GtkWidget *widget)
 {
 	EelCanvas *canvas;
 
-	g_assert (EEL_IS_CANVAS (widget));
+	g_return_if_fail (EEL_IS_CANVAS (widget));
 
 	/* Normal widget realization stuff */
 
@@ -2250,7 +2273,7 @@ eel_canvas_unrealize (GtkWidget *widget)
 {
 	EelCanvas *canvas;
 
-	g_assert (EEL_IS_CANVAS (widget));
+	g_return_if_fail (EEL_IS_CANVAS (widget));
 
 	canvas = EEL_CANVAS (widget);
 
@@ -2352,9 +2375,9 @@ scroll_to (EelCanvas *canvas, int cx, int cy)
 	
 	/* Signal GtkLayout that it should do a redraw. */
 	if (changed_x)
-		g_signal_emit_by_name (GTK_OBJECT (canvas->layout.hadjustment), "value_changed");
+		g_signal_emit_by_name (G_OBJECT (canvas->layout.hadjustment), "value_changed");
 	if (changed_y)
-		g_signal_emit_by_name (GTK_OBJECT (canvas->layout.vadjustment), "value_changed");
+		g_signal_emit_by_name (G_OBJECT (canvas->layout.vadjustment), "value_changed");
 }
 
 /* Size allocation handler for the canvas */
@@ -2363,8 +2386,8 @@ eel_canvas_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
 {
 	EelCanvas *canvas;
 
-	g_assert (EEL_IS_CANVAS (widget));
-	g_assert (allocation != NULL);
+	g_return_if_fail (EEL_IS_CANVAS (widget));
+	g_return_if_fail (allocation != NULL);
 
 	if (GTK_WIDGET_CLASS (canvas_parent_class)->size_allocate)
 		(* GTK_WIDGET_CLASS (canvas_parent_class)->size_allocate) (widget, allocation);
@@ -2383,8 +2406,8 @@ eel_canvas_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
 		   canvas->layout.hadjustment->value,
 		   canvas->layout.vadjustment->value);
 
-	g_signal_emit_by_name (GTK_OBJECT (canvas->layout.hadjustment), "changed");
-	g_signal_emit_by_name (GTK_OBJECT (canvas->layout.vadjustment), "changed");
+	g_signal_emit_by_name (G_OBJECT (canvas->layout.hadjustment), "changed");
+	g_signal_emit_by_name (G_OBJECT (canvas->layout.vadjustment), "changed");
 }
 
 /* Emits an event for an item in the canvas, be it the current item, grabbed
@@ -2513,7 +2536,7 @@ emit_event (EelCanvas *canvas, GdkEvent *event)
 		g_object_ref (GTK_OBJECT (item));
 
 		g_signal_emit (
-		       GTK_OBJECT (item), item_signals[ITEM_EVENT], 0,
+		       G_OBJECT (item), item_signals[ITEM_EVENT], 0,
 			&ev, &finished);
 		
 		parent = item->parent;
@@ -2627,6 +2650,9 @@ pick_current_item (EelCanvas *canvas, GdkEvent *event)
 	    && (canvas->current_item != NULL)
 	    && !canvas->left_grabbed_item) {
 		GdkEvent new_event;
+		EelCanvasItem *item;
+
+		item = canvas->current_item;
 
 		new_event = canvas->pick_event;
 		new_event.type = GDK_LEAVE_NOTIFY;
@@ -2671,8 +2697,8 @@ eel_canvas_button (GtkWidget *widget, GdkEventButton *event)
 	int mask;
 	int retval;
 
-	g_assert (EEL_IS_CANVAS (widget));
-	g_assert (event != NULL);
+	g_return_val_if_fail (EEL_IS_CANVAS (widget), FALSE);
+	g_return_val_if_fail (event != NULL, FALSE);
 
 	retval = FALSE;
 
@@ -2743,8 +2769,8 @@ eel_canvas_motion (GtkWidget *widget, GdkEventMotion *event)
 {
 	EelCanvas *canvas;
 
-	g_assert (EEL_IS_CANVAS (widget));
-	g_assert (event != NULL);
+	g_return_val_if_fail (EEL_IS_CANVAS (widget), FALSE);
+	g_return_val_if_fail (event != NULL, FALSE);
 
 	canvas = EEL_CANVAS (widget);
 
@@ -2762,8 +2788,8 @@ eel_canvas_key (GtkWidget *widget, GdkEventKey *event)
 {
 	EelCanvas *canvas;
 	
-	g_assert (EEL_IS_CANVAS (widget));
-	g_assert (event != NULL);
+	g_return_val_if_fail (EEL_IS_CANVAS (widget), FALSE);
+	g_return_val_if_fail (event != NULL, FALSE);
 
 	canvas = EEL_CANVAS (widget);
 	
@@ -2782,8 +2808,8 @@ eel_canvas_crossing (GtkWidget *widget, GdkEventCrossing *event)
 {
 	EelCanvas *canvas;
 
-	g_assert (EEL_IS_CANVAS (widget));
-	g_assert (event != NULL);
+	g_return_val_if_fail (EEL_IS_CANVAS (widget), FALSE);
+	g_return_val_if_fail (event != NULL, FALSE);
 
 	canvas = EEL_CANVAS (widget);
 
@@ -2845,12 +2871,12 @@ eel_canvas_expose (GtkWidget *widget, GdkEventExpose *event)
 		canvas->idle_id = 0;
 	}
 	if (canvas->need_update) {
-		g_assert (!canvas->doing_update);
+		g_return_val_if_fail (!canvas->doing_update, FALSE);
 
 		canvas->doing_update = TRUE;
 		eel_canvas_item_invoke_update (canvas->root, 0, 0, 0);
 
-		g_assert (canvas->doing_update);
+		g_return_val_if_fail (canvas->doing_update, FALSE);
 
 		canvas->doing_update = FALSE;
 
@@ -2899,12 +2925,12 @@ do_update (EelCanvas *canvas)
 
 update_again:
 	if (canvas->need_update) {
-		g_assert (!canvas->doing_update);
+		g_return_if_fail (!canvas->doing_update);
 
 		canvas->doing_update = TRUE;
 		eel_canvas_item_invoke_update (canvas->root, 0, 0, 0);
 
-		g_assert (canvas->doing_update);
+		g_return_if_fail (canvas->doing_update);
 
 		canvas->doing_update = FALSE;
 
@@ -3352,7 +3378,7 @@ eel_canvas_w2c_rect_d (EelCanvas *canvas,
  * @cy: Y pixel coordinate (return value).
  *
  * Converts world coordinates into canvas pixel coordinates.  This version
- * returns coordinates in floating point coordinates, for greater precision.
+ * produces coordinates in floating point coordinates, for greater precision.
  **/
 void
 eel_canvas_w2c_d (EelCanvas *canvas, double wx, double wy, double *cx, double *cy)
@@ -3591,10 +3617,10 @@ eel_canvas_item_accessible_get_item_extents (EelCanvasItem *item,
 	eel_canvas_item_get_bounds (item, &bx1, &by1, &bx2, &by2);
 	eel_canvas_w2c_rect_d (item->canvas, &bx1, &by1, &bx2, &by2);
 	eel_canvas_get_scroll_offsets (item->canvas, &scroll_x, &scroll_y);
-	x1 = floor (bx1);
-	y1 = floor (by1);
-	x2 = ceil (bx2);
-	y2 = ceil (by2);
+	x1 = floor (bx1 + .5);
+	y1 = floor (by1 + .5);
+	x2 = floor (bx2 + .5);
+	y2 = floor (by2 + .5);
 	rect->x = x1 - scroll_x;
 	rect->y = y1 - scroll_y;
 	rect->width = x2 - x1;
@@ -3661,7 +3687,7 @@ eel_canvas_item_accessible_get_extents (AtkComponent *component,
 	item = EEL_CANVAS_ITEM (obj);
 
 	/* If this item has no parent canvas, something's broken */
-	g_assert (GTK_IS_WIDGET (item->canvas));
+	g_return_if_fail (GTK_IS_WIDGET (item->canvas));
 
 	eel_canvas_item_accessible_get_item_extents (item, &rect);
 	*width = rect.width;
@@ -3704,7 +3730,7 @@ eel_canvas_item_accessible_get_mdi_zorder (AtkComponent *component)
 	if (item->parent) {
        		return g_list_index (EEL_CANVAS_GROUP (item->parent)->item_list, item);
 	} else {
-		g_assert (item->canvas->root == item);
+		g_return_val_if_fail (item->canvas->root == item, -1);
 		return 0;
 	}
 }
@@ -3745,7 +3771,7 @@ eel_canvas_item_accessible_remove_focus_handler (AtkComponent *component,
 static void
 eel_canvas_item_accessible_component_interface_init (AtkComponentIface *iface)
 {
-	g_assert (iface != NULL);
+	g_return_if_fail (iface != NULL);
 
 	iface->add_focus_handler = eel_canvas_item_accessible_add_focus_handler;
 	iface->get_extents = eel_canvas_item_accessible_get_extents;
@@ -3822,7 +3848,7 @@ eel_canvas_item_accessible_get_type (void)
 	static GType type = 0;
 
 	if (!type) {
-		const GInterfaceInfo atk_component_info = {
+		static const GInterfaceInfo atk_component_info = {
 			(GInterfaceInitFunc) eel_canvas_item_accessible_component_interface_init,
                  	(GInterfaceFinalizeFunc) NULL,
 			NULL
@@ -3865,7 +3891,7 @@ eel_canvas_item_accessible_create (GObject *for_object)
 	EelCanvasItem *item;
 
 	item = EEL_CANVAS_ITEM (for_object);
-	g_assert (item != NULL);
+	g_return_val_if_fail (item != NULL, NULL);
 
 	type = eel_canvas_item_accessible_get_type ();
 	if (type == G_TYPE_INVALID) {
@@ -3888,7 +3914,7 @@ eel_canvas_item_accessible_factory_create_accessible (GObject *obj)
 {
 	AtkObject *accessible;
 
-	g_assert (G_IS_OBJECT (obj));
+	g_return_val_if_fail (G_IS_OBJECT (obj), NULL);
 
 	accessible = eel_canvas_item_accessible_create (obj);
 
@@ -3908,7 +3934,7 @@ eel_canvas_item_accessible_factory_get_type (void)
 	static GType type = 0;
 
 	if (!type) {
-		const GTypeInfo tinfo = {
+		static const GTypeInfo tinfo = {
 			sizeof (AtkObjectFactoryClass),
 			(GBaseInitFunc) NULL,
 			(GBaseFinalizeFunc) NULL,
@@ -3929,32 +3955,31 @@ eel_canvas_item_accessible_factory_get_type (void)
 
 /* Class initialization function for EelCanvasItemClass */
 static void
-eel_canvas_item_class_init (EelCanvasItemClass *class)
+eel_canvas_item_class_init (EelCanvasItemClass *klass)
 {
-	GObjectClass *gobject_class;
+	GObjectClass *gobject_class = (GObjectClass *) klass;
 
-	gobject_class = (GObjectClass *) class;
-
-	item_parent_class = g_type_class_peek (GTK_TYPE_OBJECT);
+	item_parent_class = g_type_class_peek_parent (klass);
 
 	gobject_class->set_property = eel_canvas_item_set_property;
 	gobject_class->get_property = eel_canvas_item_get_property;
+	gobject_class->dispose = eel_canvas_item_dispose;
 
 	g_object_class_install_property
 		(gobject_class, ITEM_PROP_PARENT,
 		 g_param_spec_object ("parent", NULL, NULL,
 				      EEL_TYPE_CANVAS_ITEM,
-				      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				      G_PARAM_READWRITE));
 	
 	g_object_class_install_property
 		(gobject_class, ITEM_PROP_VISIBLE,
 		 g_param_spec_boolean ("visible", NULL, NULL,
 				      TRUE,
-				      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+				      G_PARAM_READWRITE));
 
 	item_signals[ITEM_EVENT] =
 		g_signal_new ("event",
-			      G_TYPE_FROM_CLASS (class),
+			      G_TYPE_FROM_CLASS (klass),
 			      G_SIGNAL_RUN_LAST,
 			      G_STRUCT_OFFSET (EelCanvasItemClass, event),
 			      boolean_handled_accumulator, NULL,
@@ -3962,13 +3987,11 @@ eel_canvas_item_class_init (EelCanvasItemClass *class)
 			      G_TYPE_BOOLEAN, 1,
 			      GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
 
-	gobject_class->dispose = eel_canvas_item_dispose;
-
-	class->realize = eel_canvas_item_realize;
-	class->unrealize = eel_canvas_item_unrealize;
-	class->map = eel_canvas_item_map;
-	class->unmap = eel_canvas_item_unmap;
-	class->update = eel_canvas_item_update;
+	klass->realize = eel_canvas_item_realize;
+	klass->unrealize = eel_canvas_item_unrealize;
+	klass->map = eel_canvas_item_map;
+	klass->unmap = eel_canvas_item_unmap;
+	klass->update = eel_canvas_item_update;
 
 	atk_registry_set_factory_type (atk_get_default_registry (),
                                        EEL_TYPE_CANVAS_ITEM,
diff --git a/eel/eel-canvas.h b/eel/eel-canvas.h
index b2efdd3..ff1ab17 100644
--- a/eel/eel-canvas.h
+++ b/eel/eel-canvas.h
@@ -37,8 +37,8 @@
 #ifndef EEL_CANVAS_H
 #define EEL_CANVAS_H
 
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
+#include <gtk/gtklayout.h>
+#include <gdk/gdkevents.h>
 #include <stdarg.h>
 
 G_BEGIN_DECLS
@@ -101,17 +101,13 @@ enum {
 	EEL_CANVAS_UPDATE_DEEP       = 1 << 1
 };
 
-#define EEL_TYPE_CANVAS_ITEM eel_canvas_item_get_type()
-#define EEL_CANVAS_ITEM(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEL_TYPE_CANVAS_ITEM, EelCanvasItem))
-#define EEL_CANVAS_ITEM_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), EEL_TYPE_CANVAS_ITEM, EelCanvasItemClass))
-#define EEL_IS_CANVAS_ITEM(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEL_TYPE_CANVAS_ITEM))
-#define EEL_IS_CANVAS_ITEM_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), EEL_TYPE_CANVAS_ITEM))
-#define EEL_CANVAS_ITEM_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), EEL_TYPE_CANVAS_ITEM, EelCanvasItemClass))
+#define EEL_TYPE_CANVAS_ITEM            (eel_canvas_item_get_type ())
+#define EEL_CANVAS_ITEM(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEL_TYPE_CANVAS_ITEM, EelCanvasItem))
+#define EEL_CANVAS_ITEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EEL_TYPE_CANVAS_ITEM, EelCanvasItemClass))
+#define EEL_IS_CANVAS_ITEM(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEL_TYPE_CANVAS_ITEM))
+#define EEL_IS_CANVAS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEL_TYPE_CANVAS_ITEM))
+#define EEL_CANVAS_ITEM_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EEL_TYPE_CANVAS_ITEM, EelCanvasItemClass))
+
 
 struct _EelCanvasItem {
 	GtkObject object;
@@ -308,17 +304,13 @@ void eel_canvas_item_request_redraw (EelCanvasItem *item);
  */
 
 
-#define EEL_TYPE_CANVAS_GROUP eel_canvas_group_get_type()
-#define EEL_CANVAS_GROUP(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEL_TYPE_CANVAS_GROUP, EelCanvasGroup))
-#define EEL_CANVAS_GROUP_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), EEL_TYPE_CANVAS_GROUP, EelCanvasGroupClass))
-#define EEL_IS_CANVAS_GROUP(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEL_TYPE_CANVAS_GROUP))
-#define EEL_IS_CANVAS_GROUP_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), EEL_TYPE_CANVAS_GROUP))
-#define EEL_CANVAS_GROUP_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), EEL_TYPE_CANVAS_GROUP, EelCanvasGroupClass))
+#define EEL_TYPE_CANVAS_GROUP            (eel_canvas_group_get_type ())
+#define EEL_CANVAS_GROUP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEL_TYPE_CANVAS_GROUP, EelCanvasGroup))
+#define EEL_CANVAS_GROUP_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EEL_TYPE_CANVAS_GROUP, EelCanvasGroupClass))
+#define EEL_IS_CANVAS_GROUP(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEL_TYPE_CANVAS_GROUP))
+#define EEL_IS_CANVAS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEL_TYPE_CANVAS_GROUP))
+#define EEL_CANVAS_GROUP_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EEL_TYPE_CANVAS_GROUP, EelCanvasGroupClass))
+
 
 struct _EelCanvasGroup {
 	EelCanvasItem item;
@@ -341,17 +333,14 @@ GType eel_canvas_group_get_type (void) G_GNUC_CONST;
 
 /*** EelCanvas ***/
 
-#define EEL_TYPE_CANVAS eel_canvas_get_type()
-#define EEL_CANVAS(obj) \
-  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEL_TYPE_CANVAS, EelCanvas))
-#define EEL_CANVAS_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), EEL_TYPE_CANVAS, EelCanvasClass))
-#define EEL_IS_CANVAS(obj) \
-  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEL_TYPE_CANVAS))
-#define EEL_IS_CANVAS_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), EEL_TYPE_CANVAS))
-#define EEL_CANVAS_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), EEL_TYPE_CANVAS, EelCanvasClass))
+
+#define EEL_TYPE_CANVAS            (eel_canvas_get_type ())
+#define EEL_CANVAS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEL_TYPE_CANVAS, EelCanvas))
+#define EEL_CANVAS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EEL_TYPE_CANVAS, EelCanvasClass))
+#define EEL_IS_CANVAS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEL_TYPE_CANVAS))
+#define EEL_IS_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEL_TYPE_CANVAS))
+#define EEL_CANVAS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), EEL_TYPE_CANVAS, EelCanvasClass))
+
 
 struct _EelCanvas {
 	GtkLayout layout;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]