[goocanvas] GooCanvasTable: Warn if setting child properties on a non-child.



commit ed89eb49a538d0bab276cf82c5b43145819817cd
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Aug 11 23:10:05 2011 +0200

    GooCanvasTable: Warn if setting child properties on a non-child.
    
    * src/goocanvastable.c (goo_canvas_table_set_child_property):
    If the child wasn't added yet then issue a g_warning(). This gives
    the programmer a clue.

 ChangeLog            |    8 ++++++++
 src/goocanvastable.c |   10 ++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 021d686..825d340 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-08-11  Murray Cumming  <murrayc.com>
+
+	GooCanvasTable: Warn if setting child properties on a non-child.
+
+	* src/goocanvastable.c (goo_canvas_table_set_child_property):
+	If the child wasn't added yet then issue a g_warning(). This gives 
+	the programmer a clue.
+
 2011-08-11  Murray Cumming  <murrayc murrayc com>
 
 	Table demo: Correct the box packing of the scrolled windows.
diff --git a/src/goocanvastable.c b/src/goocanvastable.c
index 911869e..66c18ee 100644
--- a/src/goocanvastable.c
+++ b/src/goocanvastable.c
@@ -1108,6 +1108,7 @@ goo_canvas_table_set_child_property (GooCanvasItem     *item,
   GooCanvasTable *table = (GooCanvasTable*) item;
   GooCanvasTableChild *table_child;
   gint child_num;
+  gboolean found = FALSE;
 
   for (child_num = 0; child_num < group->items->len; child_num++)
     {
@@ -1120,11 +1121,16 @@ goo_canvas_table_set_child_property (GooCanvasItem     *item,
 						      table_child,
 						      property_id, value,
 						      pspec);
-	  break;
+          found = TRUE;
+          break;
 	}
     }
 
-  goo_canvas_item_simple_changed (simple, TRUE);
+  if (!found) {
+    g_warning ("%s: child not found.", G_STRFUNC);
+  }
+  else
+    goo_canvas_item_simple_changed (simple, TRUE);
 }
 
 



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