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