diff --git a/gui/application.ini b/gui/application.ini index 0da5e498dad..a832d9d285b 100644 --- a/gui/application.ini +++ b/gui/application.ini @@ -32,4 +32,4 @@ MinVersion=1.9a5 ; This field is optional. It specifies the maximum Gecko version that this ; application requires. It should be specified if your application uses ; unfrozen interfaces. -;MaxVersion=1.9.0.* +MaxVersion=2.* diff --git a/gui/chrome.manifest b/gui/chrome.manifest new file mode 100644 index 00000000000..865d6a88fb4 --- /dev/null +++ b/gui/chrome.manifest @@ -0,0 +1 @@ +manifest chrome/chrome.manifest diff --git a/gui/chrome/chrome.manifest b/gui/chrome/chrome.manifest index 6b524807eaa..775445ee17b 100644 --- a/gui/chrome/chrome.manifest +++ b/gui/chrome/chrome.manifest @@ -1 +1 @@ -content nixos-gui content/nixos-gui/ +content nixos-gui content/ diff --git a/gui/chrome/content/nixos-gui/io.js b/gui/chrome/content/io.js similarity index 54% rename from gui/chrome/content/nixos-gui/io.js rename to gui/chrome/content/io.js index 3e3b080b814..8d9c8c17365 100644 --- a/gui/chrome/content/nixos-gui/io.js +++ b/gui/chrome/content/io.js @@ -1,3 +1,66 @@ + +function inspect(obj, maxLevels, level) +{ + var str = '', type, msg; + + // Start Input Validations + // Don't touch, we start iterating at level zero + if(level == null) level = 0; + + // At least you want to show the first level + if(maxLevels == null) maxLevels = 1; + if(maxLevels < 1) + return 'Error: Levels number must be > 0'; + + // We start with a non null object + if(obj == null) + return 'Error: Object NULL'; + // End Input Validations + + // Each Iteration must be indented + str += ''; + + return str; +} + +// Run xulrunner application.ini -jsconsole -console, to see messages. +function log(str) +{ + Components.classes['@mozilla.org/consoleservice;1'] + .getService(Components.interfaces.nsIConsoleService) + .logStringMessage(str); +} + function makeTempFile(prefix) { var file = Components.classes["@mozilla.org/file/directory_service;1"] @@ -29,7 +92,7 @@ function readFromFile(file) var sstream = Components.classes["@mozilla.org/scriptableinputstream;1"] .createInstance(Components.interfaces.nsIScriptableInputStream); fstream.init(file, -1, 0, 0); - sstream.init(fstream); + sstream.init(fstream); var str = sstream.read(4096); while (str.length > 0) { diff --git a/gui/chrome/content/main.js b/gui/chrome/content/main.js new file mode 100644 index 00000000000..de272e27378 --- /dev/null +++ b/gui/chrome/content/main.js @@ -0,0 +1,40 @@ +// global variables. +var gNixOS; +var gOptionView; + +/* +var gProgressBar; +function setProgress(current, max) +{ + if (gProgressBar) { + gProgressBar.value = 100 * current / max; + log("progress: " + gProgressBar.value + "%"); + } + else + log("unknow progress bar"); +} +*/ + +function updatePanel(options) +{ + log("updatePanel: " + options.length); + var t = ""; + for (var i = 0; i < options.length; i++) + { + log("Called with " + options[i].path); + t += options[i].description; + } + $("#option-desc").text(t); +} + + +function onload() +{ + var optionTree = document.getElementById("option-tree"); + // gProgressBar = document.getElementById("progress-bar"); + // setProgress(0, 1); + + gNixOS = new NixOS(); + gOptionView = new OptionView(gNixOS.option, updatePanel); + optionTree.view = gOptionView; +} diff --git a/gui/chrome/content/myviewer.xul b/gui/chrome/content/myviewer.xul new file mode 100644 index 00000000000..23c6ce0a65d --- /dev/null +++ b/gui/chrome/content/myviewer.xul @@ -0,0 +1,42 @@ + + + + + + + + +