[cairo-commit] goocanvas/src goocanvas.c,1.7,1.8

Damon Chaplin commit at pdx.freedesktop.org
Sat Feb 24 03:16:42 PST 2007


Committed by: damon

Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv11941/src

Modified Files:
	goocanvas.c 
Log Message:
2007-02-24  Damon Chaplin  <damon at gnome.org>

	* demo/widgets-demo.c (on_delete_event): 
	* demo/units-demo.c (on_delete_event): 
	* demo/mv-scalability-demo.c (on_delete_event): 
	* demo/scalability-demo.c (on_delete_event): 
	* demo/mv-demo.c (on_delete_event): 
	* demo/demo.c (on_delete_event): use gtk_main_quit() rather than exit()
	here, so GTK+ destroys the window and the finalization code gets
	tested.

	* src/goocanvas.c (goo_canvas_remove): implement this so embedded
	widgets are removed properly.



Index: goocanvas.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvas.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- goocanvas.c	20 Feb 2007 14:22:03 -0000	1.7
+++ goocanvas.c	24 Feb 2007 11:16:36 -0000	1.8
@@ -173,6 +173,8 @@
 					    guint             prop_id,
 					    const GValue     *value,
 					    GParamSpec       *pspec);
+static void     goo_canvas_remove          (GtkContainer     *container,
+					    GtkWidget        *widget);
 static void     goo_canvas_forall          (GtkContainer     *container,
 					    gboolean          include_internals,
 					    GtkCallback       callback,
@@ -222,6 +224,7 @@
   widget_class->focus_out_event      = goo_canvas_focus_out;
   widget_class->grab_broken_event    = goo_canvas_grab_broken;
 
+  container_class->remove	     = goo_canvas_remove;
   container_class->forall            = goo_canvas_forall;
 
   klass->set_scroll_adjustments      = goo_canvas_set_adjustments;
@@ -3269,3 +3272,36 @@
 	(* callback) (witem->widget, callback_data);
     }
 }
+
+
+static void
+goo_canvas_remove (GtkContainer *container, 
+		   GtkWidget    *widget)
+{
+  GooCanvas *canvas;
+  GList *tmp_list;
+  GooCanvasWidget *witem;
+  GooCanvasItem *parent;
+  gint child_num;
+  
+  g_return_if_fail (GOO_IS_CANVAS (container));
+  
+  canvas = GOO_CANVAS (container);
+
+  tmp_list = canvas->widget_items;
+  while (tmp_list)
+    {
+      witem = tmp_list->data;
+      tmp_list = tmp_list->next;
+
+      if (witem->widget == widget)
+	{
+	  parent = goo_canvas_item_get_parent ((GooCanvasItem*) witem);
+	  child_num = goo_canvas_item_find_child (parent,
+						  (GooCanvasItem*) witem);
+	  goo_canvas_item_remove_child (parent, child_num);
+
+	  break;
+	}
+    }
+}



More information about the cairo-commit mailing list