1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-23 23:45:45 +01:00

Get the statusline color right after a :rehash.

This commit is contained in:
Kris Maglione
2011-01-04 11:23:48 -05:00
parent e533bdbc3d
commit e7ae04749c
3 changed files with 16 additions and 13 deletions

View File

@@ -265,15 +265,9 @@ var Buffer = Module("buffer", {
// for notifying the user about secure web pages // for notifying the user about secure web pages
onSecurityChange: function onSecurityChange(webProgress, request, state) { onSecurityChange: function onSecurityChange(webProgress, request, state) {
onSecurityChange.superapply(this, arguments); onSecurityChange.superapply(this, arguments);
// TODO: do something useful with STATE_SECURE_MED and STATE_SECURE_LOW if (webProgress && webProgress.DOMWindow)
if (state & Ci.nsIWebProgressListener.STATE_IS_INSECURE) webProgress.DOMWindow.document.dactylSecurity = state;
statusline.class = "insecure"; statusline.security = state;
else if (state & Ci.nsIWebProgressListener.STATE_IS_BROKEN)
statusline.class = "broken";
else if (state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL)
statusline.class = "extended";
else if (state & Ci.nsIWebProgressListener.STATE_SECURE_HIGH)
statusline.class = "secure";
}, },
onStatusChange: function onStatusChange(webProgress, request, status, message) { onStatusChange: function onStatusChange(webProgress, request, status, message) {
onStatusChange.superapply(this, arguments); onStatusChange.superapply(this, arguments);

View File

@@ -67,7 +67,7 @@ var StatusLine = Module("statusline", {
objects: this.widgets = { get status() this.container }, objects: this.widgets = { get status() this.container },
prepend: prepend.elements() prepend: prepend.elements()
}); });
this.class = "insecure"; this.security = content.document.dactylSecurity;
}, },
get visible() !this.statusBar.collapsed && !this.statusBar.hidden, get visible() !this.statusBar.collapsed && !this.statusBar.hidden,
@@ -94,6 +94,16 @@ var StatusLine = Module("statusline", {
highlight.highlightNode(this.statusBar, this.baseGroup + highlightGroup[type]); highlight.highlightNode(this.statusBar, this.baseGroup + highlightGroup[type]);
}, },
get class() this._class, get class() this._class,
set security(state) {
if (state & Ci.nsIWebProgressListener.STATE_IS_BROKEN)
this.class = "broken";
else if (state & Ci.nsIWebProgressListener.STATE_IDENTITY_EV_TOPLEVEL)
this.class = "extended";
else if (state & Ci.nsIWebProgressListener.STATE_SECURE_HIGH)
this.class = "secure";
else // if (state & Ci.nsIWebProgressListener.STATE_IS_INSECURE)
this.class = "insecure";
},
// update all fields of the statusline // update all fields of the statusline
update: function update() { update: function update() {

View File

@@ -118,8 +118,7 @@ var ConfigBase = Class("ConfigBase", {
this.helpCSS = true; this.helpCSS = true;
}, },
Local: function Local(dactyl, modules, window) Local: function Local(dactyl, modules, window) ({
let ({modes} = modules) ({
init: function init() { init: function init() {
let append = <e4x xmlns={XUL} xmlns:dactyl={NS}> let append = <e4x xmlns={XUL} xmlns:dactyl={NS}>
@@ -142,7 +141,7 @@ var ConfigBase = Class("ConfigBase", {
browser: Class.memoize(function () window.gBrowser), browser: Class.memoize(function () window.gBrowser),
tabbrowser: Class.memoize(function () window.gBrowser), tabbrowser: Class.memoize(function () window.gBrowser),
get browserModes() [modes.NORMAL], get browserModes() [modules.modes.NORMAL],
/** /**
* @property {string} The ID of the application's main XUL window. * @property {string} The ID of the application's main XUL window.