RepoStatusPopover.bjs
[gitlive] / RepoStatusPopover.vala
1 static Xcls_RooProjectSettings  _RooProjectSettings;
2
3 public class Xcls_RooProjectSettings : Object
4 {
5     public Gtk.Popover el;
6     private Xcls_RooProjectSettings  _this;
7
8     public static Xcls_RooProjectSettings singleton()
9     {
10         if (_RooProjectSettings == null) {
11             _RooProjectSettings= new Xcls_RooProjectSettings();
12         }
13         return _RooProjectSettings;
14     }
15     public Xcls_label_status label_status;
16     public Xcls_label_diff label_diff;
17     public Xcls_view view;
18     public Xcls_view view;
19
20         // my vars (def)
21     public signal void buttonPressed (string btn);
22     public Project.Project project;
23
24     // ctor
25     public Xcls_RooProjectSettings()
26     {
27         _this = this;
28         this.el = new Gtk.Popover( null );
29
30         // my vars (dec)
31
32         // set gobject values
33         this.el.border_width = 0;
34         this.el.modal = true;
35         this.el.position = Gtk.PositionType.RIGHT;
36         var child_0 = new Xcls_Box2( _this );
37         child_0.ref();
38         this.el.add (  child_0.el  );
39     }
40
41     // user defined functions
42     public void show (Gtk.Widget btn, GitRepo repo) {
43         _this.repo = repo;
44         // get the active project.
45          var lm = Gtk.SourceLanguageManager.get_default();
46                     
47     //    ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
48       //      lm.get_language("html")
49      //   );
50       
51         //print (project.fn);
52         //project.runhtml = project.runhtml || '';
53         _this.view.el.get_buffer().set_text("diff goes here");
54         
55           
56           
57         _this.rootURL.el.set_text( _this.project.rootURL );
58         
59         _this.html_gen_model.loadData(_this.project.html_gen);
60     
61         _this.base_template_model.loadData();
62         
63          var js = _this.project;
64         _this.database_DBTYPE.el.set_text(     js.get_string_member("DBTYPE") );
65         _this.database_DBNAME.el.set_text(    js.get_string_member("DBNAME") );
66         _this.database_DBUSERNAME.el.set_text(    js.get_string_member("DBUSERNAME") );
67         _this.database_DBPASSWORD.el.set_text(    js.get_string_member("DBPASSWORD") );
68         
69                 //console.log('show all');
70         this.el.set_modal(true);
71         this.el.set_relative_to(btn);
72     
73         this.el.set_position(Gtk.PositionType.RIGHT);
74     
75         // window + header?
76          print("SHOWALL - POPIP\n");
77         this.el.show_all();
78         this.el.set_size_request(800,500);
79         this.view.el.grab_focus();
80         
81         
82         //this.el.show_all();
83     }
84     public class Xcls_Box2 : Object
85     {
86         public Gtk.Box el;
87         private Xcls_RooProjectSettings  _this;
88
89
90             // my vars (def)
91
92         // ctor
93         public Xcls_Box2(Xcls_RooProjectSettings _owner )
94         {
95             _this = _owner;
96             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
97
98             // my vars (dec)
99
100             // set gobject values
101             this.el.homogeneous = false;
102             this.el.border_width = 5;
103             var child_0 = new Xcls_Notebook3( _this );
104             child_0.ref();
105             this.el.pack_start (  child_0.el , true,true,0 );
106             var child_1 = new Xcls_Box12( _this );
107             child_1.ref();
108             this.el.pack_end (  child_1.el , false,false,0 );
109         }
110
111         // user defined functions
112     }
113     public class Xcls_Notebook3 : Object
114     {
115         public Gtk.Notebook el;
116         private Xcls_RooProjectSettings  _this;
117
118
119             // my vars (def)
120
121         // ctor
122         public Xcls_Notebook3(Xcls_RooProjectSettings _owner )
123         {
124             _this = _owner;
125             this.el = new Gtk.Notebook();
126
127             // my vars (dec)
128
129             // set gobject values
130             var child_0 = new Xcls_label_status( _this );
131             child_0.ref();
132             var child_1 = new Xcls_label_diff( _this );
133             child_1.ref();
134             var child_2 = new Xcls_Box6( _this );
135             child_2.ref();
136             this.el.append_page (  child_2.el , _this.label_status.el );
137             var child_3 = new Xcls_Box9( _this );
138             child_3.ref();
139             this.el.append_page (  child_3.el , _this.label_diff.el );
140         }
141
142         // user defined functions
143     }
144     public class Xcls_label_status : Object
145     {
146         public Gtk.Label el;
147         private Xcls_RooProjectSettings  _this;
148
149
150             // my vars (def)
151
152         // ctor
153         public Xcls_label_status(Xcls_RooProjectSettings _owner )
154         {
155             _this = _owner;
156             _this.label_status = this;
157             this.el = new Gtk.Label( "Status" );
158
159             // my vars (dec)
160
161             // set gobject values
162         }
163
164         // user defined functions
165     }
166
167     public class Xcls_label_diff : Object
168     {
169         public Gtk.Label el;
170         private Xcls_RooProjectSettings  _this;
171
172
173             // my vars (def)
174
175         // ctor
176         public Xcls_label_diff(Xcls_RooProjectSettings _owner )
177         {
178             _this = _owner;
179             _this.label_diff = this;
180             this.el = new Gtk.Label( "Diff" );
181
182             // my vars (dec)
183
184             // set gobject values
185         }
186
187         // user defined functions
188     }
189
190     public class Xcls_Box6 : Object
191     {
192         public Gtk.Box el;
193         private Xcls_RooProjectSettings  _this;
194
195
196             // my vars (def)
197
198         // ctor
199         public Xcls_Box6(Xcls_RooProjectSettings _owner )
200         {
201             _this = _owner;
202             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
203
204             // my vars (dec)
205
206             // set gobject values
207             this.el.homogeneous = false;
208             var child_0 = new Xcls_ScrolledWindow7( _this );
209             child_0.ref();
210             this.el.pack_start (  child_0.el , true,true,0 );
211         }
212
213         // user defined functions
214     }
215     public class Xcls_ScrolledWindow7 : Object
216     {
217         public Gtk.ScrolledWindow el;
218         private Xcls_RooProjectSettings  _this;
219
220
221             // my vars (def)
222
223         // ctor
224         public Xcls_ScrolledWindow7(Xcls_RooProjectSettings _owner )
225         {
226             _this = _owner;
227             this.el = new Gtk.ScrolledWindow( null, null );
228
229             // my vars (dec)
230
231             // set gobject values
232             var child_0 = new Xcls_view( _this );
233             child_0.ref();
234             this.el.add (  child_0.el  );
235         }
236
237         // user defined functions
238     }
239     public class Xcls_view : Object
240     {
241         public Gtk.SourceView el;
242         private Xcls_RooProjectSettings  _this;
243
244
245             // my vars (def)
246
247         // ctor
248         public Xcls_view(Xcls_RooProjectSettings _owner )
249         {
250             _this = _owner;
251             _this.view = this;
252             this.el = new Gtk.SourceView();
253
254             // my vars (dec)
255
256             // init method
257
258             var description =   Pango.FontDescription.from_string("monospace");
259                 description.set_size(9000);
260                 this.el.override_font(description);
261
262             //listeners
263             this.el.key_release_event.connect( ( event) =>{
264                 if (event.keyval != 115) {
265                     return false;
266                      
267                 }
268                 if   ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
269                     return false;
270                 }
271                  var buf =    this.el.get_buffer();
272                 Gtk.TextIter s;
273                 Gtk.TextIter e;
274                 buf.get_start_iter(out s);
275                 buf.get_end_iter(out e);
276                 _this.project.runhtml = buf.get_text(s,e,true);
277                 
278                       
279                 _this.buttonPressed("save");
280                  
281                 return false;
282                      
283             });
284         }
285
286         // user defined functions
287     }
288
289
290
291     public class Xcls_Box9 : Object
292     {
293         public Gtk.Box el;
294         private Xcls_RooProjectSettings  _this;
295
296
297             // my vars (def)
298
299         // ctor
300         public Xcls_Box9(Xcls_RooProjectSettings _owner )
301         {
302             _this = _owner;
303             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
304
305             // my vars (dec)
306
307             // set gobject values
308             this.el.homogeneous = false;
309             var child_0 = new Xcls_ScrolledWindow10( _this );
310             child_0.ref();
311             this.el.pack_start (  child_0.el , true,true,0 );
312         }
313
314         // user defined functions
315     }
316     public class Xcls_ScrolledWindow10 : Object
317     {
318         public Gtk.ScrolledWindow el;
319         private Xcls_RooProjectSettings  _this;
320
321
322             // my vars (def)
323
324         // ctor
325         public Xcls_ScrolledWindow10(Xcls_RooProjectSettings _owner )
326         {
327             _this = _owner;
328             this.el = new Gtk.ScrolledWindow( null, null );
329
330             // my vars (dec)
331
332             // set gobject values
333             var child_0 = new Xcls_view( _this );
334             child_0.ref();
335             this.el.add (  child_0.el  );
336         }
337
338         // user defined functions
339     }
340     public class Xcls_view : Object
341     {
342         public Gtk.SourceView el;
343         private Xcls_RooProjectSettings  _this;
344
345
346             // my vars (def)
347
348         // ctor
349         public Xcls_view(Xcls_RooProjectSettings _owner )
350         {
351             _this = _owner;
352             _this.view = this;
353             this.el = new Gtk.SourceView();
354
355             // my vars (dec)
356
357             // init method
358
359             var description =   Pango.FontDescription.from_string("monospace");
360                 description.set_size(9000);
361                 this.el.override_font(description);
362
363             //listeners
364             this.el.key_release_event.connect( ( event) =>{
365                 if (event.keyval != 115) {
366                     return false;
367                      
368                 }
369                 if   ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
370                     return false;
371                 }
372                  var buf =    this.el.get_buffer();
373                 Gtk.TextIter s;
374                 Gtk.TextIter e;
375                 buf.get_start_iter(out s);
376                 buf.get_end_iter(out e);
377                 _this.project.runhtml = buf.get_text(s,e,true);
378                 
379                       
380                 _this.buttonPressed("save");
381                  
382                 return false;
383                      
384             });
385         }
386
387         // user defined functions
388     }
389
390
391
392
393     public class Xcls_Box12 : Object
394     {
395         public Gtk.Box el;
396         private Xcls_RooProjectSettings  _this;
397
398
399             // my vars (def)
400
401         // ctor
402         public Xcls_Box12(Xcls_RooProjectSettings _owner )
403         {
404             _this = _owner;
405             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
406
407             // my vars (dec)
408
409             // set gobject values
410             this.el.homogeneous = true;
411             this.el.expand = false;
412             this.el.vexpand = false;
413             var child_0 = new Xcls_Button13( _this );
414             child_0.ref();
415             this.el.add (  child_0.el  );
416             var child_1 = new Xcls_Button14( _this );
417             child_1.ref();
418             this.el.add (  child_1.el  );
419             var child_2 = new Xcls_Button15( _this );
420             child_2.ref();
421             this.el.add (  child_2.el  );
422         }
423
424         // user defined functions
425     }
426     public class Xcls_Button13 : Object
427     {
428         public Gtk.Button el;
429         private Xcls_RooProjectSettings  _this;
430
431
432             // my vars (def)
433
434         // ctor
435         public Xcls_Button13(Xcls_RooProjectSettings _owner )
436         {
437             _this = _owner;
438             this.el = new Gtk.Button();
439
440             // my vars (dec)
441
442             // set gobject values
443             this.el.label = "Stash Changes";
444
445             //listeners
446             this.el.button_press_event.connect( () => {
447                     _this.el.hide();
448                     return false;
449             });
450         }
451
452         // user defined functions
453     }
454
455     public class Xcls_Button14 : Object
456     {
457         public Gtk.Button el;
458         private Xcls_RooProjectSettings  _this;
459
460
461             // my vars (def)
462
463         // ctor
464         public Xcls_Button14(Xcls_RooProjectSettings _owner )
465         {
466             _this = _owner;
467             this.el = new Gtk.Button();
468
469             // my vars (dec)
470
471             // set gobject values
472             this.el.label = "Commit Changes";
473
474             //listeners
475             this.el.button_press_event.connect( () => {
476                      _this.el.hide();
477                     return false;
478             });
479         }
480
481         // user defined functions
482     }
483
484     public class Xcls_Button15 : Object
485     {
486         public Gtk.Button el;
487         private Xcls_RooProjectSettings  _this;
488
489
490             // my vars (def)
491
492         // ctor
493         public Xcls_Button15(Xcls_RooProjectSettings _owner )
494         {
495             _this = _owner;
496             this.el = new Gtk.Button();
497
498             // my vars (dec)
499
500             // set gobject values
501             this.el.label = "Ignore or now";
502
503             //listeners
504             this.el.button_press_event.connect( () => {
505                    _this.el.hide();
506                     return false;
507             });
508         }
509
510         // user defined functions
511     }
512
513
514
515 }