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 xtype : Gtk.StatusIcon,
26 stock : Gtk.STOCK_MEDIA_PLAY,
27 tooltip_text : 'GitLive',
29 'popup-menu' : function( w, event, event_time) {
30 print(Array.prototype.slice.call(arguments).join(','));
32 menu = this.get('menu');
36 this.get(this.status ? 'pause' : 'resume').el.hide();
38 menu.el.popup(null, null, null, event, event_time);
39 var g = Gtk.StatusIcon.position_menu (menu.el, null, null, null, null)
40 print(Object.keys(g).join(','));
42 menu.el.get_toplevel().move(g.x,g.y);
43 //menu.el.reposition();
45 //menu.el.popup(null, null , null, null, event, event_time);
55 xtype: Gtk.ImageMenuItem.from_stock,
56 stock: Gtk.STOCK_MEDIA_PAUSE,
58 always_show_image : true,
64 activate : function () {
65 this.parent.parent.status = 1;
66 // this.el.label = status ? 'Resume' : 'Pause';
67 this.parent.parent.el.set_from_stock( Gtk.STOCK_MEDIA_PAUSE );
74 xtype: Gtk.ImageMenuItem.from_stock,
75 stock: Gtk.STOCK_MEDIA_PLAY,
76 always_show_image : true,
82 activate : function () {
83 this.parent.parent.status = 0;
84 //var status = this.el.label == 'Pause' ? 1 : 0
85 // this.el.label = status ? 'Resume' : 'Pause';
86 this.parent.parent.el.set_from_stock( Gtk.STOCK_MEDIA_PLAY);
97 activate : function () {
98 var msg = new Gtk.MessageDialog({message_type:
99 Gtk.MessageType.INFO, buttons : Gtk.ButtonsType.OK, text: "GIT Live - auto commits and pushes everything in ~/gitlive"});
111 activate : function () {