Changed RepoStatusPopover.bjsRepoStatusPopover.vala
[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             var child_2 = new Xcls_Button18( _this );
96             child_2.ref();
97             this.el.add (  child_2.el  );
98             var child_3 = new Xcls_Button19( _this );
99             child_3.ref();
100             this.el.add (  child_3.el  );
101         }
102
103         // user defined functions
104     }
105     public class Xcls_Notebook3 : Object
106     {
107         public Gtk.Notebook el;
108         private RepoStatusPopover  _this;
109
110
111             // my vars (def)
112
113         // ctor
114         public Xcls_Notebook3(RepoStatusPopover _owner )
115         {
116             _this = _owner;
117             this.el = new Gtk.Notebook();
118
119             // my vars (dec)
120
121             // set gobject values
122             var child_0 = new Xcls_label_status( _this );
123             child_0.ref();
124             var child_1 = new Xcls_label_diff( _this );
125             child_1.ref();
126             var child_2 = new Xcls_Box6( _this );
127             child_2.ref();
128             this.el.append_page (  child_2.el , _this.label_status.el );
129             var child_3 = new Xcls_Box9( _this );
130             child_3.ref();
131             this.el.append_page (  child_3.el , _this.label_diff.el );
132         }
133
134         // user defined functions
135     }
136     public class Xcls_label_status : Object
137     {
138         public Gtk.Label el;
139         private RepoStatusPopover  _this;
140
141
142             // my vars (def)
143
144         // ctor
145         public Xcls_label_status(RepoStatusPopover _owner )
146         {
147             _this = _owner;
148             _this.label_status = this;
149             this.el = new Gtk.Label( "Status" );
150
151             // my vars (dec)
152
153             // set gobject values
154         }
155
156         // user defined functions
157     }
158
159     public class Xcls_label_diff : Object
160     {
161         public Gtk.Label el;
162         private RepoStatusPopover  _this;
163
164
165             // my vars (def)
166
167         // ctor
168         public Xcls_label_diff(RepoStatusPopover _owner )
169         {
170             _this = _owner;
171             _this.label_diff = this;
172             this.el = new Gtk.Label( "Diff" );
173
174             // my vars (dec)
175
176             // set gobject values
177         }
178
179         // user defined functions
180     }
181
182     public class Xcls_Box6 : Object
183     {
184         public Gtk.Box el;
185         private RepoStatusPopover  _this;
186
187
188             // my vars (def)
189
190         // ctor
191         public Xcls_Box6(RepoStatusPopover _owner )
192         {
193             _this = _owner;
194             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
195
196             // my vars (dec)
197
198             // set gobject values
199             this.el.homogeneous = false;
200             var child_0 = new Xcls_ScrolledWindow7( _this );
201             child_0.ref();
202             this.el.pack_start (  child_0.el , true,true,0 );
203         }
204
205         // user defined functions
206     }
207     public class Xcls_ScrolledWindow7 : Object
208     {
209         public Gtk.ScrolledWindow el;
210         private RepoStatusPopover  _this;
211
212
213             // my vars (def)
214
215         // ctor
216         public Xcls_ScrolledWindow7(RepoStatusPopover _owner )
217         {
218             _this = _owner;
219             this.el = new Gtk.ScrolledWindow( null, null );
220
221             // my vars (dec)
222
223             // set gobject values
224             var child_0 = new Xcls_status_view( _this );
225             child_0.ref();
226             this.el.add (  child_0.el  );
227         }
228
229         // user defined functions
230     }
231     public class Xcls_status_view : Object
232     {
233         public Gtk.SourceView el;
234         private RepoStatusPopover  _this;
235
236
237             // my vars (def)
238
239         // ctor
240         public Xcls_status_view(RepoStatusPopover _owner )
241         {
242             _this = _owner;
243             _this.status_view = this;
244             this.el = new Gtk.SourceView();
245
246             // my vars (dec)
247
248             // init method
249
250             var description =   Pango.FontDescription.from_string("monospace");
251                 description.set_size(9000);
252                 this.el.override_font(description);
253         }
254
255         // user defined functions
256     }
257
258
259
260     public class Xcls_Box9 : Object
261     {
262         public Gtk.Box el;
263         private RepoStatusPopover  _this;
264
265
266             // my vars (def)
267
268         // ctor
269         public Xcls_Box9(RepoStatusPopover _owner )
270         {
271             _this = _owner;
272             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
273
274             // my vars (dec)
275
276             // set gobject values
277             this.el.homogeneous = false;
278             var child_0 = new Xcls_ScrolledWindow10( _this );
279             child_0.ref();
280             this.el.pack_start (  child_0.el , true,true,0 );
281         }
282
283         // user defined functions
284     }
285     public class Xcls_ScrolledWindow10 : Object
286     {
287         public Gtk.ScrolledWindow el;
288         private RepoStatusPopover  _this;
289
290
291             // my vars (def)
292
293         // ctor
294         public Xcls_ScrolledWindow10(RepoStatusPopover _owner )
295         {
296             _this = _owner;
297             this.el = new Gtk.ScrolledWindow( null, null );
298
299             // my vars (dec)
300
301             // set gobject values
302             this.el.height_request = 400;
303             var child_0 = new Xcls_diff_view( _this );
304             child_0.ref();
305             this.el.add (  child_0.el  );
306         }
307
308         // user defined functions
309     }
310     public class Xcls_diff_view : Object
311     {
312         public Gtk.SourceView el;
313         private RepoStatusPopover  _this;
314
315
316             // my vars (def)
317
318         // ctor
319         public Xcls_diff_view(RepoStatusPopover _owner )
320         {
321             _this = _owner;
322             _this.diff_view = this;
323             this.el = new Gtk.SourceView();
324
325             // my vars (dec)
326
327             // init method
328
329             var description =   Pango.FontDescription.from_string("monospace");
330                 description.set_size(9000);
331                 this.el.override_font(description);
332         }
333
334         // user defined functions
335     }
336
337
338
339
340     public class Xcls_Box12 : Object
341     {
342         public Gtk.Box el;
343         private RepoStatusPopover  _this;
344
345
346             // my vars (def)
347
348         // ctor
349         public Xcls_Box12(RepoStatusPopover _owner )
350         {
351             _this = _owner;
352             this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
353
354             // my vars (dec)
355
356             // set gobject values
357             this.el.homogeneous = true;
358             this.el.expand = false;
359             this.el.vexpand = false;
360             var child_0 = new Xcls_Button13( _this );
361             child_0.ref();
362             this.el.add (  child_0.el  );
363             var child_1 = new Xcls_Button14( _this );
364             child_1.ref();
365             this.el.add (  child_1.el  );
366             var child_2 = new Xcls_Button15( _this );
367             child_2.ref();
368             this.el.add (  child_2.el  );
369             var child_3 = new Xcls_Button16( _this );
370             child_3.ref();
371             this.el.add (  child_3.el  );
372             var child_4 = new Xcls_Button17( _this );
373             child_4.ref();
374             this.el.add (  child_4.el  );
375         }
376
377         // user defined functions
378     }
379     public class Xcls_Button13 : Object
380     {
381         public Gtk.Button el;
382         private RepoStatusPopover  _this;
383
384
385             // my vars (def)
386
387         // ctor
388         public Xcls_Button13(RepoStatusPopover _owner )
389         {
390             _this = _owner;
391             this.el = new Gtk.Button();
392
393             // my vars (dec)
394
395             // set gobject values
396             this.el.label = "Stash Changes";
397
398             //listeners
399             this.el.button_press_event.connect( () => {
400               
401                
402                GitMonitor.gitmonitor.stop();
403                _this.repo.git({ "stash" , "--all" });
404                _this.repo.loadStatus();
405                GitMonitor.gitmonitor.start();
406                 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
407                 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
408                 Clones.singleton().reposStore.load();
409               
410                _this.el.hide();
411                 return false;
412             });
413         }
414
415         // user defined functions
416     }
417
418     public class Xcls_Button14 : Object
419     {
420         public Gtk.Button el;
421         private RepoStatusPopover  _this;
422
423
424             // my vars (def)
425
426         // ctor
427         public Xcls_Button14(RepoStatusPopover _owner )
428         {
429             _this = _owner;
430             this.el = new Gtk.Button();
431
432             // my vars (dec)
433
434             // set gobject values
435             this.el.label = "Commit Changes";
436
437             //listeners
438             this.el.button_press_event.connect( () => {
439                _this.repo.git({ "commit" , "-a" ,"-m", "Uncommited changes synced" });
440                _this.repo.push();
441                _this.repo.loadStatus();
442                
443                 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
444                 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
445                 
446                _this.el.hide();
447                Clones.singleton().reposStore.load();
448                
449                 return false;
450             });
451         }
452
453         // user defined functions
454     }
455
456     public class Xcls_Button15 : Object
457     {
458         public Gtk.Button el;
459         private RepoStatusPopover  _this;
460
461
462             // my vars (def)
463
464         // ctor
465         public Xcls_Button15(RepoStatusPopover _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 = "Create Branch";
474
475             //listeners
476             this.el.button_press_event.connect( () => {
477                var oldq = new Gee.ArrayList<GitMonitorQueue>();  
478             
479                 Clones.singleton().el.response(-1);
480                 NewBranch.singleton().show(_this.repo, oldq);
481             
482                 return false;
483             });
484         }
485
486         // user defined functions
487     }
488
489     public class Xcls_Button16 : Object
490     {
491         public Gtk.Button el;
492         private RepoStatusPopover  _this;
493
494
495             // my vars (def)
496
497         // ctor
498         public Xcls_Button16(RepoStatusPopover _owner )
499         {
500             _this = _owner;
501             this.el = new Gtk.Button();
502
503             // my vars (dec)
504
505             // set gobject values
506             this.el.label = "Ignore for now";
507
508             //listeners
509             this.el.button_press_event.connect( () => {
510                    _this.el.hide();
511                     return false;
512             });
513         }
514
515         // user defined functions
516     }
517
518     public class Xcls_Button17 : Object
519     {
520         public Gtk.Button el;
521         private RepoStatusPopover  _this;
522
523
524             // my vars (def)
525
526         // ctor
527         public Xcls_Button17(RepoStatusPopover _owner )
528         {
529             _this = _owner;
530             this.el = new Gtk.Button();
531
532             // my vars (dec)
533
534             // set gobject values
535             this.el.label = "Stash Changes";
536
537             //listeners
538             this.el.button_press_event.connect( () => {
539               
540                
541                GitMonitor.gitmonitor.stop();
542                _this.repo.git({ "stash" , "--all" });
543                _this.repo.loadStatus();
544                GitMonitor.gitmonitor.start();
545                 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
546                 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
547                 Clones.singleton().reposStore.load();
548               
549                _this.el.hide();
550                 return false;
551             });
552         }
553
554         // user defined functions
555     }
556
557
558     public class Xcls_Button18 : Object
559     {
560         public Gtk.Button el;
561         private RepoStatusPopover  _this;
562
563
564             // my vars (def)
565
566         // ctor
567         public Xcls_Button18(RepoStatusPopover _owner )
568         {
569             _this = _owner;
570             this.el = new Gtk.Button();
571
572             // my vars (dec)
573
574             // set gobject values
575             this.el.label = "Stash Changes";
576
577             //listeners
578             this.el.button_press_event.connect( () => {
579               
580                
581                GitMonitor.gitmonitor.stop();
582                _this.repo.git({ "stash" , "--all" });
583                _this.repo.loadStatus();
584                GitMonitor.gitmonitor.start();
585                 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
586                 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
587                 Clones.singleton().reposStore.load();
588               
589                _this.el.hide();
590                 return false;
591             });
592         }
593
594         // user defined functions
595     }
596
597     public class Xcls_Button19 : Object
598     {
599         public Gtk.Button el;
600         private RepoStatusPopover  _this;
601
602
603             // my vars (def)
604
605         // ctor
606         public Xcls_Button19(RepoStatusPopover _owner )
607         {
608             _this = _owner;
609             this.el = new Gtk.Button();
610
611             // my vars (dec)
612
613             // set gobject values
614             this.el.label = "Stash Changes";
615
616             //listeners
617             this.el.button_press_event.connect( () => {
618               
619                
620                GitMonitor.gitmonitor.stop();
621                _this.repo.git({ "stash" , "--all" });
622                _this.repo.loadStatus();
623                GitMonitor.gitmonitor.start();
624                 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
625                 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
626                 Clones.singleton().reposStore.load();
627               
628                _this.el.hide();
629                 return false;
630             });
631         }
632
633         // user defined functions
634     }
635
636
637 }