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