[gnome-panel/wip/applets/clock: 17/18] clock: update clock_location_new
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/wip/applets/clock: 17/18] clock: update clock_location_new
- Date: Fri, 14 Nov 2014 16:41:34 +0000 (UTC)
commit 91a5976c8a19254ea056076f70c19316561134f2
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Mon Nov 10 06:08:13 2014 +0200
clock: update clock_location_new
applets/clock/clock-location.c | 24 +++++++++++++-----------
applets/clock/clock-location.h | 3 +--
applets/clock/clock.c | 5 ++---
3 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/applets/clock/clock-location.c b/applets/clock/clock-location.c
index e6d1fb9..7c753c0 100644
--- a/applets/clock/clock-location.c
+++ b/applets/clock/clock-location.c
@@ -58,7 +58,6 @@ struct _ClockLocationPrivate
{
gchar *name;
- GWeatherLocation *world;
GWeatherLocation *loc;
SystemTimezone *systz;
@@ -119,22 +118,26 @@ g_desktop_clock_format_get_type (void)
}
ClockLocation *
-clock_location_new (GWeatherLocation *world,
- const char *name,
- const char *metar_code,
- gboolean override_latlon,
- gdouble latitude,
- gdouble longitude)
+clock_location_new (const gchar *name,
+ const gchar *metar_code,
+ gboolean override_latlon,
+ gdouble latitude,
+ gdouble longitude)
{
+ GWeatherLocation *world;
ClockLocation *this;
ClockLocationPrivate *priv;
+ world = gweather_location_get_world ();
+
+ if (!world)
+ return NULL;
+
this = g_object_new (CLOCK_TYPE_LOCATION, NULL);
priv = this->priv;
- priv->world = gweather_location_ref (world);
- priv->loc = gweather_location_find_by_station_code (priv->world,
- metar_code);
+ priv->loc = gweather_location_find_by_station_code (world,
+ metar_code);
if (name && *name) {
priv->name = g_strdup (name);
@@ -301,7 +304,6 @@ clock_location_finalize (GObject *g_obj)
g_free (priv->name);
- gweather_location_unref (priv->world);
gweather_location_unref (priv->loc);
if (priv->weather_timeout)
diff --git a/applets/clock/clock-location.h b/applets/clock/clock-location.h
index ac42edf..2f54b9c 100644
--- a/applets/clock/clock-location.h
+++ b/applets/clock/clock-location.h
@@ -72,8 +72,7 @@ struct _ClockLocationClass
GType clock_location_get_type (void);
-ClockLocation *clock_location_new (GWeatherLocation *world,
- const gchar *name,
+ClockLocation *clock_location_new (const gchar *name,
const gchar *metar_code,
gboolean override_latlon,
gdouble latitude,
diff --git a/applets/clock/clock.c b/applets/clock/clock.c
index e720512..6d2f4c3 100644
--- a/applets/clock/clock.c
+++ b/applets/clock/clock.c
@@ -1261,8 +1261,7 @@ load_cities (ClockData *cd)
&latitude, &longitude)) {
ClockLocation *loc;
- loc = clock_location_new (cd->world,
- name, code,
+ loc = clock_location_new (name, code,
latlon_override, latitude, longitude);
g_settings_bind (cd->clock_settings, "clock-format",
@@ -1503,7 +1502,7 @@ run_prefs_edit_save (GtkButton *button, ClockData *cd)
lon = -lon;
}
- loc = clock_location_new (cd->world, name, weather_code, TRUE, lat, lon);
+ loc = clock_location_new (name, weather_code, TRUE, lat, lon);
g_settings_bind (cd->clock_settings, "clock-format",
loc, "clock-format",
G_SETTINGS_BIND_GET);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]