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