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