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