network-manager-applet/0004-applet-fix-status-icon-VPN-rh1471510.patch

70 lines
2.6 KiB
Diff

From 8b8c1db2eb9824a34b36d6b10b4d6c17c4694fb6 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Thu, 10 Aug 2017 17:00:16 +0200
Subject: [PATCH] applet: fix status icon when a VPN has the default route
After commit 35736dd2dfe0 ("applet: use default active interface, even
if it is of unsupported class") when a VPN with default route is
active, applet_get_default_active_connection() returns the VPN
connection, and no icon would be set because the tun device doesn't
have a NMADeviceClass.
Require a device class only when we need to determine the status icon,
otherwise accept any connection.
Fixes: 35736dd2dfe05534e5e45d9e3cdddf3cabec840c
https://bugzilla.gnome.org/show_bug.cgi?id=785775
https://bugzilla.redhat.com/show_bug.cgi?id=1471510
(cherry picked from commit b82db07d652df24e9286d0328462f94183d406c1)
---
src/applet.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/applet.c b/src/applet.c
index 4ac7fabc..c0bb7b5b 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -225,7 +225,8 @@ applet_get_best_activating_connection (NMApplet *applet, NMDevice **device)
}
static NMActiveConnection *
-applet_get_default_active_connection (NMApplet *applet, NMDevice **device)
+applet_get_default_active_connection (NMApplet *applet, NMDevice **device,
+ gboolean only_known_devices)
{
NMActiveConnection *default_ac = NULL;
NMDevice *non_default_device = NULL;
@@ -249,6 +250,10 @@ applet_get_default_active_connection (NMApplet *applet, NMDevice **device)
candidate_dev = g_ptr_array_index (devices, 0);
+ if ( only_known_devices
+ && !get_device_class (candidate_dev, applet))
+ continue;
+
/* We have to return default connection/device even if they are of an
* unknown class - otherwise we may end up returning non
* default interface which has nothing to do with our default
@@ -1033,7 +1038,7 @@ nma_menu_vpn_item_clicked (GtkMenuItem *item, gpointer user_data)
return;
}
- active = applet_get_default_active_connection (applet, &device);
+ active = applet_get_default_active_connection (applet, &device, FALSE);
if (!active || !device) {
g_warning ("%s: no active connection or device.", __func__);
return;
@@ -2577,7 +2582,7 @@ applet_get_device_icon_for_state (NMApplet *applet,
/* If there aren't any activating devices, then show the state of
* the default active connection instead.
*/
- active = applet_get_default_active_connection (applet, &device);
+ active = applet_get_default_active_connection (applet, &device, TRUE);
if (!active || !device)
goto out;
}
--
2.13.5