[gnome-weather/gnome-3-8: 2/2] Add a compatibility shim for gweather_info_get_symbolic_icon_name()



commit e5565f800d61fae2fbdbbaeb3c5c9158bd05e2d6
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Mon Mar 4 23:02:53 2013 +0100

    Add a compatibility shim for gweather_info_get_symbolic_icon_name()
    
    Which is not present in 3.7

 src/util.js |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/util.js b/src/util.js
index 6bc3c26..329c558 100644
--- a/src/util.js
+++ b/src/util.js
@@ -95,3 +95,18 @@ function getWeatherConditions(info) {
         conditions = info.get_sky();
     return conditions;
 }
+
+if (!GWeather.Info.prototype.get_symbolic_icon_name) {
+    GWeather.Info.prototype.get_symbolic_icon_name = function() {
+        let icon = this.get_icon_name().split('-');
+
+        // If the icon is for a moonphase it ends like -000
+        // Replace the moonphase with -symbolic
+        if (!isNaN(icon[icon.length-1]))
+            icon[icon.length-1] = 'symbolic';
+        else
+            icon.push('symbolic');
+
+        return icon.join('-');
+    }
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]