xfce4-weather-plugin: update to 0.11.3.

This commit is contained in:
Đoàn Trần Công Danh 2024-12-16 07:22:18 +07:00 committed by Đoàn Trần Công Danh
parent 732e133fa6
commit 46df66c5aa
3 changed files with 99 additions and 55 deletions

View File

@ -1,7 +1,7 @@
From dc3e3cdcba7d1c5159bb27b390ffd1b3a7feeb84 Mon Sep 17 00:00:00 2001
From c0653a903c6f2cecdf41ac9eaeba4f4617656ffe Mon Sep 17 00:00:00 2001
From: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Date: Fri, 1 Mar 2024 21:56:34 +0700
Subject: [PATCH 3/4] parsers: Generalise input to array of gchar
Subject: [PATCH 1/2] parsers: Generalise input to array of gchar
In a later change, we will move to libsoup-3.0, which doesn't expose
`response_body' in SoupMessage.
@ -16,10 +16,10 @@ Prepare for that move.
5 files changed, 76 insertions(+), 29 deletions(-)
diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index 66e0719..d08f2d2 100644
index 2645408..19fa1d8 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -241,9 +241,16 @@ cb_lookup_altitude(SoupSession *session,
@@ -245,6 +245,13 @@ cb_lookup_altitude(SoupSession *session,
xfceweather_dialog *dialog = (xfceweather_dialog *) user_data;
xml_altitude *altitude;
gdouble alt = 0;
@ -31,13 +31,18 @@ index 66e0719..d08f2d2 100644
+ len = msg->response_body->length;
+ }
if (global_dialog == NULL) {
weather_debug("%s called after dialog was destroyed", G_STRFUNC);
@@ -252,7 +259,7 @@ cb_lookup_altitude(SoupSession *session,
}
altitude = (xml_altitude *)
- parse_xml_document(msg, (XmlParseFunc) parse_altitude);
+ parse_xml_document(body, len, (XmlParseFunc) parse_altitude);
if (altitude) {
alt = string_to_double(altitude->altitude, -9999);
@@ -265,9 +272,16 @@ cb_lookup_timezone(SoupSession *session,
@@ -274,6 +281,13 @@ cb_lookup_timezone(SoupSession *session,
{
xfceweather_dialog *dialog = (xfceweather_dialog *) user_data;
xml_timezone *xml_tz;
@ -49,6 +54,11 @@ index 66e0719..d08f2d2 100644
+ len = msg->response_body->length;
+ }
if (global_dialog == NULL) {
weather_debug("%s called after dialog was destroyed", G_STRFUNC);
@@ -281,7 +295,7 @@ cb_lookup_timezone(SoupSession *session,
}
xml_tz = (xml_timezone *)
- parse_xml_document(msg, (XmlParseFunc) parse_timezone);
+ parse_xml_document(body, len, (XmlParseFunc) parse_timezone);
@ -156,10 +166,10 @@ index a9d019d..09b9c02 100644
xml_astro *xml_astro_copy(const xml_astro *src);
diff --git a/panel-plugin/weather-search.c b/panel-plugin/weather-search.c
index b63e68d..cfbcd55 100644
index 7e87ae8..6a2ba1f 100644
--- a/panel-plugin/weather-search.c
+++ b/panel-plugin/weather-search.c
@@ -87,10 +87,17 @@ cb_searchdone(SoupSession *session,
@@ -89,6 +89,13 @@ cb_searchdone(SoupSession *session,
gint found = 0;
GtkTreeIter iter;
GtkTreeSelection *selection;
@ -171,6 +181,10 @@ index b63e68d..cfbcd55 100644
+ len = msg->response_body->length;
+ }
if (global_dialog == NULL) {
weather_debug("%s called after dialog was destroyed", G_STRFUNC);
@@ -97,7 +104,7 @@ cb_searchdone(SoupSession *session,
gtk_widget_set_sensitive(dialog->find_button, TRUE);
- doc = get_xml_document(msg);
@ -178,7 +192,7 @@ index b63e68d..cfbcd55 100644
if (!doc)
return;
@@ -377,9 +384,16 @@ cb_geolocation(SoupSession *session,
@@ -385,6 +392,13 @@ cb_geolocation(SoupSession *session,
xml_geolocation *geo;
gchar *full_loc;
units_config *units;
@ -190,6 +204,11 @@ index b63e68d..cfbcd55 100644
+ len = msg->response_body->length;
+ }
if (global_dialog == NULL) {
weather_debug("%s called after dialog was destroyed", G_STRFUNC);
@@ -392,7 +406,7 @@ cb_geolocation(SoupSession *session,
}
geo = (xml_geolocation *)
- parse_xml_document(msg, (XmlParseFunc) parse_geolocation);
+ parse_xml_document(body, len, (XmlParseFunc) parse_geolocation);
@ -197,10 +216,10 @@ index b63e68d..cfbcd55 100644
if (!geo) {
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index daebd00..3a6a2b6 100644
index 0a92b4e..b75c633 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -494,11 +494,17 @@ cb_astro_update_sun(SoupSession *session,
@@ -489,11 +489,17 @@ cb_astro_update_sun(SoupSession *session,
json_object *json_tree;
time_t now_t;
guint astro_forecast_days;
@ -219,7 +238,7 @@ index daebd00..3a6a2b6 100644
if (G_LIKELY(json_tree)) {
if (!parse_astrodata_sun(json_tree, data->astrodata)) {
data->msg_parse->sun_msg_parse_error++;
@@ -550,11 +556,17 @@ cb_astro_update_moon(SoupSession *session,
@@ -545,11 +551,17 @@ cb_astro_update_moon(SoupSession *session,
json_object *json_tree;
time_t now_t;
guint astro_forecast_days;
@ -238,7 +257,7 @@ index daebd00..3a6a2b6 100644
if (G_LIKELY(json_tree)) {
if (!parse_astrodata_moon(json_tree, data->astrodata)) {
data->msg_parse->moon_msg_parse_error++;
@@ -611,17 +623,23 @@ cb_weather_update(SoupSession *session,
@@ -606,17 +618,23 @@ cb_weather_update(SoupSession *session,
gpointer user_data)
{
plugin_data *data = user_data;
@ -264,3 +283,6 @@ index daebd00..3a6a2b6 100644
if (G_LIKELY(doc)) {
root_node = xmlDocGetRootElement(doc);
if (G_LIKELY(root_node))
--
2.47.1.613.gc27f4b7a9fc45

View File

@ -1,11 +1,11 @@
From ec857414aaf53ff447062631734cdf44ab29d141 Mon Sep 17 00:00:00 2001
From 279c975dc1f95bd1ce9152eee1d19122e7deb9a8 Mon Sep 17 00:00:00 2001
From: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Date: Fri, 1 Mar 2024 21:56:34 +0700
Subject: [PATCH 4/4] libsoup: Port to libsoup-3.0
Subject: [PATCH 2/2] libsoup: Port to libsoup-3.0
---
README | 4 +-
configure.ac.in | 2 +-
configure.ac | 2 +-
panel-plugin/weather-config.c | 32 ++++---
panel-plugin/weather-search.c | 37 ++++++---
panel-plugin/weather-summary.c | 23 ++++--
@ -13,11 +13,28 @@ Subject: [PATCH 4/4] libsoup: Port to libsoup-3.0
panel-plugin/weather.h | 2 +-
7 files changed, 132 insertions(+), 115 deletions(-)
diff --git a/configure.ac.in b/configure.ac.in
index 8127fb0..0bf3da4 100644
diff --git a/README b/README
index 6587581..3530b1f 100644
--- a/README
+++ b/README
@@ -152,10 +152,10 @@ using gdb or any other debugger should the plugin crash:
BUILD REQUIREMENTS AND DEPENDENCIES
==========================================================================
To be able to build the plugin, the following requirements have to be
-met in addition to those of XFCE-4.14:
+met in addition to those of XFCE-4.16:
* >=libxml-2.4.0
-* >=libsoup-2.42.0
+* >=libsoup-3.0.0
* >=upower-0.9.0 (optional)
You might also need developer libraries necessary for building other
diff --git a/configure.ac b/configure.ac
index 324599f..049ef88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,7 +71,7 @@ XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.16.0])
@@ -70,7 +70,7 @@ XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.16.0])
XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.14.0])
XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.12.0])
XDT_CHECK_PACKAGE([LIBXML], [libxml-2.0], [2.4.0])
@ -27,10 +44,10 @@ index 8127fb0..0bf3da4 100644
XDT_CHECK_OPTIONAL_PACKAGE([UPOWER_GLIB], [upower-glib], [0.9.0], [upower],
[upower for adapting update interval to power state])
diff --git a/panel-plugin/weather-config.c b/panel-plugin/weather-config.c
index d08f2d2..06bd802 100644
index 19fa1d8..d27c825 100644
--- a/panel-plugin/weather-config.c
+++ b/panel-plugin/weather-config.c
@@ -234,8 +234,8 @@ sanitize_location_name(const gchar *location_name)
@@ -238,8 +238,8 @@ sanitize_location_name(const gchar *location_name)
static void
@ -41,7 +58,7 @@ index d08f2d2..06bd802 100644
gpointer user_data)
{
xfceweather_dialog *dialog = (xfceweather_dialog *) user_data;
@@ -243,11 +243,14 @@ cb_lookup_altitude(SoupSession *session,
@@ -247,11 +247,14 @@ cb_lookup_altitude(SoupSession *session,
gdouble alt = 0;
const gchar *body = NULL;
gsize len = 0;
@ -58,9 +75,9 @@ index d08f2d2..06bd802 100644
+ else
+ body = g_bytes_get_data(response, &len);
altitude = (xml_altitude *)
parse_xml_document(body, len, (XmlParseFunc) parse_altitude);
@@ -262,23 +265,27 @@ cb_lookup_altitude(SoupSession *session,
if (global_dialog == NULL) {
weather_debug("%s called after dialog was destroyed", G_STRFUNC);
@@ -271,23 +274,27 @@ cb_lookup_altitude(SoupSession *session,
else if (dialog->pd->units->altitude == FEET)
alt /= 0.3048;
gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->spin_alt), alt);
@ -92,9 +109,9 @@ index d08f2d2..06bd802 100644
+ else
+ body = g_bytes_get_data(response, &len);
xml_tz = (xml_timezone *)
parse_xml_document(body, len, (XmlParseFunc) parse_timezone);
@@ -290,6 +297,7 @@ cb_lookup_timezone(SoupSession *session,
if (global_dialog == NULL) {
weather_debug("%s called after dialog was destroyed", G_STRFUNC);
@@ -304,6 +311,7 @@ cb_lookup_timezone(SoupSession *session,
xml_timezone_free(xml_tz);
} else
gtk_entry_set_text(GTK_ENTRY(dialog->text_timezone), "");
@ -103,10 +120,10 @@ index d08f2d2..06bd802 100644
diff --git a/panel-plugin/weather-search.c b/panel-plugin/weather-search.c
index cfbcd55..d49dd79 100644
index 6a2ba1f..e030ff8 100644
--- a/panel-plugin/weather-search.c
+++ b/panel-plugin/weather-search.c
@@ -76,8 +76,8 @@ sanitize_str(const gchar *str)
@@ -78,8 +78,8 @@ sanitize_str(const gchar *str)
static void
@ -117,7 +134,7 @@ index cfbcd55..d49dd79 100644
gpointer user_data)
{
search_dialog *dialog = (search_dialog *) user_data;
@@ -89,17 +89,22 @@ cb_searchdone(SoupSession *session,
@@ -91,11 +91,14 @@ cb_searchdone(SoupSession *session,
GtkTreeSelection *selection;
const gchar *body = NULL;
gsize len = 0;
@ -134,6 +151,9 @@ index cfbcd55..d49dd79 100644
+ else
+ body = g_bytes_get_data(response, &len);
if (global_dialog == NULL) {
weather_debug("%s called after dialog was destroyed", G_STRFUNC);
@@ -105,8 +108,10 @@ cb_searchdone(SoupSession *session,
gtk_widget_set_sensitive(dialog->find_button, TRUE);
doc = get_xml_document(body, len);
@ -145,7 +165,7 @@ index cfbcd55..d49dd79 100644
cur_node = xmlDocGetRootElement(doc);
if (cur_node) {
@@ -133,6 +138,7 @@ cb_searchdone(SoupSession *session,
@@ -140,6 +145,7 @@ cb_searchdone(SoupSession *session,
}
gtk_tree_view_column_set_title(dialog->column, _("Results"));
@ -153,7 +173,7 @@ index cfbcd55..d49dd79 100644
}
@@ -376,8 +382,8 @@ get_preferred_units(const gchar *country_code)
@@ -384,8 +390,8 @@ get_preferred_units(const gchar *country_code)
static void
@ -164,7 +184,7 @@ index cfbcd55..d49dd79 100644
gpointer user_data)
{
geolocation_data *data = (geolocation_data *) user_data;
@@ -386,11 +392,14 @@ cb_geolocation(SoupSession *session,
@@ -394,11 +400,14 @@ cb_geolocation(SoupSession *session,
units_config *units;
const gchar *body = NULL;
gsize len = 0;
@ -181,9 +201,9 @@ index cfbcd55..d49dd79 100644
+ else
+ body = g_bytes_get_data(response, &len);
geo = (xml_geolocation *)
parse_xml_document(body, len, (XmlParseFunc) parse_geolocation);
@@ -398,6 +407,7 @@ cb_geolocation(SoupSession *session,
if (global_dialog == NULL) {
weather_debug("%s called after dialog was destroyed", G_STRFUNC);
@@ -411,6 +420,7 @@ cb_geolocation(SoupSession *session,
if (!geo) {
data->cb(NULL, NULL, NULL, NULL, data->user_data);
@ -191,7 +211,7 @@ index cfbcd55..d49dd79 100644
g_free(data);
return;
}
@@ -428,6 +438,7 @@ cb_geolocation(SoupSession *session,
@@ -441,6 +451,7 @@ cb_geolocation(SoupSession *session,
g_slice_free(units_config, units);
xml_geolocation_free(geo);
g_free(full_loc);
@ -251,7 +271,7 @@ index a6a2f56..224bb34 100644
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index 3a6a2b6..18fca37 100644
index b75c633..1a84537 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -23,6 +23,8 @@
@ -280,7 +300,7 @@ index 3a6a2b6..18fca37 100644
}
@@ -486,8 +489,8 @@ calc_next_download_time(const update_info *upi,
@@ -481,8 +484,8 @@ calc_next_download_time(const update_info *upi,
* Process downloaded sun astro data and schedule next astro update.
*/
static void
@ -291,7 +311,7 @@ index 3a6a2b6..18fca37 100644
gpointer user_data)
{
plugin_data *data = user_data;
@@ -496,14 +499,17 @@ cb_astro_update_sun(SoupSession *session,
@@ -491,14 +494,17 @@ cb_astro_update_sun(SoupSession *session,
guint astro_forecast_days;
const gchar *body = NULL;
gsize len = 0;
@ -315,7 +335,7 @@ index 3a6a2b6..18fca37 100644
json_tree = get_json_tree(body, len);
if (G_LIKELY(json_tree)) {
if (!parse_astrodata_sun(json_tree, data->astrodata)) {
@@ -519,10 +525,12 @@ cb_astro_update_sun(SoupSession *session,
@@ -514,10 +520,12 @@ cb_astro_update_sun(SoupSession *session,
g_warning("Error parsing sun astronomical data!");
weather_debug("No json_tree");
}
@ -330,7 +350,7 @@ index 3a6a2b6..18fca37 100644
}
astro_forecast_days = data->forecast_days + 1;
@@ -548,8 +556,8 @@ cb_astro_update_sun(SoupSession *session,
@@ -543,8 +551,8 @@ cb_astro_update_sun(SoupSession *session,
* Process downloaded moon astro data and schedule next astro update.
*/
static void
@ -341,7 +361,7 @@ index 3a6a2b6..18fca37 100644
gpointer user_data)
{
plugin_data *data = user_data;
@@ -558,14 +566,17 @@ cb_astro_update_moon(SoupSession *session,
@@ -553,14 +561,17 @@ cb_astro_update_moon(SoupSession *session,
guint astro_forecast_days;
const gchar *body = NULL;
gsize len = 0;
@ -365,7 +385,7 @@ index 3a6a2b6..18fca37 100644
json_tree = get_json_tree(body, len);
if (G_LIKELY(json_tree)) {
if (!parse_astrodata_moon(json_tree, data->astrodata)) {
@@ -581,10 +592,12 @@ cb_astro_update_moon(SoupSession *session,
@@ -576,10 +587,12 @@ cb_astro_update_moon(SoupSession *session,
g_warning("Error parsing moon astronomical data");
weather_debug("No json_tree");
}
@ -380,7 +400,7 @@ index 3a6a2b6..18fca37 100644
}
astro_forecast_days = data->forecast_days + 1;
@@ -618,8 +631,8 @@ cb_astro_update_moon(SoupSession *session,
@@ -613,8 +626,8 @@ cb_astro_update_moon(SoupSession *session,
* Process downloaded weather data and schedule next weather update.
*/
static void
@ -391,7 +411,7 @@ index 3a6a2b6..18fca37 100644
gpointer user_data)
{
plugin_data *data = user_data;
@@ -629,16 +642,19 @@ cb_weather_update(SoupSession *session,
@@ -624,16 +637,19 @@ cb_weather_update(SoupSession *session,
gboolean parsing_error = TRUE;
const gchar *body = NULL;
gsize len = 0;
@ -417,7 +437,7 @@ index 3a6a2b6..18fca37 100644
doc = get_xml_document(body, len);
if (G_LIKELY(doc)) {
root_node = xmlDocGetRootElement(doc);
@@ -650,12 +666,13 @@ cb_weather_update(SoupSession *session,
@@ -645,12 +661,13 @@ cb_weather_update(SoupSession *session,
}
xmlFreeDoc(doc);
}
@ -435,7 +455,7 @@ index 3a6a2b6..18fca37 100644
data->weather_update->next = calc_next_download_time(data->weather_update,
now_t);
@@ -1713,32 +1730,6 @@ mi_click(GtkWidget *widget,
@@ -1708,32 +1725,6 @@ mi_click(GtkWidget *widget,
update_weatherdata_with_reset(data);
}
@ -468,7 +488,7 @@ index 3a6a2b6..18fca37 100644
#ifdef HAVE_UPOWER_GLIB
static void
@@ -2038,9 +2029,10 @@ static plugin_data *
@@ -2037,9 +2028,10 @@ static plugin_data *
xfceweather_create_control(XfcePanelPlugin *plugin)
{
plugin_data *data = g_slice_new0(plugin_data);
@ -481,7 +501,7 @@ index 3a6a2b6..18fca37 100644
GtkWidget *refresh;
cairo_surface_t *icon = NULL;
data_types lbl;
@@ -2078,29 +2070,26 @@ xfceweather_create_control(XfcePanelPlugin *plugin)
@@ -2077,29 +2069,26 @@ xfceweather_create_control(XfcePanelPlugin *plugin)
/* Setup session for HTTP connections */
data->session = soup_session_new();
@ -538,3 +558,6 @@ index 208de09..01974ce 100644
gpointer user_data);
void scrollbox_set_visible(plugin_data *data);
--
2.47.1.613.gc27f4b7a9fc45

View File

@ -1,10 +1,9 @@
# Template file for 'xfce4-weather-plugin'
pkgname=xfce4-weather-plugin
version=0.11.2
version=0.11.3
revision=1
build_style=gnu-configure
configure_args="--with-locales-dir=/usr/share/locale"
hostmakedepends="pkg-config intltool xfce4-dev-tools gettext-devel"
hostmakedepends="pkg-config gettext xfce4-dev-tools automake libtool"
makedepends="libxfce4ui-devel xfce4-panel-devel libxml2-devel libsoup3-devel
json-c-devel upower-devel"
depends="hicolor-icon-theme"
@ -13,9 +12,9 @@ maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="https://goodies.xfce.org/projects/panel-plugins/xfce4-weather-plugin"
distfiles="https://archive.xfce.org/src/panel-plugins/${pkgname}/${version%.*}/${pkgname}-${version}.tar.bz2"
checksum=65d40aff7863550858a9f9d2b6054f27c69a3e7e712991785987f9a73bba876b
checksum=002d1fe63906d2f3a012f3cb58cceff1dfbcc466759e36c76d3b03dd01c0dc57
lib32disabled=yes
pre_configure() {
autoreconf -fi
autoreconf -f
}