},
' modal' : true,
border_width : 3,
- default_height : 150,
- default_width : 500,
- title : "Remotes",
+ default_height : 500,
+ default_width : 800,
+ title : "Commit",
deletable : true,
modal : true,
show : function(c) {
this.init();
}
var _this = this;
- //this.get('/remotesStore').load();
- // this.get('/remoteURL').el.get_child().set_text('');
- //this.get('/remoteName').el.set_text('');
+ this.files = c.files;
+ this.release = c.release;
+ this.rev = c.rev;
+
+ this.repo = c.repo;
+
+ this.get('/commitDate').el.set_text(c.changed);
+ this.get('/commitAuthor').el.set_text(c.author);
+ this.get('/commitMsg').el.get_buffer().set_text('');
+ this.get('/commitPatch').showDiff(c.files);
+
this.el.show_all();
var run_ret = this.el.run();
if (run_ret < 1 ) {
return false;
}
- //var ret= {
- // url : this.get('/remoteURL').el.get_child().get_text(),
- // name : this.get('/remoteName').el.get_text()
- //};
- return true;
+ var buf = this.get('/commitMsg').el.get_buffer();
+ var e = {};
+ var s = {};
+ buf.get_start_iter(s);
+ buf.get_end_iter(e);
+
+ var ret= {
+ date : this.get('/commitDate').el.get_text(),
+ author : this.get('/commitAuthor').el.get_text(),
+ message : buf.get_text(s.value, e.value, false)
+ };
+
return ret;
},
{
xtype: Gtk.Entry,
- id : "commitDate"
+ id : "commitAuthor"
}
]
},
{
xtype: Gtk.HBox,
- pack : "pack_start,false,true,2",
+ pack : "pack_start,false,false,2",
items : [
{
xtype: Gtk.Label,
- label : "Author",
+ label : "Message",
pack : "pack_start,false,false,10",
width_request : 50,
xalign : 1
},
{
xtype: Gtk.TextView,
- id : "commitMsg"
+ height_request : 100,
+ id : "commitMsg",
+ pack : "add"
+ }
+ ]
+ },
+ {
+ xtype: Gtk.ScrolledWindow,
+ height_request : 200,
+ pack : "pack_end,true,true,0",
+ init : function() {
+ XObject.prototype.init.call(this);
+ this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+ },
+ items : [
+ {
+ xtype: WebKit.WebView,
+ id : "commitPatch",
+ pack : "add",
+ clear : function() {
+
+
+
+
+ // remove..
+ var s = "document.body.textContent='';"
+
+ this.el.execute_script(s);
+
+
+
+
+
+ },
+ showDiff : function(files) {
+ this.clear();
+
+
+
+ if (Commit.release === false) {
+ return;
+ }
+
+ var diff = Commit.repo.diff(files, Commit.release, Commit.rev);
+
+ // remove..
+ var s = "var pre = document.createElement('pre'); document.body.appendChild(pre);";
+ s += "pre.textContent = " +
+ JSON.stringify(Commit.repo.lastCmd + "\n") + '+ ' +
+ JSON.stringify(diff) + ";";
+
+ this.el.execute_script(s);
+
+
+
+
+
+ }
}
]
}