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

Commit

Permalink
Restore Bravery menu to point to new bravery panels
Browse files Browse the repository at this point in the history
fix #2669

auditors: @bbondy
  • Loading branch information
diracdeltas committed Jul 23, 2016
1 parent e4d8209 commit 37f4f20
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/extensions/brave/locales/en-US/menu.properties
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ reportAnIssue=Report an Issue
submitFeedback=Submit Feedback...
bookmarksToolbar=Bookmarks Toolbar
bravery=Bravery
braverySite=Bravery site settings...
braveryGlobal=Bravery global settings...
addBookmark=Add Bookmark...
addFolder=Add Folder...
unmuteTabs=Unmute Tabs
Expand Down
2 changes: 2 additions & 0 deletions app/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ var rendererIdentifiers = function () {
'submitFeedback',
'bookmarksToolbar',
'bravery',
'braverySite',
'braveryGlobal',
'blockPopups',
'learnSpelling',
'ignoreSpelling',
Expand Down
6 changes: 6 additions & 0 deletions app/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,12 @@ const init = (settingsState, args) => {
CommonMenu.separatorMenuItem,
CommonMenu.importBookmarksMenuItem()
]
}, {
label: locale.translation('bravery'),
submenu: [
CommonMenu.braveryGlobalMenuItem(),
CommonMenu.braverySiteMenuItem()
]
}, {
label: locale.translation('window'),
role: 'window',
Expand Down
24 changes: 24 additions & 0 deletions js/commonMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,3 +305,27 @@ module.exports.aboutBraveMenuItem = () => {
}
}
}

module.exports.braverySiteMenuItem = () => {
return {
label: locale.translation('braverySite'),
click: (item, focusedWindow) => {
module.exports.sendToFocusedWindow(focusedWindow, [messages.OPEN_BRAVERY_PANEL])
}
}
}

module.exports.braveryGlobalMenuItem = () => {
return {
label: locale.translation('braveryGlobal'),
click: (item, focusedWindow) => {
if (BrowserWindow.getAllWindows().length === 0) {
appActions.newWindow(Immutable.fromJS({

This comment has been minimized.

Copy link
@bbondy

bbondy Jul 23, 2016

Member

fairly sure you don't need the Immutable.fromJS here but it's fine as is if you want to leave it.

This comment has been minimized.

Copy link
@diracdeltas

diracdeltas Jul 23, 2016

Author Member

it was copied from module.exports.preferencesMenuItem

This comment has been minimized.

Copy link
@bbondy

bbondy Jul 23, 2016

Member

just noting I think it works both ways.

location: 'about:preferences#shields'
}))
} else {
module.exports.sendToFocusedWindow(focusedWindow, [messages.SHORTCUT_NEW_FRAME, 'about:preferences#shields', { singleFrame: true }])
}
}
}
}
10 changes: 10 additions & 0 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ class Main extends ImmutableComponent {
}
}
})
ipc.on(messages.OPEN_BRAVERY_PANEL, (e) => {
if (!this.braveShieldsDisabled) {
this.onBraveMenu()
} else {
windowActions.newFrame({
location: 'about:preferences#shields',
singleFrame: true
}, true)
}
})
ipc.on(messages.CAN_SWIPE_BACK, (e) => {
canSwipeBack = true
})
Expand Down
1 change: 1 addition & 0 deletions js/constants/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const messages = {
SHORTCUT_PREV_TAB: _,
// Misc application events
QUIT_APPLICATION: _,
OPEN_BRAVERY_PANEL: _,
PREFS_RESTART: _,
UPDATE_APP_MENU: _, /** @arg {Object} args menu args to update */
CERT_ERROR: _, /** @arg {Object} details of certificate error */
Expand Down
6 changes: 6 additions & 0 deletions js/contextMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,12 @@ function hamburgerTemplateInit (location, e) {
CommonMenu.separatorMenuItem,
CommonMenu.importBookmarksMenuItem()
]
}, {
label: locale.translation('bravery'),
submenu: [
CommonMenu.braveryGlobalMenuItem(),
CommonMenu.braverySiteMenuItem()
]
},
CommonMenu.downloadsMenuItem(),
CommonMenu.separatorMenuItem,
Expand Down

1 comment on commit 37f4f20

@bbondy
Copy link
Member

@bbondy bbondy commented on 37f4f20 Jul 23, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.