panel: Pick up spinner icon from CSS
In order to use a different spinner image in classic mode (or any other mode specific style), get it from CSS rather than hardcoding a particular image. https://bugzilla.gnome.org/show_bug.cgi?id=693688
This commit is contained in:
parent
2b439ef209
commit
4710753700
@ -512,6 +512,7 @@ StScrollBar StButton#vhandle:active {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#appMenu {
|
#appMenu {
|
||||||
|
spinner-image: url("process-working.svg");
|
||||||
spacing: 4px;
|
spacing: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,6 +258,7 @@ const AppMenuButton = new Lang.Class({
|
|||||||
this._actionGroupNotifyId = 0;
|
this._actionGroupNotifyId = 0;
|
||||||
|
|
||||||
let bin = new St.Bin({ name: 'appMenu' });
|
let bin = new St.Bin({ name: 'appMenu' });
|
||||||
|
bin.connect('style-changed', Lang.bind(this, this._onStyleChanged));
|
||||||
this.actor.add_actor(bin);
|
this.actor.add_actor(bin);
|
||||||
|
|
||||||
this.actor.bind_property("reactive", this.actor, "can-focus", 0);
|
this.actor.bind_property("reactive", this.actor, "can-focus", 0);
|
||||||
@ -297,11 +298,7 @@ const AppMenuButton = new Lang.Class({
|
|||||||
|
|
||||||
this._stop = true;
|
this._stop = true;
|
||||||
|
|
||||||
let spinnerIcon = global.datadir + '/theme/process-working.svg';
|
this._spinner = null;
|
||||||
this._spinner = new AnimatedIcon(spinnerIcon, PANEL_ICON_SIZE);
|
|
||||||
this._container.add_actor(this._spinner.actor);
|
|
||||||
this._spinner.actor.hide();
|
|
||||||
this._spinner.actor.lower_bottom();
|
|
||||||
|
|
||||||
let tracker = Shell.WindowTracker.get_default();
|
let tracker = Shell.WindowTracker.get_default();
|
||||||
let appSys = Shell.AppSystem.get_default();
|
let appSys = Shell.AppSystem.get_default();
|
||||||
@ -354,6 +351,18 @@ const AppMenuButton = new Lang.Class({
|
|||||||
onCompleteScope: this });
|
onCompleteScope: this });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onStyleChanged: function(actor) {
|
||||||
|
let node = actor.get_theme_node();
|
||||||
|
let [success, icon] = node.lookup_url('spinner-image', false);
|
||||||
|
if (!success || this._spinnerIcon == icon)
|
||||||
|
return;
|
||||||
|
this._spinnerIcon = icon;
|
||||||
|
this._spinner = new AnimatedIcon(this._spinnerIcon, PANEL_ICON_SIZE);
|
||||||
|
this._container.add_actor(this._spinner.actor);
|
||||||
|
this._spinner.actor.hide();
|
||||||
|
this._spinner.actor.lower_bottom();
|
||||||
|
},
|
||||||
|
|
||||||
_onIconBoxStyleChanged: function() {
|
_onIconBoxStyleChanged: function() {
|
||||||
let node = this._iconBox.get_theme_node();
|
let node = this._iconBox.get_theme_node();
|
||||||
this._iconBottomClip = node.get_length('app-icon-bottom-clip');
|
this._iconBottomClip = node.get_length('app-icon-bottom-clip');
|
||||||
@ -385,6 +394,10 @@ const AppMenuButton = new Lang.Class({
|
|||||||
|
|
||||||
this._stop = true;
|
this._stop = true;
|
||||||
this.actor.reactive = true;
|
this.actor.reactive = true;
|
||||||
|
|
||||||
|
if (this._spinner == null)
|
||||||
|
return;
|
||||||
|
|
||||||
Tweener.addTween(this._spinner.actor,
|
Tweener.addTween(this._spinner.actor,
|
||||||
{ opacity: 0,
|
{ opacity: 0,
|
||||||
time: SPINNER_ANIMATION_TIME,
|
time: SPINNER_ANIMATION_TIME,
|
||||||
@ -401,6 +414,10 @@ const AppMenuButton = new Lang.Class({
|
|||||||
startAnimation: function() {
|
startAnimation: function() {
|
||||||
this._stop = false;
|
this._stop = false;
|
||||||
this.actor.reactive = false;
|
this.actor.reactive = false;
|
||||||
|
|
||||||
|
if (this._spinner == null)
|
||||||
|
return;
|
||||||
|
|
||||||
this._spinner.play();
|
this._spinner.play();
|
||||||
this._spinner.actor.show();
|
this._spinner.actor.show();
|
||||||
},
|
},
|
||||||
@ -463,6 +480,9 @@ const AppMenuButton = new Lang.Class({
|
|||||||
}
|
}
|
||||||
this._label.actor.allocate(childBox, flags);
|
this._label.actor.allocate(childBox, flags);
|
||||||
|
|
||||||
|
if (this._spinner == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (direction == Clutter.TextDirection.LTR) {
|
if (direction == Clutter.TextDirection.LTR) {
|
||||||
childBox.x1 = Math.floor(iconWidth / 2) + this._label.actor.width;
|
childBox.x1 = Math.floor(iconWidth / 2) + this._label.actor.width;
|
||||||
childBox.x2 = childBox.x1 + this._spinner.actor.width;
|
childBox.x2 = childBox.x1 + this._spinner.actor.width;
|
||||||
@ -553,7 +573,8 @@ const AppMenuButton = new Lang.Class({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._spinner.actor.hide();
|
if (this._spinner)
|
||||||
|
this._spinner.actor.hide();
|
||||||
if (this._iconBox.child != null)
|
if (this._iconBox.child != null)
|
||||||
this._iconBox.child.destroy();
|
this._iconBox.child.destroy();
|
||||||
this._iconBox.hide();
|
this._iconBox.hide();
|
||||||
|
Loading…
Reference in New Issue
Block a user