ELECTRON-695 - Fixing hover close button on notification (#475)

This commit is contained in:
VICTOR RAPHAEL BRAGA DE SALES MASCARENHAS 2018-08-28 03:17:24 -03:00 committed by Vishwas Shashidhar
parent 10e0f8a295
commit 29fb713b75
2 changed files with 7 additions and 2 deletions

View File

@ -89,6 +89,7 @@ function setContents(event, notificationObj) {
let messageDoc = notiDoc.getElementById('message'); let messageDoc = notiDoc.getElementById('message');
let imageDoc = notiDoc.getElementById('image'); let imageDoc = notiDoc.getElementById('image');
let closeButton = notiDoc.getElementById('close'); let closeButton = notiDoc.getElementById('close');
closeButton.title = notificationObj.i18n.close;
if (notificationObj.color) { if (notificationObj.color) {
container.style.backgroundColor = notificationObj.color; container.style.backgroundColor = notificationObj.color;

View File

@ -19,7 +19,7 @@ const ipc = electron.ipcMain;
const { isMac, isNodeEnv } = require('../utils/misc'); const { isMac, isNodeEnv } = require('../utils/misc');
const log = require('../log.js'); const log = require('../log.js');
const logLevels = require('../enums/logLevels.js'); const logLevels = require('../enums/logLevels.js');
const i18n = require('../translation/i18n');
// maximum number of notifications that can be queued, after limit is // maximum number of notifications that can be queued, after limit is
// reached then error func callback will be invoked. // reached then error func callback will be invoked.
const MAX_QUEUE_SIZE = 30; const MAX_QUEUE_SIZE = 30;
@ -464,11 +464,15 @@ function setNotificationContents(notfWindow, notfObj) {
} else { } else {
delete updatedNotificationWindow.electronNotifyOnCloseFunc; delete updatedNotificationWindow.electronNotifyOnCloseFunc;
} }
// Set strings about i18n
const translation = {};
translation.close = i18n.getMessageFor('Close');
const windowId = notfWindow.id; const windowId = notfWindow.id;
// Set contents, ... // Set contents, ...
updatedNotificationWindow.webContents.send('electron-notify-set-contents', updatedNotificationWindow.webContents.send('electron-notify-set-contents',
Object.assign({ windowId: windowId}, notfObj)); Object.assign({ windowId: windowId, i18n: translation}, notfObj));
// Show window // Show window
updatedNotificationWindow.showInactive(); updatedNotificationWindow.showInactive();