mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 944740: Don't show Metro button in palette on non-win8. r=Gijs
This commit is contained in:
parent
c36cfb4f04
commit
0940b2e8d7
@ -151,23 +151,9 @@ let CustomizableUIInternal = {
|
||||
"add-ons-button"
|
||||
];
|
||||
|
||||
#ifdef XP_WIN
|
||||
#ifdef MOZ_METRO
|
||||
// Show switch-to-metro-button if in Windows 8.
|
||||
let isMetroCapable = false;
|
||||
try {
|
||||
// Windows 8 is version 6.2.
|
||||
let version = Cc["@mozilla.org/system-info;1"]
|
||||
.getService(Ci.nsIPropertyBag2)
|
||||
.getProperty("version");
|
||||
isMetroCapable = (parseFloat(version) >= 6.2);
|
||||
} catch (ex) { }
|
||||
|
||||
if (isMetroCapable) {
|
||||
if (gPalette.has("switch-to-metro-button")) {
|
||||
panelPlacements.push("switch-to-metro-button");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
let showCharacterEncoding = Services.prefs.getComplexValue(
|
||||
"browser.menu.showCharacterEncoding",
|
||||
|
@ -25,6 +25,14 @@ const kWidePanelItemClass = "panel-wide-item";
|
||||
let gModuleName = "[CustomizableWidgets]";
|
||||
#include logging.js
|
||||
|
||||
function isWin8OrHigher() {
|
||||
let osName = Services.sysinfo.getProperty("name");
|
||||
let version = Services.sysinfo.getProperty("version");
|
||||
|
||||
// Windows 8 is version >= 6.2
|
||||
return osName == "Windows_NT" && Services.vc.compare(version, "6.2") >= 0;
|
||||
}
|
||||
|
||||
function setAttributes(aNode, aAttrs) {
|
||||
for (let [name, value] of Iterator(aAttrs)) {
|
||||
if (!value) {
|
||||
@ -259,18 +267,6 @@ const CustomizableWidgets = [{
|
||||
aEvent.target.removeEventListener("command",
|
||||
win.PanelUI.onCommandHandler);
|
||||
}
|
||||
}, {
|
||||
id: "switch-to-metro-button",
|
||||
removable: true,
|
||||
defaultArea: CustomizableUI.AREA_PANEL,
|
||||
onCommand: function(aEvent) {
|
||||
let win = aEvent.target &&
|
||||
aEvent.target.ownerDocument &&
|
||||
aEvent.target.ownerDocument.defaultView;
|
||||
if (win && typeof win.SwitchToMetro == "function") {
|
||||
win.SwitchToMetro();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
id: "add-ons-button",
|
||||
removable: true,
|
||||
@ -797,3 +793,23 @@ const CustomizableWidgets = [{
|
||||
win.MailIntegration.sendLinkForWindow(win.content);
|
||||
}
|
||||
}];
|
||||
|
||||
#ifdef XP_WIN
|
||||
#ifdef MOZ_METRO
|
||||
if (isWin8OrHigher()) {
|
||||
CustomizableWidgets.push({
|
||||
id: "switch-to-metro-button",
|
||||
removable: true,
|
||||
defaultArea: CustomizableUI.AREA_PANEL,
|
||||
onCommand: function(aEvent) {
|
||||
let win = aEvent.target &&
|
||||
aEvent.target.ownerDocument &&
|
||||
aEvent.target.ownerDocument.defaultView;
|
||||
if (win && typeof win.SwitchToMetro == "function") {
|
||||
win.SwitchToMetro();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
#endif
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user