From 1265de6850023a989c987034609db5e264055ed2 Mon Sep 17 00:00:00 2001 From: Jonathan Beck Date: Sun, 6 Sep 2009 23:47:57 +0200 Subject: Update treestore to only contain value nodes. Use 'Item n' for array items. --- src/plist-utils.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/plist-utils.c') diff --git a/src/plist-utils.c b/src/plist-utils.c index fe63439..cc3d11e 100644 --- a/src/plist-utils.c +++ b/src/plist-utils.c @@ -49,3 +49,23 @@ int plist_node_get_item_count(plist_t node) { return count; } +int plist_item_index(plist_t node) { + plist_t parent; + plist_t child; + int count = 0; + + parent = plist_get_parent(node); + + if (parent == NULL || node == NULL) { + return -1; + } + + child = plist_get_first_child(parent); + while (child && child != node) { + count ++; + child = plist_get_next_sibling(child); + } + + return count; +} + -- cgit v1.1-32-gdbae