Fix for gnome.shell 3.30, only symbolic icons shown, if the stale is not explicitely set to regular.

merge-requests/222/head
Jens Lody 6 years ago
parent a978a41816
commit 73a40c55d2
  1. 8
      data/stylesheet.css
  2. 6
      src/darksky_net.js
  3. 54
      src/extension.js
  4. 6
      src/openweathermap_org.js

@ -1,3 +1,11 @@
.openweather-regular{
-st-icon-style: regular;
}
.openweather-symbolic{
-st-icon-style: symbolic;
}
.openweather-button { .openweather-button {
border-radius: 32px; border-radius: 32px;
padding: 13px; padding: 13px;

@ -96,10 +96,10 @@ function getWeatherIcon(icon, windspeed, cloudcover, night) {
break; break;
} }
for (let i = 0; i < iconname.length; i++) { for (let i = 0; i < iconname.length; i++) {
if (this.hasIcon(iconname[i]) + this.getIconType()) if (this.hasIcon(iconname[i]))
return iconname[i] + this.getIconType(); return iconname[i];
} }
return 'weather-severe-alert' + this.getIconType(); return 'weather-severe-alert';
} }
function parseWeatherCurrent() { function parseWeatherCurrent() {

@ -182,8 +182,8 @@ const OpenweatherMenuButton = new Lang.Class({
}); });
this._weatherIcon = new St.Icon({ this._weatherIcon = new St.Icon({
icon_name: 'view-refresh' + this.getIconType(), icon_name: 'view-refresh',
style_class: 'system-status-icon openweather-icon' style_class: 'system-status-icon openweather-icon ' + this.getIconType()
}); });
// Panel menu item - the current class // Panel menu item - the current class
@ -1081,7 +1081,7 @@ const OpenweatherMenuButton = new Lang.Class({
}, },
hasIcon: function(icon) { hasIcon: function(icon) {
return Gtk.IconTheme.get_default().has_icon(icon + this.getIconType()); return Gtk.IconTheme.get_default().has_icon(icon);
}, },
toFahrenheit: function(t) { toFahrenheit: function(t) {
@ -1169,28 +1169,11 @@ const OpenweatherMenuButton = new Lang.Class({
return (this._wind_direction) ? arrows[idx] : letters[idx]; return (this._wind_direction) ? arrows[idx] : letters[idx];
}, },
getIconType: function(icon_name) { getIconType: function() {
if (!icon_name) {
if (this._getIconType) { if (this._getIconType) {
return "openweather-symbolic";
return "-symbolic";
} else {
return "";
}
}
if (this._getIconType) {
if (String(icon_name).search("-symbolic") != -1) {
return icon_name;
} else { } else {
return icon_name + "-symbolic"; return "openweather-regular";
}
} else {
if (String(icon_name).search("-symbolic") != -1) {
return String(icon_name).replace("-symbolic", "");
} else {
return icon_name;
}
} }
}, },
@ -1444,33 +1427,36 @@ const OpenweatherMenuButton = new Lang.Class({
rebuildCurrentWeatherUi: function() { rebuildCurrentWeatherUi: function() {
this._weatherInfo.text = (' '); this._weatherInfo.text = (' ');
this._weatherIcon.icon_name = 'view-refresh' + this.getIconType(); this._weatherIcon.icon_name = 'view-refresh';
this._weatherIcon.remove_style_class_name('openweather-regular');
this._weatherIcon.remove_style_class_name('openweather-symbolic');
this._weatherIcon.add_style_class_name(this.getIconType());
this.destroyCurrentWeather(); this.destroyCurrentWeather();
// This will hold the icon for the current weather // This will hold the icon for the current weather
this._currentWeatherIcon = new St.Icon({ this._currentWeatherIcon = new St.Icon({
icon_size: 72, icon_size: 72,
icon_name: 'view-refresh' + this.getIconType(), icon_name: 'view-refresh',
style_class: 'system-menu-action openweather-current-icon' style_class: 'system-menu-action openweather-current-icon ' + this.getIconType()
}); });
this._sunriseIcon = new St.Icon({ this._sunriseIcon = new St.Icon({
icon_size: 15, icon_size: 15,
icon_name: 'weather-clear' + this.getIconType(), icon_name: 'weather-clear',
style_class: 'openweather-sunrise-icon' style_class: 'openweather-sunrise-icon ' + this.getIconType()
}); });
this._sunsetIcon = new St.Icon({ this._sunsetIcon = new St.Icon({
icon_size: 15, icon_size: 15,
icon_name: 'weather-clear-night' + this.getIconType(), icon_name: 'weather-clear-night',
style_class: 'openweather-sunset-icon' style_class: 'openweather-sunset-icon ' + this.getIconType()
}); });
this._buildIcon = new St.Icon({ this._buildIcon = new St.Icon({
icon_size: 15, icon_size: 15,
icon_name: 'view-refresh' + this.getIconType(), icon_name: 'view-refresh',
style_class: 'openweather-build-icon' style_class: 'openweather-build-icon ' + this.getIconType()
}); });
// The summary of the current weather // The summary of the current weather
@ -1619,8 +1605,8 @@ const OpenweatherMenuButton = new Lang.Class({
forecastWeather.Icon = new St.Icon({ forecastWeather.Icon = new St.Icon({
icon_size: 48, icon_size: 48,
icon_name: 'view-refresh' + this.getIconType(), icon_name: 'view-refresh',
style_class: 'system-menu-action openweather-forecast-icon' style_class: 'system-menu-action openweather-forecast-icon ' + this.getIconType()
}); });
forecastWeather.Day = new St.Label({ forecastWeather.Day = new St.Label({
style_class: 'popup-menu-item popup-status-menu-item openweather-forecast-day' style_class: 'popup-menu-item popup-status-menu-item openweather-forecast-day'

@ -170,11 +170,11 @@ weather-storm.png = weather-storm-symbolic.svg
for (let i = 0; i < iconname.length; i++) { for (let i = 0; i < iconname.length; i++) {
if (night && this.hasIcon(iconname[i] + '-night')) if (night && this.hasIcon(iconname[i] + '-night'))
return iconname[i] + '-night' + this.getIconType(); return iconname[i] + '-night';
if (this.hasIcon(iconname[i])) if (this.hasIcon(iconname[i]))
return iconname[i] + this.getIconType(); return iconname[i];
} }
return 'weather-severe-alert' + this.getIconType(); return 'weather-severe-alert';
} }
function getWeatherCondition(code) { function getWeatherCondition(code) {

Loading…
Cancel
Save