diff options
-rw-r--r-- | epan/funnel.c | 22 | ||||
-rw-r--r-- | epan/funnel.h | 14 | ||||
-rw-r--r-- | epan/libethereal.def | 1 | ||||
-rw-r--r-- | gtk/funnel_stat.c | 36 |
4 files changed, 39 insertions, 34 deletions
diff --git a/epan/funnel.c b/epan/funnel.c index 084f2edaaa..9bac9b472a 100644 --- a/epan/funnel.c +++ b/epan/funnel.c @@ -36,17 +36,16 @@ typedef struct _funnel_menu_t { struct _funnel_menu_t* next; } funnel_menu_t; - static const funnel_ops_t* ops = NULL; static funnel_menu_t* menus = NULL; const funnel_ops_t* funnel_get_funnel_ops() { return ops; } void funnel_set_funnel_ops(const funnel_ops_t* o) { ops = o; } -extern void funnel_register_menu(const char *name, - REGISTER_STAT_GROUP_E group, - void (*callback)(gpointer), - gpointer callback_data) { +void funnel_register_menu(const char *name, + REGISTER_STAT_GROUP_E group, + void (*callback)(gpointer), + gpointer callback_data) { funnel_menu_t* m = g_malloc(sizeof(funnel_menu_t)); m->name = g_strdup(name); m->group = group; @@ -63,19 +62,12 @@ extern void funnel_register_menu(const char *name, } } - -extern void funnel_register_field_menu(const char *name _U_, - const char *field_abbrev _U_, - REGISTER_STAT_GROUP_E group _U_, - void (*callback)(gpointer) _U_, - gpointer callback_data _U_) { - -} - -extern void funnel_register_all_menus(funnel_registration_cb_t r_cb) { +void funnel_register_all_menus(funnel_registration_cb_t r_cb) { funnel_menu_t* c; for (c = menus; c; c = c->next) { r_cb(c->name,c->group,c->callback,c->callback_data); } } + + diff --git a/epan/funnel.h b/epan/funnel.h index cfef7c04df..2d63e46a11 100644 --- a/epan/funnel.h +++ b/epan/funnel.h @@ -35,7 +35,6 @@ #include <glib.h> #include "../stat_menu.h" - typedef struct _funnel_text_window_t funnel_text_window_t ; typedef struct _funnel_tree_window_t funnel_tree_window_t ; typedef struct _funnel_node_t funnel_node_t ; @@ -76,19 +75,12 @@ extern void funnel_register_menu(const char *name, REGISTER_STAT_GROUP_E group, void (*callback)(gpointer), gpointer callback_data); -#if 0 -extern void funnel_register_field_menu(const char *name, - const char *field_abbrev, - REGISTER_STAT_GROUP_E group, - void (*callback)(gpointer), - gpointer callback_data); -#endif typedef void (*funnel_registration_cb_t)(const char *name, - REGISTER_STAT_GROUP_E group, - void (*callback)(gpointer), - gpointer callback_data); + REGISTER_STAT_GROUP_E group, + void (*callback)(gpointer), + gpointer callback_data); extern void funnel_register_all_menus(funnel_registration_cb_t r_cb); diff --git a/epan/libethereal.def b/epan/libethereal.def index c4a380099a..8e49dfef08 100644 --- a/epan/libethereal.def +++ b/epan/libethereal.def @@ -283,7 +283,6 @@ fvalue_to_string_repr funnel_get_funnel_ops funnel_set_funnel_ops funnel_register_menu -funnel_register_field_menu funnel_register_all_menus GatekeeperRejectReason_vals DATA get_addr_name diff --git a/gtk/funnel_stat.c b/gtk/funnel_stat.c index be8ab7fceb..aee023291a 100644 --- a/gtk/funnel_stat.c +++ b/gtk/funnel_stat.c @@ -116,8 +116,8 @@ static funnel_text_window_t* new_text_window(const gchar* title) { * so the text will be "bump" against the edges. * the following is only working for left and right edges, * there is no such thing for top and bottom :-( */ - gtk_text_view_set_left_margin(GTK_TEXT_VIEW(tw->txt), 4); - gtk_text_view_set_right_margin(GTK_TEXT_VIEW(tw->txt), 4); +/* gtk_text_view_set_left_margin(GTK_TEXT_VIEW(tw->txt), 4); + gtk_text_view_set_right_margin(GTK_TEXT_VIEW(tw->txt), 4);*/ #endif @@ -138,10 +138,12 @@ static funnel_text_window_t* new_text_window(const gchar* title) { static void text_window_clear(funnel_text_window_t* tw) { +#if GTK_MAJOR_VERSION < 2 + GtkText *txt; + if (! tw->win) return; -#if GTK_MAJOR_VERSION < 2 - GtkText *txt = tw->txt; + txt = tw->txt; gtk_text_set_point(txt, 0); /* Keep GTK+ 1.2.3 through 1.2.6 from dumping core - see @@ -238,13 +240,33 @@ static const funnel_ops_t ops = { text_window_destroy }; -static void register_tap_cb(const char *name, REGISTER_STAT_GROUP_E group, void (*callback)(gpointer), gpointer callback_data) { - register_stat_menu_item(name, group, callback, NULL, NULL, callback_data); + +typedef struct _menu_cb_t { + void (*callback)(gpointer); + void* callback_data; +} menu_cb_t; + +static void our_menu_callback(void* unused _U_, gpointer data) { + menu_cb_t* mcb = data; + mcb->callback(mcb->callback_data); +} + +static void register_menu_cb(const char *name, + REGISTER_STAT_GROUP_E group, + void (*callback)(gpointer), + gpointer callback_data) { + menu_cb_t* mcb = g_malloc(sizeof(menu_cb_t)); + + mcb->callback = callback; + mcb->callback_data = callback_data; + + register_stat_menu_item(name, group, our_menu_callback, NULL, NULL, mcb); + } void register_tap_listener_gtkfunnel(void) { funnel_set_funnel_ops(&ops); - funnel_register_all_menus(register_tap_cb); + funnel_register_all_menus(register_menu_cb); } |