d725d32766de76c561af492fb37f0aaf5a68f034
[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     public Xcls_table table;
31     public Xcls_project_id project_id;
32     public Xcls_prcellrenderer prcellrenderer;
33     public Xcls_prmodel prmodel;
34     public Xcls_summary summary;
35     public Xcls_milestone_id milestone_id;
36     public Xcls_msmodel msmodel;
37     public Xcls_description description;
38     public Xcls_priority_id priority_id;
39     public Xcls_primodel primodel;
40     public Xcls_severity_id severity_id;
41     public Xcls_sevmodel sevmodel;
42     public Xcls_classification_id classification_id;
43     public Xcls_clmodel clmodel;
44     public Xcls_developer_id developer_id;
45     public Xcls_devmodel devmodel;
46     public Xcls_projectsel projectsel;
47     public Xcls_prcellrenderer prcellrenderer;
48     public Xcls_prmodel prmodel;
49     public Xcls_ticketsel ticketsel;
50     public Xcls_dbcellrenderer dbcellrenderer;
51     public Xcls_dbmodel dbmodel;
52     public Xcls_name name;
53     public Xcls_createbtn createbtn;
54     public Xcls_btn_not_me btn_not_me;
55     public Xcls_btn_closed btn_closed;
56
57         // my vars (def)
58     public GitRepo? repo;
59     public bool running;
60     public Gee.ArrayList<GitMonitorQueue> queue;
61
62     // ctor
63     public NewBranch()
64     {
65         _this = this;
66         this.el = new Gtk.Dialog();
67
68         // my vars (dec)
69         this.repo = null;
70         this.running = false;
71         this.queue = null;
72
73         // set gobject values
74         this.el.title = "Create a working branch ";
75         this.el.default_height = 500;
76         this.el.default_width = 500;
77         this.el.deletable = true;
78         this.el.modal = true;
79         var child_0 = new Xcls_Notebook2( _this );
80         child_0.ref();
81         this.el.get_content_area().add (  child_0.el  );
82
83         //listeners
84         this.el.delete_event.connect( (self, event) => {
85             this.el.hide();
86             return true; 
87             //test  
88         });
89         this.el.response.connect( (self, response_id) =>  { 
90           
91                 GLib.debug("got %d", (int) response_id);
92                 
93                  
94                 
95                  
96                 // have they selected a ticket..
97                 // make that the current active ticket?
98                 // we really need to store locally what ticket is being worked on..
99                 // in theory we could be working on multiple project and not merging..
100                 // -- each repo would have their active ticket (only one per repo)
101                 // -- so we could just store that in there
102                 // -- initial load can check the contents of the ticket files on first scan.
103         
104                  
105                 if (response_id < 1) {
106                     _this.el.hide();    
107                     this.running = false; 
108                         return;
109                 }
110                 
111                 var ticket_id = _this.ticketsel.selectedTicketId();
112                 
113             if (this.repo != null) {
114                 var bn = _this.name.el.get_text();
115         
116                         var res = this.repo.setActiveTicket(                    
117                                  RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
118                          );
119                          if (res) {
120                                 // start the monitoring..
121                                  GitMonitor.gitmonitor.start();
122                                  
123                          }
124             }
125              
126         
127             this.running = false; 
128         
129                 this.el.hide();
130                  
131                  
132         
133                  
134         });
135     }
136
137     // user defined functions
138     public   void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" ) 
139     {
140          // this.el.set_gravity(Gdk.Gravity.NORTH);
141         if (this.running) { // should not happen!!
142                 GLib.error("new branch show called, when already being displayed?");
143         }
144         this.queue = queue;
145         
146         this.running  = true;
147         GitMonitor.gitmonitor.stop();
148         
149         this.repo = repo;
150         
151          
152         
153         this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
154         this.el.set_default_size( 500,200); // not sure why it grows..
155         GLib.debug("Loading tickets"); 
156          
157     
158         this.el.show_all();
159         this.el.set_keep_above(true);
160        
161         
162         var curproj = RooProject.getProjectByRepo(this.repo);
163          _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
164         
165         _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
166         _this.createbtn.updateState();
167         
168         _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
169         if (tid != "") { 
170                 var name = RooTicket.singleton().usernameLocal();
171                 var ticket = RooTicket.singleton().getById(tid);
172                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
173         } else {
174                 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
175         }
176         _this.view.loadTicket(tid);
177         this.el.run();
178     
179     }
180     public class Xcls_Notebook2 : Object
181     {
182         public Gtk.Notebook el;
183         private NewBranch  _this;
184
185
186             // my vars (def)
187
188         // ctor
189         public Xcls_Notebook2(NewBranch _owner )
190         {
191             _this = _owner;
192             this.el = new Gtk.Notebook();
193
194             // my vars (dec)
195
196             // set gobject values
197             this.el.vexpand = true;
198             var child_0 = new Xcls_label_select_ticket( _this );
199             child_0.ref();
200             var child_1 = new Xcls_label_create_ticket( _this );
201             child_1.ref();
202             var child_2 = new Xcls_label_quick_commit( _this );
203             child_2.ref();
204             var child_3 = new Xcls_Box6( _this );
205             child_3.ref();
206             this.el.append_page (  child_3.el , _this.label_select_ticket.el );
207             var child_4 = new Xcls_Box25( _this );
208             child_4.ref();
209             this.el.append_page (  child_4.el , _this.label_create_ticket.el );
210             var child_5 = new Xcls_Box51( _this );
211             child_5.ref();
212             this.el.append_page (  child_5.el , _this.label_quick_commit.el );
213         }
214
215         // user defined functions
216     }
217     public class Xcls_label_select_ticket : Object
218     {
219         public Gtk.Label el;
220         private NewBranch  _this;
221
222
223             // my vars (def)
224
225         // ctor
226         public Xcls_label_select_ticket(NewBranch _owner )
227         {
228             _this = _owner;
229             _this.label_select_ticket = this;
230             this.el = new Gtk.Label( "Select Existing Ticket to work on" );
231
232             // my vars (dec)
233
234             // set gobject values
235         }
236
237         // user defined functions
238     }
239
240     public class Xcls_label_create_ticket : Object
241     {
242         public Gtk.Label el;
243         private NewBranch  _this;
244
245
246             // my vars (def)
247
248         // ctor
249         public Xcls_label_create_ticket(NewBranch _owner )
250         {
251             _this = _owner;
252             _this.label_create_ticket = this;
253             this.el = new Gtk.Label( "Create a New Ticket" );
254
255             // my vars (dec)
256
257             // set gobject values
258         }
259
260         // user defined functions
261     }
262
263     public class Xcls_label_quick_commit : Object
264     {
265         public Gtk.Label el;
266         private NewBranch  _this;
267
268
269             // my vars (def)
270
271         // ctor
272         public Xcls_label_quick_commit(NewBranch _owner )
273         {
274             _this = _owner;
275             _this.label_quick_commit = this;
276             this.el = new Gtk.Label( "Quick Commit" );
277
278             // my vars (dec)
279
280             // set gobject values
281         }
282
283         // user defined functions
284     }
285
286     public class Xcls_Box6 : Object
287     {
288         public Gtk.Box el;
289         private NewBranch  _this;
290
291
292             // my vars (def)
293
294         // ctor
295         public Xcls_Box6(NewBranch _owner )
296         {
297             _this = _owner;
298             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
299
300             // my vars (dec)
301
302             // set gobject values
303             this.el.homogeneous = false;
304             var child_0 = new Xcls_Table7( _this );
305             child_0.ref();
306             this.el.pack_start (  child_0.el , false,false,0 );
307             var child_1 = new Xcls_scrolled_window( _this );
308             child_1.ref();
309             this.el.add (  child_1.el  );
310         }
311
312         // user defined functions
313     }
314     public class Xcls_Table7 : Object
315     {
316         public Gtk.Table el;
317         private NewBranch  _this;
318
319
320             // my vars (def)
321
322         // ctor
323         public Xcls_Table7(NewBranch _owner )
324         {
325             _this = _owner;
326             this.el = new Gtk.Table( 5, 5, true );
327
328             // my vars (dec)
329
330             // set gobject values
331             this.el.expand = false;
332             this.el.margin = 2;
333             this.el.column_spacing = 4;
334             this.el.vexpand = false;
335             var child_0 = new Xcls_Label8( _this );
336             child_0.ref();
337             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
338             var child_1 = new Xcls_Label9( _this );
339             child_1.ref();
340             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
341             var child_2 = new Xcls_projectsel( _this );
342             child_2.ref();
343             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
344             var child_3 = new Xcls_ticketsel( _this );
345             child_3.ref();
346             this.el.attach_defaults (  child_3.el , 1,5,1,2 );
347             var child_4 = new Xcls_Label16( _this );
348             child_4.ref();
349             this.el.attach_defaults (  child_4.el , 0,1,3,4 );
350             var child_5 = new Xcls_name( _this );
351             child_5.ref();
352             this.el.attach_defaults (  child_5.el , 0,4,4,5 );
353             var child_6 = new Xcls_createbtn( _this );
354             child_6.ref();
355             this.el.attach_defaults (  child_6.el , 4,5,4,5 );
356             var child_7 = new Xcls_Box19( _this );
357             child_7.ref();
358             this.el.attach_defaults (  child_7.el , 0,5,2,3 );
359         }
360
361         // user defined functions
362     }
363     public class Xcls_Label8 : Object
364     {
365         public Gtk.Label el;
366         private NewBranch  _this;
367
368
369             // my vars (def)
370
371         // ctor
372         public Xcls_Label8(NewBranch _owner )
373         {
374             _this = _owner;
375             this.el = new Gtk.Label( "Project" );
376
377             // my vars (dec)
378
379             // set gobject values
380             this.el.halign = Gtk.Align.START;
381             this.el.justify = Gtk.Justification.RIGHT;
382             this.el.visible = true;
383         }
384
385         // user defined functions
386     }
387
388     public class Xcls_Label9 : Object
389     {
390         public Gtk.Label el;
391         private NewBranch  _this;
392
393
394             // my vars (def)
395
396         // ctor
397         public Xcls_Label9(NewBranch _owner )
398         {
399             _this = _owner;
400             this.el = new Gtk.Label( "Ticket" );
401
402             // my vars (dec)
403
404             // set gobject values
405             this.el.halign = Gtk.Align.START;
406             this.el.visible = true;
407         }
408
409         // user defined functions
410     }
411
412     public class Xcls_projectsel : Object
413     {
414         public Gtk.ComboBox el;
415         private NewBranch  _this;
416
417
418             // my vars (def)
419         public bool loading;
420
421         // ctor
422         public Xcls_projectsel(NewBranch _owner )
423         {
424             _this = _owner;
425             _this.projectsel = this;
426             this.el = new Gtk.ComboBox.with_entry();
427
428             // my vars (dec)
429             this.loading = false;
430
431             // set gobject values
432             var child_0 = new Xcls_prcellrenderer( _this );
433             child_0.ref();
434             this.el.pack_start (  child_0.el , true );
435             var child_1 = new Xcls_prmodel( _this );
436             child_1.ref();
437             this.el.set_model (  child_1.el  );
438
439             // init method
440
441             this.el.set_entry_text_column(1);
442
443             //listeners
444             this.el.changed.connect( () => {
445                 if (this.loading) {
446                         return;
447                 }
448                 var project_id = this.selectedProjectId();
449                 _this.dbmodel.loadTickets(project_id);
450                 
451                 
452                 /*if (this.loading) {
453                         return;
454                 }
455                 var ticket_id = this.selectedTicketId();
456                 
457                 var name = RooTicket.singleton().usernameLocal();
458                 
459                 if (ticket_id == "" || ticket_id == null) {
460                 
461                         var dt = new  DateTime.now_local();
462                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
463                         return;
464                 }
465                 
466                 
467                 var ticket = RooTicket.singleton().getById(ticket_id);
468                
469                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
470                 
471                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
472                 */
473             });
474         }
475
476         // user defined functions
477         public string selectedProjectId () {
478                 Gtk.TreeIter iter;
479                 Value val1;
480          
481          
482                 this.el.get_active_iter (out iter);
483                 _this.prmodel.el.get_value (iter, 0, out val1);
484          
485         
486                 return  (string) val1;
487                 
488                 
489                 
490                 
491         }
492     }
493     public class Xcls_prcellrenderer : Object
494     {
495         public Gtk.CellRendererText el;
496         private NewBranch  _this;
497
498
499             // my vars (def)
500
501         // ctor
502         public Xcls_prcellrenderer(NewBranch _owner )
503         {
504             _this = _owner;
505             _this.prcellrenderer = this;
506             this.el = new Gtk.CellRendererText();
507
508             // my vars (dec)
509
510             // set gobject values
511         }
512
513         // user defined functions
514     }
515
516     public class Xcls_prmodel : Object
517     {
518         public Gtk.ListStore el;
519         private NewBranch  _this;
520
521
522             // my vars (def)
523
524         // ctor
525         public Xcls_prmodel(NewBranch _owner )
526         {
527             _this = _owner;
528             _this.prmodel = this;
529             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
530
531             // my vars (dec)
532
533             // set gobject values
534         }
535
536         // user defined functions
537         public void loadProjects (string id) {
538         
539         
540             
541             _this.projectsel.loading = true;
542         
543             this.el.clear();                                    
544             Gtk.TreeIter iter;
545             var el = this.el;
546             
547             el.append(out iter);
548         
549             
550             el.set_value(iter, 0, "");
551             el.set_value(iter, 1, "-- select a project --");
552             if (id == "") {
553                     _this.projectsel.el.set_active_iter(iter);
554             }
555           
556             foreach(var project in RooProject.projects()) {
557             
558                 el.append(out iter);
559                 
560                 el.set_value(iter, 0, project.id);
561                 el.set_value(iter, 1,  project.name );
562                 if (id == project.id) {
563                            _this.projectsel.el.set_active_iter(iter);
564                     }   
565                 
566             }
567             
568             _this.projectsel.loading = false;
569              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
570                                              
571         }
572     }
573
574
575     public class Xcls_ticketsel : Object
576     {
577         public Gtk.ComboBox el;
578         private NewBranch  _this;
579
580
581             // my vars (def)
582         public bool loading;
583
584         // ctor
585         public Xcls_ticketsel(NewBranch _owner )
586         {
587             _this = _owner;
588             _this.ticketsel = this;
589             this.el = new Gtk.ComboBox.with_entry();
590
591             // my vars (dec)
592             this.loading = false;
593
594             // set gobject values
595             var child_0 = new Xcls_dbcellrenderer( _this );
596             child_0.ref();
597             this.el.pack_start (  child_0.el , true );
598             var child_1 = new Xcls_dbmodel( _this );
599             child_1.ref();
600             this.el.set_model (  child_1.el  );
601
602             // init method
603
604             //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
605             this.el.set_entry_text_column(1);
606             this.el.get_child().set_sensitive(false);
607
608             //listeners
609             this.el.changed.connect( () => {
610                 if (this.loading) {
611                         return;
612                 }
613                 var ticket_id = this.selectedTicketId();
614                 
615                 var name = RooTicket.singleton().usernameLocal();
616                 
617                 this.el.get_child().get_style_context().remove_class("warning");
618                 if (ticket_id == "" || ticket_id == null) {
619                 
620                         var dt = new  DateTime.now_local();
621                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
622                         _this.view.loadTicket("");              
623                         
624                         this.el.get_child().get_style_context().add_class("warning");
625                         _this.createbtn.updateState();
626                         return;
627                 }
628                 
629                 
630                 var ticket = RooTicket.singleton().getById(ticket_id);
631                
632                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
633                 _this.scrolled_window.el.show();
634                  
635                 _this.view.loadTicket(ticket.id);
636                 _this.createbtn.updateState();
637                 
638                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
639             });
640         }
641
642         // user defined functions
643         public string selectedTicketId () {
644         Gtk.TreeIter iter;
645                 Value val1;
646          
647          
648                 this.el.get_active_iter (out iter);
649                 _this.dbmodel.el.get_value (iter, 0, out val1);
650          
651         
652                 return  (string) val1;
653                 
654                 
655                 
656                 
657         }
658     }
659     public class Xcls_dbcellrenderer : Object
660     {
661         public Gtk.CellRendererText el;
662         private NewBranch  _this;
663
664
665             // my vars (def)
666
667         // ctor
668         public Xcls_dbcellrenderer(NewBranch _owner )
669         {
670             _this = _owner;
671             _this.dbcellrenderer = this;
672             this.el = new Gtk.CellRendererText();
673
674             // my vars (dec)
675
676             // set gobject values
677         }
678
679         // user defined functions
680     }
681
682     public class Xcls_dbmodel : Object
683     {
684         public Gtk.ListStore el;
685         private NewBranch  _this;
686
687
688             // my vars (def)
689
690         // ctor
691         public Xcls_dbmodel(NewBranch _owner )
692         {
693             _this = _owner;
694             _this.dbmodel = this;
695             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
696
697             // my vars (dec)
698
699             // set gobject values
700         }
701
702         // user defined functions
703         public void loadTickets (string project_id , string tid = "") {
704         
705         
706             
707             // fixme .. get project id from selection..
708             
709              RooTicket.singleton().loadTickets(
710                                 project_id,
711                                 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY :  RooTicket.Who.ME,
712                                  _this.btn_closed.el.active ? RooTicket.Status.ALL :  RooTicket.Status.ACTIVE
713                          );
714                 
715             _this.ticketsel.loading = true;
716         
717             this.el.clear();                                    
718             Gtk.TreeIter iter;
719             var el = this.el;
720             
721             el.append(out iter);
722         
723             
724             el.set_value(iter, 0, "");
725             el.set_value(iter, 1, "-- select a ticket --");
726             
727             _this.ticketsel.el.set_active_iter(iter);
728             var tickets = RooTicket.singleton().tickets;
729             foreach(var ticket in tickets) {
730             
731                 el.append(out iter);
732                 
733                 el.set_value(iter, 0, ticket.id);
734                 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
735                 
736                 if (ticket.id == tid) {
737                             _this.ticketsel.el.set_active_iter(iter);
738                 }
739                 
740             }
741             
742             _this.ticketsel.loading = false;
743              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
744                                              
745         }
746     }
747
748
749     public class Xcls_Label16 : Object
750     {
751         public Gtk.Label el;
752         private NewBranch  _this;
753
754
755             // my vars (def)
756
757         // ctor
758         public Xcls_Label16(NewBranch _owner )
759         {
760             _this = _owner;
761             this.el = new Gtk.Label( "Use this as branch name" );
762
763             // my vars (dec)
764
765             // set gobject values
766             this.el.halign = Gtk.Align.START;
767             this.el.justify = Gtk.Justification.RIGHT;
768             this.el.xalign = 0.900000f;
769         }
770
771         // user defined functions
772     }
773
774     public class Xcls_name : Object
775     {
776         public Gtk.Entry el;
777         private NewBranch  _this;
778
779
780             // my vars (def)
781
782         // ctor
783         public Xcls_name(NewBranch _owner )
784         {
785             _this = _owner;
786             _this.name = this;
787             this.el = new Gtk.Entry();
788
789             // my vars (dec)
790
791             // set gobject values
792             this.el.visible = true;
793         }
794
795         // user defined functions
796     }
797
798     public class Xcls_createbtn : Object
799     {
800         public Gtk.Button el;
801         private NewBranch  _this;
802
803
804             // my vars (def)
805
806         // ctor
807         public Xcls_createbtn(NewBranch _owner )
808         {
809             _this = _owner;
810             _this.createbtn = this;
811             this.el = new Gtk.Button();
812
813             // my vars (dec)
814
815             // set gobject values
816             this.el.label = "Create Branch";
817
818             // init method
819
820             {
821                this.el.get_style_context().add_class("suggested-action");
822             }
823
824             //listeners
825             this.el.clicked.connect( () => {
826             
827                 GLib.debug("fire response = 1");
828                 
829                 var ticket_id = _this.ticketsel.selectedTicketId();
830                 
831                 if (ticket_id == "") {
832                         _this.ticketsel.el.get_child().get_style_context().add_class("warning");
833                         return;
834                 }
835                  
836                 _this.el.response(1);
837             });
838         }
839
840         // user defined functions
841         public void updateState () {
842         
843                 var ticket_id = _this.ticketsel.selectedTicketId();
844                 
845                 if (ticket_id == "") {
846                         this.el.set_sensitive(false);
847                         return;
848                 }
849          
850                 this.el.set_sensitive(true);
851          
852         }
853     }
854
855     public class Xcls_Box19 : Object
856     {
857         public Gtk.Box el;
858         private NewBranch  _this;
859
860
861             // my vars (def)
862
863         // ctor
864         public Xcls_Box19(NewBranch _owner )
865         {
866             _this = _owner;
867             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
868
869             // my vars (dec)
870
871             // set gobject values
872             var child_0 = new Xcls_btn_not_me( _this );
873             child_0.ref();
874             this.el.add (  child_0.el  );
875             var child_1 = new Xcls_btn_closed( _this );
876             child_1.ref();
877             this.el.add (  child_1.el  );
878             var child_2 = new Xcls_Label22( _this );
879             child_2.ref();
880             this.el.add (  child_2.el  );
881         }
882
883         // user defined functions
884     }
885     public class Xcls_btn_not_me : Object
886     {
887         public Gtk.CheckButton el;
888         private NewBranch  _this;
889
890
891             // my vars (def)
892
893         // ctor
894         public Xcls_btn_not_me(NewBranch _owner )
895         {
896             _this = _owner;
897             _this.btn_not_me = this;
898             this.el = new Gtk.CheckButton();
899
900             // my vars (dec)
901
902             // set gobject values
903             this.el.label = "Show tickets not assigned to me";
904
905             //listeners
906             this.el.toggled.connect( () => {
907                 var project_id = _this.projectsel.selectedProjectId();
908                 _this.dbmodel.loadTickets(project_id);  
909             });
910         }
911
912         // user defined functions
913     }
914
915     public class Xcls_btn_closed : Object
916     {
917         public Gtk.CheckButton el;
918         private NewBranch  _this;
919
920
921             // my vars (def)
922
923         // ctor
924         public Xcls_btn_closed(NewBranch _owner )
925         {
926             _this = _owner;
927             _this.btn_closed = this;
928             this.el = new Gtk.CheckButton();
929
930             // my vars (dec)
931
932             // set gobject values
933             this.el.label = "Show closed Tickets";
934
935             //listeners
936             this.el.toggled.connect( () => {
937                 var project_id = _this.projectsel.selectedProjectId();
938                 _this.dbmodel.loadTickets(project_id);  
939                  
940             });
941         }
942
943         // user defined functions
944     }
945
946     public class Xcls_Label22 : Object
947     {
948         public Gtk.Label el;
949         private NewBranch  _this;
950
951
952             // my vars (def)
953
954         // ctor
955         public Xcls_Label22(NewBranch _owner )
956         {
957             _this = _owner;
958             this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
959
960             // my vars (dec)
961
962             // set gobject values
963             this.el.halign = Gtk.Align.END;
964             this.el.hexpand = true;
965             this.el.use_markup = true;
966
967             //listeners
968             this.el.activate_link.connect( (uri) => {
969                 if (uri == "refresh") {
970                         RooProject.reload();
971                         var curproj = RooProject.getProjectByRepo(_this.repo);
972                          _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
973             
974                         _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);            
975                 }
976                 return true;
977             });
978         }
979
980         // user defined functions
981     }
982
983
984
985     public class Xcls_scrolled_window : Object
986     {
987         public Gtk.ScrolledWindow el;
988         private NewBranch  _this;
989
990
991             // my vars (def)
992
993         // ctor
994         public Xcls_scrolled_window(NewBranch _owner )
995         {
996             _this = _owner;
997             _this.scrolled_window = this;
998             this.el = new Gtk.ScrolledWindow( null, null );
999
1000             // my vars (dec)
1001
1002             // set gobject values
1003             this.el.height_request = 500;
1004             this.el.vexpand = true;
1005             var child_0 = new Xcls_view( _this );
1006             child_0.ref();
1007             this.el.add (  child_0.el  );
1008
1009             // init method
1010
1011             {
1012                 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
1013             }
1014         }
1015
1016         // user defined functions
1017     }
1018     public class Xcls_view : Object
1019     {
1020         public WebKit.WebView el;
1021         private NewBranch  _this;
1022
1023
1024             // my vars (def)
1025
1026         // ctor
1027         public Xcls_view(NewBranch _owner )
1028         {
1029             _this = _owner;
1030             _this.view = this;
1031             this.el = new WebKit.WebView();
1032
1033             // my vars (dec)
1034
1035             // set gobject values
1036         }
1037
1038         // user defined functions
1039         public void loadTicket (string tid) {
1040                 int h,w;
1041                 _this.el.get_size(out w, out h);
1042                 
1043                 if (tid == "") {
1044                         _this.scrolled_window.el.hide();
1045                         _this.el.resize(w, 150);
1046                 } else {
1047                         _this.scrolled_window.el.show();
1048                         _this.el.resize(w, 800);
1049                 }
1050                 
1051                 var rs =  RooTicket.singleton();                
1052                 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
1053                 var hd = uri.get_http_headers();
1054                 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
1055                 hd.append("Authorization", "Basic %s".printf(authCode));
1056                 
1057                  this.el.load_request(uri);
1058         }
1059     }
1060
1061
1062
1063     public class Xcls_Box25 : Object
1064     {
1065         public Gtk.Box el;
1066         private NewBranch  _this;
1067
1068
1069             // my vars (def)
1070
1071         // ctor
1072         public Xcls_Box25(NewBranch _owner )
1073         {
1074             _this = _owner;
1075             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1076
1077             // my vars (dec)
1078
1079             // set gobject values
1080             this.el.homogeneous = false;
1081             var child_0 = new Xcls_table( _this );
1082             child_0.ref();
1083             this.el.pack_start (  child_0.el , false,false,0 );
1084         }
1085
1086         // user defined functions
1087     }
1088     public class Xcls_table : Object
1089     {
1090         public Gtk.Table el;
1091         private NewBranch  _this;
1092
1093
1094             // my vars (def)
1095
1096         // ctor
1097         public Xcls_table(NewBranch _owner )
1098         {
1099             _this = _owner;
1100             _this.table = this;
1101             this.el = new Gtk.Table( 14, 4, true );
1102
1103             // my vars (dec)
1104
1105             // set gobject values
1106             this.el.expand = false;
1107             this.el.margin = 2;
1108             this.el.column_spacing = 4;
1109             this.el.vexpand = false;
1110             var child_0 = new Xcls_Label27( _this );
1111             child_0.ref();
1112             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
1113             var child_1 = new Xcls_Label28( _this );
1114             child_1.ref();
1115             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
1116             var child_2 = new Xcls_project_id( _this );
1117             child_2.ref();
1118             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
1119             var child_3 = new Xcls_summary( _this );
1120             child_3.ref();
1121             this.el.attach_defaults (  child_3.el , 1,4,1,2 );
1122             var child_4 = new Xcls_Label33( _this );
1123             child_4.ref();
1124             this.el.attach_defaults (  child_4.el , 0,1,2,3 );
1125             var child_5 = new Xcls_milestone_id( _this );
1126             child_5.ref();
1127             this.el.attach_defaults (  child_5.el , 0,1,3,4 );
1128             var child_6 = new Xcls_Label36( _this );
1129             child_6.ref();
1130             this.el.attach_defaults (  child_6.el , 1,4,2,3 );
1131             var child_7 = new Xcls_description( _this );
1132             child_7.ref();
1133             this.el.attach_defaults (  child_7.el , 1,4,3,12 );
1134             var child_8 = new Xcls_Label38( _this );
1135             child_8.ref();
1136             this.el.attach_defaults (  child_8.el , 0,1,4,5 );
1137             var child_9 = new Xcls_priority_id( _this );
1138             child_9.ref();
1139             this.el.attach_defaults (  child_9.el , 0,1,5,6 );
1140             var child_10 = new Xcls_Label41( _this );
1141             child_10.ref();
1142             this.el.attach_defaults (  child_10.el , 0,1,6,7 );
1143             var child_11 = new Xcls_severity_id( _this );
1144             child_11.ref();
1145             this.el.attach_defaults (  child_11.el , 0,1,7,8 );
1146             var child_12 = new Xcls_Label44( _this );
1147             child_12.ref();
1148             this.el.attach_defaults (  child_12.el , 0,1,8,9 );
1149             var child_13 = new Xcls_classification_id( _this );
1150             child_13.ref();
1151             this.el.attach_defaults (  child_13.el , 0,1,9,10 );
1152             var child_14 = new Xcls_Label47( _this );
1153             child_14.ref();
1154             this.el.attach_defaults (  child_14.el , 0,1,10,11 );
1155             var child_15 = new Xcls_developer_id( _this );
1156             child_15.ref();
1157             this.el.attach_defaults (  child_15.el , 0,1,11,12 );
1158             var child_16 = new Xcls_Button50( _this );
1159             child_16.ref();
1160             this.el.attach_defaults (  child_16.el , 0,4,13,14 );
1161         }
1162
1163         // user defined functions
1164     }
1165     public class Xcls_Label27 : Object
1166     {
1167         public Gtk.Label el;
1168         private NewBranch  _this;
1169
1170
1171             // my vars (def)
1172
1173         // ctor
1174         public Xcls_Label27(NewBranch _owner )
1175         {
1176             _this = _owner;
1177             this.el = new Gtk.Label( "Project" );
1178
1179             // my vars (dec)
1180
1181             // set gobject values
1182             this.el.halign = Gtk.Align.START;
1183             this.el.visible = true;
1184         }
1185
1186         // user defined functions
1187     }
1188
1189     public class Xcls_Label28 : Object
1190     {
1191         public Gtk.Label el;
1192         private NewBranch  _this;
1193
1194
1195             // my vars (def)
1196
1197         // ctor
1198         public Xcls_Label28(NewBranch _owner )
1199         {
1200             _this = _owner;
1201             this.el = new Gtk.Label( "Summary" );
1202
1203             // my vars (dec)
1204
1205             // set gobject values
1206             this.el.halign = Gtk.Align.START;
1207             this.el.visible = true;
1208         }
1209
1210         // user defined functions
1211     }
1212
1213     public class Xcls_project_id : Object
1214     {
1215         public Gtk.ComboBox el;
1216         private NewBranch  _this;
1217
1218
1219             // my vars (def)
1220         public bool loading;
1221
1222         // ctor
1223         public Xcls_project_id(NewBranch _owner )
1224         {
1225             _this = _owner;
1226             _this.project_id = this;
1227             this.el = new Gtk.ComboBox.with_entry();
1228
1229             // my vars (dec)
1230             this.loading = false;
1231
1232             // set gobject values
1233             var child_0 = new Xcls_prcellrenderer( _this );
1234             child_0.ref();
1235             this.el.pack_start (  child_0.el , true );
1236             var child_1 = new Xcls_prmodel( _this );
1237             child_1.ref();
1238             this.el.set_model (  child_1.el  );
1239
1240             // init method
1241
1242             this.el.set_entry_text_column(1);
1243
1244             //listeners
1245             this.el.changed.connect( () => {
1246                 if (this.loading) {
1247                         return;
1248                 }
1249                 var project_id = this.selectedProjectId();
1250                 
1251                 var rt = RooTicket.singleton();
1252                 rt.loadProjectOptions(project_id);
1253                 
1254                 _this.msmodel.loadMilestones();
1255                 _this.primodel.loadPriorities();
1256                 _this.sevmodel.loadSeverities();
1257                 _this.clmodel.loadClassifications();    
1258                 _this.devmodel.loadDevelopers();        
1259                 
1260                 // affects projects and milestones..
1261                 
1262                 
1263                 /*if (this.loading) {
1264                         return;
1265                 }
1266                 var ticket_id = this.selectedTicketId();
1267                 
1268                 var name = RooTicket.singleton().usernameLocal();
1269                 
1270                 if (ticket_id == "" || ticket_id == null) {
1271                 
1272                         var dt = new  DateTime.now_local();
1273                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
1274                         return;
1275                 }
1276                 
1277                 
1278                 var ticket = RooTicket.singleton().getById(ticket_id);
1279                
1280                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
1281                 
1282                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
1283                 */
1284             });
1285         }
1286
1287         // user defined functions
1288         public string selectedProjectId () {
1289                 Gtk.TreeIter iter;
1290                 Value val1;
1291          
1292          
1293                 this.el.get_active_iter (out iter);
1294                 _this.prmodel.el.get_value (iter, 0, out val1);
1295          
1296         
1297                 return  (string) val1;
1298                 
1299                 
1300                 
1301                 
1302         }
1303     }
1304     public class Xcls_prcellrenderer : Object
1305     {
1306         public Gtk.CellRendererText el;
1307         private NewBranch  _this;
1308
1309
1310             // my vars (def)
1311
1312         // ctor
1313         public Xcls_prcellrenderer(NewBranch _owner )
1314         {
1315             _this = _owner;
1316             _this.prcellrenderer = this;
1317             this.el = new Gtk.CellRendererText();
1318
1319             // my vars (dec)
1320
1321             // set gobject values
1322         }
1323
1324         // user defined functions
1325     }
1326
1327     public class Xcls_prmodel : Object
1328     {
1329         public Gtk.ListStore el;
1330         private NewBranch  _this;
1331
1332
1333             // my vars (def)
1334
1335         // ctor
1336         public Xcls_prmodel(NewBranch _owner )
1337         {
1338             _this = _owner;
1339             _this.prmodel = this;
1340             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1341
1342             // my vars (dec)
1343
1344             // set gobject values
1345         }
1346
1347         // user defined functions
1348         public void loadProjects (string id) {
1349         
1350             
1351             _this.project_id.loading = true;
1352         
1353             this.el.clear();                                    
1354             Gtk.TreeIter iter;
1355             var el = this.el;
1356             
1357             el.append(out iter);
1358         
1359             
1360             el.set_value(iter, 0, "");
1361             el.set_value(iter, 1, "-- select a project --");
1362             if (id == "") {
1363                     _this.project_id.el.set_active_iter(iter);
1364             }
1365         
1366             foreach(var project in RooProject.projects()) {
1367             
1368                 el.append(out iter);
1369                 
1370                 el.set_value(iter, 0, project.id);
1371                 el.set_value(iter, 1,  project.name );
1372                 if (id == project.id) {
1373                            _this.project_id.el.set_active_iter(iter);
1374                     }   
1375                 
1376             }
1377             
1378             _this.project_id.loading = false;
1379              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1380                                              
1381         }
1382     }
1383
1384
1385     public class Xcls_summary : Object
1386     {
1387         public Gtk.Entry el;
1388         private NewBranch  _this;
1389
1390
1391             // my vars (def)
1392
1393         // ctor
1394         public Xcls_summary(NewBranch _owner )
1395         {
1396             _this = _owner;
1397             _this.summary = this;
1398             this.el = new Gtk.Entry();
1399
1400             // my vars (dec)
1401
1402             // set gobject values
1403             this.el.visible = true;
1404         }
1405
1406         // user defined functions
1407     }
1408
1409     public class Xcls_Label33 : Object
1410     {
1411         public Gtk.Label el;
1412         private NewBranch  _this;
1413
1414
1415             // my vars (def)
1416
1417         // ctor
1418         public Xcls_Label33(NewBranch _owner )
1419         {
1420             _this = _owner;
1421             this.el = new Gtk.Label( "Milestone" );
1422
1423             // my vars (dec)
1424
1425             // set gobject values
1426             this.el.halign = Gtk.Align.START;
1427             this.el.justify = Gtk.Justification.RIGHT;
1428             this.el.xalign = 0.900000f;
1429         }
1430
1431         // user defined functions
1432     }
1433
1434     public class Xcls_milestone_id : Object
1435     {
1436         public Gtk.ComboBox el;
1437         private NewBranch  _this;
1438
1439
1440             // my vars (def)
1441         public bool loading;
1442
1443         // ctor
1444         public Xcls_milestone_id(NewBranch _owner )
1445         {
1446             _this = _owner;
1447             _this.milestone_id = this;
1448             this.el = new Gtk.ComboBox.with_entry();
1449
1450             // my vars (dec)
1451             this.loading = false;
1452
1453             // set gobject values
1454             var child_0 = new Xcls_msmodel( _this );
1455             child_0.ref();
1456             this.el.set_model (  child_0.el  );
1457
1458             // init method
1459
1460             this.el.set_entry_text_column(1);
1461         }
1462
1463         // user defined functions
1464         public string selectedMilestoneId () {
1465                 Gtk.TreeIter iter;
1466                 Value val1;
1467          
1468          
1469                 this.el.get_active_iter (out iter);
1470                 _this.msmodel.el.get_value (iter, 0, out val1);
1471          
1472         
1473                 return  (string) val1;
1474                 
1475                 
1476                 
1477                 
1478         }
1479     }
1480     public class Xcls_msmodel : Object
1481     {
1482         public Gtk.ListStore el;
1483         private NewBranch  _this;
1484
1485
1486             // my vars (def)
1487
1488         // ctor
1489         public Xcls_msmodel(NewBranch _owner )
1490         {
1491             _this = _owner;
1492             _this.msmodel = this;
1493             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1494
1495             // my vars (dec)
1496
1497             // set gobject values
1498         }
1499
1500         // user defined functions
1501         public void loadMilestones ( ) {
1502         
1503             var rt = RooTicket.singleton();
1504            // rt.loadProjects();
1505             
1506             _this.milestone_id.loading = true;
1507         
1508             this.el.clear();                                    
1509             Gtk.TreeIter iter;
1510             var el = this.el;
1511             
1512             el.append(out iter);
1513         
1514             
1515             el.set_value(iter, 0, "");
1516             el.set_value(iter, 1, "-- select a milestone --");
1517             _this.milestone_id.el.set_active_iter(iter);    
1518              
1519             var projects = rt.milestones;
1520             foreach(var project in projects) {
1521             
1522                 el.append(out iter);
1523                 
1524                 el.set_value(iter, 0, project.id);
1525                 el.set_value(iter, 1,  project.display_name );
1526               //  if (id == project.id) {
1527                  //        _this.milestone.el.set_active_iter(iter);
1528                  //   }   
1529                 
1530             }
1531             
1532             
1533             _this.milestone_id.loading = false;
1534              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1535                                              
1536         }
1537     }
1538
1539
1540     public class Xcls_Label36 : Object
1541     {
1542         public Gtk.Label el;
1543         private NewBranch  _this;
1544
1545
1546             // my vars (def)
1547
1548         // ctor
1549         public Xcls_Label36(NewBranch _owner )
1550         {
1551             _this = _owner;
1552             this.el = new Gtk.Label( "Description" );
1553
1554             // my vars (dec)
1555
1556             // set gobject values
1557             this.el.halign = Gtk.Align.START;
1558         }
1559
1560         // user defined functions
1561     }
1562
1563     public class Xcls_description : Object
1564     {
1565         public Gtk.TextView el;
1566         private NewBranch  _this;
1567
1568
1569             // my vars (def)
1570
1571         // ctor
1572         public Xcls_description(NewBranch _owner )
1573         {
1574             _this = _owner;
1575             _this.description = this;
1576             this.el = new Gtk.TextView();
1577
1578             // my vars (dec)
1579
1580             // set gobject values
1581             this.el.border_width = 1;
1582         }
1583
1584         // user defined functions
1585     }
1586
1587     public class Xcls_Label38 : Object
1588     {
1589         public Gtk.Label el;
1590         private NewBranch  _this;
1591
1592
1593             // my vars (def)
1594
1595         // ctor
1596         public Xcls_Label38(NewBranch _owner )
1597         {
1598             _this = _owner;
1599             this.el = new Gtk.Label( "Priority" );
1600
1601             // my vars (dec)
1602
1603             // set gobject values
1604             this.el.halign = Gtk.Align.START;
1605             this.el.xalign = 0.900000f;
1606         }
1607
1608         // user defined functions
1609     }
1610
1611     public class Xcls_priority_id : Object
1612     {
1613         public Gtk.ComboBox el;
1614         private NewBranch  _this;
1615
1616
1617             // my vars (def)
1618         public bool loading;
1619
1620         // ctor
1621         public Xcls_priority_id(NewBranch _owner )
1622         {
1623             _this = _owner;
1624             _this.priority_id = this;
1625             this.el = new Gtk.ComboBox.with_entry();
1626
1627             // my vars (dec)
1628             this.loading = false;
1629
1630             // set gobject values
1631             var child_0 = new Xcls_primodel( _this );
1632             child_0.ref();
1633             this.el.set_model (  child_0.el  );
1634
1635             // init method
1636
1637             this.el.set_entry_text_column(1);
1638         }
1639
1640         // user defined functions
1641         public string selectedPriorityId () {
1642                 Gtk.TreeIter iter;
1643                 Value val1;
1644          
1645          
1646                 this.el.get_active_iter (out iter);
1647                 _this.primodel.el.get_value (iter, 0, out val1);
1648          
1649         
1650                 return  (string) val1;
1651                 
1652                 
1653                 
1654                 
1655         }
1656     }
1657     public class Xcls_primodel : Object
1658     {
1659         public Gtk.ListStore el;
1660         private NewBranch  _this;
1661
1662
1663             // my vars (def)
1664
1665         // ctor
1666         public Xcls_primodel(NewBranch _owner )
1667         {
1668             _this = _owner;
1669             _this.primodel = this;
1670             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1671
1672             // my vars (dec)
1673
1674             // set gobject values
1675         }
1676
1677         // user defined functions
1678         public void loadPriorities ( ) {
1679         
1680             var rt = RooTicket.singleton();
1681            // rt.loadProjects();
1682             
1683             _this.priority_id.loading = true;
1684         
1685             this.el.clear();                                    
1686             Gtk.TreeIter iter;
1687             var el = this.el;
1688             
1689             
1690            var projects = rt.priorities;
1691             foreach(var project in projects) {
1692             
1693                 el.append(out iter);
1694                 
1695                 el.set_value(iter, 0, project.id);
1696                 el.set_value(iter, 1,  project.display_name );
1697                 if ("normal" == project.name) {
1698                            _this.priority_id.el.set_active_iter(iter);
1699                     }   
1700                 
1701             }
1702             
1703             _this.priority_id.loading = false;
1704                    
1705                                              
1706         }
1707     }
1708
1709
1710     public class Xcls_Label41 : Object
1711     {
1712         public Gtk.Label el;
1713         private NewBranch  _this;
1714
1715
1716             // my vars (def)
1717
1718         // ctor
1719         public Xcls_Label41(NewBranch _owner )
1720         {
1721             _this = _owner;
1722             this.el = new Gtk.Label( "Severity" );
1723
1724             // my vars (dec)
1725
1726             // set gobject values
1727             this.el.halign = Gtk.Align.START;
1728         }
1729
1730         // user defined functions
1731     }
1732
1733     public class Xcls_severity_id : Object
1734     {
1735         public Gtk.ComboBox el;
1736         private NewBranch  _this;
1737
1738
1739             // my vars (def)
1740         public bool loading;
1741
1742         // ctor
1743         public Xcls_severity_id(NewBranch _owner )
1744         {
1745             _this = _owner;
1746             _this.severity_id = this;
1747             this.el = new Gtk.ComboBox.with_entry();
1748
1749             // my vars (dec)
1750             this.loading = false;
1751
1752             // set gobject values
1753             var child_0 = new Xcls_sevmodel( _this );
1754             child_0.ref();
1755             this.el.set_model (  child_0.el  );
1756
1757             // init method
1758
1759             this.el.set_entry_text_column(1);
1760         }
1761
1762         // user defined functions
1763         public string selectedSeverityId () {
1764                 Gtk.TreeIter iter;
1765                 Value val1;
1766          
1767          
1768                 this.el.get_active_iter (out iter);
1769                 _this.sevmodel.el.get_value (iter, 0, out val1);
1770          
1771         
1772                 return  (string) val1;
1773                 
1774                 
1775                 
1776                 
1777         }
1778     }
1779     public class Xcls_sevmodel : Object
1780     {
1781         public Gtk.ListStore el;
1782         private NewBranch  _this;
1783
1784
1785             // my vars (def)
1786
1787         // ctor
1788         public Xcls_sevmodel(NewBranch _owner )
1789         {
1790             _this = _owner;
1791             _this.sevmodel = this;
1792             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1793
1794             // my vars (dec)
1795
1796             // set gobject values
1797         }
1798
1799         // user defined functions
1800         public void loadSeverities () {
1801         
1802             var rt = RooTicket.singleton();
1803             //rt.loadProjects();
1804             
1805             _this.severity_id.loading = true;
1806         
1807             this.el.clear();                                    
1808             Gtk.TreeIter iter;
1809             var el = this.el;
1810              
1811             var projects = rt.serverities;
1812             foreach(var project in projects) {
1813             
1814                 el.append(out iter);
1815                 
1816                 el.set_value(iter, 0, project.id);
1817                 el.set_value(iter, 1,  project.display_name );
1818                 if ("normal" == project.name) {
1819                            _this.severity_id.el.set_active_iter(iter);
1820                     }   
1821                 
1822             }
1823            
1824             _this.severity_id.loading = false;
1825              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1826                                              
1827         }
1828     }
1829
1830
1831     public class Xcls_Label44 : Object
1832     {
1833         public Gtk.Label el;
1834         private NewBranch  _this;
1835
1836
1837             // my vars (def)
1838
1839         // ctor
1840         public Xcls_Label44(NewBranch _owner )
1841         {
1842             _this = _owner;
1843             this.el = new Gtk.Label( "Classification" );
1844
1845             // my vars (dec)
1846
1847             // set gobject values
1848             this.el.halign = Gtk.Align.START;
1849         }
1850
1851         // user defined functions
1852     }
1853
1854     public class Xcls_classification_id : Object
1855     {
1856         public Gtk.ComboBox el;
1857         private NewBranch  _this;
1858
1859
1860             // my vars (def)
1861         public bool loading;
1862
1863         // ctor
1864         public Xcls_classification_id(NewBranch _owner )
1865         {
1866             _this = _owner;
1867             _this.classification_id = this;
1868             this.el = new Gtk.ComboBox.with_entry();
1869
1870             // my vars (dec)
1871             this.loading = false;
1872
1873             // set gobject values
1874             var child_0 = new Xcls_clmodel( _this );
1875             child_0.ref();
1876             this.el.set_model (  child_0.el  );
1877
1878             // init method
1879
1880             this.el.set_entry_text_column(1);
1881         }
1882
1883         // user defined functions
1884         public string selectedClassificationId () {
1885                 Gtk.TreeIter iter;
1886                 Value val1;
1887          
1888          
1889                 this.el.get_active_iter (out iter);
1890                 _this.clmodel.el.get_value (iter, 0, out val1);
1891          
1892         
1893                 return  (string) val1;
1894                 
1895                 
1896                 
1897                 
1898         }
1899     }
1900     public class Xcls_clmodel : Object
1901     {
1902         public Gtk.ListStore el;
1903         private NewBranch  _this;
1904
1905
1906             // my vars (def)
1907
1908         // ctor
1909         public Xcls_clmodel(NewBranch _owner )
1910         {
1911             _this = _owner;
1912             _this.clmodel = this;
1913             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
1914
1915             // my vars (dec)
1916
1917             // set gobject values
1918         }
1919
1920         // user defined functions
1921         public void loadClassifications ( ) {
1922         
1923             var rt = RooTicket.singleton();
1924             // rt.loadProjects();
1925             
1926             _this.classification_id.loading = true;
1927         
1928             this.el.clear();                                    
1929             Gtk.TreeIter iter;
1930             var el = this.el;
1931             
1932             el.append(out iter);
1933         
1934              
1935             var projects = rt.classifications;
1936             foreach(var project in projects) {
1937             
1938                 el.append(out iter);
1939                 
1940                 el.set_value(iter, 0, project.id);
1941                 el.set_value(iter, 1,  project.display_name );
1942                 if ("bug" == project.name) {
1943                            _this.classification_id.el.set_active_iter(iter);
1944                     }   
1945                 
1946             }
1947             
1948             _this.classification_id.loading = false;
1949              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
1950                                              
1951         }
1952     }
1953
1954
1955     public class Xcls_Label47 : Object
1956     {
1957         public Gtk.Label el;
1958         private NewBranch  _this;
1959
1960
1961             // my vars (def)
1962
1963         // ctor
1964         public Xcls_Label47(NewBranch _owner )
1965         {
1966             _this = _owner;
1967             this.el = new Gtk.Label( "Assign to" );
1968
1969             // my vars (dec)
1970
1971             // set gobject values
1972             this.el.halign = Gtk.Align.START;
1973         }
1974
1975         // user defined functions
1976     }
1977
1978     public class Xcls_developer_id : Object
1979     {
1980         public Gtk.ComboBox el;
1981         private NewBranch  _this;
1982
1983
1984             // my vars (def)
1985         public bool loading;
1986
1987         // ctor
1988         public Xcls_developer_id(NewBranch _owner )
1989         {
1990             _this = _owner;
1991             _this.developer_id = this;
1992             this.el = new Gtk.ComboBox.with_entry();
1993
1994             // my vars (dec)
1995             this.loading = false;
1996
1997             // set gobject values
1998             var child_0 = new Xcls_devmodel( _this );
1999             child_0.ref();
2000             this.el.set_model (  child_0.el  );
2001
2002             // init method
2003
2004             this.el.set_entry_text_column(1);
2005         }
2006
2007         // user defined functions
2008         public string selectedDeveloperId () {
2009                 Gtk.TreeIter iter;
2010                 Value val1;
2011          
2012          
2013                 this.el.get_active_iter (out iter);
2014                 _this.devmodel.el.get_value (iter, 0, out val1);
2015          
2016         
2017                 return  (string) val1;
2018                 
2019                 
2020                 
2021                 
2022         }
2023     }
2024     public class Xcls_devmodel : Object
2025     {
2026         public Gtk.ListStore el;
2027         private NewBranch  _this;
2028
2029
2030             // my vars (def)
2031
2032         // ctor
2033         public Xcls_devmodel(NewBranch _owner )
2034         {
2035             _this = _owner;
2036             _this.devmodel = this;
2037             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2038
2039             // my vars (dec)
2040
2041             // set gobject values
2042         }
2043
2044         // user defined functions
2045         public void loadDevelopers ( ) {
2046         
2047             var rt = RooTicket.singleton();
2048             //rt.loadProjects();
2049             
2050             _this.developer_id.loading = true;
2051         
2052             this.el.clear();                                    
2053             Gtk.TreeIter iter;
2054             var el = this.el;
2055             
2056             el.append(out iter);
2057         
2058             
2059             el.set_value(iter, 0, "");
2060             el.set_value(iter, 1, "-- select a developer --");
2061           //  if (id == "") {
2062                     _this.developer_id.el.set_active_iter(iter);
2063            // }
2064             
2065             var peps = rt.developers;
2066             foreach(var p in peps) {
2067             
2068                 el.append(out iter);
2069                 
2070                 el.set_value(iter, 0, p.id);
2071                 el.set_value(iter, 1,  p.display_name );
2072                 if (rt.authuser_id == p.id) {
2073                            _this.developer_id.el.set_active_iter(iter);
2074                     }   
2075             }
2076          
2077             _this.developer_id.loading = false;
2078              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
2079                                              
2080         }
2081     }
2082
2083
2084     public class Xcls_Button50 : Object
2085     {
2086         public Gtk.Button el;
2087         private NewBranch  _this;
2088
2089
2090             // my vars (def)
2091
2092         // ctor
2093         public Xcls_Button50(NewBranch _owner )
2094         {
2095             _this = _owner;
2096             this.el = new Gtk.Button();
2097
2098             // my vars (dec)
2099
2100             // set gobject values
2101             this.el.label = "Create Ticket & Branch";
2102
2103             // init method
2104
2105             {
2106                this.el.get_style_context().add_class("suggested-action");
2107             }
2108
2109             //listeners
2110             this.el.clicked.connect( () => {
2111                 GLib.debug("fire response = 1");
2112                 
2113                 
2114                 var invalid = false;
2115                 
2116                 // validate first...
2117                 _this.project_id.el.get_child().get_style_context().remove_class("warning");    
2118                 if (_this.project_id.selectedProjectId() == "") {
2119                         _this.project_id.el.get_child().get_style_context().add_class("warning");
2120                         invalid = true;
2121                 }
2122                 
2123                 _this.milestone_id.el.get_child().get_style_context().remove_class("warning");  
2124             
2125                 _this.priority_id.el.get_child().get_style_context().remove_class("warning");   
2126                 if (_this.priority_id.selectedPriorityId() == "") {
2127                         _this.priority_id.el.get_child().get_style_context().add_class("warning");
2128                         invalid = true;
2129                 }
2130                 
2131                 _this.classification_id.el.get_child().get_style_context().remove_class("warning");     
2132                 if (_this.classification_id.selectedClassificationId() == "") {
2133                         _this.classification_id.el.get_child().get_style_context().add_class("warning");
2134                         invalid = true;
2135                 }
2136                 
2137                 _this.developer_id.el.get_child().get_style_context().remove_class("warning");  
2138                 if (_this.developer_id.selectedDeveloperId() == "") {
2139                         _this.developer_id.el.get_child().get_style_context().add_class("warning");
2140                         invalid = true;
2141                 }
2142                 
2143                 _this.summary.el.get_style_context().remove_class("warning");   
2144                 if (_this.summary.el.get_text() == "") {
2145                         _this.summary.el.get_style_context().add_class("warning");
2146                         invalid = true;
2147                 }
2148                 
2149                 _this.description.el.get_style_context().remove_class("warning");       
2150              
2151                 if (invalid) {
2152                         return;
2153                 }
2154                 GLib.debug("for is valid");
2155                 
2156                 _this.el.response(1);
2157             });
2158         }
2159
2160         // user defined functions
2161     }
2162
2163
2164
2165     public class Xcls_Box51 : Object
2166     {
2167         public Gtk.Box el;
2168         private NewBranch  _this;
2169
2170
2171             // my vars (def)
2172
2173         // ctor
2174         public Xcls_Box51(NewBranch _owner )
2175         {
2176             _this = _owner;
2177             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
2178
2179             // my vars (dec)
2180
2181             // set gobject values
2182             this.el.homogeneous = false;
2183             var child_0 = new Xcls_Table52( _this );
2184             child_0.ref();
2185             this.el.pack_start (  child_0.el , false,false,0 );
2186         }
2187
2188         // user defined functions
2189     }
2190     public class Xcls_Table52 : Object
2191     {
2192         public Gtk.Table el;
2193         private NewBranch  _this;
2194
2195
2196             // my vars (def)
2197
2198         // ctor
2199         public Xcls_Table52(NewBranch _owner )
2200         {
2201             _this = _owner;
2202             this.el = new Gtk.Table( 5, 5, true );
2203
2204             // my vars (dec)
2205
2206             // set gobject values
2207             this.el.expand = false;
2208             this.el.margin = 2;
2209             this.el.column_spacing = 4;
2210             this.el.vexpand = false;
2211             var child_0 = new Xcls_Label53( _this );
2212             child_0.ref();
2213             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
2214             var child_1 = new Xcls_Label54( _this );
2215             child_1.ref();
2216             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
2217             var child_2 = new Xcls_projectsel( _this );
2218             child_2.ref();
2219             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
2220             var child_3 = new Xcls_ticketsel( _this );
2221             child_3.ref();
2222             this.el.attach_defaults (  child_3.el , 1,5,1,2 );
2223             var child_4 = new Xcls_Label61( _this );
2224             child_4.ref();
2225             this.el.attach_defaults (  child_4.el , 0,1,3,4 );
2226             var child_5 = new Xcls_name( _this );
2227             child_5.ref();
2228             this.el.attach_defaults (  child_5.el , 0,4,4,5 );
2229             var child_6 = new Xcls_createbtn( _this );
2230             child_6.ref();
2231             this.el.attach_defaults (  child_6.el , 4,5,4,5 );
2232             var child_7 = new Xcls_Box64( _this );
2233             child_7.ref();
2234             this.el.attach_defaults (  child_7.el , 0,5,2,3 );
2235         }
2236
2237         // user defined functions
2238     }
2239     public class Xcls_Label53 : Object
2240     {
2241         public Gtk.Label el;
2242         private NewBranch  _this;
2243
2244
2245             // my vars (def)
2246
2247         // ctor
2248         public Xcls_Label53(NewBranch _owner )
2249         {
2250             _this = _owner;
2251             this.el = new Gtk.Label( "Project" );
2252
2253             // my vars (dec)
2254
2255             // set gobject values
2256             this.el.halign = Gtk.Align.START;
2257             this.el.justify = Gtk.Justification.RIGHT;
2258             this.el.visible = true;
2259         }
2260
2261         // user defined functions
2262     }
2263
2264     public class Xcls_Label54 : Object
2265     {
2266         public Gtk.Label el;
2267         private NewBranch  _this;
2268
2269
2270             // my vars (def)
2271
2272         // ctor
2273         public Xcls_Label54(NewBranch _owner )
2274         {
2275             _this = _owner;
2276             this.el = new Gtk.Label( "Ticket" );
2277
2278             // my vars (dec)
2279
2280             // set gobject values
2281             this.el.halign = Gtk.Align.START;
2282             this.el.visible = true;
2283         }
2284
2285         // user defined functions
2286     }
2287
2288     public class Xcls_projectsel : Object
2289     {
2290         public Gtk.ComboBox el;
2291         private NewBranch  _this;
2292
2293
2294             // my vars (def)
2295         public bool loading;
2296
2297         // ctor
2298         public Xcls_projectsel(NewBranch _owner )
2299         {
2300             _this = _owner;
2301             _this.projectsel = this;
2302             this.el = new Gtk.ComboBox.with_entry();
2303
2304             // my vars (dec)
2305             this.loading = false;
2306
2307             // set gobject values
2308             var child_0 = new Xcls_prcellrenderer( _this );
2309             child_0.ref();
2310             this.el.pack_start (  child_0.el , true );
2311             var child_1 = new Xcls_prmodel( _this );
2312             child_1.ref();
2313             this.el.set_model (  child_1.el  );
2314
2315             // init method
2316
2317             this.el.set_entry_text_column(1);
2318
2319             //listeners
2320             this.el.changed.connect( () => {
2321                 if (this.loading) {
2322                         return;
2323                 }
2324                 var project_id = this.selectedProjectId();
2325                 _this.dbmodel.loadTickets(project_id);
2326                 
2327                 
2328                 /*if (this.loading) {
2329                         return;
2330                 }
2331                 var ticket_id = this.selectedTicketId();
2332                 
2333                 var name = RooTicket.singleton().usernameLocal();
2334                 
2335                 if (ticket_id == "" || ticket_id == null) {
2336                 
2337                         var dt = new  DateTime.now_local();
2338                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
2339                         return;
2340                 }
2341                 
2342                 
2343                 var ticket = RooTicket.singleton().getById(ticket_id);
2344                
2345                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
2346                 
2347                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
2348                 */
2349             });
2350         }
2351
2352         // user defined functions
2353         public string selectedProjectId () {
2354                 Gtk.TreeIter iter;
2355                 Value val1;
2356          
2357          
2358                 this.el.get_active_iter (out iter);
2359                 _this.prmodel.el.get_value (iter, 0, out val1);
2360          
2361         
2362                 return  (string) val1;
2363                 
2364                 
2365                 
2366                 
2367         }
2368     }
2369     public class Xcls_prcellrenderer : Object
2370     {
2371         public Gtk.CellRendererText el;
2372         private NewBranch  _this;
2373
2374
2375             // my vars (def)
2376
2377         // ctor
2378         public Xcls_prcellrenderer(NewBranch _owner )
2379         {
2380             _this = _owner;
2381             _this.prcellrenderer = this;
2382             this.el = new Gtk.CellRendererText();
2383
2384             // my vars (dec)
2385
2386             // set gobject values
2387         }
2388
2389         // user defined functions
2390     }
2391
2392     public class Xcls_prmodel : Object
2393     {
2394         public Gtk.ListStore el;
2395         private NewBranch  _this;
2396
2397
2398             // my vars (def)
2399
2400         // ctor
2401         public Xcls_prmodel(NewBranch _owner )
2402         {
2403             _this = _owner;
2404             _this.prmodel = this;
2405             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2406
2407             // my vars (dec)
2408
2409             // set gobject values
2410         }
2411
2412         // user defined functions
2413         public void loadProjects (string id) {
2414         
2415         
2416             
2417             _this.projectsel.loading = true;
2418         
2419             this.el.clear();                                    
2420             Gtk.TreeIter iter;
2421             var el = this.el;
2422             
2423             el.append(out iter);
2424         
2425             
2426             el.set_value(iter, 0, "");
2427             el.set_value(iter, 1, "-- select a project --");
2428             if (id == "") {
2429                     _this.projectsel.el.set_active_iter(iter);
2430             }
2431           
2432             foreach(var project in RooProject.projects()) {
2433             
2434                 el.append(out iter);
2435                 
2436                 el.set_value(iter, 0, project.id);
2437                 el.set_value(iter, 1,  project.name );
2438                 if (id == project.id) {
2439                            _this.projectsel.el.set_active_iter(iter);
2440                     }   
2441                 
2442             }
2443             
2444             _this.projectsel.loading = false;
2445              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
2446                                              
2447         }
2448     }
2449
2450
2451     public class Xcls_ticketsel : Object
2452     {
2453         public Gtk.ComboBox el;
2454         private NewBranch  _this;
2455
2456
2457             // my vars (def)
2458         public bool loading;
2459
2460         // ctor
2461         public Xcls_ticketsel(NewBranch _owner )
2462         {
2463             _this = _owner;
2464             _this.ticketsel = this;
2465             this.el = new Gtk.ComboBox.with_entry();
2466
2467             // my vars (dec)
2468             this.loading = false;
2469
2470             // set gobject values
2471             var child_0 = new Xcls_dbcellrenderer( _this );
2472             child_0.ref();
2473             this.el.pack_start (  child_0.el , true );
2474             var child_1 = new Xcls_dbmodel( _this );
2475             child_1.ref();
2476             this.el.set_model (  child_1.el  );
2477
2478             // init method
2479
2480             //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
2481             this.el.set_entry_text_column(1);
2482             this.el.get_child().set_sensitive(false);
2483
2484             //listeners
2485             this.el.changed.connect( () => {
2486                 if (this.loading) {
2487                         return;
2488                 }
2489                 var ticket_id = this.selectedTicketId();
2490                 
2491                 var name = RooTicket.singleton().usernameLocal();
2492                 
2493                 this.el.get_child().get_style_context().remove_class("warning");
2494                 if (ticket_id == "" || ticket_id == null) {
2495                 
2496                         var dt = new  DateTime.now_local();
2497                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
2498                         _this.view.loadTicket("");              
2499                         
2500                         this.el.get_child().get_style_context().add_class("warning");
2501                         _this.createbtn.updateState();
2502                         return;
2503                 }
2504                 
2505                 
2506                 var ticket = RooTicket.singleton().getById(ticket_id);
2507                
2508                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
2509                 _this.scrolled_window.el.show();
2510                  
2511                 _this.view.loadTicket(ticket.id);
2512                 _this.createbtn.updateState();
2513                 
2514                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
2515             });
2516         }
2517
2518         // user defined functions
2519         public string selectedTicketId () {
2520         Gtk.TreeIter iter;
2521                 Value val1;
2522          
2523          
2524                 this.el.get_active_iter (out iter);
2525                 _this.dbmodel.el.get_value (iter, 0, out val1);
2526          
2527         
2528                 return  (string) val1;
2529                 
2530                 
2531                 
2532                 
2533         }
2534     }
2535     public class Xcls_dbcellrenderer : Object
2536     {
2537         public Gtk.CellRendererText el;
2538         private NewBranch  _this;
2539
2540
2541             // my vars (def)
2542
2543         // ctor
2544         public Xcls_dbcellrenderer(NewBranch _owner )
2545         {
2546             _this = _owner;
2547             _this.dbcellrenderer = this;
2548             this.el = new Gtk.CellRendererText();
2549
2550             // my vars (dec)
2551
2552             // set gobject values
2553         }
2554
2555         // user defined functions
2556     }
2557
2558     public class Xcls_dbmodel : Object
2559     {
2560         public Gtk.ListStore el;
2561         private NewBranch  _this;
2562
2563
2564             // my vars (def)
2565
2566         // ctor
2567         public Xcls_dbmodel(NewBranch _owner )
2568         {
2569             _this = _owner;
2570             _this.dbmodel = this;
2571             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
2572
2573             // my vars (dec)
2574
2575             // set gobject values
2576         }
2577
2578         // user defined functions
2579         public void loadTickets (string project_id , string tid = "") {
2580         
2581         
2582             
2583             // fixme .. get project id from selection..
2584             
2585              RooTicket.singleton().loadTickets(
2586                                 project_id,
2587                                 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY :  RooTicket.Who.ME,
2588                                  _this.btn_closed.el.active ? RooTicket.Status.ALL :  RooTicket.Status.ACTIVE
2589                          );
2590                 
2591             _this.ticketsel.loading = true;
2592         
2593             this.el.clear();                                    
2594             Gtk.TreeIter iter;
2595             var el = this.el;
2596             
2597             el.append(out iter);
2598         
2599             
2600             el.set_value(iter, 0, "");
2601             el.set_value(iter, 1, "-- select a ticket --");
2602             
2603             _this.ticketsel.el.set_active_iter(iter);
2604             var tickets = RooTicket.singleton().tickets;
2605             foreach(var ticket in tickets) {
2606             
2607                 el.append(out iter);
2608                 
2609                 el.set_value(iter, 0, ticket.id);
2610                 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
2611                 
2612                 if (ticket.id == tid) {
2613                             _this.ticketsel.el.set_active_iter(iter);
2614                 }
2615                 
2616             }
2617             
2618             _this.ticketsel.loading = false;
2619              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
2620                                              
2621         }
2622     }
2623
2624
2625     public class Xcls_Label61 : Object
2626     {
2627         public Gtk.Label el;
2628         private NewBranch  _this;
2629
2630
2631             // my vars (def)
2632
2633         // ctor
2634         public Xcls_Label61(NewBranch _owner )
2635         {
2636             _this = _owner;
2637             this.el = new Gtk.Label( "Use this as branch name" );
2638
2639             // my vars (dec)
2640
2641             // set gobject values
2642             this.el.halign = Gtk.Align.START;
2643             this.el.justify = Gtk.Justification.RIGHT;
2644             this.el.xalign = 0.900000f;
2645         }
2646
2647         // user defined functions
2648     }
2649
2650     public class Xcls_name : Object
2651     {
2652         public Gtk.Entry el;
2653         private NewBranch  _this;
2654
2655
2656             // my vars (def)
2657
2658         // ctor
2659         public Xcls_name(NewBranch _owner )
2660         {
2661             _this = _owner;
2662             _this.name = this;
2663             this.el = new Gtk.Entry();
2664
2665             // my vars (dec)
2666
2667             // set gobject values
2668             this.el.visible = true;
2669         }
2670
2671         // user defined functions
2672     }
2673
2674     public class Xcls_createbtn : Object
2675     {
2676         public Gtk.Button el;
2677         private NewBranch  _this;
2678
2679
2680             // my vars (def)
2681
2682         // ctor
2683         public Xcls_createbtn(NewBranch _owner )
2684         {
2685             _this = _owner;
2686             _this.createbtn = this;
2687             this.el = new Gtk.Button();
2688
2689             // my vars (dec)
2690
2691             // set gobject values
2692             this.el.label = "Create Branch";
2693
2694             // init method
2695
2696             {
2697                this.el.get_style_context().add_class("suggested-action");
2698             }
2699
2700             //listeners
2701             this.el.clicked.connect( () => {
2702             
2703                 GLib.debug("fire response = 1");
2704                 
2705                 var ticket_id = _this.ticketsel.selectedTicketId();
2706                 
2707                 if (ticket_id == "") {
2708                         _this.ticketsel.el.get_child().get_style_context().add_class("warning");
2709                         return;
2710                 }
2711                  
2712                 _this.el.response(1);
2713             });
2714         }
2715
2716         // user defined functions
2717         public void updateState () {
2718         
2719                 var ticket_id = _this.ticketsel.selectedTicketId();
2720                 
2721                 if (ticket_id == "") {
2722                         this.el.set_sensitive(false);
2723                         return;
2724                 }
2725          
2726                 this.el.set_sensitive(true);
2727          
2728         }
2729     }
2730
2731     public class Xcls_Box64 : Object
2732     {
2733         public Gtk.Box el;
2734         private NewBranch  _this;
2735
2736
2737             // my vars (def)
2738
2739         // ctor
2740         public Xcls_Box64(NewBranch _owner )
2741         {
2742             _this = _owner;
2743             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
2744
2745             // my vars (dec)
2746
2747             // set gobject values
2748             var child_0 = new Xcls_btn_not_me( _this );
2749             child_0.ref();
2750             this.el.add (  child_0.el  );
2751             var child_1 = new Xcls_btn_closed( _this );
2752             child_1.ref();
2753             this.el.add (  child_1.el  );
2754             var child_2 = new Xcls_Label67( _this );
2755             child_2.ref();
2756             this.el.add (  child_2.el  );
2757         }
2758
2759         // user defined functions
2760     }
2761     public class Xcls_btn_not_me : Object
2762     {
2763         public Gtk.CheckButton el;
2764         private NewBranch  _this;
2765
2766
2767             // my vars (def)
2768
2769         // ctor
2770         public Xcls_btn_not_me(NewBranch _owner )
2771         {
2772             _this = _owner;
2773             _this.btn_not_me = this;
2774             this.el = new Gtk.CheckButton();
2775
2776             // my vars (dec)
2777
2778             // set gobject values
2779             this.el.label = "Show tickets not assigned to me";
2780
2781             //listeners
2782             this.el.toggled.connect( () => {
2783                 var project_id = _this.projectsel.selectedProjectId();
2784                 _this.dbmodel.loadTickets(project_id);  
2785             });
2786         }
2787
2788         // user defined functions
2789     }
2790
2791     public class Xcls_btn_closed : Object
2792     {
2793         public Gtk.CheckButton el;
2794         private NewBranch  _this;
2795
2796
2797             // my vars (def)
2798
2799         // ctor
2800         public Xcls_btn_closed(NewBranch _owner )
2801         {
2802             _this = _owner;
2803             _this.btn_closed = this;
2804             this.el = new Gtk.CheckButton();
2805
2806             // my vars (dec)
2807
2808             // set gobject values
2809             this.el.label = "Show closed Tickets";
2810
2811             //listeners
2812             this.el.toggled.connect( () => {
2813                 var project_id = _this.projectsel.selectedProjectId();
2814                 _this.dbmodel.loadTickets(project_id);  
2815                  
2816             });
2817         }
2818
2819         // user defined functions
2820     }
2821
2822     public class Xcls_Label67 : Object
2823     {
2824         public Gtk.Label el;
2825         private NewBranch  _this;
2826
2827
2828             // my vars (def)
2829
2830         // ctor
2831         public Xcls_Label67(NewBranch _owner )
2832         {
2833             _this = _owner;
2834             this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
2835
2836             // my vars (dec)
2837
2838             // set gobject values
2839             this.el.halign = Gtk.Align.END;
2840             this.el.hexpand = true;
2841             this.el.use_markup = true;
2842
2843             //listeners
2844             this.el.activate_link.connect( (uri) => {
2845                 if (uri == "refresh") {
2846                         RooProject.reload();
2847                         var curproj = RooProject.getProjectByRepo(_this.repo);
2848                          _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
2849             
2850                         _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);            
2851                 }
2852                 return true;
2853             });
2854         }
2855
2856         // user defined functions
2857     }
2858
2859
2860
2861
2862
2863 }