aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-folder-tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/e-folder-tree.c')
-rw-r--r--shell/e-folder-tree.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/shell/e-folder-tree.c b/shell/e-folder-tree.c
index d89476df2e..46e7897711 100644
--- a/shell/e-folder-tree.c
+++ b/shell/e-folder-tree.c
@@ -315,6 +315,35 @@ e_folder_tree_remove (EFolderTree *folder_tree,
return TRUE;
}
+static void
+count_nodes (EFolderTree *tree,
+ const char *path,
+ void *data,
+ void *closure)
+{
+ int *count = closure;
+
+ (*count)++;
+}
+
+/**
+ * e_folder_tree_get_count:
+ * @folder_tree: A pointer to an EFolderTree
+ *
+ * Gets the number of folders in the tree
+ *
+ * Return value: The number of folders in the tree
+ **/
+int
+e_folder_tree_get_count (EFolderTree *folder_tree)
+{
+ int count = 0;
+
+ e_folder_tree_foreach (folder_tree, count_nodes, &count);
+
+ return count;
+}
+
/**
* e_folder_tree_get_folder:
* @folder_tree: A pointer to an EFolderTree