diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2017-02-16 10:41:58 +0100 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2017-02-16 20:53:22 +0000 |
commit | 14e19128dca1b318896ab7768d4527723dbefd17 (patch) | |
tree | 08f677e469805715b5b17bd5d24927f5a49de0bd | |
parent | 384c26622b0adc7eda415ba6e2a9fc704cd27794 (diff) | |
download | wireshark-14e19128dca1b318896ab7768d4527723dbefd17.tar.gz wireshark-14e19128dca1b318896ab7768d4527723dbefd17.tar.bz2 wireshark-14e19128dca1b318896ab7768d4527723dbefd17.zip |
Qt: Disable pane menu items if not used in layout
If a pane is not used in the layout it should not be possible to show
and hide this from the menu, as this may give unexpected results.
Change-Id: I335168e66e1dffc89992cad480dd7daaea7e9d59
Reviewed-on: https://code.wireshark.org/review/20140
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
-rw-r--r-- | debian/libwireshark0.symbols | 1 | ||||
-rw-r--r-- | epan/prefs.c | 8 | ||||
-rw-r--r-- | epan/prefs.h | 5 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 10 |
4 files changed, 21 insertions, 3 deletions
diff --git a/debian/libwireshark0.symbols b/debian/libwireshark0.symbols index 8c174b9eb9..35ae0cbb5c 100644 --- a/debian/libwireshark0.symbols +++ b/debian/libwireshark0.symbols @@ -958,6 +958,7 @@ libwireshark.so.0 libwireshark0 #MINVER# prefs_get_uint_base@Base 2.3.0 prefs_get_uint_value@Base 2.3.0 prefs_get_uint_value_real@Base 2.3.0 + prefs_has_layout_pane_content@Base 2.2.5 prefs_invert_bool_value@Base 2.3.0 prefs_is_capture_device_hidden@Base 1.9.1 prefs_is_registered_protocol@Base 1.9.1 diff --git a/epan/prefs.c b/epan/prefs.c index ac2f25bc08..32462e20a8 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -4812,6 +4812,14 @@ prefs_capture_options_dialog_column_is_visible(const gchar *column) return FALSE; } +gboolean +prefs_has_layout_pane_content (layout_pane_content_e layout_pane_content) +{ + return ((prefs.gui_layout_content_1 == layout_pane_content) || + (prefs.gui_layout_content_2 == layout_pane_content) || + (prefs.gui_layout_content_3 == layout_pane_content)); +} + #define PRS_GUI_FILTER_LABEL "gui.filter_expressions.label" #define PRS_GUI_FILTER_EXPR "gui.filter_expressions.expr" #define PRS_GUI_FILTER_ENABLED "gui.filter_expressions.enabled" diff --git a/epan/prefs.h b/epan/prefs.h index d2b193a243..74ea1a0217 100644 --- a/epan/prefs.h +++ b/epan/prefs.h @@ -658,6 +658,11 @@ WS_DLL_PUBLIC gboolean prefs_capture_device_monitor_mode(const char *name); WS_DLL_PUBLIC gboolean prefs_capture_options_dialog_column_is_visible(const gchar *column); +/* + * Returns TRUE if the layout pane content is enabled + */ +WS_DLL_PUBLIC gboolean prefs_has_layout_pane_content (layout_pane_content_e layout_pane_content); + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index 83fdd82811..7898f6c352 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -487,6 +487,10 @@ void MainWindow::layoutToolbars() void MainWindow::updatePreferenceActions() { + main_ui_->actionViewPacketList->setEnabled(prefs_has_layout_pane_content(layout_pane_content_plist)); + main_ui_->actionViewPacketDetails->setEnabled(prefs_has_layout_pane_content(layout_pane_content_pdetails)); + main_ui_->actionViewPacketBytes->setEnabled(prefs_has_layout_pane_content(layout_pane_content_pbytes)); + main_ui_->actionViewNameResolutionPhysical->setChecked(gbl_resolv_flags.mac_name); main_ui_->actionViewNameResolutionNetwork->setChecked(gbl_resolv_flags.network_name); main_ui_->actionViewNameResolutionTransport->setChecked(gbl_resolv_flags.transport_name); @@ -501,9 +505,9 @@ void MainWindow::updateRecentActions() main_ui_->actionViewFilterToolbar->setChecked(recent.filter_toolbar_show); main_ui_->actionViewWirelessToolbar->setChecked(recent.wireless_toolbar_show); main_ui_->actionViewStatusBar->setChecked(recent.statusbar_show); - main_ui_->actionViewPacketList->setChecked(recent.packet_list_show); - main_ui_->actionViewPacketDetails->setChecked(recent.tree_view_show); - main_ui_->actionViewPacketBytes->setChecked(recent.byte_view_show); + main_ui_->actionViewPacketList->setChecked(recent.packet_list_show && prefs_has_layout_pane_content(layout_pane_content_plist)); + main_ui_->actionViewPacketDetails->setChecked(recent.tree_view_show && prefs_has_layout_pane_content(layout_pane_content_pdetails)); + main_ui_->actionViewPacketBytes->setChecked(recent.byte_view_show && prefs_has_layout_pane_content(layout_pane_content_pbytes)); foreach (QAction* tda, td_actions.keys()) { if (recent.gui_time_format == td_actions[tda]) { |