diff --git a/xfce4-weather-plugin-1.2api.patch b/xfce4-weather-plugin-1.2api.patch new file mode 100644 index 0000000..0a8c35e --- /dev/null +++ b/xfce4-weather-plugin-1.2api.patch @@ -0,0 +1,139 @@ +diff -Nur xfce4-weather-plugin-0.8.3.orig/panel-plugin/weather.c xfce4-weather-plugin-0.8.3/panel-plugin/weather.c +--- xfce4-weather-plugin-0.8.3.orig/panel-plugin/weather.c 2013-02-18 03:21:00.000000000 -0700 ++++ xfce4-weather-plugin-0.8.3/panel-plugin/weather.c 2014-10-11 11:08:02.577649363 -0600 +@@ -638,7 +638,7 @@ + /* build url */ + url = + g_strdup_printf("http://api.yr.no/weatherapi" +- "/locationforecastlts/1.1/?lat=%s;lon=%s;msl=%d", ++ "/locationforecastlts/1.2/?lat=%s;lon=%s;msl=%d", + data->lat, data->lon, data->msl); + + /* start receive thread */ +diff -Nur xfce4-weather-plugin-0.8.3.orig/panel-plugin/weather-parsers.c xfce4-weather-plugin-0.8.3/panel-plugin/weather-parsers.c +--- xfce4-weather-plugin-0.8.3.orig/panel-plugin/weather-parsers.c 2013-02-01 08:18:50.000000000 -0700 ++++ xfce4-weather-plugin-0.8.3/panel-plugin/weather-parsers.c 2014-10-11 11:07:43.801985639 -0600 +@@ -28,6 +28,7 @@ + #define _XOPEN_SOURCE + #define _XOPEN_SOURCE_EXTENDED 1 + #include "weather-parsers.h" ++#include "weather-translate.h" + #include "weather-debug.h" + + #include +@@ -196,8 +197,8 @@ + } + if (NODE_IS_TYPE(child_node, "symbol")) { + g_free(loc->symbol); +- loc->symbol = PROP(child_node, "id"); + loc->symbol_id = strtol(PROP(child_node, "number"), NULL, 10); ++ loc->symbol = g_strdup(get_symbol_for_id(loc->symbol_id)); + } + } + +diff -Nur xfce4-weather-plugin-0.8.3.orig/panel-plugin/weather-translate.c xfce4-weather-plugin-0.8.3/panel-plugin/weather-translate.c +--- xfce4-weather-plugin-0.8.3.orig/panel-plugin/weather-translate.c 2013-01-24 07:45:10.000000000 -0700 ++++ xfce4-weather-plugin-0.8.3/panel-plugin/weather-translate.c 2014-10-11 11:07:43.802985621 -0600 +@@ -29,6 +29,7 @@ + #include "weather-translate.h" + + #define DAY_LOC_N (sizeof(gchar) * 100) ++#define NODATA "NODATA" + + + static const gchar *wdirs[] = { +@@ -169,7 +170,7 @@ + + { 15, "FOG", N_("Fog"), N_("Fog") }, + +- /* Symbols 16-19 are used for polar days */ ++ /* Symbols 16-19 are used for polar days (unused beginning with API version 1.2) */ + { 16, "SUN", N_("Sunny"), N_("Clear") }, + { 17, "LIGHTCLOUD", N_("Lightly cloudy"), N_("Lightly cloudy") }, + { 18, "LIGHTRAINSUN", N_("Rain showers"), N_("Rain showers") }, +@@ -185,6 +186,73 @@ + #define NUM_SYMBOLS (sizeof(symbol_to_desc) / sizeof(symbol_to_desc[0])) + + ++/* ++ * API version 1.2, published in May 2014, introduced new symbols. We ++ * try to match these with existing symbols, in order to be compatible ++ * with existing icon themes and to maintain translation completeness. ++ * ++ * See http://api.met.no/weatherapi/weathericon/1.1/documentation ++ * for a list of symbols. For a list of symbols with descriptions, ++ * see http://om.yr.no/forklaring/symbol. ++ */ ++gint ++replace_symbol_id(gint id) ++{ ++ /* Symbol ids greater than 100 are used for indicating polar ++ * night. These ids are over the ordinary id + 100. Since we ++ * don't support polar icons, we can simply subtract 100 to ++ * get the non-polar symbol ids. ++ */ ++ if (id > 100) ++ id -= 100; ++ ++ switch (id) { ++ case 24: return 22; /* Light rain showers and thunder */ ++ case 25: return 6; /* Heavy rain showers and thunder */ ++ case 26: return 20; /* Light sleet showers and thunder */ ++ case 27: return 20; /* Heavy sleet showers and thunder */ ++ case 28: return 21; /* Light snow showers and thunder */ ++ case 29: return 21; /* Heavy snow showers and thunder */ ++ case 30: return 22; /* Light rain and thunder */ ++ case 31: return 23; /* Light sleet and thunder */ ++ case 32: return 23; /* Heavy sleet and thunder */ ++ case 33: return 14; /* Light snow and thunder */ ++ case 34: return 14; /* Heavy snow and thunder */ ++ ++ /* symbols 35-39 are unused */ ++ ++ case 40: return 5; /* Light rain showers */ ++ case 41: return 5; /* Heavy rain showers */ ++ case 42: return 7; /* Light sleet showers */ ++ case 43: return 7; /* Heavy sleet showers */ ++ case 44: return 8; /* Light snow showers */ ++ case 45: return 8; /* Heavy snow showers */ ++ case 46: return 9; /* Light rain */ ++ case 47: return 12; /* Light sleet */ ++ case 48: return 12; /* Heavy sleet */ ++ case 49: return 13; /* Light snow */ ++ case 50: return 13; /* Heavy snow */ ++ default: return id; ++ } ++} ++ ++ ++const gchar * ++get_symbol_for_id(gint id) ++{ ++ if (G_UNLIKELY(id < 1)) ++ return NODATA; ++ ++ if (id >= NUM_SYMBOLS) ++ id = replace_symbol_id(id); ++ ++ if (id < NUM_SYMBOLS) ++ return symbol_to_desc[id-1].symbol; ++ ++ return NODATA; ++} ++ ++ + const gchar * + translate_desc(const gchar *desc, + const gboolean nighttime) +diff -Nur xfce4-weather-plugin-0.8.3.orig/panel-plugin/weather-translate.h xfce4-weather-plugin-0.8.3/panel-plugin/weather-translate.h +--- xfce4-weather-plugin-0.8.3.orig/panel-plugin/weather-translate.h 2013-01-24 07:45:10.000000000 -0700 ++++ xfce4-weather-plugin-0.8.3/panel-plugin/weather-translate.h 2014-10-11 11:07:43.802985621 -0600 +@@ -24,6 +24,8 @@ + + G_BEGIN_DECLS + ++const gchar *get_symbol_for_id(gint id); ++ + const gchar *translate_desc(const gchar *desc, + gboolean nighttime); + diff --git a/xfce4-weather-plugin.spec b/xfce4-weather-plugin.spec index e96ffe6..daa9853 100644 --- a/xfce4-weather-plugin.spec +++ b/xfce4-weather-plugin.spec @@ -10,7 +10,7 @@ Name: xfce4-weather-plugin Version: 0.8.3 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Weather plugin for the Xfce panel Group: User Interface/Desktops @@ -20,6 +20,11 @@ URL: http://goodies.xfce.org/projects/panel-plugins/%{name} Source0: http://archive.xfce.org/src/panel-plugins/%{name}/%{minorversion}/%{name}-%{version}.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# Already commited upstream +# https://bugzilla.xfce.org/show_bug.cgi?id=10916 +# Rebased from upstream git head commits +Patch0: xfce4-weather-plugin-1.2api.patch + BuildRequires: libxfce4ui-devel >= 4.7.0 BuildRequires: xfce4-panel-devel >= 4.7.0 BuildRequires: libsoup-devel >= 2.26.0 @@ -37,6 +42,8 @@ weather condition, using weather data provided by xoap.weather.com. %prep %setup -q +%patch0 -p1 + %build %configure make %{?_smp_mflags} @@ -84,6 +91,11 @@ rm -rf %{buildroot} %changelog +* Sat Oct 11 2014 Kevin Fenzi 0.8.3-7 +- Add upstream patches to switch to new v1.2 weather api. +- Upstream bug https://bugzilla.xfce.org/show_bug.cgi?id=10916 +- Fixes bugs #1150329 #1119857 + * Mon Aug 18 2014 Kalev Lember - 0.8.3-6 - Rebuilt for upower 0.99.1 soname bump