mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 945842: Show Metro bookmarks folder in Windows 8 only. r=bbondy
This commit is contained in:
parent
42328ed006
commit
1916b878aa
@ -29,14 +29,6 @@ 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) {
|
||||
@ -800,7 +792,7 @@ const CustomizableWidgets = [{
|
||||
|
||||
#ifdef XP_WIN
|
||||
#ifdef MOZ_METRO
|
||||
if (isWin8OrHigher()) {
|
||||
if (Services.sysinfo.getProperty("hasWindowsTouchInterface")) {
|
||||
let widgetArgs = {tooltiptext: "switch-to-metro-button2.tooltiptext"};
|
||||
let brandShortName = BrandBundle.GetStringFromName("brandShortName");
|
||||
let metroTooltip = CustomizableUI.getLocalizedProperty(widgetArgs, "tooltiptext",
|
||||
|
@ -1591,7 +1591,7 @@ BrowserGlue.prototype = {
|
||||
// be set to the version it has been added in, we will compare its value
|
||||
// to users' smartBookmarksVersion and add new smart bookmarks without
|
||||
// recreating old deleted ones.
|
||||
const SMART_BOOKMARKS_VERSION = 5;
|
||||
const SMART_BOOKMARKS_VERSION = 6;
|
||||
const SMART_BOOKMARKS_ANNO = "Places/SmartBookmark";
|
||||
const SMART_BOOKMARKS_PREF = "browser.places.smartBookmarksVersion";
|
||||
|
||||
@ -1653,7 +1653,10 @@ BrowserGlue.prototype = {
|
||||
position: menuIndex++,
|
||||
newInVersion: 1
|
||||
},
|
||||
Windows8Touch: {
|
||||
};
|
||||
|
||||
if (Services.sysinfo.getProperty("hasWindowsTouchInterface")) {
|
||||
smartBookmarks.Windows8Touch = {
|
||||
title: bundle.GetStringFromName("windows8TouchTitle"),
|
||||
uri: NetUtil.newURI("place:folder=" +
|
||||
PlacesUtils.annotations.getItemsWithAnnotation('metro/bookmarksRoot', {})[0] +
|
||||
@ -1665,9 +1668,9 @@ BrowserGlue.prototype = {
|
||||
"&excludeQueries=1"),
|
||||
parent: PlacesUtils.bookmarksMenuFolderId,
|
||||
position: menuIndex++,
|
||||
newInVersion: 5
|
||||
},
|
||||
};
|
||||
newInVersion: 6
|
||||
};
|
||||
}
|
||||
|
||||
// Set current itemId, parent and position if Smart Bookmark exists,
|
||||
// we will use these informations to create the new version at the same
|
||||
|
@ -63,9 +63,10 @@ let (XULAppInfo = {
|
||||
}
|
||||
|
||||
// Smart bookmarks constants.
|
||||
const SMART_BOOKMARKS_VERSION = 5;
|
||||
let isWin8OrHigher = Services.sysinfo.getProperty("hasWindowsTouchInterface");
|
||||
const SMART_BOOKMARKS_VERSION = 6
|
||||
const SMART_BOOKMARKS_ON_TOOLBAR = 1;
|
||||
const SMART_BOOKMARKS_ON_MENU = 4; // Takes in count the additional separator.
|
||||
const SMART_BOOKMARKS_ON_MENU = isWin8OrHigher ? 4 : 3; // Takes in count the additional separator.
|
||||
|
||||
// Default bookmarks constants.
|
||||
const DEFAULT_BOOKMARKS_ON_TOOLBAR = 1;
|
||||
|
@ -176,6 +176,21 @@ nsSystemInfo::Init()
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_METRO)
|
||||
// Create "hasWindowsTouchInterface" property.
|
||||
nsAutoString version;
|
||||
rv = GetPropertyAsAString(NS_LITERAL_STRING("version"), version);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
double versionDouble = atof(NS_ConvertUTF16toUTF8(version).get());
|
||||
|
||||
rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16("hasWindowsTouchInterface"),
|
||||
versionDouble >= 6.2);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
#else
|
||||
rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16("hasWindowsTouchInterface"), false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
#endif
|
||||
|
||||
// Additional informations not available through PR_GetSystemInfo.
|
||||
SetInt32Property(NS_LITERAL_STRING("pagesize"), PR_GetPageSize());
|
||||
SetInt32Property(NS_LITERAL_STRING("pageshift"), PR_GetPageShift());
|
||||
|
Loading…
Reference in New Issue
Block a user