Browse Source

Merge branch 'feature/preferences'

Herbert Vojčík 9 years ago
parent
commit
d1ba74e300
5 changed files with 24 additions and 14 deletions
  1. 0 4
      index.html
  2. 7 5
      src/Helios-Browser.js
  3. 3 1
      src/Helios-Browser.st
  4. 10 3
      src/Helios-Core.js
  5. 4 1
      src/Helios-Core.st

+ 0 - 4
index.html

@@ -22,10 +22,6 @@
             require.paths['helios/app'] = require.paths['helios/index'].replace("index", "app");
             require.callback = function () {
               require(["helios/app"], function (amber) {
-                window.onbeforeunload = function() {
-                  return 'Do you want to close Amber? All uncommitted changes will be lost.';
-                };
-
                 amber.initialize({'transport.defaultAmdNamespace': "amber_core"});
                 amber.globals.HLManager._setup();
               });

+ 7 - 5
src/Helios-Browser.js

@@ -1305,7 +1305,8 @@ return $core.withContext(function($ctx1) {
 var $2,$1,$receiver;
 $2=self["@showComment"];
 if(($receiver = $2) == null || $receiver.isNil){
-$1=true;
+self["@showComment"]="helios.browser.showComment"._settingValueIfAbsent_(true);
+$1=self["@showComment"];
 } else {
 $1=$2;
 };
@@ -1316,10 +1317,10 @@ return $1;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "showComment\x0a\x09^ showComment ifNil: [ true ]",
+source: "showComment\x0a\x09^ showComment ifNil: [ \x0a\x09\x09showComment := 'helios.browser.showComment' settingValueIfAbsent: true ]",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["ifNil:"]
+messageSends: ["ifNil:", "settingValueIfAbsent:"]
 }),
 $globals.HLBrowserModel);
 
@@ -1339,6 +1340,7 @@ return $core.withContext(function($ctx2) {
 //>>excludeEnd("ctx");
 self["@showComment"]=aBoolean;
 self["@showComment"];
+"helios.browser.showComment"._settingValue_(aBoolean);
 return $recv(self._announcer())._announce_($recv($HLShowCommentToggled())._new());
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
@@ -1351,10 +1353,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: ["aBoolean"],
-source: "showComment: aBoolean\x0a\x09self withChangesDo: [\x0a\x09\x09showComment := aBoolean.\x0a\x09\x09self announcer announce: HLShowCommentToggled new ]",
+source: "showComment: aBoolean\x0a\x09self withChangesDo: [\x0a\x09\x09showComment := aBoolean.\x0a\x09\x09'helios.browser.showComment' settingValue: aBoolean.\x0a\x09\x09self announcer announce: HLShowCommentToggled new ]",
 referencedClasses: ["HLShowCommentToggled"],
 //>>excludeEnd("ide");
-messageSends: ["withChangesDo:", "announce:", "announcer", "new"]
+messageSends: ["withChangesDo:", "settingValue:", "announce:", "announcer", "new"]
 }),
 $globals.HLBrowserModel);
 

+ 3 - 1
src/Helios-Browser.st

@@ -261,12 +261,14 @@ HLToolModel subclass: #HLBrowserModel
 !HLBrowserModel methodsFor: 'accessing'!
 
 showComment
-	^ showComment ifNil: [ true ]
+	^ showComment ifNil: [ 
+		showComment := 'helios.browser.showComment' settingValueIfAbsent: true ]
 !
 
 showComment: aBoolean
 	self withChangesDo: [
 		showComment := aBoolean.
+		'helios.browser.showComment' settingValue: aBoolean.
 		self announcer announce: HLShowCommentToggled new ]
 !
 

+ 10 - 3
src/Helios-Core.js

@@ -6185,10 +6185,17 @@ var self=this;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 return $core.withContext(function($ctx1) { 
 //>>excludeEnd("ctx");
-var $1,$2;
+var $1,$2,$3;
 $1=self._current();
 $recv($1)._setup();
 $2=$recv($1)._appendToJQuery_("body"._asJQuery());
+$3="helios.confirmOnExit"._settingValueIfAbsent_(true);
+if($core.assert($3)){
+$recv(window)._onbeforeunload_((function(){
+return "Do you want to close Amber? All uncommitted changes will be lost.";
+
+}));
+};
 return self;
 //>>excludeStart("ctx", pragmas.excludeDebugContexts);
 }, function($ctx1) {$ctx1.fill(self,"setup",{},$globals.HLManager.klass)});
@@ -6196,10 +6203,10 @@ return self;
 },
 //>>excludeStart("ide", pragmas.excludeIdeData);
 args: [],
-source: "setup\x0a\x09self current \x0a\x09\x09setup;\x0a\x09\x09appendToJQuery: 'body' asJQuery",
+source: "setup\x0a\x09self current \x0a\x09\x09setup;\x0a\x09\x09appendToJQuery: 'body' asJQuery.\x0a\x09\x0a\x09('helios.confirmOnExit' settingValueIfAbsent: true) ifTrue: [\x0a\x09\x09window onbeforeunload: [ 'Do you want to close Amber? All uncommitted changes will be lost.' ] ]",
 referencedClasses: [],
 //>>excludeEnd("ide");
-messageSends: ["setup", "current", "appendToJQuery:", "asJQuery"]
+messageSends: ["setup", "current", "appendToJQuery:", "asJQuery", "ifTrue:", "settingValueIfAbsent:", "onbeforeunload:"]
 }),
 $globals.HLManager.klass);
 

+ 4 - 1
src/Helios-Core.st

@@ -1418,7 +1418,10 @@ current
 setup
 	self current 
 		setup;
-		appendToJQuery: 'body' asJQuery
+		appendToJQuery: 'body' asJQuery.
+	
+	('helios.confirmOnExit' settingValueIfAbsent: true) ifTrue: [
+		window onbeforeunload: [ 'Do you want to close Amber? All uncommitted changes will be lost.' ] ]
 ! !
 
 !HLManager class methodsFor: 'instance creation'!