branch: master
commit eb6b0856db17707cf182173c85ddae28a7646371
Author: Ian D <du...@gnu.org>
Commit: Ian D <du...@gnu.org>

    Fixed up copyright information.
    (enwc-format-mode-line-string): Set up to handle invalid and connecting 
networks.
---
 lisp/enwc-cm.el    |  4 +--
 lisp/enwc-nm.el    |  3 +-
 lisp/enwc-setup.el | 13 ++-------
 lisp/enwc-wicd.el  |  2 +-
 lisp/enwc.el       | 84 +++++++++++++++++++++++++++++-------------------------
 5 files changed, 50 insertions(+), 56 deletions(-)

diff --git a/lisp/enwc-cm.el b/lisp/enwc-cm.el
index 975c9f9..21faba6 100644
--- a/lisp/enwc-cm.el
+++ b/lisp/enwc-cm.el
@@ -1,6 +1,6 @@
 ;; enwc-cm.el
 
-;; Copyright (C) 2012,2013 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
@@ -31,7 +31,6 @@
 ;; check-connecting
 ;; get-current-nw-id
 
-
 (require 'enwc)
 
 (defgroup enwc-cm nil
@@ -44,7 +43,6 @@
   :group 'enwc-cm
   :type 'string)
 
-
 ;; DEMAND TO SEE LIFE'S MANAGER!!
 
 (defcustom enwc-cm-dbus-manager-interface "net.connman.Manager"
diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 6e4e694..20b3d16 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -1,6 +1,6 @@
 ;;; enwc-nm.el - The NetworkManager backend to ENWC
 
-;; Copyright (C) 2012,2013,2014 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
@@ -257,7 +257,6 @@ This returns a list of D-Bus paths to the access points."
                    enwc-nm-dbus-service
                    enwc-nm-wireless-dev
                    enwc-nm-dbus-wireless-interface
-
                    "GetAccessPoints"))
 
 ;; Accesspoint
diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index ec6bf9d..2dc9f16 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -1,6 +1,6 @@
 ;; enwc-setup.el - Setup routines for ENWC
 
-;; Copyright (C) 2012,2013,2014 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
@@ -97,16 +97,7 @@
 This setups ENWC and confirms that one of the backends can be found
 on D-Bus."
   (if enwc-display-mode-line
-      (enwc-enable-display-mode-line)
-      ;; (progn
-      ;;   (unless (member 'enwc-display-string
-      ;;                   global-mode-string)
-      ;;     (setq global-mode-string (append global-mode-string
-      ;;                                      '(enwc-display-string))))
-      ;;   (setq enwc-display-mode-line-timer 
-      ;;         (run-at-time t 1 'enwc-update-mode-line)))
-    )
-  
+      (enwc-enable-display-mode-line))
 
   (if (and enwc-auto-scan (> enwc-auto-scan-interval 0))
       (setq enwc-scan-timer
diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index f02f4b6..b6db670 100644
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -1,6 +1,6 @@
 ;;; enwc-wicd.el --- The Wicd backend to ENWC
 
-;; Copyright (C) 2012,2013,2014 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 6097957..872e70a 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -1,6 +1,6 @@
 ;;; enwc.el --- The Emacs Network Client
 
-;; Copyright (C) 2012,2013,2014 Free Software Foundation
+;; Copyright (C) 2012,2013,2014 Free Software Foundation, Inc.
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
@@ -447,47 +447,49 @@ WIRED indicates whether or not this is a wired 
connection."
   "Formats the mode line string.
 This is derived from `enwc-mode-line-format'.
 See the documentation for it for more details."
-  (if (enwc-check-connecting-p)
-      "[*]"
-    (let* ((f enwc-mode-line-format)
-           (p 0)
-           (l (length f))
-           (cur-id (enwc-get-current-nw-id))
-           c fin-str)
-      (while (< p l)
-        (setq c (elt f p))
-        (setq p (1+ p))
-        (setq fin-str
-              (concat
-               fin-str
-               (if (not (eq c ?%))
-                   (char-to-string c)
-                 (setq p (1+ p))
+  (let* ((f enwc-mode-line-format)
+         (p 0)
+         (l (length f))
+         (cur-id (enwc-get-current-nw-id))
+         c fin-str)
+    (while (< p l)
+      (setq c (elt f p))
+      (setq p (1+ p))
+      (setq fin-str
+            (concat
+             fin-str
+             (if (not (eq c ?%))
+                 (char-to-string c)
+               (setq p (1+ p))
+               (cond
+                ((eq (elt f (1- p)) ?s)
                  (cond
-                  ((eq (elt f (1- p)) ?s)
-                   (if (enwc-is-wired-p)
-                       "100"
-                     (number-to-string
-                      (cdr (assoc "quality" (nth cur-id enwc-last-scan))))))
-                  ((eq (elt f (1- p)) ?e)
-                   (if (enwc-is-wired-p)
-                       "Wired"
-                     (cdr (assoc "essid" (nth cur-id enwc-last-scan)))))
-                  ((eq (elt f (1- p)) ?b)
-                   (if (enwc-is-wired-p)
-                       "wired"
-                     (cdr (assoc "bssid" (nth cur-id enwc-last-scan)))))
-                  ((eq (elt f (1- p)) ?%) "%"))))))
-      fin-str)))
+                  ((enwc-is-wired-p) "100")
+                  ((not (enwc-is-valid-nw-id cur-id)) "0")
+                  ((enwc-check-connecting-p) "*")
+                  (t (number-to-string
+                      (cdr (assoc "quality" (nth cur-id enwc-last-scan)))))))
+                ((eq (elt f (1- p)) ?e)
+                 (cond
+                  ((enwc-is-wired-p) "Wired")
+                  ((or (not (enwc-is-valid-nw-id cur-id))
+                       (enwc-check-connecting-p)) "None")
+                  (t (cdr (assoc "essid" (nth cur-id enwc-last-scan))))))
+                ((eq (elt f (1- p)) ?b)
+                 (cond
+                  ((enwc-is-wired-p) "wired")
+                  ((or (not (enwc-is-valid-nw-id cur-id))
+                       (enwc-check-connecting-p)) "none")
+                  (t (cdr (assoc "bssid" (nth cur-id enwc-last-scan))))))
+                ((eq (elt f (1- p)) ?%) "%"))))))
+    fin-str))
 
 (defun enwc-update-mode-line ()
   "Updates the mode line display.
 This uses the format specified by `enwc-mode-line-format'.
 This is initiated during setup, and runs once every second."
- (let ((cur-id (enwc-get-current-nw-id))
-       (conn (enwc-check-connecting-p)))
-   (setq enwc-display-string (enwc-format-mode-line-string))
-   (force-mode-line-update)))
+  (setq enwc-display-string (enwc-format-mode-line-string))
+  (force-mode-line-update))
 
 (defun enwc-enable-display-mode-line ()
   "Enables the mode line display."
@@ -536,7 +538,10 @@ This will use the current value of 
`enwc-auto-scan-interval'."
 (defun enwc-scan-internal-wireless ()
   "The initial scan routine.
 This initiates a scan using D-Bus, then exits,
-waiting for the callback."
+waiting for the callback.
+
+All back-ends must call enwc-process-scan in some way
+upon completion of a scan."
   (if enwc-scan-interactive
       (message "Scanning..."))
   (setq enwc-scan-requested t)
@@ -690,8 +695,9 @@ NETWORKS must be in the format returned by
       (tabulated-list-print))))
 
 (defun enwc-display-networks (networks)
-  "Displays the network in NETWORKS.  This is an entry to the display
-functions, and checks whether or not ENWC is using wired."
+  "Displays the network in NETWORKS.
+This is an entry to the display functions,
+and checks whether or not ENWC is using wired."
   (if (not (eq major-mode 'enwc-mode))
       (enwc-setup-buffer))
   (if (not (listp networks))

Reply via email to