From 11e6ebaecf262c67c7b0fbfb9e4068ce9b7ad8d9 Mon Sep 17 00:00:00 2001 From: Jens Lody Date: Sun, 20 Jul 2014 19:48:37 +0200 Subject: [PATCH] Fix St-CRITICAL because of accesssing the width of a BoxLayout before it was rendered. --- src/extension.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/extension.js b/src/extension.js index ea85521..f81674e 100644 --- a/src/extension.js +++ b/src/extension.js @@ -668,7 +668,6 @@ const WeatherMenuButton = new Lang.Class({ this.parseWeatherCurrent(); })); this._buttonBox1.add_actor(button); - this._buttonBox1MinWidth = this._buttonBox1.get_width(); this._buttonBox2 = new St.BoxLayout({style_class: 'popup-menu-item'}); @@ -713,6 +712,7 @@ const WeatherMenuButton = new Lang.Class({ this._buttonMenu.actor.add_actor(this._buttonBox1); this._buttonMenu.actor.add_actor(this._buttonBox2); } + this._buttonBox1MinWidth = undefined; }, rebuildSelectCityItem: function() { this._selectCity.menu.removeAll(); @@ -837,6 +837,8 @@ const WeatherMenuButton = new Lang.Class({ _onOpenStateChanged: function(menu, open) { if (open) { + if(this._buttonBox1MinWidth === undefined) + this._buttonBox1MinWidth = this._buttonBox1.get_width(); this._buttonBox1.set_width(Math.max(this._buttonBox1MinWidth,this._currentWeather.get_width() - this._buttonBox2.get_width())); if (this._forecastScrollBox !== undefined && this._forecastBox !== undefined && this._currentWeather !== undefined) { this._forecastScrollBox.set_width(this._currentWeather.get_width());