js/ui/panel.js: Lang.bind-ify
This commit is contained in:
parent
397a105638
commit
17fb280884
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
const Big = imports.gi.Big;
|
const Big = imports.gi.Big;
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
|
const Lang = imports.lang;
|
||||||
const Mainloop = imports.mainloop;
|
const Mainloop = imports.mainloop;
|
||||||
const Meta = imports.gi.Meta;
|
const Meta = imports.gi.Meta;
|
||||||
const Shell = imports.gi.Shell;
|
const Shell = imports.gi.Shell;
|
||||||
@ -47,7 +48,6 @@ function Panel() {
|
|||||||
|
|
||||||
Panel.prototype = {
|
Panel.prototype = {
|
||||||
_init : function() {
|
_init : function() {
|
||||||
let me = this;
|
|
||||||
let global = Shell.Global.get();
|
let global = Shell.Global.get();
|
||||||
|
|
||||||
// Put the background under the panel within a group.
|
// Put the background under the panel within a group.
|
||||||
@ -87,12 +87,12 @@ Panel.prototype = {
|
|||||||
box.append(this.button.button, Big.BoxPackFlags.NONE);
|
box.append(this.button.button, Big.BoxPackFlags.NONE);
|
||||||
|
|
||||||
let statusbox = new Big.Box();
|
let statusbox = new Big.Box();
|
||||||
this._statusmenu = new Shell.StatusMenu();
|
let statusmenu = this._statusmenu = new Shell.StatusMenu();
|
||||||
statusbox.append(this._statusmenu, Big.BoxPackFlags.NONE);
|
statusbox.append(this._statusmenu, Big.BoxPackFlags.NONE);
|
||||||
let statusbutton = new Button.Button(statusbox, PANEL_BUTTON_COLOR, PRESSED_BUTTON_BACKGROUND_COLOR,
|
let statusbutton = new Button.Button(statusbox, PANEL_BUTTON_COLOR, PRESSED_BUTTON_BACKGROUND_COLOR,
|
||||||
true, null, PANEL_HEIGHT);
|
true, null, PANEL_HEIGHT);
|
||||||
statusbutton.button.connect('button-press-event', function (b, e) {
|
statusbutton.button.connect('button-press-event', function (b, e) {
|
||||||
me._statusmenu.toggle(e);
|
statusmenu.toggle(e);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
box.append(statusbutton.button, Big.BoxPackFlags.END);
|
box.append(statusbutton.button, Big.BoxPackFlags.END);
|
||||||
@ -165,10 +165,7 @@ Panel.prototype = {
|
|||||||
// Declare just "box" (ie, not the drop shadow) as a shell actor
|
// Declare just "box" (ie, not the drop shadow) as a shell actor
|
||||||
Main.addShellActor(box);
|
Main.addShellActor(box);
|
||||||
|
|
||||||
global.screen.connect('restacked',
|
global.screen.connect('restacked', Lang.bind(this, this._restacked));
|
||||||
function() {
|
|
||||||
me._restacked();
|
|
||||||
});
|
|
||||||
this._restacked();
|
this._restacked();
|
||||||
|
|
||||||
// Start the clock
|
// Start the clock
|
||||||
@ -210,7 +207,6 @@ Panel.prototype = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
_updateClock: function() {
|
_updateClock: function() {
|
||||||
let me = this;
|
|
||||||
let displayDate = new Date();
|
let displayDate = new Date();
|
||||||
let msecRemaining = 60000 - (1000 * displayDate.getSeconds() +
|
let msecRemaining = 60000 - (1000 * displayDate.getSeconds() +
|
||||||
displayDate.getMilliseconds());
|
displayDate.getMilliseconds());
|
||||||
@ -219,10 +215,8 @@ Panel.prototype = {
|
|||||||
msecRemaining += 60000;
|
msecRemaining += 60000;
|
||||||
}
|
}
|
||||||
this._clock.set_text(displayDate.toLocaleFormat("%a %b %e, %l:%M %p"));
|
this._clock.set_text(displayDate.toLocaleFormat("%a %b %e, %l:%M %p"));
|
||||||
Mainloop.timeout_add(msecRemaining, function() {
|
Mainloop.timeout_add(msecRemaining, Lang.bind(this, this._updateClock));
|
||||||
me._updateClock();
|
|
||||||
return false;
|
return false;
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
overlayHidden: function() {
|
overlayHidden: function() {
|
||||||
|
Loading…
Reference in New Issue
Block a user