-
- items : [
- {
- xtype: Gtk.Menu,
- id : 'menu',
- pack: false,
- items : [
- {
- init : function() {
-
- this.el = XObject.isSeed ?
- new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_MEDIA_PAUSE)
- : new Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_MEDIA_PAUSE, null);
- XObject.prototype.init.call(this);
- },
- label: 'Pause Commits',
-
- always_show_image : true,
- accel_group : null,
- id : 'pause',
- //label: 'Pause',
- pack: 'append',
- listeners : {
- activate : function () {
- this.parent.parent.paused = true;
- imports.GitMonitor.GitMonitor.stop();
- // this.el.label = status ? 'Resume' : 'Pause';
- this.parent.parent.el.set_from_stock( Gtk.STOCK_MEDIA_PAUSE );
-
- }
- }
- },
+ public void resume()
+ {
+ this.set_from_stock( Gtk.Stock.MEDIA_PLAY );
+ this.paused = false;
+ }
+
+ public void refreshing()
+ {
+ this.set_from_stock( Gtk.Stock.REFRESH );
+ }
+
+ public void pauseError()
+ {
+ this.paused = true;
+ var flag = true;
+ Timeout.add_full(Priority.LOW, 500, () => {
+
+ if (!this.paused) {
+ return false;
+ }
+ this.set_from_stock( flag == true ? Gtk.Stock.MEDIA_RECORD
+ : Gtk.Stock.MEDIA_PAUSE);
+ flag = !flag;
+ return true;
+ });
+
+ }
+
+ class GitliveMenu : Gtk.Menu
+ {
+ public ImageMenuItem pause;
+ public ImageMenuItem resume;
+ public Gtk.MenuItem before_seperator;
+ public Gtk.MenuItem after_seperator;
+
+
+ public GitliveMenu()
+ {
+ this.pause = new MenuItemPause();
+ this.append(this.pause);
+ this.resume = new MenuItemStartCommits();
+ this.append(this.resume);
+ this.append(new MenuItemPullAll());
+ this.before_seperator = new Gtk.SeparatorMenuItem();
+ this.append(this.before_seperator);
+
+ this.after_seperator = new Gtk.SeparatorMenuItem();
+ this.append(this.after_seperator);
+ //this.append(new MenuItemUpdateTimesheet());
+ this.append(new MenuItemManageClones());
+ this.append(new MenuItemNewTicket());
+ this.append(new MenuItemAbout());
+ this.append(new MenuItemQuit());
+ this.merge_items = new Gee.ArrayList<Gtk.MenuItem>();
+ }
+ public Gee.ArrayList<Gtk.MenuItem> merge_items;
+
+
+ public void updateMerges()
+ {
+ // show a list of possible merges on the menu.
+ foreach (var m in this.merge_items) {
+ this.remove(m);
+ }
+ foreach(var r in GitRepo.singleton().cache.values ) {
+ GLib.debug("checking %s for branch = %s", r.name, r.currentBranch.name);
+ if (r.is_master_branch()) {
+ continue;
+ }
+ GLib.debug("checking for activeTicket");
+ var t = r.activeTicket;
+ if (t == null) {
+ continue;
+ }
+ var mi = new MergeMenuItem(r,t);
+ this.insert (mi,4); //backwards.
+ this.merge_items.add(mi);
+
+ }
+
+ }
+
+
+ class MergeMenuItem : Gtk.MenuItem {
+
+ GitRepo repo;
+ RooTicket ticket;
+
+ public MergeMenuItem(GitRepo r, RooTicket t)
+ {
+ this.repo = r;
+ this.ticket = t;
+
+ this.label = ("Merge [%s] #%s %s".printf(r.name, t.id , t.summary));
+
+ this.activate.connect(() => {
+ MergeBranch.singleton().show(this.ticket, null);
+ // show merge dialog..
+ });
+
+ }
+
+ }
+
+
+ class MenuItemPause : ImageMenuItem {
+
+ public MenuItemPause()
+ {
+ //this.set_from_stock( Gtk.Stock.MEDIA_PAUSE );