3 Pango = imports.gi.Pango;
4 GLib = imports.gi.GLib;
6 GObject = imports.gi.GObject;
7 GtkSource = imports.gi.GtkSource;
8 WebKit = imports.gi.WebKit;
10 console = imports.console;
11 XObject = imports.XObject.XObject;
15 destroy_event : function (self, event) {
19 response : function (self, id) {
25 if (typeof(this.get('bug').getValue()) != 'object') {
32 //var val = this.get('bug').getValue();
52 this.release = c.release;
57 this.get('/commitDate').el.set_text(c.changed);
58 this.get('/commitAuthor').el.set_text(c.author);
59 this.get('/commitMsg').el.get_buffer().set_text('');
60 this.get('/commitPatch').showDiff(c.files);
64 var run_ret = this.el.run();
68 var buf = this.get('/commitMsg').el.get_buffer();
71 buf.get_start_iter(s);
75 date : this.get('/commitDate').el.get_text(),
76 author : this.get('/commitAuthor').el.get_text(),
77 message : buf.get_text(s.value, e.value, false)
88 pack : function(p,e) {
89 p.el.get_content_area().pack_start(e.el,true,true,10);
94 pack : "pack_start,false,true,2",
99 pack : "pack_start,false,false,10",
105 changed : function (self) {
106 var val = this.el.get_child().get_text();
107 print(JSON.stringify(val));
112 var name = this.get('/remoteName').el.get_text();
117 var val = imports.Scm.Git.Repo.Repo.parseURL(val);
118 if ((typeof(val.host) != 'undefined') && val.host.length) {
120 // need to add github owner...
121 if (host.match(/github.com$/)) {
122 host += '.' + val.path.split('/').shift();
126 this.get('/remoteName').el.set_text(host);
134 this.el = new Gtk.ComboBox.with_entry();
137 this.model = new XObject(this.model);
139 this.el.set_model(this.model.el);
140 this.el.set_entry_text_column (0);
141 XObject.prototype.init.call(this);
146 //this.insert(citer,iter,0);
147 this.model.el.clear();
152 for(var i =0 ; i < tr.length; i++) {
154 this.model.el.append(ret);
155 //print(JSON.stringify(ret,null,4));
156 if (tr[i].name == 'master') {
159 if (tr[i].name == 'working') {
162 this.model.el.set_value(ret.iter, 0, '' + tr[i].name );
163 this.model.el.set_value(ret.iter, 1, '' + tr[i].rev );
167 if (master !== false) {
168 this.el.set_active(master);
170 if (working !== false) {
171 this.el.set_active(working);
176 xtype: Gtk.ListStore,
178 XObject.prototype.init.call(this);
179 this.el.set_column_types ( 3, [
180 GObject.TYPE_STRING, // file
181 GObject.TYPE_STRING, // added
182 GObject.TYPE_STRING, // removed
191 pack : "pack_start,false,true,2",
196 pack : "pack_start,false,false,10",
208 pack : "pack_start,false,true,2",
213 pack : "pack_start,false,false,10",
225 pack : "pack_start,false,false,2",
230 pack : "pack_start,false,false,10",
236 height_request : 100,
243 xtype: Gtk.ScrolledWindow,
244 height_request : 200,
245 pack : "pack_end,true,true,0",
247 XObject.prototype.init.call(this);
248 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
252 xtype: WebKit.WebView,
261 var s = "document.body.textContent='';"
263 this.el.execute_script(s);
270 showDiff : function(files) {
275 if (Commit.release === false) {
279 var diff = Commit.repo.diff(files, Commit.release, Commit.rev);
282 var s = "var pre = document.createElement('pre'); document.body.appendChild(pre);";
283 s += "pre.textContent = " +
284 JSON.stringify(Commit.repo.lastCmd + "\n") + '+ ' +
285 JSON.stringify(diff) + ";";
287 this.el.execute_script(s);
302 pack : "add_action_widget,0"
308 pack : "add_action_widget,1"
313 XObject.cache['/Commit'] = Commit;