gtkhotkey-0.2.1-patched.tgz
[gitlive] / Commit.js
index 78957c8..e56a48e 100644 (file)
--- a/Commit.js
+++ b/Commit.js
@@ -35,9 +35,9 @@ Commit=new XObject({
     },
     ' 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) {
@@ -46,22 +46,37 @@ Commit=new XObject({
             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;
         
         
@@ -201,28 +216,83 @@ Commit=new XObject({
                         },
                         {
                             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 : "Commit Message",
+                            label : "Message",
                             pack : "pack_start,false,false,10",
                             width_request : 50,
                             xalign : 1
                         },
                         {
                             xtype: Gtk.TextView,
-                            cursor_visable : false,
+                            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);
+                                    
+                                    
+                                
+                                
+                                
+                            }
+                        }
+                    ]
                 }
             ]
         },