Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/main.js

Issue 4744516900749312: issue #1155 - Don't allow displaying icon text with Australis theme (Closed)
Patch Set: Created July 28, 2014, 7:58 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/content/settings.xul ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/main.js
===================================================================
--- a/lib/main.js
+++ b/lib/main.js
@@ -41,6 +41,52 @@
}
}
+/**
+ * Object initializing add-on options, observes add-on manager notifications
+ * about add-on options being opened.
+ * @type nsIObserver
+ */
+let optionsObserver =
+{
+ init: function()
+ {
+ Services.obs.addObserver(this, "addon-options-displayed", true);
+ onShutdown.add(function()
+ {
+ Services.obs.removeObserver(this, "addon-options-displayed");
+ }.bind(this));
+ },
+
+ initOptionsDoc: function(/**Document*/ doc)
+ {
+ function hideElement(id, hide)
+ {
+ let element = doc.getElementById(id);
+ if (element)
+ element.collapsed = hide;
+ }
Wladimir Palant 2014/07/30 07:45:40 No point to have a generic function here, we only
saroyanm 2014/07/30 09:18:32 Will keep in mind.
+
+ try
+ {
+ let {CustomizableUI} = Cu.import("resource:///modules/CustomizableUI.jsm", null);
+ if (CustomizableUI)
Wladimir Palant 2014/07/30 07:45:40 This check is pointless, if the module fails to lo
+ hideElement("abpcustomization-icondisplay", true);
+ } catch (e) {}
+ },
+
+ observe: function(subject, topic, data)
+ {
+ let {addonID} = require("info")
+ if (data != addonID)
+ return;
+
+ this.initOptionsDoc(subject.QueryInterface(Ci.nsIDOMDocument));
+ },
+
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference])
Wladimir Palant 2014/07/30 07:45:40 Please import XPCOMUtils in this file. The fact th
saroyanm 2014/07/30 09:18:32 Done.
+};
+optionsObserver.init();
+
var VerticalPreferencesLayout =
{
__proto__: WindowFeature,
@@ -193,7 +239,6 @@
}
}
-
// Initialize features and make sure to update them on changes
for (let feature in features)
updateFeature(feature);
« no previous file with comments | « chrome/content/settings.xul ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld