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