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