aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-04-16 20:08:00 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-04-16 20:08:00 +0000
commit83dc83abd8dca40a7ee13b97855dbda4f01737ec (patch)
tree3bac5a359bfb27c7a0c59f4cd0b7ed229ff1208e
parent708dae1a17665c8dd4ccac770e4b509dc09fc0b1 (diff)
rename capture_clear() to capture_restart()
statusbar update should work now even in capture error case svn path=/trunk/; revision=14105
-rw-r--r--capture.c14
-rw-r--r--capture.h4
-rw-r--r--gtk/capture_dlg.c4
-rw-r--r--gtk/capture_dlg.h4
-rw-r--r--gtk/main.c3
-rw-r--r--gtk/menu.c2
-rw-r--r--gtk/toolbar.c2
7 files changed, 23 insertions, 10 deletions
diff --git a/capture.c b/capture.c
index e6cfde0fde..07b751e9ec 100644
--- a/capture.c
+++ b/capture.c
@@ -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;
}
diff --git a/capture.h b/capture.h
index 98cafb1cc7..b903b2e71e 100644
--- a/capture.h
+++ b/capture.h
@@ -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);
diff --git a/gtk/capture_dlg.c b/gtk/capture_dlg.c
index b4271e0ea5..952734cb41 100644
--- a/gtk/capture_dlg.c
+++ b/gtk/capture_dlg.c
@@ -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
diff --git a/gtk/capture_dlg.h b/gtk/capture_dlg.h
index 70921784f2..2d76a848bd 100644
--- a/gtk/capture_dlg.h
+++ b/gtk/capture_dlg.h
@@ -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.
*/
diff --git a/gtk/main.c b/gtk/main.c
index 268cdce830..9447b6a992 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -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>");
diff --git a/gtk/menu.c b/gtk/menu.c
index b217f6f6ba..84597557d5 100644
--- a/gtk/menu.c
+++ b/gtk/menu.c
@@ -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),
diff --git a/gtk/toolbar.c b/gtk/toolbar.c
index 80c16af37d..5eaef1f315 100644
--- a/gtk/toolbar.c
+++ b/gtk/toolbar.c
@@ -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 */