forked from osmocom/wireshark
Disable some menu items and toolbar items while we're waiting for a
capture to stop, so that we don't try to quit while we're in the middle of quitting or try to stop or restart the capture we're in the middle of stopping. svn path=/trunk/; revision=43250
This commit is contained in:
parent
d86f0b5271
commit
e1ec927708
|
@ -368,6 +368,15 @@ set_capture_if_dialog_for_capture_in_progress(gboolean capture_in_progress)
|
|||
}
|
||||
}
|
||||
|
||||
/* a live capture is being stopped */
|
||||
void
|
||||
set_capture_if_dialog_for_capture_stopping(void)
|
||||
{
|
||||
if (cap_if_w) {
|
||||
gtk_widget_set_sensitive(stop_bt, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* the window was closed, cleanup things */
|
||||
static void
|
||||
|
|
|
@ -25,13 +25,17 @@
|
|||
#ifndef __CAPTURE_IF_DLG_H__
|
||||
#define __CAPTURE_IF_DLG_H__
|
||||
|
||||
/** User requested the "Capture Interfaces" dialog box by menu or toolbar.
|
||||
/** A live capture has started or stopped.
|
||||
*
|
||||
* @param capture_in_progress capture is in progress
|
||||
*/
|
||||
void
|
||||
set_capture_if_dialog_for_capture_in_progress(gboolean capture_in_progress);
|
||||
|
||||
/** A live capture is being stopped.
|
||||
*/
|
||||
void set_capture_if_dialog_for_capture_stopping(void);
|
||||
|
||||
/** User requested the "Capture Interfaces" dialog box by menu or toolbar.
|
||||
*
|
||||
* @param widget parent widget (unused)
|
||||
|
|
|
@ -1671,6 +1671,12 @@ main_capture_cb_capture_fixed_finished(capture_options *capture_opts _U_)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
main_capture_cb_capture_stopping(capture_options *capture_opts _U_)
|
||||
{
|
||||
set_menus_for_capture_stopping();
|
||||
}
|
||||
|
||||
static void
|
||||
main_capture_cb_capture_failed(capture_options *capture_opts _U_)
|
||||
{
|
||||
|
@ -1863,6 +1869,7 @@ main_capture_callback(gint event, capture_options *capture_opts, gpointer user_d
|
|||
theApp = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
|
||||
gtk_osxapplication_set_dock_icon_pixbuf(theApp,gdk_pixbuf_new_from_xpm_data(wsicon64_xpm));
|
||||
#endif
|
||||
main_capture_cb_capture_stopping(capture_opts);
|
||||
break;
|
||||
case(capture_cb_capture_failed):
|
||||
g_log(LOG_DOMAIN_MAIN, G_LOG_LEVEL_DEBUG, "Callback: capture failed");
|
||||
|
|
|
@ -4677,6 +4677,26 @@ set_menus_for_capture_in_progress(gboolean capture_in_progress)
|
|||
}
|
||||
|
||||
|
||||
/* Disable menu items while we're waiting for the capture child to
|
||||
finish. We disallow quitting until it finishes, and also disallow
|
||||
stopping or restarting the capture. */
|
||||
void
|
||||
set_menus_for_capture_stopping(void)
|
||||
{
|
||||
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/FileMenu/Quit",
|
||||
FALSE);
|
||||
#ifdef HAVE_LIBPCAP
|
||||
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Stop",
|
||||
FALSE);
|
||||
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Restart",
|
||||
FALSE);
|
||||
set_toolbar_for_capture_stopping();
|
||||
|
||||
set_capture_if_dialog_for_capture_stopping();
|
||||
#endif /* HAVE_LIBPCAP */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
set_menus_for_captured_packets(gboolean have_captured_packets)
|
||||
{
|
||||
|
|
|
@ -191,6 +191,24 @@ void set_toolbar_for_capture_in_progress(gboolean capture_in_progress) {
|
|||
}
|
||||
}
|
||||
|
||||
/* set toolbar state "stopping a capture" */
|
||||
void set_toolbar_for_capture_stopping(void) {
|
||||
|
||||
if (toolbar_init) {
|
||||
#ifdef HAVE_LIBPCAP
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(stop_button), FALSE);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(clear_button), FALSE);
|
||||
/*if (capture_in_progress) {
|
||||
gtk_widget_hide(GTK_WIDGET(new_button));
|
||||
gtk_widget_show(GTK_WIDGET(stop_button));
|
||||
} else {
|
||||
gtk_widget_show(GTK_WIDGET(new_button));
|
||||
gtk_widget_hide(GTK_WIDGET(stop_button));
|
||||
}*/
|
||||
#endif /* HAVE_LIBPCAP */
|
||||
}
|
||||
}
|
||||
|
||||
/* set toolbar state "have packets captured" */
|
||||
void set_toolbar_for_captured_packets(gboolean have_captured_packets) {
|
||||
|
||||
|
|
|
@ -46,6 +46,10 @@ void toolbar_redraw_all(void);
|
|||
*/
|
||||
void set_toolbar_for_capture_in_progress(gboolean have_capture_file);
|
||||
|
||||
/** The capture is in the process of being stopped.
|
||||
*/
|
||||
void set_toolbar_for_capture_stopping(void);
|
||||
|
||||
/** We have (or don't have) captured packets now.
|
||||
*
|
||||
* @param have_captured_packets TRUE, if we have captured packets
|
||||
|
|
|
@ -121,6 +121,11 @@ void set_menus_for_selected_tree_row(capture_file *cf);
|
|||
progress. */
|
||||
void set_menus_for_capture_in_progress(gboolean);
|
||||
|
||||
/* Disable menu items while we're waiting for the capture child to
|
||||
finish. We disallow quitting until it finishes, and also disallow
|
||||
stopping or restarting the capture. */
|
||||
void set_menus_for_capture_stopping(void);
|
||||
|
||||
/* Enable or disable menu items based on whether you have some captured
|
||||
packets. */
|
||||
void set_menus_for_captured_packets(gboolean);
|
||||
|
|
Loading…
Reference in New Issue