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