|
|
9b746a |
From 3f089ddbd8cc304c563b4ed8cfbc59d27ffadc00 Mon Sep 17 00:00:00 2001
|
|
|
9b746a |
From: Carlos Garnacho <carlosg@gnome.org>
|
|
|
9b746a |
Date: Thu, 12 Dec 2019 22:43:15 +0100
|
|
|
9b746a |
Subject: [PATCH] network: Update VPN empty label status after removing VPN
|
|
|
9b746a |
connection
|
|
|
9b746a |
|
|
|
9b746a |
Being the VPN list actually a collection of listboxes, this function
|
|
|
9b746a |
ensures it looks alright in other places. However the case of removing
|
|
|
9b746a |
all VPN connections till we're back empty was missed.
|
|
|
9b746a |
---
|
|
|
9b746a |
panels/network/cc-network-panel.c | 29 +++++++++++++++++++++++++++++
|
|
|
9b746a |
1 file changed, 29 insertions(+)
|
|
|
9b746a |
|
|
|
9b746a |
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
|
|
|
9b746a |
index 1a072a65a..f08d9b939 100644
|
|
|
9b746a |
--- a/panels/network/cc-network-panel.c
|
|
|
9b746a |
+++ b/panels/network/cc-network-panel.c
|
|
|
9b746a |
@@ -761,6 +761,33 @@ notify_connection_added_cb (NMClient *client,
|
|
|
9b746a |
add_connection (panel, NM_CONNECTION (connection));
|
|
|
9b746a |
}
|
|
|
9b746a |
|
|
|
9b746a |
+static void
|
|
|
9b746a |
+notify_connection_removed_cb (NMClient *client,
|
|
|
9b746a |
+ NMRemoteConnection *connection,
|
|
|
9b746a |
+ CcNetworkPanel *panel)
|
|
|
9b746a |
+{
|
|
|
9b746a |
+ guint i;
|
|
|
9b746a |
+
|
|
|
9b746a |
+ for (i = 0; i < panel->devices->len; i++) {
|
|
|
9b746a |
+ NetObject *object = g_ptr_array_index (panel->devices, i);
|
|
|
9b746a |
+ NMConnection *vpn_conn;
|
|
|
9b746a |
+ gboolean equal;
|
|
|
9b746a |
+
|
|
|
9b746a |
+ if (!NET_IS_VPN (object))
|
|
|
9b746a |
+ continue;
|
|
|
9b746a |
+
|
|
|
9b746a |
+ g_object_get (object, "connection", &vpn_conn, NULL);
|
|
|
9b746a |
+ equal = vpn_conn == NM_CONNECTION (connection);
|
|
|
9b746a |
+ g_object_unref (vpn_conn);
|
|
|
9b746a |
+
|
|
|
9b746a |
+ if (equal) {
|
|
|
9b746a |
+ g_ptr_array_remove (panel->devices, object);
|
|
|
9b746a |
+ update_vpn_section (panel);
|
|
|
9b746a |
+ return;
|
|
|
9b746a |
+ }
|
|
|
9b746a |
+ }
|
|
|
9b746a |
+}
|
|
|
9b746a |
+
|
|
|
9b746a |
static void
|
|
|
9b746a |
panel_check_network_manager_version (CcNetworkPanel *panel)
|
|
|
9b746a |
{
|
|
|
9b746a |
@@ -912,6 +939,8 @@ cc_network_panel_init (CcNetworkPanel *panel)
|
|
|
9b746a |
/* add remote settings such as VPN settings as virtual devices */
|
|
|
9b746a |
g_signal_connect (panel->client, NM_CLIENT_CONNECTION_ADDED,
|
|
|
9b746a |
G_CALLBACK (notify_connection_added_cb), panel);
|
|
|
9b746a |
+ g_signal_connect (panel->client, NM_CLIENT_CONNECTION_REMOVED,
|
|
|
9b746a |
+ G_CALLBACK (notify_connection_removed_cb), panel);
|
|
|
9b746a |
|
|
|
9b746a |
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (panel));
|
|
|
9b746a |
g_signal_connect_after (toplevel, "map", G_CALLBACK (on_toplevel_map), panel);
|
|
|
9b746a |
--
|
|
|
9b746a |
2.23.0
|
|
|
9b746a |
|