From 914c3a4ff6e9bf95c4817ad8acc057fbab22038d Mon Sep 17 00:00:00 2001 From: Florian Müllner Date: Mar 30 2017 17:19:38 +0000 Subject: Update logo on texture file changes While it is generally more common to change the configured logo file than updating the used file's contents, it's still useful for the logo artist to see changes in real time - as the texture cache already sets up a file monitor for us, all we have to do to support this case is recreating the icon texture itself. Fixes #2 --- diff --git a/extension.js b/extension.js index d11f271..13ae308 100644 --- a/extension.js +++ b/extension.js @@ -50,6 +50,12 @@ const BackgroundLogo = new Lang.Class({ Lang.bind(this, this._updateVisibility)); this._textureCache = St.TextureCache.get_default(); + this._textureCache.connect('texture-file-changed', Lang.bind(this, + function(cache, file) { + if (!this._logoFile || !this._logoFile.equal(file)) + return; + this._updateLogoTexture(); + })); this.actor = new St.Widget({ layout_manager: new Clutter.BinLayout(), opacity: 0 }); @@ -89,6 +95,10 @@ const BackgroundLogo = new Lang.Class({ this._logoFile = file; + this._updateLogoTexture(); + }, + + _updateLogoTexture: function() { if (this._icon) this._icon.destroy();