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_scrolled_window scrolled_window;
16     public Xcls_view view;
17     public Xcls_label_select_ticket label_select_ticket;
18     public Xcls_label_create_ticket label_create_ticket;
19     public Xcls_label_quick_commit label_quick_commit;
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_createbtn createbtn;
28     public Xcls_btn_not_me btn_not_me;
29     public Xcls_btn_closed btn_closed;
30
31         // my vars (def)
32     public GitRepo? repo;
33     public bool running;
34     public Gee.ArrayList<GitMonitorQueue> queue;
35
36     // ctor
37     public NewBranch()
38     {
39         _this = this;
40         this.el = new Gtk.Dialog();
41
42         // my vars (dec)
43         this.repo = null;
44         this.running = false;
45         this.queue = null;
46
47         // set gobject values
48         this.el.title = "Create a working branch ";
49         this.el.default_height = 500;
50         this.el.default_width = 500;
51         this.el.deletable = true;
52         this.el.modal = true;
53         var child_0 = new Xcls_Box2( _this );
54         child_0.ref();
55         this.el.get_content_area().add (  child_0.el  );
56         var child_1 = new Xcls_Notebook5( _this );
57         child_1.ref();
58         this.el.add (  child_1.el  );
59
60         //listeners
61         this.el.delete_event.connect( (self, event) => {
62             this.el.hide();
63             return true; 
64             //test  
65         });
66         this.el.response.connect( (self, response_id) =>  { 
67           
68                 GLib.debug("got %d", (int) response_id);
69                 
70                  
71                 
72                  
73                 // have they selected a ticket..
74                 // make that the current active ticket?
75                 // we really need to store locally what ticket is being worked on..
76                 // in theory we could be working on multiple project and not merging..
77                 // -- each repo would have their active ticket (only one per repo)
78                 // -- so we could just store that in there
79                 // -- initial load can check the contents of the ticket files on first scan.
80         
81                  
82                 if (response_id < 1) {
83                     _this.el.hide();    
84                     this.running = false; 
85                         return;
86                 }
87                 
88                 var ticket_id = _this.ticketsel.selectedTicketId();
89                 
90             if (this.repo != null) {
91                 var bn = _this.name.el.get_text();
92         
93                         var res = this.repo.setActiveTicket(                    
94                                  RooTicket.singleton().getById(ticket_id != "" ? ticket_id : "-1"), bn
95                          );
96                          if (res) {
97                                 // start the monitoring..
98                                  GitMonitor.gitmonitor.start();
99                                  
100                          }
101             }
102              
103         
104             this.running = false; 
105         
106                 this.el.hide();
107                  
108                  
109         
110                  
111         });
112     }
113
114     // user defined functions
115     public   void show ( GitRepo repo, Gee.ArrayList<GitMonitorQueue> queue, string tid = "" ) 
116     {
117          // this.el.set_gravity(Gdk.Gravity.NORTH);
118         if (this.running) { // should not happen!!
119                 GLib.error("new branch show called, when already being displayed?");
120         }
121         this.queue = queue;
122         
123         this.running  = true;
124         GitMonitor.gitmonitor.stop();
125         
126         this.repo = repo;
127         
128          
129         
130         this.el.move((Gdk.Screen.width() / 2)- 250 ,0);
131         this.el.set_default_size( 500,200); // not sure why it grows..
132         GLib.debug("Loading tickets"); 
133          
134     
135         this.el.show_all();
136         this.el.set_keep_above(true);
137        
138         
139         var curproj = RooProject.getProjectByRepo(this.repo);
140          _this.prmodel.loadProjects(curproj == null ? "" : curproj.id);
141         
142         _this.dbmodel.loadTickets(curproj == null ? "": curproj.id, tid);
143         _this.createbtn.updateState();
144         
145         _this.ticketsel.el.get_child().get_style_context().remove_class("warning");
146         if (tid != "") { 
147                 var name = RooTicket.singleton().usernameLocal();
148                 var ticket = RooTicket.singleton().getById(tid);
149                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
150         } else {
151                 _this.ticketsel.el.get_child().get_style_context().add_class("warning");
152         }
153         _this.view.loadTicket(tid);
154         this.el.run();
155     
156     }
157     public class Xcls_Box2 : Object
158     {
159         public Gtk.Box el;
160         private NewBranch  _this;
161
162
163             // my vars (def)
164
165         // ctor
166         public Xcls_Box2(NewBranch _owner )
167         {
168             _this = _owner;
169             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
170
171             // my vars (dec)
172
173             // set gobject values
174             var child_0 = new Xcls_scrolled_window( _this );
175             child_0.ref();
176             this.el.add (  child_0.el  );
177         }
178
179         // user defined functions
180     }
181     public class Xcls_scrolled_window : Object
182     {
183         public Gtk.ScrolledWindow el;
184         private NewBranch  _this;
185
186
187             // my vars (def)
188
189         // ctor
190         public Xcls_scrolled_window(NewBranch _owner )
191         {
192             _this = _owner;
193             _this.scrolled_window = this;
194             this.el = new Gtk.ScrolledWindow( null, null );
195
196             // my vars (dec)
197
198             // set gobject values
199             this.el.height_request = 500;
200             this.el.vexpand = true;
201             var child_0 = new Xcls_view( _this );
202             child_0.ref();
203             this.el.add (  child_0.el  );
204
205             // init method
206
207             {
208                 this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
209             }
210         }
211
212         // user defined functions
213     }
214     public class Xcls_view : Object
215     {
216         public WebKit.WebView el;
217         private NewBranch  _this;
218
219
220             // my vars (def)
221
222         // ctor
223         public Xcls_view(NewBranch _owner )
224         {
225             _this = _owner;
226             _this.view = this;
227             this.el = new WebKit.WebView();
228
229             // my vars (dec)
230
231             // set gobject values
232         }
233
234         // user defined functions
235         public void loadTicket (string tid) {
236                 int h,w;
237                 _this.el.get_size(out w, out h);
238                 
239                 if (tid == "") {
240                         _this.scrolled_window.el.hide();
241                         _this.el.resize(w, 150);
242                 } else {
243                         _this.scrolled_window.el.show();
244                         _this.el.resize(w, 800);
245                 }
246                 
247                 var rs =  RooTicket.singleton();                
248                 var uri = new WebKit.URIRequest("https://roojs.com/admin.php/MTrack/View/" + tid);
249                 var hd = uri.get_http_headers();
250                 var authCode = Base64.encode ("%s:%s".printf(rs.username, rs.password).data);
251                 hd.append("Authorization", "Basic %s".printf(authCode));
252                 
253                  this.el.load_request(uri);
254         }
255     }
256
257
258
259     public class Xcls_Notebook5 : Object
260     {
261         public Gtk.Notebook el;
262         private NewBranch  _this;
263
264
265             // my vars (def)
266
267         // ctor
268         public Xcls_Notebook5(NewBranch _owner )
269         {
270             _this = _owner;
271             this.el = new Gtk.Notebook();
272
273             // my vars (dec)
274
275             // set gobject values
276             this.el.vexpand = true;
277             var child_0 = new Xcls_label_select_ticket( _this );
278             child_0.ref();
279             var child_1 = new Xcls_label_create_ticket( _this );
280             child_1.ref();
281             var child_2 = new Xcls_label_quick_commit( _this );
282             child_2.ref();
283             var child_3 = new Xcls_Box9( _this );
284             child_3.ref();
285             this.el.append_page (  child_3.el , _this.label_select_ticket.el );
286             var child_4 = new Xcls_Box27( _this );
287             child_4.ref();
288             this.el.append_page (  child_4.el , _this.label_create_ticket.el );
289             var child_5 = new Xcls_Box28( _this );
290             child_5.ref();
291             this.el.append_page (  child_5.el , _this.label_quick_commit.el );
292         }
293
294         // user defined functions
295     }
296     public class Xcls_label_select_ticket : Object
297     {
298         public Gtk.Label el;
299         private NewBranch  _this;
300
301
302             // my vars (def)
303
304         // ctor
305         public Xcls_label_select_ticket(NewBranch _owner )
306         {
307             _this = _owner;
308             _this.label_select_ticket = this;
309             this.el = new Gtk.Label( "Select Existing Ticket to work on" );
310
311             // my vars (dec)
312
313             // set gobject values
314         }
315
316         // user defined functions
317     }
318
319     public class Xcls_label_create_ticket : Object
320     {
321         public Gtk.Label el;
322         private NewBranch  _this;
323
324
325             // my vars (def)
326
327         // ctor
328         public Xcls_label_create_ticket(NewBranch _owner )
329         {
330             _this = _owner;
331             _this.label_create_ticket = this;
332             this.el = new Gtk.Label( "Create a new Ticket" );
333
334             // my vars (dec)
335
336             // set gobject values
337         }
338
339         // user defined functions
340     }
341
342     public class Xcls_label_quick_commit : Object
343     {
344         public Gtk.Label el;
345         private NewBranch  _this;
346
347
348             // my vars (def)
349
350         // ctor
351         public Xcls_label_quick_commit(NewBranch _owner )
352         {
353             _this = _owner;
354             _this.label_quick_commit = this;
355             this.el = new Gtk.Label( "Quick Commit" );
356
357             // my vars (dec)
358
359             // set gobject values
360         }
361
362         // user defined functions
363     }
364
365     public class Xcls_Box9 : Object
366     {
367         public Gtk.Box el;
368         private NewBranch  _this;
369
370
371             // my vars (def)
372
373         // ctor
374         public Xcls_Box9(NewBranch _owner )
375         {
376             _this = _owner;
377             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
378
379             // my vars (dec)
380
381             // set gobject values
382             this.el.homogeneous = false;
383             var child_0 = new Xcls_Table10( _this );
384             child_0.ref();
385             this.el.pack_start (  child_0.el , false,false,0 );
386         }
387
388         // user defined functions
389     }
390     public class Xcls_Table10 : Object
391     {
392         public Gtk.Table el;
393         private NewBranch  _this;
394
395
396             // my vars (def)
397
398         // ctor
399         public Xcls_Table10(NewBranch _owner )
400         {
401             _this = _owner;
402             this.el = new Gtk.Table( 5, 5, true );
403
404             // my vars (dec)
405
406             // set gobject values
407             this.el.expand = false;
408             this.el.margin = 2;
409             this.el.column_spacing = 4;
410             this.el.vexpand = false;
411             var child_0 = new Xcls_Label11( _this );
412             child_0.ref();
413             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
414             var child_1 = new Xcls_Label12( _this );
415             child_1.ref();
416             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
417             var child_2 = new Xcls_projectsel( _this );
418             child_2.ref();
419             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
420             var child_3 = new Xcls_ticketsel( _this );
421             child_3.ref();
422             this.el.attach_defaults (  child_3.el , 1,4,1,2 );
423             var child_4 = new Xcls_Button19( _this );
424             child_4.ref();
425             this.el.attach_defaults (  child_4.el , 4,5,1,2 );
426             var child_5 = new Xcls_Label20( _this );
427             child_5.ref();
428             this.el.attach_defaults (  child_5.el , 0,1,3,4 );
429             var child_6 = new Xcls_name( _this );
430             child_6.ref();
431             this.el.attach_defaults (  child_6.el , 0,4,4,5 );
432             var child_7 = new Xcls_createbtn( _this );
433             child_7.ref();
434             this.el.attach_defaults (  child_7.el , 4,5,4,5 );
435             var child_8 = new Xcls_Box23( _this );
436             child_8.ref();
437             this.el.attach_defaults (  child_8.el , 0,5,2,3 );
438         }
439
440         // user defined functions
441     }
442     public class Xcls_Label11 : Object
443     {
444         public Gtk.Label el;
445         private NewBranch  _this;
446
447
448             // my vars (def)
449
450         // ctor
451         public Xcls_Label11(NewBranch _owner )
452         {
453             _this = _owner;
454             this.el = new Gtk.Label( "Project" );
455
456             // my vars (dec)
457
458             // set gobject values
459             this.el.halign = Gtk.Align.START;
460             this.el.justify = Gtk.Justification.RIGHT;
461             this.el.visible = true;
462         }
463
464         // user defined functions
465     }
466
467     public class Xcls_Label12 : Object
468     {
469         public Gtk.Label el;
470         private NewBranch  _this;
471
472
473             // my vars (def)
474
475         // ctor
476         public Xcls_Label12(NewBranch _owner )
477         {
478             _this = _owner;
479             this.el = new Gtk.Label( "Ticket" );
480
481             // my vars (dec)
482
483             // set gobject values
484             this.el.halign = Gtk.Align.START;
485             this.el.visible = true;
486         }
487
488         // user defined functions
489     }
490
491     public class Xcls_projectsel : Object
492     {
493         public Gtk.ComboBox el;
494         private NewBranch  _this;
495
496
497             // my vars (def)
498         public bool loading;
499
500         // ctor
501         public Xcls_projectsel(NewBranch _owner )
502         {
503             _this = _owner;
504             _this.projectsel = this;
505             this.el = new Gtk.ComboBox.with_entry();
506
507             // my vars (dec)
508             this.loading = false;
509
510             // set gobject values
511             var child_0 = new Xcls_prcellrenderer( _this );
512             child_0.ref();
513             this.el.pack_start (  child_0.el , true );
514             var child_1 = new Xcls_prmodel( _this );
515             child_1.ref();
516             this.el.set_model (  child_1.el  );
517
518             // init method
519
520             this.el.set_entry_text_column(1);
521
522             //listeners
523             this.el.changed.connect( () => {
524                 if (this.loading) {
525                         return;
526                 }
527                 var project_id = this.selectedProjectId();
528                 _this.dbmodel.loadTickets(project_id);
529                 
530                 
531                 /*if (this.loading) {
532                         return;
533                 }
534                 var ticket_id = this.selectedTicketId();
535                 
536                 var name = RooTicket.singleton().usernameLocal();
537                 
538                 if (ticket_id == "" || ticket_id == null) {
539                 
540                         var dt = new  DateTime.now_local();
541                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
542                         return;
543                 }
544                 
545                 
546                 var ticket = RooTicket.singleton().getById(ticket_id);
547                
548                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
549                 
550                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
551                 */
552             });
553         }
554
555         // user defined functions
556         public string selectedProjectId () {
557                 Gtk.TreeIter iter;
558                 Value val1;
559          
560          
561                 this.el.get_active_iter (out iter);
562                 _this.prmodel.el.get_value (iter, 0, out val1);
563          
564         
565                 return  (string) val1;
566                 
567                 
568                 
569                 
570         }
571     }
572     public class Xcls_prcellrenderer : Object
573     {
574         public Gtk.CellRendererText el;
575         private NewBranch  _this;
576
577
578             // my vars (def)
579
580         // ctor
581         public Xcls_prcellrenderer(NewBranch _owner )
582         {
583             _this = _owner;
584             _this.prcellrenderer = this;
585             this.el = new Gtk.CellRendererText();
586
587             // my vars (dec)
588
589             // set gobject values
590         }
591
592         // user defined functions
593     }
594
595     public class Xcls_prmodel : Object
596     {
597         public Gtk.ListStore el;
598         private NewBranch  _this;
599
600
601             // my vars (def)
602
603         // ctor
604         public Xcls_prmodel(NewBranch _owner )
605         {
606             _this = _owner;
607             _this.prmodel = this;
608             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
609
610             // my vars (dec)
611
612             // set gobject values
613         }
614
615         // user defined functions
616         public void loadProjects (string id) {
617         
618         
619             
620             _this.projectsel.loading = true;
621         
622             this.el.clear();                                    
623             Gtk.TreeIter iter;
624             var el = this.el;
625             
626             el.append(out iter);
627         
628             
629             el.set_value(iter, 0, "");
630             el.set_value(iter, 1, "-- select a project --");
631             if (id == "") {
632                     _this.projectsel.el.set_active_iter(iter);
633             }
634           
635             foreach(var project in RooProject.projects()) {
636             
637                 el.append(out iter);
638                 
639                 el.set_value(iter, 0, project.id);
640                 el.set_value(iter, 1,  project.name );
641                 if (id == project.id) {
642                            _this.projectsel.el.set_active_iter(iter);
643                     }   
644                 
645             }
646             
647             _this.projectsel.loading = false;
648              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
649                                              
650         }
651     }
652
653
654     public class Xcls_ticketsel : Object
655     {
656         public Gtk.ComboBox el;
657         private NewBranch  _this;
658
659
660             // my vars (def)
661         public bool loading;
662
663         // ctor
664         public Xcls_ticketsel(NewBranch _owner )
665         {
666             _this = _owner;
667             _this.ticketsel = this;
668             this.el = new Gtk.ComboBox.with_entry();
669
670             // my vars (dec)
671             this.loading = false;
672
673             // set gobject values
674             var child_0 = new Xcls_dbcellrenderer( _this );
675             child_0.ref();
676             this.el.pack_start (  child_0.el , true );
677             var child_1 = new Xcls_dbmodel( _this );
678             child_1.ref();
679             this.el.set_model (  child_1.el  );
680
681             // init method
682
683             //this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
684             this.el.set_entry_text_column(1);
685             this.el.get_child().set_sensitive(false);
686
687             //listeners
688             this.el.changed.connect( () => {
689                 if (this.loading) {
690                         return;
691                 }
692                 var ticket_id = this.selectedTicketId();
693                 
694                 var name = RooTicket.singleton().usernameLocal();
695                 
696                 this.el.get_child().get_style_context().remove_class("warning");
697                 if (ticket_id == "" || ticket_id == null) {
698                 
699                         var dt = new  DateTime.now_local();
700                         _this.name.el.set_text("wip_%s_%s".printf(name,dt.format("%Y_%b_%d")));
701                         _this.view.loadTicket("");              
702                         
703                         this.el.get_child().get_style_context().add_class("warning");
704                         _this.createbtn.updateState();
705                         return;
706                 }
707                 
708                 
709                 var ticket = RooTicket.singleton().getById(ticket_id);
710                
711                 _this.name.el.set_text("wip_%s_T%s_%s".printf(name,ticket.id, ticket.summaryToBranchName()));
712                 _this.scrolled_window.el.show();
713                  
714                 _this.view.loadTicket(ticket.id);
715                 _this.createbtn.updateState();
716                 
717                 //GLib.debug (//"Selection: %s, %s\n", (string) val1, (string) val2);
718             });
719         }
720
721         // user defined functions
722         public string selectedTicketId () {
723         Gtk.TreeIter iter;
724                 Value val1;
725          
726          
727                 this.el.get_active_iter (out iter);
728                 _this.dbmodel.el.get_value (iter, 0, out val1);
729          
730         
731                 return  (string) val1;
732                 
733                 
734                 
735                 
736         }
737     }
738     public class Xcls_dbcellrenderer : Object
739     {
740         public Gtk.CellRendererText el;
741         private NewBranch  _this;
742
743
744             // my vars (def)
745
746         // ctor
747         public Xcls_dbcellrenderer(NewBranch _owner )
748         {
749             _this = _owner;
750             _this.dbcellrenderer = this;
751             this.el = new Gtk.CellRendererText();
752
753             // my vars (dec)
754
755             // set gobject values
756         }
757
758         // user defined functions
759     }
760
761     public class Xcls_dbmodel : Object
762     {
763         public Gtk.ListStore el;
764         private NewBranch  _this;
765
766
767             // my vars (def)
768
769         // ctor
770         public Xcls_dbmodel(NewBranch _owner )
771         {
772             _this = _owner;
773             _this.dbmodel = this;
774             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
775
776             // my vars (dec)
777
778             // set gobject values
779         }
780
781         // user defined functions
782         public void loadTickets (string project_id , string tid = "") {
783         
784         
785             
786             // fixme .. get project id from selection..
787             
788              RooTicket.singleton().loadTickets(
789                                 project_id,
790                                 _this.btn_not_me.el.active ? RooTicket.Who.ANYBODY :  RooTicket.Who.ME,
791                                  _this.btn_closed.el.active ? RooTicket.Status.ALL :  RooTicket.Status.ACTIVE
792                          );
793                 
794             _this.ticketsel.loading = true;
795         
796             this.el.clear();                                    
797             Gtk.TreeIter iter;
798             var el = this.el;
799             
800             el.append(out iter);
801         
802             
803             el.set_value(iter, 0, "");
804             el.set_value(iter, 1, "-- select a ticket --");
805             
806             _this.ticketsel.el.set_active_iter(iter);
807             var tickets = RooTicket.singleton().tickets;
808             foreach(var ticket in tickets) {
809             
810                 el.append(out iter);
811                 
812                 el.set_value(iter, 0, ticket.id);
813                 el.set_value(iter, 1, "#%s %s".printf( ticket.id, ticket.summary));
814                 
815                 if (ticket.id == tid) {
816                             _this.ticketsel.el.set_active_iter(iter);
817                 }
818                 
819             }
820             
821             _this.ticketsel.loading = false;
822              //this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
823                                              
824         }
825     }
826
827
828     public class Xcls_Button19 : Object
829     {
830         public Gtk.Button el;
831         private NewBranch  _this;
832
833
834             // my vars (def)
835
836         // ctor
837         public Xcls_Button19(NewBranch _owner )
838         {
839             _this = _owner;
840             this.el = new Gtk.Button();
841
842             // my vars (dec)
843
844             // set gobject values
845             this.el.expand = false;
846             this.el.label = "New Ticket";
847
848             //listeners
849             this.el.clicked.connect( () => {
850                 _this.el.response(-1);
851                 Ticket.singleton().show(_this.repo);
852             
853             });
854         }
855
856         // user defined functions
857     }
858
859     public class Xcls_Label20 : Object
860     {
861         public Gtk.Label el;
862         private NewBranch  _this;
863
864
865             // my vars (def)
866
867         // ctor
868         public Xcls_Label20(NewBranch _owner )
869         {
870             _this = _owner;
871             this.el = new Gtk.Label( "Use this as branch name" );
872
873             // my vars (dec)
874
875             // set gobject values
876             this.el.halign = Gtk.Align.START;
877             this.el.justify = Gtk.Justification.RIGHT;
878             this.el.xalign = 0.900000f;
879         }
880
881         // user defined functions
882     }
883
884     public class Xcls_name : Object
885     {
886         public Gtk.Entry el;
887         private NewBranch  _this;
888
889
890             // my vars (def)
891
892         // ctor
893         public Xcls_name(NewBranch _owner )
894         {
895             _this = _owner;
896             _this.name = this;
897             this.el = new Gtk.Entry();
898
899             // my vars (dec)
900
901             // set gobject values
902             this.el.visible = true;
903         }
904
905         // user defined functions
906     }
907
908     public class Xcls_createbtn : Object
909     {
910         public Gtk.Button el;
911         private NewBranch  _this;
912
913
914             // my vars (def)
915
916         // ctor
917         public Xcls_createbtn(NewBranch _owner )
918         {
919             _this = _owner;
920             _this.createbtn = this;
921             this.el = new Gtk.Button();
922
923             // my vars (dec)
924
925             // set gobject values
926             this.el.label = "Create Branch";
927
928             // init method
929
930             {
931                this.el.get_style_context().add_class("suggested-action");
932             }
933
934             //listeners
935             this.el.clicked.connect( () => {
936             
937                 GLib.debug("fire response = 1");
938                 
939                 var ticket_id = _this.ticketsel.selectedTicketId();
940                 
941                 if (ticket_id == "") {
942                         _this.ticketsel.el.get_child().get_style_context().add_class("warning");
943                         return;
944                 }
945                  
946                 _this.el.response(1);
947             });
948         }
949
950         // user defined functions
951         public void updateState () {
952         
953                 var ticket_id = _this.ticketsel.selectedTicketId();
954                 
955                 if (ticket_id == "") {
956                         this.el.set_sensitive(false);
957                         return;
958                 }
959          
960                 this.el.set_sensitive(true);
961          
962         }
963     }
964
965     public class Xcls_Box23 : Object
966     {
967         public Gtk.Box el;
968         private NewBranch  _this;
969
970
971             // my vars (def)
972
973         // ctor
974         public Xcls_Box23(NewBranch _owner )
975         {
976             _this = _owner;
977             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
978
979             // my vars (dec)
980
981             // set gobject values
982             var child_0 = new Xcls_btn_not_me( _this );
983             child_0.ref();
984             this.el.add (  child_0.el  );
985             var child_1 = new Xcls_btn_closed( _this );
986             child_1.ref();
987             this.el.add (  child_1.el  );
988             var child_2 = new Xcls_Label26( _this );
989             child_2.ref();
990             this.el.add (  child_2.el  );
991         }
992
993         // user defined functions
994     }
995     public class Xcls_btn_not_me : Object
996     {
997         public Gtk.CheckButton el;
998         private NewBranch  _this;
999
1000
1001             // my vars (def)
1002
1003         // ctor
1004         public Xcls_btn_not_me(NewBranch _owner )
1005         {
1006             _this = _owner;
1007             _this.btn_not_me = this;
1008             this.el = new Gtk.CheckButton();
1009
1010             // my vars (dec)
1011
1012             // set gobject values
1013             this.el.label = "Show tickets not assigned to me";
1014
1015             //listeners
1016             this.el.toggled.connect( () => {
1017                 var project_id = _this.projectsel.selectedProjectId();
1018                 _this.dbmodel.loadTickets(project_id);  
1019             });
1020         }
1021
1022         // user defined functions
1023     }
1024
1025     public class Xcls_btn_closed : Object
1026     {
1027         public Gtk.CheckButton el;
1028         private NewBranch  _this;
1029
1030
1031             // my vars (def)
1032
1033         // ctor
1034         public Xcls_btn_closed(NewBranch _owner )
1035         {
1036             _this = _owner;
1037             _this.btn_closed = this;
1038             this.el = new Gtk.CheckButton();
1039
1040             // my vars (dec)
1041
1042             // set gobject values
1043             this.el.label = "Show closed Tickets";
1044
1045             //listeners
1046             this.el.toggled.connect( () => {
1047                 var project_id = _this.projectsel.selectedProjectId();
1048                 _this.dbmodel.loadTickets(project_id);  
1049                  
1050             });
1051         }
1052
1053         // user defined functions
1054     }
1055
1056     public class Xcls_Label26 : Object
1057     {
1058         public Gtk.Label el;
1059         private NewBranch  _this;
1060
1061
1062             // my vars (def)
1063
1064         // ctor
1065         public Xcls_Label26(NewBranch _owner )
1066         {
1067             _this = _owner;
1068             this.el = new Gtk.Label( "<a href=\"refresh\">Refresh Ticket list</a>" );
1069
1070             // my vars (dec)
1071
1072             // set gobject values
1073             this.el.halign = Gtk.Align.END;
1074             this.el.hexpand = true;
1075             this.el.use_markup = true;
1076
1077             //listeners
1078             this.el.activate_link.connect( (uri) => {
1079                 if (uri == "refresh") {
1080                         RooProject.reload();
1081                         var curproj = RooProject.getProjectByRepo(_this.repo);
1082                          _this.prmodel.loadProjects(curproj == null ? "": curproj.id);
1083             
1084                         _this.dbmodel.loadTickets(curproj == null ? "": curproj.id);            
1085                 }
1086                 return true;
1087             });
1088         }
1089
1090         // user defined functions
1091     }
1092
1093
1094
1095
1096     public class Xcls_Box27 : Object
1097     {
1098         public Gtk.Box el;
1099         private NewBranch  _this;
1100
1101
1102             // my vars (def)
1103
1104         // ctor
1105         public Xcls_Box27(NewBranch _owner )
1106         {
1107             _this = _owner;
1108             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1109
1110             // my vars (dec)
1111
1112             // set gobject values
1113             this.el.homogeneous = false;
1114         }
1115
1116         // user defined functions
1117     }
1118
1119     public class Xcls_Box28 : Object
1120     {
1121         public Gtk.Box el;
1122         private NewBranch  _this;
1123
1124
1125             // my vars (def)
1126
1127         // ctor
1128         public Xcls_Box28(NewBranch _owner )
1129         {
1130             _this = _owner;
1131             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
1132
1133             // my vars (dec)
1134
1135             // set gobject values
1136             this.el.homogeneous = false;
1137         }
1138
1139         // user defined functions
1140     }
1141
1142
1143 }