src/Builder4/PopoverProperty.bjs
authorAlan Knowles <alan@roojs.com>
Mon, 1 Jun 2015 08:24:05 +0000 (16:24 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 1 Jun 2015 08:24:05 +0000 (16:24 +0800)
src/Builder4/PopoverProperty.vala

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

index fb8e837..6af2cfe 100644 (file)
@@ -13,7 +13,7 @@
    },
    "id" : "PopoverProperty",
    "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
-   "| void show" : "(Gtk.Widget btn, JsRender.Node node, string key) \n\t{\n\n\tstring kname = \"\", kflag = \"\", ktype = \"\";\n\tif (key.length > 0) {\n\t\tnode.normalize_key( key, out  kname, out  kflag, out ktype);\n\t}\n\n\t_this.kname.el.set_text(kname);\n\t_this.ktype.el.set_text(ktype);\n\t\n\t_this.dbmodel.loadData(kflag);\n\t// does node have this property...\n\n\n\tif (key.length > 0) {\n\t\tthis.save_btn.el.set_label(\"Save\");\n\t} else {\n\t\tthis.save_btn.el.set_label(\"Create\");\n\t}\n\n\t_this.node = node;\n\t//console.log('show all');\n\tthis.el.set_modal(true);\n\tthis.el.set_relative_to(btn);\n\n\tthis.el.set_position(Gtk.PositionType.TOP);\n\n\t// window + header?\n\t print(\"SHOWALL - POPIP\\n\");\n\tthis.el.show_all();\n\tthis.kname.el.grab_focus();\n\n\t//this.success = c.success;\n \n}",
+   "| void show" : "(Gtk.Widget btn, JsRender.Node node, string key) \n\t{\n\t\n\tstring kname = \"\", kflag = \"\", ktype = \"\";\n\tif (key.length > 0) {\n\t\tnode.normalize_key( key, out  kname, out  kflag, out ktype);\n\t}\n\n\t_this.kname.el.set_text(kname);\n\t_this.ktype.el.set_text(ktype);\n\t\n\t_this.dbmodel.loadData(kflag);\n\t// does node have this property...\n\n\n\tif (key.length > 0) {\n\t\tthis.save_btn.el.set_label(\"Save\");\n\t} else {\n\t\tthis.save_btn.el.set_label(\"Create\");\n\t}\n\n\t_this.node = node;\n\t//console.log('show all');\n\tthis.el.set_modal(true);\n\tthis.el.set_relative_to(btn);\n\n\tthis.el.set_position(Gtk.PositionType.TOP);\n\n\t// window + header?\n\t print(\"SHOWALL - POPIP\\n\");\n\tthis.el.show_all();\n\tthis.kname.el.grab_focus();\n\n\t//this.success = c.success;\n \n}",
    "bool done" : false,
    "# Project.Project project" : "",
    "|   void updateNodeFromValues" : "() {\n\n     /*   _this.file.title = _this.title.el.get_text();\n        _this.file.region = _this.region.el.get_text();            \n        _this.file.parent = _this.parent.el.get_text();                        \n        _this.file.permname = _this.permname.el.get_text();                                    \n        _this.file.modOrder = _this.modOrder.el.get_text();\n        \n        if (_this.file.name.length  > 0 && _this.file.name != _this.name.el.get_text()) {\n            _this.file.renameTo(_this.name.el.get_text());\n        }\n        // store the module...\n        _this.file.build_module = \"\";        \n         Gtk.TreeIter iter; \n        if (_this.build_module.el.get_active_iter (out iter)) {\n             Value vfname;\n             this.dbmodel.el.get_value (iter, 0, out vfname);\n             if (((string)vfname).length > 0) {\n                 _this.file.build_module = (string)vfname;\n             }\n    \n        }\n        */\n        \n        \n\n                                                    \n}    ",
@@ -28,8 +28,8 @@
    "items" : [
     {
      "bool homogeneous" : false,
-     "xtype" : "Box",
      "$ pack" : "add",
+     "xtype" : "Box",
      "$ xns" : "Gtk",
      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
      "items" : [
@@ -41,8 +41,8 @@
       },
       {
        "int margin_right" : 4,
-       "xtype" : "Table",
        "* pack" : "pack_start,false,false,4",
+       "xtype" : "Table",
        "uint row_spacing" : 2,
        "n_columns" : 2,
        "$ xns" : "Gtk",
          "items" : [
           {
            "id" : "dbcellrenderer",
-           "* pack" : "pack_start,true",
            "xtype" : "CellRendererText",
+           "* pack" : "pack_start,true",
            "$ xns" : "Gtk"
           },
           {
            "id" : "dbmodel",
-           "* pack" : "set_model",
            "xtype" : "ListStore",
+           "* pack" : "set_model",
            "$ columns" : "typeof(string),typeof(string)",
            "n_columns" : 2,
            "$ xns" : "Gtk",
         },
         {
          "label" : "Name",
-         "$ visible" : true,
          "tooltip_text" : "center, north, south, east, west",
+         "$ visible" : true,
          "xalign" : 0.90000000000000002,
          "* pack" : "attach_defaults,0,1,2,3",
          "xtype" : "Label",
          "listeners" : {
           "clicked" : "() => { \n\n  _this.done = true;\n    _this.el.hide(); \n}"
          },
+         "string label" : "Cancel",
          "* pack" : "add",
          "xtype" : "Button",
-         "string label" : "Cancel",
          "$ xns" : "Gtk"
         },
         {
           "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",
+         "xtype" : "Button",
          "string label" : "Save",
          "$ xns" : "Gtk"
         }
index d800016..a4cfbb7 100644 (file)
@@ -58,7 +58,7 @@ public class Xcls_PopoverProperty : Object
     // user defined functions
     public void show (Gtk.Widget btn, JsRender.Node node, string key) 
        {
-    
+       
        string kname = "", kflag = "", ktype = "";
        if (key.length > 0) {
                node.normalize_key( key, out  kname, out  kflag, out ktype);