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