Sample/Editor.js
authorAlan Knowles <alan@akbkhome.com>
Mon, 1 Nov 2010 03:26:49 +0000 (11:26 +0800)
committerAlan Knowles <alan@akbkhome.com>
Mon, 1 Nov 2010 03:26:49 +0000 (11:26 +0800)
Sample/Editor.js

index 82a6037..cfbd524 100644 (file)
@@ -14,7 +14,7 @@ Editor=new XObject({
     xtype: Gtk.Window,
     listeners : {
         destroy_event : function (self, event) {
-            if (!this.get('/Editor.buffer').checkSyntax) {
+            if (!this.save()) {
                 // no hiding with errors.
                 return true;
             }
@@ -22,7 +22,11 @@ Editor=new XObject({
             return true;
         },
         delete_event : function (self, event) {
-              this.el.hide();
+            if (!this.save()) {
+                // no hiding with errors.
+                return true;
+            }
+            this.el.hide();
             return true;
         },
         configure_event : function (self, object) {