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