diff options
author | Milan Crha <mcrha@redhat.com> | 2010-10-07 01:26:08 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-10-07 01:26:08 +0800 |
commit | 1c6f2d154e74f908e2c4a137de0233b5faf4f6b6 (patch) | |
tree | 77a33236e48ed59a7c7c65e8a1c91481dd09f3eb /libgnomecanvas/gnome-canvas-widget.c | |
parent | 1b2fefb086c3e34089beb8b89b22d79005cc7725 (diff) | |
download | gsoc2013-evolution-1c6f2d154e74f908e2c4a137de0233b5faf4f6b6.tar.gz gsoc2013-evolution-1c6f2d154e74f908e2c4a137de0233b5faf4f6b6.tar.zst gsoc2013-evolution-1c6f2d154e74f908e2c4a137de0233b5faf4f6b6.zip |
Bug #631320 - GtkObject is gone in GTK3
Diffstat (limited to 'libgnomecanvas/gnome-canvas-widget.c')
-rw-r--r-- | libgnomecanvas/gnome-canvas-widget.c | 46 |
1 files changed, 21 insertions, 25 deletions
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); |