Commit d099b21d authored by Natanael Copa's avatar Natanael Copa

main/dhcpcd-ui: backport fix to not spam when connected

prevent spamming notify messages when we are connected
parent d91ee279
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=dhcpcd-ui
pkgver=0.7.5
pkgrel=1
pkgrel=2
pkgdesc="A GTK+ monitor and configuration GUI for dhcpcd"
url="https://roy.marples.name/projects/dhcpcd-ui"
arch="all"
......@@ -11,6 +11,7 @@ makedepends="glib-dev gtk+-dev dbus-dev libnotify-dev bsd-compat-headers"
install=
subpackages="$pkgname-doc"
source="http://roy.marples.name/downloads/dhcpcd/$pkgname-$pkgver.tar.bz2
dont-spam.patch
"
_builddir="$srcdir"/dhcpcd-ui-$pkgver
......@@ -38,6 +39,5 @@ package() {
make DESTDIR="$pkgdir" AUTOSTARTDIR=/etc/xdg/autostart install
}
md5sums="ff937ffe2ffc2801488078a61bdbfd0d dhcpcd-ui-0.7.5.tar.bz2"
sha256sums="2dae2108605867aba78d98cc9e56e22d7b751eedc3f7e6d689d42d08e706aaf3 dhcpcd-ui-0.7.5.tar.bz2"
sha512sums="78dba758f7cee825a1618c33b1fff9549c4e51e19fd5eebd1ae5d6a4686726ec8ad86dc1ec5384238b43589dd700979c694f48bc94e2844f1ef898292660a5d2 dhcpcd-ui-0.7.5.tar.bz2"
sha512sums="78dba758f7cee825a1618c33b1fff9549c4e51e19fd5eebd1ae5d6a4686726ec8ad86dc1ec5384238b43589dd700979c694f48bc94e2844f1ef898292660a5d2 dhcpcd-ui-0.7.5.tar.bz2
bf7a002a6084048c3ca6f6bf952909193839fc3e394a1a037b823dfacc47960ca698ee539a22a89f29d2c8649ae750a70737db025718224840d23ecfbe514a83 dont-spam.patch"
From ed60b357213cb8d90e10483e37fa343ddb346a0c Mon Sep 17 00:00:00 2001
From: Roy Marples <roy@marples.name>
Date: Mon, 6 Nov 2017 13:45:47 +0000
Subject: Don't spam the user about new AP's if we're connected already.
---
src/dhcpcd-gtk/main.c | 45 ++++++++++++++++++++++++---------------------
src/dhcpcd-qt/dhcpcd-qt.cpp | 39 +++++++++++++++++++++++----------------
2 files changed, 47 insertions(+), 37 deletions(-)
diff --git a/src/dhcpcd-gtk/main.c b/src/dhcpcd-gtk/main.c
index 00e18d8..6444bf8 100644
--- a/src/dhcpcd-gtk/main.c
+++ b/src/dhcpcd-gtk/main.c
@@ -584,9 +584,8 @@ dhcpcd_wpa_scan_cb(DHCPCD_WPA *wpa, _unused void *data)
DHCPCD_IF *i;
WI_SCAN *w;
DHCPCD_WI_SCAN *scans, *s1, *s2;
- char *txt, *t;
- int lerrno, fd;
const char *msg;
+ int lerrno, fd;
/* This could be a new WPA so watch it */
fd = dhcpcd_wpa_get_fd(wpa);
@@ -621,27 +620,31 @@ dhcpcd_wpa_scan_cb(DHCPCD_WPA *wpa, _unused void *data)
TAILQ_INIT(&w->menus);
TAILQ_INSERT_TAIL(&wi_scans, w, next);
} else {
- txt = NULL;
- msg = N_("New Access Point");
- for (s1 = scans; s1; s1 = s1->next) {
- for (s2 = w->scans; s2; s2 = s2->next)
- if (g_strcmp0(s1->ssid, s2->ssid) == 0)
- break;
- if (s2 == NULL) {
- if (txt == NULL)
- txt = g_strdup(s1->ssid);
- else {
- msg = N_("New Access Points");
- t = g_strconcat(txt, "\n",
- s1->ssid, NULL);
- g_free(txt);
- txt = t;
+ if (!i->up) {
+ char *txt, *t;
+
+ txt = NULL;
+ msg = N_("New Access Point");
+ for (s1 = scans; s1; s1 = s1->next) {
+ for (s2 = w->scans; s2; s2 = s2->next)
+ if (g_strcmp0(s1->ssid, s2->ssid) == 0)
+ break;
+ if (s2 == NULL) {
+ if (txt == NULL)
+ txt = g_strdup(s1->ssid);
+ else {
+ msg = N_("New Access Points");
+ t = g_strconcat(txt, "\n",
+ s1->ssid, NULL);
+ g_free(txt);
+ txt = t;
+ }
}
}
- }
- if (txt) {
- notify(msg, txt, "network-wireless");
- g_free(txt);
+ if (txt) {
+ notify(msg, txt, "network-wireless");
+ g_free(txt);
+ }
}
menu_update_scans(w, scans);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment