[gnome-initial-setup/wjt/gweather-4: 3/6] timezone: Build against gweather-4.0
- From: Will Thompson <wjt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-initial-setup/wjt/gweather-4: 3/6] timezone: Build against gweather-4.0
- Date: Tue, 4 Jan 2022 15:43:46 +0000 (UTC)
commit 371d84d7ecde0add8e9cb03c55de47d0d7983456
Author: Will Thompson <will willthompson co uk>
Date: Tue Jan 4 12:52:44 2022 +0000
timezone: Build against gweather-4.0
GWeather 4.0 removes GWeatherLocationEntry and, as a result, its
dependency on any version of GTK.
For now we just replace this widget with a plain GtkEntry. A subsequent
commit will re-introduce an imported & adjusted copy of GWeatherLocationEntry.
https://gitlab.gnome.org/GNOME/gnome-initial-setup/-/issues/132
.gitlab-ci.yml | 4 ++++
gnome-initial-setup/meson.build | 2 +-
.../pages/timezone/gis-timezone-page.c | 23 +++++++++++-----------
.../pages/timezone/gis-timezone-page.ui | 2 +-
subprojects/libgweather.wrap | 3 +++
5 files changed, 21 insertions(+), 13 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 932295cd..28edc05f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,6 +17,10 @@ stages:
-Dgnome-desktop:gtk_doc=false
-Dgnome-desktop:desktop_docs=false
-Dgnome-desktop:legacy_library=false
+ -Dlibgweather:enable_vala=false
+ -Dlibgweather:gtk_doc=false
+ -Dlibgweather:introspection=false
+ -Dlibgweather:tests=false
${EXTRA_PARAMETERS}
_build .
- cd _build
diff --git a/gnome-initial-setup/meson.build b/gnome-initial-setup/meson.build
index 35c1668d..f171e7db 100644
--- a/gnome-initial-setup/meson.build
+++ b/gnome-initial-setup/meson.build
@@ -35,7 +35,7 @@ dependencies = [
dependency ('gnome-desktop-4', fallback: ['gnome-desktop', 'libgnome_desktop_base_dep']),
dependency ('gsettings-desktop-schemas', version: '>= 3.37.1'),
dependency ('fontconfig'),
- dependency ('gweather-3.0'),
+ dependency ('gweather-4.0', fallback: ['libgweather', 'libgweather_dep']),
dependency ('goa-1.0'),
dependency ('goa-backend-1.0'),
dependency ('gtk+-3.0', version: '>= 3.11.3'),
diff --git a/gnome-initial-setup/pages/timezone/gis-timezone-page.c
b/gnome-initial-setup/pages/timezone/gis-timezone-page.c
index 573b876b..e0a6d3df 100644
--- a/gnome-initial-setup/pages/timezone/gis-timezone-page.c
+++ b/gnome-initial-setup/pages/timezone/gis-timezone-page.c
@@ -39,7 +39,6 @@
#include <geoclue.h>
#include <geocode-glib/geocode-glib.h>
-#define GWEATHER_I_KNOW_THIS_IS_UNSTABLE
#include <libgweather/gweather.h>
#include "timedated.h"
@@ -126,20 +125,20 @@ set_location (GisTimezonePage *page,
{
GisTimezonePagePrivate *priv = gis_timezone_page_get_instance_private (page);
- g_clear_pointer (&priv->current_location, gweather_location_unref);
+ g_clear_object (&priv->current_location);
gtk_widget_set_visible (priv->search_overlay, (location == NULL));
gis_page_set_complete (GIS_PAGE (page), (location != NULL));
if (location)
{
- GWeatherTimezone *zone;
+ GTimeZone *zone;
const char *tzid;
- priv->current_location = gweather_location_ref (location);
+ priv->current_location = g_object_ref (location);
zone = gweather_location_get_timezone (location);
- tzid = gweather_timezone_get_tzid (zone);
+ tzid = g_time_zone_get_identifier (zone);
cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (priv->map), tzid);
@@ -158,18 +157,18 @@ on_location_notify (GClueSimple *simple,
GisTimezonePagePrivate *priv = gis_timezone_page_get_instance_private (page);
GClueLocation *location;
gdouble latitude, longitude;
- GWeatherLocation *glocation = NULL;
+ g_autoptr(GWeatherLocation) world = gweather_location_get_world ();
+ g_autoptr(GWeatherLocation) glocation = NULL;
location = gclue_simple_get_location (simple);
latitude = gclue_location_get_latitude (location);
longitude = gclue_location_get_longitude (location);
- glocation = gweather_location_find_nearest_city (NULL, latitude, longitude);
+ glocation = gweather_location_find_nearest_city (world, latitude, longitude);
priv->in_geoclue_callback = TRUE;
set_location (page, glocation);
priv->in_geoclue_callback = FALSE;
- gweather_location_unref (glocation);
}
static void
@@ -229,12 +228,13 @@ entry_text_changed (GtkEditable *editable,
priv->search_entry_text_changed_id = 0;
}
+#if 0
static void
entry_location_changed (GObject *object, GParamSpec *param, GisTimezonePage *page)
{
GisTimezonePagePrivate *priv = gis_timezone_page_get_instance_private (page);
GWeatherLocationEntry *entry = GWEATHER_LOCATION_ENTRY (object);
- GWeatherLocation *location;
+ g_autoptr(GWeatherLocation) location = NULL;
location = gweather_location_entry_get_location (entry);
if (!location)
@@ -243,9 +243,8 @@ entry_location_changed (GObject *object, GParamSpec *param, GisTimezonePage *pag
priv->in_search = TRUE;
set_location (page, location);
priv->in_search = FALSE;
-
- gweather_location_unref (location);
}
+#endif
#define GETTEXT_PACKAGE_TIMEZONES "gnome-control-center-2.0-timezones"
@@ -447,8 +446,10 @@ gis_timezone_page_constructed (GObject *object)
priv->search_entry_text_changed_id =
g_signal_connect (priv->search_entry, "changed",
G_CALLBACK (entry_text_changed), page);
+#if 0
g_signal_connect (priv->search_entry, "notify::location",
G_CALLBACK (entry_location_changed), page);
+#endif
g_signal_connect (priv->search_entry, "map",
G_CALLBACK (entry_mapped), page);
g_signal_connect (priv->map, "location-changed",
diff --git a/gnome-initial-setup/pages/timezone/gis-timezone-page.ui
b/gnome-initial-setup/pages/timezone/gis-timezone-page.ui
index 07fc3520..1f81d3ed 100644
--- a/gnome-initial-setup/pages/timezone/gis-timezone-page.ui
+++ b/gnome-initial-setup/pages/timezone/gis-timezone-page.ui
@@ -28,7 +28,7 @@
<property name="orientation">vertical</property>
<property name="spacing">14</property>
<child>
- <object class="GWeatherLocationEntry" id="search_entry">
+ <object class="GtkEntry" id="search_entry">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="max-width-chars">55</property>
diff --git a/subprojects/libgweather.wrap b/subprojects/libgweather.wrap
new file mode 100644
index 00000000..6d36c28e
--- /dev/null
+++ b/subprojects/libgweather.wrap
@@ -0,0 +1,3 @@
+[wrap-git]
+url = https://gitlab.gnome.org/GNOME/libgweather.git
+revision = main
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]