Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 524850 | Differences between
and this patch

Collapse All | Expand All

(-)xfce4-weather-plugin-0.8.3.orig/panel-plugin/weather.c (-1 / +1 lines)
Lines 638-644 Link Here
638
        /* build url */
638
        /* build url */
639
        url =
639
        url =
640
            g_strdup_printf("http://api.yr.no/weatherapi"
640
            g_strdup_printf("http://api.yr.no/weatherapi"
641
                            "/locationforecastlts/1.1/?lat=%s;lon=%s;msl=%d",
641
                            "/locationforecastlts/1.2/?lat=%s;lon=%s;msl=%d",
642
                            data->lat, data->lon, data->msl);
642
                            data->lat, data->lon, data->msl);
643
643
644
        /* start receive thread */
644
        /* start receive thread */
(-)xfce4-weather-plugin-0.8.3.orig/panel-plugin/weather-parsers.c (-1 / +2 lines)
Lines 28-33 Link Here
28
#define _XOPEN_SOURCE
28
#define _XOPEN_SOURCE
29
#define _XOPEN_SOURCE_EXTENDED 1
29
#define _XOPEN_SOURCE_EXTENDED 1
30
#include "weather-parsers.h"
30
#include "weather-parsers.h"
31
#include "weather-translate.h"
31
#include "weather-debug.h"
32
#include "weather-debug.h"
32
33
33
#include <time.h>
34
#include <time.h>
Lines 196-203 Link Here
196
        }
197
        }
197
        if (NODE_IS_TYPE(child_node, "symbol")) {
198
        if (NODE_IS_TYPE(child_node, "symbol")) {
198
            g_free(loc->symbol);
199
            g_free(loc->symbol);
199
            loc->symbol = PROP(child_node, "id");
200
            loc->symbol_id = strtol(PROP(child_node, "number"), NULL, 10);
200
            loc->symbol_id = strtol(PROP(child_node, "number"), NULL, 10);
201
            loc->symbol = g_strdup(get_symbol_for_id(loc->symbol_id));
201
        }
202
        }
202
    }
203
    }
203
204
(-)xfce4-weather-plugin-0.8.3.orig/panel-plugin/weather-translate.c (-1 / +69 lines)
Lines 29-34 Link Here
29
#include "weather-translate.h"
29
#include "weather-translate.h"
30
30
31
#define DAY_LOC_N (sizeof(gchar) * 100)
31
#define DAY_LOC_N (sizeof(gchar) * 100)
32
#define NODATA "NODATA"
32
33
33
34
34
static const gchar *wdirs[] = {
35
static const gchar *wdirs[] = {
Lines 169-175 Link Here
169
170
170
    { 15, "FOG",                 N_("Fog"),                        N_("Fog")                        },
171
    { 15, "FOG",                 N_("Fog"),                        N_("Fog")                        },
171
172
172
    /* Symbols 16-19 are used for polar days */
173
    /* Symbols 16-19 are used for polar days (unused beginning with API version 1.2) */
173
    { 16, "SUN",                 N_("Sunny"),                      N_("Clear")                      },
174
    { 16, "SUN",                 N_("Sunny"),                      N_("Clear")                      },
174
    { 17, "LIGHTCLOUD",          N_("Lightly cloudy"),             N_("Lightly cloudy")             },
175
    { 17, "LIGHTCLOUD",          N_("Lightly cloudy"),             N_("Lightly cloudy")             },
175
    { 18, "LIGHTRAINSUN",        N_("Rain showers"),               N_("Rain showers")               },
176
    { 18, "LIGHTRAINSUN",        N_("Rain showers"),               N_("Rain showers")               },
Lines 185-190 Link Here
185
#define NUM_SYMBOLS (sizeof(symbol_to_desc) / sizeof(symbol_to_desc[0]))
186
#define NUM_SYMBOLS (sizeof(symbol_to_desc) / sizeof(symbol_to_desc[0]))
186
187
187
188
189
/*
190
 * API version 1.2, published in May 2014, introduced new symbols. We
191
 * try to match these with existing symbols, in order to be compatible
192
 * with existing icon themes and to maintain translation completeness.
193
 *
194
 * See http://api.met.no/weatherapi/weathericon/1.1/documentation
195
 * for a list of symbols. For a list of symbols with descriptions,
196
 * see http://om.yr.no/forklaring/symbol.
197
 */
198
gint
199
replace_symbol_id(gint id)
200
{
201
    /* Symbol ids greater than 100 are used for indicating polar
202
     * night. These ids are over the ordinary id + 100. Since we
203
     * don't support polar icons, we can simply subtract 100 to
204
     * get the non-polar symbol ids.
205
     */
206
    if (id > 100)
207
        id -= 100;
208
209
    switch (id) {
210
    case 24: return 22; /* Light rain showers and thunder */
211
    case 25: return 6;  /* Heavy rain showers and thunder */
212
    case 26: return 20; /* Light sleet showers and thunder */
213
    case 27: return 20; /* Heavy sleet showers and thunder */
214
    case 28: return 21; /* Light snow showers and thunder */
215
    case 29: return 21; /* Heavy snow showers and thunder */
216
    case 30: return 22; /* Light rain and thunder */
217
    case 31: return 23; /* Light sleet and thunder */
218
    case 32: return 23; /* Heavy sleet and thunder */
219
    case 33: return 14; /* Light snow and thunder */
220
    case 34: return 14; /* Heavy snow and thunder */
221
222
    /* symbols 35-39 are unused */
223
224
    case 40: return 5;  /* Light rain showers */
225
    case 41: return 5;  /* Heavy rain showers */
226
    case 42: return 7;  /* Light sleet showers */
227
    case 43: return 7;  /* Heavy sleet showers */
228
    case 44: return 8;  /* Light snow showers */
229
    case 45: return 8;  /* Heavy snow showers */
230
    case 46: return 9;  /* Light rain */
231
    case 47: return 12; /* Light sleet */
232
    case 48: return 12; /* Heavy sleet */
233
    case 49: return 13; /* Light snow */
234
    case 50: return 13; /* Heavy snow */
235
    default: return id;
236
    }
237
}
238
239
240
const gchar *
241
get_symbol_for_id(gint id)
242
{
243
    if (G_UNLIKELY(id < 1))
244
        return NODATA;
245
246
    if (id >= NUM_SYMBOLS)
247
        id = replace_symbol_id(id);
248
249
    if (id < NUM_SYMBOLS)
250
        return symbol_to_desc[id-1].symbol;
251
252
    return NODATA;
253
}
254
255
188
const gchar *
256
const gchar *
189
translate_desc(const gchar *desc,
257
translate_desc(const gchar *desc,
190
               const gboolean nighttime)
258
               const gboolean nighttime)
(-)xfce4-weather-plugin-0.8.3.orig/panel-plugin/weather-translate.h (+2 lines)
Lines 24-29 Link Here
24
24
25
G_BEGIN_DECLS
25
G_BEGIN_DECLS
26
26
27
const gchar *get_symbol_for_id(gint id);
28
27
const gchar *translate_desc(const gchar *desc,
29
const gchar *translate_desc(const gchar *desc,
28
                            gboolean nighttime);
30
                            gboolean nighttime);
29
31

Return to bug 524850