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