README.txt
[gitlive] / Commit.bjs
index 12b0342..b24740e 100644 (file)
@@ -1,5 +1,5 @@
 {
-    "id": "file-gtk-7",
+    "id": "file-gtk-3",
     "name": "Commit",
     "parent": "",
     "title": false,
             },
             " modal": true,
             "border_width": 3,
-            "default_height": 150,
-            "default_width": 500,
-            "title": "Remotes",
+            "default_height": 500,
+            "default_width": 800,
+            "title": "Commit",
             "xtype": "Dialog",
-            "|deletable": true,
-            "|modal": true,
-            "|show": "function(c) {\n    \n    if (!this.el) {\n        this.init();\n    }\n    var _this = this;\n    //this.get('/remotesStore').load();\n   // this.get('/remoteURL').el.get_child().set_text('');\n    //this.get('/remoteName').el.set_text('');\n    \n    \n    this.el.show_all();\n    \n    var run_ret = this.el.run();\n    if (run_ret < 1 ) {\n        return false;\n    }\n    //var ret=  {\n    //    url :  this.get('/remoteURL').el.get_child().get_text(),\n    //    name :  this.get('/remoteName').el.get_text()\n    //};\n    return true;\n    return ret;\n    \n    \n    \n}\n",
+            "|deletable": "true",
+            "|modal": "true",
+            "|show": "function(c) {\n    \n    if (!this.el) {\n        this.init();\n    }\n    var _this = this;\n    \n    \n    this.files = c.files;\n    this.release = c.release;\n    this.rev = c.rev;\n    \n    this.repo = c.repo;\n\n    this.get('/commitDate').el.set_text(c.changed);\n    this.get('/commitAuthor').el.set_text(c.author);\n    this.get('/commitMsg').el.get_buffer().set_text('');\n    this.get('/commitPatch').showDiff(c.files);\n    \n    this.el.show_all();\n    \n    var run_ret = this.el.run();\n    if (run_ret < 1 ) {\n        return false;\n    }\n    var buf = this.get('/commitMsg').el.get_buffer();\n    var e = {};\n    var s = {};\n    buf.get_start_iter(s);\n    buf.get_end_iter(e);\n    \n    var ret=  {\n        date :  this.get('/commitDate').el.get_text(),\n        author :  this.get('/commitAuthor').el.get_text(),\n        message : buf.get_text(s.value, e.value, false)\n    };\n \n    return ret;\n    \n    \n    \n}\n",
             "|xns": "Gtk",
             "items": [
                 {
@@ -27,7 +27,7 @@
                     "|xns": "Gtk",
                     "items": [
                         {
-                            "pack": "pack_start,false,true,10",
+                            "pack": "pack_start,false,true,2",
                             "xtype": "HBox",
                             "|xns": "Gtk",
                             "items": [
@@ -42,7 +42,7 @@
                                     "listeners": {
                                         "changed": "function (self) {\n   var val = this.el.get_child().get_text();\n   print(JSON.stringify(val));\n   if (!val.length) {\n       return;\n   }\n   \n   var name = this.get('/remoteName').el.get_text();\n   if (name.length) {\n       return;\n   }\n   // fill in name\n   var val = imports.Scm.Git.Repo.Repo.parseURL(val);\n   if ((typeof(val.host) != 'undefined') && val.host.length) {\n       var host = val.host;\n       // need to add github owner...\n        if (host.match(/github.com$/)) {\n          host += '.' + val.path.split('/').shift();\n        }\n   \n   \n        this.get('/remoteName').el.set_text(host);\n   }\n    \n   \n}"
                                     },
-                                    "id": "remoteURL",
+                                    "id": "commitFixes",
                                     "xtype": "ComboBox",
                                     "|init": "function() {\n    this.el = new Gtk.ComboBox.with_entry();\n    \n    \n    this.model  = new XObject(this.model);\n    this.model.init();\n    this.el.set_model(this.model.el);\n    this.el.set_entry_text_column (0);\n     XObject.prototype.init.call(this);\n    \n}\n",
                                     "|load": "function(tr)\n{\n    //this.insert(citer,iter,0);\n    this.model.el.clear();\n    \n    var master = false;\n    var working = false;\n    \n    for(var i =0 ; i < tr.length; i++) {\n        var ret = {  };\n        this.model.el.append(ret);\n        //print(JSON.stringify(ret,null,4));\n        if (tr[i].name == 'master') {\n            master = i;\n        }\n        if (tr[i].name == 'working') {\n            working = i;\n        }          \n        this.model.el.set_value(ret.iter, 0, '' + tr[i].name );\n        this.model.el.set_value(ret.iter, 1, '' + tr[i].rev  );\n \n        \n    }     \n    if (master !== false) {\n        this.el.set_active(master);\n    }\n    if (working !== false) {\n        this.el.set_active(working);\n    }\n    \n}",
@@ -59,7 +59,7 @@
                             ]
                         },
                         {
-                            "pack": "pack_start,false,true,10",
+                            "pack": "pack_start,false,true,2",
                             "xtype": "HBox",
                             "|xns": "Gtk",
                             "items": [
                                     "|xns": "Gtk"
                                 }
                             ]
+                        },
+                        {
+                            "pack": "pack_start,false,true,2",
+                            "xtype": "HBox",
+                            "|xns": "Gtk",
+                            "items": [
+                                {
+                                    "label": "Author",
+                                    "pack": "pack_start,false,false,10",
+                                    "width_request": 50,
+                                    "xalign": 1,
+                                    "xtype": "Label",
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "id": "commitAuthor",
+                                    "xtype": "Entry",
+                                    "|xns": "Gtk"
+                                }
+                            ]
+                        },
+                        {
+                            "pack": "pack_start,false,false,2",
+                            "xtype": "HBox",
+                            "|xns": "Gtk",
+                            "items": [
+                                {
+                                    "label": "Message",
+                                    "pack": "pack_start,false,false,10",
+                                    "width_request": 50,
+                                    "xalign": 1,
+                                    "xtype": "Label",
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "height_request": 100,
+                                    "id": "commitMsg",
+                                    "pack": "add",
+                                    "xtype": "TextView",
+                                    "|xns": "Gtk"
+                                }
+                            ]
+                        },
+                        {
+                            "height_request": 200,
+                            "pack": "pack_end,true,true,0",
+                            "xtype": "ScrolledWindow",
+                            "|init": "function() {\n    XObject.prototype.init.call(this);\n      this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n}\n",
+                            "|xns": "Gtk",
+                            "items": [
+                                {
+                                    "id": "commitPatch",
+                                    "pack": "add",
+                                    "xtype": "WebView",
+                                    "|clear": "function() {\n    \n    \n    \n     \n   // remove..\n    var s  = \"document.body.textContent='';\"\n        \n    this.el.execute_script(s);\n        \n        \n    \n    \n    \n}\n",
+                                    "|showDiff": "function(files) {\n    this.clear();\n    \n    \n    \n    if (Commit.release === false) {\n        return;\n    }\n    \n    var diff = Commit.repo.diff(files, Commit.release, Commit.rev);\n    \n   // remove..\n    var s  = \"var pre  = document.createElement('pre'); document.body.appendChild(pre);\";\n    s += \"pre.textContent =  \" +\n             JSON.stringify(Commit.repo.lastCmd + \"\\n\") + '+  ' + \n             JSON.stringify(diff) + \";\";\n        \n    this.el.execute_script(s);\n        \n        \n    \n    \n    \n}\n",
+                                    "|xns": "WebKit"
+                                }
+                            ]
                         }
                     ]
                 },
         }
     ],
     "permname": "",
-    "modOrder": "0"
+    "modOrder": ""
 }
\ No newline at end of file