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.add (  child_0.el  );
47     }
48
49     // user defined functions
50     public void show (Gtk.Widget menuitem)    {
51     
52     
53         Gdk.Screen s;
54         Gdk.Rectange r;
55         Gtk.Orientation o;
56         
57         statusicon.get_geometry( out s, out r, out o);
58     
59        
60         this.el.set_relative_to( null );
61         this.el.set_pointing_to( r);
62         this.el.set_position(Gtk.PositionType.BOTTOM);
63         
64         
65                 //console.log('show all');
66         this.el.set_modal(true);
67     
68     
69         
70     //  this.el.popup();
71         // window + header?
72         this.el.show_all();
73         this.el.set_size_request(800,500);
74     
75         //this.view.el.grab_focus();
76     }
77     public class Xcls_Box2 : Object
78     {
79         public Gtk.Box el;
80         private Clones  _this;
81
82
83             // my vars (def)
84
85         // ctor
86         public Xcls_Box2(Clones _owner )
87         {
88             _this = _owner;
89             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
90
91             // my vars (dec)
92
93             // set gobject values
94             var child_0 = new Xcls_Box3( _this );
95             child_0.ref();
96             this.el.pack_start (  child_0.el , false,false,0 );
97             var child_1 = new Xcls_ScrolledWindow9( _this );
98             child_1.ref();
99             this.el.add (  child_1.el  );
100             var child_2 = new Xcls_ok_button( _this );
101             child_2.ref();
102             this.el.add (  child_2.el  );
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.expand = true;
435             this.el.shadow_type = Gtk.ShadowType.IN;
436             var child_0 = new Xcls_reposView( _this );
437             child_0.ref();
438             this.el.add (  child_0.el  );
439
440             // init method
441
442             {
443               
444                this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
445             }
446         }
447
448         // user defined functions
449     }
450     public class Xcls_reposView : Object
451     {
452         public Gtk.TreeView el;
453         private Clones  _this;
454
455
456             // my vars (def)
457
458         // ctor
459         public Xcls_reposView(Clones _owner )
460         {
461             _this = _owner;
462             _this.reposView = this;
463             this.el = new Gtk.TreeView();
464
465             // my vars (dec)
466
467             // set gobject values
468             var child_0 = new Xcls_reposStore( _this );
469             child_0.ref();
470             this.el.set_model (  child_0.el  );
471             var child_1 = new Xcls_tv_autocommit( _this );
472             child_1.ref();
473             this.el.append_column (  child_1.el  );
474             var child_2 = new Xcls_tv_autopush( _this );
475             child_2.ref();
476             this.el.append_column (  child_2.el  );
477             var child_3 = new Xcls_tv_repo( _this );
478             child_3.ref();
479             this.el.append_column (  child_3.el  );
480             var child_4 = new Xcls_tv_current_branch( _this );
481             child_4.ref();
482             this.el.append_column (  child_4.el  );
483             var child_5 = new Xcls_tv_last_updated( _this );
484             child_5.ref();
485             this.el.append_column (  child_5.el  );
486             var child_6 = new Xcls_tv_all_branches( _this );
487             child_6.ref();
488             this.el.append_column (  child_6.el  );
489
490             // init method
491
492             {
493                 var selection = this.el.get_selection();
494                 selection.set_mode( Gtk.SelectionMode.SINGLE);
495             
496             
497                 var description = new Pango.FontDescription();
498                 description.set_size(10000);
499                 this.el.override_font(description);
500             }
501
502             //listeners
503             this.el.cursor_changed.connect( ()  => {
504               // SEE SELECTION.CHANGED
505               /*
506               
507               return;
508               
509                 if (this.el.get_selection().count_selected_rows() < 1) {
510                     //nothing? - clea it?
511                     return;
512                 }
513                     var ret = {};         
514                 var model = this.get('/changedFilesStore');
515             
516                  var s = this.el.get_selection();
517                  var files = [];
518                 s.selected_foreach(function(model,p,iter) {
519                 
520                    files.push( model.get_value(iter, 0).value.get_string());
521                  
522                 });
523                 this.get('/patchview').showDiff(files); 
524                 //var value = ''+ ret.model.get_value(ret.iter, 1).value.get_string();
525                  //print("OUT?" + value);// id..
526                 // load the list in the right grid..
527                  
528                 return true;
529             */
530             });
531         }
532
533         // user defined functions
534     }
535     public class Xcls_reposStore : Object
536     {
537         public Gtk.ListStore el;
538         private Clones  _this;
539
540
541             // my vars (def)
542
543         // ctor
544         public Xcls_reposStore(Clones _owner )
545         {
546             _this = _owner;
547             _this.reposStore = this;
548             this.el = new Gtk.ListStore( 0,      typeof(string),  // 0 repo
549      typeof(string),  // 1 current branch
550      typeof(string),  // 2 all branch
551      typeof(string),  // 3 updated
552      typeof(bool),   // 4 auto commit
553      typeof(bool),   // 5 auto push
554      typeof(string),   // 7 repopath
555       typeof(string)   // 8 color highlighting?
556        );
557
558             // my vars (dec)
559
560             // set gobject values
561         }
562
563         // user defined functions
564     }
565
566     public class Xcls_tv_autocommit : Object
567     {
568         public Gtk.TreeViewColumn el;
569         private Clones  _this;
570
571
572             // my vars (def)
573
574         // ctor
575         public Xcls_tv_autocommit(Clones _owner )
576         {
577             _this = _owner;
578             _this.tv_autocommit = this;
579             this.el = new Gtk.TreeViewColumn();
580
581             // my vars (dec)
582
583             // set gobject values
584             this.el.title = "Auto Commit";
585             this.el.min_width = 50;
586             var child_0 = new Xcls_cr_autocommit( _this );
587             child_0.ref();
588             this.el.pack_start (  child_0.el , false );
589
590             // init method
591
592             //    this.items[0].el.set_activatable(true);
593              this.el.add_attribute(_this.cr_autocommit.el , "active", 4 );
594         }
595
596         // user defined functions
597     }
598     public class Xcls_cr_autocommit : Object
599     {
600         public Gtk.CellRendererToggle el;
601         private Clones  _this;
602
603
604             // my vars (def)
605
606         // ctor
607         public Xcls_cr_autocommit(Clones _owner )
608         {
609             _this = _owner;
610             _this.cr_autocommit = this;
611             this.el = new Gtk.CellRendererToggle();
612
613             // my vars (dec)
614
615             // set gobject values
616             this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
617
618             //listeners
619             this.el.toggled.connect( (self, path)  => {
620             /*    var ret ={} ;
621                 var store = this.get('/reposStore');
622                 store.el.get_iter_from_string(ret, path);
623                                                                              
624                 var value =   store.el.get_value(ret.iter,4).value.get_boolean();
625                                                                              
626                 //print(JSON.stringify(value));
627                 store.el.set_value(ret.iter,4, !value);
628                 
629                  var path =  store.el.get_value(ret.iter, 6).value.get_string();
630                  var repo = imports.Scm.Repo.Repo.get(path);
631                  repo.autocommit(!value);
632               */   
633                 
634                 
635             });
636         }
637
638         // user defined functions
639     }
640
641
642     public class Xcls_tv_autopush : Object
643     {
644         public Gtk.TreeViewColumn el;
645         private Clones  _this;
646
647
648             // my vars (def)
649
650         // ctor
651         public Xcls_tv_autopush(Clones _owner )
652         {
653             _this = _owner;
654             _this.tv_autopush = this;
655             this.el = new Gtk.TreeViewColumn();
656
657             // my vars (dec)
658
659             // set gobject values
660             this.el.title = "Auto Push";
661             this.el.min_width = 50;
662             var child_0 = new Xcls_cr_autopush( _this );
663             child_0.ref();
664             this.el.pack_start (  child_0.el , false );
665
666             // init method
667
668             this.el.add_attribute(_this.cr_autopush.el , "active", 5 );
669             //      this.items[0].el.set_activatable(true);
670         }
671
672         // user defined functions
673     }
674     public class Xcls_cr_autopush : Object
675     {
676         public Gtk.CellRendererToggle el;
677         private Clones  _this;
678
679
680             // my vars (def)
681
682         // ctor
683         public Xcls_cr_autopush(Clones _owner )
684         {
685             _this = _owner;
686             _this.cr_autopush = this;
687             this.el = new Gtk.CellRendererToggle();
688
689             // my vars (dec)
690
691             // set gobject values
692             this.el.mode = Gtk.CellRendererMode.ACTIVATABLE;
693
694             //listeners
695             this.el.toggled.connect( (self, path)  => {
696             /*    var ret ={} ;
697                 var store = this.get('/reposStore');
698                 store.el.get_iter_from_string(ret, path);
699                                                                              
700                 var value =   store.el.get_value(ret.iter,5).value.get_boolean();
701                                                                              
702                 //print(JSON.stringify(value));
703                 store.el.set_value(ret.iter,5, !value);
704                   var path =  store.el.get_value(ret.iter, 6).value.get_string();
705                  var repo = imports.Scm.Repo.Repo.get(path);
706                  repo.autopush(!value);
707                 */
708             });
709         }
710
711         // user defined functions
712     }
713
714
715     public class Xcls_tv_repo : Object
716     {
717         public Gtk.TreeViewColumn el;
718         private Clones  _this;
719
720
721             // my vars (def)
722
723         // ctor
724         public Xcls_tv_repo(Clones _owner )
725         {
726             _this = _owner;
727             _this.tv_repo = this;
728             this.el = new Gtk.TreeViewColumn();
729
730             // my vars (dec)
731
732             // set gobject values
733             this.el.title = "Repo";
734             this.el.min_width = 200;
735             this.el.resizable = true;
736             var child_0 = new Xcls_cr_repo( _this );
737             child_0.ref();
738             this.el.pack_start (  child_0.el , false );
739
740             // init method
741
742             this.el.add_attribute(_this.cr_repo.el , "markup", 0 );
743         }
744
745         // user defined functions
746     }
747     public class Xcls_cr_repo : Object
748     {
749         public Gtk.CellRendererText el;
750         private Clones  _this;
751
752
753             // my vars (def)
754
755         // ctor
756         public Xcls_cr_repo(Clones _owner )
757         {
758             _this = _owner;
759             _this.cr_repo = this;
760             this.el = new Gtk.CellRendererText();
761
762             // my vars (dec)
763
764             // set gobject values
765         }
766
767         // user defined functions
768     }
769
770
771     public class Xcls_tv_current_branch : Object
772     {
773         public Gtk.TreeViewColumn el;
774         private Clones  _this;
775
776
777             // my vars (def)
778
779         // ctor
780         public Xcls_tv_current_branch(Clones _owner )
781         {
782             _this = _owner;
783             _this.tv_current_branch = this;
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_cr_current_branch( _this );
792             child_0.ref();
793             this.el.pack_start (  child_0.el , false );
794
795             // init method
796
797             this.el.add_attribute(_this.cr_current_branch.el , "markup", 1 );
798                  this.el.add_attribute(_this.cr_current_branch.el, "cell-background", 7 );
799         }
800
801         // user defined functions
802     }
803     public class Xcls_cr_current_branch : Object
804     {
805         public Gtk.CellRendererText el;
806         private Clones  _this;
807
808
809             // my vars (def)
810
811         // ctor
812         public Xcls_cr_current_branch(Clones _owner )
813         {
814             _this = _owner;
815             _this.cr_current_branch = this;
816             this.el = new Gtk.CellRendererText();
817
818             // my vars (dec)
819
820             // set gobject values
821         }
822
823         // user defined functions
824     }
825
826
827     public class Xcls_tv_last_updated : Object
828     {
829         public Gtk.TreeViewColumn el;
830         private Clones  _this;
831
832
833             // my vars (def)
834
835         // ctor
836         public Xcls_tv_last_updated(Clones _owner )
837         {
838             _this = _owner;
839             _this.tv_last_updated = this;
840             this.el = new Gtk.TreeViewColumn();
841
842             // my vars (dec)
843
844             // set gobject values
845             this.el.title = "Last updated";
846             this.el.min_width = 50;
847             var child_0 = new Xcls_cr_last_updated( _this );
848             child_0.ref();
849             this.el.pack_start (  child_0.el , false );
850
851             // init method
852
853             this.el.add_attribute(_this.cr_last_updated.el , "markup", 3 );
854         }
855
856         // user defined functions
857     }
858     public class Xcls_cr_last_updated : Object
859     {
860         public Gtk.CellRendererText el;
861         private Clones  _this;
862
863
864             // my vars (def)
865
866         // ctor
867         public Xcls_cr_last_updated(Clones _owner )
868         {
869             _this = _owner;
870             _this.cr_last_updated = this;
871             this.el = new Gtk.CellRendererText();
872
873             // my vars (dec)
874
875             // set gobject values
876         }
877
878         // user defined functions
879     }
880
881
882     public class Xcls_tv_all_branches : Object
883     {
884         public Gtk.TreeViewColumn el;
885         private Clones  _this;
886
887
888             // my vars (def)
889
890         // ctor
891         public Xcls_tv_all_branches(Clones _owner )
892         {
893             _this = _owner;
894             _this.tv_all_branches = this;
895             this.el = new Gtk.TreeViewColumn();
896
897             // my vars (dec)
898
899             // set gobject values
900             this.el.title = "All Branches";
901             this.el.min_width = 50;
902             this.el.resizable = false;
903             var child_0 = new Xcls_cr_all_branches( _this );
904             child_0.ref();
905             this.el.pack_start (  child_0.el , false );
906
907             // init method
908
909             this.el.add_attribute(_this.cr_all_branches.el , "markup", 2 );
910         }
911
912         // user defined functions
913     }
914     public class Xcls_cr_all_branches : Object
915     {
916         public Gtk.CellRendererText el;
917         private Clones  _this;
918
919
920             // my vars (def)
921
922         // ctor
923         public Xcls_cr_all_branches(Clones _owner )
924         {
925             _this = _owner;
926             _this.cr_all_branches = this;
927             this.el = new Gtk.CellRendererText();
928
929             // my vars (dec)
930
931             // set gobject values
932         }
933
934         // user defined functions
935     }
936
937
938
939
940     public class Xcls_ok_button : Object
941     {
942         public Gtk.Button el;
943         private Clones  _this;
944
945
946             // my vars (def)
947
948         // ctor
949         public Xcls_ok_button(Clones _owner )
950         {
951             _this = _owner;
952             _this.ok_button = this;
953             this.el = new Gtk.Button();
954
955             // my vars (dec)
956
957             // set gobject values
958             this.el.label = "Close";
959         }
960
961         // user defined functions
962     }
963
964
965 }