mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-09 04:25:38 +00:00
Bug 602671 - New theme for the search engine popup [r=mfinkle]
--HG-- extra : rebase_source : f2735fa949e4ff9b45271508b934ca27acdc4e78
This commit is contained in:
parent
d232b01137
commit
aa3ef3d7f4
@ -1020,15 +1020,7 @@ var BrowserUI = {
|
||||
}
|
||||
case "cmd_opensearch":
|
||||
this.blurFocusedElement();
|
||||
|
||||
MenuListHelperUI.show({
|
||||
title: Elements.browserBundle.getString("opensearch.searchWith"),
|
||||
menupopup: { children: BrowserSearch.engines },
|
||||
set selectedIndex(aIndex) {
|
||||
let name = this.menupopup.children[aIndex].label;
|
||||
BrowserUI.doOpenSearch(name);
|
||||
}
|
||||
});
|
||||
BrowserSearch.toggle();
|
||||
break;
|
||||
case "cmd_bookmarks":
|
||||
this.activePanel = BookmarkList;
|
||||
|
@ -1207,6 +1207,61 @@ nsBrowserAccess.prototype = {
|
||||
|
||||
|
||||
const BrowserSearch = {
|
||||
get _popup() {
|
||||
delete this._popup;
|
||||
return this._popup = document.getElementById("search-engines-popup");
|
||||
},
|
||||
|
||||
get _list() {
|
||||
delete this._list;
|
||||
return this._list = document.getElementById("search-engines-list");
|
||||
},
|
||||
|
||||
get _button() {
|
||||
delete this._button;
|
||||
return this._button = document.getElementById("tool-search");
|
||||
},
|
||||
|
||||
toggle: function bs_toggle() {
|
||||
if (this._popup.hidden)
|
||||
this.show();
|
||||
else
|
||||
this.hide();
|
||||
},
|
||||
|
||||
show: function bs_show() {
|
||||
let popup = this._popup;
|
||||
let list = this._list;
|
||||
while (list.lastChild)
|
||||
list.removeChild(list.lastChild);
|
||||
|
||||
this.engines.forEach(function(aEngine) {
|
||||
let button = document.createElement("button");
|
||||
button.className = "prompt-button";
|
||||
button.setAttribute("label", aEngine.name);
|
||||
button.setAttribute("pack", "start");
|
||||
button.setAttribute("image", aEngine.iconURI ? aEngine.iconURI.spec : null);
|
||||
button.onclick = function() {
|
||||
popup.hidden = true;
|
||||
BrowserUI.doOpenSearch(aEngine.name);
|
||||
}
|
||||
list.appendChild(button);
|
||||
});
|
||||
|
||||
popup.hidden = false;
|
||||
popup.top = BrowserUI.toolbarH - popup.offset;
|
||||
popup.anchorTo(document.getElementById("tool-search"));
|
||||
|
||||
document.getElementById("urlbar-icons").setAttribute("open", "true");
|
||||
BrowserUI.pushPopup(this, [popup, this._button]);
|
||||
},
|
||||
|
||||
hide: function bs_hide() {
|
||||
this._popup.hidden = true;
|
||||
document.getElementById("urlbar-icons").removeAttribute("open");
|
||||
BrowserUI.popPopup();
|
||||
},
|
||||
|
||||
observe: function bs_observe(aSubject, aTopic, aData) {
|
||||
if (aTopic != "browser-search-engine-modified")
|
||||
return;
|
||||
@ -1238,16 +1293,8 @@ const BrowserSearch = {
|
||||
if (this._engines)
|
||||
return this._engines;
|
||||
|
||||
let engines = Services.search.getVisibleEngines({ }).map(
|
||||
function(item, index, array) {
|
||||
return {
|
||||
label: item.name,
|
||||
default: (item == Services.search.defaultEngine),
|
||||
image: item.iconURI ? item.iconURI.spec : null
|
||||
}
|
||||
});
|
||||
|
||||
return this._engines = engines;
|
||||
this._engines = Services.search.getVisibleEngines({ });
|
||||
return this._engines;
|
||||
},
|
||||
|
||||
updatePageSearchEngines: function updatePageSearchEngines(aNode) {
|
||||
@ -1275,7 +1322,7 @@ const BrowserSearch = {
|
||||
|
||||
isPermanentSearchEngine: function isPermanentSearchEngine(aEngine) {
|
||||
return !BrowserSearch.engines.some(function(item) {
|
||||
return aEngine.title == item.label;
|
||||
return aEngine.title == item.name;
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -1740,13 +1787,6 @@ IdentityHandler.prototype = {
|
||||
},
|
||||
|
||||
toggle: function ih_toggle() {
|
||||
// When the urlbar is active the identity button is used to show the
|
||||
// list of search engines
|
||||
if (Elements.urlbarState.getAttribute("mode") == "edit") {
|
||||
CommandUpdater.doCommand("cmd_opensearch");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._identityPopup.hidden)
|
||||
this.show();
|
||||
else
|
||||
|
@ -517,6 +517,10 @@
|
||||
#endif
|
||||
</vbox>
|
||||
|
||||
<arrowbox id="search-engines-popup" hidden="true" align="center" offset="18" flex="1">
|
||||
<hbox id="search-engines-list" class="prompt-buttons"/>
|
||||
</arrowbox>
|
||||
|
||||
<vbox id="newtab-popup" hidden="true" class="dialog-dark" onclick="NewTabPopup.selectTab()" align="center" left="21">
|
||||
<label/>
|
||||
</vbox>
|
||||
|
@ -41,7 +41,7 @@
|
||||
-moz-box-align: center;
|
||||
padding: 0 8px; /* core spacing */
|
||||
border: none;
|
||||
background: #444444;
|
||||
background: #5e6166;
|
||||
}
|
||||
|
||||
#toolbar-moveable-container[top="0"] {
|
||||
@ -293,7 +293,7 @@ toolbarbutton.urlbar-button {
|
||||
padding: 0;
|
||||
-moz-border-start: 3px solid #262629;
|
||||
min-width: 80px !important;
|
||||
background: #444444;
|
||||
background: #5e6166;
|
||||
}
|
||||
|
||||
toolbarbutton.button-control {
|
||||
@ -819,7 +819,7 @@ autocompleteresult.noresults > .autocomplete-item-container {
|
||||
#tabs-container {
|
||||
padding-top: 8px;
|
||||
-moz-border-end: 3px solid #262629;
|
||||
background: #444444;
|
||||
background: #5e6166;
|
||||
}
|
||||
|
||||
#tabs:-moz-locale-dir(rtl) {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@ -185,6 +185,11 @@ button:focus > .button-box {
|
||||
border: 1px solid transparent;
|
||||
}
|
||||
|
||||
/* Override GTK2 system setting */
|
||||
.button-icon {
|
||||
display: -moz-initial !important;
|
||||
}
|
||||
|
||||
/* dark buttons ------------------------------------------------------------ */
|
||||
/*
|
||||
we set notification buttons here as well, since the style can't be set in
|
||||
|
Loading…
x
Reference in New Issue
Block a user