Ethereal-dev: [Ethereal-dev] [patch] Why do I have to START a capture after setting the option
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Jaap Keuter <jaap.keuter@xxxxxxxxx>
Date: Mon, 4 Jul 2005 08:54:50 +0200 (CEST)
Hello list, Why do I have to START a capture after setting the options? I find myself in situations in which I want to setup the capture options, then prepare some test setup and launch a capture from the toolbar. So I've added an Ok button to the Capture options dialog. This saves the options and closes the dialog box. No worries, the Start button is still the default, so the keyboard interface isn't changed. Greetings, Jaap
Index: capture_dlg.c =================================================================== --- capture_dlg.c (revision 14840) +++ capture_dlg.c (working copy) @@ -116,6 +116,9 @@ capture_prep_file_cb(GtkWidget *file_bt, GtkWidget *file_te); static void +capture_ok_cb(GtkWidget *w, gpointer data); + +static void select_link_type_cb(GtkWidget *w, gpointer data); static void @@ -532,7 +535,7 @@ *resolv_fr, *resolv_vb, *m_resolv_cb, *n_resolv_cb, *t_resolv_cb, - *bbox, *ok_bt, *cancel_bt, + *bbox, *cap_bt, *ok_bt, *cancel_bt, *help_bt; #if GTK_MAJOR_VERSION < 2 GtkAccelGroup *accel_group; @@ -1093,13 +1096,18 @@ "Perform transport layer name resolution while capturing.", NULL); gtk_container_add(GTK_CONTAINER(resolv_vb), t_resolv_cb); - /* Button row: "Start" and "Cancel" buttons */ - bbox = dlg_button_row_new(ETHEREAL_STOCK_CAPTURE_START, GTK_STOCK_CANCEL, GTK_STOCK_HELP, NULL); + /* Button row: "Ok", "Start" and "Cancel" buttons */ + bbox = dlg_button_row_new(GTK_STOCK_OK, ETHEREAL_STOCK_CAPTURE_START, GTK_STOCK_CANCEL, GTK_STOCK_HELP, NULL); gtk_box_pack_start(GTK_BOX(main_vb), bbox, FALSE, FALSE, 5); - ok_bt = OBJECT_GET_DATA(bbox, ETHEREAL_STOCK_CAPTURE_START); - SIGNAL_CONNECT(ok_bt, "clicked", capture_start_cb, cap_open_w); + ok_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_OK); + SIGNAL_CONNECT(ok_bt, "clicked", capture_ok_cb, cap_open_w); gtk_tooltips_set_tip(tooltips, ok_bt, + "Save the capture options.", NULL); + + cap_bt = OBJECT_GET_DATA(bbox, ETHEREAL_STOCK_CAPTURE_START); + SIGNAL_CONNECT(cap_bt, "clicked", capture_start_cb, cap_open_w); + gtk_tooltips_set_tip(tooltips, cap_bt, "Start the capture process.", NULL); cancel_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CANCEL); @@ -1112,7 +1120,7 @@ "Show help about capturing.", NULL); SIGNAL_CONNECT(help_bt, "clicked", topic_cb, HELP_CAPTURE_OPTIONS_DIALOG); - gtk_widget_grab_default(ok_bt); + gtk_widget_grab_default(cap_bt); /* Attach pointers to needed widgets to the capture prefs window/object */ OBJECT_SET_DATA(cap_open_w, E_CAP_IFACE_KEY, if_cb); @@ -1162,9 +1170,9 @@ entries, so that if the user types Return there, we act as if the "OK" button had been selected, as happens if Return is typed if some widget that *doesn't* handle the Return key has the input focus. */ - dlg_set_activate(GTK_COMBO(if_cb)->entry, ok_bt); - dlg_set_activate(filter_te, ok_bt); - dlg_set_activate(file_te, ok_bt); + dlg_set_activate(GTK_COMBO(if_cb)->entry, cap_bt); + dlg_set_activate(filter_te, cap_bt); + dlg_set_activate(file_te, cap_bt); /* XXX - why does not @@ -1257,6 +1265,20 @@ } } +/* user pressed the "Ok" button */ +static void +capture_ok_cb(GtkWidget *w _U_, gpointer d _U_) +{ + gpointer dialog; + + + /* get the values and close the options dialog */ + if(cap_open_w) { + capture_dlg_prep(cap_open_w); + window_destroy(GTK_WIDGET(cap_open_w)); + } +} + /* user pressed the "Start" button (in dialog or toolbar) */ void capture_start_cb(GtkWidget *w _U_, gpointer d _U_)
- Prev by Date: Re: [Ethereal-dev] Improving rendered output of User and Developer Guide
- Next by Date: Re: [Ethereal-dev] Improving rendered output of User and Developer Guide
- Previous by thread: Re: [Ethereal-dev] Improving rendered output of User and Developer Guide
- Next by thread: [Ethereal-dev] buildbot failure in FreeBSD 5.3 (IA64)
- Index(es):