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,Gtk.StatusIcon , 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 // this.el.label = status ? 'Resume' : 'Pause';
77 this.parent.parent.el.set_from_stock( Gtk.STOCK_MEDIA_PAUSE );
85 this.el = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_MEDIA_PLAY);
86 XObject.prototype.init.call(this);
88 label: 'Resume Commits',
89 always_show_image : true,
95 activate : function () {
96 this.parent.parent.paused = false;
97 //var status = this.el.label == 'Pause' ? 1 : 0
98 // this.el.label = status ? 'Resume' : 'Pause';
99 this.parent.parent.el.set_from_stock( Gtk.STOCK_MEDIA_PLAY);
107 this.el = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_RELOAD);
108 XObject.prototype.init.call(this);
110 label: 'Pull (Refresh) All',
111 always_show_image : true,
116 activate : function () {
124 this.el = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_RELOAD);
125 XObject.prototype.init.call(this);
127 label: 'Manage Clones',
128 always_show_image : true,
134 activate : function () {
146 this.el = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_ABOUT);
147 XObject.prototype.init.call(this);
149 label: 'About GitLive',
152 activate : function () {
153 var msg = new Gtk.MessageDialog({message_type:
154 Gtk.MessageType.INFO, buttons : Gtk.ButtonsType.OK, text: "GIT Live - auto commits and pushes everything in ~/gitlive"});
163 this.el = new Gtk.ImageMenuItem.from_stock(Gtk.STOCK_QUIT);
164 XObject.prototype.init.call(this);
169 activate : function () {