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.js'].XObject
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,null, null, 1, Gtk.get_current_event_time());
42 var a = new Gdk.Rectangle();
43 // needs direction=inout setting in gir to work (in bugzilla @present)
44 this.el.get_geometry(g,a,null);
46 // should check to see if @ top or bottom I guess..
47 menu.el.get_toplevel().move(a.x, a.y +a.height);
59 this.el = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_MEDIA_PAUSE);
60 XObject.prototype.init.call(this);
62 label: 'Pause Commits',
64 always_show_image : true,
70 activate : function () {
71 this.parent.parent.paused = true;
72 // this.el.label = status ? 'Resume' : 'Pause';
73 this.parent.parent.el.set_from_stock( Gtk.STOCK_MEDIA_PAUSE );
81 this.el = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_MEDIA_PLAY);
82 XObject.prototype.init.call(this);
84 label: 'Resume Commits',
85 always_show_image : true,
91 activate : function () {
92 this.parent.parent.paused = false;
93 //var status = this.el.label == 'Pause' ? 1 : 0
94 // this.el.label = status ? 'Resume' : 'Pause';
95 this.parent.parent.el.set_from_stock( Gtk.STOCK_MEDIA_PLAY);
106 activate : function () {
107 var msg = new Gtk.MessageDialog({message_type:
108 Gtk.MessageType.INFO, buttons : Gtk.ButtonsType.OK, text: "GIT Live - auto commits and pushes everything in ~/gitlive"});
120 activate : function () {