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