[cairo-commit] goocanvas/demo demo-features.c, 1.2, 1.3 demo.c, 1.22, 1.23 mv-demo-features.c, 1.1, 1.2 mv-demo.c, 1.7, 1.8 widgets-demo.c, 1.2, 1.3

Damon Chaplin commit at pdx.freedesktop.org
Thu Mar 8 05:58:51 PST 2007


Committed by: damon

Update of /cvs/cairo/goocanvas/demo
In directory kemper:/tmp/cvs-serv9315/demo

Modified Files:
	demo-features.c demo.c mv-demo-features.c mv-demo.c 
	widgets-demo.c 
Log Message:
2007-03-08  Damon Chaplin  <damon at gnome.org>

	* src/goocanvasitemmodel.c (goo_canvas_item_model_remove): 
	* src/goocanvasitem.c (goo_canvas_item_remove): new convenience
	functions to easily remove items & models from the canvas.

	* demo/mv-demo-features.c (on_button_press): 
	* demo/demo-features.c (on_button_press): 
	* demo/demo.c (on_button_press): 
	* demo/mv-demo.c (on_button_press): 
	* demo/widgets-demo.c (remove_widget_clicked): use new remove()
	functions to test them.

	* docs/goocanvas-sections.txt: rearranged GooCanvasItem/Model to put
	commonly-used functions first, and added remove() functions.



Index: demo-features.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/demo-features.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- demo-features.c	29 Nov 2006 18:47:02 -0000	1.2
+++ demo-features.c	8 Mar 2007 13:58:45 -0000	1.3
@@ -17,7 +17,6 @@
 		 gpointer data)
 {
   GooCanvasItem *parent1, *parent2, *parent;
-  int child_num;
 
   if (event->button != 1 || event->type != GDK_BUTTON_PRESS)
     return FALSE;
@@ -29,8 +28,7 @@
 
   parent = goo_canvas_item_get_parent (item);
   g_object_ref (item);
-  child_num = goo_canvas_item_find_child (parent, item);
-  goo_canvas_item_remove_child (parent, child_num);
+  goo_canvas_item_remove (item);
   if (parent == parent1)
     goo_canvas_item_add_child (parent2, item, -1);
   else

Index: demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/demo.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- demo.c	8 Mar 2007 12:31:59 -0000	1.22
+++ demo.c	8 Mar 2007 13:58:45 -0000	1.23
@@ -295,12 +295,7 @@
     case 1:
       if (event->state & GDK_SHIFT_MASK)
 	{
-	  GooCanvasItem *parent;
-	  gint child_num;
-
-	  parent = goo_canvas_item_get_parent (item);
-	  child_num = goo_canvas_item_find_child (parent, item);
-	  goo_canvas_item_remove_child (parent, child_num);
+	  goo_canvas_item_remove (item);
 	}
       else
 	{

Index: mv-demo-features.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/mv-demo-features.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- mv-demo-features.c	29 Nov 2006 18:27:06 -0000	1.1
+++ mv-demo-features.c	8 Mar 2007 13:58:45 -0000	1.2
@@ -12,7 +12,6 @@
 {
   GooCanvasItemModel *model = goo_canvas_item_get_model (item);
   GooCanvasItemModel *parent1, *parent2, *parent;
-  int child_num;
 
   if (event->button != 1 || event->type != GDK_BUTTON_PRESS)
     return FALSE;
@@ -22,8 +21,7 @@
 
   parent = goo_canvas_item_model_get_parent (model);
   g_object_ref (model);
-  child_num = goo_canvas_item_model_find_child (parent, model);
-  goo_canvas_item_model_remove_child (parent, child_num);
+  goo_canvas_item_model_remove (model);
   if (parent == parent1)
     goo_canvas_item_model_add_child (parent2, model, -1);
   else

Index: mv-demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/mv-demo.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- mv-demo.c	8 Mar 2007 12:31:59 -0000	1.7
+++ mv-demo.c	8 Mar 2007 13:58:45 -0000	1.8
@@ -255,12 +255,7 @@
     case 1:
       if (event->state & GDK_SHIFT_MASK)
 	{
-	  GooCanvasItemModel *parent;
-	  gint child_num;
-
-	  parent = goo_canvas_item_model_get_parent (model);
-	  child_num = goo_canvas_item_model_find_child (parent, model);
-	  goo_canvas_item_model_remove_child (parent, child_num);
+	  goo_canvas_item_model_remove (model);
 	}
       else
 	{

Index: widgets-demo.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/widgets-demo.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- widgets-demo.c	24 Feb 2007 11:16:36 -0000	1.2
+++ widgets-demo.c	8 Mar 2007 13:58:45 -0000	1.3
@@ -32,17 +32,15 @@
 static void
 remove_widget_clicked (GtkWidget *button, gpointer data)
 {
-  GooCanvasItem *root, *witem;
+  GooCanvasItem *witem;
   GList *elem;
 
   if (!added_widget_items)
     return;
 
   witem = added_widget_items->data;
-  root = goo_canvas_get_root_item (GOO_CANVAS (canvas));
 
-  goo_canvas_item_remove_child (root,
-				goo_canvas_item_find_child (root, witem));
+  goo_canvas_item_remove (witem);
 
   elem = added_widget_items;
   added_widget_items = added_widget_items->next;



More information about the cairo-commit mailing list