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