mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-02-15 07:28:59 +00:00
Move settings (‘Preferences’) into OS-level menu
This reduces our reliance on custom UI until we have more design resources.
This commit is contained in:
@@ -19,6 +19,10 @@
|
||||
"message": "&Help",
|
||||
"description": "The label that is used for the Help menu in the program main menu. The '&' indicates that the following letter will be used as the keyboard 'shortcut letter' for accessing the menu with the Alt-<letter> combination."
|
||||
},
|
||||
"mainMenuSettings": {
|
||||
"message": "Preferences…",
|
||||
"description": "The label that is used for the Preferences menu in the program main menu. This should be consistent with the standard naming for ‘Preferences’ on the operating system."
|
||||
},
|
||||
"menuSetupWithImport": {
|
||||
"message": "Set up with import",
|
||||
"description": "When the application is not yet set up, menu option to start up the import sequence"
|
||||
|
||||
17
app/menu.js
17
app/menu.js
@@ -18,11 +18,20 @@ exports.createTemplate = (options, messages) => {
|
||||
setupWithImport,
|
||||
showAbout,
|
||||
showDebugLog,
|
||||
showSettings,
|
||||
} = options;
|
||||
|
||||
const template = [{
|
||||
label: messages.mainMenuFile.message,
|
||||
submenu: [
|
||||
{
|
||||
label: messages.mainMenuSettings.message,
|
||||
accelerator: 'CommandOrControl+,',
|
||||
click: showSettings,
|
||||
},
|
||||
{
|
||||
type: 'separator',
|
||||
},
|
||||
{
|
||||
role: 'quit',
|
||||
},
|
||||
@@ -218,6 +227,14 @@ function updateForMac(template, messages, options) {
|
||||
{
|
||||
type: 'separator',
|
||||
},
|
||||
{
|
||||
label: messages.mainMenuSettings.message,
|
||||
accelerator: 'CommandOrControl+,',
|
||||
click: showSettings,
|
||||
},
|
||||
{
|
||||
type: 'separator',
|
||||
},
|
||||
{
|
||||
role: 'hide',
|
||||
},
|
||||
|
||||
@@ -170,6 +170,16 @@
|
||||
Whisper.events.on('showDebugLog', function() {
|
||||
appView.openDebugLog();
|
||||
});
|
||||
Whisper.events.on('showSettings', () => {
|
||||
if (!appView || !appView.inboxView) {
|
||||
console.log(
|
||||
'background: Event: \'showSettings\':' +
|
||||
' Expected `appView.inboxView` to exist.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
appView.inboxView.showSettings();
|
||||
});
|
||||
Whisper.events.on('unauthorized', function() {
|
||||
appView.inboxView.networkStatusView.update();
|
||||
});
|
||||
|
||||
9
main.js
9
main.js
@@ -324,6 +324,14 @@ function showDebugLog() {
|
||||
}
|
||||
}
|
||||
|
||||
function showSettings() {
|
||||
if (!mainWindow) {
|
||||
return;
|
||||
}
|
||||
|
||||
mainWindow.webContents.send('show-settings');
|
||||
}
|
||||
|
||||
function openReleaseNotes() {
|
||||
shell.openExternal(`https://github.com/signalapp/Signal-Desktop/releases/tag/v${app.getVersion()}`);
|
||||
}
|
||||
@@ -449,6 +457,7 @@ function setupMenu(options) {
|
||||
setupWithImport,
|
||||
setupAsNewDevice,
|
||||
setupAsStandalone,
|
||||
showSettings,
|
||||
});
|
||||
const template = createTemplate(menuOptions, locale.messages);
|
||||
const menu = Menu.buildFromTemplate(template);
|
||||
|
||||
@@ -54,6 +54,10 @@
|
||||
Whisper.events.trigger('setupAsStandalone');
|
||||
});
|
||||
|
||||
ipc.on('show-settings', function() {
|
||||
Whisper.events.trigger('showSettings');
|
||||
});
|
||||
|
||||
window.addSetupMenuItems = function() {
|
||||
ipc.send('add-setup-menu-items');
|
||||
}
|
||||
|
||||
@@ -8,6 +8,14 @@
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"label": "Preferences…",
|
||||
"accelerator": "CommandOrControl+,",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"role": "hide"
|
||||
},
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
{
|
||||
"label": "&File",
|
||||
"submenu": [
|
||||
{
|
||||
"label": "Preferences…",
|
||||
"accelerator": "CommandOrControl+,",
|
||||
"click": null
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
},
|
||||
{
|
||||
"role": "quit"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user