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