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