[cairo-commit] goocanvas/demo demo-table.c, 1.3, 1.4 mv-demo-table.c, 1.3, 1.4

Damon Chaplin commit at pdx.freedesktop.org
Sun Nov 18 05:57:42 PST 2007


Committed by: damon

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

Modified Files:
	demo-table.c mv-demo-table.c 
Log Message:
2007-11-18  Damon Chaplin  <damon at gnome.org>

	* src/goocanvasitem.c (goo_canvas_item_get_child_property) 
	(goo_canvas_item_set_child_property): 
	* src/goocanvasitemmodel.c (goo_canvas_item_model_get_child_property) 
	(goo_canvas_item_model_set_child_property): new functions to get/set
	individual child properties (to help language bindings).

	* demo/demo-table.c (create_demo_item): 
	* demo/mv-demo-table.c (create_demo_item): test the above.

	* src/goocanvasitem.c:
	* src/goocanvasitemmodel.c: fixed some docs that wrongly say functions
	are for implementing new items only.



Index: demo-table.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/demo-table.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- demo-table.c	11 May 2007 16:30:48 -0000	1.3
+++ demo-table.c	18 Nov 2007 13:57:40 -0000	1.4
@@ -35,6 +35,8 @@
 {
   GooCanvasItem *item = NULL;
   GtkWidget *widget;
+  GValue value = { 0 };
+  guint new_row;
 
   switch (demo_item_type)
     {
@@ -52,18 +54,30 @@
       break;
     }
 
-  goo_canvas_item_set_child_properties (table, item,
-					"row", row,
-					"column", column,
-					"rows", rows,
-					"columns", columns,
+  g_value_init (&value, G_TYPE_UINT);
+  g_value_set_uint (&value, row);
+  goo_canvas_item_set_child_property (table, item, "row", &value);
+  g_value_set_uint (&value, column);
+  goo_canvas_item_set_child_property (table, item, "column", &value);
+  g_value_set_uint (&value, rows);
+  goo_canvas_item_set_child_property (table, item, "rows", &value);
+  g_value_set_uint (&value, columns);
+  goo_canvas_item_set_child_property (table, item, "columns", &value);
+
+  /* Test the get function. */
+  goo_canvas_item_get_child_property (table, item, "row", &value);
+  new_row = g_value_get_uint (&value);
+  if (new_row != row)
+    g_warning ("Got bad row setting: %i should be: %i\n", new_row, row);
+
 #if 1
+  goo_canvas_item_set_child_properties (table, item,
 					"x-expand", TRUE,
 					"x-fill", TRUE,
 					"y-expand", TRUE,
 					"y-fill", TRUE,
-#endif
 					NULL);
+#endif
 
   g_object_set_data (G_OBJECT (item), "id", text);
   g_signal_connect (item, "button_press_event",

Index: mv-demo-table.c
===================================================================
RCS file: /cvs/cairo/goocanvas/demo/mv-demo-table.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- mv-demo-table.c	11 May 2007 16:30:48 -0000	1.3
+++ mv-demo-table.c	18 Nov 2007 13:57:40 -0000	1.4
@@ -35,6 +35,8 @@
 {
   GooCanvasItemModel *model = NULL;
   GooCanvasItem *item;
+  GValue value = { 0 };
+  guint new_row;
 
   switch (demo_item_type)
     {
@@ -49,18 +51,30 @@
       break;
     }
 
-  goo_canvas_item_model_set_child_properties (table, model,
-					      "row", row,
-					      "column", column,
-					      "rows", rows,
-					      "columns", columns,
+  g_value_init (&value, G_TYPE_UINT);
+  g_value_set_uint (&value, row);
+  goo_canvas_item_model_set_child_property (table, model, "row", &value);
+  g_value_set_uint (&value, column);
+  goo_canvas_item_model_set_child_property (table, model, "column", &value);
+  g_value_set_uint (&value, rows);
+  goo_canvas_item_model_set_child_property (table, model, "rows", &value);
+  g_value_set_uint (&value, columns);
+  goo_canvas_item_model_set_child_property (table, model, "columns", &value);
+
+  /* Test the get function. */
+  goo_canvas_item_model_get_child_property (table, model, "row", &value);
+  new_row = g_value_get_uint (&value);
+  if (new_row != row)
+    g_warning ("Got bad row setting: %i should be: %i\n", new_row, row);
+
 #if 1
+  goo_canvas_item_model_set_child_properties (table, model,
 					      "x-expand", TRUE,
 					      "x-fill", TRUE,
 					      "y-expand", TRUE,
 					      "y-fill", TRUE,
-#endif
 					      NULL);
+#endif
 
   item = goo_canvas_get_item (canvas, model);
   g_object_set_data (G_OBJECT (item), "id", text);



More information about the cairo-commit mailing list