forked from osmocom/wireshark
Change the sensitivity of the start button depending on the number of interfaces selected.
svn path=/trunk/; revision=48827
This commit is contained in:
parent
267a89b1f4
commit
a17ec349b4
|
@ -2449,6 +2449,7 @@ update_options_table(gint indx)
|
|||
change_interface_selection(g_strdup(device.name), device.selected);
|
||||
}
|
||||
}
|
||||
set_sensitivity_for_start_icon();
|
||||
}
|
||||
|
||||
|
||||
|
@ -3190,6 +3191,7 @@ static void capture_all_cb(GtkToggleButton *button, gpointer d _U_)
|
|||
gtk_widget_set_sensitive(all_compile_bt, FALSE);
|
||||
#endif
|
||||
}
|
||||
set_sensitivity_for_start_icon();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4825,6 +4825,8 @@ set_menus_for_capture_in_progress(gboolean capture_in_progress)
|
|||
!capture_in_progress);
|
||||
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Start",
|
||||
!capture_in_progress);
|
||||
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Start",
|
||||
global_capture_opts.num_selected > 0);
|
||||
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Stop",
|
||||
capture_in_progress);
|
||||
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Restart",
|
||||
|
@ -4832,6 +4834,12 @@ set_menus_for_capture_in_progress(gboolean capture_in_progress)
|
|||
#endif /* HAVE_LIBPCAP */
|
||||
}
|
||||
|
||||
void
|
||||
set_menus_capture_start_sensitivity(gboolean enable)
|
||||
{
|
||||
set_menu_sensitivity(ui_manager_main_menubar, "/Menubar/CaptureMenu/Start",
|
||||
enable);
|
||||
}
|
||||
|
||||
/* Disable menu items while we're waiting for the capture child to
|
||||
finish. We disallow quitting until it finishes, and also disallow
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include "ui/gtk/keys.h"
|
||||
#include "ui/gtk/packet_history.h"
|
||||
#include "ui/gtk/packet_list.h"
|
||||
#include "ui/capture_globals.h"
|
||||
|
||||
#include "ui/gtk/old-gtk-compat.h"
|
||||
|
||||
|
@ -97,6 +98,10 @@ toolbar_redraw_all(void)
|
|||
(GtkToolbarStyle)prefs.gui_toolbar_filter_style);
|
||||
}
|
||||
|
||||
void set_start_button_sensitive(gboolean enable) {
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(new_button), enable);
|
||||
}
|
||||
|
||||
/* Enable or disable toolbar items based on whether you have a capture file
|
||||
and, if so, whether you've finished reading it and whether there's stuff
|
||||
in it that hasn't yet been saved to a permanent file. */
|
||||
|
@ -136,10 +141,13 @@ void set_toolbar_for_capture_in_progress(gboolean capture_in_progress) {
|
|||
|
||||
if (toolbar_init) {
|
||||
#ifdef HAVE_LIBPCAP
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(capture_options_button), !capture_in_progress);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(capture_options_button), !capture_in_progress);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(new_button), !capture_in_progress);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(stop_button), capture_in_progress);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(clear_button), capture_in_progress);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(clear_button), capture_in_progress);
|
||||
if (!capture_in_progress) {
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(new_button), (global_capture_opts.num_selected > 0));
|
||||
}
|
||||
/*if (capture_in_progress) {
|
||||
gtk_widget_hide(GTK_WIDGET(new_button));
|
||||
gtk_widget_show(GTK_WIDGET(stop_button));
|
||||
|
|
|
@ -44,4 +44,7 @@ void toolbar_redraw_all(void);
|
|||
*/
|
||||
void set_toolbar_object_data(const gchar *key, gpointer data);
|
||||
|
||||
void set_start_button_sensitive(gboolean enable);
|
||||
void set_menus_capture_start_sensitivity(gboolean enable);
|
||||
|
||||
#endif /* __TOOLBAR_H__ */
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "ui/gtk/main.h"
|
||||
#include "ui/gtk/menus.h"
|
||||
#include "ui/gtk/main_welcome.h"
|
||||
#include "ui/gtk/main_toolbar.h"
|
||||
#include "ui/gtk/help_dlg.h"
|
||||
#include "ui/gtk/capture_file_dlg.h"
|
||||
#include "ui/gtk/stock_icons.h"
|
||||
|
@ -751,9 +752,19 @@ gboolean on_selection_changed(GtkTreeSelection *selection _U_,
|
|||
break;
|
||||
}
|
||||
}
|
||||
set_sensitivity_for_start_icon();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
set_sensitivity_for_start_icon()
|
||||
{
|
||||
gboolean enable = (global_capture_opts.num_selected > 0);
|
||||
|
||||
set_start_button_sensitive(enable);
|
||||
set_menus_capture_start_sensitivity(enable);
|
||||
}
|
||||
|
||||
static gboolean activate_ifaces(GtkTreeModel *model,
|
||||
GtkTreePath *path _U_,
|
||||
GtkTreeIter *iter,
|
||||
|
|
|
@ -76,6 +76,8 @@ void change_selection_for_all(gboolean enable);
|
|||
|
||||
void update_welcome_list(void);
|
||||
|
||||
void set_sensitivity_for_start_icon(void);
|
||||
|
||||
#ifdef HAVE_PCAP_REMOTE
|
||||
void add_interface_to_list(guint index);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue