applet: fix status icon when a VPN has the default route (rh#1471510)

This commit is contained in:
Beniamino Galvani 2017-09-18 17:46:21 +02:00
parent 3b6fdafa6a
commit 53d33a76f0
2 changed files with 75 additions and 1 deletions

View File

@ -0,0 +1,69 @@
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

View File

@ -5,7 +5,7 @@
%global rpm_version 1.8.2
%global real_version 1.8.2
%global release_version 3
%global release_version 4
Name: network-manager-applet
Summary: A network control and status applet for NetworkManager
@ -21,6 +21,7 @@ Patch0: nm-applet-no-notifications.patch
Patch1: 0001-wireless-security-acually-save-the-PKCS-11-PINs-for-.patch
Patch2: 0002-wireless-security-fix-some-crash-issues-on-connectio.patch
Patch3: 0003-libnma-empty-certificate-fix-rh1469852.patch
Patch4: 0004-applet-fix-status-icon-VPN-rh1471510.patch
Requires: NetworkManager >= %{nm_version}
Requires: NetworkManager-glib >= %{nm_version}
@ -124,6 +125,7 @@ This package deprecates libnm-gtk.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
autoreconf -i -f
@ -239,6 +241,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || :
%changelog
* Mon Sep 18 2017 Beniamino Galvani <bgalvani@redhat.com> - 1.8.2-4
- applet: fix status icon when a VPN has the default route (rh#1471510)
* Wed Aug 23 2017 Thomas Haller <thaller@redhat.com> - 1.8.2-3
- libnma: fix certificate picker for empty certificates (rh#1469852)