Clones.bjs
authorAlan Knowles <alan@roojs.com>
Fri, 14 Dec 2018 07:27:44 +0000 (15:27 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 14 Dec 2018 07:27:44 +0000 (15:27 +0800)
Clones.vala

Clones.bjs
Clones.vala

index b731ebb..e87e420 100644 (file)
@@ -30,8 +30,8 @@
      "items" : [
       {
        "bool homogeneous" : true,
-       "* pack" : "pack_start,false,false,0",
        "xtype" : "Box",
+       "* pack" : "pack_start,false,false,0",
        "$ xns" : "Gtk",
        "Gtk.Orientation orientation" : "Gtk.Orientation.HORIZONTAL",
        "items" : [
           "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}"
          },
          "label" : "Add Repository",
-         "* pack" : "add",
-         "xtype" : "Button",
-         "$ 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",
-         "* pack" : "add",
-         "xtype" : "Button",
-         "$ 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",
-         "* pack" : "add",
-         "xtype" : "Button",
-         "$ xns" : "Gtk"
-        },
-        {
-         "listeners" : {
-          "clicked" : "() => {\n    \n    \n \n       \n    \n    \n}"
-         },
-         "label" : "Switch Branch",
-         "* pack" : "add",
          "xtype" : "Button",
-         "$ 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",
          "* pack" : "add",
-         "xtype" : "Button",
          "$ xns" : "Gtk"
         }
        ]
       },
       {
        "* init" : "  {\n  \n   this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n}\n",
-       "bool hexpand" : true,
        "bool expand" : true,
+       "bool hexpand" : 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",
-         "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",
+         "bool activate_on_single_click" : true,
          "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",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererToggle",
+             "* pack" : "pack_start,false",
              "$ 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",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererToggle",
+             "* pack" : "pack_start,false",
              "$ 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",
-             "xtype" : "CellRendererToggle",
              "* pack" : "pack_start,false",
+             "xtype" : "CellRendererToggle",
              "$ xns" : "Gtk",
              "$ mode" : "Gtk.CellRendererMode.ACTIVATABLE"
             }
           },
           {
            "id" : "tv_repo",
-           "* init" : "\n    this.el.add_attribute(_this.cr_repo.el , \"markup\", 0 );\n",
            "Gtk.SortType sort_order" : "Gtk.SortType.ASCENDING",
+           "* init" : "\n    this.el.add_attribute(_this.cr_repo.el , \"markup\", 0 );\n",
            "title" : "Repo",
            "* pack" : "append_column",
            "xtype" : "TreeViewColumn",
            "items" : [
             {
              "id" : "cr_repo",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererText",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_active_ticket",
-             "xtype" : "CellRendererText",
              "* pack" : "pack_start,false",
+             "xtype" : "CellRendererText",
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_current_branch",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererText",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_last_updated",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererText",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk"
             }
            ]
            "items" : [
             {
              "id" : "cr_all_branches",
-             "* pack" : "pack_start,false",
              "xtype" : "CellRendererText",
+             "* pack" : "pack_start,false",
              "$ xns" : "Gtk"
             }
            ]
index c1a8a2b..3af463f 100644 (file)
@@ -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
@@ -224,217 +212,6 @@ public class Clones : Object
                    
                 
                 
-            });
-        }
-
-        // 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( () => {
-                
-                
-             
-                   
-                
-                
-            });
-        }
-
-        // 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 +219,7 @@ public class Clones : Object
     }
 
 
-    public class Xcls_ScrolledWindow9 : Object
+    public class Xcls_ScrolledWindow5 : Object
     {
         public Gtk.ScrolledWindow el;
         private Clones  _this;
@@ -451,7 +228,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 );