[gnome-shell] Use TextureCache to load the information icon
- From: Colin Walters <walters src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-shell] Use TextureCache to load the information icon
- Date: Tue, 30 Jun 2009 20:50:21 +0000 (UTC)
commit 3a7447daccc29e7e9bb7634ef2fa068f0bec24eb
Author: Marina Zhurakhinskaya <marinaz redhat com>
Date: Thu Jun 25 17:24:46 2009 -0400
Use TextureCache to load the information icon
Use TextureCache to load the information icon, so that we don't create a
new ClutterTexture for information icons corresponding to each display
item.
js/ui/genericDisplay.js | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/genericDisplay.js b/js/ui/genericDisplay.js
index af4eb0d..1cc941f 100644
--- a/js/ui/genericDisplay.js
+++ b/js/ui/genericDisplay.js
@@ -73,15 +73,18 @@ GenericDisplayItem.prototype = {
x: 0, y: 0,
width: availableWidth, height: ITEM_DISPLAY_HEIGHT });
this.actor.add_actor(this._bg);
-
- this._informationButton = new Clutter.Texture({ x: availableWidth - ITEM_DISPLAY_PADDING_RIGHT - INFORMATION_BUTTON_SIZE,
- y: ITEM_DISPLAY_HEIGHT / 2 - INFORMATION_BUTTON_SIZE / 2,
- width: INFORMATION_BUTTON_SIZE,
- height: INFORMATION_BUTTON_SIZE,
- reactive: true
- });
+
let global = Shell.Global.get();
- this._informationButton.set_from_file(global.imagedir + "info.svg");
+ let infoIconUri = "file://" + global.imagedir + "info.svg";
+
+ this._informationButton = Shell.TextureCache.get_default().load_uri_sync(infoIconUri,
+ INFORMATION_BUTTON_SIZE,
+ INFORMATION_BUTTON_SIZE);
+
+ this._informationButton.x = availableWidth - ITEM_DISPLAY_PADDING_RIGHT - INFORMATION_BUTTON_SIZE;
+ this._informationButton.y = ITEM_DISPLAY_HEIGHT / 2 - INFORMATION_BUTTON_SIZE / 2;
+ this._informationButton.reactive = true;
+
// Connecting to the button-press-event for the information button ensures that the actor,
// which is a draggable actor, does not get the button-press-event and doesn't initiate
// the dragging, which then prevents us from getting the button-release-event for the button.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]