[glade3/project-tree-model] glade-widget: Add a g_return_if_fail() if we cannot find an apator for widgets



commit 330ca259d1ca0c15709bd334c7779e9a9b319eb3
Author: Johannes Schmid <jhs gnome org>
Date:   Sun May 9 19:33:22 2010 +0200

    glade-widget: Add a g_return_if_fail() if we cannot find an apator for widgets
    
    Also checks in glade-project.c if we found a widget.

 gladeui/glade-project.c |    2 ++
 gladeui/glade-widget.c  |   11 +++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index e4188fa..7307cb6 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -4532,6 +4532,8 @@ glade_project_model_iter_children (GtkTreeModel* model,
 	if (parent)
 	{
 		GladeWidget* widget = glade_widget_get_from_gobject (parent->user_data);
+		if (widget)
+			return FALSE;
 		GList* children = glade_widget_get_children (widget);
 		if (children)
 		{
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 61af7a1..95c04f2 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -3448,12 +3448,15 @@ glade_widget_set_parent (GladeWidget *widget,
  * Returns: The children of widget
  */
 GList *
-glade_widget_get_children (GladeWidget* widget)
+glade_widget_get_children (GladeWidget *widget)
 {
-	GladeWidgetAdaptor* adaptor = glade_widget_get_adaptor (widget);
-	GList* children = NULL;
-	GList* node;
+	GladeWidgetAdaptor *adaptor;
+	GList *children = NULL;
+	GList *node;
+
+	g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
 
+	adaptor = glade_widget_get_adaptor (widget);
 	children = glade_widget_adaptor_get_children (adaptor, widget->object);
 	for (node = children; node != NULL; node = g_list_next (node))
 	{



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