1 //<script type="text/javascript">
5 * Status icon and menu for component of gitlive.
7 * Implements XObject - however we want to control initialization.
11 * Currently only does a few things
19 XObject = imports.XObject.XObject
20 gitlive = imports.gitlive;
23 StatusIcon = new XObject({
25 paused : false, // on!
26 xtype : Gtk.StatusIcon,
27 stock : Gtk.STOCK_MEDIA_PLAY,
28 tooltip_text : 'GitLive',
30 //'popup-menu' : function( w, event, event_time) {
31 'activate' : function( w, event, event_time) {
32 print(Array.prototype.slice.call(arguments).join(','));
34 menu = this.get('menu');
38 this.get(!this.paused ? 'resume' : 'pause' ).el.hide();
40 menu.el.popup(null, null,Gtk.StatusIcon.position_menu , this.el , 1, Gtk.get_current_event_time());
41 //menu.el.popup(null, null,null, null, 1, Gtk.get_current_event_time());
46 var a = new Gdk.Rectangle();
47 // needs direction=inout setting in gir to work (in bugzilla @present)
48 this.el.get_geometry(g,a,null);
50 // should check to see if @ top or bottom I guess..
51 menu.el.get_toplevel().move(a.x, a.y +a.height);
63 this.el = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_MEDIA_PAUSE);
64 XObject.prototype.init.call(this);
66 label: 'Pause Commits',
68 always_show_image : true,
74 activate : function () {
75 this.parent.parent.paused = true;
76 gitlive.monitor.stop();
77 // this.el.label = status ? 'Resume' : 'Pause';
78 this.parent.parent.el.set_from_stock( Gtk.STOCK_MEDIA_PAUSE );
86 this.el = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_MEDIA_PLAY);
87 XObject.prototype.init.call(this);
89 label: 'Resume Commits',
90 always_show_image : true,
96 activate : function () {
97 this.parent.parent.paused = false;
98 gitlive.monitor.start();
99 //var status = this.el.label == 'Pause' ? 1 : 0
100 // this.el.label = status ? 'Resume' : 'Pause';
101 this.parent.parent.el.set_from_stock( Gtk.STOCK_MEDIA_PLAY);
109 this.el = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_RELOAD);
110 XObject.prototype.init.call(this);
112 label: 'Pull (Refresh) All',
113 always_show_image : true,
118 activate : function () {
119 gitlive.monitor.stop();
123 gitlive.monitor.start();
130 this.el = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_RELOAD);
131 XObject.prototype.init.call(this);
133 label: 'Manage Clones',
134 always_show_image : true,
140 activate : function () {
152 this.el = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_ABOUT);
153 XObject.prototype.init.call(this);
155 label: 'About GitLive',
158 activate : function () {
159 var msg = new Gtk.MessageDialog({message_type:
160 Gtk.MessageType.INFO, buttons : Gtk.ButtonsType.OK, text: "GIT Live - auto commits and pushes everything in ~/gitlive"});
169 this.el = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_QUIT);
170 XObject.prototype.init.call(this);
175 activate : function () {