2011-06-05 23:04:11 +00:00
|
|
|
/* tap_param_dlg.c
|
2011-06-05 22:39:23 +00:00
|
|
|
* Routines for parameter dialog used by gui taps
|
2003-12-17 22:13:08 +00:00
|
|
|
* Copyright 2003 Lars Roland
|
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
2003-12-17 22:13:08 +00:00
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2003-12-17 22:13:08 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2003-12-17 22:13:08 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 01:48:30 +00:00
|
|
|
#include "config.h"
|
2003-12-17 22:13:08 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
2008-04-13 03:32:24 +00:00
|
|
|
#include <string.h>
|
2003-12-17 22:13:08 +00:00
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2008-04-13 03:32:24 +00:00
|
|
|
#include <epan/stat_cmd_args.h>
|
|
|
|
|
2003-12-17 22:13:08 +00:00
|
|
|
#include "../file.h"
|
|
|
|
#include "../globals.h"
|
2005-08-21 09:48:27 +00:00
|
|
|
#include "../stat_menu.h"
|
2008-04-13 03:32:24 +00:00
|
|
|
|
2012-01-15 21:59:11 +00:00
|
|
|
#include "ui/gtk/stock_icons.h"
|
|
|
|
#include "ui/gtk/dlg_utils.h"
|
|
|
|
#include "ui/gtk/filter_dlg.h"
|
|
|
|
#include "ui/gtk/gui_stat_menu.h"
|
|
|
|
#include "ui/gtk/tap_param_dlg.h"
|
|
|
|
#include "ui/gtk/gui_utils.h"
|
|
|
|
#include "ui/gtk/gtkglobals.h"
|
|
|
|
#include "ui/gtk/filter_autocomplete.h"
|
2003-12-17 22:13:08 +00:00
|
|
|
|
2012-01-15 21:59:11 +00:00
|
|
|
#include "ui/gtk/old-gtk-compat.h"
|
2003-12-17 22:13:08 +00:00
|
|
|
|
2011-06-05 22:39:23 +00:00
|
|
|
typedef struct _tap_param_dlg_list_item {
|
2011-06-05 23:16:14 +00:00
|
|
|
GtkWidget *dlg;
|
|
|
|
tap_param_dlg cont;
|
|
|
|
construct_args_t args;
|
2011-06-06 01:04:56 +00:00
|
|
|
GtkWidget **param_items; /* items for params */
|
2011-06-05 23:16:14 +00:00
|
|
|
struct _tap_param_dlg_list_item *next;
|
2011-06-05 22:39:23 +00:00
|
|
|
} tap_param_dlg_list_item;
|
2003-12-17 22:13:08 +00:00
|
|
|
|
2011-06-05 22:39:23 +00:00
|
|
|
static tap_param_dlg_list_item *start_dlg_list=NULL;
|
|
|
|
static tap_param_dlg_list_item *end_dlg_list=NULL;
|
|
|
|
static tap_param_dlg_list_item *current_dlg = NULL;
|
2003-12-19 23:41:55 +00:00
|
|
|
|
2005-08-21 09:48:27 +00:00
|
|
|
/*
|
2011-06-05 22:39:23 +00:00
|
|
|
* Register a stat that has a parameter dialog.
|
2005-08-21 09:48:27 +00:00
|
|
|
* We register it both as a command-line stat and a menu item stat.
|
|
|
|
*/
|
|
|
|
void
|
2013-05-24 03:10:56 +00:00
|
|
|
register_param_stat(tap_param_dlg *info, const char *name,
|
|
|
|
register_stat_group_t group)
|
2005-08-21 09:48:27 +00:00
|
|
|
{
|
2013-05-24 03:10:56 +00:00
|
|
|
gchar *full_name;
|
|
|
|
const gchar *stock_id = NULL;
|
|
|
|
|
2011-06-05 23:16:14 +00:00
|
|
|
register_stat_cmd_arg(info->init_string, info->tap_init_cb, NULL);
|
2013-05-24 03:10:56 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This menu item will pop up a dialog box, so append "..."
|
|
|
|
* to it.
|
|
|
|
*/
|
|
|
|
full_name = g_strdup_printf("%s...", name);
|
|
|
|
|
|
|
|
switch (group) {
|
|
|
|
|
|
|
|
case REGISTER_ANALYZE_GROUP_UNSORTED:
|
|
|
|
case REGISTER_ANALYZE_GROUP_CONVERSATION_FILTER:
|
|
|
|
case REGISTER_STAT_GROUP_UNSORTED:
|
|
|
|
case REGISTER_STAT_GROUP_GENERIC:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REGISTER_STAT_GROUP_CONVERSATION_LIST:
|
|
|
|
stock_id = WIRESHARK_STOCK_CONVERSATIONS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REGISTER_STAT_GROUP_ENDPOINT_LIST:
|
|
|
|
stock_id = WIRESHARK_STOCK_ENDPOINTS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REGISTER_STAT_GROUP_RESPONSE_TIME:
|
|
|
|
stock_id = WIRESHARK_STOCK_TIME;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case REGISTER_STAT_GROUP_TELEPHONY:
|
2013-05-30 22:32:10 +00:00
|
|
|
case REGISTER_STAT_GROUP_TELEPHONY_GSM:
|
2013-05-31 21:57:15 +00:00
|
|
|
case REGISTER_STAT_GROUP_TELEPHONY_LTE:
|
2013-05-31 23:00:39 +00:00
|
|
|
case REGISTER_STAT_GROUP_TELEPHONY_SCTP:
|
2013-05-24 03:10:56 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case REGISTER_TOOLS_GROUP_UNSORTED:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
register_menu_bar_menu_items(
|
|
|
|
stat_group_name(group), /* GUI path to the place holder in the menu */
|
|
|
|
name, /* Action name */
|
|
|
|
stock_id, /* Stock id */
|
|
|
|
full_name, /* label */
|
|
|
|
NULL, /* Accelerator */
|
|
|
|
NULL, /* Tooltip */
|
|
|
|
tap_param_dlg_cb, /* Callback */
|
|
|
|
info, /* Callback data */
|
|
|
|
TRUE, /* Enabled */
|
|
|
|
NULL,
|
|
|
|
NULL);
|
2011-07-26 17:46:19 +00:00
|
|
|
}
|
2005-08-21 09:48:27 +00:00
|
|
|
|
2011-06-05 22:39:23 +00:00
|
|
|
void tap_param_dlg_update (void)
|
2003-12-19 23:41:55 +00:00
|
|
|
{
|
2011-06-05 23:16:14 +00:00
|
|
|
tap_param_dlg_list_item *dialog = start_dlg_list;
|
2012-06-03 22:03:05 +00:00
|
|
|
char *display_name;
|
2011-06-05 23:16:14 +00:00
|
|
|
char *title;
|
2011-07-26 17:46:19 +00:00
|
|
|
|
2011-06-05 23:16:14 +00:00
|
|
|
while(dialog != NULL) {
|
|
|
|
if(dialog->dlg) {
|
2012-06-03 22:03:05 +00:00
|
|
|
display_name = cf_get_display_name(&cfile);
|
|
|
|
title = g_strdup_printf("Wireshark: %s: %s", dialog->cont.win_title , display_name);
|
|
|
|
g_free(display_name);
|
2011-06-05 23:16:14 +00:00
|
|
|
gtk_window_set_title(GTK_WINDOW(dialog->dlg), title);
|
|
|
|
g_free(title);
|
|
|
|
}
|
|
|
|
dialog = dialog->next;
|
|
|
|
}
|
2003-12-19 23:41:55 +00:00
|
|
|
}
|
2003-12-17 22:13:08 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
dlg_destroy_cb(GtkWidget *item _U_, gpointer dialog_data)
|
2011-06-05 23:16:14 +00:00
|
|
|
{
|
|
|
|
tap_param_dlg_list_item *dlg_data = (tap_param_dlg_list_item *) dialog_data;
|
|
|
|
dlg_data->dlg = NULL;
|
2003-12-17 22:13:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-06-05 22:39:23 +00:00
|
|
|
tap_param_dlg_start_button_clicked(GtkWidget *item _U_, gpointer dialog_data)
|
2003-12-17 22:13:08 +00:00
|
|
|
{
|
2011-06-05 23:16:14 +00:00
|
|
|
GString *params;
|
|
|
|
size_t i;
|
2013-06-01 01:23:59 +00:00
|
|
|
gdouble d;
|
2011-06-06 01:04:56 +00:00
|
|
|
gint j;
|
2011-07-26 17:46:19 +00:00
|
|
|
|
2011-06-05 23:16:14 +00:00
|
|
|
tap_param_dlg_list_item *dlg_data = (tap_param_dlg_list_item *) dialog_data;
|
|
|
|
|
|
|
|
params = g_string_new(dlg_data->cont.init_string);
|
|
|
|
for(i=0;i<dlg_data->cont.nparams;i++) {
|
2011-06-06 01:04:56 +00:00
|
|
|
g_string_append_c(params, ',');
|
|
|
|
switch (dlg_data->cont.params[i].type) {
|
|
|
|
|
|
|
|
case PARAM_ENUM:
|
|
|
|
j = gtk_combo_box_get_active(GTK_COMBO_BOX(dlg_data->param_items[i]));
|
|
|
|
g_string_append_printf(params,"%d",
|
|
|
|
dlg_data->cont.params[i].enum_vals[j].value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARAM_UINT:
|
2013-06-01 01:23:59 +00:00
|
|
|
d = gtk_spin_button_get_value(GTK_SPIN_BUTTON(dlg_data->param_items[i]));
|
|
|
|
g_string_append_printf(params,"%u",(guint)d);
|
|
|
|
break;
|
|
|
|
|
2011-06-06 01:04:56 +00:00
|
|
|
case PARAM_STRING:
|
|
|
|
case PARAM_FILTER:
|
|
|
|
g_string_append(params,
|
|
|
|
gtk_entry_get_text(GTK_ENTRY(dlg_data->param_items[i])));
|
|
|
|
break;
|
|
|
|
}
|
2011-06-05 23:16:14 +00:00
|
|
|
}
|
|
|
|
(dlg_data->cont.tap_init_cb)(params->str,NULL);
|
|
|
|
g_string_free(params, TRUE);
|
2003-12-17 22:13:08 +00:00
|
|
|
}
|
|
|
|
|
2011-08-20 09:55:32 +00:00
|
|
|
void
|
|
|
|
tap_param_dlg_cb(GtkAction *action _U_, gpointer data)
|
2003-12-17 22:13:08 +00:00
|
|
|
{
|
2011-06-05 23:16:14 +00:00
|
|
|
const char *filter;
|
2012-06-03 22:03:05 +00:00
|
|
|
char *display_name;
|
2011-06-05 23:16:14 +00:00
|
|
|
char *title;
|
|
|
|
GtkWidget *dlg_box;
|
2011-06-06 01:04:56 +00:00
|
|
|
GtkWidget *item_box, *item, *label, *filter_bt;
|
2011-06-05 23:16:14 +00:00
|
|
|
GtkWidget *bbox, *start_button, *cancel_button;
|
2011-06-06 01:04:56 +00:00
|
|
|
size_t i, j;
|
|
|
|
char *label_with_colon;
|
2011-07-26 17:46:19 +00:00
|
|
|
|
2011-06-05 23:16:14 +00:00
|
|
|
tap_param_dlg *dlg_data = (tap_param_dlg *) data;
|
|
|
|
|
|
|
|
if(dlg_data==NULL)
|
|
|
|
return;
|
2011-07-26 17:46:19 +00:00
|
|
|
|
2011-06-05 23:16:14 +00:00
|
|
|
if(dlg_data->index==-1) {
|
|
|
|
/* Dialog is not registered */
|
|
|
|
if(start_dlg_list==NULL) {
|
|
|
|
start_dlg_list = (tap_param_dlg_list_item *) g_malloc(sizeof (tap_param_dlg_list_item));
|
|
|
|
end_dlg_list = start_dlg_list;
|
|
|
|
end_dlg_list->cont.index = 0; /* first entry in list -> index = 0 */
|
|
|
|
} else {
|
|
|
|
end_dlg_list->next = (tap_param_dlg_list_item *) g_malloc(sizeof (tap_param_dlg_list_item));
|
|
|
|
end_dlg_list->next->cont.index = end_dlg_list->cont.index + 1;
|
|
|
|
end_dlg_list = end_dlg_list->next;
|
|
|
|
}
|
|
|
|
end_dlg_list->dlg = NULL;
|
2013-03-21 02:29:09 +00:00
|
|
|
end_dlg_list->param_items = (GtkWidget **)g_malloc(dlg_data->nparams * sizeof (GtkWidget *));
|
2011-06-05 23:16:14 +00:00
|
|
|
end_dlg_list->cont.win_title = dlg_data->win_title;
|
|
|
|
end_dlg_list->cont.init_string = dlg_data->init_string;
|
|
|
|
end_dlg_list->cont.tap_init_cb = dlg_data->tap_init_cb;
|
|
|
|
end_dlg_list->cont.nparams = dlg_data->nparams;
|
|
|
|
end_dlg_list->cont.params = dlg_data->params;
|
|
|
|
end_dlg_list->args.title = g_strdup_printf("%s Filter", dlg_data->win_title);
|
|
|
|
end_dlg_list->args.wants_apply_button = TRUE;
|
|
|
|
end_dlg_list->args.activate_on_ok = FALSE;
|
2005-12-31 17:09:27 +00:00
|
|
|
end_dlg_list->args.modal_and_transient = FALSE;
|
2011-06-05 23:16:14 +00:00
|
|
|
end_dlg_list->next = NULL;
|
|
|
|
dlg_data->index = end_dlg_list->cont.index;
|
|
|
|
current_dlg = end_dlg_list;
|
|
|
|
} else {
|
|
|
|
/* Dialog is registered, find it */
|
|
|
|
current_dlg = start_dlg_list;
|
|
|
|
while(dlg_data->index != current_dlg->cont.index)
|
|
|
|
{
|
|
|
|
if(current_dlg->next == NULL) {
|
|
|
|
/* could not find any dialog */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
current_dlg = current_dlg->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if the window is already open, bring it to front */
|
|
|
|
if(current_dlg->dlg){
|
2011-07-21 20:12:08 +00:00
|
|
|
gdk_window_raise(gtk_widget_get_window(current_dlg->dlg));
|
2011-06-05 23:16:14 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-06-03 22:03:05 +00:00
|
|
|
display_name = cf_get_display_name(&cfile);
|
|
|
|
title = g_strdup_printf("Wireshark: %s: %s", current_dlg->cont.win_title , display_name);
|
|
|
|
g_free(display_name);
|
2011-06-05 23:16:14 +00:00
|
|
|
|
|
|
|
current_dlg->dlg=dlg_window_new(title);
|
|
|
|
gtk_window_set_default_size(GTK_WINDOW(current_dlg->dlg), 300, -1);
|
|
|
|
g_free(title);
|
|
|
|
|
2012-04-21 16:40:14 +00:00
|
|
|
dlg_box=ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 10, FALSE);
|
2011-06-05 23:16:14 +00:00
|
|
|
gtk_container_set_border_width(GTK_CONTAINER(dlg_box), 10);
|
|
|
|
gtk_container_add(GTK_CONTAINER(current_dlg->dlg), dlg_box);
|
|
|
|
gtk_widget_show(dlg_box);
|
|
|
|
|
|
|
|
/* Parameter items */
|
|
|
|
for(i=0;i<current_dlg->cont.nparams;i++) {
|
|
|
|
/* Item box */
|
2012-04-21 16:40:14 +00:00
|
|
|
item_box=ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3, FALSE);
|
2011-06-05 23:16:14 +00:00
|
|
|
|
|
|
|
switch (current_dlg->cont.params[i].type) {
|
|
|
|
|
|
|
|
case PARAM_UINT:
|
2013-06-01 01:23:59 +00:00
|
|
|
/* Label */
|
|
|
|
label_with_colon=g_strdup_printf("%s:", current_dlg->cont.params[i].title);
|
|
|
|
label=gtk_label_new(label_with_colon);
|
|
|
|
g_free(label_with_colon);
|
|
|
|
gtk_box_pack_start(GTK_BOX(item_box), label, FALSE, TRUE, 0);
|
|
|
|
gtk_widget_show(label);
|
|
|
|
|
|
|
|
/* Spin button */
|
|
|
|
item=gtk_spin_button_new_with_range(0, G_MAXUINT, 1);
|
|
|
|
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(item), TRUE);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2011-06-05 23:16:14 +00:00
|
|
|
case PARAM_STRING:
|
|
|
|
/* Label */
|
2011-06-06 01:04:56 +00:00
|
|
|
label_with_colon=g_strdup_printf("%s:", current_dlg->cont.params[i].title);
|
|
|
|
label=gtk_label_new(label_with_colon);
|
|
|
|
g_free(label_with_colon);
|
2011-06-05 23:16:14 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(item_box), label, FALSE, TRUE, 0);
|
|
|
|
gtk_widget_show(label);
|
2011-06-06 01:04:56 +00:00
|
|
|
|
|
|
|
/* Entry */
|
|
|
|
item=gtk_entry_new();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARAM_ENUM:
|
|
|
|
/* Label */
|
|
|
|
label_with_colon=g_strdup_printf("%s:", current_dlg->cont.params[i].title);
|
|
|
|
label=gtk_label_new(label_with_colon);
|
|
|
|
g_free(label_with_colon);
|
|
|
|
gtk_box_pack_start(GTK_BOX(item_box), label, FALSE, TRUE, 0);
|
|
|
|
gtk_widget_show(label);
|
|
|
|
|
|
|
|
/* Combo box */
|
2011-07-24 18:03:53 +00:00
|
|
|
item=gtk_combo_box_text_new();
|
2011-06-06 01:04:56 +00:00
|
|
|
for (j = 0; current_dlg->cont.params[i].enum_vals[j].name != NULL;
|
|
|
|
j++)
|
2011-07-24 18:03:53 +00:00
|
|
|
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(item),
|
2011-06-06 01:04:56 +00:00
|
|
|
current_dlg->cont.params[i].enum_vals[j].description);
|
|
|
|
gtk_combo_box_set_active(GTK_COMBO_BOX(item), 0);
|
2011-06-05 23:16:14 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case PARAM_FILTER:
|
|
|
|
/* Filter button */
|
|
|
|
filter_bt=gtk_button_new_from_stock(WIRESHARK_STOCK_DISPLAY_FILTER_ENTRY);
|
|
|
|
g_signal_connect(filter_bt, "clicked", G_CALLBACK(display_filter_construct_cb), &(current_dlg->args));
|
|
|
|
gtk_box_pack_start(GTK_BOX(item_box), filter_bt, FALSE, TRUE, 0);
|
|
|
|
gtk_widget_show(filter_bt);
|
|
|
|
|
2011-06-06 01:04:56 +00:00
|
|
|
/* Entry */
|
|
|
|
item=gtk_entry_new();
|
2011-12-29 11:54:08 +00:00
|
|
|
g_signal_connect(item, "changed", G_CALLBACK(filter_te_syntax_check_cb), NULL);
|
|
|
|
g_object_set_data(G_OBJECT(item_box), E_FILT_AUTOCOMP_PTR_KEY, NULL);
|
|
|
|
g_signal_connect(item, "key-press-event", G_CALLBACK (filter_string_te_key_pressed_cb), NULL);
|
|
|
|
g_signal_connect(current_dlg->dlg, "key-press-event", G_CALLBACK (filter_parent_dlg_key_pressed_cb), NULL);
|
|
|
|
g_object_set_data(G_OBJECT(filter_bt), E_FILT_TE_PTR_KEY, item);
|
|
|
|
|
2011-06-05 23:16:14 +00:00
|
|
|
filter=gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
|
|
|
|
if(filter){
|
2011-06-06 01:04:56 +00:00
|
|
|
gtk_entry_set_text(GTK_ENTRY(item), filter);
|
2011-06-05 23:16:14 +00:00
|
|
|
} else {
|
2011-06-06 01:04:56 +00:00
|
|
|
colorize_filter_te_as_empty(item);
|
2011-06-05 23:16:14 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-06-06 01:04:56 +00:00
|
|
|
g_assert_not_reached();
|
|
|
|
item=NULL;
|
2011-06-05 23:16:14 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-07-26 17:46:19 +00:00
|
|
|
|
2011-06-06 01:04:56 +00:00
|
|
|
gtk_box_pack_start(GTK_BOX(item_box), item, TRUE, TRUE, 0);
|
|
|
|
current_dlg->param_items[i]=item;
|
|
|
|
gtk_widget_show(item);
|
2011-06-05 23:16:14 +00:00
|
|
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(dlg_box), item_box, TRUE, TRUE, 0);
|
|
|
|
gtk_widget_show(item_box);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* button box */
|
|
|
|
bbox = dlg_button_row_new(WIRESHARK_STOCK_CREATE_STAT, GTK_STOCK_CANCEL, NULL);
|
|
|
|
gtk_box_pack_start(GTK_BOX(dlg_box), bbox, FALSE, FALSE, 0);
|
|
|
|
gtk_widget_show(bbox);
|
|
|
|
|
2013-03-21 02:29:09 +00:00
|
|
|
start_button = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), WIRESHARK_STOCK_CREATE_STAT);
|
2011-06-05 23:16:14 +00:00
|
|
|
g_signal_connect(start_button, "clicked",
|
|
|
|
G_CALLBACK(tap_param_dlg_start_button_clicked), current_dlg);
|
|
|
|
|
2013-03-21 02:29:09 +00:00
|
|
|
cancel_button = (GtkWidget *)g_object_get_data(G_OBJECT(bbox), GTK_STOCK_CANCEL);
|
2011-06-05 23:16:14 +00:00
|
|
|
window_set_cancel_button(current_dlg->dlg, cancel_button, window_cancel_button_cb);
|
|
|
|
|
|
|
|
/* Catch the "activate" signal on all the text entries, so that
|
|
|
|
if the user types Return there, we act as if the "Create Stat"
|
|
|
|
button had been selected, as happens if Return is typed if
|
|
|
|
some widget that *doesn't* handle the Return key has the input
|
|
|
|
focus. */
|
|
|
|
for(i=0;i<current_dlg->cont.nparams;i++){
|
2011-06-06 01:04:56 +00:00
|
|
|
switch (current_dlg->cont.params[i].type) {
|
|
|
|
|
2013-06-01 01:23:59 +00:00
|
|
|
case PARAM_UINT:
|
2011-06-06 01:04:56 +00:00
|
|
|
case PARAM_ENUM:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PARAM_STRING:
|
|
|
|
case PARAM_FILTER:
|
|
|
|
dlg_set_activate(current_dlg->param_items[i], start_button);
|
|
|
|
break;
|
|
|
|
}
|
2011-06-05 23:16:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Give the initial focus to the first entry box. */
|
|
|
|
if(current_dlg->cont.nparams>0){
|
2011-06-06 01:04:56 +00:00
|
|
|
gtk_widget_grab_focus(current_dlg->param_items[0]);
|
2011-06-05 23:16:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_grab_default(start_button );
|
|
|
|
|
|
|
|
g_signal_connect(current_dlg->dlg, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
|
|
|
|
g_signal_connect(current_dlg->dlg, "destroy", G_CALLBACK(dlg_destroy_cb), current_dlg);
|
|
|
|
|
|
|
|
gtk_widget_show_all(current_dlg->dlg);
|
|
|
|
window_present(current_dlg->dlg);
|
2003-12-17 22:13:08 +00:00
|
|
|
}
|