aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/datetime-interface.c13
-rw-r--r--src/datetime-prefs.c49
2 files changed, 24 insertions, 38 deletions
diff --git a/src/datetime-interface.c b/src/datetime-interface.c
index 5939061..e67be85 100644
--- a/src/datetime-interface.c
+++ b/src/datetime-interface.c
@@ -124,10 +124,7 @@ bus_get_cb (GObject * object, GAsyncResult * res, gpointer user_data)
g_warn_if_fail(priv->bus == NULL);
priv->bus = connection;
- if (priv->bus_cancel != NULL) {
- g_object_unref(priv->bus_cancel);
- priv->bus_cancel = NULL;
- }
+ g_clear_object (&priv->bus_cancel);
/* Now register our object on our new connection */
priv->dbus_registration = g_dbus_connection_register_object(priv->bus,
@@ -158,15 +155,11 @@ datetime_interface_dispose (GObject *object)
priv->dbus_registration = 0;
}
- if (priv->bus != NULL) {
- g_object_unref(priv->bus);
- priv->bus = NULL;
- }
+ g_clear_object (&priv->bus);
if (priv->bus_cancel != NULL) {
g_cancellable_cancel(priv->bus_cancel);
- g_object_unref(priv->bus_cancel);
- priv->bus_cancel = NULL;
+ g_clear_object (&priv->bus_cancel);
}
G_OBJECT_CLASS (datetime_interface_parent_class)->dispose (object);
diff --git a/src/datetime-prefs.c b/src/datetime-prefs.c
index 9fdfbed..50445ff 100644
--- a/src/datetime-prefs.c
+++ b/src/datetime-prefs.c
@@ -776,46 +776,39 @@ static void
indicator_datetime_panel_dispose (GObject * object)
{
IndicatorDatetimePanel * self = (IndicatorDatetimePanel *) object;
+ IndicatorDatetimePanelPrivate * priv = self->priv;
- if (self->priv->builder) {
- g_object_unref (self->priv->builder);
- self->priv->builder = NULL;
- }
-
- if (self->priv->proxy) {
- g_object_unref (self->priv->proxy);
- self->priv->proxy = NULL;
- }
+ g_clear_object (&priv->builder);
+ g_clear_object (&priv->proxy);
- if (self->priv->loc_dlg) {
- gtk_widget_destroy (self->priv->loc_dlg);
- self->priv->loc_dlg = NULL;
+ if (priv->loc_dlg) {
+ gtk_widget_destroy (priv->loc_dlg);
+ priv->loc_dlg = NULL;
}
- if (self->priv->save_time_id) {
- g_source_remove (self->priv->save_time_id);
- self->priv->save_time_id = 0;
+ if (priv->save_time_id) {
+ g_source_remove (priv->save_time_id);
+ priv->save_time_id = 0;
}
- if (self->priv->completion) {
- cc_timezone_completion_watch_entry (self->priv->completion, NULL);
- g_object_unref (self->priv->completion);
- self->priv->completion = NULL;
+ if (priv->completion) {
+ cc_timezone_completion_watch_entry (priv->completion, NULL);
+ g_clear_object (&priv->completion);
}
- if (self->priv->tz_entry) {
- gtk_widget_destroy (self->priv->tz_entry);
- self->priv->tz_entry = NULL;
+ if (priv->tz_entry) {
+ gtk_widget_destroy (priv->tz_entry);
+ priv->tz_entry = NULL;
}
- if (self->priv->time_spin) {
- gtk_widget_destroy (self->priv->time_spin);
- self->priv->time_spin = NULL;
+ if (priv->time_spin) {
+ gtk_widget_destroy (priv->time_spin);
+ priv->time_spin = NULL;
}
- if (self->priv->date_spin) {
- gtk_widget_destroy (self->priv->date_spin);
- self->priv->date_spin = NULL;
+ if (priv->date_spin) {
+ gtk_widget_destroy (priv->date_spin);
+ priv->date_spin = NULL;
}
}