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_label_status label_status;
17 public Xcls_label_diff label_diff;
18 public Xcls_status_view status_view;
19 public Xcls_diff_view diff_view;
20 public Xcls_btn_create btn_create;
21 public Xcls_btn_merge btn_merge;
27 public RepoStatusPopover()
30 this.el = new Gtk.Popover( null );
35 this.el.border_width = 0;
37 this.el.position = Gtk.PositionType.RIGHT;
38 var child_0 = new Xcls_Box2( _this );
40 this.el.add ( child_0.el );
43 // user defined functions
44 public void show (Gtk.Widget btn, Gdk.Rectangle rect, GitRepo repo) {
46 // get the active project.
47 var lm = Gtk.SourceLanguageManager.get_default();
49 // ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
50 // lm.get_language("html")
54 //project.runhtml = project.runhtml || '';
55 _this.diff_view.el.get_buffer().set_text(repo.git_diff);
56 _this.status_view.el.get_buffer().set_text(repo.git_status);
58 //console.log('show all');
59 this.el.set_modal(true);
60 this.el.set_relative_to(btn);
61 this.el.set_pointing_to(rect);
63 //this.el.set_position(Gtk.PositionType.RIGHT);
65 if (repo.activeTicket == null) {
66 _this.btn_merge.el.set_sensitive(false);
68 _this.btn_merge.el.set_sensitive(true);
70 _this.btn_create.el.set_sensitive(repo.is_master());
72 _this.btn_stash.el.set_sensitive(repo.has_local_changes);
73 _this.btn_commit.el.set_sensitive(repo.has_local_changes);
74 _this.btn_reset.el.set_sensitive(repo.has_local_changes);
75 _this.btn_pull.el.set_sensitive(repo.ahead_or_behind == "B");
78 GLib.debug("SHOWALL - POPIP\n");
80 //this.el.set_size_request(800,500);
81 // this.diff_view.el.grab_focus();
85 public class Xcls_Box2 : Object
88 private RepoStatusPopover _this;
94 public Xcls_Box2(RepoStatusPopover _owner )
97 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
101 // set gobject values
102 this.el.homogeneous = false;
103 this.el.border_width = 5;
104 var child_0 = new Xcls_Box3( _this );
106 this.el.pack_start ( child_0.el , false,false,0 );
107 var child_1 = new Xcls_Notebook9( _this );
109 this.el.add ( child_1.el );
110 var child_2 = new Xcls_Box18( _this );
112 this.el.pack_end ( child_2.el , false,false,0 );
115 // user defined functions
117 public class Xcls_Box3 : Object
120 private RepoStatusPopover _this;
126 public Xcls_Box3(RepoStatusPopover _owner )
129 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
133 // set gobject values
134 this.el.homogeneous = true;
135 this.el.expand = false;
136 this.el.vexpand = false;
137 var child_0 = new Xcls_Toolbar4( _this );
139 this.el.add ( child_0.el );
142 // user defined functions
144 public class Xcls_Toolbar4 : Object
146 public Gtk.Toolbar el;
147 private RepoStatusPopover _this;
153 public Xcls_Toolbar4(RepoStatusPopover _owner )
156 this.el = new Gtk.Toolbar();
160 // set gobject values
161 this.el.toolbar_style = Gtk.ToolbarStyle.BOTH_HORIZ;
162 var child_0 = new Xcls_btn_stash( _this );
164 this.el.add ( child_0.el );
165 var child_1 = new Xcls_ToolButton6( _this );
167 this.el.add ( child_1.el );
168 var child_2 = new Xcls_ToolButton7( _this );
170 this.el.add ( child_2.el );
171 var child_3 = new Xcls_ToolButton8( _this );
173 this.el.add ( child_3.el );
176 // user defined functions
178 public class Xcls_btn_stash : Object
180 public Gtk.ToolButton el;
181 private RepoStatusPopover _this;
187 public Xcls_btn_stash(RepoStatusPopover _owner )
190 _this.btn_stash = this;
191 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-undo", Gtk.IconSize.SMALL_TOOLBAR), null);;
195 // set gobject values
196 this.el.label = "Stash Changes";
197 this.el.is_important = true;
200 this.el.button_press_event.connect( () => {
203 GitMonitor.gitmonitor.stop();
204 _this.repo.git({ "stash" , "--all" });
205 _this.repo.loadStatus();
206 GitMonitor.gitmonitor.start();
207 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
208 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
209 Clones.singleton().reposStore.load();
216 // user defined functions
219 public class Xcls_ToolButton6 : Object
221 public Gtk.ToolButton el;
222 private RepoStatusPopover _this;
228 public Xcls_ToolButton6(RepoStatusPopover _owner )
231 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-save", Gtk.IconSize.SMALL_TOOLBAR), null);;
235 // set gobject values
236 this.el.label = "Commit Changes";
237 this.el.is_important = true;
240 this.el.button_press_event.connect( () => {
241 _this.repo.git({ "commit" , "-a" ,"-m", "Uncommited changes synced" });
243 _this.repo.loadStatus();
245 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
246 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
249 Clones.singleton().reposStore.load();
255 // user defined functions
258 public class Xcls_ToolButton7 : Object
260 public Gtk.ToolButton el;
261 private RepoStatusPopover _this;
267 public Xcls_ToolButton7(RepoStatusPopover _owner )
270 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-revert-to-saved", Gtk.IconSize.SMALL_TOOLBAR), null);;
274 // set gobject values
275 this.el.label = "Reset / clear changes";
276 this.el.is_important = true;
279 this.el.button_press_event.connect( () => {
282 GitMonitor.gitmonitor.stop();
283 _this.repo.git({ "reset" , "--hard" });
284 _this.repo.loadStatus();
285 GitMonitor.gitmonitor.start();
286 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
287 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
288 Clones.singleton().reposStore.load();
295 // user defined functions
298 public class Xcls_ToolButton8 : Object
300 public Gtk.ToolButton el;
301 private RepoStatusPopover _this;
307 public Xcls_ToolButton8(RepoStatusPopover _owner )
310 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-bottom", Gtk.IconSize.SMALL_TOOLBAR), null);;
314 // set gobject values
315 this.el.label = "Pull updates";
316 this.el.is_important = true;
319 this.el.button_press_event.connect( () => {
322 GitMonitor.gitmonitor.stop();
323 _this.repo.git({ "pull" , "--all" });
324 _this.repo.loadStatus();
325 GitMonitor.gitmonitor.start();
326 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
327 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
328 Clones.singleton().reposStore.load();
335 // user defined functions
340 public class Xcls_Notebook9 : Object
342 public Gtk.Notebook el;
343 private RepoStatusPopover _this;
349 public Xcls_Notebook9(RepoStatusPopover _owner )
352 this.el = new Gtk.Notebook();
356 // set gobject values
357 this.el.vexpand = true;
358 var child_0 = new Xcls_label_status( _this );
360 var child_1 = new Xcls_label_diff( _this );
362 var child_2 = new Xcls_Box12( _this );
364 this.el.append_page ( child_2.el , _this.label_status.el );
365 var child_3 = new Xcls_Box15( _this );
367 this.el.append_page ( child_3.el , _this.label_diff.el );
370 // user defined functions
372 public class Xcls_label_status : Object
375 private RepoStatusPopover _this;
381 public Xcls_label_status(RepoStatusPopover _owner )
384 _this.label_status = this;
385 this.el = new Gtk.Label( "Status" );
389 // set gobject values
392 // user defined functions
395 public class Xcls_label_diff : Object
398 private RepoStatusPopover _this;
404 public Xcls_label_diff(RepoStatusPopover _owner )
407 _this.label_diff = this;
408 this.el = new Gtk.Label( "Diff" );
412 // set gobject values
415 // user defined functions
418 public class Xcls_Box12 : Object
421 private RepoStatusPopover _this;
427 public Xcls_Box12(RepoStatusPopover _owner )
430 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
434 // set gobject values
435 this.el.homogeneous = false;
436 var child_0 = new Xcls_ScrolledWindow13( _this );
438 this.el.pack_start ( child_0.el , true,true,0 );
441 // user defined functions
443 public class Xcls_ScrolledWindow13 : Object
445 public Gtk.ScrolledWindow el;
446 private RepoStatusPopover _this;
452 public Xcls_ScrolledWindow13(RepoStatusPopover _owner )
455 this.el = new Gtk.ScrolledWindow( null, null );
459 // set gobject values
460 var child_0 = new Xcls_status_view( _this );
462 this.el.add ( child_0.el );
465 // user defined functions
467 public class Xcls_status_view : Object
469 public Gtk.SourceView el;
470 private RepoStatusPopover _this;
476 public Xcls_status_view(RepoStatusPopover _owner )
479 _this.status_view = this;
480 this.el = new Gtk.SourceView();
486 var description = Pango.FontDescription.from_string("monospace");
487 description.set_size(9000);
488 this.el.override_font(description);
491 // user defined functions
496 public class Xcls_Box15 : Object
499 private RepoStatusPopover _this;
505 public Xcls_Box15(RepoStatusPopover _owner )
508 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
512 // set gobject values
513 this.el.homogeneous = false;
514 var child_0 = new Xcls_ScrolledWindow16( _this );
516 this.el.pack_start ( child_0.el , true,true,0 );
519 // user defined functions
521 public class Xcls_ScrolledWindow16 : Object
523 public Gtk.ScrolledWindow el;
524 private RepoStatusPopover _this;
530 public Xcls_ScrolledWindow16(RepoStatusPopover _owner )
533 this.el = new Gtk.ScrolledWindow( null, null );
537 // set gobject values
538 this.el.height_request = 400;
539 var child_0 = new Xcls_diff_view( _this );
541 this.el.add ( child_0.el );
544 // user defined functions
546 public class Xcls_diff_view : Object
548 public Gtk.SourceView el;
549 private RepoStatusPopover _this;
555 public Xcls_diff_view(RepoStatusPopover _owner )
558 _this.diff_view = this;
559 this.el = new Gtk.SourceView();
565 var description = Pango.FontDescription.from_string("monospace");
566 description.set_size(9000);
567 this.el.override_font(description);
570 // user defined functions
576 public class Xcls_Box18 : Object
579 private RepoStatusPopover _this;
585 public Xcls_Box18(RepoStatusPopover _owner )
588 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
592 // set gobject values
593 this.el.homogeneous = true;
594 this.el.expand = false;
595 this.el.vexpand = false;
596 var child_0 = new Xcls_Toolbar19( _this );
598 this.el.add ( child_0.el );
601 // user defined functions
603 public class Xcls_Toolbar19 : Object
605 public Gtk.Toolbar el;
606 private RepoStatusPopover _this;
612 public Xcls_Toolbar19(RepoStatusPopover _owner )
615 this.el = new Gtk.Toolbar();
619 // set gobject values
620 this.el.toolbar_style = Gtk.ToolbarStyle.BOTH_HORIZ;
621 var child_0 = new Xcls_btn_create( _this );
623 this.el.add ( child_0.el );
624 var child_1 = new Xcls_btn_merge( _this );
626 this.el.add ( child_1.el );
627 var child_2 = new Xcls_ToolButton22( _this );
629 this.el.add ( child_2.el );
632 // user defined functions
634 public class Xcls_btn_create : Object
636 public Gtk.ToolButton el;
637 private RepoStatusPopover _this;
643 public Xcls_btn_create(RepoStatusPopover _owner )
646 _this.btn_create = this;
647 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-add", Gtk.IconSize.SMALL_TOOLBAR), null);;
651 // set gobject values
652 this.el.label = "Create Branch / Start ticket";
653 this.el.is_important = true;
656 this.el.button_press_event.connect( () => {
657 var oldq = new Gee.ArrayList<GitMonitorQueue>();
659 Clones.singleton().el.response(-1);
660 NewBranch.singleton().show(_this.repo, oldq);
666 // user defined functions
669 public class Xcls_btn_merge : Object
671 public Gtk.ToolButton el;
672 private RepoStatusPopover _this;
678 public Xcls_btn_merge(RepoStatusPopover _owner )
681 _this.btn_merge = this;
682 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-top", Gtk.IconSize.SMALL_TOOLBAR), null);;
686 // set gobject values
687 this.el.label = "Merge branch / Complete ticket";
688 this.el.is_important = true;
691 this.el.clicked.connect( () => {
694 Clones.singleton().el.response(-1);
695 if (_this.repo.activeTicket != null) {
696 MergeBranch.singleton().show(_this.repo.activeTicket, null);
702 // user defined functions
705 public class Xcls_ToolButton22 : Object
707 public Gtk.ToolButton el;
708 private RepoStatusPopover _this;
714 public Xcls_ToolButton22(RepoStatusPopover _owner )
717 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-new", Gtk.IconSize.SMALL_TOOLBAR), null);;
721 // set gobject values
722 this.el.label = "Create Ticket";
723 this.el.is_important = true;
726 this.el.button_press_event.connect( () => {
730 Clones.singleton().el.response(-1);
733 Ticket.singleton().show( _this.repo);
739 // user defined functions