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