1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-10 07:44:15 +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
onSecurityChange: function onSecurityChange(webProgress, request, state) {
onSecurityChange.superapply(this, arguments);
// TODO: do something useful with STATE_SECURE_MED and STATE_SECURE_LOW
if (state & Ci.nsIWebProgressListener.STATE_IS_INSECURE)
statusline.class = "insecure";
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";
if (webProgress && webProgress.DOMWindow)
webProgress.DOMWindow.document.dactylSecurity = state;
statusline.security = state;
},
onStatusChange: function onStatusChange(webProgress, request, status, message) {
onStatusChange.superapply(this, arguments);

View File

@@ -67,7 +67,7 @@ var StatusLine = Module("statusline", {
objects: this.widgets = { get status() this.container },
prepend: prepend.elements()
});
this.class = "insecure";
this.security = content.document.dactylSecurity;
},
get visible() !this.statusBar.collapsed && !this.statusBar.hidden,
@@ -94,6 +94,16 @@ var StatusLine = Module("statusline", {
highlight.highlightNode(this.statusBar, this.baseGroup + highlightGroup[type]);
},
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: function update() {

View File

@@ -118,8 +118,7 @@ var ConfigBase = Class("ConfigBase", {
this.helpCSS = true;
},
Local: function Local(dactyl, modules, window)
let ({modes} = modules) ({
Local: function Local(dactyl, modules, window) ({
init: function init() {
let append = <e4x xmlns={XUL} xmlns:dactyl={NS}>
@@ -142,7 +141,7 @@ var ConfigBase = Class("ConfigBase", {
browser: 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.