aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-datetime.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-03-01 21:01:49 -0600
committerCharles Kerr <charles.kerr@canonical.com>2012-03-01 21:01:49 -0600
commit4586df056f8a637c9a33d1d6a70ca0480b2c9e0c (patch)
tree753f96488581629bafd69c058b4dec519d0c032f /src/indicator-datetime.c
parentcf8ba28a080998c29e415abeda4277452539cc49 (diff)
downloadayatana-indicator-datetime-4586df056f8a637c9a33d1d6a70ca0480b2c9e0c.tar.gz
ayatana-indicator-datetime-4586df056f8a637c9a33d1d6a70ca0480b2c9e0c.tar.bz2
ayatana-indicator-datetime-4586df056f8a637c9a33d1d6a70ca0480b2c9e0c.zip
tweak: use g_clear_object() in dispose()
Diffstat (limited to 'src/indicator-datetime.c')
-rw-r--r--src/indicator-datetime.c52
1 files changed, 14 insertions, 38 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index c847d47..08d7383 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -405,10 +405,7 @@ service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data)
GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error);
- if (priv->service_proxy_cancel != NULL) {
- g_object_unref(priv->service_proxy_cancel);
- priv->service_proxy_cancel = NULL;
- }
+ g_clear_object (&priv->service_proxy_cancel);
if (error != NULL) {
g_warning("Could not grab DBus proxy for %s: %s", SERVICE_NAME, error->message);
@@ -429,46 +426,25 @@ static void
indicator_datetime_dispose (GObject *object)
{
IndicatorDatetime * self = INDICATOR_DATETIME(object);
+ IndicatorDatetimePrivate * priv = self->priv;
- if (self->priv->label != NULL) {
- g_object_unref(self->priv->label);
- self->priv->label = NULL;
- }
-
- if (self->priv->timer != 0) {
- g_source_remove(self->priv->timer);
- self->priv->timer = 0;
- }
-
- if (self->priv->idle_measure != 0) {
- g_source_remove(self->priv->idle_measure);
- self->priv->idle_measure = 0;
- }
-
- if (self->priv->menu != NULL) {
- g_object_unref(G_OBJECT(self->priv->menu));
- self->priv->menu = NULL;
- }
-
- if (self->priv->sm != NULL) {
- g_object_unref(G_OBJECT(self->priv->sm));
- self->priv->sm = NULL;
+ if (priv->timer != 0) {
+ g_source_remove(priv->timer);
+ priv->timer = 0;
}
- if (self->priv->settings != NULL) {
- g_object_unref(G_OBJECT(self->priv->settings));
- self->priv->settings = NULL;
+ if (priv->idle_measure != 0) {
+ g_source_remove(priv->idle_measure);
+ priv->idle_measure = 0;
}
- if (self->priv->service_proxy != NULL) {
- g_object_unref(self->priv->service_proxy);
- self->priv->service_proxy = NULL;
- }
+ g_clear_object (&priv->label);
+ g_clear_object (&priv->menu);
+ g_clear_object (&priv->sm);
+ g_clear_object (&priv->settings);
+ g_clear_object (&priv->service_proxy);
+ g_clear_object (&priv->indicator_right_group);
- if (self->priv->indicator_right_group != NULL) {
- g_object_unref(G_OBJECT(self->priv->indicator_right_group));
- self->priv->indicator_right_group = NULL;
- }
G_OBJECT_CLASS (indicator_datetime_parent_class)->dispose (object);
return;