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_btn_reset btn_reset;
18 public Xcls_btn_pull btn_pull;
19 public Xcls_label_status label_status;
20 public Xcls_label_diff label_diff;
21 public Xcls_status_view status_view;
22 public Xcls_diff_view diff_view;
23 public Xcls_btn_create btn_create;
24 public Xcls_btn_merge btn_merge;
30 public RepoStatusPopover()
33 this.el = new Gtk.Popover( null );
38 this.el.border_width = 0;
40 this.el.position = Gtk.PositionType.RIGHT;
41 var child_0 = new Xcls_Box2( _this );
43 this.el.add ( child_0.el );
46 // user defined functions
47 public void show (Gtk.Widget btn, Gdk.Rectangle rect, GitRepo repo) {
49 // get the active project.
50 var lm = Gtk.SourceLanguageManager.get_default();
52 // ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
53 // lm.get_language("html")
57 //project.runhtml = project.runhtml || '';
58 _this.diff_view.el.get_buffer().set_text(repo.git_diff);
59 _this.status_view.el.get_buffer().set_text(repo.git_status);
61 //console.log('show all');
62 this.el.set_modal(true);
63 this.el.set_relative_to(btn);
64 this.el.set_pointing_to(rect);
66 //this.el.set_position(Gtk.PositionType.RIGHT);
68 if (repo.activeTicket == null) {
69 _this.btn_merge.el.set_sensitive(false);
71 _this.btn_merge.el.set_sensitive(true);
73 _this.btn_create.el.set_sensitive(repo.is_master_branch());
75 _this.btn_stash.el.set_sensitive(repo.has_local_changes);
76 _this.btn_commit.el.set_sensitive(repo.has_local_changes);
77 _this.btn_reset.el.set_sensitive(repo.has_local_changes);
78 _this.btn_pull.el.set_sensitive(repo.ahead_or_behind == "B");
81 GLib.debug("SHOWALL - POPIP\n");
83 //this.el.set_size_request(800,500);
84 // this.diff_view.el.grab_focus();
88 public class Xcls_Box2 : Object
91 private RepoStatusPopover _this;
97 public Xcls_Box2(RepoStatusPopover _owner )
100 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
104 // set gobject values
105 this.el.homogeneous = false;
106 this.el.border_width = 5;
107 var child_0 = new Xcls_Box3( _this );
109 this.el.pack_start ( child_0.el , false,false,0 );
110 var child_1 = new Xcls_Notebook9( _this );
112 this.el.add ( child_1.el );
113 var child_2 = new Xcls_Box18( _this );
115 this.el.pack_end ( child_2.el , false,false,0 );
118 // user defined functions
120 public class Xcls_Box3 : Object
123 private RepoStatusPopover _this;
129 public Xcls_Box3(RepoStatusPopover _owner )
132 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
136 // set gobject values
137 this.el.homogeneous = true;
138 this.el.expand = false;
139 this.el.vexpand = false;
140 var child_0 = new Xcls_Toolbar4( _this );
142 this.el.add ( child_0.el );
145 // user defined functions
147 public class Xcls_Toolbar4 : Object
149 public Gtk.Toolbar el;
150 private RepoStatusPopover _this;
156 public Xcls_Toolbar4(RepoStatusPopover _owner )
159 this.el = new Gtk.Toolbar();
163 // set gobject values
164 this.el.toolbar_style = Gtk.ToolbarStyle.BOTH_HORIZ;
165 var child_0 = new Xcls_btn_stash( _this );
167 this.el.add ( child_0.el );
168 var child_1 = new Xcls_btn_commit( _this );
170 this.el.add ( child_1.el );
171 var child_2 = new Xcls_btn_reset( _this );
173 this.el.add ( child_2.el );
174 var child_3 = new Xcls_btn_pull( _this );
176 this.el.add ( child_3.el );
179 // user defined functions
181 public class Xcls_btn_stash : Object
183 public Gtk.ToolButton el;
184 private RepoStatusPopover _this;
190 public Xcls_btn_stash(RepoStatusPopover _owner )
193 _this.btn_stash = this;
194 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-undo", Gtk.IconSize.SMALL_TOOLBAR), null);;
198 // set gobject values
199 this.el.label = "Stash Changes";
200 this.el.is_important = true;
203 this.el.clicked.connect( () => {
206 GitMonitor.gitmonitor.stop();
207 _this.repo.git({ "stash" , "--all" });
208 _this.repo.loadStatus();
209 GitMonitor.gitmonitor.start();
210 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
211 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
212 Clones.singleton().reposStore.load();
219 // user defined functions
222 public class Xcls_btn_commit : Object
224 public Gtk.ToolButton el;
225 private RepoStatusPopover _this;
231 public Xcls_btn_commit(RepoStatusPopover _owner )
234 _this.btn_commit = this;
235 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-save", Gtk.IconSize.SMALL_TOOLBAR), null);;
239 // set gobject values
240 this.el.label = "Commit Changes";
241 this.el.is_important = true;
244 this.el.clicked.connect( () => {
245 _this.repo.git({ "commit" , "-a" ,"-m", "Uncommited changes synced" });
247 _this.repo.loadStatus();
249 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
250 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
253 Clones.singleton().reposStore.load();
258 // user defined functions
261 public class Xcls_btn_reset : Object
263 public Gtk.ToolButton el;
264 private RepoStatusPopover _this;
270 public Xcls_btn_reset(RepoStatusPopover _owner )
273 _this.btn_reset = this;
274 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-revert-to-saved", Gtk.IconSize.SMALL_TOOLBAR), null);;
278 // set gobject values
279 this.el.label = "Reset / clear changes";
280 this.el.is_important = true;
283 this.el.clicked.connect( () => {
286 GitMonitor.gitmonitor.stop();
287 _this.repo.git({ "reset" , "--hard" });
288 _this.repo.loadStatus();
289 GitMonitor.gitmonitor.start();
290 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
291 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
292 Clones.singleton().reposStore.load();
299 // user defined functions
302 public class Xcls_btn_pull : Object
304 public Gtk.ToolButton el;
305 private RepoStatusPopover _this;
311 public Xcls_btn_pull(RepoStatusPopover _owner )
314 _this.btn_pull = this;
315 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-bottom", Gtk.IconSize.SMALL_TOOLBAR), null);;
319 // set gobject values
320 this.el.label = "Pull updates";
321 this.el.is_important = true;
324 this.el.clicked.connect( () => {
327 GitMonitor.gitmonitor.stop();
328 _this.repo.git({ "pull" , "--all" });
329 _this.repo.loadStatus();
330 GitMonitor.gitmonitor.start();
331 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
332 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
333 Clones.singleton().reposStore.load();
340 // user defined functions
345 public class Xcls_Notebook9 : Object
347 public Gtk.Notebook el;
348 private RepoStatusPopover _this;
354 public Xcls_Notebook9(RepoStatusPopover _owner )
357 this.el = new Gtk.Notebook();
361 // set gobject values
362 this.el.vexpand = true;
363 var child_0 = new Xcls_label_status( _this );
365 var child_1 = new Xcls_label_diff( _this );
367 var child_2 = new Xcls_Box12( _this );
369 this.el.append_page ( child_2.el , _this.label_status.el );
370 var child_3 = new Xcls_Box15( _this );
372 this.el.append_page ( child_3.el , _this.label_diff.el );
375 // user defined functions
377 public class Xcls_label_status : Object
380 private RepoStatusPopover _this;
386 public Xcls_label_status(RepoStatusPopover _owner )
389 _this.label_status = this;
390 this.el = new Gtk.Label( "Status" );
394 // set gobject values
397 // user defined functions
400 public class Xcls_label_diff : Object
403 private RepoStatusPopover _this;
409 public Xcls_label_diff(RepoStatusPopover _owner )
412 _this.label_diff = this;
413 this.el = new Gtk.Label( "Diff" );
417 // set gobject values
420 // user defined functions
423 public class Xcls_Box12 : Object
426 private RepoStatusPopover _this;
432 public Xcls_Box12(RepoStatusPopover _owner )
435 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
439 // set gobject values
440 this.el.homogeneous = false;
441 var child_0 = new Xcls_ScrolledWindow13( _this );
443 this.el.pack_start ( child_0.el , true,true,0 );
446 // user defined functions
448 public class Xcls_ScrolledWindow13 : Object
450 public Gtk.ScrolledWindow el;
451 private RepoStatusPopover _this;
457 public Xcls_ScrolledWindow13(RepoStatusPopover _owner )
460 this.el = new Gtk.ScrolledWindow( null, null );
464 // set gobject values
465 var child_0 = new Xcls_status_view( _this );
467 this.el.add ( child_0.el );
470 // user defined functions
472 public class Xcls_status_view : Object
474 public Gtk.SourceView el;
475 private RepoStatusPopover _this;
481 public Xcls_status_view(RepoStatusPopover _owner )
484 _this.status_view = this;
485 this.el = new Gtk.SourceView();
491 var description = Pango.FontDescription.from_string("monospace");
492 description.set_size(9000);
493 this.el.override_font(description);
496 // user defined functions
501 public class Xcls_Box15 : Object
504 private RepoStatusPopover _this;
510 public Xcls_Box15(RepoStatusPopover _owner )
513 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
517 // set gobject values
518 this.el.homogeneous = false;
519 var child_0 = new Xcls_ScrolledWindow16( _this );
521 this.el.pack_start ( child_0.el , true,true,0 );
524 // user defined functions
526 public class Xcls_ScrolledWindow16 : Object
528 public Gtk.ScrolledWindow el;
529 private RepoStatusPopover _this;
535 public Xcls_ScrolledWindow16(RepoStatusPopover _owner )
538 this.el = new Gtk.ScrolledWindow( null, null );
542 // set gobject values
543 this.el.height_request = 400;
544 var child_0 = new Xcls_diff_view( _this );
546 this.el.add ( child_0.el );
549 // user defined functions
551 public class Xcls_diff_view : Object
553 public Gtk.SourceView el;
554 private RepoStatusPopover _this;
560 public Xcls_diff_view(RepoStatusPopover _owner )
563 _this.diff_view = this;
564 this.el = new Gtk.SourceView();
570 var description = Pango.FontDescription.from_string("monospace");
571 description.set_size(9000);
572 this.el.override_font(description);
575 // user defined functions
581 public class Xcls_Box18 : Object
584 private RepoStatusPopover _this;
590 public Xcls_Box18(RepoStatusPopover _owner )
593 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
597 // set gobject values
598 this.el.homogeneous = true;
599 this.el.expand = false;
600 this.el.vexpand = false;
601 var child_0 = new Xcls_Toolbar19( _this );
603 this.el.add ( child_0.el );
606 // user defined functions
608 public class Xcls_Toolbar19 : Object
610 public Gtk.Toolbar el;
611 private RepoStatusPopover _this;
617 public Xcls_Toolbar19(RepoStatusPopover _owner )
620 this.el = new Gtk.Toolbar();
624 // set gobject values
625 this.el.toolbar_style = Gtk.ToolbarStyle.BOTH_HORIZ;
626 var child_0 = new Xcls_btn_create( _this );
628 this.el.add ( child_0.el );
629 var child_1 = new Xcls_btn_merge( _this );
631 this.el.add ( child_1.el );
632 var child_2 = new Xcls_ToolButton22( _this );
634 this.el.add ( child_2.el );
637 // user defined functions
639 public class Xcls_btn_create : Object
641 public Gtk.ToolButton el;
642 private RepoStatusPopover _this;
648 public Xcls_btn_create(RepoStatusPopover _owner )
651 _this.btn_create = this;
652 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-add", Gtk.IconSize.SMALL_TOOLBAR), null);;
656 // set gobject values
657 this.el.label = "Create Branch / Start ticket";
658 this.el.is_important = true;
661 this.el.clicked.connect( () => {
662 var oldq = new Gee.ArrayList<GitMonitorQueue>();
664 Clones.singleton().el.response(-1);
665 NewBranch.singleton().show(_this.repo, oldq);
671 // user defined functions
674 public class Xcls_btn_merge : Object
676 public Gtk.ToolButton el;
677 private RepoStatusPopover _this;
683 public Xcls_btn_merge(RepoStatusPopover _owner )
686 _this.btn_merge = this;
687 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-top", Gtk.IconSize.SMALL_TOOLBAR), null);;
691 // set gobject values
692 this.el.label = "Merge branch / Complete ticket";
693 this.el.is_important = true;
696 this.el.clicked.connect( () => {
699 Clones.singleton().el.response(-1);
700 if (_this.repo.activeTicket != null) {
701 MergeBranch.singleton().show(_this.repo.activeTicket, null);
707 // user defined functions
710 public class Xcls_ToolButton22 : Object
712 public Gtk.ToolButton el;
713 private RepoStatusPopover _this;
719 public Xcls_ToolButton22(RepoStatusPopover _owner )
722 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-new", Gtk.IconSize.SMALL_TOOLBAR), null);;
726 // set gobject values
727 this.el.label = "Create Ticket";
728 this.el.is_important = true;
731 this.el.clicked.connect( () => {
735 Clones.singleton().el.response(-1);
738 Ticket.singleton().show( _this.repo);
743 // user defined functions