Partial Fix #5560 - Gitlive - branching wip
authorAlan Knowles <alan@roojs.com>
Fri, 14 Dec 2018 08:18:01 +0000 (16:18 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 14 Dec 2018 08:18:01 +0000 (16:18 +0800)
17 files changed:
Clone.bjs [new file with mode: 0644]
Clone.vala [new file with mode: 0644]
Clones.bjs
Clones.vala
GitRepo.vala
Makefile.am
MergeBranch.bjs
MergeBranch.vala
Monitor.vala
NewBranch.bjs
NewBranch.vala
RepoStatusPopover.bjs
RepoStatusPopover.vala
RooTicket.vala
config1.builder
old_seed_version/Commit.bjs
old_seed_version/Merger.bjs

diff --git a/Clone.bjs b/Clone.bjs
new file mode 100644 (file)
index 0000000..e6e034f
--- /dev/null
+++ b/Clone.bjs
@@ -0,0 +1,68 @@
+{
+ "name" : "Clone",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/alan/gitlive/gitlive/Clone.bjs",
+ "permname" : "",
+ "modOrder" : "",
+ "build_module" : "gitlive",
+ "items" : [
+  {
+   "| void show" : " (Gtk.Widget btn) {\n \n    \t//console.log('show all');\n\tthis.el.set_modal(true);\n\tthis.el.set_relative_to(btn);\n  \tthis.repomodel.loadRepos();\n\t//this.el.set_position(Gtk.PositionType.RIGHT);\n\n\t// window + header?\n\t GLib.debug(\"SHOWALL - POPIP\\n\");\n\tthis.el.show_all();\n;\n}\n",
+   "xtype" : "Popover",
+   "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
+   "$ xns" : "Gtk",
+   "bool modal" : true,
+   "uint border_width" : 0,
+   "items" : [
+    {
+     "* pack" : "add",
+     "xtype" : "Box",
+     "gboolean expand" : false,
+     "$ xns" : "Gtk",
+     "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+     "gboolean vexpand" : false,
+     "items" : [
+      {
+       "* ctor" : "new Gtk.ComboBox.with_entry()",
+       "| string selectedRepo" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.repomodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
+       "id" : "reposel",
+       "* init" : "this.el.set_entry_text_column(1);",
+       "bool hexpand" : true,
+       "* pack" : "add",
+       "xtype" : "ComboBox",
+       "# bool loading" : false,
+       "$ xns" : "Gtk",
+       "items" : [
+        {
+         "id" : "prcellrenderer",
+         "xtype" : "CellRendererText",
+         "* pack" : "pack_start,true",
+         "$ xns" : "Gtk"
+        },
+        {
+         "id" : "repomodel",
+         "| void loadRepos" : "  () {\n\n    var rt = RooTicket.singleton();\n    var gr = GitRepo.singleton();\n    _this.reposel.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a repo --\");\n \n\t_this.reposel.el.set_active_iter(iter);\n    \n    var projects = rt.projects;\n    foreach(var newrepo in rt.repos) {\n    \tvar has_repo = false;\n    \tforeach(var repo in gr.cache.values) {\n    \t\tif (newrepo.shortname == repo.name) {\n    \t\t\thas_repo = true;\n    \t\t}\n    \t}\n    \tif (has_repo) {\n    \t\tcontinue;\n\t\t}\n        el.append(out iter);\n        \n        el.set_value(iter, 0, newrepo.shortname);\n        el.set_value(iter, 1, newrepo.shortname); // \"%s : %s\".printf(newrepo.shortname, newrepo.description) );\n       \n        \n    }\n    \n    _this.reposel.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
+         "* pack" : "set_model",
+         "xtype" : "ListStore",
+         "$ columns" : "typeof(string),typeof(string)",
+         "n_columns" : 2,
+         "$ xns" : "Gtk"
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "button_press_event" : "() => {\n      _this.el.hide();\n      Clones.singleton().el.hide();\n     var repo = _this.reposel.selectedRepo();\n        GitMonitor.gitmonitor.stop();\n        \n    \n        string[]  args = { \"git\" , \"--no-pager\" , \"clone\" };\n    \n        args +=  (\"http://git.roojs.com/\" + repo );\n \n    \n\n        string[]   env = {};\n        string  home = \"HOME=\" + Environment.get_home_dir() ;\n        env +=  home ;\n   \t\t//v.push(\"GITPATH=\" + this.repo );\n        //}\n          \n        var cfg = new SpawnConfig(Environment.get_home_dir() + \"/gitlive\" , args , env);\n        //cfg.debug = true;\n\n       // may throw error...\n        var sp = new Spawn(cfg);\n      \n      \t GLib.debug(\"Spawn: %s\", sp.output);\n\t\n        \n        \n        \n        \n        \n        GitMonitor.gitmonitor.start();\n\n         GitRepo.updateAll(\"show_clones\");\n      \n        return false;\n}"
+       },
+       "label" : "Checkout",
+       "xtype" : "Button",
+       "* pack" : "add",
+       "$ xns" : "Gtk"
+      }
+     ]
+    }
+   ]
+  }
+ ]
+}
\ No newline at end of file
diff --git a/Clone.vala b/Clone.vala
new file mode 100644 (file)
index 0000000..afad682
--- /dev/null
@@ -0,0 +1,283 @@
+static Clone  _Clone;
+
+public class Clone : Object
+{
+    public Gtk.Popover el;
+    private Clone  _this;
+
+    public static Clone singleton()
+    {
+        if (_Clone == null) {
+            _Clone= new Clone();
+        }
+        return _Clone;
+    }
+    public Xcls_reposel reposel;
+    public Xcls_prcellrenderer prcellrenderer;
+    public Xcls_repomodel repomodel;
+
+        // my vars (def)
+
+    // ctor
+    public Clone()
+    {
+        _this = this;
+        this.el = new Gtk.Popover( null );
+
+        // my vars (dec)
+
+        // set gobject values
+        this.el.border_width = 0;
+        this.el.modal = true;
+        this.el.position = Gtk.PositionType.RIGHT;
+        var child_0 = new Xcls_Box2( _this );
+        child_0.ref();
+        this.el.add (  child_0.el  );
+    }
+
+    // user defined functions
+    public void show (Gtk.Widget btn) {
+     
+               //console.log('show all');
+       this.el.set_modal(true);
+       this.el.set_relative_to(btn);
+       this.repomodel.loadRepos();
+       //this.el.set_position(Gtk.PositionType.RIGHT);
+    
+       // window + header?
+        GLib.debug("SHOWALL - POPIP\n");
+       this.el.show_all();
+    ;
+    }
+    public class Xcls_Box2 : Object
+    {
+        public Gtk.Box el;
+        private Clone  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_Box2(Clone _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.expand = false;
+            this.el.vexpand = false;
+            var child_0 = new Xcls_reposel( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_Button6( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+        }
+
+        // user defined functions
+    }
+    public class Xcls_reposel : Object
+    {
+        public Gtk.ComboBox el;
+        private Clone  _this;
+
+
+            // my vars (def)
+        public bool loading;
+
+        // ctor
+        public Xcls_reposel(Clone _owner )
+        {
+            _this = _owner;
+            _this.reposel = this;
+            this.el = new Gtk.ComboBox.with_entry();
+
+            // my vars (dec)
+            this.loading = false;
+
+            // set gobject values
+            this.el.hexpand = true;
+            var child_0 = new Xcls_prcellrenderer( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , true );
+            var child_1 = new Xcls_repomodel( _this );
+            child_1.ref();
+            this.el.set_model (  child_1.el  );
+
+            // init method
+
+            this.el.set_entry_text_column(1);
+        }
+
+        // user defined functions
+        public string selectedRepo () {
+               Gtk.TreeIter iter;
+               Value val1;
+         
+         
+               this.el.get_active_iter (out iter);
+               _this.repomodel.el.get_value (iter, 0, out val1);
+         
+        
+               return  (string) val1;
+               
+               
+               
+               
+        }
+    }
+    public class Xcls_prcellrenderer : Object
+    {
+        public Gtk.CellRendererText el;
+        private Clone  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_prcellrenderer(Clone _owner )
+        {
+            _this = _owner;
+            _this.prcellrenderer = this;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions
+    }
+
+    public class Xcls_repomodel : Object
+    {
+        public Gtk.ListStore el;
+        private Clone  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_repomodel(Clone _owner )
+        {
+            _this = _owner;
+            _this.repomodel = this;
+            this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions
+        public void loadRepos () {
+        
+            var rt = RooTicket.singleton();
+            var gr = GitRepo.singleton();
+            _this.reposel.loading = true;
+        
+            this.el.clear();                                    
+            Gtk.TreeIter iter;
+            var el = this.el;
+            
+            el.append(out iter);
+        
+            
+            el.set_value(iter, 0, "");
+            el.set_value(iter, 1, "-- select a repo --");
+         
+               _this.reposel.el.set_active_iter(iter);
+            
+            var projects = rt.projects;
+            foreach(var newrepo in rt.repos) {
+               var has_repo = false;
+               foreach(var repo in gr.cache.values) {
+                       if (newrepo.shortname == repo.name) {
+                               has_repo = true;
+                       }
+               }
+               if (has_repo) {
+                       continue;
+                       }
+                el.append(out iter);
+                
+                el.set_value(iter, 0, newrepo.shortname);
+                el.set_value(iter, 1, newrepo.shortname); // "%s : %s".printf(newrepo.shortname, newrepo.description) );
+               
+                
+            }
+            
+            _this.reposel.loading = false;
+             //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
+                                             
+        }
+    }
+
+
+    public class Xcls_Button6 : Object
+    {
+        public Gtk.Button el;
+        private Clone  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_Button6(Clone _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Checkout";
+
+            //listeners
+            this.el.button_press_event.connect( () => {
+                  _this.el.hide();
+                  Clones.singleton().el.hide();
+                 var repo = _this.reposel.selectedRepo();
+                    GitMonitor.gitmonitor.stop();
+                    
+                
+                    string[]  args = { "git" , "--no-pager" , "clone" };
+                
+                    args +=  ("http://git.roojs.com/" + repo );
+             
+                
+            
+                    string[]   env = {};
+                    string  home = "HOME=" + Environment.get_home_dir() ;
+                    env +=  home ;
+                               //v.push("GITPATH=" + this.repo );
+                    //}
+                      
+                    var cfg = new SpawnConfig(Environment.get_home_dir() + "/gitlive" , args , env);
+                    //cfg.debug = true;
+            
+                   // may throw error...
+                    var sp = new Spawn(cfg);
+                  
+                        GLib.debug("Spawn: %s", sp.output);
+               
+                    
+                    
+                    
+                    
+                    
+                    GitMonitor.gitmonitor.start();
+            
+                     GitRepo.updateAll("show_clones");
+                  
+                    return false;
+            });
+        }
+
+        // user defined functions
+    }
+
+
+}
index fea00e0..6662012 100644 (file)
@@ -14,7 +14,7 @@
    },
    "boolean deletable" : true,
    "default_width" : 1024,
-   "| void show" : "()    {\n\n    \n    this.el.set_deletable(true);\n    this.el.set_gravity(Gdk.Gravity.NORTH);\n    this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);\n    \n    this.el.set_default_size(\n\t\t\tint.min(1024,Gdk.Screen.width()),\n\t\t\tint.max(500,Gdk.Screen.width() - 300)\n\t);\n    \n    this.el.show_all();\n    _this.reposStore.load();\n    this.el.set_keep_above(true);\n    this.el.run();\n    // load clones..\n//     this.get('/reposStore').load();\n    \n    //this.get('/ok_button').el.set_sensitive(false);\n    \n    // block until we return.\n//    var run_ret = this.el.run();\n//    if (run_ret < 1 ) {\n//        return  \"DONE\";\n//    }\n//    print(\"RUN RETURN : \" + run_ret);\n//    return \"DONE\";\n    //print(JSON.stringify(this.get('bug').getValue()));\n   // return this.get('bug').getValue();\n    //this.success = c.success;\n}\n",
+   "| void show" : "()    {\n\n    \n    this.el.set_deletable(true);\n    this.el.set_gravity(Gdk.Gravity.NORTH);\n    this.el.move((Gdk.Screen.width() / 2 ) -400 ,0);\n    \n    this.el.set_default_size(\n\t\t\tint.min(1024,Gdk.Screen.width()),\n\t\t\tint.max(500,Gdk.Screen.height() - 300)\n\t);\n     \n    this.el.show_all();\n    _this.reposStore.load();\n    this.el.set_keep_above(true);\n    this.el.run();\n    // load clones..\n//     this.get('/reposStore').load();\n    \n    //this.get('/ok_button').el.set_sensitive(false);\n    \n    // block until we return.\n//    var run_ret = this.el.run();\n//    if (run_ret < 1 ) {\n//        return  \"DONE\";\n//    }\n//    print(\"RUN RETURN : \" + run_ret);\n//    return \"DONE\";\n    //print(JSON.stringify(this.get('bug').getValue()));\n   // return this.get('bug').getValue();\n    //this.success = c.success;\n}\n",
    "title" : "Manage Clones",
    "xtype" : "Dialog",
    "default_height" : 500,
      "items" : [
       {
        "bool homogeneous" : true,
-       "xtype" : "Box",
        "* pack" : "pack_start,false,false,0",
+       "xtype" : "Box",
        "$ xns" : "Gtk",
        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
        "items" : [
         {
          "listeners" : {
-          "clicked" : "() => {\n\n/*    var rv = this.get('/reposView');\n    var rs = this.get('/reposStore');\n    if (rv.el.get_selection().count_selected_rows() != 1) {\n        //nothing?\n        // error condition.\n        return;\n    }\n    var Remotes =     imports.Remotes.Remotes;\n    \n \n    var ret = {};       \n    var s = rv.el.get_selection();\n    var path = '';\n    s.selected_foreach(function(model,p,iter) {\n                                                    \n       path = model.get_value(iter, 6).value.get_string();\n     \n    }); \n\n    var repo = false;\n    rs.repos.forEach(function(r) {\n        if (r.repopath == path) {\n            repo = r;\n        \n        }\n    \n    });\n    Remotes.repo = repo;\n    Remotes.el.set_transient_for(Clones.el);\n    Clones.el.set_title(\"Manage Clones - \" + repo.repopath);\n    Remotes.show();\n    Clones.el.set_title(\"Manage Clones\");\n\n  */   \n    \n     \n\n       \n    \n    \n}"
+          "clicked" : "() => {\n\t\tClone.singleton().show(this.el);\n    \n    \n    \n}"
          },
          "label" : "Add Repository",
-         "xtype" : "Button",
-         "* pack" : "add",
-         "$ xns" : "Gtk"
-        },
-        {
-         "listeners" : {
-          "clicked" : "() => {\n// \n\n\t//NewBranch.singleton().show();\n\n/*\n    var rv = this.get('/reposView');\n    var rs = this.get('/reposStore');\n    if (rv.el.get_selection().count_selected_rows() != 1) {\n        //nothing?\n        // error condition.\n        return;\n    }\n    var Branches =     imports.Branches.Branches;\n    \n \n    var ret = {};       \n    var s = rv.el.get_selection();\n    var path = '';\n    s.selected_foreach(function(model,p,iter) {\n                                                    \n       path = model.get_value(iter, 6).value.get_string();\n     \n    }); \n\n    var repo = false;\n    rs.repos.forEach(function(r) {\n        if (r.repopath == path) {\n            repo = r;\n        \n        }\n    \n    });\n    Branches.repo = repo;\n    Branches.el.set_transient_for(Clones.el);\n    Clones.el.set_title(\"Manage Clones - \" + repo.repopath);\n    Branches.show();\n    Clones.el.set_title(\"Manage Clones\");\n\n     \n    \n    \n    \n\n       \n */   \n    \n}"
-         },
-         "label" : "Branches",
-         "xtype" : "Button",
-         "* pack" : "add",
-         "$ xns" : "Gtk",
-         "bool visible" : false
-        },
-        {
-         "listeners" : {
-          "clicked" : "() =>  {\n\n\tvar rv = _this.reposView;\n\tvar rs = _this.reposStore;\n\tvar s =rv.el.get_selection();\n\tif (s.count_selected_rows() != 1) {\n\t\treturn;\n\t}\n\tGtk.TreeIter iter;\n\tGtk.TreeModel tm;\n\ts.get_selected(out tm, out iter);\n\tGLib.Value val;\n    tm.get_value(iter, 6, out val);\n    var git_working_dir = (string)val;\n    \n    var repo = GitRepo.singleton().get(git_working_dir);\n    \n    // if you hit merge.... in master..\n    // ignore..\n    if (repo.currentBranch.name == \"master\") {\n    \treturn;\n\t}\n\tMergeBranch.singleton().show(repo.activeTicket, repo);\n\t_this.reposStore.load();\n\t\n \n    \n}\n\n"
-         },
-         "label" : "Merge",
-         "xtype" : "Button",
-         "* pack" : "add",
-         "$ xns" : "Gtk"
-        },
-        {
-         "listeners" : {
-          "clicked" : "() => {\n    \n    \n \n       \n    \n    \n}"
-         },
-         "label" : "Switch Branch",
-         "xtype" : "Button",
          "* pack" : "add",
-         "$ xns" : "Gtk",
-         "bool visible" : false
-        },
-        {
-         "listeners" : {
-          "clicked" : "() =>  {\n\n\tvar rv = _this.reposView;\n\tvar rs = _this.reposStore;\n\tvar s =rv.el.get_selection();\n\tif (s.count_selected_rows() != 1) {\n\t\treturn;\n\t}\n\tGtk.TreeIter iter;\n\tGtk.TreeModel tm;\n\ts.get_selected(out tm, out iter);\n\tGLib.Value val;\n    tm.get_value(iter, 6, out val);\n    var git_working_dir = (string)val;\n    \n    var repo = GitRepo.singleton().get(git_working_dir);\n    GitMonitor.gitmonitor.pause();    \n    repo.pull();\n    repo.loadStatus();\n    _this.reposStore.load();\n    GitMonitor.gitmonitor.start(); \n\n \n    \n}\n\n"
-         },
-         "label" : "Pull",
          "xtype" : "Button",
-         "* pack" : "add",
          "$ xns" : "Gtk"
         }
        ]
       },
       {
        "* init" : "  {\n  \n   this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n}\n",
-       "bool expand" : true,
        "bool hexpand" : true,
+       "bool expand" : true,
        "xtype" : "ScrolledWindow",
        "* pack" : "pack_end,true,true,0",
        "Gtk.ShadowType shadow_type" : "Gtk.ShadowType.IN",
@@ -99,8 +61,8 @@
           "cursor_changed" : "()  => {\n  // SEE SELECTION.CHANGED\n  /*\n  \n  return;\n  \n    if (this.el.get_selection().count_selected_rows() < 1) {\n        //nothing? - clea it?\n        return;\n    }\n        var ret = {};         \n    var model = this.get('/changedFilesStore');\n\n     var s = this.el.get_selection();\n     var files = [];\n    s.selected_foreach(function(model,p,iter) {\n    \n       files.push( model.get_value(iter, 0).value.get_string());\n     \n    });\n    this.get('/patchview').showDiff(files); \n    //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();\n     //print(\"OUT?\" + value);// id..\n    // load the list in the right grid..\n     \n    return true;\n*/\n}"
          },
          "id" : "reposView",
-         "* init" : " \n{\n    var selection = this.el.get_selection();\n    selection.set_mode( Gtk.SelectionMode.SINGLE);\n\n\n    var description = new Pango.FontDescription();\n    description.set_size(10000);\n    this.el.override_font(description);\n \n}\n",
          "bool activate_on_single_click" : true,
+         "* init" : " \n{\n    var selection = this.el.get_selection();\n    selection.set_mode( Gtk.SelectionMode.SINGLE);\n\n\n    var description = new Pango.FontDescription();\n    description.set_size(10000);\n    this.el.override_font(description);\n \n}\n",
          "xtype" : "TreeView",
          "* pack" : "add",
          "int search_column" : 0,
               "toggled" : "  (self, path)  => {\n  \n  \tGtk.TreeIter iter;\n  \t_this.reposStore.el.get_iter_from_string(out iter, path);\n  \t\n  \tGLib.Value val;\n  \tGLib.Value rval;\n  \t_this.reposStore.el.get_value(iter, 4, out val);\n  \t_this.reposStore.el.get_value(iter, 6, out rval);\n  \t\n  \tvar repopath = (string)rval;\n  \tvar bval = (bool)val;\n  \t_this.reposStore.el.set_value(iter, 4, !bval);\n  \tGLib.debug(\"got repopath? %s\", repopath);\n  \t\n  \tvar repo = GitRepo.get(repopath);\n  \trepo.set_autocommit(!bval);\n  \t\n  \t\n  \t\n  \n}"
              },
              "id" : "cr_autocommit",
-             "xtype" : "CellRendererToggle",
              "* pack" : "pack_start,false",
+             "xtype" : "CellRendererToggle",
              "$ xns" : "Gtk",
              "$ mode" : "Gtk.CellRendererMode.ACTIVATABLE"
             }
               "toggled" : "  (self, path)  => {\n  \n  \tGtk.TreeIter iter;\n  \t_this.reposStore.el.get_iter_from_string(out iter, path);\n  \t\n  \tGLib.Value val;\n  \tGLib.Value rval;\n  \t_this.reposStore.el.get_value(iter, 5, out val);\n  \t_this.reposStore.el.get_value(iter, 6, out rval);\n  \t\n  \tvar repopath = (string)rval;\n  \tvar bval = (bool)val;\n  \t_this.reposStore.el.set_value(iter, 5, !bval);\n  \tvar repo = GitRepo.get(repopath);\n  \trepo.set_autopush(!bval);\n  \t\n  \t\n  \t\n  \n}"
              },
              "id" : "cr_autopush",
-             "xtype" : "CellRendererToggle",
              "* pack" : "pack_start,false",
+             "xtype" : "CellRendererToggle",
              "$ xns" : "Gtk",
              "$ mode" : "Gtk.CellRendererMode.ACTIVATABLE"
             }
               "toggled" : "  (self, path)  => {\n  \n  \tGtk.TreeIter iter;\n  \t_this.reposStore.el.get_iter_from_string(out iter, path);\n  \t\n  \tGLib.Value val;\n  \tGLib.Value rval;\n  \t_this.reposStore.el.get_value(iter, 8, out val);\n  \t_this.reposStore.el.get_value(iter, 6, out rval);\n  \t\n  \tvar repopath = (string)rval;\n  \tvar bval = (bool)val;\n  \t_this.reposStore.el.set_value(iter, 8, !bval);\n  \tvar repo = GitRepo.get(repopath);\n  \trepo.set_auto_branch(!bval);\n  \t\n  \t\n  \t\n  \n}"
              },
              "id" : "cr_autobranch",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererToggle",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk",
              "$ mode" : "Gtk.CellRendererMode.ACTIVATABLE"
             }
           },
           {
            "id" : "tv_repo",
-           "Gtk.SortType sort_order" : "Gtk.SortType.ASCENDING",
            "* init" : "\n    this.el.add_attribute(_this.cr_repo.el , \"markup\", 0 );\n",
+           "Gtk.SortType sort_order" : "Gtk.SortType.ASCENDING",
            "title" : "Repo",
            "* pack" : "append_column",
            "xtype" : "TreeViewColumn",
            "items" : [
             {
              "id" : "cr_repo",
-             "xtype" : "CellRendererText",
              "* pack" : "pack_start,false",
+             "xtype" : "CellRendererText",
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_active_ticket",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererText",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_current_branch",
-             "xtype" : "CellRendererText",
              "* pack" : "pack_start,false",
+             "xtype" : "CellRendererText",
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_last_updated",
-             "xtype" : "CellRendererText",
              "* pack" : "pack_start,false",
+             "xtype" : "CellRendererText",
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_all_branches",
-             "xtype" : "CellRendererText",
              "* pack" : "pack_start,false",
+             "xtype" : "CellRendererText",
              "$ xns" : "Gtk"
             }
            ]
index 78f86ca..befa7f3 100644 (file)
@@ -75,9 +75,9 @@ public class Clones : Object
         
         this.el.set_default_size(
                        int.min(1024,Gdk.Screen.width()),
-                       int.max(500,Gdk.Screen.width() - 300)
+                       int.max(500,Gdk.Screen.height() - 300)
        );
-        
+         
         this.el.show_all();
         _this.reposStore.load();
         this.el.set_keep_above(true);
@@ -118,7 +118,7 @@ public class Clones : Object
             var child_0 = new Xcls_Box3( _this );
             child_0.ref();
             this.el.pack_start (  child_0.el , false,false,0 );
-            var child_1 = new Xcls_ScrolledWindow9( _this );
+            var child_1 = new Xcls_ScrolledWindow5( _this );
             child_1.ref();
             this.el.pack_end (  child_1.el , true,true,0 );
         }
@@ -146,18 +146,6 @@ public class Clones : Object
             var child_0 = new Xcls_Button4( _this );
             child_0.ref();
             this.el.add (  child_0.el  );
-            var child_1 = new Xcls_Button5( _this );
-            child_1.ref();
-            this.el.add (  child_1.el  );
-            var child_2 = new Xcls_Button6( _this );
-            child_2.ref();
-            this.el.add (  child_2.el  );
-            var child_3 = new Xcls_Button7( _this );
-            child_3.ref();
-            this.el.add (  child_3.el  );
-            var child_4 = new Xcls_Button8( _this );
-            child_4.ref();
-            this.el.add (  child_4.el  );
         }
 
         // user defined functions
@@ -183,257 +171,9 @@ public class Clones : Object
 
             //listeners
             this.el.clicked.connect( () => {
-            
-            /*    var rv = this.get('/reposView');
-                var rs = this.get('/reposStore');
-                if (rv.el.get_selection().count_selected_rows() != 1) {
-                    //nothing?
-                    // error condition.
-                    return;
-                }
-                var Remotes =     imports.Remotes.Remotes;
-                
-             
-                var ret = {};       
-                var s = rv.el.get_selection();
-                var path = '';
-                s.selected_foreach(function(model,p,iter) {
-                                                                
-                   path = model.get_value(iter, 6).value.get_string();
-                 
-                }); 
-            
-                var repo = false;
-                rs.repos.forEach(function(r) {
-                    if (r.repopath == path) {
-                        repo = r;
-                    
-                    }
-                
-                });
-                Remotes.repo = repo;
-                Remotes.el.set_transient_for(Clones.el);
-                Clones.el.set_title("Manage Clones - " + repo.repopath);
-                Remotes.show();
-                Clones.el.set_title("Manage Clones");
-            
-              */   
-                
-                 
-            
-                   
-                
-                
-            });
-        }
-
-        // user defined functions
-    }
-
-    public class Xcls_Button5 : Object
-    {
-        public Gtk.Button el;
-        private Clones  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_Button5(Clones _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.Button();
-
-            // my vars (dec)
-
-            // set gobject values
-            this.el.label = "Branches";
-            this.el.visible = false;
-
-            //listeners
-            this.el.clicked.connect( () => {
-            // 
-            
-               //NewBranch.singleton().show();
-            
-            /*
-                var rv = this.get('/reposView');
-                var rs = this.get('/reposStore');
-                if (rv.el.get_selection().count_selected_rows() != 1) {
-                    //nothing?
-                    // error condition.
-                    return;
-                }
-                var Branches =     imports.Branches.Branches;
-                
-             
-                var ret = {};       
-                var s = rv.el.get_selection();
-                var path = '';
-                s.selected_foreach(function(model,p,iter) {
-                                                                
-                   path = model.get_value(iter, 6).value.get_string();
-                 
-                }); 
-            
-                var repo = false;
-                rs.repos.forEach(function(r) {
-                    if (r.repopath == path) {
-                        repo = r;
-                    
-                    }
-                
-                });
-                Branches.repo = repo;
-                Branches.el.set_transient_for(Clones.el);
-                Clones.el.set_title("Manage Clones - " + repo.repopath);
-                Branches.show();
-                Clones.el.set_title("Manage Clones");
-            
-                 
-                
-                
-                
-            
-                   
-             */   
-                
-            });
-        }
-
-        // user defined functions
-    }
-
-    public class Xcls_Button6 : Object
-    {
-        public Gtk.Button el;
-        private Clones  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_Button6(Clones _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.Button();
-
-            // my vars (dec)
-
-            // set gobject values
-            this.el.label = "Merge";
-
-            //listeners
-            this.el.clicked.connect( () =>  {
-            
-               var rv = _this.reposView;
-               var rs = _this.reposStore;
-               var s =rv.el.get_selection();
-               if (s.count_selected_rows() != 1) {
-                       return;
-               }
-               Gtk.TreeIter iter;
-               Gtk.TreeModel tm;
-               s.get_selected(out tm, out iter);
-               GLib.Value val;
-                tm.get_value(iter, 6, out val);
-                var git_working_dir = (string)val;
-                
-                var repo = GitRepo.singleton().get(git_working_dir);
-                
-                // if you hit merge.... in master..
-                // ignore..
-                if (repo.currentBranch.name == "master") {
-                       return;
-               }
-               MergeBranch.singleton().show(repo.activeTicket, repo);
-               _this.reposStore.load();
-               
-             
-                
-            });
-        }
-
-        // user defined functions
-    }
-
-    public class Xcls_Button7 : Object
-    {
-        public Gtk.Button el;
-        private Clones  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_Button7(Clones _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.Button();
-
-            // my vars (dec)
-
-            // set gobject values
-            this.el.label = "Switch Branch";
-            this.el.visible = false;
-
-            //listeners
-            this.el.clicked.connect( () => {
-                
+                       Clone.singleton().show(this.el);
                 
-             
-                   
-                
-                
-            });
-        }
-
-        // user defined functions
-    }
-
-    public class Xcls_Button8 : Object
-    {
-        public Gtk.Button el;
-        private Clones  _this;
-
-
-            // my vars (def)
-
-        // ctor
-        public Xcls_Button8(Clones _owner )
-        {
-            _this = _owner;
-            this.el = new Gtk.Button();
-
-            // my vars (dec)
-
-            // set gobject values
-            this.el.label = "Pull";
-
-            //listeners
-            this.el.clicked.connect( () =>  {
-            
-               var rv = _this.reposView;
-               var rs = _this.reposStore;
-               var s =rv.el.get_selection();
-               if (s.count_selected_rows() != 1) {
-                       return;
-               }
-               Gtk.TreeIter iter;
-               Gtk.TreeModel tm;
-               s.get_selected(out tm, out iter);
-               GLib.Value val;
-                tm.get_value(iter, 6, out val);
-                var git_working_dir = (string)val;
                 
-                var repo = GitRepo.singleton().get(git_working_dir);
-                GitMonitor.gitmonitor.pause();    
-                repo.pull();
-                repo.loadStatus();
-                _this.reposStore.load();
-                GitMonitor.gitmonitor.start(); 
-            
-             
                 
             });
         }
@@ -442,7 +182,7 @@ public class Clones : Object
     }
 
 
-    public class Xcls_ScrolledWindow9 : Object
+    public class Xcls_ScrolledWindow5 : Object
     {
         public Gtk.ScrolledWindow el;
         private Clones  _this;
@@ -451,7 +191,7 @@ public class Clones : Object
             // my vars (def)
 
         // ctor
-        public Xcls_ScrolledWindow9(Clones _owner )
+        public Xcls_ScrolledWindow5(Clones _owner )
         {
             _this = _owner;
             this.el = new Gtk.ScrolledWindow( null, null );
index b444ce4..91feb4c 100644 (file)
@@ -131,9 +131,7 @@ public class GitRepo : Object
         }
     
         return list_cache;
-        
          
-          
        }
        
        public static GitRepo get(string path) 
@@ -184,6 +182,20 @@ public class GitRepo : Object
                
     }
     
+    public bool is_managed()
+    {
+       // is it a roojs origin?
+       var r = this.git({ "remote" , "get-url" , "--push" , "origin"});
+       var uri = new Soup.URI(r);
+       if (uri.get_host() != "git.roojs.com") { // we can only push to this url. -- unless we have forced it to be managed.
+               return FileUtils.test(this.gitdir + "/.gitlive-managed" , FileTest.EXISTS);
+       }
+       // otherwise see if unmanaged is set to disable it..
+       return !FileUtils.test(this.gitdir + "/.gitlive-unmanaged" , FileTest.EXISTS);  
+
+    }
+    
+    
     public bool is_autocommit ()
     {
        return !FileUtils.test(this.gitdir + "/.gitlive-disable-autocommit" , FileTest.EXISTS);
@@ -266,6 +278,7 @@ public class GitRepo : Object
     
     public void loadBranches()
     {
+
        GitBranch.loadBranches(this);
     }
      
@@ -846,14 +859,18 @@ public class GitRepo : Object
      
     public static void updateAll(string after)
     {
-                       update_all_after = after;
-               var tr =  GitRepo.singleton().cache;
-                
+               update_all_after = after;
+               var tr =  GitRepo.singleton().cache;
             
-           update_all_total = tr.size;
-           foreach(var repo  in tr.values) {
-                  repo.update_async(updateAllCallback); 
-            } 
+        
+       update_all_total = tr.size;
+       foreach(var repo  in tr.values) {
+                       if (!repo.is_managed()) {
+                       update_all_total--;                     
+                               continue;
+                       }
+           repo.update_async(updateAllCallback); 
+        } 
 
     }
     public static void  updateAllCallback(GitRepo repo, int err, string res)
index 70af8b4..731bbd4 100644 (file)
@@ -31,6 +31,7 @@ Gitlive_SOURCES = \
           c/xorg_idletime.c \
           WindowLog.vala \
           Clones.vala \
+          Clone.vala \
           NewBranch.vala \
           MergeBranch.vala \
           RepoStatusPopover.vala
index 4e589ef..3cafabe 100644 (file)
@@ -14,8 +14,8 @@
     "show" : "(self)  => {\n \n\n  //test\n}"
    },
    "default_width" : 500,
-   "$ deletable" : true,
    "# GitRepo repo" : "",
+   "$ deletable" : true,
    "title" : "Merge Branch",
    "xtype" : "Dialog",
    "|   void show" : "(  RooTicket ticket, GitRepo? repo ) \n{\n     // this.el.set_gravity(Gdk.Gravity.NORTH);\n    if (this.running) {\n    \treturn;\n\t}\n\tGitMonitor.gitmonitor.stop();\n\t\n    this.ticket = ticket;\n    this.repo = repo;\n    \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n       \tGLib.debug(\"Loading tickets\"); \n\n\n    this.el.show_all();\n \t_this.dbmodel.loadTickets();\n \t_this.actionmodel.loadActions();\n\n\n}",
@@ -32,8 +32,8 @@
      "items" : [
       {
        "bool homogeneous" : false,
-       "xtype" : "Table",
        "* pack" : "pack_start,false,false,0",
+       "xtype" : "Table",
        "uint column_spacing" : 2,
        "n_columns" : 2,
        "$ xns" : "Gtk",
          "items" : [
           {
            "id" : "actioncellrenderer",
-           "xtype" : "CellRendererText",
            "* pack" : "pack_start,true",
+           "xtype" : "CellRendererText",
            "$ xns" : "Gtk"
           },
           {
            "id" : "actionmodel",
-           "xtype" : "ListStore",
            "* pack" : "set_model",
+           "xtype" : "ListStore",
            "$ columns" : "typeof(string),typeof(string)",
            "n_columns" : 2,
            "$ xns" : "Gtk",
          "items" : [
           {
            "id" : "dbcellrenderer",
-           "* pack" : "pack_start,true",
            "xtype" : "CellRendererText",
+           "* pack" : "pack_start,true",
            "$ xns" : "Gtk"
           },
           {
            "id" : "dbmodel",
-           "* pack" : "set_model",
            "xtype" : "ListStore",
-           "| void loadTickets" : "  () {\n\n    RooTicket.singleton().loadTickets();\n    \n    _this.ticketsel.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a ticket --\");\n    \n    _this.ticketsel.el.set_active_iter(iter);\n    \n    if (_this.ticket != null &&  _this.ticket.id == \"-1\") {\n\t\tel.append(out iter);\n\t\tel.set_value(iter, 0, \"-1\");\n\t\tel.set_value(iter, 1, \"Temporary Branch - No ticket specified/relivant\");\n        _this.ticketsel.el.set_active_iter(iter);\t\n    }\n    \n    \n    \n    \n    var tickets = RooTicket.singleton().tickets;\n    foreach(var ticket in tickets) {\n    \n        el.append(out iter);\n\n        el.set_value(iter, 0, ticket.id);\n        el.set_value(iter, 1, \"#%s [%s] %s\".printf( ticket.id, ticket.project_id_name , ticket.summary));\n\t\tif (_this.ticket != null && _this.ticket.id == ticket.id) {\n\t\t    _this.ticketsel.el.set_active_iter(iter);\n\t    }\n        \n    }\n    \n    _this.ticketsel.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
+           "* pack" : "set_model",
+           "| void loadTickets" : "  () {\n\n    RooTicket.singleton().loadTickets(\"\",RooTicket.NotMe.FALSE, RooTicket.Closed.FALSE);\n    \n    _this.ticketsel.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a ticket --\");\n    \n    _this.ticketsel.el.set_active_iter(iter);\n    \n    if (_this.ticket != null &&  _this.ticket.id == \"-1\") {\n\t\tel.append(out iter);\n\t\tel.set_value(iter, 0, \"-1\");\n\t\tel.set_value(iter, 1, \"Temporary Branch - No ticket specified/relivant\");\n        _this.ticketsel.el.set_active_iter(iter);\t\n    }\n    \n    \n    \n    \n    var tickets = RooTicket.singleton().tickets;\n    foreach(var ticket in tickets) {\n    \n        el.append(out iter);\n\n        el.set_value(iter, 0, ticket.id);\n        el.set_value(iter, 1, \"#%s [%s] %s\".printf( ticket.id, ticket.project_id_name , ticket.summary));\n\t\tif (_this.ticket != null && _this.ticket.id == ticket.id) {\n\t\t    _this.ticketsel.el.set_active_iter(iter);\n\t    }\n        \n    }\n    \n    _this.ticketsel.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
            "$ columns" : "typeof(string),typeof(string)",
            "n_columns" : 2,
            "$ xns" : "Gtk"
     },
     {
      "label" : "Cancel",
-     "* pack" : "add_action_widget,0",
      "xtype" : "Button",
+     "* pack" : "add_action_widget,0",
      "Gtk.ReliefStyle relief" : "Gtk.ReliefStyle.NONE",
      "$ xns" : "Gtk"
     },
     {
      "label" : "Do Merge",
-     "* pack" : "add_action_widget,1",
      "xtype" : "Button",
+     "* pack" : "add_action_widget,1",
      "$ xns" : "Gtk"
     }
    ]
index 77fb77f..6f84765 100644 (file)
@@ -500,7 +500,7 @@ public class MergeBranch : Object
         // user defined functions
         public void loadTickets () {
         
-            RooTicket.singleton().loadTickets();
+            RooTicket.singleton().loadTickets("",RooTicket.NotMe.FALSE, RooTicket.Closed.FALSE);
             
             _this.ticketsel.loading = true;
         
index 1b5c499..5b12963 100644 (file)
@@ -166,7 +166,8 @@ public class Monitor : gitMonitorBase
                 this.monitors.append_val(fm);
 
             } catch (Error e) {
-                  GLib.debug("Error adding monitor: %s", e.message);
+                  GLib.debug("Error adding monitor: %s\n", e.message);
+                  GLib.debug("Try: \n\nsudo su\necho 512 > /proc/sys/fs/inotify/max_user_instances\n");     
                 // FIXME -- show error? do nothing..            
             }
             // print("ADD path " + depth + ' ' + path);
index 85263ca..040ffc1 100644 (file)
   {
    "listeners" : {
     "delete_event" : "(self, event) => {\n    this.el.hide();\n    return true; \n    //test  \n}\n ",
-    "response" : " (self, response_id) =>  { \n  \n\tGLib.debug(\"got %d\", (int) response_id);\n\tif (response_id == 0) {\n\t    _this.el.hide();\t\n\t    this.running = false; \n\t \treturn;\n\t}\n\t \n\t// have they selected a ticket..\n\t// make that the current active ticket?\n\t// we really need to store locally what ticket is being worked on..\n\t// in theory we could be working on multiple project and not merging..\n\t// -- each repo would have their active ticket (only one per repo)\n\t// -- so we could just store that in there\n\t// -- initial load can check the contents of the ticket files on first scan.\n\tvar ticket_id = _this.ticketsel.selectedTicketId();\n\t\n    if (this.repo != null) {\n    \tvar bn = _this.name.el.get_text();\n\n\t\tvar res = this.repo.setActiveTicket(\t\t\t\n\t\t\t RooTicket.singleton().getById(ticket_id != \"\" ? ticket_id : \"-1\"), bn\n\t\t );\n\t\t if (res) {\n\t\t \t// start the monitoring..\n\t\t \t GitMonitor.gitmonitor.start();\n\t\t \t \n\t\t }\n    }\n    \n\n    this.running = false; \n\n\tthis.el.hide();\n\t \n\t \n\n\t \n}",
-    "show" : "(self)  => {\n \n\n  //test\n}"
+    "response" : " (self, response_id) =>  { \n  \n\tGLib.debug(\"got %d\", (int) response_id);\n\tif (response_id < 1) {\n\t    _this.el.hide();\t\n\t    this.running = false; \n\t \treturn;\n\t}\n\t \n\t// have they selected a ticket..\n\t// make that the current active ticket?\n\t// we really need to store locally what ticket is being worked on..\n\t// in theory we could be working on multiple project and not merging..\n\t// -- each repo would have their active ticket (only one per repo)\n\t// -- so we could just store that in there\n\t// -- initial load can check the contents of the ticket files on first scan.\n\tvar ticket_id = _this.ticketsel.selectedTicketId();\n\t\n    if (this.repo != null) {\n    \tvar bn = _this.name.el.get_text();\n\n\t\tvar res = this.repo.setActiveTicket(\t\t\t\n\t\t\t RooTicket.singleton().getById(ticket_id != \"\" ? ticket_id : \"-1\"), bn\n\t\t );\n\t\t if (res) {\n\t\t \t// start the monitoring..\n\t\t \t GitMonitor.gitmonitor.start();\n\t\t \t \n\t\t }\n    }\n    \n\n    this.running = false; \n\n\tthis.el.hide();\n\t \n\t \n\n\t \n}"
    },
    "default_width" : 500,
    "$ deletable" : true,
    "title" : "Create a working branch ",
    "xtype" : "Dialog",
    "# GitRepo? repo" : "null",
-   "|   void show" : "( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue ) \n{\n     // this.el.set_gravity(Gdk.Gravity.NORTH);\n    if (this.running) { // should not happen!!\n    \tGLib.error(\"new branch show called, when already being displayed?\");\n\t}\n\tthis.queue = queue;\n\t\n\tthis.running  = true;\n\tGitMonitor.gitmonitor.stop();\n\t\n    this.repo = repo;\n    \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n       \tGLib.debug(\"Loading tickets\"); \n\n\n    this.el.show_all();\n        this.el.set_keep_above(true);\n \t_this.dbmodel.loadTickets();\n \tthis.el.run();\n\n}",
+   "|   void show" : "( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue ) \n{\n     // this.el.set_gravity(Gdk.Gravity.NORTH);\n    if (this.running) { // should not happen!!\n    \tGLib.error(\"new branch show called, when already being displayed?\");\n\t}\n\tthis.queue = queue;\n\t\n\tthis.running  = true;\n\tGitMonitor.gitmonitor.stop();\n\t\n    this.repo = repo;\n    \n    \n    \n    \n\tthis.el.move((Gdk.Screen.width() / 2)- 250 ,0);\n\tthis.el.set_default_size( 500,200); // not sure why it grows..\n    GLib.debug(\"Loading tickets\"); \n     \n\n    this.el.show_all();\n    this.el.set_keep_above(true);\n   \n    \n    var curproj = RooTicket.singleton().getProjectByRepo(this.repo);\n     _this.prmodel.loadProjects(curproj == null ? \"\" : curproj.id);\n    \n \t_this.dbmodel.loadTickets(curproj == null ? \"\": curproj.id);\n \tthis.el.run();\n\n}",
    "default_height" : 200,
    "$ xns" : "Gtk",
    "# bool running" : false,
      "$ xns" : "Gtk",
      "items" : [
       {
-       "bool homogeneous" : false,
-       "* pack" : "pack_start,false,false,0",
+       "bool homogeneous" : true,
+       "bool expand" : false,
        "xtype" : "Table",
-       "uint column_spacing" : 2,
-       "n_columns" : 2,
+       "* pack" : "pack_start,false,false,0",
+       "uint column_spacing" : 4,
+       "n_columns" : 5,
        "$ xns" : "Gtk",
-       "n_rows" : 2,
+       "n_rows" : 5,
+       "bool vexpand" : false,
        "int margin" : 2,
        "items" : [
         {
-         "label" : "Select Ticket",
+         "label" : "Project",
          "$ visible" : true,
-         "xalign" : 0.90000000000000002,
+         "Gtk.Align halign" : "Gtk.Align.START",
          "* pack" : "attach_defaults,0,1,0,1",
          "xtype" : "Label",
          "$ justify" : "Gtk.Justification.RIGHT",
          "$ xns" : "Gtk"
         },
         {
+         "label" : "Ticket",
+         "$ visible" : true,
+         "Gtk.Align halign" : "Gtk.Align.START",
+         "* pack" : "attach_defaults,1,2,0,1",
+         "xtype" : "Label",
+         "x_options" : 4,
+         "$ xns" : "Gtk"
+        },
+        {
+         "listeners" : {
+          "changed" : "() => {\n\tif (this.loading) {\n\t\treturn;\n\t}\n\tvar project_id = this.selectedProjectId();\n\t_this.dbmodel.loadTickets(project_id);\n\t\n\t\n\t/*if (this.loading) {\n\t\treturn;\n\t}\n\tvar ticket_id = this.selectedTicketId();\n\t\n\tvar name = RooTicket.singleton().usernameLocal();\n\t\n\tif (ticket_id == \"\" || ticket_id == null) {\n\t\n\t\tvar dt = new  DateTime.now_local();\n\t\t_this.name.el.set_text(\"wip_%s_%s\".printf(name,dt.format(\"%Y_%b_%d\")));\n\t\treturn;\n\t}\n\t\n\t\n\tvar ticket = RooTicket.singleton().getById(ticket_id);\n   \n\t_this.name.el.set_text(\"wip_%s_T%s_%s\".printf(name,ticket.id, ticket.summaryToBranchName()));\n\t\n\t//GLib.debug (//\"Selection: %s, %s\\n\", (string) val1, (string) val2);\n\t*/\n}"
+         },
+         "* ctor" : "new Gtk.ComboBox.with_entry()",
+         "id" : "projectsel",
+         "| string selectedProjectId" : "() {\n\tGtk.TreeIter iter;\n\tValue val1;\n \n \n\tthis.el.get_active_iter (out iter);\n\t_this.prmodel.el.get_value (iter, 0, out val1);\n \n\n\treturn  (string) val1;\n\t\n\t\n\t\n\t\n}\n",
+         "* init" : "this.el.set_entry_text_column(1);",
+         "* pack" : "attach_defaults,0,1,1,2",
+         "xtype" : "ComboBox",
+         "# bool loading" : false,
+         "$ xns" : "Gtk",
+         "items" : [
+          {
+           "id" : "prcellrenderer",
+           "xtype" : "CellRendererText",
+           "* pack" : "pack_start,true",
+           "$ xns" : "Gtk"
+          },
+          {
+           "| void loadProjects" : "  (string id) {\n\n    var rt = RooTicket.singleton();\n    rt.loadProjects();\n    \n    _this.projectsel.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a project --\");\n    if (id == \"\") {\n\t    _this.projectsel.el.set_active_iter(iter);\n    }\n    var projects = rt.projects;\n    foreach(var project in projects) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, project.id);\n        el.set_value(iter, 1,  project.name );\n        if (id == project.id) {\n\t \t   _this.projectsel.el.set_active_iter(iter);\n\t    }   \n        \n    }\n    \n    _this.projectsel.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
+           "id" : "prmodel",
+           "* pack" : "set_model",
+           "xtype" : "ListStore",
+           "$ columns" : "typeof(string),typeof(string)",
+           "n_columns" : 2,
+           "$ xns" : "Gtk"
+          }
+         ]
+        },
+        {
          "listeners" : {
           "changed" : "() => {\n\tif (this.loading) {\n\t\treturn;\n\t}\n\tvar ticket_id = this.selectedTicketId();\n\t\n\tvar name = RooTicket.singleton().usernameLocal();\n\t\n\tif (ticket_id == \"\" || ticket_id == null) {\n\t\n\t\tvar dt = new  DateTime.now_local();\n\t\t_this.name.el.set_text(\"wip_%s_%s\".printf(name,dt.format(\"%Y_%b_%d\")));\n\t\treturn;\n\t}\n\t\n\t\n\tvar ticket = RooTicket.singleton().getById(ticket_id);\n   \n\t_this.name.el.set_text(\"wip_%s_T%s_%s\".printf(name,ticket.id, ticket.summaryToBranchName()));\n\t\n\t//GLib.debug (//\"Selection: %s, %s\\n\", (string) val1, (string) val2);\n}"
          },
+         "* ctor" : "new Gtk.ComboBox.with_entry()",
          "id" : "ticketsel",
-         "* init" : "this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );",
-         "* pack" : "attach_defaults,1,2,0,1",
+         "* init" : "//this.el.add_attribute(_this.dbcellrenderer.el , \"markup\", 1 );\nthis.el.set_entry_text_column(1);",
+         "* pack" : "attach_defaults,1,4,1,2",
          "xtype" : "ComboBox",
          "# bool loading" : false,
          "$ xns" : "Gtk",
          "items" : [
           {
            "id" : "dbcellrenderer",
-           "xtype" : "CellRendererText",
            "* pack" : "pack_start,true",
+           "xtype" : "CellRendererText",
            "$ xns" : "Gtk"
           },
           {
            "id" : "dbmodel",
-           "xtype" : "ListStore",
            "* pack" : "set_model",
-           "| void loadTickets" : "  () {\n\n    RooTicket.singleton().loadTickets();\n    \n    _this.ticketsel.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a ticket --\");\n    \n    _this.ticketsel.el.set_active_iter(iter);\n    var tickets = RooTicket.singleton().tickets;\n    foreach(var ticket in tickets) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, ticket.id);\n        el.set_value(iter, 1, \"#%s [%s] %s\".printf( ticket.id, ticket.project_id_name , ticket.summary));\n        \n        //if (data.get(i) == cur) {\n         //   _this.build_module.el.set_active_iter(iter);\n       // }\n        \n    }\n    \n    _this.ticketsel.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
+           "xtype" : "ListStore",
+           "| void loadTickets" : "(string project_id) {\n\n\n    \n    // fixme .. get project id from selection..\n    \n     RooTicket.singleton().loadTickets(\n \t\t\tproject_id,\n \t\t\t_this.btn_not_me.el.active ? RooTicket.NotMe.TRUE :  RooTicket.NotMe.FALSE,\n \t\t\t _this.btn_closed.el.active ? RooTicket.Closed.TRUE :  RooTicket.Closed.FALSE\n\t\t );\n        \n    _this.ticketsel.loading = true;\n\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n\n    \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"-- select a ticket --\");\n    \n    _this.ticketsel.el.set_active_iter(iter);\n    var tickets = RooTicket.singleton().tickets;\n    foreach(var ticket in tickets) {\n    \n        el.append(out iter);\n        \n        el.set_value(iter, 0, ticket.id);\n        el.set_value(iter, 1, \"#%s [%s] %s\".printf( ticket.id, ticket.project_id_name , ticket.summary));\n        \n        //if (data.get(i) == cur) {\n         //   _this.build_module.el.set_active_iter(iter);\n       // }\n        \n    }\n    \n    _this.ticketsel.loading = false;\n     //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          \n                                     \n}\n",
            "$ columns" : "typeof(string),typeof(string)",
            "n_columns" : 2,
            "$ xns" : "Gtk"
          ]
         },
         {
-         "label" : "or use this as branch name",
+         "bool expand" : false,
+         "xtype" : "Button",
+         "* pack" : "attach_defaults,4,5,1,2",
+         "string label" : "New Ticket",
+         "$ xns" : "Gtk"
+        },
+        {
+         "label" : "Use this as branch name",
+         "Gtk.Align halign" : "Gtk.Align.START",
          "xalign" : 0.90000000000000002,
-         "* pack" : "attach_defaults,0,1,1,2",
+         "* pack" : "attach_defaults,0,1,3,4",
          "xtype" : "Label",
          "$ justify" : "Gtk.Justification.RIGHT",
          "x_options" : 4,
          "id" : "name",
          "$ visible" : true,
          "xtype" : "Entry",
-         "* pack" : "attach_defaults,1,2,1,2",
+         "* pack" : "attach_defaults,0,4,4,5",
+         "$ xns" : "Gtk"
+        },
+        {
+         "listeners" : {
+          "activate" : "() => {\n\t_this.el.response(1);\n}\n"
+         },
+         "label" : "Create Branch",
+         "* init" : "{\n   this.el.get_style_context().add_class(\"suggested-action\");\n}\n",
+         "xtype" : "Button",
+         "* pack" : "attach_defaults,4,5,4,5",
          "$ xns" : "Gtk"
+        },
+        {
+         "* pack" : "attach_defaults,0,5,2,3",
+         "xtype" : "Box",
+         "$ xns" : "Gtk",
+         "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
+         "items" : [
+          {
+           "listeners" : {
+            "toggled" : "() => {\n\tvar project_id = _this.projectsel.selectedProjectId();\n\t_this.dbmodel.loadTickets(project_id);\t\n}"
+           },
+           "id" : "btn_not_me",
+           "string label" : "Show tickets not assigned to me",
+           "* pack" : "add",
+           "xtype" : "CheckButton",
+           "$ xns" : "Gtk"
+          },
+          {
+           "listeners" : {
+            "toggled" : "() => {\n \tvar project_id = _this.projectsel.selectedProjectId();\n\t_this.dbmodel.loadTickets(project_id);\t\n\t \n}"
+           },
+           "id" : "btn_closed",
+           "xtype" : "CheckButton",
+           "string label" : "Show closed Tickets",
+           "* pack" : "add",
+           "$ xns" : "Gtk"
+          },
+          {
+           "listeners" : {
+            "activate_link" : "(uri) => {\n\tif (uri == \"refresh\") {\n\t\tvar curproj = RooTicket.singleton().getProjectByRepo(_this.repo);\n\t\t _this.prmodel.loadProjects(curproj == null ? \"\": curproj.id);\n\n\t\t_this.dbmodel.loadTickets(curproj == null ? \"\": curproj.id);\t\t\n\t}\n\treturn true;\n}"
+           },
+           "bool use_markup" : true,
+           "Gtk.Align halign" : "Gtk.Align.END",
+           "bool hexpand" : true,
+           "* pack" : "add",
+           "xtype" : "Label",
+           "string label" : "<a href=\"refresh\">Refresh Ticket list</a>",
+           "$ xns" : "Gtk"
+          }
+         ]
         }
        ]
       }
      ]
-    },
-    {
-     "label" : "Do not create Branch",
-     "xtype" : "Button",
-     "* pack" : "add_action_widget,0",
-     "Gtk.ReliefStyle relief" : "Gtk.ReliefStyle.NONE",
-     "$ xns" : "Gtk"
-    },
-    {
-     "label" : "Create Branch",
-     "xtype" : "Button",
-     "* pack" : "add_action_widget,1",
-     "$ xns" : "Gtk"
     }
    ]
   }
index c55d3de..34662cd 100644 (file)
@@ -12,10 +12,15 @@ public class NewBranch : Object
         }
         return _NewBranch;
     }
+    public Xcls_projectsel projectsel;
+    public Xcls_prcellrenderer prcellrenderer;
+    public Xcls_prmodel prmodel;
     public Xcls_ticketsel ticketsel;
     public Xcls_dbcellrenderer dbcellrenderer;
     public Xcls_dbmodel dbmodel;
     public Xcls_name name;
+    public Xcls_btn_not_me btn_not_me;
+    public Xcls_btn_closed btn_closed;
 
         // my vars (def)
     public GitRepo? repo;
@@ -42,12 +47,6 @@ public class NewBranch : Object
         var child_0 = new Xcls_VBox2( _this );
         child_0.ref();
         this.el.get_content_area().add (  child_0.el  );
-        var child_1 = new Xcls_Button10( _this );
-        child_1.ref();
-        this.el.add_action_widget (  child_1.el , 0 );
-        var child_2 = new Xcls_Button11( _this );
-        child_2.ref();
-        this.el.add_action_widget (  child_2.el , 1 );
 
         //listeners
         this.el.delete_event.connect( (self, event) => {
@@ -58,7 +57,7 @@ public class NewBranch : Object
         this.el.response.connect( (self, response_id) =>  { 
           
                GLib.debug("got %d", (int) response_id);
-               if (response_id == 0) {
+               if (response_id < 1) {
                    _this.el.hide();    
                    this.running = false; 
                        return;
@@ -95,11 +94,6 @@ public class NewBranch : Object
         
                 
         });
-        this.el.show.connect( (self)  => {
-         
-        
-          //test
-        });
     }
 
     // user defined functions
@@ -116,13 +110,22 @@ public class NewBranch : Object
        
         this.repo = repo;
         
+        
+        
+        
        this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
-               GLib.debug("Loading tickets"); 
-    
+       this.el.set_default_size( 500,200); // not sure why it grows..
+        GLib.debug("Loading tickets"); 
+         
     
         this.el.show_all();
-            this.el.set_keep_above(true);
-       _this.dbmodel.loadTickets();
+        this.el.set_keep_above(true);
+       
+        
+        var curproj = RooTicket.singleton().getProjectByRepo(this.repo);
+         _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
+        
+       _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);
        this.el.run();
     
     }
@@ -162,25 +165,42 @@ public class NewBranch : Object
         public Xcls_Table3(NewBranch _owner )
         {
             _this = _owner;
-            this.el = new Gtk.Table( 2, 2, false );
+            this.el = new Gtk.Table( 5, 5, true );
 
             // my vars (dec)
 
             // set gobject values
+            this.el.expand = false;
             this.el.margin = 2;
-            this.el.column_spacing = 2;
+            this.el.column_spacing = 4;
+            this.el.vexpand = false;
             var child_0 = new Xcls_Label4( _this );
             child_0.ref();
             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
-            var child_1 = new Xcls_ticketsel( _this );
+            var child_1 = new Xcls_Label5( _this );
             child_1.ref();
             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
-            var child_2 = new Xcls_Label8( _this );
+            var child_2 = new Xcls_projectsel( _this );
             child_2.ref();
             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
-            var child_3 = new Xcls_name( _this );
+            var child_3 = new Xcls_ticketsel( _this );
             child_3.ref();
-            this.el.attach_defaults (  child_3.el , 1,2,1,2 );
+            this.el.attach_defaults (  child_3.el , 1,4,1,2 );
+            var child_4 = new Xcls_Button12( _this );
+            child_4.ref();
+            this.el.attach_defaults (  child_4.el , 4,5,1,2 );
+            var child_5 = new Xcls_Label13( _this );
+            child_5.ref();
+            this.el.attach_defaults (  child_5.el , 0,1,3,4 );
+            var child_6 = new Xcls_name( _this );
+            child_6.ref();
+            this.el.attach_defaults (  child_6.el , 0,4,4,5 );
+            var child_7 = new Xcls_Button15( _this );
+            child_7.ref();
+            this.el.attach_defaults (  child_7.el , 4,5,4,5 );
+            var child_8 = new Xcls_Box16( _this );
+            child_8.ref();
+            this.el.attach_defaults (  child_8.el , 0,5,2,3 );
         }
 
         // user defined functions
@@ -197,19 +217,207 @@ public class NewBranch : Object
         public Xcls_Label4(NewBranch _owner )
         {
             _this = _owner;
-            this.el = new Gtk.Label( "Select Ticket" );
+            this.el = new Gtk.Label( "Project" );
 
             // my vars (dec)
 
             // set gobject values
+            this.el.halign = Gtk.Align.START;
             this.el.justify = Gtk.Justification.RIGHT;
-            this.el.xalign = 0.900000f;
             this.el.visible = true;
         }
 
         // user defined functions
     }
 
+    public class Xcls_Label5 : Object
+    {
+        public Gtk.Label el;
+        private NewBranch  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_Label5(NewBranch _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Ticket" );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.halign = Gtk.Align.START;
+            this.el.visible = true;
+        }
+
+        // user defined functions
+    }
+
+    public class Xcls_projectsel : Object
+    {
+        public Gtk.ComboBox el;
+        private NewBranch  _this;
+
+
+            // my vars (def)
+        public bool loading;
+
+        // ctor
+        public Xcls_projectsel(NewBranch _owner )
+        {
+            _this = _owner;
+            _this.projectsel = this;
+            this.el = new Gtk.ComboBox.with_entry();
+
+            // my vars (dec)
+            this.loading = false;
+
+            // set gobject values
+            var child_0 = new Xcls_prcellrenderer( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , true );
+            var child_1 = new Xcls_prmodel( _this );
+            child_1.ref();
+            this.el.set_model (  child_1.el  );
+
+            // init method
+
+            this.el.set_entry_text_column(1);
+
+            //listeners
+            this.el.changed.connect( () => {
+               if (this.loading) {
+                       return;
+               }
+               var project_id = this.selectedProjectId();
+               _this.dbmodel.loadTickets(project_id);
+               
+               
+               /*if (this.loading) {
+                       return;
+               }
+               var ticket_id = this.selectedTicketId();
+               
+               var name = RooTicket.singleton().usernameLocal();
+               
+               if (ticket_id == "" || ticket_id == null) {
+               
+                       var dt = new  DateTime.now_local();
+                       _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
+                       return;
+               }
+               
+               
+               var ticket = RooTicket.singleton().getById(ticket_id);
+               
+               _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
+               
+               //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
+               */
+            });
+        }
+
+        // user defined functions
+        public string selectedProjectId () {
+               Gtk.TreeIter iter;
+               Value val1;
+         
+         
+               this.el.get_active_iter (out iter);
+               _this.prmodel.el.get_value (iter, 0, out val1);
+         
+        
+               return  (string) val1;
+               
+               
+               
+               
+        }
+    }
+    public class Xcls_prcellrenderer : Object
+    {
+        public Gtk.CellRendererText el;
+        private NewBranch  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_prcellrenderer(NewBranch _owner )
+        {
+            _this = _owner;
+            _this.prcellrenderer = this;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions
+    }
+
+    public class Xcls_prmodel : Object
+    {
+        public Gtk.ListStore el;
+        private NewBranch  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_prmodel(NewBranch _owner )
+        {
+            _this = _owner;
+            _this.prmodel = this;
+            this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions
+        public void loadProjects (string id) {
+        
+            var rt = RooTicket.singleton();
+            rt.loadProjects();
+            
+            _this.projectsel.loading = true;
+        
+            this.el.clear();                                    
+            Gtk.TreeIter iter;
+            var el = this.el;
+            
+            el.append(out iter);
+        
+            
+            el.set_value(iter, 0, "");
+            el.set_value(iter, 1, "-- select a project --");
+            if (id == "") {
+                   _this.projectsel.el.set_active_iter(iter);
+            }
+            var projects = rt.projects;
+            foreach(var project in projects) {
+            
+                el.append(out iter);
+                
+                el.set_value(iter, 0, project.id);
+                el.set_value(iter, 1,  project.name );
+                if (id == project.id) {
+                          _this.projectsel.el.set_active_iter(iter);
+                   }   
+                
+            }
+            
+            _this.projectsel.loading = false;
+             //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
+                                             
+        }
+    }
+
+
     public class Xcls_ticketsel : Object
     {
         public Gtk.ComboBox el;
@@ -224,7 +432,7 @@ public class NewBranch : Object
         {
             _this = _owner;
             _this.ticketsel = this;
-            this.el = new Gtk.ComboBox();
+            this.el = new Gtk.ComboBox.with_entry();
 
             // my vars (dec)
             this.loading = false;
@@ -239,7 +447,8 @@ public class NewBranch : Object
 
             // init method
 
-            this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
+            //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
+            this.el.set_entry_text_column(1);
 
             //listeners
             this.el.changed.connect( () => {
@@ -327,10 +536,18 @@ public class NewBranch : Object
         }
 
         // user defined functions
-        public void loadTickets () {
+        public void loadTickets (string project_id) {
         
-            RooTicket.singleton().loadTickets();
+        
+            
+            // fixme .. get project id from selection..
             
+             RooTicket.singleton().loadTickets(
+                               project_id,
+                               _this.btn_not_me.el.active ? RooTicket.NotMe.TRUE :  RooTicket.NotMe.FALSE,
+                                _this.btn_closed.el.active ? RooTicket.Closed.TRUE :  RooTicket.Closed.FALSE
+                        );
+                
             _this.ticketsel.loading = true;
         
             this.el.clear();                                    
@@ -365,7 +582,31 @@ public class NewBranch : Object
     }
 
 
-    public class Xcls_Label8 : Object
+    public class Xcls_Button12 : Object
+    {
+        public Gtk.Button el;
+        private NewBranch  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_Button12(NewBranch _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.expand = false;
+            this.el.label = "New Ticket";
+        }
+
+        // user defined functions
+    }
+
+    public class Xcls_Label13 : Object
     {
         public Gtk.Label el;
         private NewBranch  _this;
@@ -374,14 +615,15 @@ public class NewBranch : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Label8(NewBranch _owner )
+        public Xcls_Label13(NewBranch _owner )
         {
             _this = _owner;
-            this.el = new Gtk.Label( "or use this as branch name" );
+            this.el = new Gtk.Label( "Use this as branch name" );
 
             // my vars (dec)
 
             // set gobject values
+            this.el.halign = Gtk.Align.START;
             this.el.justify = Gtk.Justification.RIGHT;
             this.el.xalign = 0.900000f;
         }
@@ -413,9 +655,7 @@ public class NewBranch : Object
         // user defined functions
     }
 
-
-
-    public class Xcls_Button10 : Object
+    public class Xcls_Button15 : Object
     {
         public Gtk.Button el;
         private NewBranch  _this;
@@ -424,7 +664,7 @@ public class NewBranch : Object
             // my vars (def)
 
         // ctor
-        public Xcls_Button10(NewBranch _owner )
+        public Xcls_Button15(NewBranch _owner )
         {
             _this = _owner;
             this.el = new Gtk.Button();
@@ -432,34 +672,151 @@ public class NewBranch : Object
             // my vars (dec)
 
             // set gobject values
-            this.el.relief = Gtk.ReliefStyle.NONE;
-            this.el.label = "Do not create Branch";
+            this.el.label = "Create Branch";
+
+            // init method
+
+            {
+               this.el.get_style_context().add_class("suggested-action");
+            }
+
+            //listeners
+            this.el.activate.connect( () => {
+               _this.el.response(1);
+            });
         }
 
         // user defined functions
     }
 
-    public class Xcls_Button11 : Object
+    public class Xcls_Box16 : Object
     {
-        public Gtk.Button el;
+        public Gtk.Box el;
         private NewBranch  _this;
 
 
             // my vars (def)
 
         // ctor
-        public Xcls_Button11(NewBranch _owner )
+        public Xcls_Box16(NewBranch _owner )
         {
             _this = _owner;
-            this.el = new Gtk.Button();
+            this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
 
             // my vars (dec)
 
             // set gobject values
-            this.el.label = "Create Branch";
+            var child_0 = new Xcls_btn_not_me( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_btn_closed( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+            var child_2 = new Xcls_Label19( _this );
+            child_2.ref();
+            this.el.add (  child_2.el  );
+        }
+
+        // user defined functions
+    }
+    public class Xcls_btn_not_me : Object
+    {
+        public Gtk.CheckButton el;
+        private NewBranch  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_btn_not_me(NewBranch _owner )
+        {
+            _this = _owner;
+            _this.btn_not_me = this;
+            this.el = new Gtk.CheckButton();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Show tickets not assigned to me";
+
+            //listeners
+            this.el.toggled.connect( () => {
+               var project_id = _this.projectsel.selectedProjectId();
+               _this.dbmodel.loadTickets(project_id);  
+            });
         }
 
         // user defined functions
     }
 
+    public class Xcls_btn_closed : Object
+    {
+        public Gtk.CheckButton el;
+        private NewBranch  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_btn_closed(NewBranch _owner )
+        {
+            _this = _owner;
+            _this.btn_closed = this;
+            this.el = new Gtk.CheckButton();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Show closed Tickets";
+
+            //listeners
+            this.el.toggled.connect( () => {
+               var project_id = _this.projectsel.selectedProjectId();
+               _this.dbmodel.loadTickets(project_id);  
+                
+            });
+        }
+
+        // user defined functions
+    }
+
+    public class Xcls_Label19 : Object
+    {
+        public Gtk.Label el;
+        private NewBranch  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_Label19(NewBranch _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.halign = Gtk.Align.END;
+            this.el.hexpand = true;
+            this.el.use_markup = true;
+
+            //listeners
+            this.el.activate_link.connect( (uri) => {
+               if (uri == "refresh") {
+                       var curproj = RooTicket.singleton().getProjectByRepo(_this.repo);
+                        _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
+            
+                       _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);            
+               }
+               return true;
+            });
+        }
+
+        // user defined functions
+    }
+
+
+
+
 }
index a34afca..9cc00e9 100644 (file)
@@ -9,7 +9,7 @@
  "items" : [
   {
    "GitRepo repo" : "",
-   "| void show" : " (Gtk.Widget btn, Gdk.Rectangle rect, GitRepo repo) {\n    _this.repo = repo;\n    // get the active project.\n     var lm = Gtk.SourceLanguageManager.get_default();\n                \n//    ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(\n  //      lm.get_language(\"html\")\n //   );\n  \n    //print (project.fn);\n    //project.runhtml = project.runhtml || '';\n    _this.diff_view.el.get_buffer().set_text(repo.git_diff);\n    _this.status_view.el.get_buffer().set_text(repo.git_status);\n       \n    \t//console.log('show all');\n\tthis.el.set_modal(true);\n\tthis.el.set_relative_to(btn);\n    this.el.set_pointing_to(rect);\n  \n\t//this.el.set_position(Gtk.PositionType.RIGHT);\n\n\t// window + header?\n\t GLib.debug(\"SHOWALL - POPIP\\n\");\n\tthis.el.show_all();\n\tthis.el.set_size_request(800,500);\n//\tthis.diff_view.el.grab_focus();\n\t\n    //this.el.show_all();\n}\n",
+   "| void show" : " (Gtk.Widget btn, Gdk.Rectangle rect, GitRepo repo) {\n    _this.repo = repo;\n    // get the active project.\n     var lm = Gtk.SourceLanguageManager.get_default();\n                \n//    ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(\n  //      lm.get_language(\"html\")\n //   );\n  \n    //print (project.fn);\n    //project.runhtml = project.runhtml || '';\n    _this.diff_view.el.get_buffer().set_text(repo.git_diff);\n    _this.status_view.el.get_buffer().set_text(repo.git_status);\n       \n    \t//console.log('show all');\n\tthis.el.set_modal(true);\n\tthis.el.set_relative_to(btn);\n    this.el.set_pointing_to(rect);\n  \n\t//this.el.set_position(Gtk.PositionType.RIGHT);\n\n\t// window + header?\n\t GLib.debug(\"SHOWALL - POPIP\\n\");\n\tthis.el.show_all();\n\t//this.el.set_size_request(800,500);\n//\tthis.diff_view.el.grab_focus();\n\t\n    //this.el.show_all();\n}\n",
    "xtype" : "Popover",
    "Gtk.PositionType position" : "Gtk.PositionType.RIGHT",
    "$ xns" : "Gtk",
        "items" : [
         {
          "id" : "label_status",
-         "* pack" : false,
          "xtype" : "Label",
+         "* pack" : false,
          "$ xns" : "Gtk",
          "utf8 label" : "Status"
         },
         {
          "id" : "label_diff",
-         "xtype" : "Label",
          "* pack" : false,
+         "xtype" : "Label",
          "$ xns" : "Gtk",
          "utf8 label" : "Diff"
         },
@@ -74,8 +74,9 @@
          "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
          "items" : [
           {
-           "* pack" : "pack_start,true,true,0",
+           "int height_request" : 400,
            "xtype" : "ScrolledWindow",
+           "* pack" : "pack_start,true,true,0",
            "$ xns" : "Gtk",
            "items" : [
             {
        "items" : [
         {
          "listeners" : {
-          "button_press_event" : "() => {\n   _this.repo.git({ \"stash\" , \"--all\" });\n   _this.repo.loadStatus();\n   \n    _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);\n    _this.status_view.el.get_buffer().set_text(_this.repo.git_status);\n    Clones.singleton().reposStore.load();\n  \n   _this.el.hide();\n    return false;\n}"
+          "button_press_event" : "() => {\n  \n   \n   GitMonitor.gitmonitor.stop();\n   _this.repo.git({ \"stash\" , \"--all\" });\n   _this.repo.loadStatus();\n   GitMonitor.gitmonitor.start();\n    _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);\n    _this.status_view.el.get_buffer().set_text(_this.repo.git_status);\n    Clones.singleton().reposStore.load();\n  \n   _this.el.hide();\n    return false;\n}"
          },
          "label" : "Stash Changes",
-         "xtype" : "Button",
          "* pack" : "add",
+         "xtype" : "Button",
          "$ xns" : "Gtk"
         },
         {
           "button_press_event" : "() => {\n   _this.repo.git({ \"commit\" , \"-a\" ,\"-m\", \"Uncommited changes synced\" });\n   _this.repo.push();\n   _this.repo.loadStatus();\n   \n    _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);\n    _this.status_view.el.get_buffer().set_text(_this.repo.git_status);\n    \n   _this.el.hide();\n   Clones.singleton().reposStore.load();\n   \n    return false;\n}"
          },
          "label" : "Commit Changes",
+         "* pack" : "add",
+         "xtype" : "Button",
+         "$ xns" : "Gtk"
+        },
+        {
+         "listeners" : {
+          "button_press_event" : "() => {\n   var oldq = new Gee.ArrayList<GitMonitorQueue>();  \n\t \n\tNewBranch.singleton().show(_this.repo, oldq);\n\n    return false;\n}"
+         },
+         "label" : "Create Branch",
          "xtype" : "Button",
          "* pack" : "add",
          "$ xns" : "Gtk"
           "button_press_event" : "() => {\n       _this.el.hide();\n        return false;\n}"
          },
          "label" : "Ignore for now",
-         "* pack" : "add",
          "xtype" : "Button",
+         "* pack" : "add",
          "$ xns" : "Gtk"
         }
        ]
index 136505c..3fc1a6b 100644 (file)
@@ -62,7 +62,7 @@ public class RepoStatusPopover : Object
        // window + header?
         GLib.debug("SHOWALL - POPIP\n");
        this.el.show_all();
-       this.el.set_size_request(800,500);
+       //this.el.set_size_request(800,500);
     // this.diff_view.el.grab_focus();
        
         //this.el.show_all();
@@ -293,6 +293,7 @@ public class RepoStatusPopover : Object
             // my vars (dec)
 
             // set gobject values
+            this.el.height_request = 400;
             var child_0 = new Xcls_diff_view( _this );
             child_0.ref();
             this.el.add (  child_0.el  );
@@ -359,6 +360,9 @@ public class RepoStatusPopover : Object
             var child_2 = new Xcls_Button15( _this );
             child_2.ref();
             this.el.add (  child_2.el  );
+            var child_3 = new Xcls_Button16( _this );
+            child_3.ref();
+            this.el.add (  child_3.el  );
         }
 
         // user defined functions
@@ -384,9 +388,12 @@ public class RepoStatusPopover : Object
 
             //listeners
             this.el.button_press_event.connect( () => {
+              
+               
+               GitMonitor.gitmonitor.stop();
                _this.repo.git({ "stash" , "--all" });
                _this.repo.loadStatus();
-               
+               GitMonitor.gitmonitor.start();
                 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
                 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
                 Clones.singleton().reposStore.load();
@@ -454,6 +461,38 @@ public class RepoStatusPopover : Object
             // my vars (dec)
 
             // set gobject values
+            this.el.label = "Create Branch";
+
+            //listeners
+            this.el.button_press_event.connect( () => {
+               var oldq = new Gee.ArrayList<GitMonitorQueue>();  
+                
+               NewBranch.singleton().show(_this.repo, oldq);
+            
+                return false;
+            });
+        }
+
+        // user defined functions
+    }
+
+    public class Xcls_Button16 : Object
+    {
+        public Gtk.Button el;
+        private RepoStatusPopover  _this;
+
+
+            // my vars (def)
+
+        // ctor
+        public Xcls_Button16(RepoStatusPopover _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
             this.el.label = "Ignore for now";
 
             //listeners
index c4c71bd..d675621 100644 (file)
@@ -3,24 +3,61 @@
 code to fetch ticket info...
 
 */
+
+public class RooRepo : Object 
+{
+
+       public string  id; // not really important that they are numbers..
+       public string project_id;
+       public string description;
+       public string shortname;
+
+
+}
+
+public class RooProject  : Object 
+{
+       public string  id; // not really important that they are numbers..
+       public string code;
+       public string name;
+       public string type;
+}
+
+
 static RooTicket  _RooTicket;
 
 
 
 public class RooTicket : Object
 {
-       
-   const string baseurl = "https://roojs.com/admin.php/Roo/mtrack_ticket"; 
-       
+       public enum NotMe {
+               TRUE,
+               FALSE
+       }
+       public enum Closed {
+               TRUE,
+               FALSE
+       }
+       
+   //const string baseurl = "https://roojs.com/admin.php/Ro/mtrack_ticket"; 
+       const string roourl = "https://roojs.com/admin.php/Roo";        
        public static RooTicket singleton()
     {
         if (_RooTicket == null) {
             _RooTicket = new RooTicket();
             _RooTicket.tickets = new Gee.ArrayList<RooTicket>();
+            _RooTicket.projects = new Gee.ArrayList<RooProject>();
+            _RooTicket.repos = new Gee.ArrayList<RooRepo>();
+            _RooTicket.loadRepos(); // initalize it..        
         }
         return _RooTicket;
     }
        public Gee.ArrayList<RooTicket> tickets; // only available for singletonn.
+       public Gee.ArrayList<RooProject> projects; // only available for singletonn.    
+       public Gee.ArrayList<RooRepo> repos; // only available for singletonn.          
        public string username = ""; // only available for singletonn.
        public string password = ""; // only available for singletonn.
 
@@ -64,6 +101,64 @@ public class RooTicket : Object
                GLib.debug("ADD ticket  %s : %s : %s", add.id, add.summary, add.project_id_name);
                return add;
        }
+       public RooProject addProject(Json.Object t)
+       {
+               var add = new RooProject();
+               add.id = t.get_string_member("id");
+               add.name = t.get_string_member("name");
+               add.type = t.get_string_member("type");
+               add.code = t.get_string_member("code");                                         
+               this.projects.add(add);
+               GLib.debug("ADD project  %s : %s : %s", add.id, add.code, add.name);
+               return add;
+       }
+       
+       public RooRepo addRepo(Json.Object t)
+       {
+               var add = new RooRepo();
+               add.id = t.get_string_member("id");
+               add.shortname = t.get_string_member("shortname");
+               add.description = t.get_string_member("description");           
+               add.project_id = t.get_string_member("project_id");                                             
+               this.repos.add(add);
+               GLib.debug("ADD project  %s : %s : %s", add.id, add.shortname, add.project_id);
+               return add;
+       }
+       
+       public RooProject? getProjectByRepo(GitRepo repo)
+       {
+               var rt = RooTicket.singleton();
+               
+               if (rt.repos.size < 1) {
+                       rt.loadRepos();
+               }
+               if (rt.projects.size < 1) {
+                       rt.loadProjects();
+               }
+               
+               var pid = "";
+               foreach(var roo_repo in rt.repos) {
+                       if (roo_repo.shortname == repo.name) {
+                               pid = roo_repo.project_id;
+                               break;
+                       }
+               }
+               if (pid == "") {
+                       GLib.debug("getProjectByRepo: repo has no project");            
+                       return null;
+               }
+               // get project by id...
+               foreach(var roo_project in rt.projects) {
+                       if (roo_project.id == pid) {
+                               GLib.debug("getProjectByRepo: project_id = %s", pid);
+                               return roo_project;
+                       }
+               }
+               GLib.debug("getProjectByRepo: can not find project");                           
+               return null;
+       
+       }
+       
        
        public static RooTicket fakeTicket()
        {
@@ -94,63 +189,77 @@ public class RooTicket : Object
        }
 
 
-       public RooTicket? loadTicket(string id)
-       {
-       
-               var table = new GLib.HashTable<string, string>(str_hash, str_equal);
-               table.insert("_id",id);         
-               
-               var params = Soup.Form.encode_hash(table);              
-               var url = "%s?%s" . printf(baseurl, params);
-               GLib.debug("request %s", url);
-               
-               var session = new Soup.Session ();
-               session.timeout = 0;
-               var message = new Soup.Message ("GET", url);
-               RooTicket.setAuth(message);
-               session.send_message (message);
-               
-               
-               var data = (string) message.response_body.flatten().data;
-               GLib.debug("got %s", data);
-               try {
-                       var parser = new Json.Parser ();
-                       parser.load_from_data (data, -1);
-
-                       var response = parser.get_root().get_object();
-                       var status = response.get_boolean_member("success");
-               
-                       if(!status){
-                               GLib.error(response.get_string_member("errorMsg"));
-                               return null;
-                       }
-                       var rd = response.get_object_member ("data");
-                       
-                       return this.addTicket(rd);
-                       
-                        
-               
-               } catch (Error e) {
-                       GLib.error(e.message);
-                       return null;
-               }
-        }
+       public RooTicket? loadTicket(string id)
+       {
+
+                  var table = new GLib.HashTable<string, string>(str_hash, str_equal);
+                  table.insert("_id",id);         
+                  
+                  var params = Soup.Form.encode_hash(table);              
+                  var url = "%s/%s?%s" . printf(roourl, "mtrack_ticket", params);
+                  GLib.debug("request %s", url);
+                  
+                  var session = new Soup.Session ();
+                  session.timeout = 0;
+                  var message = new Soup.Message ("GET", url);
+                  RooTicket.setAuth(message);
+                  session.send_message (message);
+                  
+                  
+                  var data = (string) message.response_body.flatten().data;
+                  GLib.debug("got %s", data);
+                  try {
+                          var parser = new Json.Parser ();
+                          parser.load_from_data (data, -1);
+
+                          var response = parser.get_root().get_object();
+                          var status = response.get_boolean_member("success");
+                  
+                          if(!status){
+                                  GLib.error(response.get_string_member("errorMsg"));
+                                  return null;
+                          }
+                          var rd = response.get_object_member ("data");
+                          
+                          return this.addTicket(rd);
+                          
+                           
+                  
+                  } catch (Error e) {
+                          GLib.error(e.message);
+                          return null;
+                  }
+       }
 
-       public void loadTickets()
+       public void loadTickets(string project_id, NotMe not_me, Closed closed)
        {
                RooTicket.singleton().tickets = new Gee.ArrayList<RooTicket>();
         
                
                var table = new GLib.HashTable<string, string>(str_hash, str_equal);
-        
-               table.insert("query[viewtype]","me");
+               if (not_me  == NotMe.FALSE) {
+                       table.insert("query[viewtype]","me");
+               } else {
+               
+               }               
+               if (closed  == Closed.TRUE) {
+                       table.insert("query[viewtype]","me");
+               } else {
+               
+               }
+
                table.insert("limit","999");
                table.insert("sort","summary");
                table.insert("dir","ASC");
+               
+               if (project_id != "") {
+                       table.insert("project_id",project_id);
+               }
+
 
                var params = Soup.Form.encode_hash(table);
                
-               var url = "%s?%s" . printf(baseurl, params);
+               var url = "%s/%s?%s" . printf(roourl, "mtrack_ticket", params);
                
                GLib.debug("request %s", url);
                
@@ -164,7 +273,7 @@ public class RooTicket : Object
                session.send_message (message);
                
                var data = (string) message.response_body.flatten().data;
-               GLib.debug("got %s", data);
+               //GLib.debug("got %s", data);
                try {
                        var parser = new Json.Parser ();
                        parser.load_from_data (data, -1);
@@ -192,6 +301,119 @@ public class RooTicket : Object
                
        }
        
+       
+       public void loadProjects()
+       {
+               RooTicket.singleton().projects = new Gee.ArrayList<RooProject>();
+        
+               
+               var table = new GLib.HashTable<string, string>(str_hash, str_equal);
+        
+               table.insert("query[project_filter]","P,N,U");
+               table.insert("limit","999");
+               table.insert("sort","name");
+               table.insert("dir","ASC");
+
+               var params = Soup.Form.encode_hash(table);
+               
+               var url = "%s/%s?%s" . printf(roourl, "core_project", params);
+               
+               GLib.debug("request %s", url);
+               
+               var session = new Soup.Session ();
+               session.timeout = 0;
+               var message = new Soup.Message ("GET", url);
+               
+               
+               RooTicket.setAuth(message);
+               
+               session.send_message (message);
+               
+               var data = (string) message.response_body.flatten().data;
+               //GLib.debug("got %s", data);
+               try {
+                       var parser = new Json.Parser ();
+                       parser.load_from_data (data, -1);
+
+                       var response = parser.get_root().get_object();
+                       var status = response.get_boolean_member("success");
+               
+                       if(!status){
+                               GLib.error(response.get_string_member("errorMsg"));
+                               return;
+                       }
+                       var rd = response.get_array_member ("data");
+                       
+                       // got a valid result...
+                       var _this = RooTicket.singleton();
+                       for(var i = 0; i < rd.get_length(); i++) {
+                               _this.addProject(rd.get_object_element(i));
+                       }
+                        
+               
+               } catch (Error e) {
+                       GLib.error(e.message);
+                       return;
+               }
+               
+       }
+       public void loadRepos()
+       {
+               RooTicket.singleton().repos = new Gee.ArrayList<RooRepo>();
+        
+               
+               var table = new GLib.HashTable<string, string>(str_hash, str_equal);
+        
+
+               table.insert("limit","999");
+               table.insert("sort","shortname");
+               table.insert("dir","ASC");
+
+               var params = Soup.Form.encode_hash(table);
+               
+               var url = "%s/%s?%s" . printf(roourl, "mtrack_repos", params);
+               
+               GLib.debug("request %s", url);
+               
+               var session = new Soup.Session ();
+               session.timeout = 0;
+               var message = new Soup.Message ("GET", url);
+               
+               
+               RooTicket.setAuth(message);
+               
+               session.send_message (message);
+               
+               var data = (string) message.response_body.flatten().data;
+               //GLib.debug("got %s", data);
+               try {
+                       var parser = new Json.Parser ();
+                       parser.load_from_data (data, -1);
+
+                       var response = parser.get_root().get_object();
+                       var status = response.get_boolean_member("success");
+               
+                       if(!status){
+                               GLib.error(response.get_string_member("errorMsg"));
+                               return;
+                       }
+                       var rd = response.get_array_member ("data");
+                       
+                       // got a valid result...
+                       var _this = RooTicket.singleton();
+                       for(var i = 0; i < rd.get_length(); i++) {
+                               _this.addRepo(rd.get_object_element(i));
+                       }
+                        
+               
+               } catch (Error e) {
+                       GLib.error(e.message);
+                       return;
+               }
+               
+       }
+       
+       
        public  static void setAuth(Soup.Message message) 
        {
                var rs =  RooTicket.singleton();                
@@ -234,11 +456,11 @@ public class RooTicket : Object
                table.insert("reason","fixed by Commits: %s".printf(commits));  
                var params = Soup.Form.encode_hash(table);              
 
-               GLib.debug("request POST %s / %s", baseurl, id);
+               GLib.debug("request POST %s / %s", roourl, id);
 
                var session = new Soup.Session ();
                session.timeout = 0;
-               var message = new Soup.Message ("POST", baseurl);
+               var message = new Soup.Message ("POST", roourl + "/mtrack_ticket");
                RooTicket.setAuth(message);
 
                message.set_request ("application/x-www-form-urlencoded", Soup.MemoryUse.STATIC, params.data);
@@ -271,3 +493,4 @@ public class RooTicket : Object
 
        
 }
+
index 8b54660..88c1719 100644 (file)
@@ -19,7 +19,8 @@
             "..//gitlive/GitMonitorQueue.vala",
             "..//gitlive/RooTicket.vala",
             "..//gitlive/MergeBranch.vala",
-            "..//gitlive/RepoStatusPopover.vala"
+            "..//gitlive/RepoStatusPopover.vala",
+            "..//gitlive/Clone.vala"
         ],
         "packages" : [
         ]
index b24740e..23731bf 100644 (file)
 {
-    "id": "file-gtk-3",
-    "name": "Commit",
-    "parent": "",
-    "title": false,
-    "path": "/home/alan/gitlive/gitlive/Commit.bjs",
-    "items": [
+ "name" : "Commit",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/alan/gitlive/gitlive/old_seed_version/Commit.bjs",
+ "permname" : "",
+ "modOrder" : "",
+ "build_module" : "",
+ "items" : [
+  {
+   "listeners" : {
+    "response" : "function (self, id) {\n  // hide\n     //if (id < 1) {\n        this.el.hide();\n        return;\n    //}\n    if (typeof(this.get('bug').getValue()) != 'object') {\n        print(\"ERROR\");\n        return;\n    }\n \n    this.el.hide();\n        \n    //var val = this.get('bug').getValue();\n     //   Seed.print(val);\n}",
+    "destroy_event" : "function (self, event) {\n     this.el.hide();\n                return false;\n}"
+   },
+   "default_width" : 800,
+   "$ deletable" : true,
+   "title" : "Commit",
+   "xtype" : "Dialog",
+   "default_height" : 500,
+   " modal" : true,
+   "$ modal" : true,
+   "$ show" : "function(c) {\n    \n    if (!this.el) {\n        this.init();\n    }\n    var _this = this;\n    \n    \n    this.files = c.files;\n    this.release = c.release;\n    this.rev = c.rev;\n    \n    this.repo = c.repo;\n\n    this.get('/commitDate').el.set_text(c.changed);\n    this.get('/commitAuthor').el.set_text(c.author);\n    this.get('/commitMsg').el.get_buffer().set_text('');\n    this.get('/commitPatch').showDiff(c.files);\n    \n    this.el.show_all();\n    \n    var run_ret = this.el.run();\n    if (run_ret < 1 ) {\n        return false;\n    }\n    var buf = this.get('/commitMsg').el.get_buffer();\n    var e = {};\n    var s = {};\n    buf.get_start_iter(s);\n    buf.get_end_iter(e);\n    \n    var ret=  {\n        date :  this.get('/commitDate').el.get_text(),\n        author :  this.get('/commitAuthor').el.get_text(),\n        message : buf.get_text(s.value, e.value, false)\n    };\n \n    return ret;\n    \n    \n    \n}\n",
+   "$ xns" : "Gtk",
+   "border_width" : 3,
+   "items" : [
+    {
+     "xtype" : "VBox",
+     "$ pack" : " function(p,e) {\n        p.el.get_content_area().pack_start(e.el,true,true,10);\n    }\n",
+     "$ xns" : "Gtk",
+     "items" : [
+      {
+       "* pack" : "pack_start,false,true,2",
+       "xtype" : "HBox",
+       "$ xns" : "Gtk",
+       "items" : [
         {
-            "listeners": {
-                "destroy_event": "function (self, event) {\n     this.el.hide();\n                return false;\n}",
-                "response": "function (self, id) {\n  // hide\n     //if (id < 1) {\n        this.el.hide();\n        return;\n    //}\n    if (typeof(this.get('bug').getValue()) != 'object') {\n        print(\"ERROR\");\n        return;\n    }\n \n    this.el.hide();\n        \n    //var val = this.get('bug').getValue();\n     //   Seed.print(val);\n}"
-            },
-            " modal": true,
-            "border_width": 3,
-            "default_height": 500,
-            "default_width": 800,
-            "title": "Commit",
-            "xtype": "Dialog",
-            "|deletable": "true",
-            "|modal": "true",
-            "|show": "function(c) {\n    \n    if (!this.el) {\n        this.init();\n    }\n    var _this = this;\n    \n    \n    this.files = c.files;\n    this.release = c.release;\n    this.rev = c.rev;\n    \n    this.repo = c.repo;\n\n    this.get('/commitDate').el.set_text(c.changed);\n    this.get('/commitAuthor').el.set_text(c.author);\n    this.get('/commitMsg').el.get_buffer().set_text('');\n    this.get('/commitPatch').showDiff(c.files);\n    \n    this.el.show_all();\n    \n    var run_ret = this.el.run();\n    if (run_ret < 1 ) {\n        return false;\n    }\n    var buf = this.get('/commitMsg').el.get_buffer();\n    var e = {};\n    var s = {};\n    buf.get_start_iter(s);\n    buf.get_end_iter(e);\n    \n    var ret=  {\n        date :  this.get('/commitDate').el.get_text(),\n        author :  this.get('/commitAuthor').el.get_text(),\n        message : buf.get_text(s.value, e.value, false)\n    };\n \n    return ret;\n    \n    \n    \n}\n",
-            "|xns": "Gtk",
-            "items": [
-                {
-                    "xtype": "VBox",
-                    "|pack": " function(p,e) {\n        p.el.get_content_area().pack_start(e.el,true,true,10);\n    }\n",
-                    "|xns": "Gtk",
-                    "items": [
-                        {
-                            "pack": "pack_start,false,true,2",
-                            "xtype": "HBox",
-                            "|xns": "Gtk",
-                            "items": [
-                                {
-                                    "label": "Fixes",
-                                    "pack": "pack_start,false,false,10",
-                                    "width_request": 50,
-                                    "xtype": "Label",
-                                    "|xns": "Gtk"
-                                },
-                                {
-                                    "listeners": {
-                                        "changed": "function (self) {\n   var val = this.el.get_child().get_text();\n   print(JSON.stringify(val));\n   if (!val.length) {\n       return;\n   }\n   \n   var name = this.get('/remoteName').el.get_text();\n   if (name.length) {\n       return;\n   }\n   // fill in name\n   var val = imports.Scm.Git.Repo.Repo.parseURL(val);\n   if ((typeof(val.host) != 'undefined') && val.host.length) {\n       var host = val.host;\n       // need to add github owner...\n        if (host.match(/github.com$/)) {\n          host += '.' + val.path.split('/').shift();\n        }\n   \n   \n        this.get('/remoteName').el.set_text(host);\n   }\n    \n   \n}"
-                                    },
-                                    "id": "commitFixes",
-                                    "xtype": "ComboBox",
-                                    "|init": "function() {\n    this.el = new Gtk.ComboBox.with_entry();\n    \n    \n    this.model  = new XObject(this.model);\n    this.model.init();\n    this.el.set_model(this.model.el);\n    this.el.set_entry_text_column (0);\n     XObject.prototype.init.call(this);\n    \n}\n",
-                                    "|load": "function(tr)\n{\n    //this.insert(citer,iter,0);\n    this.model.el.clear();\n    \n    var master = false;\n    var working = false;\n    \n    for(var i =0 ; i < tr.length; i++) {\n        var ret = {  };\n        this.model.el.append(ret);\n        //print(JSON.stringify(ret,null,4));\n        if (tr[i].name == 'master') {\n            master = i;\n        }\n        if (tr[i].name == 'working') {\n            working = i;\n        }          \n        this.model.el.set_value(ret.iter, 0, '' + tr[i].name );\n        this.model.el.set_value(ret.iter, 1, '' + tr[i].rev  );\n \n        \n    }     \n    if (master !== false) {\n        this.el.set_active(master);\n    }\n    if (working !== false) {\n        this.el.set_active(working);\n    }\n    \n}",
-                                    "|xns": "Gtk",
-                                    "items": [
-                                        {
-                                            "*prop": "model",
-                                            "xtype": "ListStore",
-                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 3, [\n           GObject.TYPE_STRING, // file  \n          GObject.TYPE_STRING, // added\n          GObject.TYPE_STRING, // removed\n      ] );\n}\n",
-                                            "|xns": "Gtk"
-                                        }
-                                    ]
-                                }
-                            ]
-                        },
-                        {
-                            "pack": "pack_start,false,true,2",
-                            "xtype": "HBox",
-                            "|xns": "Gtk",
-                            "items": [
-                                {
-                                    "label": "Date",
-                                    "pack": "pack_start,false,false,10",
-                                    "width_request": 50,
-                                    "xalign": 1,
-                                    "xtype": "Label",
-                                    "|xns": "Gtk"
-                                },
-                                {
-                                    "id": "commitDate",
-                                    "xtype": "Entry",
-                                    "|xns": "Gtk"
-                                }
-                            ]
-                        },
-                        {
-                            "pack": "pack_start,false,true,2",
-                            "xtype": "HBox",
-                            "|xns": "Gtk",
-                            "items": [
-                                {
-                                    "label": "Author",
-                                    "pack": "pack_start,false,false,10",
-                                    "width_request": 50,
-                                    "xalign": 1,
-                                    "xtype": "Label",
-                                    "|xns": "Gtk"
-                                },
-                                {
-                                    "id": "commitAuthor",
-                                    "xtype": "Entry",
-                                    "|xns": "Gtk"
-                                }
-                            ]
-                        },
-                        {
-                            "pack": "pack_start,false,false,2",
-                            "xtype": "HBox",
-                            "|xns": "Gtk",
-                            "items": [
-                                {
-                                    "label": "Message",
-                                    "pack": "pack_start,false,false,10",
-                                    "width_request": 50,
-                                    "xalign": 1,
-                                    "xtype": "Label",
-                                    "|xns": "Gtk"
-                                },
-                                {
-                                    "height_request": 100,
-                                    "id": "commitMsg",
-                                    "pack": "add",
-                                    "xtype": "TextView",
-                                    "|xns": "Gtk"
-                                }
-                            ]
-                        },
-                        {
-                            "height_request": 200,
-                            "pack": "pack_end,true,true,0",
-                            "xtype": "ScrolledWindow",
-                            "|init": "function() {\n    XObject.prototype.init.call(this);\n      this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n}\n",
-                            "|xns": "Gtk",
-                            "items": [
-                                {
-                                    "id": "commitPatch",
-                                    "pack": "add",
-                                    "xtype": "WebView",
-                                    "|clear": "function() {\n    \n    \n    \n     \n   // remove..\n    var s  = \"document.body.textContent='';\"\n        \n    this.el.execute_script(s);\n        \n        \n    \n    \n    \n}\n",
-                                    "|showDiff": "function(files) {\n    this.clear();\n    \n    \n    \n    if (Commit.release === false) {\n        return;\n    }\n    \n    var diff = Commit.repo.diff(files, Commit.release, Commit.rev);\n    \n   // remove..\n    var s  = \"var pre  = document.createElement('pre'); document.body.appendChild(pre);\";\n    s += \"pre.textContent =  \" +\n             JSON.stringify(Commit.repo.lastCmd + \"\\n\") + '+  ' + \n             JSON.stringify(diff) + \";\";\n        \n    this.el.execute_script(s);\n        \n        \n    \n    \n    \n}\n",
-                                    "|xns": "WebKit"
-                                }
-                            ]
-                        }
-                    ]
-                },
-                {
-                    "label": "Cancel",
-                    "pack": "add_action_widget,0",
-                    "xtype": "Button",
-                    "|xns": "Gtk",
-                    "listeners": {}
-                },
-                {
-                    "id": "ok_button",
-                    "label": "Add",
-                    "pack": "add_action_widget,1",
-                    "xtype": "Button",
-                    "|xns": "Gtk"
-                }
-            ]
+         "label" : "Fixes",
+         "* pack" : "pack_start,false,false,10",
+         "xtype" : "Label",
+         "width_request" : 50,
+         "$ xns" : "Gtk"
+        },
+        {
+         "listeners" : {
+          "changed" : "function (self) {\n   var val = this.el.get_child().get_text();\n   print(JSON.stringify(val));\n   if (!val.length) {\n       return;\n   }\n   \n   var name = this.get('/remoteName').el.get_text();\n   if (name.length) {\n       return;\n   }\n   // fill in name\n   var val = imports.Scm.Git.Repo.Repo.parseURL(val);\n   if ((typeof(val.host) != 'undefined') && val.host.length) {\n       var host = val.host;\n       // need to add github owner...\n        if (host.match(/github.com$/)) {\n          host += '.' + val.path.split('/').shift();\n        }\n   \n   \n        this.get('/remoteName').el.set_text(host);\n   }\n    \n   \n}"
+         },
+         "id" : "commitFixes",
+         "* init" : "function() {\n    this.el = new Gtk.ComboBox.with_entry();\n    \n    \n    this.model  = new XObject(this.model);\n    this.model.init();\n    this.el.set_model(this.model.el);\n    this.el.set_entry_text_column (0);\n     XObject.prototype.init.call(this);\n    \n}\n",
+         "xtype" : "ComboBox",
+         "$ xns" : "Gtk",
+         "$ load" : "function(tr)\n{\n    //this.insert(citer,iter,0);\n    this.model.el.clear();\n    \n    var master = false;\n    var working = false;\n    \n    for(var i =0 ; i < tr.length; i++) {\n        var ret = {  };\n        this.model.el.append(ret);\n        //print(JSON.stringify(ret,null,4));\n        if (tr[i].name == 'master') {\n            master = i;\n        }\n        if (tr[i].name == 'working') {\n            working = i;\n        }          \n        this.model.el.set_value(ret.iter, 0, '' + tr[i].name );\n        this.model.el.set_value(ret.iter, 1, '' + tr[i].rev  );\n \n        \n    }     \n    if (master !== false) {\n        this.el.set_active(master);\n    }\n    if (working !== false) {\n        this.el.set_active(working);\n    }\n    \n}",
+         "items" : [
+          {
+           "* init" : "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 3, [\n           GObject.TYPE_STRING, // file  \n          GObject.TYPE_STRING, // added\n          GObject.TYPE_STRING, // removed\n      ] );\n}\n",
+           "xtype" : "ListStore",
+           "$ xns" : "Gtk",
+           "* prop" : "model"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "* pack" : "pack_start,false,true,2",
+       "xtype" : "HBox",
+       "$ xns" : "Gtk",
+       "items" : [
+        {
+         "label" : "Date",
+         "xalign" : 1,
+         "* pack" : "pack_start,false,false,10",
+         "xtype" : "Label",
+         "width_request" : 50,
+         "$ xns" : "Gtk"
+        },
+        {
+         "id" : "commitDate",
+         "xtype" : "Entry",
+         "$ xns" : "Gtk"
+        }
+       ]
+      },
+      {
+       "* pack" : "pack_start,false,true,2",
+       "xtype" : "HBox",
+       "$ xns" : "Gtk",
+       "items" : [
+        {
+         "label" : "Author",
+         "xalign" : 1,
+         "* pack" : "pack_start,false,false,10",
+         "xtype" : "Label",
+         "width_request" : 50,
+         "$ xns" : "Gtk"
+        },
+        {
+         "id" : "commitAuthor",
+         "xtype" : "Entry",
+         "$ xns" : "Gtk"
+        }
+       ]
+      },
+      {
+       "* pack" : "pack_start,false,false,2",
+       "xtype" : "HBox",
+       "$ xns" : "Gtk",
+       "items" : [
+        {
+         "label" : "Message",
+         "xalign" : 1,
+         "* pack" : "pack_start,false,false,10",
+         "xtype" : "Label",
+         "width_request" : 50,
+         "$ xns" : "Gtk"
+        },
+        {
+         "id" : "commitMsg",
+         "* pack" : "add",
+         "xtype" : "TextView",
+         "$ xns" : "Gtk",
+         "height_request" : 100
+        }
+       ]
+      },
+      {
+       "* init" : "function() {\n    XObject.prototype.init.call(this);\n      this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n}\n",
+       "xtype" : "ScrolledWindow",
+       "* pack" : "pack_end,true,true,0",
+       "$ xns" : "Gtk",
+       "height_request" : 200,
+       "items" : [
+        {
+         "$ clear" : "function() {\n    \n    \n    \n     \n   // remove..\n    var s  = \"document.body.textContent='';\"\n        \n    this.el.execute_script(s);\n        \n        \n    \n    \n    \n}\n",
+         "id" : "commitPatch",
+         "xtype" : "WebView",
+         "* pack" : "add",
+         "$ showDiff" : "function(files) {\n    this.clear();\n    \n    \n    \n    if (Commit.release === false) {\n        return;\n    }\n    \n    var diff = Commit.repo.diff(files, Commit.release, Commit.rev);\n    \n   // remove..\n    var s  = \"var pre  = document.createElement('pre'); document.body.appendChild(pre);\";\n    s += \"pre.textContent =  \" +\n             JSON.stringify(Commit.repo.lastCmd + \"\\n\") + '+  ' + \n             JSON.stringify(diff) + \";\";\n        \n    this.el.execute_script(s);\n        \n        \n    \n    \n    \n}\n",
+         "$ xns" : "WebKit"
         }
-    ],
-    "permname": "",
-    "modOrder": ""
+       ]
+      }
+     ]
+    },
+    {
+     "label" : "Cancel",
+     "xtype" : "Button",
+     "* pack" : "add_action_widget,0",
+     "$ xns" : "Gtk"
+    },
+    {
+     "label" : "Add",
+     "id" : "ok_button",
+     "* pack" : "add_action_widget,1",
+     "xtype" : "Button",
+     "$ xns" : "Gtk"
+    }
+   ]
+  }
+ ]
 }
\ No newline at end of file
index fa7ebd0..4db2f5f 100644 (file)
 {
-    "id": "file-gtk-5",
-    "name": "Merger",
-    "parent": "",
-    "title": false,
-    "path": "/home/alan/gitlive/gitlive/Merger.bjs",
-    "items": [
+ "name" : "Merger",
+ "parent" : "",
+ "title" : "",
+ "path" : "/home/alan/gitlive/gitlive/old_seed_version/Merger.bjs",
+ "permname" : "",
+ "modOrder" : "",
+ "build_module" : "",
+ "items" : [
+  {
+   "listeners" : {
+    "response" : "function (self, id) {\n  // hide\n     //if (id < 1) {\n        this.el.hide();\n        return;\n    //}\n    if (typeof(this.get('bug').getValue()) != 'object') {\n        print(\"ERROR\");\n        return;\n    }\n \n    this.el.hide();\n        \n    //var val = this.get('bug').getValue();\n     //   Seed.print(val);\n}",
+    "destroy_event" : "function (self, event) {\n     this.el.hide();\n                return false;\n}"
+   },
+   "default_width" : 800,
+   "id" : "Merger",
+   "$ deletable" : true,
+   "title" : "Merger",
+   "xtype" : "Dialog",
+   "default_height" : 700,
+   "$ show" : "function(c) {\n    \n    if (!this.el) {\n        this.init();\n    }\n    var _this = this;\n     \n      //this.el.set_title(\"Merger - ??? \");\n//   this.el.set_title(\"Merger - \" + this.repo.repopath);\n\n\n     Merger.loading = true; // stop change firing on combos.\n     /// load up branches\n     \n     this.get('/historyTreeStore').el.clear();\n     this.get('/changedFilesStore').el.clear();\n     this.get('/patchview').clear();\n    \n     \n     \n     this.get('/workingCombo').load(Merger.repo.branches);\n     \n     this.get('/releaseCombo').load(Merger.repo.branches);\n\n\n\n\n     Merger.loading = false;\n\n    this.el.show_all();\n    //this.get('/ok_button').el.set_sensitive(false);\n    \n    // block until we return.\n    var run_ret = this.el.run();\n    if (run_ret < 1 ) {\n        return  \"DONE\";\n    }\n    print(\"RUN RETURN : \" + run_ret);\n    return \"DONE\";\n    //print(JSON.stringify(this.get('bug').getValue()));\n   // return this.get('bug').getValue();\n    //this.success = c.success;\n}\n",
+   "$ xns" : "Gtk",
+   "border_width" : 3,
+   "items" : [
+    {
+     "xtype" : "VBox",
+     "$ pack" : " function(p,e) {\n        p.el.get_content_area().pack_start(e.el,true,true,0)\n    }\n",
+     "$ xns" : "Gtk",
+     "items" : [
+      {
+       "* pack" : "pack_start,false,true",
+       "xtype" : "HBox",
+       "$ xns" : "Gtk",
+       "items" : [
         {
-            "listeners": {
-                "destroy_event": "function (self, event) {\n     this.el.hide();\n                return false;\n}",
-                "response": "function (self, id) {\n  // hide\n     //if (id < 1) {\n        this.el.hide();\n        return;\n    //}\n    if (typeof(this.get('bug').getValue()) != 'object') {\n        print(\"ERROR\");\n        return;\n    }\n \n    this.el.hide();\n        \n    //var val = this.get('bug').getValue();\n     //   Seed.print(val);\n}"
-            },
-            "border_width": 3,
-            "default_height": 700,
-            "default_width": 800,
-            "id": "Merger",
-            "title": "Merger",
-            "xtype": "Dialog",
-            "|deletable": "true",
-            "|show": "function(c) {\n    \n    if (!this.el) {\n        this.init();\n    }\n    var _this = this;\n     \n      //this.el.set_title(\"Merger - ??? \");\n//   this.el.set_title(\"Merger - \" + this.repo.repopath);\n\n\n     Merger.loading = true; // stop change firing on combos.\n     /// load up branches\n     \n     this.get('/historyTreeStore').el.clear();\n     this.get('/changedFilesStore').el.clear();\n     this.get('/patchview').clear();\n    \n     \n     \n     this.get('/workingCombo').load(Merger.repo.branches);\n     \n     this.get('/releaseCombo').load(Merger.repo.branches);\n\n\n\n\n     Merger.loading = false;\n\n    this.el.show_all();\n    //this.get('/ok_button').el.set_sensitive(false);\n    \n    // block until we return.\n    var run_ret = this.el.run();\n    if (run_ret < 1 ) {\n        return  \"DONE\";\n    }\n    print(\"RUN RETURN : \" + run_ret);\n    return \"DONE\";\n    //print(JSON.stringify(this.get('bug').getValue()));\n   // return this.get('bug').getValue();\n    //this.success = c.success;\n}\n",
-            "|xns": "Gtk",
-            "items": [
+         "label" : "Working Branch",
+         "xtype" : "Label",
+         "$ xns" : "Gtk"
+        },
+        {
+         "listeners" : {
+          "changed" : "function (self) {\n   this.get('/historyTreeStore').loadTree();\n}"
+         },
+         "id" : "workingCombo",
+         "* init" : "function() {\n    this.el = new Gtk.ComboBox.with_entry();\n    \n    \n    this.model  = new XObject(this.model);\n    this.model.init();\n    this.el.set_model(this.model.el);\n    this.el.set_entry_text_column (0);\n     XObject.prototype.init.call(this);\n    \n}\n",
+         "xtype" : "ComboBox",
+         "$ xns" : "Gtk",
+         "$ load" : "function(tr)\n{\n    //this.insert(citer,iter,0);\n    this.model.el.clear();\n    \n    var master = false;\n    var working = false;\n    \n    for(var i =0 ; i < tr.length; i++) {\n        if (!tr[i].name.length) {\n            continue;\n        }\n        var ret = {  };\n        this.model.el.append(ret);\n        //print(JSON.stringify(ret,null,4));\n        if (tr[i].name == 'master') {\n            master = i;\n        }\n        if (tr[i].name == 'working') {\n            working = i;\n        }          \n        this.model.el.set_value(ret.iter, 0, '' + tr[i].name );\n        this.model.el.set_value(ret.iter, 1, '' + tr[i].rev  );\n \n        \n    }     \n    if (master !== false) {\n        this.el.set_active(master);\n    }\n    if (working !== false) {\n        this.el.set_active(working);\n    }\n    \n}",
+         "items" : [
+          {
+           "* init" : "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 3, [\n           GObject.TYPE_STRING, // file  \n          GObject.TYPE_STRING, // added\n          GObject.TYPE_STRING, // removed\n      ] );\n}\n",
+           "xtype" : "ListStore",
+           "$ xns" : "Gtk",
+           "* prop" : "model"
+          }
+         ]
+        },
+        {
+         "label" : "Release Branch",
+         "xtype" : "Label",
+         "$ xns" : "Gtk"
+        },
+        {
+         "listeners" : {
+          "changed" : "function (self) {\n   this.get('/historyTreeStore').loadTree();\n}"
+         },
+         "id" : "releaseCombo",
+         "* init" : "function() {\n    this.el = new Gtk.ComboBox.with_entry();\n    \n    \n    this.model  = new XObject(this.model);\n    this.model.init();\n    this.el.set_model(this.model.el);\n    this.el.set_entry_text_column (0);\n     XObject.prototype.init.call(this);\n    \n}\n",
+         "xtype" : "ComboBox",
+         "$ xns" : "Gtk",
+         "$ load" : "function(tr)\n{\n    //this.insert(citer,iter,0);\n    this.model.el.clear();\n    \n    var master = false;\n    var release = false;\n    \n    for(var i =0 ; i < tr.length; i++) {\n        var ret = {  };\n        if (!tr[i].name.length) {\n            continue;\n        }\n        \n        this.model.el.append(ret);\n        //print(JSON.stringify(ret,null,4));\n        if (tr[i].name == 'master') {\n            master = i;\n        }\n        if (tr[i].name == 'release') {\n            release = i;\n        }\n         \n        this.model.el.set_value(ret.iter, 0, '' + tr[i].name );\n        this.model.el.set_value(ret.iter, 1, '' + tr[i].rev  );\n \n        \n    }     \n    if (master !== false) {\n        this.el.set_active(master);\n    }\n    if (release !== false) {\n        this.el.set_active(release);\n    }\n    \n}",
+         "items" : [
+          {
+           "* init" : "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 3, [\n           GObject.TYPE_STRING, // file  \n          GObject.TYPE_STRING, // added\n          GObject.TYPE_STRING, // removed\n      ] );\n}\n",
+           "xtype" : "ListStore",
+           "$ xns" : "Gtk",
+           "* prop" : "model"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "position" : 400,
+       "xtype" : "VPaned",
+       "* pack" : "pack_end,true,true,0",
+       "$ xns" : "Gtk",
+       "items" : [
+        {
+         "position" : 200,
+         "xtype" : "HPaned",
+         "* pack" : "add",
+         "$ xns" : "Gtk",
+         "items" : [
+          {
+           "* init" : "function() {\n    XObject.prototype.init.call(this);\n     this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n}\n",
+           "xtype" : "ScrolledWindow",
+           "$ xns" : "Gtk",
+           "items" : [
+            {
+             "listeners" : {
+              "cursor_changed" : "function (self) {\n\n    if (this.el.get_selection().count_selected_rows() < 1) {\n        //nothing?\n        return;\n    }\n    var model = this.get('/historyTreeStore');\n    var ret = {};        \n     var s = this.el.get_selection();\n    s.get_selected(ret);\n    \n    var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();\n     print(\"OUT?\" + value);// id..\n    // load the list in the right grid..\n    var Repo = imports.Scm.Git.Repo.Repo;\n    \n    \n   \n    if (model.release === false) {\n        return;\n    }\n    model.rev = value;\n   \n    var files = Merger.repo.changedFiles('/',   'rev', model.release + '..' + value);\n    this.get('/changedFilesStore').load(files);\n    return true;\n\n}"
+             },
+             "* init" : "function() {\n    XObject.prototype.init.call(this);\n        var description = new Pango.FontDescription.c_new();\n   description.set_size(8000);\n     this.el.modify_font(description);\n\n     this.selection = this.el.get_selection();\n      this.selection.set_mode( Gtk.SelectionMode.SINGLE);\n    var _this = this;\n    /*\n 780                                                                     \n 781                                                                         // is this really needed??\n 782                                                                         this.selection.signal['changed'].connect(function() {\n 783                                                                                 _this.get('/LeftTree.view').listeners.cursor_changed.apply(\n 784                                                                                     _this.get('/LeftTree.view'), [ _this.get('/LeftTree.view'), '']\n 785                                                                                 );\n 786                                                                         });\n 787                                                                         \n */\n }\n",
+             "* pack" : "add",
+             "xtype" : "TreeView",
+             "$ xns" : "Gtk",
+             "items" : [
+              {
+               "release" : false,
+               "id" : "historyTreeStore",
+               "* init" : "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 3, [\n       GObject.TYPE_STRING, // title \n      GObject.TYPE_STRING, // rev \n  ] );\n}\n",
+               "* pack" : "set_model",
+               "xtype" : "TreeStore",
+               "$ xns" : "Gtk",
+               "$ load" : "function(tr,iter)\n{\n    //this.insert(citer,iter,0);\n    if (!iter) {\n        this.el.clear();\n    }\n    \n    for(var i =0 ; i < tr.length; i++) {\n        var ret = {  };\n        if (iter) {\n            this.el.insert(ret ,iter,-1);\n        } else {\n            this.el.append(ret);\n        }\n        //print(JSON.stringify(ret,null,4));\n         \n          \n        this.el.set_value(ret.iter, 0, ''  +  tr[i].text );\n        this.el.set_value(ret.iter, 1, '' + tr[i].rev  );\n \n        if (tr[i].children && tr[i].children.length) {\n            this.load(tr[i].children, ret.iter);\n        }\n    }     \n}",
+               "$ loadTree" : "function() {\n\n   this.working = false;\n   if (Merger.loading) {\n        return;\n   }\n   \n   \n   var wid = this.get('/workingCombo').el.get_active();\n   var rid = this.get('/releaseCombo').el.get_active();\n   if (wid < 0 || rid < 0 || rid == wid) {\n        return;\n   }\n   \n   var w = Merger.repo.branches[wid];\n   var r = Merger.repo.branches[rid];\n   \n\n\n    var rev = r.name + '..' + w.name;\n    this.release = r.name;\n    this.working = w.name;\n    \n    // this takes some time, lets. try and dialog it..\n\n    \n    \n    \n    var msg = new Gtk.MessageDialog( {\n        buttons : Gtk.ButtonsType.NONE,\n        text: \"Loading History\"\n        \n    });\n    \n    msg.set_transient_for(Merger.el);\n    msg.set_modal(true);\n    msg.show_all();\n\n    var hist = Merger.repo.dayTree('/', false, 'rev', rev);\n    msg.hide();\n    \n    this.load(hist);\n        \n       \n}\n"
+              },
+              {
+               "* init" : "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 0 );\n\n}\n",
+               "xtype" : "TreeViewColumn",
+               "* pack" : "append_column",
+               "title" : "Changes",
+               "$ xns" : "Gtk",
+               "items" : [
                 {
-                    "xtype": "VBox",
-                    "|pack": " function(p,e) {\n        p.el.get_content_area().pack_start(e.el,true,true,0)\n    }\n",
-                    "|xns": "Gtk",
-                    "items": [
-                        {
-                            "pack": "pack_start,false,true",
-                            "xtype": "HBox",
-                            "|xns": "Gtk",
-                            "items": [
-                                {
-                                    "label": "Working Branch",
-                                    "xtype": "Label",
-                                    "|xns": "Gtk"
-                                },
-                                {
-                                    "listeners": {
-                                        "changed": "function (self) {\n   this.get('/historyTreeStore').loadTree();\n}"
-                                    },
-                                    "id": "workingCombo",
-                                    "xtype": "ComboBox",
-                                    "|init": "function() {\n    this.el = new Gtk.ComboBox.with_entry();\n    \n    \n    this.model  = new XObject(this.model);\n    this.model.init();\n    this.el.set_model(this.model.el);\n    this.el.set_entry_text_column (0);\n     XObject.prototype.init.call(this);\n    \n}\n",
-                                    "|load": "function(tr)\n{\n    //this.insert(citer,iter,0);\n    this.model.el.clear();\n    \n    var master = false;\n    var working = false;\n    \n    for(var i =0 ; i < tr.length; i++) {\n        if (!tr[i].name.length) {\n            continue;\n        }\n        var ret = {  };\n        this.model.el.append(ret);\n        //print(JSON.stringify(ret,null,4));\n        if (tr[i].name == 'master') {\n            master = i;\n        }\n        if (tr[i].name == 'working') {\n            working = i;\n        }          \n        this.model.el.set_value(ret.iter, 0, '' + tr[i].name );\n        this.model.el.set_value(ret.iter, 1, '' + tr[i].rev  );\n \n        \n    }     \n    if (master !== false) {\n        this.el.set_active(master);\n    }\n    if (working !== false) {\n        this.el.set_active(working);\n    }\n    \n}",
-                                    "|xns": "Gtk",
-                                    "items": [
-                                        {
-                                            "*prop": "model",
-                                            "xtype": "ListStore",
-                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 3, [\n           GObject.TYPE_STRING, // file  \n          GObject.TYPE_STRING, // added\n          GObject.TYPE_STRING, // removed\n      ] );\n}\n",
-                                            "|xns": "Gtk"
-                                        }
-                                    ]
-                                },
-                                {
-                                    "label": "Release Branch",
-                                    "xtype": "Label",
-                                    "|xns": "Gtk"
-                                },
-                                {
-                                    "listeners": {
-                                        "changed": "function (self) {\n   this.get('/historyTreeStore').loadTree();\n}"
-                                    },
-                                    "id": "releaseCombo",
-                                    "xtype": "ComboBox",
-                                    "|init": "function() {\n    this.el = new Gtk.ComboBox.with_entry();\n    \n    \n    this.model  = new XObject(this.model);\n    this.model.init();\n    this.el.set_model(this.model.el);\n    this.el.set_entry_text_column (0);\n     XObject.prototype.init.call(this);\n    \n}\n",
-                                    "|load": "function(tr)\n{\n    //this.insert(citer,iter,0);\n    this.model.el.clear();\n    \n    var master = false;\n    var release = false;\n    \n    for(var i =0 ; i < tr.length; i++) {\n        var ret = {  };\n        if (!tr[i].name.length) {\n            continue;\n        }\n        \n        this.model.el.append(ret);\n        //print(JSON.stringify(ret,null,4));\n        if (tr[i].name == 'master') {\n            master = i;\n        }\n        if (tr[i].name == 'release') {\n            release = i;\n        }\n         \n        this.model.el.set_value(ret.iter, 0, '' + tr[i].name );\n        this.model.el.set_value(ret.iter, 1, '' + tr[i].rev  );\n \n        \n    }     \n    if (master !== false) {\n        this.el.set_active(master);\n    }\n    if (release !== false) {\n        this.el.set_active(release);\n    }\n    \n}",
-                                    "|xns": "Gtk",
-                                    "items": [
-                                        {
-                                            "*prop": "model",
-                                            "xtype": "ListStore",
-                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 3, [\n           GObject.TYPE_STRING, // file  \n          GObject.TYPE_STRING, // added\n          GObject.TYPE_STRING, // removed\n      ] );\n}\n",
-                                            "|xns": "Gtk"
-                                        }
-                                    ]
-                                }
-                            ]
-                        },
-                        {
-                            "pack": "pack_end,true,true,0",
-                            "position": 400,
-                            "xtype": "VPaned",
-                            "|xns": "Gtk",
-                            "items": [
-                                {
-                                    "pack": "add",
-                                    "position": 200,
-                                    "xtype": "HPaned",
-                                    "|xns": "Gtk",
-                                    "items": [
-                                        {
-                                            "xtype": "ScrolledWindow",
-                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n     this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n}\n",
-                                            "|xns": "Gtk",
-                                            "items": [
-                                                {
-                                                    "listeners": {
-                                                        "cursor_changed": "function (self) {\n\n    if (this.el.get_selection().count_selected_rows() < 1) {\n        //nothing?\n        return;\n    }\n    var model = this.get('/historyTreeStore');\n    var ret = {};        \n     var s = this.el.get_selection();\n    s.get_selected(ret);\n    \n    var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();\n     print(\"OUT?\" + value);// id..\n    // load the list in the right grid..\n    var Repo = imports.Scm.Git.Repo.Repo;\n    \n    \n   \n    if (model.release === false) {\n        return;\n    }\n    model.rev = value;\n   \n    var files = Merger.repo.changedFiles('/',   'rev', model.release + '..' + value);\n    this.get('/changedFilesStore').load(files);\n    return true;\n\n}"
-                                                    },
-                                                    "pack": "add",
-                                                    "xtype": "TreeView",
-                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n        var description = new Pango.FontDescription.c_new();\n   description.set_size(8000);\n     this.el.modify_font(description);\n\n     this.selection = this.el.get_selection();\n      this.selection.set_mode( Gtk.SelectionMode.SINGLE);\n    var _this = this;\n    /*\n 780                                                                     \n 781                                                                         // is this really needed??\n 782                                                                         this.selection.signal['changed'].connect(function() {\n 783                                                                                 _this.get('/LeftTree.view').listeners.cursor_changed.apply(\n 784                                                                                     _this.get('/LeftTree.view'), [ _this.get('/LeftTree.view'), '']\n 785                                                                                 );\n 786                                                                         });\n 787                                                                         \n */\n }\n",
-                                                    "|xns": "Gtk",
-                                                    "items": [
-                                                        {
-                                                            "id": "historyTreeStore",
-                                                            "pack": "set_model",
-                                                            "release": false,
-                                                            "xtype": "TreeStore",
-                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 3, [\n       GObject.TYPE_STRING, // title \n      GObject.TYPE_STRING, // rev \n  ] );\n}\n",
-                                                            "|load": "function(tr,iter)\n{\n    //this.insert(citer,iter,0);\n    if (!iter) {\n        this.el.clear();\n    }\n    \n    for(var i =0 ; i < tr.length; i++) {\n        var ret = {  };\n        if (iter) {\n            this.el.insert(ret ,iter,-1);\n        } else {\n            this.el.append(ret);\n        }\n        //print(JSON.stringify(ret,null,4));\n         \n          \n        this.el.set_value(ret.iter, 0, ''  +  tr[i].text );\n        this.el.set_value(ret.iter, 1, '' + tr[i].rev  );\n \n        if (tr[i].children && tr[i].children.length) {\n            this.load(tr[i].children, ret.iter);\n        }\n    }     \n}",
-                                                            "|loadTree": "function() {\n\n   this.working = false;\n   if (Merger.loading) {\n        return;\n   }\n   \n   \n   var wid = this.get('/workingCombo').el.get_active();\n   var rid = this.get('/releaseCombo').el.get_active();\n   if (wid < 0 || rid < 0 || rid == wid) {\n        return;\n   }\n   \n   var w = Merger.repo.branches[wid];\n   var r = Merger.repo.branches[rid];\n   \n\n\n    var rev = r.name + '..' + w.name;\n    this.release = r.name;\n    this.working = w.name;\n    \n    // this takes some time, lets. try and dialog it..\n\n    \n    \n    \n    var msg = new Gtk.MessageDialog( {\n        buttons : Gtk.ButtonsType.NONE,\n        text: \"Loading History\"\n        \n    });\n    \n    msg.set_transient_for(Merger.el);\n    msg.set_modal(true);\n    msg.show_all();\n\n    var hist = Merger.repo.dayTree('/', false, 'rev', rev);\n    msg.hide();\n    \n    this.load(hist);\n        \n       \n}\n",
-                                                            "|xns": "Gtk"
-                                                        },
-                                                        {
-                                                            "pack": "append_column",
-                                                            "title": "Changes",
-                                                            "xtype": "TreeViewColumn",
-                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 0 );\n\n}\n",
-                                                            "|xns": "Gtk",
-                                                            "items": [
-                                                                {
-                                                                    "pack": "pack_start",
-                                                                    "xtype": "CellRendererText",
-                                                                    "|xns": "Gtk"
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "xtype": "ScrolledWindow",
-                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n      this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n}\n",
-                                            "|xns": "Gtk",
-                                            "items": [
-                                                {
-                                                    "listeners": {
-                                                        "cursor_changed": "function (self) {\n  // SEE SELECTION.CHANGED\n    var files = this.files();\n    this.get('/patchview').showDiff(files); \n    //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();\n     //print(\"OUT?\" + value);// id..\n    // load the list in the right grid..\n     \n    return true;\n\n}"
-                                                    },
-                                                    "id": "changedFilesView",
-                                                    "pack": "add",
-                                                    "xtype": "TreeView",
-                                                    "|files": "function() {\n     if (this.el.get_selection().count_selected_rows() < 1) {\n        //nothing? - clea it?\n        return [];\n    }\n\n    var ret = {};         \n \n\n     var s = this.el.get_selection();\n     var files = [];\n      s.selected_foreach(function(model,p,iter) {\n    \n       files.push( model.get_value(iter, 0).value.get_string());\n     \n    });\n    return files;\n}\n",
-                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n        var description = new Pango.FontDescription.c_new();\n   description.set_size(8000);\n     this.el.modify_font(description);\n\n     this.selection = this.el.get_selection();\n      this.selection.set_mode( Gtk.SelectionMode.MULTIPLE);\n    var _this = this;\n  this.selection.signal['changed'].connect(function() {\n     _this.listeners.cursor_changed.apply(\n          _this, [ _this, '']\n       );\n             });\n  }\n",
-                                                    "|xns": "Gtk",
-                                                    "items": [
-                                                        {
-                                                            "id": "changedFilesStore",
-                                                            "pack": "set_model",
-                                                            "xtype": "ListStore",
-                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 3, [\n       GObject.TYPE_STRING, // file  \n      GObject.TYPE_STRING, // added\n      GObject.TYPE_STRING, // removed\n  ] );\n}\n",
-                                                            "|load": "function(tr)\n{\n    //this.insert(citer,iter,0);\n    this.el.clear();\n    for(var i =0 ; i < tr.length; i++) {\n        var ret = {  };\n       \n        this.el.append(ret);\n        \n        //print(JSON.stringify(ret,null,4));\n         \n          \n        this.el.set_value(ret.iter, 0, ''  +  tr[i].filename );\n        this.el.set_value(ret.iter, 1, '' + tr[i].added  );\n        this.el.set_value(ret.iter, 2, '' + tr[i].removed  );\n \n        \n    }     \n}",
-                                                            "|xns": "Gtk"
-                                                        },
-                                                        {
-                                                            "resizable": true,
-                                                            "min_width": 200,
-                                                            "pack": "append_column",
-                                                            "title": "Filename",
-                                                            "xtype": "TreeViewColumn",
-                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 0 );\n\n}\n",
-                                                            "|xns": "Gtk",
-                                                            "items": [
-                                                                {
-                                                                    "pack": "pack_start",
-                                                                    "xtype": "CellRendererText",
-                                                                    "|xns": "Gtk"
-                                                                }
-                                                            ]
-                                                        },
-                                                        {
-                                                            "min_width": 50,
-                                                            "pack": "append_column",
-                                                            "title": "Added",
-                                                            "xtype": "TreeViewColumn",
-                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 1 );\n\n}\n",
-                                                            "|xns": "Gtk",
-                                                            "items": [
-                                                                {
-                                                                    "pack": "pack_start",
-                                                                    "xtype": "CellRendererText",
-                                                                    "|xns": "Gtk"
-                                                                }
-                                                            ]
-                                                        },
-                                                        {
-                                                            "min_width": 50,
-                                                            "pack": "append_column",
-                                                            "title": "Removed",
-                                                            "xtype": "TreeViewColumn",
-                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 2 );\n\n}\n",
-                                                            "|xns": "Gtk",
-                                                            "items": [
-                                                                {
-                                                                    "pack": "pack_start",
-                                                                    "xtype": "CellRendererText",
-                                                                    "|xns": "Gtk"
-                                                                }
-                                                            ]
-                                                        }
-                                                    ]
-                                                },
-                                                {
-                                                    "|xns": "Gtk",
-                                                    "xtype": "TreeView",
-                                                    "pack": false,
-                                                    "items": [
-                                                        {
-                                                            "|xns": "Gtk",
-                                                            "xtype": "ListStore",
-                                                            "pack": false
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                },
-                                {
-                                    "xtype": "VBox",
-                                    "|xns": "Gtk",
-                                    "items": [
-                                        {
-                                            "pack": "pack_start,false,false,0",
-                                            "xtype": "HBox",
-                                            "|xns": "Gtk",
-                                            "items": [
-                                                {
-                                                    "listeners": {
-                                                        "clicked": "function (self) {\n    \n     \n     var model = this.get('/historyTreeStore');\n    \n    if (model.release === false) {\n        return;\n    }\n    \n \n    var files = this.get('/changedFilesView').files();\n    \n     if (!files.length) {\n        return; // error.!\n    }\n    var diff = Merger.repo.diff(files, model.release, model.rev);\n   \n   \n   print(\"history?\");\n   \n    \n    var history =  Merger.repo.history(files, 1, 'rev', model.rev);\n    \n    print(\"History\" + JSON.stringify(history, null,4));\n    \n    Commit = imports.Commit.Commit;\n\n    Commit.el.set_modal(true);\n    Commit.el.set_transient_for(Merger.el);\n\n    var ce = Commit.show({\n        repo : Merger.repo,\n        files : files,\n        release : model.release,\n        rev : model.rev,\n        author : history[0].changeby,\n        changed : history[0].changed_raw\n        \n    \n    });\n    if (ce === false ) {\n        return;\n    }\n    \n    \n    var diff = Merger.repo.diff(files, model.release, model.rev);\n    \n    \n    print(JSON.stringify(ce,null,4));\n    //.... commit!!!\n    \n    imports.GitMonitor.GitMonitor.pause();\n    \n    \n    \n    var msg = new Gtk.MessageDialog( {\n        buttons : Gtk.ButtonsType.NONE,\n        text: \"Committing Changes\"\n    });\n    \n    msg.set_transient_for(Merger.el);\n    msg.set_modal(true);\n    msg.show_all();\n\n     \n    \n    try { \n        \n        Merger.repo.checkout(model.release);\n        \n        print(\"Call apply patch\");\n        \n        Merger.repo.applyPatch(diff);\n        \n        var author = Merger.repo.parseAuthor(ce.author);\n        \n        print(\"Add new files.\");\n        // add all the files..\n        Merger.repo.add(files);\n        \n        print(\"Commit changes.\");\n        Merger.repo.commit({\n            name    : author.name,\n            email   : author.email,\n            author  : ce.author,\n            changed : ce.changed,\n            reason  : ce.message,\n            files : files\n            \n        });\n        \n      \n    } catch (e) {\n     //message..\n        msg.hide();\n         \n        var emsg = new Gtk.MessageDialog({\n                message_type: Gtk.MessageType.ERROR, \n                buttons : Gtk.ButtonsType.OK, \n                text: e.message\n        });\n        emsg.set_transient_for(Merger.el);\n        emsg.set_modal(true);\n        emsg.run();\n        emsg.destroy();\n        Merger.repo.stash(); // revert change.. - so we can go back...\n    }\n    msg.show_all();\n    msg.set_markup(\"Changing to previous branch\");\n    Merger.repo.checkout(model.working);\n    \n    \n    // if gitlive was previously running warn the user that it is now paused..\n    /*\n    var cmsg = new Gtk.MessageDialog({\n            message_type: Gtk.MessageType.ERROR, \n            buttons : Gtk.ButtonsType.OK, \n            text: \"Git Live is now paused \"\n    });\n    cmsg.run();\n    cmsg.destroy();\n    */\n    var _t = this;\n    GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 5, function() {\n         imports.GitMonitor.GitMonitor.resume();\n         msg.hide();\n         msg.destroy();\n          _t.get('/historyTreeStore').loadTree();\n          _t.get('/changedFilesStore').el.clear();\n          _t.get('/patchview').showDiff(files); \n         return false; //only once.\n    });\n     \n    \n\n\n}   "
-                                                    },
-                                                    "label": "Commit diff (no merge)",
-                                                    "xtype": "Button",
-                                                    "|xns": "Gtk"
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "pack": "pack_end,true,true,0",
-                                            "xtype": "ScrolledWindow",
-                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n      this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n}\n",
-                                            "|xns": "Gtk",
-                                            "items": [
-                                                {
-                                                    "id": "patchview",
-                                                    "pack": "add",
-                                                    "xtype": "WebView",
-                                                    "|clear": "function() {\n    \n    \n    \n     \n   // remove..\n    var s  = \"document.body.textContent='';\"\n        \n    this.el.execute_script(s);\n        \n        \n    \n    \n    \n}\n",
-                                                    "|showDiff": "function(files) {\n    this.clear();\n    \n    \n     var model = this.get('/historyTreeStore');\n    \n    if (model.release === false) {\n        return;\n    }\n    \n    var diff = Merger.repo.diff(files, model.release, model.rev);\n    \n   // remove..\n    var s  = \"var pre  = document.createElement('pre'); document.body.appendChild(pre);\";\n    s += \"pre.textContent =  \" +\n             JSON.stringify(Merger.repo.lastCmd + \"\\n\") + '+  ' + \n           JSON.stringify(diff) + \";\";\n    print(s);\n        \n    this.el.execute_script(s);\n        \n        \n    \n    \n    \n}\n",
-                                                    "|xns": "WebKit"
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                }
-                            ]
-                        }
-                    ]
-                },
+                 "* pack" : "pack_start",
+                 "xtype" : "CellRendererText",
+                 "$ xns" : "Gtk"
+                }
+               ]
+              }
+             ]
+            }
+           ]
+          },
+          {
+           "* init" : "function() {\n    XObject.prototype.init.call(this);\n      this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n}\n",
+           "xtype" : "ScrolledWindow",
+           "$ xns" : "Gtk",
+           "items" : [
+            {
+             "listeners" : {
+              "cursor_changed" : "function (self) {\n  // SEE SELECTION.CHANGED\n    var files = this.files();\n    this.get('/patchview').showDiff(files); \n    //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();\n     //print(\"OUT?\" + value);// id..\n    // load the list in the right grid..\n     \n    return true;\n\n}"
+             },
+             "id" : "changedFilesView",
+             "$ files" : "function() {\n     if (this.el.get_selection().count_selected_rows() < 1) {\n        //nothing? - clea it?\n        return [];\n    }\n\n    var ret = {};         \n \n\n     var s = this.el.get_selection();\n     var files = [];\n      s.selected_foreach(function(model,p,iter) {\n    \n       files.push( model.get_value(iter, 0).value.get_string());\n     \n    });\n    return files;\n}\n",
+             "* init" : "function() {\n    XObject.prototype.init.call(this);\n        var description = new Pango.FontDescription.c_new();\n   description.set_size(8000);\n     this.el.modify_font(description);\n\n     this.selection = this.el.get_selection();\n      this.selection.set_mode( Gtk.SelectionMode.MULTIPLE);\n    var _this = this;\n  this.selection.signal['changed'].connect(function() {\n     _this.listeners.cursor_changed.apply(\n          _this, [ _this, '']\n       );\n             });\n  }\n",
+             "xtype" : "TreeView",
+             "* pack" : "add",
+             "$ xns" : "Gtk",
+             "items" : [
+              {
+               "id" : "changedFilesStore",
+               "* init" : "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 3, [\n       GObject.TYPE_STRING, // file  \n      GObject.TYPE_STRING, // added\n      GObject.TYPE_STRING, // removed\n  ] );\n}\n",
+               "xtype" : "ListStore",
+               "* pack" : "set_model",
+               "$ xns" : "Gtk",
+               "$ load" : "function(tr)\n{\n    //this.insert(citer,iter,0);\n    this.el.clear();\n    for(var i =0 ; i < tr.length; i++) {\n        var ret = {  };\n       \n        this.el.append(ret);\n        \n        //print(JSON.stringify(ret,null,4));\n         \n          \n        this.el.set_value(ret.iter, 0, ''  +  tr[i].filename );\n        this.el.set_value(ret.iter, 1, '' + tr[i].added  );\n        this.el.set_value(ret.iter, 2, '' + tr[i].removed  );\n \n        \n    }     \n}"
+              },
+              {
+               "* init" : "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 0 );\n\n}\n",
+               "* pack" : "append_column",
+               "title" : "Filename",
+               "xtype" : "TreeViewColumn",
+               "min_width" : 200,
+               "$ xns" : "Gtk",
+               "resizable" : true,
+               "items" : [
                 {
-                    "id": "ok_button",
-                    "label": "Close",
-                    "pack": "add_action_widget,1",
-                    "xtype": "Button",
-                    "|xns": "Gtk"
+                 "* pack" : "pack_start",
+                 "xtype" : "CellRendererText",
+                 "$ xns" : "Gtk"
                 }
-            ]
+               ]
+              },
+              {
+               "* init" : "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 1 );\n\n}\n",
+               "title" : "Added",
+               "* pack" : "append_column",
+               "xtype" : "TreeViewColumn",
+               "min_width" : 50,
+               "$ xns" : "Gtk",
+               "items" : [
+                {
+                 "* pack" : "pack_start",
+                 "xtype" : "CellRendererText",
+                 "$ xns" : "Gtk"
+                }
+               ]
+              },
+              {
+               "* init" : "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 2 );\n\n}\n",
+               "title" : "Removed",
+               "* pack" : "append_column",
+               "xtype" : "TreeViewColumn",
+               "min_width" : 50,
+               "$ xns" : "Gtk",
+               "items" : [
+                {
+                 "* pack" : "pack_start",
+                 "xtype" : "CellRendererText",
+                 "$ xns" : "Gtk"
+                }
+               ]
+              }
+             ]
+            },
+            {
+             "* pack" : false,
+             "xtype" : "TreeView",
+             "$ xns" : "Gtk",
+             "items" : [
+              {
+               "* pack" : false,
+               "xtype" : "ListStore",
+               "$ xns" : "Gtk"
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "xtype" : "VBox",
+         "$ xns" : "Gtk",
+         "items" : [
+          {
+           "* pack" : "pack_start,false,false,0",
+           "xtype" : "HBox",
+           "$ xns" : "Gtk",
+           "items" : [
+            {
+             "listeners" : {
+              "clicked" : "function (self) {\n    \n     \n     var model = this.get('/historyTreeStore');\n    \n    if (model.release === false) {\n        return;\n    }\n    \n \n    var files = this.get('/changedFilesView').files();\n    \n     if (!files.length) {\n        return; // error.!\n    }\n    var diff = Merger.repo.diff(files, model.release, model.rev);\n   \n   \n   print(\"history?\");\n   \n    \n    var history =  Merger.repo.history(files, 1, 'rev', model.rev);\n    \n    print(\"History\" + JSON.stringify(history, null,4));\n    \n    Commit = imports.Commit.Commit;\n\n    Commit.el.set_modal(true);\n    Commit.el.set_transient_for(Merger.el);\n\n    var ce = Commit.show({\n        repo : Merger.repo,\n        files : files,\n        release : model.release,\n        rev : model.rev,\n        author : history[0].changeby,\n        changed : history[0].changed_raw\n        \n    \n    });\n    if (ce === false ) {\n        return;\n    }\n    \n    \n    var diff = Merger.repo.diff(files, model.release, model.rev);\n    \n    \n    print(JSON.stringify(ce,null,4));\n    //.... commit!!!\n    \n    imports.GitMonitor.GitMonitor.pause();\n    \n    \n    \n    var msg = new Gtk.MessageDialog( {\n        buttons : Gtk.ButtonsType.NONE,\n        text: \"Committing Changes\"\n    });\n    \n    msg.set_transient_for(Merger.el);\n    msg.set_modal(true);\n    msg.show_all();\n\n     \n    \n    try { \n        \n        Merger.repo.checkout(model.release);\n        \n        print(\"Call apply patch\");\n        \n        Merger.repo.applyPatch(diff);\n        \n        var author = Merger.repo.parseAuthor(ce.author);\n        \n        print(\"Add new files.\");\n        // add all the files..\n        Merger.repo.add(files);\n        \n        print(\"Commit changes.\");\n        Merger.repo.commit({\n            name    : author.name,\n            email   : author.email,\n            author  : ce.author,\n            changed : ce.changed,\n            reason  : ce.message,\n            files : files\n            \n        });\n        \n      \n    } catch (e) {\n     //message..\n        msg.hide();\n         \n        var emsg = new Gtk.MessageDialog({\n                message_type: Gtk.MessageType.ERROR, \n                buttons : Gtk.ButtonsType.OK, \n                text: e.message\n        });\n        emsg.set_transient_for(Merger.el);\n        emsg.set_modal(true);\n        emsg.run();\n        emsg.destroy();\n        Merger.repo.stash(); // revert change.. - so we can go back...\n    }\n    msg.show_all();\n    msg.set_markup(\"Changing to previous branch\");\n    Merger.repo.checkout(model.working);\n    \n    \n    // if gitlive was previously running warn the user that it is now paused..\n    /*\n    var cmsg = new Gtk.MessageDialog({\n            message_type: Gtk.MessageType.ERROR, \n            buttons : Gtk.ButtonsType.OK, \n            text: \"Git Live is now paused \"\n    });\n    cmsg.run();\n    cmsg.destroy();\n    */\n    var _t = this;\n    GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 5, function() {\n         imports.GitMonitor.GitMonitor.resume();\n         msg.hide();\n         msg.destroy();\n          _t.get('/historyTreeStore').loadTree();\n          _t.get('/changedFilesStore').el.clear();\n          _t.get('/patchview').showDiff(files); \n         return false; //only once.\n    });\n     \n    \n\n\n}   "
+             },
+             "label" : "Commit diff (no merge)",
+             "xtype" : "Button",
+             "$ xns" : "Gtk"
+            }
+           ]
+          },
+          {
+           "* init" : "function() {\n    XObject.prototype.init.call(this);\n      this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n}\n",
+           "* pack" : "pack_end,true,true,0",
+           "xtype" : "ScrolledWindow",
+           "$ xns" : "Gtk",
+           "items" : [
+            {
+             "$ clear" : "function() {\n    \n    \n    \n     \n   // remove..\n    var s  = \"document.body.textContent='';\"\n        \n    this.el.execute_script(s);\n        \n        \n    \n    \n    \n}\n",
+             "id" : "patchview",
+             "xtype" : "WebView",
+             "* pack" : "add",
+             "$ showDiff" : "function(files) {\n    this.clear();\n    \n    \n     var model = this.get('/historyTreeStore');\n    \n    if (model.release === false) {\n        return;\n    }\n    \n    var diff = Merger.repo.diff(files, model.release, model.rev);\n    \n   // remove..\n    var s  = \"var pre  = document.createElement('pre'); document.body.appendChild(pre);\";\n    s += \"pre.textContent =  \" +\n             JSON.stringify(Merger.repo.lastCmd + \"\\n\") + '+  ' + \n           JSON.stringify(diff) + \";\";\n    print(s);\n        \n    this.el.execute_script(s);\n        \n        \n    \n    \n    \n}\n",
+             "$ xns" : "WebKit"
+            }
+           ]
+          }
+         ]
         }
-    ],
-    "permname": "",
-    "modOrder": ""
+       ]
+      }
+     ]
+    },
+    {
+     "label" : "Close",
+     "id" : "ok_button",
+     "* pack" : "add_action_widget,1",
+     "xtype" : "Button",
+     "$ xns" : "Gtk"
+    }
+   ]
+  }
+ ]
 }
\ No newline at end of file