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