From f904f42f9da356bcc70377046c7f6617e5bcba4b Mon Sep 17 00:00:00 2001 From: Ulf Lamping Date: Tue, 10 Feb 2009 03:54:55 +0000 Subject: Remove an ugly hack: There was an ugly hack while creating the menu, that tried to detect the stat_group a stats_tree belongs to by looking at the name string. That makes it unnecessarily hard to understand how the menu is really created. Fix: Add a new function stats_tree_register_with_group() that takes the stat_group as a parameter. Use this function where a stats_tree doesn't fit into the default "unsorted" group. svn path=/trunk/; revision=27407 --- epan/stats_tree.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'epan/stats_tree.h') diff --git a/epan/stats_tree.h b/epan/stats_tree.h index 207a0670cd..66a0c556cd 100644 --- a/epan/stats_tree.h +++ b/epan/stats_tree.h @@ -30,6 +30,7 @@ #include #include #include +#include "../stat_menu.h" #include "../register.h" #define STAT_TREE_ROOT "root" @@ -49,11 +50,12 @@ typedef void (*stat_tree_init_cb)(stats_tree*); /* stats_tree cleanup callback */ typedef void (*stat_tree_cleanup_cb)(stats_tree*); -/* registers a new stats tree +/* registers a new stats tree with default group REGISTER_STAT_GROUP_UNSORTED * abbr: protocol abbr * name: protocol display name * packet: per packet callback * init: tree initialization callback + * cleanup: cleanup callback */ extern void stats_tree_register(const gchar *tapname, const gchar *abbr, @@ -62,6 +64,22 @@ extern void stats_tree_register(const gchar *tapname, stat_tree_init_cb init, stat_tree_cleanup_cb cleanup); +/* registers a new stats tree + * abbr: protocol abbr + * name: protocol display name + * packet: per packet callback + * init: tree initialization callback + * cleanup: cleanup callback + * stat_group: the group this stat belongs to + */ +extern void stats_tree_register_with_group(const gchar *tapname, + const gchar *abbr, + const gchar *name, + stat_tree_packet_cb packet, + stat_tree_init_cb init, + stat_tree_cleanup_cb cleanup, + register_stat_group_t stat_group); + extern int stats_tree_parent_id_by_name(stats_tree *st, const gchar *parent_name); /* Creates a node in the tree (to be used in the in init_cb) -- cgit v1.2.3