[goffice] Canvas: avoid notifying items of no-op canvas changes.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Canvas: avoid notifying items of no-op canvas changes.
- Date: Tue, 26 Mar 2013 13:18:57 +0000 (UTC)
commit 28c8cd3b28266e817744ddbcda76a752b2f857ea
Author: Morten Welinder <terra gnome org>
Date: Tue Mar 26 09:18:25 2013 -0400
Canvas: avoid notifying items of no-op canvas changes.
ChangeLog | 3 +++
goffice/canvas/goc-group.c | 15 ++++++++++++++-
2 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 35282d2..5e7fb04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2013-03-26 Morten Welinder <terra gnome org>
+ * goffice/canvas/goc-group.c (goc_group_add_child): Only notify of
+ canvas changes when the canvas actually does change.
+
* goffice/canvas/goc-item.c (goc_item_get_style_context): Track
parent changes.
diff --git a/goffice/canvas/goc-group.c b/goffice/canvas/goc-group.c
index fcbe086..389f1cb 100644
--- a/goffice/canvas/goc-group.c
+++ b/goffice/canvas/goc-group.c
@@ -334,17 +334,30 @@ goc_group_clear (GocGroup *group)
void
goc_group_add_child (GocGroup *parent, GocItem *item)
{
+ GocCanvas *old_canvas;
+
g_return_if_fail (GOC_IS_GROUP (parent));
g_return_if_fail (GOC_IS_ITEM (item));
+
if (item->parent == parent)
return;
+
+ /* Remove from current group. */
if (item->parent != NULL)
goc_group_remove_child (item->parent, item);
+
+ old_canvas = item->canvas;
+
+ /* Insert into new group. */
parent->children = g_list_append (parent->children, item);
item->parent = parent;
item->canvas = parent->base.canvas;
+
+ /* Notify of changes. */
g_object_notify (G_OBJECT (item), "parent");
- g_object_notify (G_OBJECT (item), "canvas");
+ if (item->canvas != old_canvas)
+ g_object_notify (G_OBJECT (item), "canvas");
+
if (GOC_ITEM (parent)->realized)
_goc_item_realize (item);
goc_item_bounds_changed (GOC_ITEM (parent));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]