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