Import Debian changes 1.34.0-ok1

network-manager-applet (1.34.0-ok1) nile; urgency=medium

  * Build for openKylin.
This commit is contained in:
Luoyaoming 2024-04-24 16:07:37 +08:00 committed by luoyaoming
parent c88f3f32d8
commit a8098f56c1
15 changed files with 716 additions and 0 deletions

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
network-manager-applet (1.34.0-ok1) nile; urgency=medium
* Build for openKylin.
-- Luoyaoming <Luoyaoming@kylinos.cn> Wed, 24 Apr 2024 16:07:37 +0800

60
debian/control vendored Normal file
View File

@ -0,0 +1,60 @@
Source: network-manager-applet
Section: gnome
Priority: optional
Maintainer: openKylin Developers <packaging@lists.openkylin.top>
XSBC-Original-Maintainer: Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>
Uploaders: Michael Biebl <biebl@debian.org>
Build-Depends: debhelper-compat (= 13),
dh-sequence-translations,
meson (>= 0.46.0),
gettext (>= 0.18),
pkg-config,
libsecret-1-dev (>= 0.18),
libgtk-3-dev (>= 3.10),
libglib2.0-dev (>= 2.40),
libayatana-appindicator3-dev,
libdbusmenu-gtk3-dev (>= 16.04.0),
libnm-dev (>= 1.15),
libnma-dev (>= 1.8.27),
libmm-glib-dev,
libjansson-dev (>= 2.7),
libselinux-dev,
Standards-Version: 4.6.2
Rules-Requires-Root: no
Vcs-Git: https://salsa.debian.org/utopia-team/network-manager-applet.git
Vcs-Browser: https://salsa.debian.org/utopia-team/network-manager-applet
Homepage: https://www.gnome.org/projects/NetworkManager/
Package: network-manager-gnome
Architecture: linux-any
Section: gnome
Pre-Depends: ${misc:Pre-Depends}
Depends: ${shlibs:Depends},
${misc:Depends},
network-manager,
gnome-shell | policykit-1-gnome | polkit-1-auth-agent,
default-dbus-session-bus | dbus-session-bus
Recommends: gnome-shell | notification-daemon,
gnome-keyring,
humanity-icon-theme,
mobile-broadband-provider-info,
iso-codes
Suggests: network-manager-openconnect-gnome,
network-manager-openvpn-gnome,
network-manager-vpnc-gnome,
network-manager-pptp-gnome
Breaks: libnma-common (<< 1.10.4)
Replaces: libnma-common (<< 1.10.4)
Description: network management framework (GNOME frontend)
NetworkManager is a system network service that manages your network devices
and connections, attempting to keep active network connectivity when
available. It manages ethernet, WiFi, mobile broadband (WWAN), and PPPoE
devices, and provides VPN integration with a variety of different VPN
services.
.
This package contains a systray applet for GNOME's notification area but it
also works for other desktop environments which provide a systray like KDE
or Xfce.
It displays the available networks and allows users to easily switch between
them. For encrypted networks it will prompt the user for the key/passphrase
and it can optionally store them in the gnome-keyring.

50
debian/copyright vendored Normal file
View File

@ -0,0 +1,50 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: network-manager-applet
Source: https://ftp.gnome.org/pub/GNOME/sources/network-manager-applet/
Files: *
Copyright: 2004 - 2015 Red Hat, Inc.
2005 - 2008 Novell, Inc.
2001, 2002 Free Software Foundation
License: GPL-2+
Files: shared/*
Copyright: 2009 Novell, Inc.
2009 - 2015 Red Hat, Inc.
2012 Lanedo GmbH
1999, 2000 Eazel, Inc.
License: LGPL-2+
License: GPL-2+
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
.
On Debian systems, the complete text of the GNU General Public
License version 2 can be found in "/usr/share/common-licenses/GPL-2".
License: LGPL-2+
This package is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU Lesser General
Public License can be found in "/usr/share/common-licenses/LGPL-2".

5
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,5 @@
[DEFAULT]
pristine-tar = True
patch-numbers = False
debian-branch = debian/master
upstream-branch = upstream/latest

1
debian/network-manager-gnome.docs vendored Normal file
View File

@ -0,0 +1 @@
NEWS

View File

@ -0,0 +1,28 @@
From: Michael Biebl <biebl@debian.org>
Date: Tue, 18 Mar 2014 10:49:13 +0100
Subject: Force online state with unmanaged devices
If NM has an active unmanaged device it will forcefully set the online
state to CONNECTED_GLOBAL. In that case show a wired connection icon
instead of an offline icon.
Closes: #471191
---
src/applet.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/applet.c b/src/applet.c
index 24019e7..ca9e4ed 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -2648,6 +2648,10 @@ applet_update_icon (gpointer user_data)
applet_get_device_icon_for_state (applet, &pixbuf, &icon_name_free, &dev_tip_free);
icon_name = icon_name_free;
dev_tip = dev_tip_free;
+ if (!pixbuf && state == NM_STATE_CONNECTED_GLOBAL) {
+ icon_name = g_strdup ("nm-device-wired");
+ pixbuf = g_object_ref (nma_icon_check_and_load (icon_name, applet));
+ }
break;
}

View File

@ -0,0 +1,35 @@
From: Mathieu Trudel-Lapierre <mathieu@canonical.com>
Date: Fri, 20 May 2016 14:32:07 +0800
Subject: Have the appindicator enabled by default.
---
src/main.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/main.c b/src/main.c
index 1c0f7e9..9612ee9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,7 +17,7 @@
gboolean shell_debug = FALSE;
gboolean with_agent = TRUE;
-gboolean with_appindicator = FALSE;
+gboolean with_appindicator = TRUE;
static void
usage (const char *progname)
@@ -47,11 +47,9 @@ int main (int argc, char *argv[])
shell_debug = TRUE;
else if (!strcmp (argv[i], "--no-agent"))
with_agent = FALSE;
- else if (!strcmp (argv[i], "--indicator")) {
+ else if (!strcmp (argv[i], "--no-indicator")) {
#ifdef WITH_APPINDICATOR
- with_appindicator = TRUE;
-#else
- g_error ("Error: --indicator requested but indicator support not available");
+ with_appindicator = FALSE;
#endif
}
}

View File

@ -0,0 +1,127 @@
From: =?utf-8?q?Antti_Kaijanm=C3=A4ki?= <antti.kaijanmaki@canonical.com>
Date: Tue, 24 May 2016 13:37:12 +0800
Subject: Make policykit-restricted actions insensitive
Make sure the behavior for policykit-restricted actions is
consistently to make the items insensitive
---
src/applet-device-wifi.c | 29 +++++++++++++++++++++++++++++
src/applet.c | 30 ++++++++++++++++++++++++++++--
2 files changed, 57 insertions(+), 2 deletions(-)
Index: network-manager-applet-1.32.0/src/applet-device-wifi.c
===================================================================
--- network-manager-applet-1.32.0.orig/src/applet-device-wifi.c 2023-06-22 13:15:43.718563338 +0200
+++ network-manager-applet-1.32.0/src/applet-device-wifi.c 2023-06-22 13:15:43.714563397 +0200
@@ -203,6 +203,8 @@
{
GtkWidget *menu_item;
GtkWidget *label;
+ gboolean allowed;
+ NMClientPermissionResult perm;
menu_item = gtk_menu_item_new ();
label = gtk_label_new_with_mnemonic (_("_Connect to Hidden Wi-Fi Network…"));
@@ -213,6 +215,33 @@
g_signal_connect_swapped (menu_item, "activate",
G_CALLBACK (applet_wifi_connect_to_hidden_network),
applet);
+
+ allowed = FALSE;
+ perm = nm_client_get_permission_result (applet->nm_client,
+ NM_CLIENT_PERMISSION_NETWORK_CONTROL);
+ if ( perm == NM_CLIENT_PERMISSION_RESULT_YES
+ || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) {
+ /* First, the user has to be able to control networks
+ * to connect to a new hidden access point.
+ */
+ perm = nm_client_get_permission_result (applet->nm_client,
+ NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN);
+ if ( perm == NM_CLIENT_PERMISSION_RESULT_YES
+ || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) {
+ /* The user can modify (and add!) a new configuration for herself. */
+ allowed = TRUE;
+ } else {
+ perm = nm_client_get_permission_result (applet->nm_client,
+ NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM);
+ if ( perm == NM_CLIENT_PERMISSION_RESULT_YES
+ || perm == NM_CLIENT_PERMISSION_RESULT_AUTH) {
+ /* The user can modify (and add!) a new system wide configuration. */
+ allowed = TRUE;
+ }
+ }
+ }
+
+ gtk_widget_set_sensitive (GTK_WIDGET (menu_item), allowed);
}
gboolean
Index: network-manager-applet-1.32.0/src/applet.c
===================================================================
--- network-manager-applet-1.32.0.orig/src/applet.c 2023-06-22 13:15:43.718563338 +0200
+++ network-manager-applet-1.32.0/src/applet.c 2023-06-22 13:15:43.714563397 +0200
@@ -43,6 +43,8 @@
G_DEFINE_TYPE (NMApplet, nma, G_TYPE_APPLICATION)
+static gboolean is_permission_yes (NMApplet *applet, NMClientPermission perm);
+
/********************************************************************/
static gboolean
@@ -1295,7 +1297,10 @@
G_CALLBACK (applet_device_disconnect_db),
info,
applet_device_info_destroy, 0);
- gtk_widget_set_sensitive (item, TRUE);
+ if (is_permission_yes (applet, NM_CLIENT_PERMISSION_NETWORK_CONTROL))
+ gtk_widget_set_sensitive (item, TRUE);
+ else
+ gtk_widget_set_sensitive (item, FALSE);
break;
}
default:
@@ -1449,7 +1454,8 @@
state = nm_client_get_state (applet->nm_client);
if ( state != NM_STATE_CONNECTED_LOCAL
&& state != NM_STATE_CONNECTED_SITE
- && state != NM_STATE_CONNECTED_GLOBAL)
+ && state != NM_STATE_CONNECTED_GLOBAL
+ && !is_permission_yes (applet, NM_CLIENT_PERMISSION_NETWORK_CONTROL))
gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
else
gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE);
@@ -1475,6 +1481,12 @@
g_signal_connect (item, "activate", G_CALLBACK (nma_menu_add_vpn_item_activate), applet);
}
gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item));
+ if ( is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM)
+ || is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN)) {
+ gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE);
+ } else {
+ gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
+ }
gtk_widget_show (GTK_WIDGET (item));
g_ptr_array_unref (list);
@@ -1733,6 +1745,20 @@
gtk_widget_show_all (applet->wwan_enabled_item);
else
gtk_widget_hide (applet->wwan_enabled_item);
+
+ if (is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM)
+ || is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN)
+ || is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME)) {
+
+ /* User has permissions to modify some of the settings. */
+ gtk_widget_set_sensitive (applet->connections_menu_item, TRUE);
+
+ } else {
+ /* the user is not allowed to edit any of the settings,
+ * so set the "Edit Connections..." menu item insensitive.
+ */
+ gtk_widget_set_sensitive (applet->connections_menu_item, FALSE);
+ }
}
static void

View File

@ -0,0 +1,166 @@
Subject: Support hiding rather than desensitizing disallowed items
This is done using a new environment variable that can be set
when nm-applet is started: NM_APPLET_HIDE_POLICY_ITEMS.
---
src/applet-device-wifi.c | 20 +++++++++++++++++---
src/applet.c | 44 +++++++++++++++++++++++++++++++++++++++-----
src/applet.h | 1 +
3 files changed, 57 insertions(+), 8 deletions(-)
Index: network-manager-applet-1.32.0/src/applet-device-wifi.c
===================================================================
--- network-manager-applet-1.32.0.orig/src/applet-device-wifi.c 2023-06-22 13:15:45.650534371 +0200
+++ network-manager-applet-1.32.0/src/applet-device-wifi.c 2023-06-22 13:15:45.650534371 +0200
@@ -211,7 +211,6 @@
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_container_add (GTK_CONTAINER (menu_item), label);
gtk_widget_show_all (menu_item);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
g_signal_connect_swapped (menu_item, "activate",
G_CALLBACK (applet_wifi_connect_to_hidden_network),
applet);
@@ -242,6 +241,13 @@
}
gtk_widget_set_sensitive (GTK_WIDGET (menu_item), allowed);
+ if (!allowed && applet->hide_policy_items) {
+ /* don't add the item if it should be hidden */
+ /* TODO: is this the final solution? */
+ g_object_ref_sink (menu_item);
+ g_object_unref (menu_item);
+ } else
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
}
gboolean
@@ -289,13 +295,21 @@
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_container_add (GTK_CONTAINER (menu_item), label);
gtk_widget_show_all (menu_item);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
g_signal_connect_swapped (menu_item, "activate",
G_CALLBACK (applet_wifi_create_wifi_network),
applet);
- if (!applet_wifi_can_create_wifi_network (applet))
+ if (!applet_wifi_can_create_wifi_network (applet)) {
gtk_widget_set_sensitive (GTK_WIDGET (menu_item), FALSE);
+ if (applet->hide_policy_items) {
+ /* don't add the item if it should be hidden */
+ /* TODO: is this the final solution? */
+ g_object_ref_sink (menu_item);
+ g_object_unref (menu_item);
+ return;
+ }
+ }
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
}
typedef struct {
Index: network-manager-applet-1.32.0/src/applet.c
===================================================================
--- network-manager-applet-1.32.0.orig/src/applet.c 2023-06-22 13:15:45.650534371 +0200
+++ network-manager-applet-1.32.0/src/applet.c 2023-06-22 13:15:45.650534371 +0200
@@ -1426,6 +1426,19 @@
GtkMenuItem *item;
GPtrArray *list;
int i;
+ gboolean configure_allowed;
+ gboolean disconnect_allowed;
+
+ if ( is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM)
+ || is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN))
+ configure_allowed = TRUE;
+ else
+ configure_allowed = FALSE;
+
+ if (is_permission_yes (applet, NM_CLIENT_PERMISSION_NETWORK_CONTROL))
+ disconnect_allowed = TRUE;
+ else
+ disconnect_allowed = FALSE;
vpn_menu = GTK_MENU (gtk_menu_new ());
@@ -1455,9 +1468,16 @@
if ( state != NM_STATE_CONNECTED_LOCAL
&& state != NM_STATE_CONNECTED_SITE
&& state != NM_STATE_CONNECTED_GLOBAL
- && !is_permission_yes (applet, NM_CLIENT_PERMISSION_NETWORK_CONTROL))
+ && !disconnect_allowed){
gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
- else
+ if (!applet->hide_policy_items)
+ gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item));
+ else {
+ /* TODO: is this the final solution? */
+ g_object_ref_sink (item);
+ g_object_unref (item);
+ }
+ } else
gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE);
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), !!active);
@@ -1473,7 +1493,10 @@
/* Draw a separator, but only if we have VPN connections above it */
if (list->len) {
- nma_menu_add_separator_item (GTK_WIDGET (vpn_menu));
+ if ( !applet->hide_policy_items
+ || configure_allowed
+ || disconnect_allowed)
+ nma_menu_add_separator_item (GTK_WIDGET (vpn_menu)); /* separator is added if there will be items under it */
item = GTK_MENU_ITEM (gtk_menu_item_new_with_mnemonic (_("_Configure VPN…")));
g_signal_connect (item, "activate", G_CALLBACK (nma_menu_configure_vpn_item_activate), applet);
} else {
@@ -1481,11 +1504,17 @@
g_signal_connect (item, "activate", G_CALLBACK (nma_menu_add_vpn_item_activate), applet);
}
gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item));
- if ( is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM)
- || is_permission_yes (applet, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN)) {
+ if (configure_allowed) {
gtk_widget_set_sensitive (GTK_WIDGET (item), TRUE);
} else {
gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
+ if (!applet->hide_policy_items) {
+ gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item));
+ } else {
+ /* TODO: is this the final solution? */
+ g_object_ref_sink (item);
+ g_object_unref (item);
+ }
}
gtk_widget_show (GTK_WIDGET (item));
@@ -1758,6 +1787,7 @@
* so set the "Edit Connections..." menu item insensitive.
*/
gtk_widget_set_sensitive (applet->connections_menu_item, FALSE);
+ gtk_widget_set_visible (applet->connections_menu_item, !applet->hide_policy_items);
}
}
@@ -3561,6 +3591,10 @@
g_signal_connect (applet, "startup", G_CALLBACK (applet_startup), NULL);
g_signal_connect (applet, "activate", G_CALLBACK (applet_activate), NULL);
+
+ applet->hide_policy_items = FALSE;
+ if (getenv ("NM_APPLET_HIDE_POLICY_ITEMS"))
+ applet->hide_policy_items = TRUE;
}
static void nma_class_init (NMAppletClass *klass)
Index: network-manager-applet-1.32.0/src/applet.h
===================================================================
--- network-manager-applet-1.32.0.orig/src/applet.h 2023-06-22 13:15:45.650534371 +0200
+++ network-manager-applet-1.32.0/src/applet.h 2023-06-22 13:15:45.650534371 +0200
@@ -80,6 +80,7 @@
#endif
gboolean visible;
+ gboolean hide_policy_items;
/* Permissions */
NMClientPermissionResult permissions[NM_CLIENT_PERMISSION_LAST + 1];

View File

@ -0,0 +1,212 @@
From: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Date: Fri, 20 May 2016 14:27:57 +0800
Subject: lp341684_device_sensitive_disconnect_notify
---
src/applet-device-wifi.c | 2 +
src/applet.c | 142 +++++++++++++++++++++++++++++++++++++++++++++--
src/applet.h | 5 +-
3 files changed, 143 insertions(+), 6 deletions(-)
Index: network-manager-applet-1.32.0/src/applet-device-wifi.c
===================================================================
--- network-manager-applet-1.32.0.orig/src/applet-device-wifi.c 2023-06-22 13:15:39.698623607 +0200
+++ network-manager-applet-1.32.0/src/applet-device-wifi.c 2023-06-22 13:15:39.698623607 +0200
@@ -1239,6 +1239,8 @@
ap = _active_ap_get (applet, device);
+ g_object_set_data_full (G_OBJECT(device), "canonical-last-essid", g_strdup (esc_ssid), (GDestroyNotify) g_free);
+
esc_ssid = get_ssid_utf8 (ap);
if (!ap)
Index: network-manager-applet-1.32.0/src/applet.c
===================================================================
--- network-manager-applet-1.32.0.orig/src/applet.c 2023-06-22 13:15:39.698623607 +0200
+++ network-manager-applet-1.32.0/src/applet.c 2023-06-22 13:15:39.698623607 +0200
@@ -174,6 +174,18 @@
return NULL;
}
+struct _OfflineNotificationContextInfo {
+ NMState state;
+ NMDeviceState device_state;
+ NMDeviceStateReason device_state_reason;
+ NMDeviceType device_type;
+ gchar* title;
+ gchar* text;
+ const gchar* icon;
+};
+
+typedef struct _OfflineNotificationContextInfo OfflineNotificationContextInfo;
+
static NMActiveConnection *
applet_get_best_activating_connection (NMApplet *applet, NMDevice **device)
{
@@ -2096,6 +2108,61 @@
return NULL;
}
+static gboolean
+select_merged_notification_text (OfflineNotificationContextInfo *info)
+{
+ /* only do something if this is about full offline state */
+ if(info->state != NM_STATE_UNKNOWN || info->device_state != NM_DEVICE_STATE_UNKNOWN) {
+ if (!info->text)
+ info->text = g_strdup (_("Network"));
+ if (info->state == NM_STATE_DISCONNECTED || info->state == NM_STATE_ASLEEP) {
+ info->title = _("Disconnected - you are now offline");
+ } else
+ info->title = _("Disconnected");
+
+ switch (info->device_type) {
+ case NM_DEVICE_TYPE_ETHERNET:
+ info->icon = "notification-network-ethernet-disconnected";
+ break;
+ case NM_DEVICE_TYPE_WIFI:
+ info->icon = "notification-network-wireless-disconnected";
+ break;
+ case NM_DEVICE_TYPE_MODEM:
+ info->icon = "notification-gsm-disconnected";
+ break;
+ default:
+ info->icon = "nm-no-connection";
+ break;
+ }
+ g_debug("going for offline with icon: %s", info->icon);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static gboolean
+foo_online_offline_deferred_notify (gpointer user_data)
+{
+ NMApplet *applet = NM_APPLET (user_data);
+ OfflineNotificationContextInfo *info = applet->notification_queue_data;
+ if(select_merged_notification_text (info))
+ if (!g_settings_get_boolean (applet->gsettings, PREF_DISABLE_DISCONNECTED_NOTIFICATIONS))
+ applet_do_notify (applet,
+ info->title,
+ info->text,
+ info->icon,
+ PREF_DISABLE_DISCONNECTED_NOTIFICATIONS);
+ else
+ g_debug("no notification because merged found that we have nothing to say (e.g. not offline)");
+ if (info->text)
+ g_free (info->text);
+ info->text = NULL;
+ g_free (applet->notification_queue_data);
+ applet->notification_queue_data = NULL;
+ applet->deferred_id = 0;
+ return FALSE;
+}
+
static void
applet_common_device_state_changed (NMDevice *device,
NMDeviceState new_state,
@@ -2110,6 +2177,54 @@
switch (new_state) {
+ case NM_DEVICE_STATE_FAILED:
+ case NM_DEVICE_STATE_DISCONNECTED:
+ case NM_DEVICE_STATE_UNMANAGED:
+ case NM_DEVICE_STATE_UNAVAILABLE:
+ {
+ if (old_state != NM_DEVICE_STATE_FAILED &&
+ old_state != NM_DEVICE_STATE_UNKNOWN &&
+ old_state != NM_DEVICE_STATE_DISCONNECTED &&
+ old_state != NM_DEVICE_STATE_UNMANAGED &&
+ old_state != NM_DEVICE_STATE_UNAVAILABLE) {
+ OfflineNotificationContextInfo *info = applet->notification_queue_data;
+ if (!info) {
+ info = g_new0(OfflineNotificationContextInfo, 1);
+ applet->notification_queue_data = info;
+ }
+
+ info->device_state = new_state;
+ info->device_state_reason = reason;
+ if (info->text) {
+ g_free(info->text);
+ info->text = NULL;
+ }
+ if (NM_IS_DEVICE_WIFI (device)) {
+ info->device_type = NM_DEVICE_TYPE_WIFI;
+ info->text = g_strdup(g_object_get_data (G_OBJECT(device), "canonical-last-essid"));
+ if (!info->text)
+ info->text = g_strdup (_("Wireless network"));
+ } else if (NM_IS_DEVICE_ETHERNET (device)) {
+ info->device_type = NM_DEVICE_TYPE_ETHERNET;
+ info->text = g_strdup(_("Ethernet network"));
+ } else if (NM_IS_DEVICE_MODEM (device)) {
+ info->device_type = NM_DEVICE_TYPE_MODEM;
+ info->text = g_strdup (_("Modem network"));
+ } else {
+ info->device_type = NM_DEVICE_TYPE_UNKNOWN;
+ info->text = g_strdup (_("Network"));
+ }
+
+ if (applet->deferred_id)
+ g_source_remove (applet->deferred_id);
+ applet->deferred_id = g_timeout_add (1000, foo_online_offline_deferred_notify, applet);
+
+ clear_animation_timeout (applet);
+ } else {
+ g_debug ("old state indicates that this was not a disconnect %d", old_state);
+ }
+ break;
+ }
case NM_DEVICE_STATE_PREPARE:
case NM_DEVICE_STATE_CONFIG:
case NM_DEVICE_STATE_NEED_AUTH:
@@ -2196,13 +2311,26 @@
{
NMApplet *applet = NM_APPLET (user_data);
+ g_debug("foo_client_state_changed_cb");
switch (nm_client_get_state (client)) {
case NM_STATE_DISCONNECTED:
- applet_do_notify (applet, _("Disconnected"),
- _("The network connection has been disconnected."),
- "nm-no-connection",
- PREF_DISABLE_DISCONNECTED_NOTIFICATIONS);
- break;
+ case NM_STATE_ASLEEP:
+ {
+ OfflineNotificationContextInfo *info = applet->notification_queue_data;
+ if (!info) {
+ info = g_new0(OfflineNotificationContextInfo, 1);
+ applet->notification_queue_data = info;
+ }
+
+ info->state = nm_client_get_state (client);
+ select_merged_notification_text (info);
+
+ if (applet->deferred_id)
+ g_source_remove (applet->deferred_id);
+ applet->deferred_id = g_timeout_add (1000, foo_online_offline_deferred_notify, applet);
+
+ /* Fall through */
+ }
default:
break;
}
Index: network-manager-applet-1.32.0/src/applet.h
===================================================================
--- network-manager-applet-1.32.0.orig/src/applet.h 2023-06-22 13:15:39.698623607 +0200
+++ network-manager-applet-1.32.0/src/applet.h 2023-06-22 13:15:39.698623607 +0200
@@ -139,8 +139,11 @@
/* Tracker objects for secrets requests */
GSList * secrets_reqs;
-
guint wifi_scan_id;
+
+ gpointer notification_queue_data;
+ guint deferred_id;
+
} NMApplet;
typedef void (*AppletNewAutoConnectionCallback) (NMConnection *connection,

5
debian/patches/series vendored Normal file
View File

@ -0,0 +1,5 @@
Force-online-state-with-unmanaged-devices.patch
lp341684_device_sensitive_disconnect_notify.patch
Have-the-appindicator-enabled-by-default.patch
Make-policykit-restricted-actions-insensitive.patch
Support-hiding-rather-than-desensitizing-disallowed-items.patch

15
debian/rules vendored Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-z,defs
%:
dh $@ --without=autoreconf --buildsystem=meson
override_dh_auto_configure:
dh_auto_configure -- \
--libexecdir=/usr/lib/NetworkManager \
-Dappindicator=ayatana \
-Dwwan=true \
-Dselinux=true \
-Dteam=true

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

4
debian/upstream/metadata vendored Normal file
View File

@ -0,0 +1,4 @@
Bug-Database: https://gitlab.gnome.org/GNOME/network-manager-applet/issues
Bug-Submit: https://gitlab.gnome.org/GNOME/network-manager-applet/issues/new
Repository: https://gitlab.gnome.org/GNOME/network-manager-applet.git
Repository-Browse: https://gitlab.gnome.org/GNOME/network-manager-applet

2
debian/watch vendored Normal file
View File

@ -0,0 +1,2 @@
version=4
https://download.gnome.org/sources/@PACKAGE@/([\d\.]+)/@PACKAGE@@ANY_VERSION@\.tar\.xz