Index: ui/gtk/funnel_stat.c =================================================================== --- ui/gtk/funnel_stat.c (revision 43690) +++ ui/gtk/funnel_stat.c (working copy) @@ -55,6 +55,7 @@ #include "ui/progress_dlg.h" #include "../color_filters.h" +#include "ui/gtk/file_dlg.h" #include "ui/gtk/gui_utils.h" #include "ui/gtk/dlg_utils.h" #include "ui/gtk/tap_param_dlg.h" @@ -377,7 +378,91 @@ } +struct _funnel_open_dlg_data { + GtkWidget *win, file_open_w; + GPtrArray *entries; + funnel_dlg_cb_t dlg_cb; + void *data; +}; +static void funnel_new_file_picker_dialog(const gchar* title, + const gchar** fieldnames, + funnel_dlg_cb_t dlg_cb, + void* data) +{ + GtkWidget *file_open_w; + GtkWidget *main_vb, *main_tb; + GPtrArray* entries = NULL; + gchar *cf_name; + const gchar* fieldname; + int i, len; + GPtrArray* returns = NULL; + + entries = g_ptr_array_new(); + + for (i=0;fieldnames[i];i++); + + len = i; + + file_open_w = file_selection_new(title, FILE_SELECTION_OPEN); + + gtk_widget_set_size_request(file_open_w, DEF_WIDTH, DEF_HEIGHT); + + main_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 5, FALSE); + file_selection_set_extra_widget(file_open_w, main_vb); + gtk_container_set_border_width(GTK_CONTAINER(main_vb), 6); + gtk_widget_show(main_vb); + + main_tb = gtk_table_new(i+1, 2, FALSE); + gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0); + gtk_table_set_row_spacings(GTK_TABLE(main_tb), 10); + gtk_table_set_col_spacings(GTK_TABLE(main_tb), 15); + gtk_widget_show(main_tb); + + for (i = 0; (fieldname = fieldnames[i]) ; i++) { + GtkWidget *entry, *label; + + label = gtk_label_new(fieldname); + gtk_misc_set_alignment(GTK_MISC(label), 1.0f, 0.5f); + gtk_table_attach_defaults(GTK_TABLE(main_tb), label, 0, 1, i+1, i + 2); + gtk_widget_show(label); + + entry = gtk_entry_new(); + g_ptr_array_add(entries,entry); + gtk_table_attach_defaults(GTK_TABLE(main_tb), entry, 1, 2, i+1, i + 2); + gtk_widget_show(entry); + } + + /* + * Run the dialog ... + */ + cf_name = file_selection_run(file_open_w); + if (cf_name == NULL) { + return; /* Do we need to destroy it? */ + } + + /* + * Now call the callback ... + */ + returns = g_ptr_array_new(); + + /* Add the file name as the first param */ + g_ptr_array_add(returns, g_strdup(cf_name)); + + /* Now add the text string */ + for(i=0; ipdata, data); + + window_destroy(GTK_WIDGET(file_open_w)); +} + struct _funnel_dlg_data { GtkWidget* win; GPtrArray* entries; @@ -575,6 +660,7 @@ text_window_add_button, /*...,*/ funnel_new_dialog, + funnel_new_file_picker_dialog, funnel_logger, funnel_retap_packets, copy_to_clipboard, Index: ui/gtk/tcp_graph.c =================================================================== --- ui/gtk/tcp_graph.c (revision 43690) +++ ui/gtk/tcp_graph.c (working copy) @@ -2767,7 +2767,7 @@ break; y = y - floor (y); } - g_snprintf (str, sizeof(str), "%.*f", rdigits, label); + g_snprintf (str, sizeof(str), "%'*f", rdigits, label); switch (dir) { case AXIS_HORIZONTAL: layout = gtk_widget_create_pango_layout(axis->g->drawing_area, Index: ui/gtk/io_stat.c =================================================================== --- ui/gtk/io_stat.c (revision 43690) +++ ui/gtk/io_stat.c (working copy) @@ -950,14 +950,14 @@ if(draw_y_as_time){ print_time_scale_string(label_string, 15, value, value, TRUE); } else { - g_snprintf(label_string, 15, "%d", value); + g_snprintf(label_string, 15, "%'d", value); } } else { value = (max_y/10)*i; if(draw_y_as_time){ print_time_scale_string(label_string, 15, value, max_y, FALSE); } else { - g_snprintf(label_string, 15, "%d", value); + g_snprintf(label_string, 15, "%'d", value); } } Index: ui/cli/tap-funnel.c =================================================================== --- ui/cli/tap-funnel.c (revision 43690) +++ ui/cli/tap-funnel.c (working copy) @@ -100,6 +100,7 @@ NULL, /*...,*/ NULL, + NULL, funnel_logger, NULL, NULL, Index: epan/wslua/wslua_gui.c =================================================================== --- epan/wslua/wslua_gui.c (revision 43690) +++ epan/wslua/wslua_gui.c (working copy) @@ -210,6 +210,70 @@ } +WSLUA_FUNCTION wslua_file_picker_new_dialog(lua_State* L) { /* Pops up a file picker new dialog */ +#define WSLUA_ARG_new_dialog_TITLE 1 /* Title of the dialog's window. */ +#define WSLUA_ARG_new_dialog_ACTION 2 /* Action to be performed when OKd. */ +/* WSLUA_MOREARGS new_dialog A series of strings to be used as labels of the dialog's fields */ + + const gchar *title; + int top = lua_gettop(L); + int i; + GPtrArray* labels; + struct _dlg_cb_data* dcbd; + + if (! ops) { + luaL_error(L,"the GUI facility has to be enabled"); + return 0; + } + + if (!ops->new_dialog) { + WSLUA_ERROR(new_dialog,"GUI not available"); + } + + if (! (title = luaL_checkstring(L,WSLUA_ARG_new_dialog_TITLE)) ) { + WSLUA_ARG_ERROR(new_dialog,TITLE,"Must be a string"); + } + + if (! lua_isfunction(L,WSLUA_ARG_new_dialog_ACTION)) { + WSLUA_ARG_ERROR(new_dialog,ACTION,"Must be a function"); + } + + if (top < 3) { + WSLUA_ERROR(new_dialog,"At least one field required"); + } + + dcbd = g_malloc(sizeof(struct _dlg_cb_data)); + dcbd->L = L; + + lua_remove(L,1); + + lua_pushvalue(L, 1); + dcbd->func_ref = luaL_ref(L, LUA_REGISTRYINDEX); + lua_remove(L,1); + + labels = g_ptr_array_new(); + + top -= 2; + + for (i = 1; i <= top; i++) { + gchar* label = (void*)luaL_checkstring(L,i); + + /* XXX leaks labels on error */ + if (! label) + WSLUA_ERROR(new_dialog,"All fields must be strings"); + + g_ptr_array_add(labels,label); + } + + g_ptr_array_add(labels,NULL); + + ops->file_picker_new_dialog(title, (const gchar**)labels->pdata, lua_dialog_cb, dcbd); + + g_ptr_array_free(labels,FALSE); + + WSLUA_RETURN(0); +} + WSLUA_FUNCTION wslua_new_dialog(lua_State* L) { /* Pops up a new dialog */ #define WSLUA_ARG_new_dialog_TITLE 1 /* Title of the dialog's window. */ #define WSLUA_ARG_new_dialog_ACTION 2 /* Action to be performed when OKd. */ @@ -242,7 +306,6 @@ WSLUA_ERROR(new_dialog,"At least one field required"); } - dcbd = g_malloc(sizeof(struct _dlg_cb_data)); dcbd->L = L; Index: epan/funnel.h =================================================================== --- epan/funnel.h (revision 43690) +++ epan/funnel.h (working copy) @@ -67,6 +67,10 @@ funnel_dlg_cb_t dlg_cb, void* data); + void (*file_picker_new_dialog)(const gchar* title, + const gchar** fieldnames, + funnel_dlg_cb_t dlg_cb, + void* data); void (*logger)(const gchar *log_domain, GLogLevelFlags log_level,