mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 941292 - Move charms controller in with flyout code. r=sfoster
This commit is contained in:
parent
5d68ce0a66
commit
dc4cfdae9c
@ -116,6 +116,7 @@ let ScriptContexts = {};
|
||||
["NavButtonSlider", "chrome://browser/content/NavButtonSlider.js"],
|
||||
["ContextUI", "chrome://browser/content/ContextUI.js"],
|
||||
["FlyoutPanelsUI", "chrome://browser/content/flyoutpanels/FlyoutPanelsUI.js"],
|
||||
["SettingsCharm", "chrome://browser/content/flyoutpanels/SettingsCharm.js"],
|
||||
["APZCObserver", "chrome://browser/content/apzc.js"],
|
||||
].forEach(function (aScript) {
|
||||
let [name, script] = aScript;
|
||||
|
@ -1276,70 +1276,3 @@ var DialogUI = {
|
||||
return targetNode ? true : false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Manage the contents of the Windows 8 "Settings" charm.
|
||||
*/
|
||||
var SettingsCharm = {
|
||||
_entries: new Map(),
|
||||
_nextId: 0,
|
||||
|
||||
/**
|
||||
* Add a new item to the "Settings" menu in the Windows 8 charms.
|
||||
* @param aEntry Object with a "label" property (string that will appear in the UI)
|
||||
* and an "onselected" property (function to be called when the user chooses this entry)
|
||||
*/
|
||||
addEntry: function addEntry(aEntry) {
|
||||
try {
|
||||
let id = Services.metro.addSettingsPanelEntry(aEntry.label);
|
||||
this._entries.set(id, aEntry);
|
||||
} catch (e) {
|
||||
// addSettingsPanelEntry does not work on non-Metro platforms
|
||||
Cu.reportError(e);
|
||||
}
|
||||
},
|
||||
|
||||
init: function SettingsCharm_init() {
|
||||
Services.obs.addObserver(this, "metro-settings-entry-selected", false);
|
||||
|
||||
// Options
|
||||
this.addEntry({
|
||||
label: Strings.browser.GetStringFromName("optionsCharm"),
|
||||
onselected: function() FlyoutPanelsUI.show('PrefsFlyoutPanel')
|
||||
});
|
||||
/*
|
||||
* Temporarily disabled until we can have sync prefs together with the
|
||||
* Desktop browser's sync prefs.
|
||||
// Sync
|
||||
this.addEntry({
|
||||
label: Strings.brand.GetStringFromName("syncBrandShortName"),
|
||||
onselected: function() FlyoutPanelsUI.show('SyncFlyoutPanel')
|
||||
});
|
||||
*/
|
||||
// About
|
||||
this.addEntry({
|
||||
label: Strings.browser.GetStringFromName("aboutCharm1"),
|
||||
onselected: function() FlyoutPanelsUI.show('AboutFlyoutPanel')
|
||||
});
|
||||
// Help
|
||||
this.addEntry({
|
||||
label: Strings.browser.GetStringFromName("helpOnlineCharm"),
|
||||
onselected: function() {
|
||||
let url = Services.urlFormatter.formatURLPref("app.support.baseURL");
|
||||
BrowserUI.addAndShowTab(url, Browser.selectedTab);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
observe: function SettingsCharm_observe(aSubject, aTopic, aData) {
|
||||
if (aTopic == "metro-settings-entry-selected") {
|
||||
let entry = this._entries.get(parseInt(aData, 10));
|
||||
if (entry)
|
||||
entry.onselected();
|
||||
}
|
||||
},
|
||||
|
||||
uninit: function SettingsCharm_uninit() {
|
||||
Services.obs.removeObserver(this, "metro-settings-entry-selected");
|
||||
}
|
||||
};
|
||||
|
67
browser/metro/base/content/flyoutpanels/SettingsCharm.js
Normal file
67
browser/metro/base/content/flyoutpanels/SettingsCharm.js
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
/**
|
||||
* Manage the contents of the Windows 8 "Settings" charm.
|
||||
*/
|
||||
var SettingsCharm = {
|
||||
_entries: new Map(),
|
||||
_nextId: 0,
|
||||
|
||||
/**
|
||||
* Add a new item to the "Settings" menu in the Windows 8 charms.
|
||||
* @param aEntry Object with a "label" property (string that will appear in the UI)
|
||||
* and an "onselected" property (function to be called when the user chooses this entry)
|
||||
*/
|
||||
addEntry: function addEntry(aEntry) {
|
||||
try {
|
||||
let id = Services.metro.addSettingsPanelEntry(aEntry.label);
|
||||
this._entries.set(id, aEntry);
|
||||
} catch (e) {
|
||||
// addSettingsPanelEntry does not work on non-Metro platforms
|
||||
Cu.reportError(e);
|
||||
}
|
||||
},
|
||||
|
||||
init: function SettingsCharm_init() {
|
||||
Services.obs.addObserver(this, "metro-settings-entry-selected", false);
|
||||
|
||||
// Options
|
||||
this.addEntry({
|
||||
label: Strings.browser.GetStringFromName("optionsCharm"),
|
||||
onselected: function() FlyoutPanelsUI.show('PrefsFlyoutPanel')
|
||||
});
|
||||
/*
|
||||
* Temporarily disabled until we can have sync prefs together with the
|
||||
* Desktop browser's sync prefs.
|
||||
// Sync
|
||||
this.addEntry({
|
||||
label: Strings.brand.GetStringFromName("syncBrandShortName"),
|
||||
onselected: function() FlyoutPanelsUI.show('SyncFlyoutPanel')
|
||||
});
|
||||
*/
|
||||
// About
|
||||
this.addEntry({
|
||||
label: Strings.browser.GetStringFromName("aboutCharm1"),
|
||||
onselected: function() FlyoutPanelsUI.show('AboutFlyoutPanel')
|
||||
});
|
||||
// Help
|
||||
this.addEntry({
|
||||
label: Strings.browser.GetStringFromName("helpOnlineCharm"),
|
||||
onselected: function() {
|
||||
let url = Services.urlFormatter.formatURLPref("app.support.baseURL");
|
||||
BrowserUI.addAndShowTab(url, Browser.selectedTab);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
observe: function SettingsCharm_observe(aSubject, aTopic, aData) {
|
||||
if (aTopic == "metro-settings-entry-selected") {
|
||||
let entry = this._entries.get(parseInt(aData, 10));
|
||||
if (entry)
|
||||
entry.onselected();
|
||||
}
|
||||
},
|
||||
|
||||
uninit: function SettingsCharm_uninit() {
|
||||
Services.obs.removeObserver(this, "metro-settings-entry-selected");
|
||||
}
|
||||
};
|
@ -30,9 +30,13 @@ chrome.jar:
|
||||
content/bindings/notification.xml (content/bindings/notification.xml)
|
||||
content/bindings/tabprompts.xml (content/bindings/tabprompts.xml)
|
||||
|
||||
content/flyoutpanels/SettingsCharm.js (content/flyoutpanels/SettingsCharm.js)
|
||||
* content/flyoutpanels/FlyoutPanelsUI.js (content/flyoutpanels/FlyoutPanelsUI.js)
|
||||
* content/flyoutpanels/AboutFlyoutPanel.js (content/flyoutpanels/AboutFlyoutPanel.js)
|
||||
content/flyoutpanels/PrefsFlyoutPanel.js (content/flyoutpanels/PrefsFlyoutPanel.js)
|
||||
#ifdef MOZ_SERVICES_SYNC
|
||||
content/flyoutpanels/SyncFlyoutPanel.js (content/flyoutpanels/SyncFlyoutPanel.js)
|
||||
#endif
|
||||
|
||||
content/helperui/AlertsHelper.js (content/helperui/AlertsHelper.js)
|
||||
content/helperui/IndexedDB.js (content/helperui/IndexedDB.js)
|
||||
@ -81,9 +85,6 @@ chrome.jar:
|
||||
content/TopSites.js (content/TopSites.js)
|
||||
content/console.js (content/console.js)
|
||||
content/dbg-metro-actors.js (content/dbg-metro-actors.js)
|
||||
#ifdef MOZ_SERVICES_SYNC
|
||||
content/flyoutpanels/SyncFlyoutPanel.js (content/flyoutpanels/SyncFlyoutPanel.js)
|
||||
#endif
|
||||
content/NavButtonSlider.js (content/NavButtonSlider.js)
|
||||
content/ContextUI.js (content/ContextUI.js)
|
||||
content/apzc.js (content/apzc.js)
|
||||
|
Loading…
Reference in New Issue
Block a user