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