rename capture_clear() to capture_restart()

statusbar update should work now even in capture error case

svn path=/trunk/; revision=14105
This commit is contained in:
Ulf Lamping 2005-04-16 20:08:00 +00:00
parent 708dae1a17
commit 83dc83abd8
7 changed files with 23 additions and 10 deletions

View File

@ -104,7 +104,7 @@ capture_stop(capture_options *capture_opts)
void
capture_clear(capture_options *capture_opts)
capture_restart(capture_options *capture_opts)
{
capture_opts->restart = TRUE;
capture_stop(capture_opts);
@ -263,6 +263,8 @@ capture_input_new_packets(capture_options *capture_opts, int to_read)
int err;
g_assert(capture_opts->save_file);
if(capture_opts->real_time_mode) {
/* Read from the capture file the number of records the child told us
it added.
@ -296,6 +298,15 @@ capture_input_closed(capture_options *capture_opts)
int err;
/* if we have no file (happens if an error occured), do a fake start */
if(capture_opts->save_file == NULL) {
if(capture_opts->real_time_mode) {
cf_callback_invoke(cf_cb_live_capture_update_started, capture_opts);
} else {
cf_callback_invoke(cf_cb_live_capture_fixed_started, capture_opts);
}
}
if(capture_opts->real_time_mode) {
/* first of all, we are not doing a capture any more */
cf_callback_invoke(cf_cb_live_capture_update_finished, capture_opts->cf);
@ -339,6 +350,7 @@ capture_input_closed(capture_options *capture_opts)
/* if we couldn't open a capture file, there's nothing more for us to do */
if(capture_opts->save_file == NULL) {
cf_close(capture_opts->cf);
return;
}

View File

@ -107,8 +107,8 @@ extern gboolean capture_start(capture_options *capture_opts);
/** Stop a capture session (usually from a menu item). */
extern void capture_stop(capture_options *capture_opts);
/** Clear the current captured packets and start again. */
extern void capture_clear(capture_options *capture_opts);
/** Restart the current captured packets and start again. */
extern void capture_restart(capture_options *capture_opts);
/** Terminate the capture child cleanly when exiting. */
extern void capture_kill_child(capture_options *capture_opts);

View File

@ -165,9 +165,9 @@ capture_stop_cb(GtkWidget *w _U_, gpointer d _U_)
}
void
capture_clear_cb(GtkWidget *w _U_, gpointer d _U_)
capture_restart_cb(GtkWidget *w _U_, gpointer d _U_)
{
capture_clear(capture_opts);
capture_restart(capture_opts);
}
static void

View File

@ -52,12 +52,12 @@ void capture_start_cb(GtkWidget *widget, gpointer data);
*/
void capture_stop_cb(GtkWidget *widget, gpointer data);
/** User requested capture clear by menu or toolbar.
/** User requested capture restart by menu or toolbar.
*
* @param widget parent widget (unused)
* @param data unused
*/
void capture_clear_cb(GtkWidget *widget, gpointer data);
void capture_restart_cb(GtkWidget *widget, gpointer data);
/** Create the "Capture Options" dialog box.
*/

View File

@ -1357,7 +1357,8 @@ main_cf_cb_live_capture_fixed_started(capture_options *capture_opts)
/*set_menus_for_captured_packets(TRUE);*/
capture_msg = g_strdup_printf(" %s: <live capture in progress> to file: %s",
get_interface_descriptive_name(capture_opts->iface), capture_opts->save_file);
get_interface_descriptive_name(capture_opts->iface),
(capture_opts->save_file) ? capture_opts->save_file : "");
statusbar_push_file_msg(capture_msg);
gtk_statusbar_push(GTK_STATUSBAR(packets_bar), packets_ctx, " <capturing>");

View File

@ -305,7 +305,7 @@ static GtkItemFactoryEntry menu_items[] =
capture_start_cb, 0, ETHEREAL_STOCK_CAPTURE_START),
ITEM_FACTORY_STOCK_ENTRY("/Capture/S_top", "<control>E", capture_stop_cb,
0, ETHEREAL_STOCK_CAPTURE_STOP),
ITEM_FACTORY_STOCK_ENTRY("/Capture/_Restart", NULL, capture_clear_cb,
ITEM_FACTORY_STOCK_ENTRY("/Capture/_Restart", NULL, capture_restart_cb,
0, ETHEREAL_STOCK_CAPTURE_RESTART),
ITEM_FACTORY_STOCK_ENTRY("/Capture/Capture _Filters...", NULL, cfilter_dialog_cb,
0, ETHEREAL_STOCK_CAPTURE_FILTER),

View File

@ -502,7 +502,7 @@ toolbar_new(void)
toolbar_item(stop_button, window, main_tb,
ETHEREAL_STOCK_CAPTURE_STOP, "Stop the running live capture", capture_stop_24_xpm, capture_stop_cb, NULL);
toolbar_item(clear_button, window, main_tb,
ETHEREAL_STOCK_CAPTURE_RESTART, "Restart the running live capture", capture_restart_24_xpm, capture_clear_cb, NULL);
ETHEREAL_STOCK_CAPTURE_RESTART, "Restart the running live capture", capture_restart_24_xpm, capture_restart_cb, NULL);
toolbar_append_separator(main_tb);
#endif /* HAVE_LIBPCAP */