1 static RepoStatusPopover _RepoStatusPopover;
3 public class RepoStatusPopover : Object
6 private RepoStatusPopover _this;
8 public static RepoStatusPopover singleton()
10 if (_RepoStatusPopover == null) {
11 _RepoStatusPopover= new RepoStatusPopover();
13 return _RepoStatusPopover;
15 public Xcls_btn_stash btn_stash;
16 public Xcls_btn_commit btn_commit;
17 public Xcls_label_status label_status;
18 public Xcls_label_diff label_diff;
19 public Xcls_status_view status_view;
20 public Xcls_diff_view diff_view;
21 public Xcls_btn_create btn_create;
22 public Xcls_btn_merge btn_merge;
28 public RepoStatusPopover()
31 this.el = new Gtk.Popover( null );
36 this.el.border_width = 0;
38 this.el.position = Gtk.PositionType.RIGHT;
39 var child_0 = new Xcls_Box2( _this );
41 this.el.add ( child_0.el );
44 // user defined functions
45 public void show (Gtk.Widget btn, Gdk.Rectangle rect, GitRepo repo) {
47 // get the active project.
48 var lm = Gtk.SourceLanguageManager.get_default();
50 // ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
51 // lm.get_language("html")
55 //project.runhtml = project.runhtml || '';
56 _this.diff_view.el.get_buffer().set_text(repo.git_diff);
57 _this.status_view.el.get_buffer().set_text(repo.git_status);
59 //console.log('show all');
60 this.el.set_modal(true);
61 this.el.set_relative_to(btn);
62 this.el.set_pointing_to(rect);
64 //this.el.set_position(Gtk.PositionType.RIGHT);
66 if (repo.activeTicket == null) {
67 _this.btn_merge.el.set_sensitive(false);
69 _this.btn_merge.el.set_sensitive(true);
71 _this.btn_create.el.set_sensitive(repo.is_master());
73 _this.btn_stash.el.set_sensitive(repo.has_local_changes);
74 _this.btn_commit.el.set_sensitive(repo.has_local_changes);
75 _this.btn_reset.el.set_sensitive(repo.has_local_changes);
76 _this.btn_pull.el.set_sensitive(repo.ahead_or_behind == "B");
79 GLib.debug("SHOWALL - POPIP\n");
81 //this.el.set_size_request(800,500);
82 // this.diff_view.el.grab_focus();
86 public class Xcls_Box2 : Object
89 private RepoStatusPopover _this;
95 public Xcls_Box2(RepoStatusPopover _owner )
98 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
102 // set gobject values
103 this.el.homogeneous = false;
104 this.el.border_width = 5;
105 var child_0 = new Xcls_Box3( _this );
107 this.el.pack_start ( child_0.el , false,false,0 );
108 var child_1 = new Xcls_Notebook9( _this );
110 this.el.add ( child_1.el );
111 var child_2 = new Xcls_Box18( _this );
113 this.el.pack_end ( child_2.el , false,false,0 );
116 // user defined functions
118 public class Xcls_Box3 : Object
121 private RepoStatusPopover _this;
127 public Xcls_Box3(RepoStatusPopover _owner )
130 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
134 // set gobject values
135 this.el.homogeneous = true;
136 this.el.expand = false;
137 this.el.vexpand = false;
138 var child_0 = new Xcls_Toolbar4( _this );
140 this.el.add ( child_0.el );
143 // user defined functions
145 public class Xcls_Toolbar4 : Object
147 public Gtk.Toolbar el;
148 private RepoStatusPopover _this;
154 public Xcls_Toolbar4(RepoStatusPopover _owner )
157 this.el = new Gtk.Toolbar();
161 // set gobject values
162 this.el.toolbar_style = Gtk.ToolbarStyle.BOTH_HORIZ;
163 var child_0 = new Xcls_btn_stash( _this );
165 this.el.add ( child_0.el );
166 var child_1 = new Xcls_btn_commit( _this );
168 this.el.add ( child_1.el );
169 var child_2 = new Xcls_ToolButton7( _this );
171 this.el.add ( child_2.el );
172 var child_3 = new Xcls_ToolButton8( _this );
174 this.el.add ( child_3.el );
177 // user defined functions
179 public class Xcls_btn_stash : Object
181 public Gtk.ToolButton el;
182 private RepoStatusPopover _this;
188 public Xcls_btn_stash(RepoStatusPopover _owner )
191 _this.btn_stash = this;
192 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-undo", Gtk.IconSize.SMALL_TOOLBAR), null);;
196 // set gobject values
197 this.el.label = "Stash Changes";
198 this.el.is_important = true;
201 this.el.button_press_event.connect( () => {
204 GitMonitor.gitmonitor.stop();
205 _this.repo.git({ "stash" , "--all" });
206 _this.repo.loadStatus();
207 GitMonitor.gitmonitor.start();
208 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
209 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
210 Clones.singleton().reposStore.load();
217 // user defined functions
220 public class Xcls_btn_commit : Object
222 public Gtk.ToolButton el;
223 private RepoStatusPopover _this;
229 public Xcls_btn_commit(RepoStatusPopover _owner )
232 _this.btn_commit = this;
233 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-save", Gtk.IconSize.SMALL_TOOLBAR), null);;
237 // set gobject values
238 this.el.label = "Commit Changes";
239 this.el.is_important = true;
242 this.el.button_press_event.connect( () => {
243 _this.repo.git({ "commit" , "-a" ,"-m", "Uncommited changes synced" });
245 _this.repo.loadStatus();
247 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
248 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
251 Clones.singleton().reposStore.load();
257 // user defined functions
260 public class Xcls_ToolButton7 : Object
262 public Gtk.ToolButton el;
263 private RepoStatusPopover _this;
269 public Xcls_ToolButton7(RepoStatusPopover _owner )
272 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-revert-to-saved", Gtk.IconSize.SMALL_TOOLBAR), null);;
276 // set gobject values
277 this.el.label = "Reset / clear changes";
278 this.el.is_important = true;
281 this.el.button_press_event.connect( () => {
284 GitMonitor.gitmonitor.stop();
285 _this.repo.git({ "reset" , "--hard" });
286 _this.repo.loadStatus();
287 GitMonitor.gitmonitor.start();
288 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
289 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
290 Clones.singleton().reposStore.load();
297 // user defined functions
300 public class Xcls_ToolButton8 : Object
302 public Gtk.ToolButton el;
303 private RepoStatusPopover _this;
309 public Xcls_ToolButton8(RepoStatusPopover _owner )
312 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-bottom", Gtk.IconSize.SMALL_TOOLBAR), null);;
316 // set gobject values
317 this.el.label = "Pull updates";
318 this.el.is_important = true;
321 this.el.button_press_event.connect( () => {
324 GitMonitor.gitmonitor.stop();
325 _this.repo.git({ "pull" , "--all" });
326 _this.repo.loadStatus();
327 GitMonitor.gitmonitor.start();
328 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
329 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
330 Clones.singleton().reposStore.load();
337 // user defined functions
342 public class Xcls_Notebook9 : Object
344 public Gtk.Notebook el;
345 private RepoStatusPopover _this;
351 public Xcls_Notebook9(RepoStatusPopover _owner )
354 this.el = new Gtk.Notebook();
358 // set gobject values
359 this.el.vexpand = true;
360 var child_0 = new Xcls_label_status( _this );
362 var child_1 = new Xcls_label_diff( _this );
364 var child_2 = new Xcls_Box12( _this );
366 this.el.append_page ( child_2.el , _this.label_status.el );
367 var child_3 = new Xcls_Box15( _this );
369 this.el.append_page ( child_3.el , _this.label_diff.el );
372 // user defined functions
374 public class Xcls_label_status : Object
377 private RepoStatusPopover _this;
383 public Xcls_label_status(RepoStatusPopover _owner )
386 _this.label_status = this;
387 this.el = new Gtk.Label( "Status" );
391 // set gobject values
394 // user defined functions
397 public class Xcls_label_diff : Object
400 private RepoStatusPopover _this;
406 public Xcls_label_diff(RepoStatusPopover _owner )
409 _this.label_diff = this;
410 this.el = new Gtk.Label( "Diff" );
414 // set gobject values
417 // user defined functions
420 public class Xcls_Box12 : Object
423 private RepoStatusPopover _this;
429 public Xcls_Box12(RepoStatusPopover _owner )
432 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
436 // set gobject values
437 this.el.homogeneous = false;
438 var child_0 = new Xcls_ScrolledWindow13( _this );
440 this.el.pack_start ( child_0.el , true,true,0 );
443 // user defined functions
445 public class Xcls_ScrolledWindow13 : Object
447 public Gtk.ScrolledWindow el;
448 private RepoStatusPopover _this;
454 public Xcls_ScrolledWindow13(RepoStatusPopover _owner )
457 this.el = new Gtk.ScrolledWindow( null, null );
461 // set gobject values
462 var child_0 = new Xcls_status_view( _this );
464 this.el.add ( child_0.el );
467 // user defined functions
469 public class Xcls_status_view : Object
471 public Gtk.SourceView el;
472 private RepoStatusPopover _this;
478 public Xcls_status_view(RepoStatusPopover _owner )
481 _this.status_view = this;
482 this.el = new Gtk.SourceView();
488 var description = Pango.FontDescription.from_string("monospace");
489 description.set_size(9000);
490 this.el.override_font(description);
493 // user defined functions
498 public class Xcls_Box15 : Object
501 private RepoStatusPopover _this;
507 public Xcls_Box15(RepoStatusPopover _owner )
510 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
514 // set gobject values
515 this.el.homogeneous = false;
516 var child_0 = new Xcls_ScrolledWindow16( _this );
518 this.el.pack_start ( child_0.el , true,true,0 );
521 // user defined functions
523 public class Xcls_ScrolledWindow16 : Object
525 public Gtk.ScrolledWindow el;
526 private RepoStatusPopover _this;
532 public Xcls_ScrolledWindow16(RepoStatusPopover _owner )
535 this.el = new Gtk.ScrolledWindow( null, null );
539 // set gobject values
540 this.el.height_request = 400;
541 var child_0 = new Xcls_diff_view( _this );
543 this.el.add ( child_0.el );
546 // user defined functions
548 public class Xcls_diff_view : Object
550 public Gtk.SourceView el;
551 private RepoStatusPopover _this;
557 public Xcls_diff_view(RepoStatusPopover _owner )
560 _this.diff_view = this;
561 this.el = new Gtk.SourceView();
567 var description = Pango.FontDescription.from_string("monospace");
568 description.set_size(9000);
569 this.el.override_font(description);
572 // user defined functions
578 public class Xcls_Box18 : Object
581 private RepoStatusPopover _this;
587 public Xcls_Box18(RepoStatusPopover _owner )
590 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
594 // set gobject values
595 this.el.homogeneous = true;
596 this.el.expand = false;
597 this.el.vexpand = false;
598 var child_0 = new Xcls_Toolbar19( _this );
600 this.el.add ( child_0.el );
603 // user defined functions
605 public class Xcls_Toolbar19 : Object
607 public Gtk.Toolbar el;
608 private RepoStatusPopover _this;
614 public Xcls_Toolbar19(RepoStatusPopover _owner )
617 this.el = new Gtk.Toolbar();
621 // set gobject values
622 this.el.toolbar_style = Gtk.ToolbarStyle.BOTH_HORIZ;
623 var child_0 = new Xcls_btn_create( _this );
625 this.el.add ( child_0.el );
626 var child_1 = new Xcls_btn_merge( _this );
628 this.el.add ( child_1.el );
629 var child_2 = new Xcls_ToolButton22( _this );
631 this.el.add ( child_2.el );
634 // user defined functions
636 public class Xcls_btn_create : Object
638 public Gtk.ToolButton el;
639 private RepoStatusPopover _this;
645 public Xcls_btn_create(RepoStatusPopover _owner )
648 _this.btn_create = this;
649 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-add", Gtk.IconSize.SMALL_TOOLBAR), null);;
653 // set gobject values
654 this.el.label = "Create Branch / Start ticket";
655 this.el.is_important = true;
658 this.el.button_press_event.connect( () => {
659 var oldq = new Gee.ArrayList<GitMonitorQueue>();
661 Clones.singleton().el.response(-1);
662 NewBranch.singleton().show(_this.repo, oldq);
668 // user defined functions
671 public class Xcls_btn_merge : Object
673 public Gtk.ToolButton el;
674 private RepoStatusPopover _this;
680 public Xcls_btn_merge(RepoStatusPopover _owner )
683 _this.btn_merge = this;
684 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-top", Gtk.IconSize.SMALL_TOOLBAR), null);;
688 // set gobject values
689 this.el.label = "Merge branch / Complete ticket";
690 this.el.is_important = true;
693 this.el.clicked.connect( () => {
696 Clones.singleton().el.response(-1);
697 if (_this.repo.activeTicket != null) {
698 MergeBranch.singleton().show(_this.repo.activeTicket, null);
704 // user defined functions
707 public class Xcls_ToolButton22 : Object
709 public Gtk.ToolButton el;
710 private RepoStatusPopover _this;
716 public Xcls_ToolButton22(RepoStatusPopover _owner )
719 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-new", Gtk.IconSize.SMALL_TOOLBAR), null);;
723 // set gobject values
724 this.el.label = "Create Ticket";
725 this.el.is_important = true;
728 this.el.button_press_event.connect( () => {
732 Clones.singleton().el.response(-1);
735 Ticket.singleton().show( _this.repo);
741 // user defined functions