summaryrefslogtreecommitdiffstats
path: root/meta-xfce
diff options
context:
space:
mode:
authorAndreas Müller <schnitzeltony@googlemail.com>2015-01-26 11:01:54 +0100
committerMartin Jansa <Martin.Jansa@gmail.com>2015-02-19 10:09:58 +0100
commit54ae46b0b0aa010197070b2a4057492ca323e18f (patch)
tree335cb86e7b914c0f3da3d4773c53d843aed7d898 /meta-xfce
parentf26d42cd3469cdea025f00502d2de8f98d6a2b02 (diff)
downloadmeta-openembedded-54ae46b0b0aa010197070b2a4057492ca323e18f.tar.gz
xfce4-weather-plugin: update to 0.8.5
patches were applied mainline Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
Diffstat (limited to 'meta-xfce')
-rw-r--r--meta-xfce/recipes-panel-plugins/weather/files/0001-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch162
-rw-r--r--meta-xfce/recipes-panel-plugins/weather/files/0002-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch27
-rw-r--r--meta-xfce/recipes-panel-plugins/weather/xfce4-weather-plugin_0.8.5.bb (renamed from meta-xfce/recipes-panel-plugins/weather/xfce4-weather-plugin_0.8.3.bb)8
3 files changed, 2 insertions, 195 deletions
diff --git a/meta-xfce/recipes-panel-plugins/weather/files/0001-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch b/meta-xfce/recipes-panel-plugins/weather/files/0001-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch
deleted file mode 100644
index d4ad24054..000000000
--- a/meta-xfce/recipes-panel-plugins/weather/files/0001-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch
+++ /dev/null
@@ -1,162 +0,0 @@
1From 1ff71669644a0b824a8a5ba9b40771ee4fb8a76b Mon Sep 17 00:00:00 2001
2From: Harald Judt <h.judt@gmx.at>
3Date: Wed, 28 May 2014 20:08:02 +0200
4Subject: [PATCH 1/2] Make plugin ready for met.no locationforecast-1.2 API
5 (bug #10916).
6
7http://api.yr.no/weatherapi/locationforecastlts/1.1/documentation#version_1_2___2014_05_20
8
9The updated API version uses CamelCase symbol names instead of UPPERCASE
10ones and has added some new names (like 'Drizzle'), which unfortunately
11have not been documented (yet?).
12
13What's more, the typo 'celcius' has been replaced by the fixed 'celsius',
14but luckily the plugin will not be affected by that change.
15
16What's a bit more unfortunate is that the existing icon themes do not
17cover the new symbol names, so one would have to create quite a lot of
18new icons. Also, new translations would have to be added for the symbols,
19and maybe existing ones would have to be altered. To prevent this, we're
20simply going to map the new symbols to existing ones as good as possible.
21This should be good enough for the time being.
22
23Upstream-Status: Applied
24---
25 panel-plugin/weather-parsers.c | 3 +-
26 panel-plugin/weather-translate.c | 70 +++++++++++++++++++++++++++++++++++++++-
27 panel-plugin/weather-translate.h | 2 ++
28 3 files changed, 73 insertions(+), 2 deletions(-)
29
30diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c
31index 0f321ba..5a9b30a 100644
32--- a/panel-plugin/weather-parsers.c
33+++ b/panel-plugin/weather-parsers.c
34@@ -28,6 +28,7 @@
35 #define _XOPEN_SOURCE
36 #define _XOPEN_SOURCE_EXTENDED 1
37 #include "weather-parsers.h"
38+#include "weather-translate.h"
39 #include "weather-debug.h"
40
41 #include <time.h>
42@@ -220,8 +221,8 @@ parse_location(xmlNode *cur_node,
43 }
44 if (NODE_IS_TYPE(child_node, "symbol")) {
45 g_free(loc->symbol);
46- loc->symbol = PROP(child_node, "id");
47 loc->symbol_id = strtol(PROP(child_node, "number"), NULL, 10);
48+ loc->symbol = g_strdup(get_symbol_for_id(loc->symbol_id));
49 }
50 }
51
52diff --git a/panel-plugin/weather-translate.c b/panel-plugin/weather-translate.c
53index 0c1606d..c38919a 100644
54--- a/panel-plugin/weather-translate.c
55+++ b/panel-plugin/weather-translate.c
56@@ -29,6 +29,7 @@
57 #include "weather-translate.h"
58
59 #define DAY_LOC_N (sizeof(gchar) * 100)
60+#define NODATA "NODATA"
61
62
63 static const gchar *moon_phases[] = {
64@@ -117,7 +118,7 @@ static const symbol_desc symbol_to_desc[] = {
65
66 { 15, "FOG", N_("Fog"), N_("Fog") },
67
68- /* Symbols 16-19 are used for polar days */
69+ /* Symbols 16-19 are used for polar days (unused beginning with API version 1.2) */
70 { 16, "SUN", N_("Sunny"), N_("Clear") },
71 { 17, "LIGHTCLOUD", N_("Lightly cloudy"), N_("Lightly cloudy") },
72 { 18, "LIGHTRAINSUN", N_("Rain showers"), N_("Rain showers") },
73@@ -133,6 +134,73 @@ static const symbol_desc symbol_to_desc[] = {
74 #define NUM_SYMBOLS (sizeof(symbol_to_desc) / sizeof(symbol_to_desc[0]))
75
76
77+/*
78+ * API version 1.2, published in May 2014, introduced new symbols. We
79+ * try to match these with existing symbols, in order to be compatible
80+ * with existing icon themes and to maintain translation completeness.
81+ *
82+ * See http://api.met.no/weatherapi/weathericon/1.1/documentation
83+ * for a list of symbols. For a list of symbols with descriptions,
84+ * see http://om.yr.no/forklaring/symbol.
85+ */
86+gint
87+replace_symbol_id(gint id)
88+{
89+ /* Symbol ids greater than 100 are used for indicating polar
90+ * night. These ids are over the ordinary id + 100. Since we
91+ * don't support polar icons, we can simply subtract 100 to
92+ * get the non-polar symbol ids.
93+ */
94+ if (id > 100)
95+ id -= 100;
96+
97+ switch (id) {
98+ case 24: return 22; /* Light rain showers and thunder */
99+ case 25: return 6; /* Heavy rain showers and thunder */
100+ case 26: return 20; /* Light sleet showers and thunder */
101+ case 27: return 20; /* Heavy sleet showers and thunder */
102+ case 28: return 21; /* Light snow showers and thunder */
103+ case 29: return 21; /* Heavy snow showers and thunder */
104+ case 30: return 22; /* Light rain and thunder */
105+ case 31: return 23; /* Light sleet and thunder */
106+ case 32: return 23; /* Heavy sleet and thunder */
107+ case 33: return 14; /* Light snow and thunder */
108+ case 34: return 14; /* Heavy snow and thunder */
109+
110+ /* symbols 35-39 are unused */
111+
112+ case 40: return 5; /* Light rain showers */
113+ case 41: return 5; /* Heavy rain showers */
114+ case 42: return 7; /* Light sleet showers */
115+ case 43: return 7; /* Heavy sleet showers */
116+ case 44: return 8; /* Light snow showers */
117+ case 45: return 8; /* Heavy snow showers */
118+ case 46: return 9; /* Light rain */
119+ case 47: return 12; /* Light sleet */
120+ case 48: return 12; /* Heavy sleet */
121+ case 49: return 13; /* Light snow */
122+ case 50: return 13; /* Heavy snow */
123+ default: return id;
124+ }
125+}
126+
127+
128+const gchar *
129+get_symbol_for_id(gint id)
130+{
131+ if (G_UNLIKELY(id < 1))
132+ return NODATA;
133+
134+ if (id >= NUM_SYMBOLS)
135+ id = replace_symbol_id(id);
136+
137+ if (id < NUM_SYMBOLS)
138+ return symbol_to_desc[id-1].symbol;
139+
140+ return NODATA;
141+}
142+
143+
144 const gchar *
145 translate_desc(const gchar *desc,
146 const gboolean nighttime)
147diff --git a/panel-plugin/weather-translate.h b/panel-plugin/weather-translate.h
148index 2116795..854e24f 100644
149--- a/panel-plugin/weather-translate.h
150+++ b/panel-plugin/weather-translate.h
151@@ -24,6 +24,8 @@
152
153 G_BEGIN_DECLS
154
155+const gchar *get_symbol_for_id(gint id);
156+
157 const gchar *translate_desc(const gchar *desc,
158 gboolean nighttime);
159
160--
1611.8.3.1
162
diff --git a/meta-xfce/recipes-panel-plugins/weather/files/0002-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch b/meta-xfce/recipes-panel-plugins/weather/files/0002-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch
deleted file mode 100644
index 4c385a469..000000000
--- a/meta-xfce/recipes-panel-plugins/weather/files/0002-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch
+++ /dev/null
@@ -1,27 +0,0 @@
1From 7df303bc5fa649299e18efeb5d4b801614030488 Mon Sep 17 00:00:00 2001
2From: Harald Judt <h.judt@gmx.at>
3Date: Tue, 3 Jun 2014 19:59:05 +0200
4Subject: [PATCH 2/2] Switch to met.no locationforecastLTS-1.2 API (bug
5 #10916).
6
7Upstream-Status: Applied
8---
9 panel-plugin/weather.c | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
13index efa8559..63451fd 100644
14--- a/panel-plugin/weather.c
15+++ b/panel-plugin/weather.c
16@@ -660,7 +660,7 @@ update_handler(plugin_data *data)
17 /* build url */
18 url =
19 g_strdup_printf("http://api.yr.no/weatherapi"
20- "/locationforecastlts/1.1/?lat=%s;lon=%s;msl=%d",
21+ "/locationforecastlts/1.2/?lat=%s;lon=%s;msl=%d",
22 data->lat, data->lon, data->msl);
23
24 /* start receive thread */
25--
261.8.3.1
27
diff --git a/meta-xfce/recipes-panel-plugins/weather/xfce4-weather-plugin_0.8.3.bb b/meta-xfce/recipes-panel-plugins/weather/xfce4-weather-plugin_0.8.5.bb
index 6e4c86db5..3fc5eae7a 100644
--- a/meta-xfce/recipes-panel-plugins/weather/xfce4-weather-plugin_0.8.3.bb
+++ b/meta-xfce/recipes-panel-plugins/weather/xfce4-weather-plugin_0.8.5.bb
@@ -7,11 +7,7 @@ inherit xfce-panel-plugin
7 7
8DEPENDS += "libsoup-2.4 dbus-glib upower" 8DEPENDS += "libsoup-2.4 dbus-glib upower"
9 9
10SRC_URI += " \ 10SRC_URI[md5sum] = "cc6d9039540a71e57102ae75224a3f5e"
11 file://0001-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch \ 11SRC_URI[sha256sum] = "be8ac0e5635355d568e4095a3459f53efd5f10a8ef46976a43dc30cbb277e5cd"
12 file://0002-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch \
13"
14SRC_URI[md5sum] = "755b33089c02afe88abb39253003a7f3"
15SRC_URI[sha256sum] = "40a6a22be7653b15a47174a430da89040f178695b48e5e01e77990050f715ce4"
16 12
17FILES_${PN} += "${datadir}/xfce4/weather" 13FILES_${PN} += "${datadir}/xfce4/weather"