4114dd60e649f1e54c3dfef404bafee5a4146ab9
[gitlive] / NewBranch.vala
1 static NewBranch  _NewBranch;
2
3 public class NewBranch : Object
4 {
5     public Gtk.Dialog el;
6     private NewBranch  _this;
7
8     public static NewBranch singleton()
9     {
10         if (_NewBranch == null) {
11             _NewBranch= new NewBranch();
12         }
13         return _NewBranch;
14     }
15     public Xcls_label_select_ticket label_select_ticket;
16     public Xcls_label_create_ticket label_create_ticket;
17     public Xcls_label_quick_commit label_quick_commit;
18     public Xcls_projectsel projectsel;
19     public Xcls_prcellrenderer prcellrenderer;
20     public Xcls_prmodel prmodel;
21     public Xcls_ticketsel ticketsel;
22     public Xcls_dbcellrenderer dbcellrenderer;
23     public Xcls_dbmodel dbmodel;
24     public Xcls_name name;
25     public Xcls_createbtn createbtn;
26     public Xcls_btn_not_me btn_not_me;
27     public Xcls_btn_closed btn_closed;
28     public Xcls_scrolled_window scrolled_window;
29     public Xcls_view view;
30
31         // my vars (def)
32     public GitRepo? repo;
33     public bool running;
34     public Gee.ArrayList<GitMonitorQueue> queue;
35
36     // ctor
37     public NewBranch()
38     {
39         _this = this;
40         this.el = new Gtk.Dialog();
41
42         // my vars (dec)
43         this.repo = null;
44         this.running = false;
45         this.queue = null;
46
47         // set gobject values
48         this.el.title = "Create a working branch ";
49         this.el.default_height = 500;
50         this.el.default_width = 500;
51         this.el.deletable = true;
52         this.el.modal = true;
53         var child_0 = new Xcls_Notebook2( _this );
54         child_0.ref();
55         this.el.get_content_area().add (  child_0.el  );
56
57         //listeners
58         this.el.delete_event.connect( (self, event) => {
59             this.el.hide();
60             return true; 
61             //test  
62         });
63         this.el.response.connect( (self, response_id) =>  { 
64           
65                 GLib.debug("got %d", (int) response_id);
66                 
67                  
68                 
69                  
70                 // have they selected a ticket..
71                 // make that the current active ticket?
72                 // we really need to store locally what ticket is being worked on..
73                 // in theory we could be working on multiple project and not merging..
74                 // -- each repo would have their active ticket (only one per repo)
75                 // -- so we could just store that in there
76                 // -- initial load can check the contents of the ticket files on first scan.
77         
78                  
79                 if (response_id < 1) {
80                     _this.el.hide();    
81                     this.running = false; 
82                         return;
83                 }
84                 
85                 var ticket_id = _this.ticketsel.selectedTicketId();
86                 
87             if (this.repo != null) {
88                 var bn = _this.name.el.get_text();
89         
90                         var res = this.repo.setActiveTicket(                    
91                                  RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
92                          );
93                          if (res) {
94                                 // start the monitoring..
95                                  GitMonitor.gitmonitor.start();
96                                  
97                          }
98             }
99              
100         
101             this.running = false; 
102         
103                 this.el.hide();
104                  
105                  
106         
107                  
108         });
109     }
110
111     // user defined functions
112     public   void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" ) 
113     {
114          // this.el.set_gravity(Gdk.Gravity.NORTH);
115         if (this.running) { // should not happen!!
116                 GLib.error("new branch show called, when already being displayed?");
117         }
118         this.queue = queue;
119         
120         this.running  = true;
121         GitMonitor.gitmonitor.stop();
122         
123         this.repo = repo;
124         
125          
126         
127         this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
128         this.el.set_default_size( 500,200); // not sure why it grows..
129         GLib.debug("Loading tickets"); 
130          
131     
132         this.el.show_all();
133         this.el.set_keep_above(true);
134        
135         
136         var curproj = RooProject.getProjectByRepo(this.repo);
137          _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
138         
139         _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
140         _this.createbtn.updateState();
141         
142         _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
143         if (tid != "") { 
144                 var name = RooTicket.singleton().usernameLocal();
145                 var ticket = RooTicket.singleton().getById(tid);
146                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
147         } else {
148                 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
149         }
150         _this.view.loadTicket(tid);
151         this.el.run();
152     
153     }
154     public class Xcls_Notebook2 : Object
155     {
156         public Gtk.Notebook el;
157         private NewBranch  _this;
158
159
160             // my vars (def)
161
162         // ctor
163         public Xcls_Notebook2(NewBranch _owner )
164         {
165             _this = _owner;
166             this.el = new Gtk.Notebook();
167
168             // my vars (dec)
169
170             // set gobject values
171             this.el.vexpand = true;
172             var child_0 = new Xcls_label_select_ticket( _this );
173             child_0.ref();
174             var child_1 = new Xcls_label_create_ticket( _this );
175             child_1.ref();
176             var child_2 = new Xcls_label_quick_commit( _this );
177             child_2.ref();
178             var child_3 = new Xcls_Box6( _this );
179             child_3.ref();
180             this.el.append_page (  child_3.el , _this.label_select_ticket.el );
181             var child_4 = new Xcls_Box26( _this );
182             child_4.ref();
183             this.el.append_page (  child_4.el , _this.label_create_ticket.el );
184             var child_5 = new Xcls_Box27( _this );
185             child_5.ref();
186             this.el.append_page (  child_5.el , _this.label_quick_commit.el );
187         }
188
189         // user defined functions
190     }
191     public class Xcls_label_select_ticket : Object
192     {
193         public Gtk.Label el;
194         private NewBranch  _this;
195
196
197             // my vars (def)
198
199         // ctor
200         public Xcls_label_select_ticket(NewBranch _owner )
201         {
202             _this = _owner;
203             _this.label_select_ticket = this;
204             this.el = new Gtk.Label( "Select Existing Ticket to work on" );
205
206             // my vars (dec)
207
208             // set gobject values
209         }
210
211         // user defined functions
212     }
213
214     public class Xcls_label_create_ticket : Object
215     {
216         public Gtk.Label el;
217         private NewBranch  _this;
218
219
220             // my vars (def)
221
222         // ctor
223         public Xcls_label_create_ticket(NewBranch _owner )
224         {
225             _this = _owner;
226             _this.label_create_ticket = this;
227             this.el = new Gtk.Label( "Create a New Ticket" );
228
229             // my vars (dec)
230
231             // set gobject values
232         }
233
234         // user defined functions
235     }
236
237     public class Xcls_label_quick_commit : Object
238     {
239         public Gtk.Label el;
240         private NewBranch  _this;
241
242
243             // my vars (def)
244
245         // ctor
246         public Xcls_label_quick_commit(NewBranch _owner )
247         {
248             _this = _owner;
249             _this.label_quick_commit = this;
250             this.el = new Gtk.Label( "Quick Commit" );
251
252             // my vars (dec)
253
254             // set gobject values
255         }
256
257         // user defined functions
258     }
259
260     public class Xcls_Box6 : Object
261     {
262         public Gtk.Box el;
263         private NewBranch  _this;
264
265
266             // my vars (def)
267
268         // ctor
269         public Xcls_Box6(NewBranch _owner )
270         {
271             _this = _owner;
272             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
273
274             // my vars (dec)
275
276             // set gobject values
277             this.el.homogeneous = false;
278             var child_0 = new Xcls_Table7( _this );
279             child_0.ref();
280             this.el.pack_start (  child_0.el , false,false,0 );
281             var child_1 = new Xcls_scrolled_window( _this );
282             child_1.ref();
283             this.el.add (  child_1.el  );
284         }
285
286         // user defined functions
287     }
288     public class Xcls_Table7 : Object
289     {
290         public Gtk.Table el;
291         private NewBranch  _this;
292
293
294             // my vars (def)
295
296         // ctor
297         public Xcls_Table7(NewBranch _owner )
298         {
299             _this = _owner;
300             this.el = new Gtk.Table( 5, 5, true );
301
302             // my vars (dec)
303
304             // set gobject values
305             this.el.expand = false;
306             this.el.margin = 2;
307             this.el.column_spacing = 4;
308             this.el.vexpand = false;
309             var child_0 = new Xcls_Label8( _this );
310             child_0.ref();
311             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
312             var child_1 = new Xcls_Label9( _this );
313             child_1.ref();
314             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
315             var child_2 = new Xcls_projectsel( _this );
316             child_2.ref();
317             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
318             var child_3 = new Xcls_ticketsel( _this );
319             child_3.ref();
320             this.el.attach_defaults (  child_3.el , 1,4,1,2 );
321             var child_4 = new Xcls_Button16( _this );
322             child_4.ref();
323             this.el.attach_defaults (  child_4.el , 4,5,1,2 );
324             var child_5 = new Xcls_Label17( _this );
325             child_5.ref();
326             this.el.attach_defaults (  child_5.el , 0,1,3,4 );
327             var child_6 = new Xcls_name( _this );
328             child_6.ref();
329             this.el.attach_defaults (  child_6.el , 0,4,4,5 );
330             var child_7 = new Xcls_createbtn( _this );
331             child_7.ref();
332             this.el.attach_defaults (  child_7.el , 4,5,4,5 );
333             var child_8 = new Xcls_Box20( _this );
334             child_8.ref();
335             this.el.attach_defaults (  child_8.el , 0,5,2,3 );
336         }
337
338         // user defined functions
339     }
340     public class Xcls_Label8 : Object
341     {
342         public Gtk.Label el;
343         private NewBranch  _this;
344
345
346             // my vars (def)
347
348         // ctor
349         public Xcls_Label8(NewBranch _owner )
350         {
351             _this = _owner;
352             this.el = new Gtk.Label( "Project" );
353
354             // my vars (dec)
355
356             // set gobject values
357             this.el.halign = Gtk.Align.START;
358             this.el.justify = Gtk.Justification.RIGHT;
359             this.el.visible = true;
360         }
361
362         // user defined functions
363     }
364
365     public class Xcls_Label9 : Object
366     {
367         public Gtk.Label el;
368         private NewBranch  _this;
369
370
371             // my vars (def)
372
373         // ctor
374         public Xcls_Label9(NewBranch _owner )
375         {
376             _this = _owner;
377             this.el = new Gtk.Label( "Ticket" );
378
379             // my vars (dec)
380
381             // set gobject values
382             this.el.halign = Gtk.Align.START;
383             this.el.visible = true;
384         }
385
386         // user defined functions
387     }
388
389     public class Xcls_projectsel : Object
390     {
391         public Gtk.ComboBox el;
392         private NewBranch  _this;
393
394
395             // my vars (def)
396         public bool loading;
397
398         // ctor
399         public Xcls_projectsel(NewBranch _owner )
400         {
401             _this = _owner;
402             _this.projectsel = this;
403             this.el = new Gtk.ComboBox.with_entry();
404
405             // my vars (dec)
406             this.loading = false;
407
408             // set gobject values
409             var child_0 = new Xcls_prcellrenderer( _this );
410             child_0.ref();
411             this.el.pack_start (  child_0.el , true );
412             var child_1 = new Xcls_prmodel( _this );
413             child_1.ref();
414             this.el.set_model (  child_1.el  );
415
416             // init method
417
418             this.el.set_entry_text_column(1);
419
420             //listeners
421             this.el.changed.connect( () => {
422                 if (this.loading) {
423                         return;
424                 }
425                 var project_id = this.selectedProjectId();
426                 _this.dbmodel.loadTickets(project_id);
427                 
428                 
429                 /*if (this.loading) {
430                         return;
431                 }
432                 var ticket_id = this.selectedTicketId();
433                 
434                 var name = RooTicket.singleton().usernameLocal();
435                 
436                 if (ticket_id == "" || ticket_id == null) {
437                 
438                         var dt = new  DateTime.now_local();
439                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
440                         return;
441                 }
442                 
443                 
444                 var ticket = RooTicket.singleton().getById(ticket_id);
445                
446                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
447                 
448                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
449                 */
450             });
451         }
452
453         // user defined functions
454         public string selectedProjectId () {
455                 Gtk.TreeIter iter;
456                 Value val1;
457          
458          
459                 this.el.get_active_iter (out iter);
460                 _this.prmodel.el.get_value (iter, 0, out val1);
461          
462         
463                 return  (string) val1;
464                 
465                 
466                 
467                 
468         }
469     }
470     public class Xcls_prcellrenderer : Object
471     {
472         public Gtk.CellRendererText el;
473         private NewBranch  _this;
474
475
476             // my vars (def)
477
478         // ctor
479         public Xcls_prcellrenderer(NewBranch _owner )
480         {
481             _this = _owner;
482             _this.prcellrenderer = this;
483             this.el = new Gtk.CellRendererText();
484
485             // my vars (dec)
486
487             // set gobject values
488         }
489
490         // user defined functions
491     }
492
493     public class Xcls_prmodel : Object
494     {
495         public Gtk.ListStore el;
496         private NewBranch  _this;
497
498
499             // my vars (def)
500
501         // ctor
502         public Xcls_prmodel(NewBranch _owner )
503         {
504             _this = _owner;
505             _this.prmodel = this;
506             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
507
508             // my vars (dec)
509
510             // set gobject values
511         }
512
513         // user defined functions
514         public void loadProjects (string id) {
515         
516         
517             
518             _this.projectsel.loading = true;
519         
520             this.el.clear();                                    
521             Gtk.TreeIter iter;
522             var el = this.el;
523             
524             el.append(out iter);
525         
526             
527             el.set_value(iter, 0, "");
528             el.set_value(iter, 1, "-- select a project --");
529             if (id == "") {
530                     _this.projectsel.el.set_active_iter(iter);
531             }
532           
533             foreach(var project in RooProject.projects()) {
534             
535                 el.append(out iter);
536                 
537                 el.set_value(iter, 0, project.id);
538                 el.set_value(iter, 1,  project.name );
539                 if (id == project.id) {
540                            _this.projectsel.el.set_active_iter(iter);
541                     }   
542                 
543             }
544             
545             _this.projectsel.loading = false;
546              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
547                                              
548         }
549     }
550
551
552     public class Xcls_ticketsel : Object
553     {
554         public Gtk.ComboBox el;
555         private NewBranch  _this;
556
557
558             // my vars (def)
559         public bool loading;
560
561         // ctor
562         public Xcls_ticketsel(NewBranch _owner )
563         {
564             _this = _owner;
565             _this.ticketsel = this;
566             this.el = new Gtk.ComboBox.with_entry();
567
568             // my vars (dec)
569             this.loading = false;
570
571             // set gobject values
572             var child_0 = new Xcls_dbcellrenderer( _this );
573             child_0.ref();
574             this.el.pack_start (  child_0.el , true );
575             var child_1 = new Xcls_dbmodel( _this );
576             child_1.ref();
577             this.el.set_model (  child_1.el  );
578
579             // init method
580
581             //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
582             this.el.set_entry_text_column(1);
583             this.el.get_child().set_sensitive(false);
584
585             //listeners
586             this.el.changed.connect( () => {
587                 if (this.loading) {
588                         return;
589                 }
590                 var ticket_id = this.selectedTicketId();
591                 
592                 var name = RooTicket.singleton().usernameLocal();
593                 
594                 this.el.get_child().get_style_context().remove_class("warning");
595                 if (ticket_id == "" || ticket_id == null) {
596                 
597                         var dt = new  DateTime.now_local();
598                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
599                         _this.view.loadTicket("");              
600                         
601                         this.el.get_child().get_style_context().add_class("warning");
602                         _this.createbtn.updateState();
603                         return;
604                 }
605                 
606                 
607                 var ticket = RooTicket.singleton().getById(ticket_id);
608                
609                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
610                 _this.scrolled_window.el.show();
611                  
612                 _this.view.loadTicket(ticket.id);
613                 _this.createbtn.updateState();
614                 
615                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
616             });
617         }
618
619         // user defined functions
620         public string selectedTicketId () {
621         Gtk.TreeIter iter;
622                 Value val1;
623          
624          
625                 this.el.get_active_iter (out iter);
626                 _this.dbmodel.el.get_value (iter, 0, out val1);
627          
628         
629                 return  (string) val1;
630                 
631                 
632                 
633                 
634         }
635     }
636     public class Xcls_dbcellrenderer : Object
637     {
638         public Gtk.CellRendererText el;
639         private NewBranch  _this;
640
641
642             // my vars (def)
643
644         // ctor
645         public Xcls_dbcellrenderer(NewBranch _owner )
646         {
647             _this = _owner;
648             _this.dbcellrenderer = this;
649             this.el = new Gtk.CellRendererText();
650
651             // my vars (dec)
652
653             // set gobject values
654         }
655
656         // user defined functions
657     }
658
659     public class Xcls_dbmodel : Object
660     {
661         public Gtk.ListStore el;
662         private NewBranch  _this;
663
664
665             // my vars (def)
666
667         // ctor
668         public Xcls_dbmodel(NewBranch _owner )
669         {
670             _this = _owner;
671             _this.dbmodel = this;
672             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
673
674             // my vars (dec)
675
676             // set gobject values
677         }
678
679         // user defined functions
680         public void loadTickets (string project_id , string tid = "") {
681         
682         
683             
684             // fixme .. get project id from selection..
685             
686              RooTicket.singleton().loadTickets(
687                                 project_id,
688                                 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY :  RooTicket.Who.ME,
689                                  _this.btn_closed.el.active ? RooTicket.Status.ALL :  RooTicket.Status.ACTIVE
690                          );
691                 
692             _this.ticketsel.loading = true;
693         
694             this.el.clear();                                    
695             Gtk.TreeIter iter;
696             var el = this.el;
697             
698             el.append(out iter);
699         
700             
701             el.set_value(iter, 0, "");
702             el.set_value(iter, 1, "-- select a ticket --");
703             
704             _this.ticketsel.el.set_active_iter(iter);
705             var tickets = RooTicket.singleton().tickets;
706             foreach(var ticket in tickets) {
707             
708                 el.append(out iter);
709                 
710                 el.set_value(iter, 0, ticket.id);
711                 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
712                 
713                 if (ticket.id == tid) {
714                             _this.ticketsel.el.set_active_iter(iter);
715                 }
716                 
717             }
718             
719             _this.ticketsel.loading = false;
720              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
721                                              
722         }
723     }
724
725
726     public class Xcls_Button16 : Object
727     {
728         public Gtk.Button el;
729         private NewBranch  _this;
730
731
732             // my vars (def)
733
734         // ctor
735         public Xcls_Button16(NewBranch _owner )
736         {
737             _this = _owner;
738             this.el = new Gtk.Button();
739
740             // my vars (dec)
741
742             // set gobject values
743             this.el.expand = false;
744             this.el.label = "New Ticket";
745
746             //listeners
747             this.el.clicked.connect( () => {
748                 _this.el.response(-1);
749                 Ticket.singleton().show(_this.repo);
750             
751             });
752         }
753
754         // user defined functions
755     }
756
757     public class Xcls_Label17 : Object
758     {
759         public Gtk.Label el;
760         private NewBranch  _this;
761
762
763             // my vars (def)
764
765         // ctor
766         public Xcls_Label17(NewBranch _owner )
767         {
768             _this = _owner;
769             this.el = new Gtk.Label( "Use this as branch name" );
770
771             // my vars (dec)
772
773             // set gobject values
774             this.el.halign = Gtk.Align.START;
775             this.el.justify = Gtk.Justification.RIGHT;
776             this.el.xalign = 0.900000f;
777         }
778
779         // user defined functions
780     }
781
782     public class Xcls_name : Object
783     {
784         public Gtk.Entry el;
785         private NewBranch  _this;
786
787
788             // my vars (def)
789
790         // ctor
791         public Xcls_name(NewBranch _owner )
792         {
793             _this = _owner;
794             _this.name = this;
795             this.el = new Gtk.Entry();
796
797             // my vars (dec)
798
799             // set gobject values
800             this.el.visible = true;
801         }
802
803         // user defined functions
804     }
805
806     public class Xcls_createbtn : Object
807     {
808         public Gtk.Button el;
809         private NewBranch  _this;
810
811
812             // my vars (def)
813
814         // ctor
815         public Xcls_createbtn(NewBranch _owner )
816         {
817             _this = _owner;
818             _this.createbtn = this;
819             this.el = new Gtk.Button();
820
821             // my vars (dec)
822
823             // set gobject values
824             this.el.label = "Create Branch";
825
826             // init method
827
828             {
829                this.el.get_style_context().add_class("suggested-action");
830             }
831
832             //listeners
833             this.el.clicked.connect( () => {
834             
835                 GLib.debug("fire response = 1");
836                 
837                 var ticket_id = _this.ticketsel.selectedTicketId();
838                 
839                 if (ticket_id == "") {
840                         _this.ticketsel.el.get_child().get_style_context().add_class("warning");
841                         return;
842                 }
843                  
844                 _this.el.response(1);
845             });
846         }
847
848         // user defined functions
849         public void updateState () {
850         
851                 var ticket_id = _this.ticketsel.selectedTicketId();
852                 
853                 if (ticket_id == "") {
854                         this.el.set_sensitive(false);
855                         return;
856                 }
857          
858                 this.el.set_sensitive(true);
859          
860         }
861     }
862
863     public class Xcls_Box20 : Object
864     {
865         public Gtk.Box el;
866         private NewBranch  _this;
867
868
869             // my vars (def)
870
871         // ctor
872         public Xcls_Box20(NewBranch _owner )
873         {
874             _this = _owner;
875             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
876
877             // my vars (dec)
878
879             // set gobject values
880             var child_0 = new Xcls_btn_not_me( _this );
881             child_0.ref();
882             this.el.add (  child_0.el  );
883             var child_1 = new Xcls_btn_closed( _this );
884             child_1.ref();
885             this.el.add (  child_1.el  );
886             var child_2 = new Xcls_Label23( _this );
887             child_2.ref();
888             this.el.add (  child_2.el  );
889         }
890
891         // user defined functions
892     }
893     public class Xcls_btn_not_me : Object
894     {
895         public Gtk.CheckButton el;
896         private NewBranch  _this;
897
898
899             // my vars (def)
900
901         // ctor
902         public Xcls_btn_not_me(NewBranch _owner )
903         {
904             _this = _owner;
905             _this.btn_not_me = this;
906             this.el = new Gtk.CheckButton();
907
908             // my vars (dec)
909
910             // set gobject values
911             this.el.label = "Show tickets not assigned to me";
912
913             //listeners
914             this.el.toggled.connect( () => {
915                 var project_id = _this.projectsel.selectedProjectId();
916                 _this.dbmodel.loadTickets(project_id);  
917             });
918         }
919
920         // user defined functions
921     }
922
923     public class Xcls_btn_closed : Object
924     {
925         public Gtk.CheckButton el;
926         private NewBranch  _this;
927
928
929             // my vars (def)
930
931         // ctor
932         public Xcls_btn_closed(NewBranch _owner )
933         {
934             _this = _owner;
935             _this.btn_closed = this;
936             this.el = new Gtk.CheckButton();
937
938             // my vars (dec)
939
940             // set gobject values
941             this.el.label = "Show closed Tickets";
942
943             //listeners
944             this.el.toggled.connect( () => {
945                 var project_id = _this.projectsel.selectedProjectId();
946                 _this.dbmodel.loadTickets(project_id);  
947                  
948             });
949         }
950
951         // user defined functions
952     }
953
954     public class Xcls_Label23 : Object
955     {
956         public Gtk.Label el;
957         private NewBranch  _this;
958
959
960             // my vars (def)
961
962         // ctor
963         public Xcls_Label23(NewBranch _owner )
964         {
965             _this = _owner;
966             this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
967
968             // my vars (dec)
969
970             // set gobject values
971             this.el.halign = Gtk.Align.END;
972             this.el.hexpand = true;
973             this.el.use_markup = true;
974
975             //listeners
976             this.el.activate_link.connect( (uri) => {
977                 if (uri == "refresh") {
978                         RooProject.reload();
979                         var curproj = RooProject.getProjectByRepo(_this.repo);
980                          _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
981             
982                         _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);            
983                 }
984                 return true;
985             });
986         }
987
988         // user defined functions
989     }
990
991
992
993     public class Xcls_scrolled_window : Object
994     {
995         public Gtk.ScrolledWindow el;
996         private NewBranch  _this;
997
998
999             // my vars (def)
1000
1001         // ctor
1002         public Xcls_scrolled_window(NewBranch _owner )
1003         {
1004             _this = _owner;
1005             _this.scrolled_window = this;
1006             this.el = new Gtk.ScrolledWindow( null, null );
1007
1008             // my vars (dec)
1009
1010             // set gobject values
1011             this.el.height_request = 500;
1012             this.el.vexpand = true;
1013             var child_0 = new Xcls_view( _this );
1014             child_0.ref();
1015             this.el.add (  child_0.el  );
1016
1017             // init method
1018
1019             {
1020                 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1021             }
1022         }
1023
1024         // user defined functions
1025     }
1026     public class Xcls_view : Object
1027     {
1028         public WebKit.WebView el;
1029         private NewBranch  _this;
1030
1031
1032             // my vars (def)
1033
1034         // ctor
1035         public Xcls_view(NewBranch _owner )
1036         {
1037             _this = _owner;
1038             _this.view = this;
1039             this.el = new WebKit.WebView();
1040
1041             // my vars (dec)
1042
1043             // set gobject values
1044         }
1045
1046         // user defined functions
1047         public void loadTicket (string tid) {
1048                 int h,w;
1049                 _this.el.get_size(out w, out h);
1050                 
1051                 if (tid == "") {
1052                         _this.scrolled_window.el.hide();
1053                         _this.el.resize(w, 150);
1054                 } else {
1055                         _this.scrolled_window.el.show();
1056                         _this.el.resize(w, 800);
1057                 }
1058                 
1059                 var rs =  RooTicket.singleton();                
1060                 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1061                 var hd = uri.get_http_headers();
1062                 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1063                 hd.append("Authorization", "Basic %s".printf(authCode));
1064                 
1065                  this.el.load_request(uri);
1066         }
1067     }
1068
1069
1070
1071     public class Xcls_Box26 : Object
1072     {
1073         public Gtk.Box el;
1074         private NewBranch  _this;
1075
1076
1077             // my vars (def)
1078
1079         // ctor
1080         public Xcls_Box26(NewBranch _owner )
1081         {
1082             _this = _owner;
1083             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1084
1085             // my vars (dec)
1086
1087             // set gobject values
1088             this.el.homogeneous = false;
1089         }
1090
1091         // user defined functions
1092     }
1093
1094     public class Xcls_Box27 : Object
1095     {
1096         public Gtk.Box el;
1097         private NewBranch  _this;
1098
1099
1100             // my vars (def)
1101
1102         // ctor
1103         public Xcls_Box27(NewBranch _owner )
1104         {
1105             _this = _owner;
1106             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1107
1108             // my vars (dec)
1109
1110             // set gobject values
1111             this.el.homogeneous = false;
1112         }
1113
1114         // user defined functions
1115     }
1116
1117
1118 }