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