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