[gnome-shell] base-icon: Always recreate icon texture on style changes
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] base-icon: Always recreate icon texture on style changes
- Date: Fri, 4 Mar 2011 00:43:36 +0000 (UTC)
commit e01971eac7769abb67fe31d3e15b69abac2f3144
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Mar 3 00:25:23 2011 +0100
base-icon: Always recreate icon texture on style changes
Currently the icon texture is only updated on style changes when
the icon size is set from CSS and differs from the previously used
icon size.
As the style change may have been triggered by an icon theme change,
textures that are created for themed icons should always be recreated;
given that this is the case for most uses (with the exception of
file thumbnails), recreate the icon texture unconditionally to avoid
complexity.
https://bugzilla.gnome.org/show_bug.cgi?id=643738
js/ui/iconGrid.js | 27 +++++++++++++++------------
1 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index f2d046c..24556e2 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -52,8 +52,7 @@ BaseIcon.prototype = {
this.createIcon = params.createIcon;
this._setSizeManually = params.setSizeManually;
- this.icon = this.createIcon(this.iconSize);
- this._iconBin.set_child(this.icon);
+ this.icon = null;
},
_allocate: function(actor, box, flags) {
@@ -116,14 +115,15 @@ BaseIcon.prototype = {
if (!this._setSizeManually)
throw new Error('setSizeManually has to be set to use setIconsize');
- this._setIconSize(size);
- },
-
- _setIconSize: function(size) {
if (size == this.iconSize)
return;
- this.icon.destroy();
+ this._createIconTexture(size);
+ },
+
+ _createIconTexture: function(size) {
+ if (this.icon)
+ this.icon.destroy();
this.iconSize = size;
this.icon = this.createIcon(this.iconSize);
@@ -139,12 +139,15 @@ BaseIcon.prototype = {
let node = this.actor.get_theme_node();
this._spacing = node.get_length('spacing');
- if (this._setSizeManually)
- return;
+ let size;
+ if (this._setSizeManually) {
+ size = this.iconSize;
+ } else {
+ let [found, len] = node.lookup_length('icon-size', false);
+ size = found ? len : ICON_SIZE;
+ }
- let len = node.get_length('icon-size');
- if (len > 0)
- this._setIconSize(len);
+ this._createIconTexture(size);
}
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]