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);
60 this.get('/commitPatch').showDiff(c.files);
64 var run_ret = this.el.run();
68 var buf = this.get('/commitMsg').el.get_buffer();
70 date : this.get('/commitDate').el.get_text(),
71 author : this.get('/commitAuthor').el.get_text(),
72 message : buf.get_text(buf.get_start_iter(),buf.get_end_iter(), false)
83 pack : function(p,e) {
84 p.el.get_content_area().pack_start(e.el,true,true,10);
89 pack : "pack_start,false,true,2",
94 pack : "pack_start,false,false,10",
100 changed : function (self) {
101 var val = this.el.get_child().get_text();
102 print(JSON.stringify(val));
107 var name = this.get('/remoteName').el.get_text();
112 var val = imports.Scm.Git.Repo.Repo.parseURL(val);
113 if ((typeof(val.host) != 'undefined') && val.host.length) {
115 // need to add github owner...
116 if (host.match(/github.com$/)) {
117 host += '.' + val.path.split('/').shift();
121 this.get('/remoteName').el.set_text(host);
129 this.el = new Gtk.ComboBox.with_entry();
132 this.model = new XObject(this.model);
134 this.el.set_model(this.model.el);
135 this.el.set_entry_text_column (0);
136 XObject.prototype.init.call(this);
141 //this.insert(citer,iter,0);
142 this.model.el.clear();
147 for(var i =0 ; i < tr.length; i++) {
149 this.model.el.append(ret);
150 //print(JSON.stringify(ret,null,4));
151 if (tr[i].name == 'master') {
154 if (tr[i].name == 'working') {
157 this.model.el.set_value(ret.iter, 0, '' + tr[i].name );
158 this.model.el.set_value(ret.iter, 1, '' + tr[i].rev );
162 if (master !== false) {
163 this.el.set_active(master);
165 if (working !== false) {
166 this.el.set_active(working);
171 xtype: Gtk.ListStore,
173 XObject.prototype.init.call(this);
174 this.el.set_column_types ( 3, [
175 GObject.TYPE_STRING, // file
176 GObject.TYPE_STRING, // added
177 GObject.TYPE_STRING, // removed
186 pack : "pack_start,false,true,2",
191 pack : "pack_start,false,false,10",
203 pack : "pack_start,false,true,2",
208 pack : "pack_start,false,false,10",
220 pack : "pack_start,false,false,2",
225 pack : "pack_start,false,false,10",
231 height_request : 100,
238 xtype: Gtk.ScrolledWindow,
239 height_request : 200,
240 pack : "pack_end,true,true,0",
242 XObject.prototype.init.call(this);
243 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
247 xtype: WebKit.WebView,
256 var s = "document.body.textContent='';"
258 this.el.execute_script(s);
265 showDiff : function(files) {
270 if (Commit.release === false) {
274 var diff = Commit.repo.diff(files, Commit.release, Commit.rev);
277 var s = "var pre = document.createElement('pre'); document.body.appendChild(pre);";
278 s += "pre.textContent = " +
279 JSON.stringify(Commit.repo.lastCmd + "\n") + '+ ' +
280 JSON.stringify(diff) + ";";
282 this.el.execute_script(s);
297 pack : "add_action_widget,0"
303 pack : "add_action_widget,1"
308 XObject.cache['/Commit'] = Commit;