[arch-commits] Commit in xfce4-weather-plugin/trunk (5 files)

Evangelos Foutras foutrelis at archlinux.org
Thu Oct 9 20:02:45 UTC 2014


    Date: Thursday, October 9, 2014 @ 22:02:44
  Author: foutrelis
Revision: 224158

upgpkg: xfce4-weather-plugin 0.8.3-5

Fix FS#42314: Plugin is using an EOL REST service

Added:
  xfce4-weather-plugin/trunk/0001-Fix-color-parsing-when-reading-config-file.patch
  xfce4-weather-plugin/trunk/0002-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch
  xfce4-weather-plugin/trunk/0003-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch
Modified:
  xfce4-weather-plugin/trunk/PKGBUILD
Deleted:
  xfce4-weather-plugin/trunk/fix-color-parsing-when-reading-config-file.patch

-----------------------------------------------------------------+
 0001-Fix-color-parsing-when-reading-config-file.patch           |   28 +
 0002-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch |  162 ++++++++++
 0003-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch |   26 +
 PKGBUILD                                                        |   21 -
 fix-color-parsing-when-reading-config-file.patch                |   22 -
 5 files changed, 232 insertions(+), 27 deletions(-)

Added: 0001-Fix-color-parsing-when-reading-config-file.patch
===================================================================
--- 0001-Fix-color-parsing-when-reading-config-file.patch	                        (rev 0)
+++ 0001-Fix-color-parsing-when-reading-config-file.patch	2014-10-09 20:02:44 UTC (rev 224158)
@@ -0,0 +1,28 @@
+From 09a9a4fdec9ee709bd3da2be2ba1cf13e4e377e1 Mon Sep 17 00:00:00 2001
+From: Harald Judt <h.judt at gmx.at>
+Date: Wed, 20 Feb 2013 15:25:09 +0100
+Subject: [PATCH] Fix color parsing when reading config file.
+
+This turned out to be a stupid copy & paste mistake.
+
+(cherry picked from commit 462e85dfd54e9a3bdf6c330c602a6545bccce585)
+---
+ panel-plugin/weather.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
+index 710c33c..4a2e3c3 100644
+--- a/panel-plugin/weather.c
++++ b/panel-plugin/weather.c
+@@ -884,7 +884,7 @@ xfceweather_read_config(XfcePanelPlugin *plugin,
+ 
+     value = xfce_rc_read_entry(rc, "scrollbox_color", NULL);
+     if (value)
+-        gdk_color_parse("#rrrrggggbbbb", &(data->scrollbox_color));
++        gdk_color_parse(value, &(data->scrollbox_color));
+ 
+     data->scrollbox_use_color =
+         xfce_rc_read_bool_entry(rc, "scrollbox_use_color", FALSE);
+-- 
+2.1.2
+

Added: 0002-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch
===================================================================
--- 0002-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch	                        (rev 0)
+++ 0002-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch	2014-10-09 20:02:44 UTC (rev 224158)
@@ -0,0 +1,162 @@
+From a17ed6d248135cedc645b0481c4ad01687386ed2 Mon Sep 17 00:00:00 2001
+From: Harald Judt <h.judt at gmx.at>
+Date: Wed, 28 May 2014 20:08:02 +0200
+Subject: [PATCH] Make plugin ready for met.no locationforecast-1.2 API (bug
+ #10916).
+
+http://api.yr.no/weatherapi/locationforecastlts/1.1/documentation#version_1_2___2014_05_20
+
+The updated API version uses CamelCase symbol names instead of UPPERCASE
+ones and has added some new names (like 'Drizzle'), which unfortunately
+have not been documented (yet?).
+
+What's more, the typo 'celcius' has been replaced by the fixed 'celsius',
+but luckily the plugin will not be affected by that change.
+
+What's a bit more unfortunate is that the existing icon themes do not
+cover the new symbol names, so one would have to create quite a lot of
+new icons. Also, new translations would have to be added for the symbols,
+and maybe existing ones would have to be altered. To prevent this, we're
+simply going to map the new symbols to existing ones as good as possible.
+This should be good enough for the time being.
+
+(cherry picked from commit 1ff71669644a0b824a8a5ba9b40771ee4fb8a76b)
+---
+ panel-plugin/weather-parsers.c   |  3 +-
+ panel-plugin/weather-translate.c | 70 +++++++++++++++++++++++++++++++++++++++-
+ panel-plugin/weather-translate.h |  2 ++
+ 3 files changed, 73 insertions(+), 2 deletions(-)
+
+diff --git a/panel-plugin/weather-parsers.c b/panel-plugin/weather-parsers.c
+index c380130..2c90c11 100644
+--- a/panel-plugin/weather-parsers.c
++++ b/panel-plugin/weather-parsers.c
+@@ -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 <time.h>
+@@ -196,8 +197,8 @@ parse_location(xmlNode *cur_node,
+         }
+         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 --git a/panel-plugin/weather-translate.c b/panel-plugin/weather-translate.c
+index 004eef1..cc97600 100644
+--- a/panel-plugin/weather-translate.c
++++ b/panel-plugin/weather-translate.c
+@@ -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 @@ static const symbol_desc symbol_to_desc[] = {
+ 
+     { 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 @@ static const symbol_desc symbol_to_desc[] = {
+ #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 --git a/panel-plugin/weather-translate.h b/panel-plugin/weather-translate.h
+index 1538466..2926279 100644
+--- a/panel-plugin/weather-translate.h
++++ b/panel-plugin/weather-translate.h
+@@ -24,6 +24,8 @@
+ 
+ G_BEGIN_DECLS
+ 
++const gchar *get_symbol_for_id(gint id);
++
+ const gchar *translate_desc(const gchar *desc,
+                             gboolean nighttime);
+ 
+-- 
+2.1.2
+

Added: 0003-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch
===================================================================
--- 0003-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch	                        (rev 0)
+++ 0003-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch	2014-10-09 20:02:44 UTC (rev 224158)
@@ -0,0 +1,26 @@
+From 70024ad992bfd3845d885469e5eccfad76269465 Mon Sep 17 00:00:00 2001
+From: Harald Judt <h.judt at gmx.at>
+Date: Tue, 3 Jun 2014 19:59:05 +0200
+Subject: [PATCH] Switch to met.no locationforecastLTS-1.2 API (bug #10916).
+
+(cherry picked from commit 7df303bc5fa649299e18efeb5d4b801614030488)
+---
+ panel-plugin/weather.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
+index 4a2e3c3..e5036ae 100644
+--- a/panel-plugin/weather.c
++++ b/panel-plugin/weather.c
+@@ -638,7 +638,7 @@ update_handler(plugin_data *data)
+         /* 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 */
+-- 
+2.1.2
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2014-10-09 17:35:51 UTC (rev 224157)
+++ PKGBUILD	2014-10-09 20:02:44 UTC (rev 224158)
@@ -4,7 +4,7 @@
 
 pkgname=xfce4-weather-plugin
 pkgver=0.8.3
-pkgrel=4
+pkgrel=5
 pkgdesc="A weather plugin for the Xfce4 panel"
 arch=('i686' 'x86_64')
 url="http://goodies.xfce.org/projects/panel-plugins/xfce4-weather-plugin"
@@ -14,15 +14,26 @@
 makedepends=('intltool')
 install=$pkgname.install
 source=(http://archive.xfce.org/src/panel-plugins/$pkgname/0.8/$pkgname-$pkgver.tar.bz2
-        fix-color-parsing-when-reading-config-file.patch)
+        0001-Fix-color-parsing-when-reading-config-file.patch
+        0002-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch
+        0003-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch)
 sha256sums=('40a6a22be7653b15a47174a430da89040f178695b48e5e01e77990050f715ce4'
-            'dbf1f938e656293daeac4c3ab55061c5f61d8e29e470453b4e956081ca4722c7')
+            'a3f00c0012e6f6aef678e2ecc2d683c2371e256d95681e31ec027207fbf7100c'
+            '6c26a43817324496285306882b3cce38d70ed28e63e2e963ff873d97e4459732'
+            'd953160b0c7aa5d64cffa2be9cd68f2cfcddd3ac3334b6bcf1566c0b95b20f01')
 
+
+prepare() {
+  cd "$srcdir/$pkgname-$pkgver"
+
+  patch -Np1 -i ../0001-Fix-color-parsing-when-reading-config-file.patch
+  patch -Np1 -i ../0002-Make-plugin-ready-for-met.no-locationforecast-1.2-AP.patch
+  patch -Np1 -i ../0003-Switch-to-met.no-locationforecastLTS-1.2-API-bug-109.patch
+}
+
 build() {
   cd "$srcdir/$pkgname-$pkgver"
 
-  patch -Np1 -i "$srcdir/fix-color-parsing-when-reading-config-file.patch"
-
   ./configure \
     --prefix=/usr \
     --sysconfdir=/etc \

Deleted: fix-color-parsing-when-reading-config-file.patch
===================================================================
--- fix-color-parsing-when-reading-config-file.patch	2014-10-09 17:35:51 UTC (rev 224157)
+++ fix-color-parsing-when-reading-config-file.patch	2014-10-09 20:02:44 UTC (rev 224158)
@@ -1,22 +0,0 @@
-From 462e85dfd54e9a3bdf6c330c602a6545bccce585 Mon Sep 17 00:00:00 2001
-From: Harald Judt <h.judt at gmx.at>
-Date: Wed, 20 Feb 2013 14:25:09 +0000
-Subject: Fix color parsing when reading config file.
-
-This turned out to be a stupid copy & paste mistake.
----
-diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
-index 710c33c..4a2e3c3 100644
---- a/panel-plugin/weather.c
-+++ b/panel-plugin/weather.c
-@@ -884,7 +884,7 @@ xfceweather_read_config(XfcePanelPlugin *plugin,
- 
-     value = xfce_rc_read_entry(rc, "scrollbox_color", NULL);
-     if (value)
--        gdk_color_parse("#rrrrggggbbbb", &(data->scrollbox_color));
-+        gdk_color_parse(value, &(data->scrollbox_color));
- 
-     data->scrollbox_use_color =
-         xfce_rc_read_bool_entry(rc, "scrollbox_use_color", FALSE);
---
-cgit v0.9.1



More information about the arch-commits mailing list