[gnome-shell] js/ui/panel.js: Lang.bind-ify
- From: Dan Winship <danw src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-shell] js/ui/panel.js: Lang.bind-ify
- Date: Thu, 7 May 2009 13:07:46 -0400 (EDT)
commit 17fb2808842e33ae27c0841216ee4d39e54d694b
Author: Dan Winship <danw gnome org>
Date: Thu May 7 09:54:21 2009 -0400
js/ui/panel.js: Lang.bind-ify
---
js/ui/panel.js | 18 ++++++------------
1 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/js/ui/panel.js b/js/ui/panel.js
index be021cf..20c4fa7 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -2,6 +2,7 @@
const Big = imports.gi.Big;
const Clutter = imports.gi.Clutter;
+const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
@@ -47,7 +48,6 @@ function Panel() {
Panel.prototype = {
_init : function() {
- let me = this;
let global = Shell.Global.get();
// Put the background under the panel within a group.
@@ -87,12 +87,12 @@ Panel.prototype = {
box.append(this.button.button, Big.BoxPackFlags.NONE);
let statusbox = new Big.Box();
- this._statusmenu = new Shell.StatusMenu();
+ let statusmenu = this._statusmenu = new Shell.StatusMenu();
statusbox.append(this._statusmenu, Big.BoxPackFlags.NONE);
let statusbutton = new Button.Button(statusbox, PANEL_BUTTON_COLOR, PRESSED_BUTTON_BACKGROUND_COLOR,
true, null, PANEL_HEIGHT);
statusbutton.button.connect('button-press-event', function (b, e) {
- me._statusmenu.toggle(e);
+ statusmenu.toggle(e);
return false;
});
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
Main.addShellActor(box);
- global.screen.connect('restacked',
- function() {
- me._restacked();
- });
+ global.screen.connect('restacked', Lang.bind(this, this._restacked));
this._restacked();
// Start the clock
@@ -210,7 +207,6 @@ Panel.prototype = {
},
_updateClock: function() {
- let me = this;
let displayDate = new Date();
let msecRemaining = 60000 - (1000 * displayDate.getSeconds() +
displayDate.getMilliseconds());
@@ -219,10 +215,8 @@ Panel.prototype = {
msecRemaining += 60000;
}
this._clock.set_text(displayDate.toLocaleFormat("%a %b %e, %l:%M %p"));
- Mainloop.timeout_add(msecRemaining, function() {
- me._updateClock();
- return false;
- });
+ Mainloop.timeout_add(msecRemaining, Lang.bind(this, this._updateClock));
+ return false;
},
overlayHidden: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]