[glade] glade_project_remove_object() check if object has a GladeWidget first since its cheaper and issue a
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] glade_project_remove_object() check if object has a GladeWidget first since its cheaper and issue a
- Date: Wed, 11 Sep 2013 21:26:18 +0000 (UTC)
commit 9e1b474621314dd3fa41ace6b17c615a9bdb498e
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Wed Sep 11 16:12:59 2013 -0300
glade_project_remove_object() check if object has a GladeWidget first since its cheaper
and issue a warning if we have an object in the project without a GladeWidget.
gladeui/glade-project.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index 2292e74..a2881ea 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -3731,15 +3731,25 @@ glade_project_remove_object (GladeProject *project, GObject *object)
g_return_if_fail (GLADE_IS_PROJECT (project));
g_return_if_fail (G_IS_OBJECT (object));
- if (!glade_project_has_object (project, object))
- return;
-
if (GLADE_IS_PLACEHOLDER (object))
return;
if ((gwidget = glade_widget_get_from_gobject (object)) == NULL)
- return;
+ {
+ if (g_list_find (project->priv->objects, object))
+ {
+ project->priv->tree = g_list_remove_all (project->priv->tree, object);
+ project->priv->objects = g_list_remove_all (project->priv->objects, object);
+ project->priv->selection = g_list_remove_all (project->priv->selection, object);
+ g_warning ("Internal data model error, removing object %p %s without a GladeWidget wrapper",
+ object, G_OBJECT_TYPE_NAME (object));
+ }
+ return;
+ }
+ if (!glade_project_has_object (project, object))
+ return;
+
/* Recurse and remove deepest children first */
if ((children = glade_widget_get_children (gwidget)) != NULL)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]