[gnome-shell] Move style updates in AppIcon._onStateChanged out
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Move style updates in AppIcon._onStateChanged out
- Date: Thu, 6 Nov 2014 20:30:13 +0000 (UTC)
commit 24c0a1a1d458c8d1ba1b9d3e728a27d347f7833f
Author: Yuki <yuuki k osada gmail com>
Date: Sat Nov 1 22:24:03 2014 +0800
Move style updates in AppIcon._onStateChanged out
There is currently no simple way to inject into AppIcon's state change,
so an extension that wants to do this has to destroy/remove/update all
icons in the Shell (i.e. in the Dash, AllView, FrequentView) on enable()
and disable() after updating AppIcon.prototype._onStateChange, or the
extension must require a restart of the Shell.
To solve this issue, we rename _onStateChanged to _updateRunningStyle,
and connect the notify::state signal with an anonymous function that
calls _updateRunningStyle.
This extra function call should allow extensions to just extend the
updateRunningStyle function in the prototype.
https://bugzilla.gnome.org/show_bug.cgi?id=739497
js/ui/appDisplay.js | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 4f182ec..5a14aca 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1562,10 +1562,11 @@ const AppIcon = new Lang.Class({
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
this._menuTimeoutId = 0;
- this._stateChangedId = this.app.connect('notify::state',
- Lang.bind(this,
- this._onStateChanged));
- this._onStateChanged();
+ this._stateChangedId = this.app.connect('notify::state', Lang.bind(this,
+ function () {
+ this._updateRunningStyle();
+ }));
+ this._updateRunningStyle();
},
_onDestroy: function() {
@@ -1586,7 +1587,7 @@ const AppIcon = new Lang.Class({
}
},
- _onStateChanged: function() {
+ _updateRunningStyle: function() {
if (this.app.state != Shell.AppState.STOPPED)
this.actor.add_style_class_name('running');
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]