[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master e8b1d77 05/76: * enwc.el (enwc-display-mode-line-timer): A
From: |
Ian Dunn |
Subject: |
[elpa] master e8b1d77 05/76: * enwc.el (enwc-display-mode-line-timer): Added a variable for the mode line timer. |
Date: |
Thu, 23 Feb 2017 19:42:43 -0500 (EST) |
branch: master
commit e8b1d77f4940804f97a7d8cbc865bca86c25090a
Author: Ian D <address@hidden>
Commit: Ian D <address@hidden>
* enwc.el (enwc-display-mode-line-timer): Added a variable for the mode
line timer.
(enwc-scan-timer, enwc-auto-scan, enwc-auto-scan-interval,
enwc-toggle-auto-scan): Added support for automatic scans.
(enwc-scan-internal-wireless, enwc-process-scan): Only displays scanning
message when interactive.
* enwc-setup.el (enwc-setup): Initializes the timers for mode line display
and automatic scanning.
---
lisp/enwc-setup.el | 10 +++++++---
lisp/enwc.el | 35 +++++++++++++++++++++++++++++++++--
2 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index fddcd08..33a156c 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -89,8 +89,7 @@
"-get-nw-info"))
enwc-save-nw-settings-func (intern (concat "enwc-"
sym-name
- "-save-nw-settings"))
- )
+ "-save-nw-settings")))
(funcall (intern (concat "enwc-" sym-name "-setup")))))
(defun enwc-setup ()
@@ -100,7 +99,12 @@ on D-Bus."
(if enwc-display-mode-line
(setq global-mode-string (append global-mode-string
'(enwc-display-string))))
- (run-at-time t 1 'enwc-update-mode-line)
+ (setq enwc-display-mode-line-timer
+ (run-at-time t 1 'enwc-update-mode-line))
+
+ (if (and enwc-auto-scan (> enwc-auto-scan-interval 0))
+ (setq enwc-scan-timer
+ (run-at-time t enwc-auto-scan-interval 'enwc-scan t)))
(let ((cur-back nil)
(back-list enwc-backends))
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 8436c79..1f786dc 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -78,6 +78,18 @@ Emacs mode line."
:group 'enwc
:type 'boolean)
+(defcustom enwc-auto-scan 't
+ "Whether or not to have ENWC automatically scan.
+If non-nil, then ENWC will automatically scan for
+networks every `enwc-auto-scan-interval' seconds."
+ :group 'enwc
+ :type 'boolean)
+
+(defcustom enwc-auto-scan-interval 20
+ "The interval between automatic scans."
+ :group 'enwc
+ :type 'integer)
+
;;; The function variables for the abstract layer.
(defvar enwc-scan-func nil
@@ -245,6 +257,12 @@ This is used so as to avoid multiple updates of the scan
data.")
"Indicates that a scan was interactively requested.
This is only used internally.")
+(defvar enwc-display-mode-line-timer nil
+ "The timer that updates the mode line display.")
+
+(defvar enwc-scan-timer nil
+ "The timer for automatic scanning.")
+
(make-local-variable 'enwc-edit-id)
;; The Fonts
@@ -448,6 +466,17 @@ This is initiated during setup, and runs once every
second."
(setq global-mode-string (delq 'enwc-display-string global-mode-string)))
(setq enwc-display-mode-line new)))
+(defun enwc-toggle-auto-scan ()
+ "Toggles automatic scanning.
+This will use the current value of `enwc-auto-scan-interval'."
+ (interactive)
+ (let ((new (not enwc-auto-scan)))
+ (if new
+ (setq enwc-scan-timer
+ (run-at-time t enwc-auto-scan-interval 'enwc-scan t))
+ (cancel-timer enwc-scan-timer))
+ (setq enwc-auto-scan new)))
+
;;;;;;;;;;;;;;;;;;
;; Scan internal
;;;;;;;;;;;;;;;;;;
@@ -456,7 +485,8 @@ This is initiated during setup, and runs once every second."
"The initial scan routine.
This initiates a scan using D-Bus, then exits,
waiting for the callback."
- (message "Scanning...")
+ (if enwc-scan-interactive
+ (message "Scanning..."))
(setq enwc-scan-requested t)
(setq enwc-scan-done nil)
(enwc-do-scan))
@@ -470,7 +500,8 @@ the scan results."
(setq enwc-scan-requested nil)
(let ((cur-id 0)
(nw-prop-list nil))
- (message "Scanning... Done")
+ (if enwc-scan-interactive
+ (message "Scanning... Done"))
(setq enwc-access-points (enwc-get-nw)
enwc-essid-width 5)
(setq nw-prop-list
- [elpa] master updated (b30addd -> da7e3c6), Ian Dunn, 2017/02/23
- [elpa] master e8b1d77 05/76: * enwc.el (enwc-display-mode-line-timer): Added a variable for the mode line timer.,
Ian Dunn <=
- [elpa] master 4a3acfc 07/76: * enwc.el (enwc-enable-display-mode-line, enwc-disable-display-mode-line, enwc-toggle-display-mode-line): Broke enable/disable mode line functionality into different functions., Ian Dunn, 2017/02/23
- [elpa] master d091e21 16/76: (enwc-get-profile-sec-info): Removed., Ian Dunn, 2017/02/23
- [elpa] master 20afe01 22/76: (enwc-wicd-save-nw-settings): Updated to work with new interface., Ian Dunn, 2017/02/23
- [elpa] master ca50c21 21/76: (enwc--int-to-byte-list, enwc--byte-list-to-int, enwc--htonl): Added to assist with D-Bus conversion., Ian Dunn, 2017/02/23
- [elpa] master e5c36d3 26/76: (enwc-nm-details-list): Removed., Ian Dunn, 2017/02/23
- [elpa] master 421b0d9 35/76: (enwc-wicd-setup): Renamed to `enwc-wicd-load'., Ian Dunn, 2017/02/23
- [elpa] master 7a3c057 03/76: Added support for toggling the mode line display., Ian Dunn, 2017/02/23
- [elpa] master b5e612f 04/76: * enwc.el (enwc-display-networks, enwc-maybe-pretty-entry): Added support for colorizing the current network., Ian Dunn, 2017/02/23
- [elpa] master 89f9418 08/76: enwc.el (enwc-display-wireless-networks): Removed old comment., Ian Dunn, 2017/02/23
- [elpa] master d6aa3ee 02/76: Fixed up enwc-wicd network properties., Ian Dunn, 2017/02/23