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

(-)file_not_specified_in_diff (-2 / +70 lines)
Line  Link Here
0
-- panel-plugin/weather-translate.c
0
++ panel-plugin/weather-translate.c
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
static const gchar *wdirs[] = {
33
static const gchar *wdirs[] = {
Lines 170-176 static const symbol_desc symbol_to_desc[] = { Link Here
170
    { 15, "FOG",                 N_("Fog"),                        N_("Fog")                        },
171
    { 15, "FOG",                 N_("Fog"),                        N_("Fog")                        },
171
    /* Symbols 16-19 are used for polar days */
172
    /* Symbols 16-19 are used for polar days (unused beginning with API version 1.2) */
172
    { 16, "SUN",                 N_("Sunny"),                      N_("Clear")                      },
173
    { 16, "SUN",                 N_("Sunny"),                      N_("Clear")                      },
173
    { 17, "LIGHTCLOUD",          N_("Lightly cloudy"),             N_("Lightly cloudy")             },
174
    { 17, "LIGHTCLOUD",          N_("Lightly cloudy"),             N_("Lightly cloudy")             },
174
    { 18, "LIGHTRAINSUN",        N_("Rain showers"),               N_("Rain showers")               },
175
    { 18, "LIGHTRAINSUN",        N_("Rain showers"),               N_("Rain showers")               },
Lines 185-190 static const symbol_desc symbol_to_desc[] = { 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)

Return to bug 524850