void
cf_close(capture_file *cf)
{
- cf_reset_state(cf);
+ /* close things, if not already closed before */
+ if(cf->state != FILE_CLOSED) {
+
+ cf_callback_invoke(cf_cb_file_closing, cf);
- cleanup_dissection();
+ cf_reset_state(cf);
- cf_callback_invoke(cf_cb_file_closed, cf);
+ cleanup_dissection();
+
+ cf_callback_invoke(cf_cb_file_closed, cf);
+ }
}
cf_read_status_t
to_read--;
}
- packet_list_thaw();
-
/* XXX - this cheats and looks inside the packet list to find the final
row number. */
if (auto_scroll_live && cf->plist_end != NULL)
packet_list_moveto_end();
+ packet_list_thaw();
+
if (cf->state == FILE_READ_ABORTED) {
/* Well, the user decided to exit Ethereal. Return CF_READ_ABORTED
so that our caller can kill off the capture child process;
packet_range_process_init(range);
- /* Used to be :
- * if (!save_filtered && !save_marked && !save_manual_range &&
- * !save_marked_range && !save_curr && save_format == cf->cd_t) {
- */
if (packet_range_process_all(range) && save_format == cf->cd_t) {
/* We're not filtering packets, and we're saving it in the format
g_free(win_name);
}
+GtkWidget *close_dlg = NULL;
static void
-main_cf_cb_file_closed(capture_file *cf)
+main_cf_cb_file_closing(capture_file *cf)
{
+
+ /* if we have more than 10000 packets, show a splash screen while closing */
+ /* XXX - don't know a better way to decide wether to show or not,
+ * as most of the time is spend in a single eth_clist_clear function,
+ * so we can't use a progress bar here! */
+ if(cf->count > 10000) {
+ close_dlg = simple_dialog(ESD_TYPE_STOP, ESD_BTN_NONE, "%sClosing file!%s\n\nPlease wait ...",
+ simple_dialog_primary_start(), simple_dialog_primary_end());
+#if GTK_MAJOR_VERSION >= 2
+ gtk_window_set_position(GTK_WINDOW(close_dlg), GTK_WIN_POS_CENTER_ON_PARENT);
+#else
+ gtk_window_set_position(GTK_WINDOW(close_dlg), GTK_WIN_POS_CENTER);
+#endif
+ }
+
/* Destroy all windows, which refer to the
capture file we're closing. */
destroy_cfile_wins();
/* Set up main window for no capture file. */
main_set_for_capture_file(FALSE);
+
+ main_window_update();
+}
+
+static void
+main_cf_cb_file_closed(capture_file *cf)
+{
+ if(close_dlg != NULL) {
+ splash_destroy(close_dlg);
+ close_dlg = NULL;
+ }
}
static void
statusbar_push_file_msg(capture_msg);
}
+GtkWidget * stop_dlg = NULL;
+
static void
main_cf_cb_live_capture_update_finished(capture_file *cf)
{
+ if(stop_dlg != NULL) {
+ simple_dialog_close(stop_dlg);
+ stop_dlg = NULL;
+ }
+
/* Pop the "<live capture in progress>" message off the status bar. */
statusbar_pop_file_msg();
static void
main_cf_cb_live_capture_fixed_finished(capture_file *cf _U_)
{
+ if(stop_dlg != NULL) {
+ simple_dialog_close(stop_dlg);
+ stop_dlg = NULL;
+ }
+
/* Pop the "<live capture in progress>" message off the status bar. */
statusbar_pop_file_msg();
/* We don't have loaded the capture file, this will be done later.
* For now we still have simply a blank screen. */
}
+
+static void
+main_cf_cb_live_capture_stopping(capture_file *cf _U_)
+{
+ stop_dlg = simple_dialog(ESD_TYPE_STOP, ESD_BTN_NONE, "%sCapture stop!%s\n\nPlease wait ...",
+ simple_dialog_primary_start(), simple_dialog_primary_end());
+#if GTK_MAJOR_VERSION >= 2
+ gtk_window_set_position(GTK_WINDOW(stop_dlg), GTK_WIN_POS_CENTER_ON_PARENT);
+#else
+ gtk_window_set_position(GTK_WINDOW(stop_dlg), GTK_WIN_POS_CENTER);
+#endif
+}
+
#endif
static void
static void main_cf_callback(gint event, gpointer data, gpointer user_data _U_)
{
switch(event) {
+ case(cf_cb_file_closing):
+ main_cf_cb_file_closing(data);
+ break;
case(cf_cb_file_closed):
main_cf_cb_file_closed(data);
break;
case(cf_cb_live_capture_fixed_finished):
main_cf_cb_live_capture_fixed_finished(data);
break;
+ case(cf_cb_live_capture_stopping):
+ main_cf_cb_live_capture_stopping(data);
+ break;
#endif
case(cf_cb_packet_selected):
main_cf_cb_packet_selected(data);