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