[gnome-control-center/gnome-3-8] network: Update forget button sensitivity when rows are destroyed
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-8] network: Update forget button sensitivity when rows are destroyed
- Date: Tue, 1 Oct 2013 13:11:26 +0000 (UTC)
commit 898261f54c76d7d22b083d2d526ddc832083dd8b
Author: Rui Matos <tiagomatos gmail com>
Date: Mon Sep 30 18:55:03 2013 +0200
network: Update forget button sensitivity when rows are destroyed
Doesn't make sense to keep it sensitive after the dialog returns OK.
This also avoids using finalized objects if the forget button is
clicked after some previously checked rows were destroyed because
their connection got removed elsewhere.
https://bugzilla.gnome.org/show_bug.cgi?id=709118
panels/network/net-device-wifi.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index fc70e31..fbb8209 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -1437,6 +1437,18 @@ check_toggled (GtkToggleButton *check, GtkWidget *forget)
}
static void
+update_forget (GtkWidget *forget,
+ gpointer row)
+{
+ GList *rows;
+
+ rows = g_object_steal_data (G_OBJECT (forget), "rows");
+ rows = g_list_remove (rows, row);
+ g_object_set_data_full (G_OBJECT (forget), "rows", rows, (GDestroyNotify)g_list_free);
+ gtk_widget_set_sensitive (forget, rows != NULL);
+}
+
+static void
make_row (GtkSizeGroup *rows,
GtkSizeGroup *icons,
GtkWidget *forget,
@@ -1513,6 +1525,8 @@ make_row (GtkSizeGroup *rows,
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
gtk_box_pack_start (GTK_BOX (row), widget, FALSE, FALSE, 0);
+ g_signal_connect_object (row, "destroy",
+ G_CALLBACK (update_forget), forget, G_CONNECT_SWAPPED);
}
if (check_out)
*check_out = widget;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]