1
|
|
-Origin: https://github.com/mate-desktop/libmateweather/pull/133
|
2
|
|
-From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= <congdanhqx@gmail.com>
|
|
1
|
+From 8767c4010989af95d9149772a21bba8216813c89 Mon Sep 17 00:00:00 2001
|
|
2
|
+From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
|
|
3
|
+ <congdanhqx@gmail.com>
|
3
|
4
|
Date: Mon, 4 Mar 2024 23:47:37 +0700
|
4
|
|
-Subject: Port to libsoup-3.0
|
|
5
|
+Subject: [PATCH] Port to libsoup-3.0
|
5
|
6
|
|
6
|
7
|
---
|
7
|
8
|
.build.yml | 10 ++--
|
... |
... |
@@ -11,17 +12,15 @@ Subject: Port to libsoup-3.0 |
11
|
12
|
libmateweather/weather-bom.c | 36 ++++++++-----
|
12
|
13
|
libmateweather/weather-iwin.c | 37 ++++++++-----
|
13
|
14
|
libmateweather/weather-met.c | 34 ++++++++----
|
14
|
|
- libmateweather/weather-metar.c | 57 ++++++++++++++------
|
|
15
|
+ libmateweather/weather-metar.c | 56 ++++++++++++++------
|
15
|
16
|
libmateweather/weather-priv.h | 6 ++-
|
16
|
17
|
libmateweather/weather-wx.c | 53 +++++++++---------
|
17
|
18
|
libmateweather/weather.c | 7 +--
|
18
|
|
- 11 files changed, 157 insertions(+), 93 deletions(-)
|
|
19
|
+ 11 files changed, 156 insertions(+), 93 deletions(-)
|
19
|
20
|
|
20
|
|
-diff --git a/.build.yml b/.build.yml
|
21
|
|
-index 622db502..024b8f4a 100644
|
22
|
21
|
--- a/.build.yml
|
23
|
22
|
+++ b/.build.yml
|
24
|
|
-@@ -9,7 +9,7 @@ requires:
|
|
23
|
+@@ -9,7 +9,7 @@
|
25
|
24
|
- gcc
|
26
|
25
|
- git
|
27
|
26
|
- gtk3
|
... |
... |
@@ -30,7 +29,7 @@ index 622db502..024b8f4a 100644 |
30
|
29
|
- make
|
31
|
30
|
- mate-common
|
32
|
31
|
- tzdata
|
33
|
|
-@@ -27,8 +27,7 @@ requires:
|
|
32
|
+@@ -27,8 +27,7 @@
|
34
|
33
|
- gtk-doc-tools
|
35
|
34
|
- libglib2.0-dev
|
36
|
35
|
- libgtk-3-dev
|
... |
... |
@@ -40,7 +39,7 @@ index 622db502..024b8f4a 100644 |
40
|
39
|
- libxml2-dev
|
41
|
40
|
- libxml2-utils
|
42
|
41
|
- make
|
43
|
|
-@@ -44,7 +43,7 @@ requires:
|
|
42
|
+@@ -43,7 +42,7 @@
|
44
|
43
|
- gcc
|
45
|
44
|
- git
|
46
|
45
|
- gtk3-devel
|
... |
... |
@@ -49,7 +48,7 @@ index 622db502..024b8f4a 100644 |
49
|
48
|
- libxml2-devel
|
50
|
49
|
- make
|
51
|
50
|
- mate-common
|
52
|
|
-@@ -60,8 +59,7 @@ requires:
|
|
51
|
+@@ -59,8 +58,7 @@
|
53
|
52
|
- gtk-doc-tools
|
54
|
53
|
- libglib2.0-dev
|
55
|
54
|
- libgtk-3-dev
|
... |
... |
@@ -59,11 +58,9 @@ index 622db502..024b8f4a 100644 |
59
|
58
|
- libxml2-dev
|
60
|
59
|
- libxml2-utils
|
61
|
60
|
- make
|
62
|
|
-diff --git a/configure.ac b/configure.ac
|
63
|
|
-index 133108eb..d9fcf9c1 100644
|
64
|
61
|
--- a/configure.ac
|
65
|
62
|
+++ b/configure.ac
|
66
|
|
-@@ -8,6 +8,7 @@ AC_CONFIG_AUX_DIR([build-aux])
|
|
63
|
+@@ -8,6 +8,7 @@
|
67
|
64
|
AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-xz tar-ustar check-news])
|
68
|
65
|
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
69
|
66
|
|
... |
... |
@@ -71,7 +68,7 @@ index 133108eb..d9fcf9c1 100644 |
71
|
68
|
# Before making a release, the LT_VERSION string should be modified.
|
72
|
69
|
# The string is of the form C:R:A.
|
73
|
70
|
# - If interfaces have been changed or added, but binary compatibility has
|
74
|
|
-@@ -23,7 +24,7 @@ AC_CANONICAL_HOST
|
|
71
|
+@@ -23,7 +24,7 @@
|
75
|
72
|
|
76
|
73
|
GLIB_REQUIRED=2.56.0
|
77
|
74
|
GTK_REQUIRED=3.22.0
|
... |
... |
@@ -80,7 +77,7 @@ index 133108eb..d9fcf9c1 100644 |
80
|
77
|
GIO_REQUIRED=2.25.0
|
81
|
78
|
LIBXML_REQUIRED=2.6.0
|
82
|
79
|
|
83
|
|
-@@ -65,7 +66,7 @@ dnl -- Check for libxml (required) ------------------------------------------
|
|
80
|
+@@ -65,7 +66,7 @@
|
84
|
81
|
PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED)
|
85
|
82
|
|
86
|
83
|
dnl -- check for libsoup (required) -----------------------------------------
|
... |
... |
@@ -89,7 +86,7 @@ index 133108eb..d9fcf9c1 100644 |
89
|
86
|
|
90
|
87
|
dnl -- check for gio (required) -----------------------------------------
|
91
|
88
|
PKG_CHECK_MODULES(GIO,
|
92
|
|
-@@ -100,6 +101,7 @@ AC_CHECK_FUNCS(regexec,,[AC_CHECK_LIB(regex,regexec,
|
|
89
|
+@@ -100,6 +101,7 @@
|
93
|
90
|
[AC_MSG_ERROR([No regex library found])])])
|
94
|
91
|
AC_SUBST(REGEX_LIBS)
|
95
|
92
|
|
... |
... |
@@ -97,11 +94,9 @@ index 133108eb..d9fcf9c1 100644 |
97
|
94
|
|
98
|
95
|
dnl ***************************************************************************
|
99
|
96
|
dnl *** Check for presence of tm.tm_gmtoff on the system ***
|
100
|
|
-diff --git a/libmateweather/mateweather-uninstalled.pc.in b/libmateweather/mateweather-uninstalled.pc.in
|
101
|
|
-index 03e74617..c692842a 100644
|
102
|
97
|
--- a/libmateweather/mateweather-uninstalled.pc.in
|
103
|
98
|
+++ b/libmateweather/mateweather-uninstalled.pc.in
|
104
|
|
-@@ -8,6 +8,6 @@ Name: MateWeather
|
|
99
|
+@@ -8,6 +8,6 @@
|
105
|
100
|
Description: MateWeather shared library
|
106
|
101
|
Version: @VERSION@
|
107
|
102
|
Requires: glib-2.0 gobject-2.0 gdk-pixbuf-2.0 gtk+-3.0 gio-2.0
|
... |
... |
@@ -109,11 +104,9 @@ index 03e74617..c692842a 100644 |
109
|
104
|
+Requires.private: libxml-2.0 libsoup-3.0
|
110
|
105
|
Libs: ${pc_top_builddir}/${pcfiledir}/libmateweather.la
|
111
|
106
|
Cflags: -I${pc_top_builddir}/${pcfiledir}/..
|
112
|
|
-diff --git a/libmateweather/mateweather.pc.in b/libmateweather/mateweather.pc.in
|
113
|
|
-index a617c334..bea024dd 100644
|
114
|
107
|
--- a/libmateweather/mateweather.pc.in
|
115
|
108
|
+++ b/libmateweather/mateweather.pc.in
|
116
|
|
-@@ -8,7 +8,7 @@ Name: MateWeather
|
|
109
|
+@@ -8,7 +8,7 @@
|
117
|
110
|
Description: MateWeather shared library
|
118
|
111
|
Version: @VERSION@
|
119
|
112
|
Requires: glib-2.0 gobject-2.0 gdk-pixbuf-2.0 gtk+-3.0 gio-2.0
|
... |
... |
@@ -122,8 +115,6 @@ index a617c334..bea024dd 100644 |
122
|
115
|
Libs: -L${libdir} -lmateweather
|
123
|
116
|
Libs.private: -lm
|
124
|
117
|
Cflags: -I${includedir}
|
125
|
|
-diff --git a/libmateweather/weather-bom.c b/libmateweather/weather-bom.c
|
126
|
|
-index 47b2d0b9..f5c7a87d 100644
|
127
|
118
|
--- a/libmateweather/weather-bom.c
|
128
|
119
|
+++ b/libmateweather/weather-bom.c
|
129
|
120
|
@@ -27,34 +27,45 @@
|
... |
... |
@@ -183,7 +174,7 @@ index 47b2d0b9..f5c7a87d 100644 |
183
|
174
|
}
|
184
|
175
|
|
185
|
176
|
void
|
186
|
|
-@@ -70,7 +81,8 @@ bom_start_open (WeatherInfo *info)
|
|
177
|
+@@ -70,7 +81,8 @@
|
187
|
178
|
loc->zone + 1);
|
188
|
179
|
|
189
|
180
|
msg = soup_message_new ("GET", url);
|
... |
... |
@@ -193,11 +184,9 @@ index 47b2d0b9..f5c7a87d 100644 |
193
|
184
|
g_free (url);
|
194
|
185
|
|
195
|
186
|
info->requests_pending++;
|
196
|
|
-diff --git a/libmateweather/weather-iwin.c b/libmateweather/weather-iwin.c
|
197
|
|
-index 9f7ff380..b1dc1ffa 100644
|
198
|
187
|
--- a/libmateweather/weather-iwin.c
|
199
|
188
|
+++ b/libmateweather/weather-iwin.c
|
200
|
|
-@@ -93,7 +93,7 @@ hasAttr (xmlNode *node, const char *attr_name, const char *attr_value)
|
|
189
|
+@@ -93,7 +93,7 @@
|
201
|
190
|
}
|
202
|
191
|
|
203
|
192
|
static GSList *
|
... |
... |
@@ -206,7 +195,7 @@ index 9f7ff380..b1dc1ffa 100644 |
206
|
195
|
{
|
207
|
196
|
GSList *res = NULL;
|
208
|
197
|
xmlDocPtr doc;
|
209
|
|
-@@ -107,7 +107,7 @@ parseForecastXml (const char *buff, WeatherInfo *master_info)
|
|
198
|
+@@ -107,7 +107,7 @@
|
210
|
199
|
#define XC (const xmlChar *)
|
211
|
200
|
#define isElem(_node,_name) g_str_equal ((const char *)_node->name, _name)
|
212
|
201
|
|
... |
... |
@@ -215,7 +204,7 @@ index 9f7ff380..b1dc1ffa 100644 |
215
|
204
|
if (!doc)
|
216
|
205
|
return NULL;
|
217
|
206
|
|
218
|
|
-@@ -380,26 +380,36 @@ parseForecastXml (const char *buff, WeatherInfo *master_info)
|
|
207
|
+@@ -380,26 +380,36 @@
|
219
|
208
|
}
|
220
|
209
|
|
221
|
210
|
static void
|
... |
... |
@@ -260,7 +249,7 @@ index 9f7ff380..b1dc1ffa 100644 |
260
|
249
|
}
|
261
|
250
|
|
262
|
251
|
/* Get forecast into newly alloc'ed string */
|
263
|
|
-@@ -439,7 +449,9 @@ iwin_start_open (WeatherInfo *info)
|
|
252
|
+@@ -439,7 +449,9 @@
|
264
|
253
|
|
265
|
254
|
msg = soup_message_new ("GET", url);
|
266
|
255
|
g_free (url);
|
... |
... |
@@ -271,7 +260,7 @@ index 9f7ff380..b1dc1ffa 100644 |
271
|
260
|
|
272
|
261
|
info->requests_pending++;
|
273
|
262
|
}
|
274
|
|
-@@ -470,7 +482,8 @@ iwin_start_open (WeatherInfo *info)
|
|
263
|
+@@ -470,7 +482,8 @@
|
275
|
264
|
|
276
|
265
|
msg = soup_message_new ("GET", url);
|
277
|
266
|
g_free (url);
|
... |
... |
@@ -281,11 +270,9 @@ index 9f7ff380..b1dc1ffa 100644 |
281
|
270
|
|
282
|
271
|
info->requests_pending++;
|
283
|
272
|
}
|
284
|
|
-diff --git a/libmateweather/weather-met.c b/libmateweather/weather-met.c
|
285
|
|
-index 164e9f23..7022abb2 100644
|
286
|
273
|
--- a/libmateweather/weather-met.c
|
287
|
274
|
+++ b/libmateweather/weather-met.c
|
288
|
|
-@@ -119,19 +119,20 @@ met_reprocess (char *x, int len)
|
|
275
|
+@@ -120,19 +120,20 @@
|
289
|
276
|
*/
|
290
|
277
|
|
291
|
278
|
static gchar *
|
... |
... |
@@ -309,7 +296,7 @@ index 164e9f23..7022abb2 100644 |
309
|
296
|
g_return_val_if_fail (rp != NULL, r);
|
310
|
297
|
|
311
|
298
|
p += 13;
|
312
|
|
-@@ -143,21 +144,31 @@ met_parse (const gchar *meto)
|
|
299
|
+@@ -144,21 +145,31 @@
|
313
|
300
|
}
|
314
|
301
|
|
315
|
302
|
static void
|
... |
... |
@@ -348,7 +335,7 @@ index 164e9f23..7022abb2 100644 |
348
|
335
|
}
|
349
|
336
|
|
350
|
337
|
void
|
351
|
|
-@@ -171,7 +182,8 @@ metoffice_start_open (WeatherInfo *info)
|
|
338
|
+@@ -172,7 +183,8 @@
|
352
|
339
|
url = "" ("http://www.metoffice.gov.uk/weather/europe/uk/%s.html", loc->zone + 1);
|
353
|
340
|
|
354
|
341
|
msg = soup_message_new ("GET", url);
|
... |
... |
@@ -358,11 +345,9 @@ index 164e9f23..7022abb2 100644 |
358
|
345
|
g_free (url);
|
359
|
346
|
|
360
|
347
|
info->requests_pending++;
|
361
|
|
-diff --git a/libmateweather/weather-metar.c b/libmateweather/weather-metar.c
|
362
|
|
-index 7bc24fc9..d85188b5 100644
|
363
|
348
|
--- a/libmateweather/weather-metar.c
|
364
|
349
|
+++ b/libmateweather/weather-metar.c
|
365
|
|
-@@ -486,43 +486,60 @@ metar_parse (gchar *metar, WeatherInfo *info)
|
|
350
|
+@@ -486,43 +486,60 @@
|
366
|
351
|
}
|
367
|
352
|
|
368
|
353
|
static void
|
... |
... |
@@ -436,7 +421,7 @@ index 7bc24fc9..d85188b5 100644 |
436
|
421
|
/* The response doesn't even seem to have come from NOAA...
|
437
|
422
|
* most likely it is a wifi hotspot login page. Call that a
|
438
|
423
|
* network error.
|
439
|
|
-@@ -531,7 +548,8 @@ metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
|
|
424
|
+@@ -531,7 +548,8 @@
|
440
|
425
|
}
|
441
|
426
|
|
442
|
427
|
info->valid = success;
|
... |
... |
@@ -446,7 +431,7 @@ index 7bc24fc9..d85188b5 100644 |
446
|
431
|
}
|
447
|
432
|
|
448
|
433
|
/* Read current conditions and fill in info structure */
|
449
|
|
-@@ -540,6 +558,7 @@ metar_start_open (WeatherInfo *info)
|
|
434
|
+@@ -540,6 +558,7 @@
|
450
|
435
|
{
|
451
|
436
|
WeatherLocation *loc;
|
452
|
437
|
SoupMessage *msg;
|
... |
... |
@@ -454,7 +439,7 @@ index 7bc24fc9..d85188b5 100644 |
454
|
439
|
|
455
|
440
|
g_return_if_fail (info != NULL);
|
456
|
441
|
info->valid = info->network_error = FALSE;
|
457
|
|
-@@ -549,8 +568,7 @@ metar_start_open (WeatherInfo *info)
|
|
442
|
+@@ -549,8 +568,7 @@
|
458
|
443
|
return;
|
459
|
444
|
}
|
460
|
445
|
|
... |
... |
@@ -464,7 +449,7 @@ index 7bc24fc9..d85188b5 100644 |
464
|
449
|
"dataSource", "metars",
|
465
|
450
|
"requestType", "retrieve",
|
466
|
451
|
"format", "xml",
|
467
|
|
-@@ -559,7 +577,12 @@ metar_start_open (WeatherInfo *info)
|
|
452
|
+@@ -559,7 +577,11 @@
|
468
|
453
|
"fields", "raw_text",
|
469
|
454
|
"stationString", loc->code,
|
470
|
455
|
NULL);
|
... |
... |
@@ -472,14 +457,11 @@ index 7bc24fc9..d85188b5 100644 |
472
|
457
|
+ msg = soup_message_new_from_encoded_form (
|
473
|
458
|
+ "GET", "https://aviationweather.gov/cgi-bin/data/dataserver.php",
|
474
|
459
|
+ query);
|
475
|
|
-+ g_free(query);
|
476
|
460
|
+ soup_session_send_and_read_async (info->session, msg, G_PRIORITY_DEFAULT,
|
477
|
461
|
+ NULL, metar_finish, info);
|
478
|
462
|
|
479
|
463
|
info->requests_pending++;
|
480
|
464
|
}
|
481
|
|
-diff --git a/libmateweather/weather-priv.h b/libmateweather/weather-priv.h
|
482
|
|
-index 817f13c5..03cdcbd9 100644
|
483
|
465
|
--- a/libmateweather/weather-priv.h
|
484
|
466
|
+++ b/libmateweather/weather-priv.h
|
485
|
467
|
@@ -21,6 +21,7 @@
|
... |
... |
@@ -490,7 +472,7 @@ index 817f13c5..03cdcbd9 100644 |
490
|
472
|
#include <time.h>
|
491
|
473
|
#include <libintl.h>
|
492
|
474
|
#include <math.h>
|
493
|
|
-@@ -34,6 +35,8 @@ const char *mateweather_dpgettext (const char *context, const char *str) G_GNUC_
|
|
475
|
+@@ -34,6 +35,8 @@
|
494
|
476
|
#define _(str) (mateweather_gettext (str))
|
495
|
477
|
#define C_(context, str) (mateweather_dpgettext (context, str))
|
496
|
478
|
#define N_(str) (str)
|
... |
... |
@@ -499,7 +481,7 @@ index 817f13c5..03cdcbd9 100644 |
499
|
481
|
|
500
|
482
|
|
501
|
483
|
#define WEATHER_LOCATION_CODE_LEN 4
|
502
|
|
-@@ -95,7 +98,6 @@ struct _WeatherInfo {
|
|
484
|
+@@ -96,7 +99,6 @@
|
503
|
485
|
GSList *forecast_list; /* list of WeatherInfo* for the forecast, NULL if not available */
|
504
|
486
|
gchar *radar_buffer;
|
505
|
487
|
gchar *radar_url;
|
... |
... |
@@ -507,7 +489,7 @@ index 817f13c5..03cdcbd9 100644 |
507
|
489
|
GdkPixbufAnimation *radar;
|
508
|
490
|
SoupSession *session;
|
509
|
491
|
gint requests_pending;
|
510
|
|
-@@ -167,7 +169,7 @@ gboolean metar_parse (gchar *metar,
|
|
492
|
+@@ -168,7 +170,7 @@
|
511
|
493
|
|
512
|
494
|
gboolean requests_init (WeatherInfo *info);
|
513
|
495
|
void request_done (WeatherInfo *info,
|
... |
... |
@@ -516,8 +498,6 @@ index 817f13c5..03cdcbd9 100644 |
516
|
498
|
|
517
|
499
|
void ecl2equ (gdouble t,
|
518
|
500
|
gdouble eclipLon,
|
519
|
|
-diff --git a/libmateweather/weather-wx.c b/libmateweather/weather-wx.c
|
520
|
|
-index e29ceccd..11f73368 100644
|
521
|
501
|
--- a/libmateweather/weather-wx.c
|
522
|
502
|
+++ b/libmateweather/weather-wx.c
|
523
|
503
|
@@ -25,48 +25,51 @@
|
... |
... |
@@ -594,7 +574,7 @@ index e29ceccd..11f73368 100644 |
594
|
574
|
}
|
595
|
575
|
|
596
|
576
|
/* Get radar map and into newly allocated pixmap */
|
597
|
|
-@@ -79,7 +82,6 @@ wx_start_open (WeatherInfo *info)
|
|
577
|
+@@ -79,7 +82,6 @@
|
598
|
578
|
|
599
|
579
|
g_return_if_fail (info != NULL);
|
600
|
580
|
info->radar = NULL;
|
... |
... |
@@ -602,7 +582,7 @@ index e29ceccd..11f73368 100644 |
602
|
582
|
loc = info->location;
|
603
|
583
|
g_return_if_fail (loc != NULL);
|
604
|
584
|
|
605
|
|
-@@ -98,9 +100,8 @@ wx_start_open (WeatherInfo *info)
|
|
585
|
+@@ -98,9 +100,8 @@
|
606
|
586
|
return;
|
607
|
587
|
}
|
608
|
588
|
|
... |
... |
@@ -614,11 +594,9 @@ index e29ceccd..11f73368 100644 |
614
|
594
|
g_free (url);
|
615
|
595
|
|
616
|
596
|
info->requests_pending++;
|
617
|
|
-diff --git a/libmateweather/weather.c b/libmateweather/weather.c
|
618
|
|
-index 86453fc5..1d7533a6 100644
|
619
|
597
|
--- a/libmateweather/weather.c
|
620
|
598
|
+++ b/libmateweather/weather.c
|
621
|
|
-@@ -348,12 +348,13 @@ requests_init (WeatherInfo *info)
|
|
599
|
+@@ -351,12 +351,13 @@
|
622
|
600
|
return TRUE;
|
623
|
601
|
}
|
624
|
602
|
|