summaryrefslogtreecommitdiff
path: root/applets/clock
diff options
context:
space:
mode:
Diffstat (limited to 'applets/clock')
-rw-r--r--applets/clock/calendar-window.c8
-rw-r--r--applets/clock/clock-face.c17
-rw-r--r--applets/clock/clock-location-tile.c14
-rw-r--r--applets/clock/clock-location.c15
-rw-r--r--applets/clock/clock-map.c27
-rw-r--r--applets/clock/system-timezone.c8
6 files changed, 23 insertions, 66 deletions
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index 8fe2c77c..11003d28 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -617,17 +617,15 @@ calendar_window_set_prefs_path (CalendarWindow *calwin,
!strcmp (calwin->priv->prefs_path, prefs_path))
return;
- if (calwin->priv->prefs_path)
- g_free (calwin->priv->prefs_path);
- calwin->priv->prefs_path = NULL;
-
+ g_free (calwin->priv->prefs_path);
if (prefs_path && prefs_path [0])
calwin->priv->prefs_path = g_strdup (prefs_path);
+ else
+ calwin->priv->prefs_path = NULL;
g_object_notify (G_OBJECT (calwin), "prefs-path");
if (calwin->priv->settings)
g_object_unref (calwin->priv->settings);
-
calwin->priv->settings = g_settings_new_with_path (CLOCK_SCHEMA, calwin->priv->prefs_path);
}
diff --git a/applets/clock/clock-face.c b/applets/clock/clock-face.c
index a30afd13..7340c8a8 100644
--- a/applets/clock/clock-face.c
+++ b/applets/clock/clock-face.c
@@ -369,20 +369,9 @@ clock_face_finalize (GObject *obj)
{
ClockFacePrivate *priv = clock_face_get_instance_private (CLOCK_FACE(obj));
- if (priv->location) {
- g_object_unref (priv->location);
- priv->location = NULL;
- }
-
- if (priv->face_pixbuf) {
- g_object_unref (priv->face_pixbuf);
- priv->face_pixbuf = NULL;
- }
-
- if (priv->size_widget) {
- g_object_unref (priv->size_widget);
- priv->size_widget = NULL;
- }
+ g_clear_object (&priv->location);
+ g_clear_object (&priv->face_pixbuf);
+ g_clear_object (&priv->size_widget);
G_OBJECT_CLASS (clock_face_parent_class)->finalize (obj);
diff --git a/applets/clock/clock-location-tile.c b/applets/clock/clock-location-tile.c
index 55bc749a..b70f467c 100644
--- a/applets/clock/clock-location-tile.c
+++ b/applets/clock/clock-location-tile.c
@@ -143,19 +143,11 @@ clock_location_tile_finalize (GObject *g_obj)
g_signal_handler_disconnect (priv->location, priv->location_weather_updated_id);
priv->location_weather_updated_id = 0;
- g_object_unref (priv->location);
- priv->location = NULL;
+ g_clear_object (&priv->location);
}
- if (priv->button_group) {
- g_object_unref (priv->button_group);
- priv->button_group = NULL;
- }
-
- if (priv->current_group) {
- g_object_unref (priv->current_group);
- priv->current_group = NULL;
- }
+ g_clear_object (&priv->button_group);
+ g_clear_object (&priv->current_group);
G_OBJECT_CLASS (clock_location_tile_parent_class)->finalize (g_obj);
}
diff --git a/applets/clock/clock-location.c b/applets/clock/clock-location.c
index 67af64b1..637d834d 100644
--- a/applets/clock/clock-location.c
+++ b/applets/clock/clock-location.c
@@ -210,17 +210,14 @@ clock_location_finalize (GObject *g_obj)
G_CALLBACK (network_changed),
CLOCK_LOCATION (g_obj));
- g_free (priv->name);
- g_free (priv->city);
+ g_clear_pointer (&priv->name, g_free);
+ g_clear_pointer (&priv->city, g_free);
- if (priv->systz) {
- g_object_unref (priv->systz);
- priv->systz = NULL;
- }
+ g_clear_object (&priv->systz);
- g_free (priv->timezone);
- g_free (priv->tzname);
- g_free (priv->weather_code);
+ g_clear_pointer (&priv->timezone, g_free);
+ g_clear_pointer (&priv->tzname, g_free);
+ g_clear_pointer (&priv->weather_code, g_free);
if (priv->weather_info) {
weather_info_free (priv->weather_info);
diff --git a/applets/clock/clock-map.c b/applets/clock/clock-map.c
index fc096c60..97441c62 100644
--- a/applets/clock/clock-map.c
+++ b/applets/clock/clock-map.c
@@ -150,32 +150,15 @@ clock_map_finalize (GObject *g_obj)
priv->highlight_timeout_id = 0;
}
- if (priv->stock_map_pixbuf) {
- g_object_unref (priv->stock_map_pixbuf);
- priv->stock_map_pixbuf = NULL;
- }
+ g_clear_object (&priv->stock_map_pixbuf);
for (i = 0; i < MARKER_NB; i++) {
- if (priv->location_marker_pixbuf[i]) {
- g_object_unref (priv->location_marker_pixbuf[i]);
- priv->location_marker_pixbuf[i] = NULL;
- }
+ g_clear_object (&priv->location_marker_pixbuf[i]);
}
- if (priv->location_map_pixbuf) {
- g_object_unref (priv->location_map_pixbuf);
- priv->location_map_pixbuf = NULL;
- }
-
- if (priv->shadow_pixbuf) {
- g_object_unref (priv->shadow_pixbuf);
- priv->shadow_pixbuf = NULL;
- }
-
- if (priv->shadow_map_pixbuf) {
- g_object_unref (priv->shadow_map_pixbuf);
- priv->shadow_map_pixbuf = NULL;
- }
+ g_clear_object (&priv->location_map_pixbuf);
+ g_clear_object (&priv->shadow_pixbuf);
+ g_clear_object (&priv->shadow_map_pixbuf);
G_OBJECT_CLASS (clock_map_parent_class)->finalize (g_obj);
}
diff --git a/applets/clock/system-timezone.c b/applets/clock/system-timezone.c
index 801f3386..b7b3d64b 100644
--- a/applets/clock/system-timezone.c
+++ b/applets/clock/system-timezone.c
@@ -234,13 +234,11 @@ system_timezone_finalize (GObject *obj)
systz = SYSTEM_TIMEZONE (obj);
priv = system_timezone_get_instance_private (systz);
- g_free (priv->tz);
- g_free (priv->env_tz);
+ g_clear_pointer (&priv->tz, g_free);
+ g_clear_pointer (&priv->env_tz, g_free);
for (i = 0; i < CHECK_NB; i++) {
- if (priv->monitors[i])
- g_object_unref (priv->monitors[i]);
- priv->monitors[i] = NULL;
+ g_clear_object (&priv->monitors[i]);
}
G_OBJECT_CLASS (system_timezone_parent_class)->finalize (obj);