Clones.bjs
[gitlive] / Clones.vala
1 static Clones  _Clones;
2
3 public class Clones : Object
4 {
5     public Gtk.Popover el;
6     private Clones  _this;
7
8     public static Clones singleton()
9     {
10         if (_Clones == null) {
11             _Clones= new Clones();
12         }
13         return _Clones;
14     }
15     public Xcls_reposView reposView;
16     public Xcls_reposStore reposStore;
17     public Xcls_tv_autocommit tv_autocommit;
18     public Xcls_cr_autocommit cr_autocommit;
19     public Xcls_tv_autopush tv_autopush;
20     public Xcls_cr_autopush cr_autopush;
21     public Xcls_tv_repo tv_repo;
22     public Xcls_cr_repo cr_repo;
23     public Xcls_tv_current_branch tv_current_branch;
24     public Xcls_cr_current_branch cr_current_branch;
25     public Xcls_tv_last_updated tv_last_updated;
26     public Xcls_cr_last_updated cr_last_updated;
27     public Xcls_tv_all_branches tv_all_branches;
28     public Xcls_cr_all_branches cr_all_branches;
29     public Xcls_ok_button ok_button;
30
31         // my vars (def)
32
33     // ctor
34     public Clones()
35     {
36         _this = this;
37         this.el = new Gtk.Popover( null );
38
39         // my vars (dec)
40
41         // set gobject values
42         this.el.border_width = 3;
43         this.el.modal = true;
44         var child_0 = new Xcls_Box2( _this );
45         child_0.ref();
46         this.el.add (  child_0.el  );
47     }
48
49     // user defined functions
50     public void show (Gtk.Widget menuitem)    {
51     
52        
53     
54         
55                 //console.log('show all');
56         this.el.set_modal(false);
57     
58     
59         this.el.set_position(Gtk.PositionType.TOP);
60     //  this.el.popup();
61         // window + header?
62         this.el.show_all();
63         this.el.set_size_request(800,500);
64         this.el.set_relative_to(menuitem);
65         //this.view.el.grab_focus();
66     }
67     public class Xcls_Box2 : Object
68     {
69         public Gtk.Box el;
70         private Clones  _this;
71
72
73             // my vars (def)
74
75         // ctor
76         public Xcls_Box2(Clones _owner )
77         {
78             _this = _owner;
79             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
80
81             // my vars (dec)
82
83             // set gobject values
84             var child_0 = new Xcls_Box3( _this );
85             child_0.ref();
86             this.el.pack_start (  child_0.el , false,false,0 );
87             var child_1 = new Xcls_ScrolledWindow9( _this );
88             child_1.ref();
89             this.el.add (  child_1.el  );
90             var child_2 = new Xcls_ok_button( _this );
91             child_2.ref();
92             this.el.add (  child_2.el  );
93         }
94
95         // user defined functions
96     }
97     public class Xcls_Box3 : Object
98     {
99         public Gtk.Box el;
100         private Clones  _this;
101
102
103             // my vars (def)
104
105         // ctor
106         public Xcls_Box3(Clones _owner )
107         {
108             _this = _owner;
109             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
110
111             // my vars (dec)
112
113             // set gobject values
114             var child_0 = new Xcls_Button4( _this );
115             child_0.ref();
116             this.el.add (  child_0.el  );
117             var child_1 = new Xcls_Button5( _this );
118             child_1.ref();
119             this.el.add (  child_1.el  );
120             var child_2 = new Xcls_Button6( _this );
121             child_2.ref();
122             this.el.add (  child_2.el  );
123             var child_3 = new Xcls_Button7( _this );
124             child_3.ref();
125             this.el.add (  child_3.el  );
126             var child_4 = new Xcls_Button8( _this );
127             child_4.ref();
128             this.el.add (  child_4.el  );
129         }
130
131         // user defined functions
132     }
133     public class Xcls_Button4 : Object
134     {
135         public Gtk.Button el;
136         private Clones  _this;
137
138
139             // my vars (def)
140
141         // ctor
142         public Xcls_Button4(Clones _owner )
143         {
144             _this = _owner;
145             this.el = new Gtk.Button();
146
147             // my vars (dec)
148
149             // set gobject values
150             this.el.label = "Remotes / Clones";
151
152             //listeners
153             this.el.clicked.connect( () => {
154             
155             /*    var rv = this.get('/reposView');
156                 var rs = this.get('/reposStore');
157                 if (rv.el.get_selection().count_selected_rows() != 1) {
158                     //nothing?
159                     // error condition.
160                     return;
161                 }
162                 var Remotes =     imports.Remotes.Remotes;
163                 
164              
165                 var ret = {};       
166                 var s = rv.el.get_selection();
167                 var path = '';
168                 s.selected_foreach(function(model,p,iter) {
169                                                                 
170                    path = model.get_value(iter, 6).value.get_string();
171                  
172                 }); 
173             
174                 var repo = false;
175                 rs.repos.forEach(function(r) {
176                     if (r.repopath == path) {
177                         repo = r;
178                     
179                     }
180                 
181                 });
182                 Remotes.repo = repo;
183                 Remotes.el.set_transient_for(Clones.el);
184                 Clones.el.set_title("Manage Clones - " + repo.repopath);
185                 Remotes.show();
186                 Clones.el.set_title("Manage Clones");
187             
188               */   
189                 
190                  
191             
192                    
193                 
194                 
195             });
196         }
197
198         // user defined functions
199     }
200
201     public class Xcls_Button5 : Object
202     {
203         public Gtk.Button el;
204         private Clones  _this;
205
206
207             // my vars (def)
208
209         // ctor
210         public Xcls_Button5(Clones _owner )
211         {
212             _this = _owner;
213             this.el = new Gtk.Button();
214
215             // my vars (dec)
216
217             // set gobject values
218             this.el.label = "Branches";
219
220             //listeners
221             this.el.clicked.connect( () => {
222             /*
223                 var rv = this.get('/reposView');
224                 var rs = this.get('/reposStore');
225                 if (rv.el.get_selection().count_selected_rows() != 1) {
226                     //nothing?
227                     // error condition.
228                     return;
229                 }
230                 var Branches =     imports.Branches.Branches;
231                 
232              
233                 var ret = {};       
234                 var s = rv.el.get_selection();
235                 var path = '';
236                 s.selected_foreach(function(model,p,iter) {
237                                                                 
238                    path = model.get_value(iter, 6).value.get_string();
239                  
240                 }); 
241             
242                 var repo = false;
243                 rs.repos.forEach(function(r) {
244                     if (r.repopath == path) {
245                         repo = r;
246                     
247                     }
248                 
249                 });
250                 Branches.repo = repo;
251                 Branches.el.set_transient_for(Clones.el);
252                 Clones.el.set_title("Manage Clones - " + repo.repopath);
253                 Branches.show();
254                 Clones.el.set_title("Manage Clones");
255             
256                  
257                 
258                 
259                 
260             
261                    
262              */   
263                 
264             });
265         }
266
267         // user defined functions
268     }
269
270     public class Xcls_Button6 : Object
271     {
272         public Gtk.Button el;
273         private Clones  _this;
274
275
276             // my vars (def)
277
278         // ctor
279         public Xcls_Button6(Clones _owner )
280         {
281             _this = _owner;
282             this.el = new Gtk.Button();
283
284             // my vars (dec)
285
286             // set gobject values
287             this.el.label = "Merge";
288
289             //listeners
290             this.el.clicked.connect( () =>  {
291             /*
292                 var rv = this.get('/reposView');
293                 var rs = this.get('/reposStore');
294                 if (rv.el.get_selection().count_selected_rows() != 1) {
295                     //nothing?
296                     // error condition.
297                     return;
298                 }
299                 var Merger =     imports.Merger.Merger;
300                 
301              
302                 var ret = {};       
303                 var s = rv.el.get_selection();
304                 var path = '';
305                 s.selected_foreach(function(model,p,iter) {
306                                                                 
307                    path = model.get_value(iter, 6).value.get_string();
308                  
309                 }); 
310             
311                 var repo = false;
312                 rs.repos.forEach(function(r) {
313                     if (r.repopath == path) {
314                         repo = r;
315                     
316                     }
317                 
318                 });
319                 Merger.repo = repo;
320                 Merger.el.set_transient_for(Clones.el);
321                 Clones.el.set_title("Manage Clones - " + repo.repopath);
322                 Merger.show();
323                 Clones.el.set_title("Manage Clones");
324             
325                 
326                 
327             
328                  
329                 
330             
331              */      
332                 
333                 
334             });
335         }
336
337         // user defined functions
338     }
339
340     public class Xcls_Button7 : Object
341     {
342         public Gtk.Button el;
343         private Clones  _this;
344
345
346             // my vars (def)
347
348         // ctor
349         public Xcls_Button7(Clones _owner )
350         {
351             _this = _owner;
352             this.el = new Gtk.Button();
353
354             // my vars (dec)
355
356             // set gobject values
357             this.el.label = "Switch Branch";
358
359             //listeners
360             this.el.clicked.connect( () => {
361                 
362                 
363              
364                    
365                 
366                 
367             });
368         }
369
370         // user defined functions
371     }
372
373     public class Xcls_Button8 : Object
374     {
375         public Gtk.Button el;
376         private Clones  _this;
377
378
379             // my vars (def)
380
381         // ctor
382         public Xcls_Button8(Clones _owner )
383         {
384             _this = _owner;
385             this.el = new Gtk.Button();
386
387             // my vars (dec)
388
389             // set gobject values
390             this.el.label = "Pull";
391
392             //listeners
393             this.el.clicked.connect( () => {
394                 
395                 
396              
397                    
398                 
399                 
400             });
401         }
402
403         // user defined functions
404     }
405
406
407     public class Xcls_ScrolledWindow9 : Object
408     {
409         public Gtk.ScrolledWindow el;
410         private Clones  _this;
411
412
413             // my vars (def)
414
415         // ctor
416         public Xcls_ScrolledWindow9(Clones _owner )
417         {
418             _this = _owner;
419             this.el = new Gtk.ScrolledWindow( null, null );
420
421             // my vars (dec)
422
423             // set gobject values
424             this.el.expand = true;
425             this.el.shadow_type = Gtk.ShadowType.IN;
426             var child_0 = new Xcls_reposView( _this );
427             child_0.ref();
428             this.el.add (  child_0.el  );
429
430             // init method
431
432             {
433               
434                this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
435             }
436         }
437
438         // user defined functions
439     }
440     public class Xcls_reposView : Object
441     {
442         public Gtk.TreeView el;
443         private Clones  _this;
444
445
446             // my vars (def)
447
448         // ctor
449         public Xcls_reposView(Clones _owner )
450         {
451             _this = _owner;
452             _this.reposView = this;
453             this.el = new Gtk.TreeView();
454
455             // my vars (dec)
456
457             // set gobject values
458             var child_0 = new Xcls_reposStore( _this );
459             child_0.ref();
460             this.el.set_model (  child_0.el  );
461             var child_1 = new Xcls_tv_autocommit( _this );
462             child_1.ref();
463             this.el.append_column (  child_1.el  );
464             var child_2 = new Xcls_tv_autopush( _this );
465             child_2.ref();
466             this.el.append_column (  child_2.el  );
467             var child_3 = new Xcls_tv_repo( _this );
468             child_3.ref();
469             this.el.append_column (  child_3.el  );
470             var child_4 = new Xcls_tv_current_branch( _this );
471             child_4.ref();
472             this.el.append_column (  child_4.el  );
473             var child_5 = new Xcls_tv_last_updated( _this );
474             child_5.ref();
475             this.el.append_column (  child_5.el  );
476             var child_6 = new Xcls_tv_all_branches( _this );
477             child_6.ref();
478             this.el.append_column (  child_6.el  );
479
480             // init method
481
482             {
483                 var selection = this.el.get_selection();
484                 selection.set_mode( Gtk.SelectionMode.SINGLE);
485             
486             
487                 var description = new Pango.FontDescription();
488                 description.set_size(10000);
489                 this.el.override_font(description);
490             }
491
492             //listeners
493             this.el.cursor_changed.connect( ()  => {
494               // SEE SELECTION.CHANGED
495               /*
496               
497               return;
498               
499                 if (this.el.get_selection().count_selected_rows() < 1) {
500                     //nothing? - clea it?
501                     return;
502                 }
503                     var ret = {};         
504                 var model = this.get('/changedFilesStore');
505             
506                  var s = this.el.get_selection();
507                  var files = [];
508                 s.selected_foreach(function(model,p,iter) {
509                 
510                    files.push( model.get_value(iter, 0).value.get_string());
511                  
512                 });
513                 this.get('/patchview').showDiff(files); 
514                 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
515                  //print("OUT?" + value);// id..
516                 // load the list in the right grid..
517                  
518                 return true;
519             */
520             });
521         }
522
523         // user defined functions
524     }
525     public class Xcls_reposStore : Object
526     {
527         public Gtk.ListStore el;
528         private Clones  _this;
529
530
531             // my vars (def)
532
533         // ctor
534         public Xcls_reposStore(Clones _owner )
535         {
536             _this = _owner;
537             _this.reposStore = this;
538             this.el = new Gtk.ListStore( 0,      typeof(string),  // 0 repo
539      typeof(string),  // 1 current branch
540      typeof(string),  // 2 all branch
541      typeof(string),  // 3 updated
542      typeof(bool),   // 4 auto commit
543      typeof(bool),   // 5 auto push
544      typeof(string),   // 7 repopath
545       typeof(string)   // 8 color highlighting?
546        );
547
548             // my vars (dec)
549
550             // set gobject values
551         }
552
553         // user defined functions
554     }
555
556     public class Xcls_tv_autocommit : Object
557     {
558         public Gtk.TreeViewColumn el;
559         private Clones  _this;
560
561
562             // my vars (def)
563
564         // ctor
565         public Xcls_tv_autocommit(Clones _owner )
566         {
567             _this = _owner;
568             _this.tv_autocommit = this;
569             this.el = new Gtk.TreeViewColumn();
570
571             // my vars (dec)
572
573             // set gobject values
574             this.el.title = "Auto Commit";
575             this.el.min_width = 50;
576             var child_0 = new Xcls_cr_autocommit( _this );
577             child_0.ref();
578             this.el.pack_start (  child_0.el , false );
579
580             // init method
581
582             //    this.items[0].el.set_activatable(true);
583              this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
584         }
585
586         // user defined functions
587     }
588     public class Xcls_cr_autocommit : Object
589     {
590         public Gtk.CellRendererToggle el;
591         private Clones  _this;
592
593
594             // my vars (def)
595
596         // ctor
597         public Xcls_cr_autocommit(Clones _owner )
598         {
599             _this = _owner;
600             _this.cr_autocommit = this;
601             this.el = new Gtk.CellRendererToggle();
602
603             // my vars (dec)
604
605             // set gobject values
606             this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
607
608             //listeners
609             this.el.toggled.connect( (self, path)  => {
610             /*    var ret ={} ;
611                 var store = this.get('/reposStore');
612                 store.el.get_iter_from_string(ret, path);
613                                                                              
614                 var value =   store.el.get_value(ret.iter,4).value.get_boolean();
615                                                                              
616                 //print(JSON.stringify(value));
617                 store.el.set_value(ret.iter,4, !value);
618                 
619                  var path =  store.el.get_value(ret.iter, 6).value.get_string();
620                  var repo = imports.Scm.Repo.Repo.get(path);
621                  repo.autocommit(!value);
622               */   
623                 
624                 
625             });
626         }
627
628         // user defined functions
629     }
630
631
632     public class Xcls_tv_autopush : Object
633     {
634         public Gtk.TreeViewColumn el;
635         private Clones  _this;
636
637
638             // my vars (def)
639
640         // ctor
641         public Xcls_tv_autopush(Clones _owner )
642         {
643             _this = _owner;
644             _this.tv_autopush = this;
645             this.el = new Gtk.TreeViewColumn();
646
647             // my vars (dec)
648
649             // set gobject values
650             this.el.title = "Auto Push";
651             this.el.min_width = 50;
652             var child_0 = new Xcls_cr_autopush( _this );
653             child_0.ref();
654             this.el.pack_start (  child_0.el , false );
655
656             // init method
657
658             this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
659             //      this.items[0].el.set_activatable(true);
660         }
661
662         // user defined functions
663     }
664     public class Xcls_cr_autopush : Object
665     {
666         public Gtk.CellRendererToggle el;
667         private Clones  _this;
668
669
670             // my vars (def)
671
672         // ctor
673         public Xcls_cr_autopush(Clones _owner )
674         {
675             _this = _owner;
676             _this.cr_autopush = this;
677             this.el = new Gtk.CellRendererToggle();
678
679             // my vars (dec)
680
681             // set gobject values
682             this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
683
684             //listeners
685             this.el.toggled.connect( (self, path)  => {
686             /*    var ret ={} ;
687                 var store = this.get('/reposStore');
688                 store.el.get_iter_from_string(ret, path);
689                                                                              
690                 var value =   store.el.get_value(ret.iter,5).value.get_boolean();
691                                                                              
692                 //print(JSON.stringify(value));
693                 store.el.set_value(ret.iter,5, !value);
694                   var path =  store.el.get_value(ret.iter, 6).value.get_string();
695                  var repo = imports.Scm.Repo.Repo.get(path);
696                  repo.autopush(!value);
697                 */
698             });
699         }
700
701         // user defined functions
702     }
703
704
705     public class Xcls_tv_repo : Object
706     {
707         public Gtk.TreeViewColumn el;
708         private Clones  _this;
709
710
711             // my vars (def)
712
713         // ctor
714         public Xcls_tv_repo(Clones _owner )
715         {
716             _this = _owner;
717             _this.tv_repo = this;
718             this.el = new Gtk.TreeViewColumn();
719
720             // my vars (dec)
721
722             // set gobject values
723             this.el.title = "Repo";
724             this.el.min_width = 200;
725             this.el.resizable = true;
726             var child_0 = new Xcls_cr_repo( _this );
727             child_0.ref();
728             this.el.pack_start (  child_0.el , false );
729
730             // init method
731
732             this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
733         }
734
735         // user defined functions
736     }
737     public class Xcls_cr_repo : Object
738     {
739         public Gtk.CellRendererText el;
740         private Clones  _this;
741
742
743             // my vars (def)
744
745         // ctor
746         public Xcls_cr_repo(Clones _owner )
747         {
748             _this = _owner;
749             _this.cr_repo = this;
750             this.el = new Gtk.CellRendererText();
751
752             // my vars (dec)
753
754             // set gobject values
755         }
756
757         // user defined functions
758     }
759
760
761     public class Xcls_tv_current_branch : Object
762     {
763         public Gtk.TreeViewColumn el;
764         private Clones  _this;
765
766
767             // my vars (def)
768
769         // ctor
770         public Xcls_tv_current_branch(Clones _owner )
771         {
772             _this = _owner;
773             _this.tv_current_branch = this;
774             this.el = new Gtk.TreeViewColumn();
775
776             // my vars (dec)
777
778             // set gobject values
779             this.el.title = "Current Branch";
780             this.el.min_width = 50;
781             var child_0 = new Xcls_cr_current_branch( _this );
782             child_0.ref();
783             this.el.pack_start (  child_0.el , false );
784
785             // init method
786
787             this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
788                  this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
789         }
790
791         // user defined functions
792     }
793     public class Xcls_cr_current_branch : Object
794     {
795         public Gtk.CellRendererText el;
796         private Clones  _this;
797
798
799             // my vars (def)
800
801         // ctor
802         public Xcls_cr_current_branch(Clones _owner )
803         {
804             _this = _owner;
805             _this.cr_current_branch = this;
806             this.el = new Gtk.CellRendererText();
807
808             // my vars (dec)
809
810             // set gobject values
811         }
812
813         // user defined functions
814     }
815
816
817     public class Xcls_tv_last_updated : Object
818     {
819         public Gtk.TreeViewColumn el;
820         private Clones  _this;
821
822
823             // my vars (def)
824
825         // ctor
826         public Xcls_tv_last_updated(Clones _owner )
827         {
828             _this = _owner;
829             _this.tv_last_updated = this;
830             this.el = new Gtk.TreeViewColumn();
831
832             // my vars (dec)
833
834             // set gobject values
835             this.el.title = "Last updated";
836             this.el.min_width = 50;
837             var child_0 = new Xcls_cr_last_updated( _this );
838             child_0.ref();
839             this.el.pack_start (  child_0.el , false );
840
841             // init method
842
843             this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
844         }
845
846         // user defined functions
847     }
848     public class Xcls_cr_last_updated : Object
849     {
850         public Gtk.CellRendererText el;
851         private Clones  _this;
852
853
854             // my vars (def)
855
856         // ctor
857         public Xcls_cr_last_updated(Clones _owner )
858         {
859             _this = _owner;
860             _this.cr_last_updated = this;
861             this.el = new Gtk.CellRendererText();
862
863             // my vars (dec)
864
865             // set gobject values
866         }
867
868         // user defined functions
869     }
870
871
872     public class Xcls_tv_all_branches : Object
873     {
874         public Gtk.TreeViewColumn el;
875         private Clones  _this;
876
877
878             // my vars (def)
879
880         // ctor
881         public Xcls_tv_all_branches(Clones _owner )
882         {
883             _this = _owner;
884             _this.tv_all_branches = this;
885             this.el = new Gtk.TreeViewColumn();
886
887             // my vars (dec)
888
889             // set gobject values
890             this.el.title = "All Branches";
891             this.el.min_width = 50;
892             this.el.resizable = false;
893             var child_0 = new Xcls_cr_all_branches( _this );
894             child_0.ref();
895             this.el.pack_start (  child_0.el , false );
896
897             // init method
898
899             this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
900         }
901
902         // user defined functions
903     }
904     public class Xcls_cr_all_branches : Object
905     {
906         public Gtk.CellRendererText el;
907         private Clones  _this;
908
909
910             // my vars (def)
911
912         // ctor
913         public Xcls_cr_all_branches(Clones _owner )
914         {
915             _this = _owner;
916             _this.cr_all_branches = this;
917             this.el = new Gtk.CellRendererText();
918
919             // my vars (dec)
920
921             // set gobject values
922         }
923
924         // user defined functions
925     }
926
927
928
929
930     public class Xcls_ok_button : Object
931     {
932         public Gtk.Button el;
933         private Clones  _this;
934
935
936             // my vars (def)
937
938         // ctor
939         public Xcls_ok_button(Clones _owner )
940         {
941             _this = _owner;
942             _this.ok_button = this;
943             this.el = new Gtk.Button();
944
945             // my vars (dec)
946
947             // set gobject values
948             this.el.label = "Close";
949         }
950
951         // user defined functions
952     }
953
954
955 }