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