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