# include "config.h"
#endif
+#include <stdio.h>
#include <string.h>
#include <gtk/gtk.h>
#include "gtk/filter_utils.h"
#include "gtk/gtkglobals.h"
#include "gtk/help_dlg.h"
+#include "gtk/utf8_entities.h"
enum {
g_free (str);
}
-#define PROTO_HIER_STATS_USE_GUIMANAGER 1
-#ifndef PROTO_HIER_STATS_USE_GUIMANAGER
-static GtkItemFactoryEntry proto_hier_list_menu_items[] =
-{
- /* Match */
- {"/Apply as Filter", NULL, NULL, 0, "<Branch>", NULL,},
- {"/Apply as Filter/Selected", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_MATCH(ACTYPE_SELECTED, 0), NULL, NULL,},
- {"/Apply as Filter/Not Selected", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_MATCH(ACTYPE_NOT_SELECTED, 0), NULL, NULL,},
- {"/Apply as Filter/... and Selected", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_MATCH(ACTYPE_AND_SELECTED, 0), NULL, NULL,},
- {"/Apply as Filter/... or Selected", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_MATCH(ACTYPE_OR_SELECTED, 0), NULL, NULL,},
- {"/Apply as Filter/... and not Selected", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_MATCH(ACTYPE_AND_NOT_SELECTED, 0), NULL, NULL,},
- {"/Apply as Filter/... or not Selected", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_MATCH(ACTYPE_OR_NOT_SELECTED, 0), NULL, NULL,},
-
- /* Prepare */
- {"/Prepare a Filter", NULL, NULL, 0, "<Branch>", NULL,},
- {"/Prepare a Filter/Selected", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_PREPARE(ACTYPE_SELECTED, 0), NULL, NULL,},
- {"/Prepare a Filter/Not Selected", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_PREPARE(ACTYPE_NOT_SELECTED, 0), NULL, NULL,},
- {"/Prepare a Filter/... and Selected", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_PREPARE(ACTYPE_AND_SELECTED, 0), NULL, NULL,},
- {"/Prepare a Filter/... or Selected", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_PREPARE(ACTYPE_OR_SELECTED, 0), NULL, NULL,},
- {"/Prepare a Filter/... and not Selected", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_PREPARE(ACTYPE_AND_NOT_SELECTED, 0), NULL, NULL,},
- {"/Prepare a Filter/... or not Selected", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_PREPARE(ACTYPE_OR_NOT_SELECTED, 0), NULL, NULL,},
-
- /* Find Frame */
- {"/Find Frame", NULL, NULL, 0, "<Branch>", NULL,},
- {"/Find Frame/Find Frame", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_FIND_FRAME(ACTYPE_SELECTED, 0), NULL, NULL,},
- /* Find Next */
- {"/Find Frame/Find Next", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_FIND_NEXT(ACTYPE_SELECTED, 0), NULL, NULL,},
- /* Find Previous */
- {"/Find Frame/Find Previous", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_FIND_PREVIOUS(ACTYPE_SELECTED, 0), NULL, NULL,},
- /* Colorize Protocol */
- {"/Colorize Protocol", NULL,
- GTK_MENU_FUNC(proto_hier_select_filter_cb), CALLBACK_COLORIZE(ACTYPE_SELECTED, 0), NULL, NULL,}
-};
-#else /* PROTO_HIER_STATS_USE_GUIMANAGER */
-/* Prepare to change GtkItemFactory to GtkUIManager */
+/* Action callbacks */
static void
apply_as_selected_cb(GtkWidget *widget, gpointer user_data)
{
" <popup name='ProtoHierStatsFilterPopup'>\n"
" <menu action='/Apply as Filter'>\n"
" <menuitem action='/Apply as Filter/Selected'/>\n"
-" <menuitem action='/Apply as Filter/... not Selected'/>\n"
-" <menuitem action='/Apply as Filter/... and Selected'/>\n"
-" <menuitem action='/Apply as Filter/... or Selected'/>\n"
-" <menuitem action='/Apply as Filter/... and not Selected'/>\n"
-" <menuitem action='/Apply as Filter/... or not Selected'/>\n"
+" <menuitem action='/Apply as Filter/Not Selected'/>\n"
+" <menuitem action='/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " and Selected'/>\n"
+" <menuitem action='/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " or Selected'/>\n"
+" <menuitem action='/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " and not Selected'/>\n"
+" <menuitem action='/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " or not Selected'/>\n"
" </menu>\n"
" <menu action='/Prepare a Filter'>\n"
" <menuitem action='/Prepare a Filter/Selected'/>\n"
-" <menuitem action='/Prepare a Filter/... not Selected'/>\n"
-" <menuitem action='/Prepare a Filter/... and Selected'/>\n"
-" <menuitem action='/Prepare a Filter/... or Selected'/>\n"
-" <menuitem action='/Prepare a Filter/... and not Selected'/>\n"
-" <menuitem action='/Prepare a Filter/... or not Selected'/>\n"
+" <menuitem action='/Prepare a Filter/Not Selected'/>\n"
+" <menuitem action='/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " and Selected'/>\n"
+" <menuitem action='/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " or Selected'/>\n"
+" <menuitem action='/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " and not Selected'/>\n"
+" <menuitem action='/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " or not Selected'/>\n"
" </menu>\n"
" <menu action='/Find Frame'>\n"
" <menu action='/Find Frame/Find Frame'>\n"
{ "/Find Frame/Find Previous", NULL, "Find Previous", NULL, NULL, NULL },
{ "/Colorize Procedure", NULL, "Colorize Procedure", NULL, NULL, NULL },
{ "/Apply as Filter/Selected", NULL, "Selected", NULL, "Selected", G_CALLBACK(apply_as_selected_cb) },
- { "/Apply as Filter/... not Selected", NULL, "... not Selected", NULL, "... not Selected", G_CALLBACK(apply_as_not_selected_cb) },
- { "/Apply as Filter/... and Selected", NULL, "... and Selected", NULL, "... and Selected", G_CALLBACK(apply_as_and_selected_cb) },
- { "/Apply as Filter/... or Selected", NULL, "... or Selected", NULL, "... or Selected", G_CALLBACK(apply_as_or_selected_cb) },
- { "/Apply as Filter/... and not Selected", NULL, "... and not Selected", NULL, "... and not Selected", G_CALLBACK(apply_as_and_not_selected_cb) },
- { "/Apply as Filter/... or not Selected", NULL, "... or not Selected", NULL, "... or not Selected", G_CALLBACK(apply_as_or_not_selected_cb) },
+ { "/Apply as Filter/Not Selected", NULL, "Not Selected", NULL, "Not Selected", G_CALLBACK(apply_as_not_selected_cb) },
+ { "/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " and Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " and Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " and Selected", G_CALLBACK(apply_as_and_selected_cb) },
+ { "/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " or Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " or Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " or Selected", G_CALLBACK(apply_as_or_selected_cb) },
+ { "/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " and not Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " and not Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " and not Selected", G_CALLBACK(apply_as_and_not_selected_cb) },
+ { "/Apply as Filter/" UTF8_HORIZONTAL_ELLIPSIS " or not Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " or not Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " or not Selected", G_CALLBACK(apply_as_or_not_selected_cb) },
{ "/Prepare a Filter/Selected", NULL, "Selected", NULL, "selcted", G_CALLBACK(prep_as_selected_cb) },
- { "/Prepare a Filter/... not Selected", NULL, "... not Selected", NULL, "... not Selected", G_CALLBACK(prep_as_not_selected_cb) },
- { "/Prepare a Filter/... and Selected", NULL, "... and Selected", NULL, "... and Selected", G_CALLBACK(prep_as_and_selected_cb) },
- { "/Prepare a Filter/... or Selected", NULL, "... or Selected", NULL, "... or Selected", G_CALLBACK(prep_as_or_selected_cb) },
- { "/Prepare a Filter/... and not Selected", NULL, "... and not Selected", NULL, "... and not Selected", G_CALLBACK(prep_as_and_not_selected_cb) },
- { "/Prepare a Filter/... or not Selected", NULL, "... or not Selected", NULL, "... or not Selected", G_CALLBACK(prep_as_or_not_selected_cb) },
+ { "/Prepare a Filter/Not Selected", NULL, "Not Selected", NULL, "Not Selected", G_CALLBACK(prep_as_not_selected_cb) },
+ { "/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " and Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " and Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " and Selected", G_CALLBACK(prep_as_and_selected_cb) },
+ { "/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " or Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " or Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " or Selected", G_CALLBACK(prep_as_or_selected_cb) },
+ { "/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " and not Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " and not Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " and not Selected", G_CALLBACK(prep_as_and_not_selected_cb) },
+ { "/Prepare a Filter/" UTF8_HORIZONTAL_ELLIPSIS " or not Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " or not Selected", NULL, UTF8_HORIZONTAL_ELLIPSIS " or not Selected", G_CALLBACK(prep_as_or_not_selected_cb) },
{ "/Find Frame/Selected", NULL, "Selected", NULL, "Selected", G_CALLBACK(find_selected_cb) },
{ "/Find Frame/Not Selected", NULL, "Not Selected", NULL, "Not Selected", G_CALLBACK(find_not_selected_cb) },
{ "/Find Previous/Selected", NULL, "Selected", NULL, "Selected", G_CALLBACK(find_prev_selected_cb) },
{ "/Find Next/Not Selected", NULL, "Not Selected", NULL, "Not Selected", G_CALLBACK(find_next_not_selected_cb) },
{ "/Colorize Procedure/Colorize Protocol", NULL, "Colorize Protocol", NULL, "Colorize Protocol", G_CALLBACK(color_selected_cb) },
};
-#endif /* PROTO_HIER_STATS_USE_GUIMANAGER */
static void
fill_in_tree_node(GNode *node, gpointer data)
static void
proto_hier_create_popup_menu(void)
{
-#ifndef PROTO_HIER_STATS_USE_GUIMANAGER
- GtkItemFactory *item_factory;
- GtkWidget *popup_menu_object;
- item_factory = gtk_item_factory_new(GTK_TYPE_MENU, "<main>", NULL);
- gtk_item_factory_create_items_ac(item_factory, sizeof(proto_hier_list_menu_items)/sizeof(proto_hier_list_menu_items[0]), proto_hier_list_menu_items, NULL, 2);
- popup_menu_object = gtk_item_factory_get_widget (item_factory, "<main>");
- g_signal_connect(tree, "button_press_event", G_CALLBACK(proto_hier_show_popup_menu_cb), popup_menu_object);
-#else
GtkUIManager *ui_manager;
GtkActionGroup *action_group;
GError *error = NULL;
GtkWidget *popup_menu_object;
action_group = gtk_action_group_new ("ProtoHierStatsTFilterPopupActionGroup");
- gtk_action_group_add_actions (action_group, /* the action group */
- proto_hier_stats_popup_entries, /* an array of action descriptions */
- G_N_ELEMENTS(proto_hier_stats_popup_entries),/* the number of entries */
- NULL); /* data to pass to the action callbacks */
+ gtk_action_group_add_actions (action_group, /* the action group */
+ (gpointer)proto_hier_stats_popup_entries, /* an array of action descriptions */
+ G_N_ELEMENTS(proto_hier_stats_popup_entries), /* the number of entries */
+ NULL); /* data to pass to the action callbacks */
ui_manager = gtk_ui_manager_new ();
gtk_ui_manager_insert_action_group (ui_manager,
}
popup_menu_object = gtk_ui_manager_get_widget(ui_manager, "/ProtoHierStatsFilterPopup");
g_signal_connect(tree, "button_press_event", G_CALLBACK(proto_hier_show_popup_menu_cb), popup_menu_object);
-#endif /* PROTO_HIER_STATS_USE_GUIMANAGER */
+
}
#define MAX_DLG_HEIGHT 450
/* Scrolled Window */
sw = scrolled_window_new(NULL, NULL);
- gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
GTK_SHADOW_IN);
gtk_container_add(GTK_CONTAINER(container), sw);
store = gtk_tree_store_new(NUM_STAT_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_FLOAT,
G_TYPE_FLOAT);
tree = tree_view_new(GTK_TREE_MODEL(store));
NULL);
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_append_column(tree_view, column);
-#if GTK_CHECK_VERSION(2,6,0)
renderer = gtk_cell_renderer_progress_new();
column = gtk_tree_view_column_new_with_attributes("% Packets", renderer,
"text", PRCT_PKTS_COLUMN,
"value", PRCT_PKTS_VALUE_COLUMN,
NULL);
gtk_tree_view_column_set_expand(column, TRUE);
-#else
- gtk_tree_view_column_set_expand(column, TRUE);
- renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes("% Packets", renderer,
- "text", PRCT_PKTS_COLUMN,
- NULL);
- g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL);
-#endif
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_append_column(tree_view, column);
renderer = gtk_cell_renderer_text_new();
g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL);
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_append_column(tree_view, column);
-#if GTK_CHECK_VERSION(2,6,0)
renderer = gtk_cell_renderer_progress_new();
column = gtk_tree_view_column_new_with_attributes("% Bytes", renderer,
"text", PRCT_BYTES_COLUMN,
"value", PRCT_BYTES_VALUE_COLUMN,
NULL);
gtk_tree_view_column_set_expand(column, TRUE);
-#else
- renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes("% Bytes", renderer,
- "text", PRCT_BYTES_COLUMN,
- NULL);
- g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL);
-#endif
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
gtk_tree_view_append_column(tree_view, column);
renderer = gtk_cell_renderer_text_new();
* ex: set shiftwidth=4 tabstop=8 expandtab
* :indentSize=4:tabSize=8:noTabs=true:
*/
-