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_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 public Xcls_btn_create btn_create;
20 public Xcls_btn_merge btn_merge;
26 public RepoStatusPopover()
29 this.el = new Gtk.Popover( null );
34 this.el.border_width = 0;
36 this.el.position = Gtk.PositionType.RIGHT;
37 var child_0 = new Xcls_Box2( _this );
39 this.el.add ( child_0.el );
42 // user defined functions
43 public void show (Gtk.Widget btn, Gdk.Rectangle rect, GitRepo repo) {
45 // get the active project.
46 var lm = Gtk.SourceLanguageManager.get_default();
48 // ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
49 // lm.get_language("html")
53 //project.runhtml = project.runhtml || '';
54 _this.diff_view.el.get_buffer().set_text(repo.git_diff);
55 _this.status_view.el.get_buffer().set_text(repo.git_status);
57 //console.log('show all');
58 this.el.set_modal(true);
59 this.el.set_relative_to(btn);
60 this.el.set_pointing_to(rect);
62 //this.el.set_position(Gtk.PositionType.RIGHT);
64 if (repo.activeTicket == null) {
65 _this.btn_merge.el.set_sensitive(false);
67 _this.btn_merge.el.set_sensitive(true);
69 _this.btn_create.el.set_sensitive(repo.is_master());
71 _this.btn_stash.el.set_sensitive(repo.has_local_changes);
72 _this.btn_commit.el.set_sensitive(repo.has_local_changes);
73 _this.btn_reset.el.set_sensitive(repo.has_local_changes);
74 _this.btn_pull.el.set_sensitive(repo.ahead_or_behind == "B");
77 GLib.debug("SHOWALL - POPIP\n");
79 //this.el.set_size_request(800,500);
80 // this.diff_view.el.grab_focus();
84 public class Xcls_Box2 : Object
87 private RepoStatusPopover _this;
93 public Xcls_Box2(RepoStatusPopover _owner )
96 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
100 // set gobject values
101 this.el.homogeneous = false;
102 this.el.border_width = 5;
103 var child_0 = new Xcls_Box3( _this );
105 this.el.pack_start ( child_0.el , false,false,0 );
106 var child_1 = new Xcls_Notebook9( _this );
108 this.el.add ( child_1.el );
109 var child_2 = new Xcls_Box18( _this );
111 this.el.pack_end ( child_2.el , false,false,0 );
114 // user defined functions
116 public class Xcls_Box3 : Object
119 private RepoStatusPopover _this;
125 public Xcls_Box3(RepoStatusPopover _owner )
128 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
132 // set gobject values
133 this.el.homogeneous = true;
134 this.el.expand = false;
135 this.el.vexpand = false;
136 var child_0 = new Xcls_Toolbar4( _this );
138 this.el.add ( child_0.el );
141 // user defined functions
143 public class Xcls_Toolbar4 : Object
145 public Gtk.Toolbar el;
146 private RepoStatusPopover _this;
152 public Xcls_Toolbar4(RepoStatusPopover _owner )
155 this.el = new Gtk.Toolbar();
159 // set gobject values
160 this.el.toolbar_style = Gtk.ToolbarStyle.BOTH_HORIZ;
161 var child_0 = new Xcls_ToolButton5( _this );
163 this.el.add ( child_0.el );
164 var child_1 = new Xcls_ToolButton6( _this );
166 this.el.add ( child_1.el );
167 var child_2 = new Xcls_ToolButton7( _this );
169 this.el.add ( child_2.el );
170 var child_3 = new Xcls_ToolButton8( _this );
172 this.el.add ( child_3.el );
175 // user defined functions
177 public class Xcls_ToolButton5 : Object
179 public Gtk.ToolButton el;
180 private RepoStatusPopover _this;
186 public Xcls_ToolButton5(RepoStatusPopover _owner )
189 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-undo", Gtk.IconSize.SMALL_TOOLBAR), null);;
193 // set gobject values
194 this.el.label = "Stash Changes";
195 this.el.is_important = true;
198 this.el.button_press_event.connect( () => {
201 GitMonitor.gitmonitor.stop();
202 _this.repo.git({ "stash" , "--all" });
203 _this.repo.loadStatus();
204 GitMonitor.gitmonitor.start();
205 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
206 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
207 Clones.singleton().reposStore.load();
214 // user defined functions
217 public class Xcls_ToolButton6 : Object
219 public Gtk.ToolButton el;
220 private RepoStatusPopover _this;
226 public Xcls_ToolButton6(RepoStatusPopover _owner )
229 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-save", Gtk.IconSize.SMALL_TOOLBAR), null);;
233 // set gobject values
234 this.el.label = "Commit Changes";
235 this.el.is_important = true;
238 this.el.button_press_event.connect( () => {
239 _this.repo.git({ "commit" , "-a" ,"-m", "Uncommited changes synced" });
241 _this.repo.loadStatus();
243 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
244 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
247 Clones.singleton().reposStore.load();
253 // user defined functions
256 public class Xcls_ToolButton7 : Object
258 public Gtk.ToolButton el;
259 private RepoStatusPopover _this;
265 public Xcls_ToolButton7(RepoStatusPopover _owner )
268 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-revert-to-saved", Gtk.IconSize.SMALL_TOOLBAR), null);;
272 // set gobject values
273 this.el.label = "Reset / clear changes";
274 this.el.is_important = true;
277 this.el.button_press_event.connect( () => {
280 GitMonitor.gitmonitor.stop();
281 _this.repo.git({ "reset" , "--hard" });
282 _this.repo.loadStatus();
283 GitMonitor.gitmonitor.start();
284 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
285 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
286 Clones.singleton().reposStore.load();
293 // user defined functions
296 public class Xcls_ToolButton8 : Object
298 public Gtk.ToolButton el;
299 private RepoStatusPopover _this;
305 public Xcls_ToolButton8(RepoStatusPopover _owner )
308 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-bottom", Gtk.IconSize.SMALL_TOOLBAR), null);;
312 // set gobject values
313 this.el.label = "Pull updates";
314 this.el.is_important = true;
317 this.el.button_press_event.connect( () => {
320 GitMonitor.gitmonitor.stop();
321 _this.repo.git({ "pull" , "--all" });
322 _this.repo.loadStatus();
323 GitMonitor.gitmonitor.start();
324 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
325 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
326 Clones.singleton().reposStore.load();
333 // user defined functions
338 public class Xcls_Notebook9 : Object
340 public Gtk.Notebook el;
341 private RepoStatusPopover _this;
347 public Xcls_Notebook9(RepoStatusPopover _owner )
350 this.el = new Gtk.Notebook();
354 // set gobject values
355 this.el.vexpand = true;
356 var child_0 = new Xcls_label_status( _this );
358 var child_1 = new Xcls_label_diff( _this );
360 var child_2 = new Xcls_Box12( _this );
362 this.el.append_page ( child_2.el , _this.label_status.el );
363 var child_3 = new Xcls_Box15( _this );
365 this.el.append_page ( child_3.el , _this.label_diff.el );
368 // user defined functions
370 public class Xcls_label_status : Object
373 private RepoStatusPopover _this;
379 public Xcls_label_status(RepoStatusPopover _owner )
382 _this.label_status = this;
383 this.el = new Gtk.Label( "Status" );
387 // set gobject values
390 // user defined functions
393 public class Xcls_label_diff : Object
396 private RepoStatusPopover _this;
402 public Xcls_label_diff(RepoStatusPopover _owner )
405 _this.label_diff = this;
406 this.el = new Gtk.Label( "Diff" );
410 // set gobject values
413 // user defined functions
416 public class Xcls_Box12 : Object
419 private RepoStatusPopover _this;
425 public Xcls_Box12(RepoStatusPopover _owner )
428 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
432 // set gobject values
433 this.el.homogeneous = false;
434 var child_0 = new Xcls_ScrolledWindow13( _this );
436 this.el.pack_start ( child_0.el , true,true,0 );
439 // user defined functions
441 public class Xcls_ScrolledWindow13 : Object
443 public Gtk.ScrolledWindow el;
444 private RepoStatusPopover _this;
450 public Xcls_ScrolledWindow13(RepoStatusPopover _owner )
453 this.el = new Gtk.ScrolledWindow( null, null );
457 // set gobject values
458 var child_0 = new Xcls_status_view( _this );
460 this.el.add ( child_0.el );
463 // user defined functions
465 public class Xcls_status_view : Object
467 public Gtk.SourceView el;
468 private RepoStatusPopover _this;
474 public Xcls_status_view(RepoStatusPopover _owner )
477 _this.status_view = this;
478 this.el = new Gtk.SourceView();
484 var description = Pango.FontDescription.from_string("monospace");
485 description.set_size(9000);
486 this.el.override_font(description);
489 // user defined functions
494 public class Xcls_Box15 : Object
497 private RepoStatusPopover _this;
503 public Xcls_Box15(RepoStatusPopover _owner )
506 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
510 // set gobject values
511 this.el.homogeneous = false;
512 var child_0 = new Xcls_ScrolledWindow16( _this );
514 this.el.pack_start ( child_0.el , true,true,0 );
517 // user defined functions
519 public class Xcls_ScrolledWindow16 : Object
521 public Gtk.ScrolledWindow el;
522 private RepoStatusPopover _this;
528 public Xcls_ScrolledWindow16(RepoStatusPopover _owner )
531 this.el = new Gtk.ScrolledWindow( null, null );
535 // set gobject values
536 this.el.height_request = 400;
537 var child_0 = new Xcls_diff_view( _this );
539 this.el.add ( child_0.el );
542 // user defined functions
544 public class Xcls_diff_view : Object
546 public Gtk.SourceView el;
547 private RepoStatusPopover _this;
553 public Xcls_diff_view(RepoStatusPopover _owner )
556 _this.diff_view = this;
557 this.el = new Gtk.SourceView();
563 var description = Pango.FontDescription.from_string("monospace");
564 description.set_size(9000);
565 this.el.override_font(description);
568 // user defined functions
574 public class Xcls_Box18 : Object
577 private RepoStatusPopover _this;
583 public Xcls_Box18(RepoStatusPopover _owner )
586 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
590 // set gobject values
591 this.el.homogeneous = true;
592 this.el.expand = false;
593 this.el.vexpand = false;
594 var child_0 = new Xcls_Toolbar19( _this );
596 this.el.add ( child_0.el );
599 // user defined functions
601 public class Xcls_Toolbar19 : Object
603 public Gtk.Toolbar el;
604 private RepoStatusPopover _this;
610 public Xcls_Toolbar19(RepoStatusPopover _owner )
613 this.el = new Gtk.Toolbar();
617 // set gobject values
618 this.el.toolbar_style = Gtk.ToolbarStyle.BOTH_HORIZ;
619 var child_0 = new Xcls_btn_create( _this );
621 this.el.add ( child_0.el );
622 var child_1 = new Xcls_btn_merge( _this );
624 this.el.add ( child_1.el );
625 var child_2 = new Xcls_ToolButton22( _this );
627 this.el.add ( child_2.el );
630 // user defined functions
632 public class Xcls_btn_create : Object
634 public Gtk.ToolButton el;
635 private RepoStatusPopover _this;
641 public Xcls_btn_create(RepoStatusPopover _owner )
644 _this.btn_create = this;
645 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-add", Gtk.IconSize.SMALL_TOOLBAR), null);;
649 // set gobject values
650 this.el.label = "Create Branch / Start ticket";
651 this.el.is_important = true;
654 this.el.button_press_event.connect( () => {
655 var oldq = new Gee.ArrayList<GitMonitorQueue>();
657 Clones.singleton().el.response(-1);
658 NewBranch.singleton().show(_this.repo, oldq);
664 // user defined functions
667 public class Xcls_btn_merge : Object
669 public Gtk.ToolButton el;
670 private RepoStatusPopover _this;
676 public Xcls_btn_merge(RepoStatusPopover _owner )
679 _this.btn_merge = this;
680 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-top", Gtk.IconSize.SMALL_TOOLBAR), null);;
684 // set gobject values
685 this.el.label = "Merge branch / Complete ticket";
686 this.el.is_important = true;
689 this.el.clicked.connect( () => {
692 Clones.singleton().el.response(-1);
693 if (_this.repo.activeTicket != null) {
694 MergeBranch.singleton().show(_this.repo.activeTicket, null);
700 // user defined functions
703 public class Xcls_ToolButton22 : Object
705 public Gtk.ToolButton el;
706 private RepoStatusPopover _this;
712 public Xcls_ToolButton22(RepoStatusPopover _owner )
715 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-new", Gtk.IconSize.SMALL_TOOLBAR), null);;
719 // set gobject values
720 this.el.label = "Create Ticket";
721 this.el.is_important = true;
724 this.el.button_press_event.connect( () => {
728 Clones.singleton().el.response(-1);
731 Ticket.singleton().show( _this.repo);
737 // user defined functions