In effect, disable closing the main window while a capture is being

stopped - there's no guaranteed way to make the UI's close button
inactive (on X11, it depends on whether the window manager allows that),
but we can just do nothing and return TRUE from the delete event handler
to ignore the delete event.

svn path=/trunk/; revision=43252
This commit is contained in:
Guy Harris 2012-06-14 03:50:39 +00:00
parent 9a0ba17ea5
commit 21d35d275a
1 changed files with 17 additions and 0 deletions

View File

@ -205,6 +205,8 @@ extern gint if_list_comparator_alph (const void *first_arg, const void *second_a
capture_file cfile;
static gboolean capture_stopping;
/* "exported" main widgets */
GtkWidget *top_level = NULL, *pkt_scrollw, *tree_view_gbl, *byte_nb_ptr_gbl;
@ -1009,6 +1011,11 @@ main_do_quit(void)
static gboolean
main_window_delete_event_cb(GtkWidget *widget _U_, GdkEvent *event _U_, gpointer data _U_)
{
/* If we're in the middle of stopping a capture, don't do anything;
the user can try deleting the window after the capture stops. */
if (capture_stopping)
return TRUE;
/* If there's unsaved data, let the user save it first.
If they cancel out of it, don't quit. */
if (do_file_close(&cfile, TRUE, " before quitting"))
@ -1602,6 +1609,9 @@ main_capture_cb_capture_update_finished(capture_options *capture_opts)
capture_file *cf = capture_opts->cf;
static GList *icon_list = NULL;
/* The capture isn't stopping any more - it's stopped. */
capture_stopping = FALSE;
if (!cf->is_tempfile && cf->filename) {
/* Add this filename to the list of recent files in the "Recent Files" submenu */
add_menu_recent_capture_file(cf->filename);
@ -1645,6 +1655,9 @@ main_capture_cb_capture_fixed_finished(capture_options *capture_opts _U_)
#endif
static GList *icon_list = NULL;
/* The capture isn't stopping any more - it's stopped. */
capture_stopping = FALSE;
/*set_display_filename(cf);*/
/* Enable menu items that make sense if you're not currently running
@ -1674,6 +1687,7 @@ main_capture_cb_capture_fixed_finished(capture_options *capture_opts _U_)
static void
main_capture_cb_capture_stopping(capture_options *capture_opts _U_)
{
capture_stopping = TRUE;
set_menus_for_capture_stopping();
}
@ -1682,6 +1696,9 @@ main_capture_cb_capture_failed(capture_options *capture_opts _U_)
{
static GList *icon_list = NULL;
/* Capture isn't stopping any more. */
capture_stopping = FALSE;
/* the capture failed before the first packet was captured
reset title, menus and icon */