Commit 545c8865 authored by Rui Matos's avatar Rui Matos Committed by Bastien Nocera
Browse files

datetime: Don't leak the dialogs

https://bugzilla.gnome.org/show_bug.cgi?id=708286
parent 418b9f98
......@@ -71,6 +71,9 @@ struct _CcDateTimePanelPrivate
GtkBuilder *builder;
GtkWidget *map;
GtkWidget *datetime_dialog;
GtkWidget *timezone_dialog;
GList *listboxes;
GList *listboxes_reverse;
......@@ -148,6 +151,9 @@ cc_date_time_panel_dispose (GObject *object)
g_clear_pointer (&priv->listboxes, g_list_free);
g_clear_pointer (&priv->listboxes_reverse, g_list_free);
g_clear_pointer (&priv->datetime_dialog, gtk_widget_destroy);
g_clear_pointer (&priv->timezone_dialog, gtk_widget_destroy);
G_OBJECT_CLASS (cc_date_time_panel_parent_class)->dispose (object);
}
......@@ -782,8 +788,8 @@ on_permission_changed (GPermission *permission,
/* Hide the subdialogs if we no longer have permissions */
if (!allowed)
{
gtk_widget_hide (GTK_WIDGET (W ("datetime-dialog")));
gtk_widget_hide (GTK_WIDGET (W ("timezone-dialog")));
gtk_widget_hide (priv->datetime_dialog);
gtk_widget_hide (priv->timezone_dialog);
}
}
......@@ -1044,7 +1050,7 @@ format_hours_combobox (GtkSpinButton *spin,
return TRUE;
}
static void
static GtkWidget *
setup_timezone_dialog (CcDateTimePanel *self)
{
CcDateTimePanelPrivate *priv = self->priv;
......@@ -1079,6 +1085,8 @@ setup_timezone_dialog (CcDateTimePanel *self)
gtk_entry_completion_set_model (completion, completion_model);
gtk_entry_completion_set_text_column (completion, CITY_COL_CITY_HUMAN_READABLE);
return dialog;
}
static char *
......@@ -1151,7 +1159,7 @@ setup_am_pm_button (CcDateTimePanel *self)
g_object_unref (provider);
}
static void
static GtkWidget *
setup_datetime_dialog (CcDateTimePanel *self)
{
CcDateTimePanelPrivate *priv = self->priv;
......@@ -1228,6 +1236,8 @@ setup_datetime_dialog (CcDateTimePanel *self)
G_CALLBACK (change_time), self);
g_signal_connect_swapped (W ("m_spinbutton"), "value-changed",
G_CALLBACK (change_time), self);
return dialog;
}
static void
......@@ -1286,8 +1296,8 @@ cc_date_time_panel_init (CcDateTimePanel *self)
priv->date = g_date_time_new_now_local ();
setup_timezone_dialog (self);
setup_datetime_dialog (self);
priv->timezone_dialog = setup_timezone_dialog (self);
priv->datetime_dialog = setup_datetime_dialog (self);
setup_listbox (self, W ("listbox1"));
setup_listbox (self, W ("listbox2"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment