Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Toggle method for menu can now include bool; default is that it'll to…
Browse files Browse the repository at this point in the history
…ggle.
  • Loading branch information
bsclifton committed Sep 12, 2016
1 parent 55e76da commit dd23cbd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions js/actions/windowActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -990,10 +990,12 @@ const windowActions = {
/**
* (Windows only)
* Dispatches a message to indicate the custom rendered Menubar should be toggled (shown/hidden)
* @param {boolean} isVisible (optional)
*/
toggleMenubarVisible: function () {
toggleMenubarVisible: function (isVisible) {
dispatch({
actionType: WindowConstants.WINDOW_TOGGLE_MENUBAR_VISIBLE
actionType: WindowConstants.WINDOW_TOGGLE_MENUBAR_VISIBLE,
isVisible
})
},

Expand Down
8 changes: 6 additions & 2 deletions js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,12 @@ const doAction = (action) => {
break
case WindowConstants.WINDOW_TOGGLE_MENUBAR_VISIBLE:
if (getSetting(settings.AUTO_HIDE_MENU)) {
const currentStatus = windowState.getIn(['ui', 'menubar', 'isVisible'])
windowState = windowState.setIn(['ui', 'menubar', 'isVisible'], !currentStatus)
if (typeof action.isVisible === 'boolean'){
windowState = windowState.setIn(['ui', 'menubar', 'isVisible'], action.isVisible)
} else {
const currentStatus = windowState.getIn(['ui', 'menubar', 'isVisible'])
windowState = windowState.setIn(['ui', 'menubar', 'isVisible'], !currentStatus)
}
}
break

Expand Down

0 comments on commit dd23cbd

Please sign in to comment.