[gnome-control-center] power: Don't leak a dialog
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] power: Don't leak a dialog
- Date: Tue, 1 Oct 2013 08:07:17 +0000 (UTC)
commit 4494045c6dfba1ccbb0df21a67d90d83ae81ef7b
Author: Rui Matos <tiagomatos gmail com>
Date: Tue Sep 17 16:50:22 2013 +0200
power: Don't leak a dialog
https://bugzilla.gnome.org/show_bug.cgi?id=708286
panels/power/cc-power-panel.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/panels/power/cc-power-panel.c b/panels/power/cc-power-panel.c
index 5552877..1316e76 100644
--- a/panels/power/cc-power-panel.c
+++ b/panels/power/cc-power-panel.c
@@ -68,6 +68,7 @@ struct _CcPowerPanelPrivate
GSettings *session_settings;
GCancellable *cancellable;
GtkBuilder *builder;
+ GtkWidget *automatic_suspend_dialog;
UpClient *up_client;
GDBusProxy *screen_proxy;
GDBusProxy *kbd_proxy;
@@ -137,6 +138,7 @@ cc_power_panel_dispose (GObject *object)
g_object_unref (priv->cancellable);
priv->cancellable = NULL;
}
+ g_clear_pointer (&priv->automatic_suspend_dialog, gtk_widget_destroy);
g_clear_object (&priv->builder);
g_clear_object (&priv->screen_proxy);
g_clear_object (&priv->kbd_proxy);
@@ -1772,7 +1774,7 @@ activate_row (CcPowerPanel *self,
if (row == GTK_LIST_BOX_ROW (priv->automatic_suspend_row))
{
- w = WID (priv->builder, "automatic_suspend_dialog");
+ w = priv->automatic_suspend_dialog;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (toplevel));
gtk_window_set_modal (GTK_WINDOW (w), TRUE);
@@ -1983,7 +1985,7 @@ add_automatic_suspend_section (CcPowerPanel *self)
gtk_size_group_add_widget (priv->row_sizegroup, row);
gtk_widget_show_all (widget);
- dialog = WID (priv->builder, "automatic_suspend_dialog");
+ dialog = priv->automatic_suspend_dialog;
sw = WID (priv->builder, "automatic_suspend_close");
g_signal_connect_swapped (sw, "clicked", G_CALLBACK (gtk_widget_hide), dialog);
g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
@@ -2180,6 +2182,8 @@ cc_power_panel_init (CcPowerPanel *self)
return;
}
+ priv->automatic_suspend_dialog = WID (priv->builder, "automatic_suspend_dialog");
+
priv->cancellable = g_cancellable_new ();
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]