src/Builder4/PopoverProperty.bjs
authorAlan Knowles <alan@roojs.com>
Mon, 1 Jun 2015 09:37:31 +0000 (17:37 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 1 Jun 2015 09:37:31 +0000 (17:37 +0800)
src/Builder4/PopoverProperty.vala

src/Builder4/PopoverProperty.bjs
src/Builder4/PopoverProperty.vala

index 0ef1e96..47ddaae 100644 (file)
@@ -9,7 +9,7 @@
  "items" : [
   {
    "listeners" : {
-    "closed" : "() => {\n  if (!this.done) {\n    _this.el.show();\n  \n  }\n  \n  \n  var newtext = \"\";\n  Gtk.TreeIter citer;\n  GLib.Value gval;\n  this.kflag.el.get_active_iter(out citer);\n  this.dbmodel.el.get_value(citer, 0, out  gval);\n  \n  newtext += (string)gval;  \n  newtext += this.ktype.el.get_text().length > 0 && newtext.length > 0 ? \" \" :\"\";\n  newtext += this.ktype.el.get_text() ;\n  newtext += this.kname.el.get_text().length > 0 && newtext.length > 0 ? \" \" :\"\";\n  newtext += this.kname.el.get_text();\n  \n  \n   var lp =  _this.mainwindow.windowstate.left_props;\n    \n    switch(this.key_type) {\n        case \"listener\":\n            var ov = _this.node.listeners.get(this.old_keyname);\n            _this.node.listeners.set(newtext, ov);\n            _this.node.listeners.unset(this.old_keyname);\n            \n            \n            lp.updateKey(this.old_keyname, this.key_type, newtext);\n            \n            break;\n        case \"props\":\n            var ov = _this.node.props.get(this.old_keyname);\n            _this.node.props.set(newtext, ov);\n            _this.node.props.unset(this.old_keyname);\n            lp.updateKey(this.old_keyname, this.key_type, newtext);\n            break;\n     }\n   \n  \n  \n} "
+    "closed" : "() => {\n \n  \n  var newtext = \"\";\n  Gtk.TreeIter citer;\n  GLib.Value gval;\n  this.kflag.el.get_active_iter(out citer);\n  this.dbmodel.el.get_value(citer, 0, out  gval);\n  \n  newtext += (string)gval;  \n  newtext += this.ktype.el.get_text().length > 0 && newtext.length > 0 ? \" \" :\"\";\n  newtext += this.ktype.el.get_text() ;\n  newtext += this.kname.el.get_text().length > 0 && newtext.length > 0 ? \" \" :\"\";\n  newtext += this.kname.el.get_text();\n  \n  \n   var lp =  _this.mainwindow.windowstate.left_props;\n    \n    switch(this.key_type) {\n        case \"listener\":\n            var ov = _this.node.listeners.get(this.old_keyname);\n            _this.node.listeners.set(newtext, ov);\n            _this.node.listeners.unset(this.old_keyname);\n            \n            \n            lp.updateKey(this.old_keyname, this.key_type, newtext);\n            \n            break;\n        case \"props\":\n            var ov = _this.node.props.get(this.old_keyname);\n            _this.node.props.set(newtext, ov);\n            _this.node.props.unset(this.old_keyname);\n            lp.updateKey(this.old_keyname, this.key_type, newtext);\n            break;\n     }\n   \n  \n  \n} "
    },
    "string old_keyname" : "",
    "id" : "PopoverProperty",
          "$ xns" : "Gtk"
         }
        ]
-      },
-      {
-       "int margin_bottom" : 4,
-       "int margin_right" : 4,
-       "* pack" : "pack_end,false,true,0",
-       "xtype" : "HButtonBox",
-       "$ xns" : "Gtk",
-       "int margin_left" : 4,
-       "items" : [
-        {
-         "listeners" : {
-          "clicked" : "() => { \n\n  _this.done = true;\n    _this.el.hide(); \n}"
-         },
-         "xtype" : "Button",
-         "string label" : "Cancel",
-         "* pack" : "add",
-         "$ xns" : "Gtk"
-        },
-        {
-         "listeners" : {
-          "clicked" : "( ) =>  { \n\n  \n/*\n\n\tif (_this.name.el.get_text().length  < 1) {\n\t    StandardErrorDialog.show(\n\t        _this.mainwindow.el,\n\t        \"You have to set Component name \"\n\t    );\n\t     \n\t    return;\n\t}\n\t// what does this do?\n\t\n\tvar isNew = _this.file.name.length  > 0 ? false : true;\n\t \n\t \n\t\n  \n\t// FIXME - this may be more complicated...\n\t//for (var i in this.def) {\n\t//    this.file[i] =  this.get(i).el.get_text();\n\t//}\n\n\tif (!isNew) {\n\t    try {\n\t         _this.updateFileFromEntry();\n\t     } catch( JsRender.Error.RENAME_FILE_EXISTS er) {\n\t          Xcls_StandardErrorDialog.singleton().show(\n\t            _this.mainwindow.el,\n\t            \"The name you used already exists \"\n\t        );\n\t        return;\n\t         \n\t     }\n\n\t      _this.done = true;\n\t    _this.file.save();\n\t    _this.el.hide();\n\t    return;\n\t}\n\tvar fn = _this.name.el.get_text();\n\tvar dir = _this.project.firstPath();\n   \n\tif (GLib.FileUtils.test(dir + \"/\" + fn + \".bjs\", GLib.FileTest.EXISTS)) {\n\t    Xcls_StandardErrorDialog.singleton().show(\n\t        _this.mainwindow.el,\n\t        \"That file already exists\"\n\t    ); \n\t    return;\n\t}\n   \n   var f =  JsRender.JsRender.factory(\n\t\t_this.file.project.xtype,  \n\t\t_this.file.project, \n\t\tdir + \"/\" + fn + \".bjs\");\n\n\t_this.file = f;\n\t\n\n\t\n\t_this.updateFileFromEntry();\n\t_this.file.loaded = true;\n\t_this.file.save();\n\t_this.file.project.addFile(_this.file);\n\t\n \n\t// what about .js ?\n   _this.done = true;\n\t_this.el.hide();\n\n\t\n\t\n\t_this.success(_this.project, _this.file);\n\t*/\n   \n}"
-         },
-         "id" : "save_btn",
-         "xtype" : "Button",
-         "* pack" : "add",
-         "string label" : "Save",
-         "$ xns" : "Gtk"
-        }
-       ]
       }
      ]
     }
index bdd2000..e00cd6c 100644 (file)
@@ -18,7 +18,6 @@ public class Xcls_PopoverProperty : Object
     public Xcls_dbmodel dbmodel;
     public Xcls_ktype ktype;
     public Xcls_kname kname;
-    public Xcls_save_btn save_btn;
 
         // my vars (def)
     public string old_keyname;
@@ -48,11 +47,7 @@ public class Xcls_PopoverProperty : Object
 
         //listeners
         this.el.closed.connect( () => {
-          if (!this.done) {
-            _this.el.show();
-          
-          }
-          
+         
           
           var newtext = "";
           Gtk.TreeIter citer;
@@ -191,9 +186,6 @@ public class Xcls_PopoverProperty : Object
             var child_1 = new Xcls_Table4( _this );
             child_1.ref();
             this.el.pack_start (  child_1.el , false,false,4 );
-            var child_2 = new Xcls_HButtonBox13( _this );
-            child_2.ref();
-            this.el.pack_end (  child_2.el , false,true,0 );
         }
 
         // user defined functions
@@ -537,170 +529,5 @@ public class Xcls_PopoverProperty : Object
     }
 
 
-    public class Xcls_HButtonBox13 : Object
-    {
-        public Gtk.HButtonBox el;
-        private Xcls_PopoverProperty  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_HButtonBox13(Xcls_PopoverProperty _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.HButtonBox();
-
-            // my vars (dec)
-
-            // set gobject values
-            this.el.margin_right = 4;
-            this.el.margin_left = 4;
-            this.el.margin_bottom = 4;
-            var child_0 = new Xcls_Button14( _this );
-            child_0.ref();
-            this.el.add (  child_0.el  );
-            var child_1 = new Xcls_save_btn( _this );
-            child_1.ref();
-            this.el.add (  child_1.el  );
-        }
-
-        // user defined functions
-    }
-    public class Xcls_Button14 : Object
-    {
-        public Gtk.Button el;
-        private Xcls_PopoverProperty  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_Button14(Xcls_PopoverProperty _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.Button();
-
-            // my vars (dec)
-
-            // set gobject values
-            this.el.label = "Cancel";
-
-            //listeners
-            this.el.clicked.connect( () => { 
-            
-              _this.done = true;
-                _this.el.hide(); 
-            });
-        }
-
-        // user defined functions
-    }
-
-    public class Xcls_save_btn : Object
-    {
-        public Gtk.Button el;
-        private Xcls_PopoverProperty  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_save_btn(Xcls_PopoverProperty _owner )
-        {
-            _this = _owner;
-            _this.save_btn = this;
-            this.el = new Gtk.Button();
-
-            // my vars (dec)
-
-            // set gobject values
-            this.el.label = "Save";
-
-            //listeners
-            this.el.clicked.connect( ( ) =>  { 
-            
-              
-            /*
-            
-               if (_this.name.el.get_text().length  < 1) {
-                   StandardErrorDialog.show(
-                       _this.mainwindow.el,
-                       "You have to set Component name "
-                   );
-                    
-                   return;
-               }
-               // what does this do?
-               
-               var isNew = _this.file.name.length  > 0 ? false : true;
-                
-                
-               
-              
-               // FIXME - this may be more complicated...
-               //for (var i in this.def) {
-               //    this.file[i] =  this.get(i).el.get_text();
-               //}
-            
-               if (!isNew) {
-                   try {
-                        _this.updateFileFromEntry();
-                    } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
-                         Xcls_StandardErrorDialog.singleton().show(
-                           _this.mainwindow.el,
-                           "The name you used already exists "
-                       );
-                       return;
-                        
-                    }
-            
-                     _this.done = true;
-                   _this.file.save();
-                   _this.el.hide();
-                   return;
-               }
-               var fn = _this.name.el.get_text();
-               var dir = _this.project.firstPath();
-               
-               if (GLib.FileUtils.test(dir + "/" + fn + ".bjs", GLib.FileTest.EXISTS)) {
-                   Xcls_StandardErrorDialog.singleton().show(
-                       _this.mainwindow.el,
-                       "That file already exists"
-                   ); 
-                   return;
-               }
-               
-               var f =  JsRender.JsRender.factory(
-                       _this.file.project.xtype,  
-                       _this.file.project, 
-                       dir + "/" + fn + ".bjs");
-            
-               _this.file = f;
-               
-            
-               
-               _this.updateFileFromEntry();
-               _this.file.loaded = true;
-               _this.file.save();
-               _this.file.project.addFile(_this.file);
-               
-             
-               // what about .js ?
-               _this.done = true;
-               _this.el.hide();
-            
-               
-               
-               _this.success(_this.project, _this.file);
-               */
-               
-            });
-        }
-
-        // user defined functions
-    }
-
-
 
 }