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