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);
74 date : this.get('/commitDate').el.get_text(),
75 author : this.get('/commitAuthor').el.get_text(),
76 message : buf.get_text(s.value, e.value1, false)
87 pack : function(p,e) {
88 p.el.get_content_area().pack_start(e.el,true,true,10);
93 pack : "pack_start,false,true,2",
98 pack : "pack_start,false,false,10",
104 changed : function (self) {
105 var val = this.el.get_child().get_text();
106 print(JSON.stringify(val));
111 var name = this.get('/remoteName').el.get_text();
116 var val = imports.Scm.Git.Repo.Repo.parseURL(val);
117 if ((typeof(val.host) != 'undefined') && val.host.length) {
119 // need to add github owner...
120 if (host.match(/github.com$/)) {
121 host += '.' + val.path.split('/').shift();
125 this.get('/remoteName').el.set_text(host);
133 this.el = new Gtk.ComboBox.with_entry();
136 this.model = new XObject(this.model);
138 this.el.set_model(this.model.el);
139 this.el.set_entry_text_column (0);
140 XObject.prototype.init.call(this);
145 //this.insert(citer,iter,0);
146 this.model.el.clear();
151 for(var i =0 ; i < tr.length; i++) {
153 this.model.el.append(ret);
154 //print(JSON.stringify(ret,null,4));
155 if (tr[i].name == 'master') {
158 if (tr[i].name == 'working') {
161 this.model.el.set_value(ret.iter, 0, '' + tr[i].name );
162 this.model.el.set_value(ret.iter, 1, '' + tr[i].rev );
166 if (master !== false) {
167 this.el.set_active(master);
169 if (working !== false) {
170 this.el.set_active(working);
175 xtype: Gtk.ListStore,
177 XObject.prototype.init.call(this);
178 this.el.set_column_types ( 3, [
179 GObject.TYPE_STRING, // file
180 GObject.TYPE_STRING, // added
181 GObject.TYPE_STRING, // removed
190 pack : "pack_start,false,true,2",
195 pack : "pack_start,false,false,10",
207 pack : "pack_start,false,true,2",
212 pack : "pack_start,false,false,10",
224 pack : "pack_start,false,false,2",
229 pack : "pack_start,false,false,10",
235 height_request : 100,
242 xtype: Gtk.ScrolledWindow,
243 height_request : 200,
244 pack : "pack_end,true,true,0",
246 XObject.prototype.init.call(this);
247 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
251 xtype: WebKit.WebView,
260 var s = "document.body.textContent='';"
262 this.el.execute_script(s);
269 showDiff : function(files) {
274 if (Commit.release === false) {
278 var diff = Commit.repo.diff(files, Commit.release, Commit.rev);
281 var s = "var pre = document.createElement('pre'); document.body.appendChild(pre);";
282 s += "pre.textContent = " +
283 JSON.stringify(Commit.repo.lastCmd + "\n") + '+ ' +
284 JSON.stringify(diff) + ";";
286 this.el.execute_script(s);
301 pack : "add_action_widget,0"
307 pack : "add_action_widget,1"
312 XObject.cache['/Commit'] = Commit;