[gnome-control-center] network: when the user selects a VPN connection, allow them to delete it
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: when the user selects a VPN connection, allow them to delete it
- Date: Wed, 16 Mar 2011 12:32:54 +0000 (UTC)
commit 976c9ce1c356c0ce8c4f7fa9ecbc37feb425c061
Author: Richard Hughes <richard hughsie com>
Date: Wed Mar 16 12:32:09 2011 +0000
network: when the user selects a VPN connection, allow them to delete it
panels/network/cc-network-panel.c | 37 ++++++++++++++++++++++++++++++++++++-
1 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 496499e..df3544a 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -1400,6 +1400,11 @@ refresh_ui (CcNetworkPanel *panel)
"notebook_types"));
gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), 2);
+ /* we shoulnd't be able to delete the proxy device */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "remove_toolbutton"));
+ gtk_widget_set_sensitive (widget, FALSE);
+
/* save so we ignore */
g_free (priv->current_device);
priv->current_device = NULL;
@@ -1412,9 +1417,19 @@ refresh_ui (CcNetworkPanel *panel)
g_free (priv->current_device);
priv->current_device = NULL;
nm_device_refresh_vpn_ui (panel, NET_VPN (object));
+
+ /* we're able to remove the VPN connection */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "remove_toolbutton"));
+ gtk_widget_set_sensitive (widget, TRUE);
goto out;
}
+ /* we're not yet able to remove the connection */
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+ "remove_toolbutton"));
+ gtk_widget_set_sensitive (widget, FALSE);
+
/* save so we can update */
g_free (priv->current_device);
device = net_device_get_nm_device (NET_DEVICE (object));
@@ -1727,6 +1742,25 @@ add_connection (GtkToolButton *button, CcNetworkPanel *panel)
}
static void
+remove_connection (GtkToolButton *button, CcNetworkPanel *panel)
+{
+ NetDevice *object;
+ NMConnection *connection;
+
+ /* get current device */
+ object = get_selected_composite_device (panel);
+ if (object == NULL)
+ return;
+
+ /* VPN */
+ if (NET_IS_VPN (object)) {
+ connection = net_vpn_get_connection (NET_VPN (object));
+ nm_remote_connection_delete (NM_REMOTE_CONNECTION (connection), NULL, panel);
+ return;
+ }
+}
+
+static void
cc_network_panel_init (CcNetworkPanel *panel)
{
DBusGConnection *bus = NULL;
@@ -1925,7 +1959,8 @@ cc_network_panel_init (CcNetworkPanel *panel)
/* disable for now, until we actually show removable connections */
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
"remove_toolbutton"));
- gtk_widget_set_sensitive (widget, FALSE);
+ g_signal_connect (widget, "clicked",
+ G_CALLBACK (remove_connection), panel);
/* nothing to unlock yet */
widget = GTK_WIDGET (gtk_builder_get_object (panel->priv->builder,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]