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