[gimp] Make sure all items of a subtree get added to / removed from the name hash
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Make sure all items of a subtree get added to / removed from the name hash
- Date: Tue, 9 Feb 2010 21:41:56 +0000 (UTC)
commit 37d10415df95901495b3c3bc354056a5fd690629
Author: Michael Natterer <mitch gimp org>
Date: Tue Feb 9 00:25:10 2010 +0100
Make sure all items of a subtree get added to / removed from the name hash
when whole item hierarchies are added or removed, like when a layer
group goes to the undo stack and back.
app/core/gimpitemtree.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpitemtree.c b/app/core/gimpitemtree.c
index 26eb2ac..388a098 100644
--- a/app/core/gimpitemtree.c
+++ b/app/core/gimpitemtree.c
@@ -396,6 +396,7 @@ gimp_item_tree_add_item (GimpItemTree *tree,
{
GimpItemTreePrivate *private;
GimpContainer *container;
+ GimpContainer *children;
g_return_if_fail (GIMP_IS_ITEM_TREE (tree));
@@ -414,6 +415,20 @@ gimp_item_tree_add_item (GimpItemTree *tree,
gimp_item_tree_uniquefy_name (tree, item, NULL);
+ children = gimp_viewable_get_children (GIMP_VIEWABLE (item));
+
+ if (children)
+ {
+ GList *list = gimp_item_stack_get_item_list (GIMP_ITEM_STACK (children));
+
+ while (list)
+ {
+ gimp_item_tree_uniquefy_name (tree, list->data, NULL);
+
+ list = g_list_remove (list, list->data);
+ }
+ }
+
if (parent)
container = gimp_viewable_get_children (GIMP_VIEWABLE (parent));
else
@@ -434,6 +449,7 @@ gimp_item_tree_remove_item (GimpItemTree *tree,
GimpItemTreePrivate *private;
GimpItem *parent;
GimpContainer *container;
+ GimpContainer *children;
gint index;
g_return_val_if_fail (GIMP_IS_ITEM_TREE (tree), NULL);
@@ -454,6 +470,21 @@ gimp_item_tree_remove_item (GimpItemTree *tree,
g_hash_table_remove (private->name_hash,
gimp_object_get_name (item));
+ children = gimp_viewable_get_children (GIMP_VIEWABLE (item));
+
+ if (children)
+ {
+ GList *list = gimp_item_stack_get_item_list (GIMP_ITEM_STACK (children));
+
+ while (list)
+ {
+ g_hash_table_remove (private->name_hash,
+ gimp_object_get_name (list->data));
+
+ list = g_list_remove (list, list->data);
+ }
+ }
+
gimp_container_remove (container, GIMP_OBJECT (item));
if (parent)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]