[gnome-panel] clock: remove SystemTimezone



commit f0e21c66a45b2be644e01243aa17e9ae7af55ffb
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Mar 8 00:26:18 2020 +0200

    clock: remove SystemTimezone
    
    Use GTimeZone from GnomeWallClock.

 configure.ac                    |   6 -
 modules/clock/Makefile.am       |   3 +-
 modules/clock/clock-applet.c    |  15 +-
 modules/clock/clock-location.c  |  31 +-
 modules/clock/clock-location.h  |  14 +-
 modules/clock/system-timezone.c | 667 ----------------------------------------
 modules/clock/system-timezone.h |  57 ----
 7 files changed, 35 insertions(+), 758 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e13cb20bb..27781d691 100644
--- a/configure.ac
+++ b/configure.ac
@@ -251,12 +251,6 @@ dnl yelp-tools stuff
 
 YELP_HELP_INIT
 
-dnl **************************************************************************
-dnl Find zoneinfo directory
-dnl **************************************************************************
-
-AX_ZONEINFO
-
 dnl **************************************************************************
 dnl Process .in files
 dnl **************************************************************************
diff --git a/modules/clock/Makefile.am b/modules/clock/Makefile.am
index 46d3dea1f..b4bc70750 100644
--- a/modules/clock/Makefile.am
+++ b/modules/clock/Makefile.am
@@ -35,8 +35,6 @@ clock_la_SOURCES = \
        clock-utils.h \
        set-timezone.c \
        set-timezone.h \
-       system-timezone.c \
-       system-timezone.h \
        $(BUILT_SOURCES) \
        $(CALENDAR_SOURCES) \
        $(NULL)
@@ -45,6 +43,7 @@ clock_la_CPPFLAGS = \
        -DLOCALEDIR=\""$(localedir)"\" \
        -DCLOCK_EDS_ICONDIR="\"$(CLOCK_EDS_ICONDIR)\"" \
        -DEDS_DISABLE_DEPRECATED \
+       -DGNOME_DESKTOP_USE_UNSTABLE_API \
        -DGWEATHER_I_KNOW_THIS_IS_UNSTABLE \
        -I$(top_srcdir) \
        $(AM_CPPFLAGS) \
diff --git a/modules/clock/clock-applet.c b/modules/clock/clock-applet.c
index 6689b36cb..0ef21b062 100644
--- a/modules/clock/clock-applet.c
+++ b/modules/clock/clock-applet.c
@@ -47,7 +47,6 @@
 #include <gdk/gdkkeysyms.h>
 #include <gdk/gdkx.h>
 
-#define GNOME_DESKTOP_USE_UNSTABLE_API
 #include <libgnome-desktop/gnome-wall-clock.h>
 
 #include <libgnome-panel/gp-utils.h>
@@ -803,7 +802,6 @@ create_clock_widget (ClockApplet *cd)
 
         orientation = gp_applet_get_orientation (GP_APPLET (cd));
 
-        cd->wall_clock = g_object_new (GNOME_TYPE_WALL_CLOCK, NULL);
         g_signal_connect (cd->wall_clock, "notify::clock",
                           G_CALLBACK (update_clock), cd);
 
@@ -1133,7 +1131,8 @@ load_cities (ClockApplet *cd)
                                     &latitude, &longitude)) {
                 ClockLocation *loc;
 
-                loc = clock_location_new (cd->world,
+                loc = clock_location_new (cd->wall_clock,
+                                          cd->world,
                                           name, code,
                                           latlon_override, latitude, longitude);
 
@@ -1162,6 +1161,8 @@ fill_clock_applet (ClockApplet *cd)
         g_signal_connect (cd->applet_settings, "changed::cities",
                           G_CALLBACK (locations_changed), cd);
 
+        cd->wall_clock = g_object_new (GNOME_TYPE_WALL_CLOCK, NULL);
+
         cd->world = gweather_location_get_world ();
         load_cities (cd);
         locations_changed (NULL, NULL, cd);
@@ -1342,7 +1343,13 @@ run_prefs_edit_save (GtkButton   *button,
                 lon = -lon;
         }
 
-        loc = clock_location_new (cd->world, name, weather_code, TRUE, lat, lon);
+        loc = clock_location_new (cd->wall_clock,
+                                  cd->world,
+                                  name,
+                                  weather_code,
+                                  TRUE,
+                                  lat,
+                                  lon);
         /* has the side-effect of setting the current location if
          * there's none and this one can be considered as a current one
          */
diff --git a/modules/clock/clock-location.c b/modules/clock/clock-location.c
index 457ca96b1..ed71f5375 100644
--- a/modules/clock/clock-location.c
+++ b/modules/clock/clock-location.c
@@ -18,16 +18,15 @@
 
 #include "clock-location.h"
 #include "set-timezone.h"
-#include "system-timezone.h"
 
 struct _ClockLocationPrivate {
         gchar *name;
 
+       GnomeWallClock   *wall_clock;
+
        GWeatherLocation *world;
        GWeatherLocation *loc;
 
-        SystemTimezone *systz;
-
         gdouble latitude;
         gdouble longitude;
 
@@ -55,12 +54,13 @@ static gboolean update_weather_info (gpointer user_data);
 static void setup_weather_updates (ClockLocation *loc);
 
 ClockLocation *
-clock_location_new (GWeatherLocation *world,
-                   const char       *name,
-                   const char       *metar_code,
-                   gboolean          override_latlon,
-                   gdouble           latitude,
-                   gdouble           longitude)
+clock_location_new (GnomeWallClock   *wall_clock,
+                    GWeatherLocation *world,
+                    const char       *name,
+                    const char       *metar_code,
+                    gboolean          override_latlon,
+                    gdouble           latitude,
+                    gdouble           longitude)
 {
         ClockLocation *this;
         ClockLocationPrivate *priv;
@@ -68,6 +68,7 @@ clock_location_new (GWeatherLocation *world,
         this = g_object_new (CLOCK_LOCATION_TYPE, NULL);
         priv = this->priv;
 
+       priv->wall_clock = g_object_ref (wall_clock);
        priv->world = gweather_location_ref (world);
        priv->loc = gweather_location_find_by_station_code (priv->world,
                                                            metar_code);
@@ -136,7 +137,6 @@ clock_location_init (ClockLocation *this)
         GNetworkMonitor *monitor;
 
         priv = this->priv = clock_location_get_instance_private (this);
-        priv->systz = system_timezone_new ();
 
         priv->latitude = 0;
         priv->longitude = 0;
@@ -163,17 +163,14 @@ clock_location_finalize (GObject *g_obj)
 
        g_free (priv->name);
 
+       g_object_unref (priv->wall_clock);
+
        gweather_location_unref (priv->world);
        gweather_location_unref (priv->loc);
 
        if (priv->weather_timeout)
                g_source_remove (priv->weather_timeout);
 
-        if (priv->systz) {
-                g_object_unref (priv->systz);
-                priv->systz = NULL;
-        }
-
         if (priv->weather_info) {
                 g_object_unref (priv->weather_info);
                 priv->weather_info = NULL;
@@ -284,11 +281,13 @@ gboolean
 clock_location_is_current_timezone (ClockLocation *loc)
 {
        GWeatherTimezone *wtz;
+       GTimeZone *timezone;
        const char *zone;
 
        wtz = clock_location_get_gweather_timezone (loc);
 
-       zone = system_timezone_get (loc->priv->systz);
+       timezone = gnome_wall_clock_get_timezone (loc->priv->wall_clock);
+       zone = g_time_zone_get_identifier (timezone);
 
        if (zone)
                return strcmp (zone, gweather_timezone_get_tzid (wtz)) == 0;
diff --git a/modules/clock/clock-location.h b/modules/clock/clock-location.h
index 2f2ea1725..cb614835d 100644
--- a/modules/clock/clock-location.h
+++ b/modules/clock/clock-location.h
@@ -5,6 +5,7 @@
 #include <glib.h>
 #include <glib-object.h>
 #include <libgweather/gweather.h>
+#include <libgnome-desktop/gnome-wall-clock.h>
 
 G_BEGIN_DECLS
 
@@ -35,12 +36,13 @@ typedef struct
 
 GType clock_location_get_type (void);
 
-ClockLocation *clock_location_new (GWeatherLocation *world,
-                                  const gchar *name,
-                                  const gchar *metar_code,
-                                  gboolean override_latlon,
-                                  gdouble  latitude,
-                                  gdouble  longitude);
+ClockLocation *clock_location_new (GnomeWallClock   *wall_clock,
+                                   GWeatherLocation *world,
+                                   const gchar      *name,
+                                   const gchar      *metar_code,
+                                   gboolean          override_latlon,
+                                   gdouble           latitude,
+                                   gdouble           longitude);
 
 const gchar *clock_location_get_tzname (ClockLocation *loc);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]