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