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