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( () => {
246 _this.repo.git({ "commit" , "-a" ,"-m", "Uncommited changes synced" });
248 _this.repo.loadStatus();
250 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
251 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
254 Clones.singleton().reposStore.load();
259 // user defined functions
262 public class Xcls_btn_reset : Object
264 public Gtk.ToolButton el;
265 private RepoStatusPopover _this;
271 public Xcls_btn_reset(RepoStatusPopover _owner )
274 _this.btn_reset = this;
275 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-revert-to-saved", Gtk.IconSize.SMALL_TOOLBAR), null);;
279 // set gobject values
280 this.el.label = "Reset / clear changes";
281 this.el.is_important = true;
284 this.el.clicked.connect( () => {
287 GitMonitor.gitmonitor.stop();
288 _this.repo.git({ "reset" , "--hard" });
289 _this.repo.loadStatus();
290 GitMonitor.gitmonitor.start();
291 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
292 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
293 Clones.singleton().reposStore.load();
300 // user defined functions
303 public class Xcls_btn_pull : Object
305 public Gtk.ToolButton el;
306 private RepoStatusPopover _this;
312 public Xcls_btn_pull(RepoStatusPopover _owner )
315 _this.btn_pull = this;
316 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-bottom", Gtk.IconSize.SMALL_TOOLBAR), null);;
320 // set gobject values
321 this.el.label = "Pull updates";
322 this.el.is_important = true;
325 this.el.clicked.connect( () => {
328 GitMonitor.gitmonitor.stop();
329 _this.repo.git({ "pull" , "--all" });
330 _this.repo.loadStatus();
331 GitMonitor.gitmonitor.start();
332 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
333 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
334 Clones.singleton().reposStore.load();
341 // user defined functions
346 public class Xcls_Notebook9 : Object
348 public Gtk.Notebook el;
349 private RepoStatusPopover _this;
355 public Xcls_Notebook9(RepoStatusPopover _owner )
358 this.el = new Gtk.Notebook();
362 // set gobject values
363 this.el.vexpand = true;
364 var child_0 = new Xcls_label_status( _this );
366 var child_1 = new Xcls_label_diff( _this );
368 var child_2 = new Xcls_Box12( _this );
370 this.el.append_page ( child_2.el , _this.label_status.el );
371 var child_3 = new Xcls_Box15( _this );
373 this.el.append_page ( child_3.el , _this.label_diff.el );
376 // user defined functions
378 public class Xcls_label_status : Object
381 private RepoStatusPopover _this;
387 public Xcls_label_status(RepoStatusPopover _owner )
390 _this.label_status = this;
391 this.el = new Gtk.Label( "Status" );
395 // set gobject values
398 // user defined functions
401 public class Xcls_label_diff : Object
404 private RepoStatusPopover _this;
410 public Xcls_label_diff(RepoStatusPopover _owner )
413 _this.label_diff = this;
414 this.el = new Gtk.Label( "Diff" );
418 // set gobject values
421 // user defined functions
424 public class Xcls_Box12 : Object
427 private RepoStatusPopover _this;
433 public Xcls_Box12(RepoStatusPopover _owner )
436 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
440 // set gobject values
441 this.el.homogeneous = false;
442 var child_0 = new Xcls_ScrolledWindow13( _this );
444 this.el.pack_start ( child_0.el , true,true,0 );
447 // user defined functions
449 public class Xcls_ScrolledWindow13 : Object
451 public Gtk.ScrolledWindow el;
452 private RepoStatusPopover _this;
458 public Xcls_ScrolledWindow13(RepoStatusPopover _owner )
461 this.el = new Gtk.ScrolledWindow( null, null );
465 // set gobject values
466 var child_0 = new Xcls_status_view( _this );
468 this.el.add ( child_0.el );
471 // user defined functions
473 public class Xcls_status_view : Object
475 public Gtk.SourceView el;
476 private RepoStatusPopover _this;
482 public Xcls_status_view(RepoStatusPopover _owner )
485 _this.status_view = this;
486 this.el = new Gtk.SourceView();
492 var description = Pango.FontDescription.from_string("monospace");
493 description.set_size(9000);
494 this.el.override_font(description);
497 // user defined functions
502 public class Xcls_Box15 : Object
505 private RepoStatusPopover _this;
511 public Xcls_Box15(RepoStatusPopover _owner )
514 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
518 // set gobject values
519 this.el.homogeneous = false;
520 var child_0 = new Xcls_ScrolledWindow16( _this );
522 this.el.pack_start ( child_0.el , true,true,0 );
525 // user defined functions
527 public class Xcls_ScrolledWindow16 : Object
529 public Gtk.ScrolledWindow el;
530 private RepoStatusPopover _this;
536 public Xcls_ScrolledWindow16(RepoStatusPopover _owner )
539 this.el = new Gtk.ScrolledWindow( null, null );
543 // set gobject values
544 this.el.height_request = 400;
545 var child_0 = new Xcls_diff_view( _this );
547 this.el.add ( child_0.el );
550 // user defined functions
552 public class Xcls_diff_view : Object
554 public Gtk.SourceView el;
555 private RepoStatusPopover _this;
561 public Xcls_diff_view(RepoStatusPopover _owner )
564 _this.diff_view = this;
565 this.el = new Gtk.SourceView();
571 var description = Pango.FontDescription.from_string("monospace");
572 description.set_size(9000);
573 this.el.override_font(description);
576 // user defined functions
582 public class Xcls_Box18 : Object
585 private RepoStatusPopover _this;
591 public Xcls_Box18(RepoStatusPopover _owner )
594 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
598 // set gobject values
599 this.el.homogeneous = true;
600 this.el.expand = false;
601 this.el.vexpand = false;
602 var child_0 = new Xcls_Toolbar19( _this );
604 this.el.add ( child_0.el );
607 // user defined functions
609 public class Xcls_Toolbar19 : Object
611 public Gtk.Toolbar el;
612 private RepoStatusPopover _this;
618 public Xcls_Toolbar19(RepoStatusPopover _owner )
621 this.el = new Gtk.Toolbar();
625 // set gobject values
626 this.el.toolbar_style = Gtk.ToolbarStyle.BOTH_HORIZ;
627 var child_0 = new Xcls_btn_create( _this );
629 this.el.add ( child_0.el );
630 var child_1 = new Xcls_btn_merge( _this );
632 this.el.add ( child_1.el );
633 var child_2 = new Xcls_ToolButton22( _this );
635 this.el.add ( child_2.el );
638 // user defined functions
640 public class Xcls_btn_create : Object
642 public Gtk.ToolButton el;
643 private RepoStatusPopover _this;
649 public Xcls_btn_create(RepoStatusPopover _owner )
652 _this.btn_create = this;
653 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-add", Gtk.IconSize.SMALL_TOOLBAR), null);;
657 // set gobject values
658 this.el.label = "Create Branch / Start ticket";
659 this.el.is_important = true;
662 this.el.clicked.connect( () => {
663 var oldq = new Gee.ArrayList<GitMonitorQueue>();
665 Clones.singleton().el.response(-1);
666 NewBranch.singleton().show(_this.repo, oldq);
672 // user defined functions
675 public class Xcls_btn_merge : Object
677 public Gtk.ToolButton el;
678 private RepoStatusPopover _this;
684 public Xcls_btn_merge(RepoStatusPopover _owner )
687 _this.btn_merge = this;
688 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-top", Gtk.IconSize.SMALL_TOOLBAR), null);;
692 // set gobject values
693 this.el.label = "Merge branch / Complete ticket";
694 this.el.is_important = true;
697 this.el.clicked.connect( () => {
700 Clones.singleton().el.response(-1);
701 if (_this.repo.activeTicket != null) {
702 MergeBranch.singleton().show(_this.repo.activeTicket, null);
708 // user defined functions
711 public class Xcls_ToolButton22 : Object
713 public Gtk.ToolButton el;
714 private RepoStatusPopover _this;
720 public Xcls_ToolButton22(RepoStatusPopover _owner )
723 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-new", Gtk.IconSize.SMALL_TOOLBAR), null);;
727 // set gobject values
728 this.el.label = "Create Ticket";
729 this.el.is_important = true;
732 this.el.clicked.connect( () => {
736 Clones.singleton().el.response(-1);
739 Ticket.singleton().show( _this.repo);
744 // user defined functions