1 |
ssuominen 14/10/29 17:06:08 |
2 |
|
3 |
Added: |
4 |
xfce4-weather-plugin-0.8.3-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch |
5 |
xfce4-weather-plugin-0.8.3-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch |
6 |
xfce4-weather-plugin-0.8.3-Fix-color-parsing-when-reading-config-file.patch |
7 |
Log: |
8 |
Import upstream patches for fetching weather information wrt #524850 by Christian Tietz, David W. Noon, "Yarda" and others. Commit to stable because current stable is useless if it can't fetch the data. |
9 |
|
10 |
(Portage version: 2.2.14/cvs/Linux x86_64, RepoMan options: --force, signed Manifest commit with key 4868F14D) |
11 |
|
12 |
Revision Changes Path |
13 |
1.1 xfce-extra/xfce4-weather-plugin/files/xfce4-weather-plugin-0.8.3-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch |
14 |
|
15 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/xfce-extra/xfce4-weather-plugin/files/xfce4-weather-plugin-0.8.3-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch?rev=1.1&view=markup |
16 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/xfce-extra/xfce4-weather-plugin/files/xfce4-weather-plugin-0.8.3-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch?rev=1.1&content-type=text/plain |
17 |
|
18 |
Index: xfce4-weather-plugin-0.8.3-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch |
19 |
=================================================================== |
20 |
http://bugs.gentoo.org/524850 |
21 |
|
22 |
From 70024ad992bfd3845d885469e5eccfad76269465 Mon Sep 17 00:00:00 2001 |
23 |
From: Harald Judt <h.judt@×××.at> |
24 |
Date: Tue, 3 Jun 2014 19:59:05 +0200 |
25 |
Subject: [PATCH] Switch to met.no locationforecastLTS-1.2 API (bug #10916). |
26 |
|
27 |
(cherry picked from commit 7df303bc5fa649299e18efeb5d4b801614030488) |
28 |
--- |
29 |
panel-plugin/weather.c | 2 +- |
30 |
1 file changed, 1 insertion(+), 1 deletion(-) |
31 |
|
32 |
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c |
33 |
index 4a2e3c3..e5036ae 100644 |
34 |
--- a/panel-plugin/weather.c |
35 |
+++ b/panel-plugin/weather.c |
36 |
@@ -638,7 +638,7 @@ update_handler(plugin_data *data) |
37 |
/* build url */ |
38 |
url = |
39 |
g_strdup_printf("http://api.yr.no/weatherapi" |
40 |
- "/locationforecastlts/1.1/?lat=%s;lon=%s;msl=%d", |
41 |
+ "/locationforecastlts/1.2/?lat=%s;lon=%s;msl=%d", |
42 |
data->lat, data->lon, data->msl); |
43 |
|
44 |
/* start receive thread */ |
45 |
-- |
46 |
2.1.2 |
47 |
|
48 |
|
49 |
|
50 |
|
51 |
1.1 xfce-extra/xfce4-weather-plugin/files/xfce4-weather-plugin-0.8.3-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch |
52 |
|
53 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/xfce-extra/xfce4-weather-plugin/files/xfce4-weather-plugin-0.8.3-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch?rev=1.1&view=markup |
54 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/xfce-extra/xfce4-weather-plugin/files/xfce4-weather-plugin-0.8.3-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch?rev=1.1&content-type=text/plain |
55 |
|
56 |
Index: xfce4-weather-plugin-0.8.3-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch |
57 |
=================================================================== |
58 |
http://bugs.gentoo.org/524850 |
59 |
|
60 |
From a17ed6d248135cedc645b0481c4ad01687386ed2 Mon Sep 17 00:00:00 2001 |
61 |
From: Harald Judt <h.judt@×××.at> |
62 |
Date: Wed, 28 May 2014 20:08:02 +0200 |
63 |
Subject: [PATCH] Make plugin ready for met.no locationforecast-1.2 API (bug |
64 |
#10916). |
65 |
|
66 |
http://api.yr.no/weatherapi/locationforecastlts/1.1/documentation#version_1_2___2014_05_20 |
67 |
|
68 |
The updated API version uses CamelCase symbol names instead of UPPERCASE |
69 |
ones and has added some new names (like 'Drizzle'), which unfortunately |
70 |
have not been documented (yet?). |
71 |
|
72 |
What's more, the typo 'celcius' has been replaced by the fixed 'celsius', |
73 |
but luckily the plugin will not be affected by that change. |
74 |
|
75 |
What's a bit more unfortunate is that the existing icon themes do not |
76 |
cover the new symbol names, so one would have to create quite a lot of |
77 |
new icons. Also, new translations would have to be added for the symbols, |
78 |
and maybe existing ones would have to be altered. To prevent this, we're |
79 |
simply going to map the new symbols to existing ones as good as possible. |
80 |
This should be good enough for the time being. |
81 |
|
82 |
(cherry picked from commit 1ff71669644a0b824a8a5ba9b40771ee4fb8a76b) |
83 |
--- |
84 |
panel-plugin/weather-parsers.c | 3 +- |
85 |
panel-plugin/weather-translate.c | 70 +++++++++++++++++++++++++++++++++++++++- |
86 |
panel-plugin/weather-translate.h | 2 ++ |
87 |
3 files changed, 73 insertions(+), 2 deletions(-) |
88 |
|
89 |
diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c |
90 |
index c380130..2c90c11 100644 |
91 |
--- a/panel-plugin/weather-parsers.c |
92 |
+++ b/panel-plugin/weather-parsers.c |
93 |
@@ -28,6 +28,7 @@ |
94 |
#define _XOPEN_SOURCE |
95 |
#define _XOPEN_SOURCE_EXTENDED 1 |
96 |
#include "weather-parsers.h" |
97 |
+#include "weather-translate.h" |
98 |
#include "weather-debug.h" |
99 |
|
100 |
#include <time.h> |
101 |
@@ -196,8 +197,8 @@ parse_location(xmlNode *cur_node, |
102 |
} |
103 |
if (NODE_IS_TYPE(child_node, "symbol")) { |
104 |
g_free(loc->symbol); |
105 |
- loc->symbol = PROP(child_node, "id"); |
106 |
loc->symbol_id = strtol(PROP(child_node, "number"), NULL, 10); |
107 |
+ loc->symbol = g_strdup(get_symbol_for_id(loc->symbol_id)); |
108 |
} |
109 |
} |
110 |
|
111 |
diff --git a/panel-plugin/weather-translate.c b/panel-plugin/weather-translate.c |
112 |
index 004eef1..cc97600 100644 |
113 |
--- a/panel-plugin/weather-translate.c |
114 |
+++ b/panel-plugin/weather-translate.c |
115 |
@@ -29,6 +29,7 @@ |
116 |
#include "weather-translate.h" |
117 |
|
118 |
#define DAY_LOC_N (sizeof(gchar) * 100) |
119 |
+#define NODATA "NODATA" |
120 |
|
121 |
|
122 |
static const gchar *wdirs[] = { |
123 |
@@ -169,7 +170,7 @@ static const symbol_desc symbol_to_desc[] = { |
124 |
|
125 |
{ 15, "FOG", N_("Fog"), N_("Fog") }, |
126 |
|
127 |
- /* Symbols 16-19 are used for polar days */ |
128 |
+ /* Symbols 16-19 are used for polar days (unused beginning with API version 1.2) */ |
129 |
{ 16, "SUN", N_("Sunny"), N_("Clear") }, |
130 |
{ 17, "LIGHTCLOUD", N_("Lightly cloudy"), N_("Lightly cloudy") }, |
131 |
{ 18, "LIGHTRAINSUN", N_("Rain showers"), N_("Rain showers") }, |
132 |
@@ -185,6 +186,73 @@ static const symbol_desc symbol_to_desc[] = { |
133 |
#define NUM_SYMBOLS (sizeof(symbol_to_desc) / sizeof(symbol_to_desc[0])) |
134 |
|
135 |
|
136 |
+/* |
137 |
+ * API version 1.2, published in May 2014, introduced new symbols. We |
138 |
+ * try to match these with existing symbols, in order to be compatible |
139 |
+ * with existing icon themes and to maintain translation completeness. |
140 |
+ * |
141 |
+ * See http://api.met.no/weatherapi/weathericon/1.1/documentation |
142 |
+ * for a list of symbols. For a list of symbols with descriptions, |
143 |
+ * see http://om.yr.no/forklaring/symbol. |
144 |
+ */ |
145 |
+gint |
146 |
+replace_symbol_id(gint id) |
147 |
+{ |
148 |
+ /* Symbol ids greater than 100 are used for indicating polar |
149 |
+ * night. These ids are over the ordinary id + 100. Since we |
150 |
+ * don't support polar icons, we can simply subtract 100 to |
151 |
+ * get the non-polar symbol ids. |
152 |
+ */ |
153 |
+ if (id > 100) |
154 |
+ id -= 100; |
155 |
+ |
156 |
+ switch (id) { |
157 |
+ case 24: return 22; /* Light rain showers and thunder */ |
158 |
+ case 25: return 6; /* Heavy rain showers and thunder */ |
159 |
+ case 26: return 20; /* Light sleet showers and thunder */ |
160 |
+ case 27: return 20; /* Heavy sleet showers and thunder */ |
161 |
+ case 28: return 21; /* Light snow showers and thunder */ |
162 |
+ case 29: return 21; /* Heavy snow showers and thunder */ |
163 |
+ case 30: return 22; /* Light rain and thunder */ |
164 |
+ case 31: return 23; /* Light sleet and thunder */ |
165 |
+ case 32: return 23; /* Heavy sleet and thunder */ |
166 |
+ case 33: return 14; /* Light snow and thunder */ |
167 |
+ case 34: return 14; /* Heavy snow and thunder */ |
168 |
+ |
169 |
+ /* symbols 35-39 are unused */ |
170 |
+ |
171 |
+ case 40: return 5; /* Light rain showers */ |
172 |
+ case 41: return 5; /* Heavy rain showers */ |
173 |
+ case 42: return 7; /* Light sleet showers */ |
174 |
+ case 43: return 7; /* Heavy sleet showers */ |
175 |
+ case 44: return 8; /* Light snow showers */ |
176 |
+ case 45: return 8; /* Heavy snow showers */ |
177 |
+ case 46: return 9; /* Light rain */ |
178 |
+ case 47: return 12; /* Light sleet */ |
179 |
+ case 48: return 12; /* Heavy sleet */ |
180 |
+ case 49: return 13; /* Light snow */ |
181 |
+ case 50: return 13; /* Heavy snow */ |
182 |
+ default: return id; |
183 |
+ } |
184 |
+} |
185 |
+ |
186 |
+ |
187 |
+const gchar * |
188 |
+get_symbol_for_id(gint id) |
189 |
+{ |
190 |
+ if (G_UNLIKELY(id < 1)) |
191 |
+ return NODATA; |
192 |
+ |
193 |
+ if (id >= NUM_SYMBOLS) |
194 |
+ id = replace_symbol_id(id); |
195 |
+ |
196 |
+ if (id < NUM_SYMBOLS) |
197 |
+ return symbol_to_desc[id-1].symbol; |
198 |
+ |
199 |
+ return NODATA; |
200 |
+} |
201 |
+ |
202 |
+ |
203 |
const gchar * |
204 |
translate_desc(const gchar *desc, |
205 |
const gboolean nighttime) |
206 |
diff --git a/panel-plugin/weather-translate.h b/panel-plugin/weather-translate.h |
207 |
index 1538466..2926279 100644 |
208 |
--- a/panel-plugin/weather-translate.h |
209 |
+++ b/panel-plugin/weather-translate.h |
210 |
@@ -24,6 +24,8 @@ |
211 |
|
212 |
G_BEGIN_DECLS |
213 |
|
214 |
+const gchar *get_symbol_for_id(gint id); |
215 |
+ |
216 |
const gchar *translate_desc(const gchar *desc, |
217 |
gboolean nighttime); |
218 |
|
219 |
-- |
220 |
2.1.2 |
221 |
|
222 |
|
223 |
|
224 |
|
225 |
1.1 xfce-extra/xfce4-weather-plugin/files/xfce4-weather-plugin-0.8.3-Fix-color-parsing-when-reading-config-file.patch |
226 |
|
227 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/xfce-extra/xfce4-weather-plugin/files/xfce4-weather-plugin-0.8.3-Fix-color-parsing-when-reading-config-file.patch?rev=1.1&view=markup |
228 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/xfce-extra/xfce4-weather-plugin/files/xfce4-weather-plugin-0.8.3-Fix-color-parsing-when-reading-config-file.patch?rev=1.1&content-type=text/plain |
229 |
|
230 |
Index: xfce4-weather-plugin-0.8.3-Fix-color-parsing-when-reading-config-file.patch |
231 |
=================================================================== |
232 |
From 09a9a4fdec9ee709bd3da2be2ba1cf13e4e377e1 Mon Sep 17 00:00:00 2001 |
233 |
From: Harald Judt <h.judt@×××.at> |
234 |
Date: Wed, 20 Feb 2013 15:25:09 +0100 |
235 |
Subject: [PATCH] Fix color parsing when reading config file. |
236 |
|
237 |
This turned out to be a stupid copy & paste mistake. |
238 |
|
239 |
(cherry picked from commit 462e85dfd54e9a3bdf6c330c602a6545bccce585) |
240 |
--- |
241 |
panel-plugin/weather.c | 2 +- |
242 |
1 file changed, 1 insertion(+), 1 deletion(-) |
243 |
|
244 |
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c |
245 |
index 710c33c..4a2e3c3 100644 |
246 |
--- a/panel-plugin/weather.c |
247 |
+++ b/panel-plugin/weather.c |
248 |
@@ -884,7 +884,7 @@ xfceweather_read_config(XfcePanelPlugin *plugin, |
249 |
|
250 |
value = xfce_rc_read_entry(rc, "scrollbox_color", NULL); |
251 |
if (value) |
252 |
- gdk_color_parse("#rrrrggggbbbb", &(data->scrollbox_color)); |
253 |
+ gdk_color_parse(value, &(data->scrollbox_color)); |
254 |
|
255 |
data->scrollbox_use_color = |
256 |
xfce_rc_read_bool_entry(rc, "scrollbox_use_color", FALSE); |
257 |
-- |
258 |
2.1.2 |