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 GitMonitor.gitmonitor.stop();
247 _this.repo.git({ "commit" , "-a" ,"-m", "Uncommited changes synced" });
249 _this.repo.loadStatus();
251 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
252 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
255 Clones.singleton().reposStore.load();
256 GitMonitor.gitmonitor.start();
261 // user defined functions
264 public class Xcls_btn_reset : Object
266 public Gtk.ToolButton el;
267 private RepoStatusPopover _this;
273 public Xcls_btn_reset(RepoStatusPopover _owner )
276 _this.btn_reset = this;
277 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-revert-to-saved", Gtk.IconSize.SMALL_TOOLBAR), null);;
281 // set gobject values
282 this.el.label = "Reset / clear changes";
283 this.el.is_important = true;
286 this.el.clicked.connect( () => {
289 GitMonitor.gitmonitor.stop();
290 _this.repo.git({ "reset" , "--hard" });
291 _this.repo.loadStatus();
292 GitMonitor.gitmonitor.start();
293 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
294 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
295 Clones.singleton().reposStore.load();
302 // user defined functions
305 public class Xcls_btn_pull : Object
307 public Gtk.ToolButton el;
308 private RepoStatusPopover _this;
314 public Xcls_btn_pull(RepoStatusPopover _owner )
317 _this.btn_pull = this;
318 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-bottom", Gtk.IconSize.SMALL_TOOLBAR), null);;
322 // set gobject values
323 this.el.label = "Pull updates";
324 this.el.is_important = true;
327 this.el.clicked.connect( () => {
330 GitMonitor.gitmonitor.stop();
331 _this.repo.git({ "pull" , "--all" });
332 _this.repo.loadStatus();
333 GitMonitor.gitmonitor.start();
334 _this.diff_view.el.get_buffer().set_text(_this.repo.git_diff);
335 _this.status_view.el.get_buffer().set_text(_this.repo.git_status);
336 Clones.singleton().reposStore.load();
343 // user defined functions
348 public class Xcls_Notebook9 : Object
350 public Gtk.Notebook el;
351 private RepoStatusPopover _this;
357 public Xcls_Notebook9(RepoStatusPopover _owner )
360 this.el = new Gtk.Notebook();
364 // set gobject values
365 this.el.vexpand = true;
366 var child_0 = new Xcls_label_status( _this );
368 var child_1 = new Xcls_label_diff( _this );
370 var child_2 = new Xcls_Box12( _this );
372 this.el.append_page ( child_2.el , _this.label_status.el );
373 var child_3 = new Xcls_Box15( _this );
375 this.el.append_page ( child_3.el , _this.label_diff.el );
378 // user defined functions
380 public class Xcls_label_status : Object
383 private RepoStatusPopover _this;
389 public Xcls_label_status(RepoStatusPopover _owner )
392 _this.label_status = this;
393 this.el = new Gtk.Label( "Status" );
397 // set gobject values
400 // user defined functions
403 public class Xcls_label_diff : Object
406 private RepoStatusPopover _this;
412 public Xcls_label_diff(RepoStatusPopover _owner )
415 _this.label_diff = this;
416 this.el = new Gtk.Label( "Diff" );
420 // set gobject values
423 // user defined functions
426 public class Xcls_Box12 : Object
429 private RepoStatusPopover _this;
435 public Xcls_Box12(RepoStatusPopover _owner )
438 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
442 // set gobject values
443 this.el.homogeneous = false;
444 var child_0 = new Xcls_ScrolledWindow13( _this );
446 this.el.pack_start ( child_0.el , true,true,0 );
449 // user defined functions
451 public class Xcls_ScrolledWindow13 : Object
453 public Gtk.ScrolledWindow el;
454 private RepoStatusPopover _this;
460 public Xcls_ScrolledWindow13(RepoStatusPopover _owner )
463 this.el = new Gtk.ScrolledWindow( null, null );
467 // set gobject values
468 var child_0 = new Xcls_status_view( _this );
470 this.el.add ( child_0.el );
473 // user defined functions
475 public class Xcls_status_view : Object
477 public Gtk.SourceView el;
478 private RepoStatusPopover _this;
484 public Xcls_status_view(RepoStatusPopover _owner )
487 _this.status_view = this;
488 this.el = new Gtk.SourceView();
494 var description = Pango.FontDescription.from_string("monospace");
495 description.set_size(9000);
496 this.el.override_font(description);
499 // user defined functions
504 public class Xcls_Box15 : Object
507 private RepoStatusPopover _this;
513 public Xcls_Box15(RepoStatusPopover _owner )
516 this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
520 // set gobject values
521 this.el.homogeneous = false;
522 var child_0 = new Xcls_ScrolledWindow16( _this );
524 this.el.pack_start ( child_0.el , true,true,0 );
527 // user defined functions
529 public class Xcls_ScrolledWindow16 : Object
531 public Gtk.ScrolledWindow el;
532 private RepoStatusPopover _this;
538 public Xcls_ScrolledWindow16(RepoStatusPopover _owner )
541 this.el = new Gtk.ScrolledWindow( null, null );
545 // set gobject values
546 this.el.height_request = 400;
547 var child_0 = new Xcls_diff_view( _this );
549 this.el.add ( child_0.el );
552 // user defined functions
554 public class Xcls_diff_view : Object
556 public Gtk.SourceView el;
557 private RepoStatusPopover _this;
563 public Xcls_diff_view(RepoStatusPopover _owner )
566 _this.diff_view = this;
567 this.el = new Gtk.SourceView();
573 var description = Pango.FontDescription.from_string("monospace");
574 description.set_size(9000);
575 this.el.override_font(description);
576 var lm = Gtk.SourceLanguageManager.get_default();
578 ((Gtk.SourceBuffer)(this.el.get_buffer())).set_language(
579 lm.get_language("diff")
583 // user defined functions
589 public class Xcls_Box18 : Object
592 private RepoStatusPopover _this;
598 public Xcls_Box18(RepoStatusPopover _owner )
601 this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
605 // set gobject values
606 this.el.homogeneous = true;
607 this.el.expand = false;
608 this.el.vexpand = false;
609 var child_0 = new Xcls_Toolbar19( _this );
611 this.el.add ( child_0.el );
614 // user defined functions
616 public class Xcls_Toolbar19 : Object
618 public Gtk.Toolbar el;
619 private RepoStatusPopover _this;
625 public Xcls_Toolbar19(RepoStatusPopover _owner )
628 this.el = new Gtk.Toolbar();
632 // set gobject values
633 this.el.toolbar_style = Gtk.ToolbarStyle.BOTH_HORIZ;
634 var child_0 = new Xcls_btn_create( _this );
636 this.el.add ( child_0.el );
637 var child_1 = new Xcls_btn_merge( _this );
639 this.el.add ( child_1.el );
640 var child_2 = new Xcls_ToolButton22( _this );
642 this.el.add ( child_2.el );
645 // user defined functions
647 public class Xcls_btn_create : Object
649 public Gtk.ToolButton el;
650 private RepoStatusPopover _this;
656 public Xcls_btn_create(RepoStatusPopover _owner )
659 _this.btn_create = this;
660 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-add", Gtk.IconSize.SMALL_TOOLBAR), null);;
664 // set gobject values
665 this.el.label = "Create Branch / Start ticket";
666 this.el.is_important = true;
669 this.el.clicked.connect( () => {
670 var oldq = new Gee.ArrayList<GitMonitorQueue>();
672 Clones.singleton().el.response(-1);
673 NewBranch.singleton().show(_this.repo, oldq);
679 // user defined functions
682 public class Xcls_btn_merge : Object
684 public Gtk.ToolButton el;
685 private RepoStatusPopover _this;
691 public Xcls_btn_merge(RepoStatusPopover _owner )
694 _this.btn_merge = this;
695 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-goto-top", Gtk.IconSize.SMALL_TOOLBAR), null);;
699 // set gobject values
700 this.el.label = "Merge branch / Complete ticket";
701 this.el.is_important = true;
704 this.el.clicked.connect( () => {
707 Clones.singleton().el.response(-1);
708 if (_this.repo.activeTicket != null) {
709 MergeBranch.singleton().show(_this.repo.activeTicket, null);
715 // user defined functions
718 public class Xcls_ToolButton22 : Object
720 public Gtk.ToolButton el;
721 private RepoStatusPopover _this;
727 public Xcls_ToolButton22(RepoStatusPopover _owner )
730 this.el = new Gtk.ToolButton(new Gtk.Image.from_icon_name ("gtk-new", Gtk.IconSize.SMALL_TOOLBAR), null);;
734 // set gobject values
735 this.el.label = "Create Ticket";
736 this.el.is_important = true;
739 this.el.clicked.connect( () => {
743 Clones.singleton().el.response(-1);
746 Ticket.singleton().show( _this.repo);
751 // user defined functions