emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ELPA-diffs] ELPA branch, master, updated. a30ce157eade9c19c078b76ad1061


From: Stefan Monnier
Subject: [ELPA-diffs] ELPA branch, master, updated. a30ce157eade9c19c078b76ad106144d4ba73122
Date: Thu, 22 Aug 2013 01:49:35 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "ELPA".

The branch, master has been updated
       via  a30ce157eade9c19c078b76ad106144d4ba73122 (commit)
       via  94faa5f7dde74d44ea5cd4e05fa17a093d1e99db (commit)
       via  d1a35cdce616a4c2859b5d0726a86b099dda8864 (commit)
       via  b93e4deb7768b2ee02f00852866d123cc909cf53 (commit)
       via  2fd97d468c13d81e233df4d5c013fdd1f1fb49f3 (commit)
       via  c953374a6370d3a731e64ca3d7b2689f4b053034 (commit)
       via  5491e1e53d306b6e4bcb37f10d112ffe637b401c (commit)
       via  00acff24d08f72cd287831fbc99dc10dea2c0714 (commit)
       via  936e5a72e4b072e79a3e4eb529fd49dce427a0a8 (commit)
       via  2a977ad3baf4b5678bc536bd8453a308f818ff3a (commit)
       via  3d959b8ffb2a60c44b4d24c4690da4fa45252684 (commit)
      from  c313cab0b5092b410ed1631094bd5566f23e2fdb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit a30ce157eade9c19c078b76ad106144d4ba73122
Merge: c313cab 94faa5f
Author: Stefan Monnier <address@hidden>
Date:   Wed Aug 21 21:49:20 2013 -0400

    Sync with enwc/master

diff --cc packages/enwc/Makefile
index 0000000,81495bf..46a2c68
mode 000000,100644..100644
--- a/packages/enwc/Makefile
+++ b/packages/enwc/Makefile
@@@ -1,0 -1,44 +1,44 @@@
+ # This is part of ENWC
+ #
 -#  Copyright (C) 2012 Ian Dunn.
++#  Copyright (C) 2012-2013 Free Software Foundation, Inc.
+ #
+ #  This program 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 3 of the License, or
+ #  (at your option) any later version.
+ #
+ #  This program 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/>.
+ 
 -LISPDIR=lisp
++LISPDIR=./
+ DOCDIR=doc/
+ 
+ ALLSRC=$(wildcard $(LISPDIR)/*.el)
+ ALLELC=$(wildcard $(LISPDIR)/*.elc)
+ 
+ PREFIX=/usr/local
+ INFODIR=$(PREFIX)/info
+ SITELISP=$(PREFIX)/share/emacs/site-lisp/enwc
+ 
+ .PHONY: all install lisp clean
+ .PRECIOUS: %.elc
+ all: lisp
+ 
+ lisp:
 -      $(MAKE) -C $(LISPDIR)
++      #$(MAKE) -C $(LISPDIR)
+ 
+ install:
+       install -m 644 $(ALLELC) $(SITELISP)
+       install -m 644 $(ALLSRC) $(SITELISP)
+ 
+ uninstall:
+       -rm -f $(SITELISP)/*.elc
+       -rm -f $(SITELISP)/*.el
+ 
+ clean:
+       $(MAKE) -C $(LISPDIR) clean
diff --cc packages/enwc/enwc.el
index 69517ca,a131516..ab48a19
--- a/packages/enwc/enwc.el
+++ b/packages/enwc/enwc.el
@@@ -4,6 -4,6 +4,7 @@@
  
  ;; Author: Ian Dunn
  ;; Keywords: enwc, network, wicd, manager, nm
++;; Version: 1.0
  
  ;; This file is part of ENWC
  

commit 94faa5f7dde74d44ea5cd4e05fa17a093d1e99db
Author: Ian D <address@hidden>
Date:   Fri Apr 5 08:58:48 2013 -0400

    Fixed D-Bus calls for enwc-get-wireless-nw-props.

diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
old mode 100644
new mode 100755
index f946b41..e7388d2
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -24,7 +24,7 @@
 
 
 ;;; Commentary:
-
+;; TODO
 
 (require 'enwc)
 
@@ -74,7 +74,7 @@ the wicd wireless interface."
         enwc-wicd-dbus-wireless-path
         enwc-wicd-dbus-wireless-interface
         method
-        :timeout 2000
+        :timeout 25000
         args))
 
 (defun enwc-wicd-dbus-wired-call-method (method &rest args)
@@ -96,17 +96,49 @@ the wicd wired interface."
   "Wicd get networks function.  Just returns a number sequence."
   (number-sequence 0 (1- (enwc-wicd-dbus-wireless-call-method 
"GetNumberOfNetworks"))))
 
+(defvar enwc-wicd-prop-values nil)
+(defvar enwc-wicd-prop-num 0)
+
+(defun enwc-wicd-nw-prop-handler (&rest args)
+  (setq enwc-wicd-prop-values (cons args enwc-wicd-prop-values))
+  (setq enwc-wicd-prop-num (1+ enwc-wicd-prop-num)))
+
 (defun enwc-wicd-get-wireless-network-property (id prop)
   "Wicd get wireless network property function.
 This calls the D-Bus method on Wicd to get the property PROP
 from wireless network with id ID."
-  (enwc-wicd-dbus-wireless-call-method "GetWirelessProperty"
-                                      id prop))
+  (dbus-call-method-asynchronously :system
+                                  enwc-wicd-dbus-service
+                                  enwc-wicd-dbus-wireless-path
+                                  enwc-wicd-dbus-wireless-interface
+                                  "GetWirelessProperty"
+                                  'enwc-wicd-nw-prop-handler
+                                  :int32 id
+                                  :string prop)
+
+  ;;(enwc-wicd-dbus-wireless-call-method "GetWirelessProperty" id prop)
+  )
+
+(defun enwc-wicd-build-prop-list (prop-list det-list)
+  (let (ret
+       (act-det-list (reverse det-list)))
+    (while prop-list
+      (let ((cur-prop (pop prop-list))
+           (cur-det (pop act-det-list)))
+       (setq ret (append ret (cons (cons cur-det (car cur-prop)) nil)))
+       ))
+    ret))
 
 (defun enwc-wicd-get-wireless-nw-props (id)
-  (mapcar (lambda (x)
-           (cons x (enwc-wicd-get-wireless-network-property id x)))
-         enwc-wicd-details-list))
+  (setq enwc-wicd-prop-values nil)
+  (setq enwc-wicd-prop-num 0)
+  (mapc (lambda (x)
+           (enwc-wicd-get-wireless-network-property id x))
+         enwc-wicd-details-list)
+  ;; Wait for less than a second.
+  (while (< enwc-wicd-prop-num 6)
+    (read-event nil nil 0.001))
+  (enwc-wicd-build-prop-list enwc-wicd-prop-values enwc-wicd-details-list))
 
 (defun enwc-wicd-get-encryption-type (id)
   "Wicd get encryption type function.
@@ -212,7 +244,7 @@ This function is a wrapper around the 
*-get-(wired|wireless)-nw-prop
 functions, allowing for a single function that checks for wired."
   (if wired
       (enwc-wicd-get-wired-nw-prop id ent)
-  (enwc-wicd-get-wireless-network-property id ent)))
+    (enwc-wicd-dbus-wireless-call-method "GetWirelessProperty" id ent)))
 
 (defun enwc-wicd-get-nw-info (wired id)
   (let ((dns-list (enwc-wicd-get-dns wired id)))
@@ -293,9 +325,11 @@ the network with id ID."
       (if (eq state 0)
          (setq enwc-wicd-current-ap ""
                enwc-wicd-current-nw-id -1)
-       (setq enwc-wicd-current-ap (caadr info)
+       (setq enwc-wicd-current-ap (car (cadr info))
              enwc-wicd-current-nw-id (or (and info
-                                              (string-to-number (caar (cdddr 
info))))
+                                              (nthcdr 3 info)
+                                              (caar (nthcdr 3 info))
+                                              (string-to-number (caar (nthcdr 
3 info))))
                                          -1)))
   ))
 

commit d1a35cdce616a4c2859b5d0726a86b099dda8864
Author: Ian D <address@hidden>
Date:   Fri Apr 5 07:45:26 2013 -0400

    Updated copyright message.

diff --git a/lisp/enwc-cm.el b/lisp/enwc-cm.el
index e5a1663..975c9f9 100644
--- a/lisp/enwc-cm.el
+++ b/lisp/enwc-cm.el
@@ -1,6 +1,6 @@
 ;; enwc-cm.el
 
-;; Copyright (C) 2012 Ian Dunn
+;; Copyright (C) 2012,2013 Free Software Foundation
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index fe8f147..790eaec 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 Ian Dunn
+;; Copyright (C) 2012,2013 Free Software Foundation
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index 0062eff..c0e3ac2 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 Ian Dunn
+;; Copyright (C) 2012,2013 Free Software Foundation
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index f1fd90d..f946b41 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 Ian Dunn
+;; Copyright (C) 2012,2013 Free Software Foundation
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 6a3d647..a131516 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -1,6 +1,6 @@
 ;;; enwc.el --- The Emacs Network Client
 
-;; Copyright (C) 2012 Ian Dunn
+;; Copyright (C) 2012,2013 Free Software Foundation
 
 ;; Author: Ian Dunn
 ;; Keywords: enwc, network, wicd, manager, nm
@@ -977,7 +977,7 @@ and redisplays the settings from the network profile
     map)
   "The keymap for editable fields within the ENWC edit buffer.")
 
-(define-derived-mode enwc-mode tabulated-list-mode "*ENWC*"
+(define-derived-mode enwc-mode tabulated-list-mode "enwc"
   "Mode for working with network connections.
 \\{enwc-mode-map}"
   ;;(setq buffer-read-only t)

commit b93e4deb7768b2ee02f00852866d123cc909cf53
Author: Ian D <address@hidden>
Date:   Wed Mar 20 15:09:48 2013 -0400

    Fixed up some more parts of new display.

diff --git a/lisp/enwc.el b/lisp/enwc.el
index 65484e4..6a3d647 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -717,7 +717,7 @@ Moves to the enwc buffer if necessary."
   (interactive)
   (if (not (eq major-mode 'enwc-mode))
       (enwc-setup-buffer))
-  (let ((id (- (line-number-at-pos) 2)))
+  (let ((id (- (line-number-at-pos) 1)))
     (enwc-connect-to-network id)))
 
 (defun enwc-disconnect ()
@@ -950,7 +950,7 @@ and redisplays the settings from the network profile
 (defun enwc-edit-entry-at-point ()
   "Edit the current network entry."
   (interactive)
-  (setq enwc-edit-id (- (line-number-at-pos) 2))
+  (setq enwc-edit-id (- (line-number-at-pos) 1))
   (select-window (split-window))
   (enwc-setup-edit-buffer))
 

commit 2fd97d468c13d81e233df4d5c013fdd1f1fb49f3
Author: Ian D <address@hidden>
Date:   Wed Mar 20 15:06:44 2013 -0400

    Updated display to use tabulated list.

diff --git a/lisp/enwc.el b/lisp/enwc.el
index 59a9856..65484e4 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -41,6 +41,7 @@
 
 (require 'dbus)
 (require 'wid-edit)
+(require 'tabulated-list)
 
 ;;; Code:
 
@@ -62,7 +63,7 @@
   :group 'enwc
   :type 'string)
 
-(defcustom enwc-backends '(nm wicd)
+(defcustom enwc-backends '(wicd nm)
   "The list of backends to be used by ENWC.
 These will be checked in the order designated here,
 and the first active backend found will be used."
@@ -183,6 +184,11 @@ bssid, mode, and channel.")
 This is altered every second to display the current network strength
 in `enwc-update-mode-line'.")
 
+;; (setq tabulated-list-format (vector `("ID" ,enwc-id-width sort) ...))
+;; (setq tabulated-list-entries `((,id [id str essid encrypt ...]) ...))
+;; (tabulated-list-init-header)
+;; (tabulated-list-print)
+
 (defvar enwc-wireless-headers '("ID" "STR" "ESSID"
                                "ENCRYPT" "BSSID" "MODE" "CHNL")
   "The list of headers to be displayed in the ENWC buffer.
@@ -225,6 +231,8 @@ whether or not ENWC is in wired mode.")
 
 (defvar enwc-scan-requested nil)
 
+(defvar enwc-scan-interactive nil)
+
 (make-local-variable 'enwc-edit-id)
 ;; The Fonts
 
@@ -407,7 +415,9 @@ This is initiated during setup, and runs once every second."
     (setq str
          (if (enwc-is-wired-p)
              100
-           (if (enwc-is-valid-nw-id cur-id)
+           (if (and
+                (enwc-is-valid-nw-id cur-id)
+                enwc-last-scan)
                (cdr (assoc "quality" (nth cur-id enwc-last-scan)))
              0)))
     (setq enwc-display-string (concat " ["
@@ -426,6 +436,7 @@ This initiates a scan using D-Bus, then exits,
 waiting for the callback."
   (message "Scanning...")
   (setq enwc-scan-requested t)
+  (setq enwc-scan-done nil)
   (enwc-do-scan))
 
 (defun enwc-process-scan (&rest args)
@@ -442,12 +453,10 @@ the scan results."
       (setq enwc-last-scan
            (mapcar (lambda (x)
                      (let ((ret-itm (cons (cons "id" cur-id) nil))
-                           (prop-list (enwc-get-wireless-nw-props x))
-                           )
+                           (prop-list (enwc-get-wireless-nw-props x)))
                        (setq cur-id (1+ cur-id))
                        (dolist (det enwc-details-list)
-                         (let (;;(cur-item (enwc-get-wireless-nw-prop x det))
-                               (cur-item (cdr (assoc det prop-list)))
+                         (let ((cur-item (cdr (assoc det prop-list)))
                                (ident (enwc-detail-to-ident det))
                                pos-len)
                            (if (string= ident "essid")
@@ -460,8 +469,7 @@ the scan results."
                                (setq cur-item
                                      (if cur-item
                                          (enwc-get-encryption-type x)
-                                       "Unsecured"))
-                             )
+                                       "Unsecured")))
                            (setq ret-itm (append ret-itm
                                                  (cons (cons ident
                                                              cur-item)
@@ -469,9 +477,13 @@ the scan results."
                        ret-itm))
                    (number-sequence 0 (1- (length enwc-access-points))))))
     (setq enwc-essid-width (1+ enwc-essid-width))
-    (enwc-display-wireless-networks enwc-last-scan)
-    (goto-char 0)
-    (forward-line)))
+    (setq enwc-scan-done t)
+    (if enwc-scan-interactive
+       (progn
+         (enwc-display-wireless-networks enwc-last-scan)
+         ;;(goto-char 0)
+         ;;(forward-line)
+         ))))
 
 (defun enwc-scan-internal-wired ()
   "The scanning routine for a wired connection.
@@ -523,53 +535,85 @@ ENT is the entry, and WIDTH is the column width."
 
 (defun enwc-display-wireless-networks (networks)
   "Displays the networks in the list NETWORKS in the current buffer.
-NETWORKS must be in the format returned
- by `enwc-scan-internal-wireless'."
+NETWORKS must be in the format returned by
+`enwc-scan-internal-wireless'."
   (if (not (eq major-mode 'enwc-mode))
           (enwc-setup-buffer))
   (if (not (listp networks))
       (error "NETWORKS must be a list of association lists."))
-  (let ((inhibit-read-only t)
-       (cur-id (enwc-get-current-nw-id)))
-    (erase-buffer)
+  (let (;;(inhibit-read-only t)
+       (cur-id (enwc-get-current-nw-id))
+       entries)
+    ;;(erase-buffer)
     (let ((header enwc-wireless-headers)
          (pos 0))
 
-      (dolist (hd header)
-       (insert (propertize hd 'face 'enwc-header-face))
-       (setq pos (length hd))
-       (insert-char 32 (- (symbol-value (intern (concat "enwc-"
-                                                        (downcase hd)
-                                                        "-width")))
-                          pos))))
-    (insert "\n")
-
+      (setq tabulated-list-format
+           (vector '("ID" 2)
+                   '("STR" 4)
+                   `("ESSID" ,enwc-essid-width)
+                   '("ENCRYPT" 9)
+                   '("BSSID" 17)
+                   '("MODE" 15)
+                   '("CHNL" 2)))
+
+      ;; (dolist (hd header)
+      ;;       (insert (propertize hd 'face 'enwc-header-face))
+      ;;       (setq pos (length hd))
+      ;;       (insert-char 32 (- (symbol-value (intern (concat "enwc-"
+      ;;                                                        (downcase hd)
+      ;;                                                        "-width")))
+      ;;                          pos)))
+      )
+    ;;(insert "\n")
+
+    ;;TODO: Setup faces.
     (dolist (nw networks)
-      (let* ((id (propertize (number-to-string (cdr (assoc "id" nw)))
-                            'width enwc-id-width))
-            (str (propertize (concat (number-to-string (cdr (assoc "quality"
-                                                                   nw)))
-                                     "%")
-                             'width enwc-str-width))
-            (essid (propertize (cdr (assoc "essid" nw))
-                               'width enwc-essid-width))
-            (encrypt (propertize (cdr (assoc "encryption" nw))
-                                 'width enwc-encrypt-width))
-            (bssid (propertize (cdr (assoc "bssid" nw))
-                               'width enwc-bssid-width))
-            (mode (propertize (cdr (assoc "mode" nw))
-                              'width enwc-mode-width))
-            (chnl (propertize (cdr (assoc "channel" nw))
-                              'width enwc-chnl-width))
-            props)
-
-       (setq props (list id str essid encrypt bssid mode chnl))
-
-       (dolist (ent props)
-         (if (eq (string-to-number id) cur-id)
-             (setq ent (propertize ent 'face 'enwc-connected-face)))
-         (enwc-insert-ent ent (get-text-property 0 'width ent)))
-       (insert "\n")))))
+      (let ((id (cdr (assoc "id" nw)))
+           entry)
+       (setq entry (list nil
+                         (vector
+                          (number-to-string (cdr (assoc "id" nw)))
+                          (concat (number-to-string (cdr (assoc "quality" nw)))
+                                  "%")
+                          (cdr (assoc "essid" nw))
+                          (cdr (assoc "encryption" nw))
+                          (cdr (assoc "bssid" nw))
+                          (cdr (assoc "mode" nw))
+                          (cdr (assoc "channel" nw)))))
+       (setq entries (cons entry entries))))
+
+    (setq tabulated-list-entries (nreverse entries))
+    (tabulated-list-init-header)
+
+    ;; (dolist (nw networks)
+    ;;   (let* ((id (propertize (number-to-string (cdr (assoc "id" nw)))
+    ;;                              'width enwc-id-width))
+    ;;              (str (propertize (concat (number-to-string (cdr (assoc 
"quality"
+    ;;                                                                     
nw)))
+    ;;                                       "%")
+    ;;                               'width enwc-str-width))
+    ;;              (essid (propertize (cdr (assoc "essid" nw))
+    ;;                                 'width enwc-essid-width))
+    ;;              (encrypt (propertize (cdr (assoc "encryption" nw))
+    ;;                                   'width enwc-encrypt-width))
+    ;;              (bssid (propertize (cdr (assoc "bssid" nw))
+    ;;                                 'width enwc-bssid-width))
+    ;;              (mode (propertize (cdr (assoc "mode" nw))
+    ;;                                'width enwc-mode-width))
+    ;;              (chnl (propertize (cdr (assoc "channel" nw))
+    ;;                                'width enwc-chnl-width))
+    ;;              props)
+
+    ;;         (setq props (list id str essid encrypt bssid mode chnl))
+
+    ;;         (dolist (ent props)
+    ;;           (if (eq (string-to-number id) cur-id)
+    ;;               (setq ent (propertize ent 'face 'enwc-connected-face)))
+    ;;           (enwc-insert-ent ent (get-text-property 0 'width ent)))
+    ;;         (insert "\n")))
+    (tabulated-list-print)
+    ))
 
 (defun enwc-display-networks (networks)
   "Displays the network in NETWORKS.  This is an entry to the display
@@ -586,12 +630,13 @@ functions, and checks whether or not ENWC is using wired."
   "The frontend of the scanning routine.  Sets up and moves to
 the ENWC buffer if necessary, and scans and displays the networks."
   (interactive)
+  (setq enwc-scan-interactive t)
   (if (not (eq major-mode 'enwc-mode))
       (switch-to-buffer "*ENWC*"))
   (if enwc-using-wired
       (progn
-       (setq enwc-last-scan (enwc-scan-internal))
-       (enwc-display-networks enwc-last-scan)
+       (enwc-scan-internal)
+       ;;(enwc-display-networks enwc-last-scan)
        (goto-char 0)
        (forward-line))
     (enwc-scan-internal)))
@@ -604,6 +649,10 @@ NETWORKS is nil.  If the network is not found, then it 
returns nil.
    When called interactively, this only prints out what it finds.
 Otherwise, it actually returns it."
   (interactive "sNetwork ESSID: ")
+  (if (not (or networks enwc-last-scan))
+      (progn
+       (setq enwc-scan-interactive nil)
+       (enwc-scan-internal)))
   (let ((nets (or networks enwc-last-scan))
        need-break cur-net)
     (if (not nets)
@@ -636,8 +685,9 @@ and checks whether or not ENWC is using wired."
          (enwc-wired-connect id)
          (setq cur-net (nth id (enwc-get-wired-profiles))))
       (enwc-wireless-connect id)
-      (setq cur-net (enwc-get-wireless-nw-prop id "essid")))
-    cur-net))
+      (if enwc-last-scan
+         (setq cur-net (cdr (assoc "essid" (nth id enwc-last-scan)))))
+    cur-net)))
 
 (defun enwc-connect-to-network (net-id)
   "Connects the the network with network id NET-ID.
@@ -927,16 +977,25 @@ and redisplays the settings from the network profile
     map)
   "The keymap for editable fields within the ENWC edit buffer.")
 
+(define-derived-mode enwc-mode tabulated-list-mode "*ENWC*"
+  "Mode for working with network connections.
+\\{enwc-mode-map}"
+  ;;(setq buffer-read-only t)
+  (add-hook 'tabulated-list-revert-hook 'enwc-scan nil t)
+  )
+
 (defun enwc-setup-buffer ()
   "Sets up the ENWC buffer.
 This first checks to see that it exists,
 and if it doesn't, then create it."
   (if (not (get-buffer "*ENWC*"))
       (with-current-buffer (get-buffer-create "*ENWC*")
-       (use-local-map enwc-mode-map)
-       (setq major-mode 'enwc-mode
-             mode-name "enwc")
-       (setq buffer-read-only t)))
+       ;;(use-local-map enwc-mode-map)
+       ;;(setq major-mode 'enwc-mode
+       ;;      mode-name "enwc")
+       (enwc-mode)
+       ;;(setq buffer-read-only t)
+       ))
   (switch-to-buffer "*ENWC*"))
 
 (provide 'enwc)

commit c953374a6370d3a731e64ca3d7b2689f4b053034
Author: Ian D <address@hidden>
Date:   Sun Feb 24 13:42:39 2013 -0500

    Updated display functionality

diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index 52adcc5..f1fd90d 100644
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -62,6 +62,10 @@
   '("essid" "bssid" "quality" "encryption" "mode" "channel")
   "The list of the desired details to be obtained from each network.")
 
+(defvar enwc-wicd-current-ap "")
+
+(defvar enwc-wicd-current-nw-id -1)
+
 (defun enwc-wicd-dbus-wireless-call-method (method &rest args)
   "Calls D-Bus method METHOD with arguments ARGS within
 the wicd wireless interface."
@@ -70,7 +74,7 @@ the wicd wireless interface."
         enwc-wicd-dbus-wireless-path
         enwc-wicd-dbus-wireless-interface
         method
-        :timeout 25000
+        :timeout 2000
         args))
 
 (defun enwc-wicd-dbus-wired-call-method (method &rest args)
@@ -121,7 +125,10 @@ network with id ID."
   "Wicd get current network id function.
 This calls the D-Bus method on Wicd to get the current
 wireless network id."
-  (enwc-wicd-dbus-wireless-call-method "GetCurrentNetworkID"))
+  ;;(enwc-wicd-dbus-wireless-call-method "GetCurrentNetworkID"))
+  (if wired
+      -1
+    enwc-wicd-current-nw-id))
 
 (defun enwc-wicd-check-connecting ()
   "The Wicd check connecting function."
@@ -281,6 +288,17 @@ the network with id ID."
     (enwc-wicd-save-nw-profile wired id))
   )
 
+(defun enwc-wicd-wireless-prop-changed (state info)
+  (if state
+      (if (eq state 0)
+         (setq enwc-wicd-current-ap ""
+               enwc-wicd-current-nw-id -1)
+       (setq enwc-wicd-current-ap (caadr info)
+             enwc-wicd-current-nw-id (or (and info
+                                              (string-to-number (caar (cdddr 
info))))
+                                         -1)))
+  ))
+
 (defun enwc-wicd-setup ()
   ;; Thanks to Michael Albinus for pointing out this signal.
   (dbus-register-signal :system
@@ -288,7 +306,15 @@ the network with id ID."
                        enwc-wicd-dbus-wireless-path
                        enwc-wicd-dbus-wireless-interface
                        "SendEndScanSignal"
-                       'enwc-process-scan))
+                       'enwc-process-scan)
+
+  (dbus-register-signal :system
+                       enwc-wicd-dbus-service
+                       "/org/wicd/daemon"
+                       enwc-wicd-dbus-service
+                       "StatusChanged"
+                       'enwc-wicd-wireless-prop-changed)
+  )
 
 (provide 'enwc-wicd)
 

commit 5491e1e53d306b6e4bcb37f10d112ffe637b401c
Author: Ian D <address@hidden>
Date:   Fri Jan 25 08:22:27 2013 -0500

    Fixed up NetworkManager settings support.

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 909f3b1..fe8f147 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -679,6 +679,14 @@ Sets up the encryption type passed in through SETTINGS."
        (setq ret-list (append ret-list (list name-list)))
       (setcdr (assoc key-name ret-list) (list name-list)))
 
+
+    (if (or (string= enctype "eap-leap")
+           (string= enctype "eap-peap")
+           (string= enctype "eap-tls")
+           (string= enctype "eap-ttls"))
+       (setcdr (assoc "eap" (cadr (assoc "802-1x" ret-list)))
+               (cons (cons (cons (substring enctype 4) nil) nil) nil)))
+
     ret-list))
 
 (defun enwc-nm-finalize-settings (settings)
@@ -787,7 +795,7 @@ to put it in the form that NetworkManager will recognize."
 
     (if (= (length (cdr (assoc "addr" settings))) 0)
        (setcdr (assoc "addresses" (cadr (assoc "ipv4" props)))
-               (cons nil nil))
+               (cons (cons nil nil) nil))
 
       (setcdr (assoc "addresses" (cadr (assoc "ipv4" props)))
              (list (list (list (list (enwc-nm-addr-back
@@ -800,7 +808,7 @@ to put it in the form that NetworkManager will recognize."
 
     (if (= (length (cdr (assoc "dns1" settings))) 0)
        (setcdr (assoc "dns" (cadr (assoc "ipv4" props)))
-               (cons nil nil))
+               (cons (cons nil nil) nil))
       (setcdr (assoc "dns" (cadr (assoc "ipv4" props)))
              (list (list (list (enwc-nm-addr-back
                                 (cdr (assoc "dns1" settings)))
@@ -818,15 +826,19 @@ ID is the network id of the profile to save,
 WIRED denotes whether or not this is a wired profile,
 and SETTINGS is the list of settings."
   (let ((mod-sets (enwc-nm-setup-settings wired id settings)))
-    (if (not nil)
-       (dbus-call-method :system
-                         enwc-nm-dbus-service
-                         (nth id enwc-access-points)
-                         enwc-nm-dbus-connections-interface
-                         (if (not enwc-nm-edit-info) "AddConnection"
-                           "Update")
-                         :timeout 25000
-                         :array mod-sets))))
+    (print mod-sets)
+    (print id)
+    (dbus-call-method :system
+                     enwc-nm-dbus-service
+                     ;;(nth id enwc-access-points)
+                     (enwc-nm-get-conn-by-nid id)
+                     enwc-nm-dbus-connections-interface
+                     (if (not enwc-nm-edit-info)
+                         "AddConnection"
+                       "Update")
+                     :timeout 25000
+                     :array mod-sets)
+    ))
 
 (defun enwc-nm-setup ()
   (setq enwc-nm-wired-dev (enwc-nm-get-device-by-name enwc-wired-device)
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 9d5fa15..59a9856 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -745,8 +745,8 @@ WIDGET is always the menu drop-down of security types."
     (if (string= (widget-value widget) "None")
        nil
       (setq type-wid-list
-           (cdr (assoc "reqs"
-                       (cadr (assoc (widget-value widget)
+           (cadr (assoc "reqs"
+                        (cdr (assoc (widget-value widget)
                                     (enwc-get-sec-types enwc-using-wired))))))
       (setq reqs
            (mapcar (lambda (x)
@@ -887,11 +887,12 @@ and redisplays the settings from the network profile
                                       (enwc-get-sec-types 
enwc-using-wired)))))))
     (dolist (x type-wid-list)
       (widget-forward 1)
-      (setq settings
-           (append settings
-                   (cons (cons (car x)
-                               (widget-field-value-get (widget-at)))
-                         nil))))
+      (if (not (string= (widget-field-value-get (widget-at)) ""))
+         (setq settings
+               (append settings
+                       (cons (cons (car x)
+                                   (widget-field-value-get (widget-at)))
+                             nil)))))
     (print settings)
 
     (enwc-save-nw-settings enwc-using-wired enwc-edit-id settings)))

commit 00acff24d08f72cd287831fbc99dc10dea2c0714
Author: Ian D <address@hidden>
Date:   Fri Jan 25 07:57:00 2013 -0500

    Added enwc-get-wireless-nw-props function to speed up NetworkManager 
network display.

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 9a72004..909f3b1 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -96,35 +96,35 @@
 
 (defvar enwc-nm-sec-types
   '(("eap-leap" . (("Name" . "eap-leap")
-                  ("reqs" . (("identity" . "Username")
-                             ("password" . "Password")))))
+                  ("reqs" . ((("identity" . "Username")
+                              ("password" . "Password"))))))
     ("eap-peap" . (("Name" . "eap-peap")
-                  ("reqs" . (("anonymous-identity" . "Anonymous Identity")
-                             ("ca-cert" . "CA Certificate")
-                             ("phase2-auth" . "Inner Authentication")
-                             ("phase1-peapver" . "PEAP Version")
-                             ("identity" . "Username")
-                             ("password" . "Password")))))
+                  ("reqs" . ((("anonymous-identity" . "Anonymous Identity")
+                              ("ca-cert" . "CA Certificate")
+                              ("phase2-auth" . "Inner Authentication")
+                              ("phase1-peapver" . "PEAP Version")
+                              ("identity" . "Username")
+                              ("password" . "Password"))))))
     ("eap-tls" . (("Name" . "eap-tls")
-                 ("reqs" . (("identity" . "Identity")
-                            ("client-cert" . "User Certificate")
-                            ("ca-cert" . "CA Certificate")
-                            ("private-key" . "Private Key")
-                            ("private-key-password" . "Private Key 
Password")))))
-    ("eap-ttls" . (("Name" . "eap-ttls")
-                  ("reqs" . (("anonymous-identity" . "Anonymous Identity")
+                 ("reqs" . ((("identity" . "Identity")
+                             ("client-cert" . "User Certificate")
                              ("ca-cert" . "CA Certificate")
-                             ("phase2-auth" . "Inner Authentication")
-                             ("identity" . "Username")
-                             ("password" . "Password")))))
+                             ("private-key" . "Private Key")
+                             ("private-key-password" . "Private Key 
Password"))))))
+    ("eap-ttls" . (("Name" . "eap-ttls")
+                  ("reqs" . ((("anonymous-identity" . "Anonymous Identity")
+                              ("ca-cert" . "CA Certificate")
+                              ("phase2-auth" . "Inner Authentication")
+                              ("identity" . "Username")
+                              ("password" . "Password"))))))
     ("wpa-psk" . (("Name" . "wpa2")
-                 ("reqs" . (("psk" . "PSK")))))
+                 ("reqs" . ((("psk" . "PSK"))))))
     ("wep" . (("Name" . "wep")
-             ("reqs" . (("wep-key0" . "WEP Key")
-                        ("wep-key-type" . "WEP Key Type")))))
+             ("reqs" . ((("wep-key0" . "WEP Key")
+                         ("wep-key-type" . "WEP Key Type"))))))
     ("leap" . (("Name" . "leap")
-              ("reqs" . (("leap-username" . "Username")
-                         ("leap-password" . "Password")))))
+              ("reqs" . ((("leap-username" . "Username")
+                         ("leap-password" . "Password"))))))
     )
   "The security types for NetworkManager.
 This is still in the process of being worked on."
@@ -145,6 +145,9 @@ This is still in the process of being worked on."
 (defvar enwc-nm-wired-p nil
   "Whether or not NetworkManager is wired.")
 
+(defvar enwc-nm-edit-info nil
+  "The information for the network connection being edited.")
+
 (defun enwc-nm-get-settings (conn)
   "Gets the connection settings.
 CONN is an object path to the connection."
@@ -193,7 +196,8 @@ CONN is an object path to the connection."
              (setq uuid
                    (car (cadr (assoc "uuid"
                                      (cadr (assoc "connection"
-                                                  settings))))))))))))
+                                                  settings))))))))))
+    uuid))
 
 (defun enwc-nm-get-uuid-by-id (id)
   "Gets a network connection's uuid by the network's id.
@@ -264,25 +268,61 @@ This runs like normal, using element ID of 
`enwc-access-points'
 PROP from that access point.  It also sets the channel from the
  frequency if necessary."
   (let ((ap (nth id enwc-access-points))
+       (mod-prop prop)
        ret)
+    (if (string= mod-prop "essid")
+       (setq mod-prop "Ssid"))
     (setq ret (dbus-get-property :system
                                 enwc-nm-dbus-service
                                 ap
                                 enwc-nm-dbus-accesspoint-interface
-                                prop))
-    (if (string= prop "Frequency")
+                                mod-prop))
+    (if (not ret)
+       (progn
+         (if (not enwc-nm-edit-info)
+             (setq ret ""))
+         (progn
+           (setq ret (assoc mod-prop
+                            (cadr (assoc "802-1x"
+                                         enwc-nm-edit-info))))
+           (if (not ret)
+               (setq ret (assoc mod-prop
+                                (cadr (assoc "802-11-wireless-security"
+                                             enwc-nm-edit-info)))))
+           (setq ret (car (cadr ret))))))
+    (if (string= mod-prop "Frequency")
        (setq ret (number-to-string (1+ (/ (- ret 2412) 5)))))
-    (if (string= prop "Ssid")
+    (if (string= mod-prop "Ssid")
        (setq ret (dbus-byte-array-to-string ret)))
-    (if (string= prop "Mode")
+    (if (string= mod-prop "Mode")
        (setq ret (cond ((= ret 0) "Unknown")
                        ((= ret 1) "Ad-Hoc")
                        ((= ret 2) "Infrastructure"))))
     ret))
 
+(defun enwc-nm-get-wireless-nw-props (id)
+  (let ((ap (nth id enwc-access-points))
+       tmp-val
+       ret)
+    (setq ret (dbus-get-all-properties :system
+                                      enwc-nm-dbus-service
+                                      ap
+                                      enwc-nm-dbus-accesspoint-interface))
+    (setq tmp-val (cdr (assoc "Mode" ret)))
+    (setcdr (assoc "Frequency" ret)
+           (number-to-string (1+ (/ (- (cdr (assoc "Frequency" ret))
+                                       2412) 5))))
+    (setcdr (assoc "Ssid" ret)
+           (dbus-byte-array-to-string (cdr (assoc "Ssid" ret))))
+    (setcdr (assoc "Mode" ret)
+           (cond ((= tmp-val 0) "Unkown")
+                 ((= tmp-val 1) "Ad-Hoc")
+                 ((= tmp-val 2) "Infrastructure")))
+    ret))
+
 (defun enwc-nm-get-conn-by-nid (nid)
   "Gets a connection object with the network id NID."
-  (let* ((ssid (enwc-nm-get-wireless-network-property (nth nid 
enwc-access-points)
+  (let* ((ssid (enwc-nm-get-wireless-network-property nid
                                                      "Ssid"))
         (uuid (enwc-nm-get-uuid-by-ssid ssid)))
     (if uuid
@@ -425,21 +465,23 @@ This simply checks for the active access point."
                          (nth 7 hex-nums)))))
 
 (defun enwc-nm-convert-addr (addr)
-  (let* ((hex-addr (format "%08x" addr))
-        (ret-addr (format "%i.%i.%i.%i"
-                          (string-to-number (substring hex-addr
-                                                       6 8)
-                                            16)
-                          (string-to-number (substring hex-addr
-                                                       4 6)
-                                            16)
-                          (string-to-number (substring hex-addr
-                                                       2 4)
-                                            16)
-                          (string-to-number (substring hex-addr
-                                                       0 2)
-                                            16))))
-    ret-addr))
+  (if addr
+      (let* ((hex-addr (format "%08x" addr))
+            (ret-addr (format "%i.%i.%i.%i"
+                              (string-to-number (substring hex-addr
+                                                           6 8)
+                                                16)
+                              (string-to-number (substring hex-addr
+                                                           4 6)
+                                                16)
+                              (string-to-number (substring hex-addr
+                                                           2 4)
+                                                16)
+                              (string-to-number (substring hex-addr
+                                                           0 2)
+                                                16))))
+       ret-addr)
+    ""))
 
 (defun enwc-nm-addr-back (addr)
   (let ((bytes (split-string addr "."))
@@ -458,22 +500,24 @@ This simply checks for the active access point."
 (defun enwc-nm-netmask-to-prefix (netmask)
   "Converts a netmask to a prefix.
 NETMASK is an ip address in network byte order."
-  (let* ((mask netmask)
-        (cur-pos 3)
-        (cur-mark (logand (lsh mask (* -8 cur-pos)) 255))
-        (pf 0))
-    (while (and (eq cur-mark 255) (>= cur-pos 0))
-      (setq pf (+ pf 8))
-      (setq cur-pos (1- cur-pos))
-      (setq cur-mark (logand (lsh mask (* -8 cur-pos)) 255))
-    )
-
-    (if (>= cur-pos 0)
-       (let ((v (logand (lsh mask (* -8 cur-pos)) 255)))
-         (while (not (eq v 0))
-           (setq pf (1+ pf))
-           (setq v (lsh v 1)))))
-    pf))
+  (if netmask
+      (let* ((mask netmask)
+            (cur-pos 3)
+            (cur-mark (logand (lsh mask (* -8 cur-pos)) 255))
+            (pf 0))
+       (while (and (eq cur-mark 255) (>= cur-pos 0))
+         (setq pf (+ pf 8))
+         (setq cur-pos (1- cur-pos))
+         (setq cur-mark (logand (lsh mask (* -8 cur-pos)) 255))
+         )
+
+       (if (>= cur-pos 0)
+           (let ((v (logand (lsh mask (* -8 cur-pos)) 255)))
+             (while (not (eq v 0))
+               (setq pf (1+ pf))
+               (setq v (lsh v 1)))))
+       pf)
+    0))
 
 (defun enwc-nm-prefix-to-netmask (prefix)
   "Converts a prefix to a netmask.
@@ -487,6 +531,49 @@ PREFIX is an integer <= 32."
     (setq pf (1- pf)))
   netmask))
 
+(defun enwc-nm-get-nw-info (wired id)
+  (let ((conn (enwc-nm-get-conn-by-nid id)))
+    (if conn
+       (setq enwc-nm-edit-info
+             (enwc-nm-get-settings conn))))
+
+  (let (ip-addr netmask gateway dns-list nw-info)
+    (if enwc-nm-edit-info
+       (progn
+         (setq ip-addr (nth 0 (caar (cadr (assoc "addresses"
+                                                 (cadr (assoc "ipv4"
+                                                              
enwc-nm-edit-info))))))
+               netmask (nth 3 (caar (cadr (assoc "addresses"
+                                                 (cadr (assoc "ipv4"
+                                                              
enwc-nm-edit-info))))))
+               gateway (nth 2 (caar (cadr (assoc "address"
+                                                 (cadr (assoc "ipv4"
+                                                              
enwc-nm-edit-info))))))
+               dns-list (car (cadr (assoc "dns" (cadr (assoc "ipv4"
+                                                             
enwc-nm-edit-info))))))
+         (setq ip-addr (enwc-nm-convert-addr ip-addr)
+               netmask (enwc-nm-convert-addr netmask)
+               gateway (enwc-nm-convert-addr gateway)
+               dns-list (mapcar 'enwc-nm-convert-addr
+                                dns-list))
+         (setq nw-info (list (cons (cons "addr"
+                                         ip-addr) nil)
+                             (cons (cons "netmask"
+                                         netmask) nil)
+                             (cons (cons "gateway"
+                                         gateway) nil)
+                             (cons (cons "dns1"
+                                         (nth 0
+                                              dns-list))
+                                   nil)
+                             (cons (cons "dns2"
+                                         (nth 1
+                                              dns-list))
+                                   nil)
+                             (cons (cons "enctype"
+                                         "None") nil)
+                             )))
+      nil)))
 
 (defun enwc-nm-get-ip-addr (wired id)
   "Gets the IP Address of a connection profile."
@@ -541,7 +628,7 @@ PREFIX is an integer <= 32."
 Sets up the encryption type passed in through SETTINGS."
   (let* ((ret-list nw-settings)
         (req-list (nthcdr 6 settings))
-        (enctype (assoc "enctype" settings))
+        (enctype (cdr (assoc "enctype" settings)))
         key-mgmt
         new-list name-list
         ;;(name-list (cdr (assoc "reqs" (cdr (assoc enctype 
enwc-nm-sec-types)))))
@@ -565,8 +652,10 @@ Sets up the encryption type passed in through SETTINGS."
        (progn
          (setq key-name "802-1x")
          (setq key-mgmt "ieee8021x")
-         (setcdr (assoc "eap" (cadr (assoc "802-1x" ret-list)))
-                 (list (list (list (substring enctype 3))))))
+         (setq req-list (push (cons "eap" (substring enctype 4)) req-list))
+         (print req-list)
+         ;;(setcdr (assoc "eap" (cadr (assoc "802-1x" ret-list))) (list (list 
(list (substring enctype 4)))))
+         )
       (setq key-name "802-11-wireless-security")
       (setq key-mgmt
            (cond ((string= enctype "wep") "none")
@@ -670,38 +759,56 @@ such as :array, :dict-entry, etc."
 Gets the current network properties of network ID
 and uses the information in the association list SETTINGS
 to put it in the form that NetworkManager will recognize."
-  (let* ((ssid (enwc-nm-get-wireless-network-property (nth id 
enwc-access-points) "Ssid"))
-        (uuid (enwc-nm-get-uuid-by-ssid ssid))
-        conn props)
-
-    (if uuid
-       (setq conn (enwc-nm-get-conn-by-uuid uuid)))
+  (print settings)
+  (let (ssid uuid conn props)
 
-    (setq props
-         (if conn
-             (enwc-nm-get-settings (enwc-nm-get-conn-by-nid id))
-           (enwc-nm-create-settings wired ssid)))
+    (if (not enwc-nm-edit-info)
+       (progn
+         (setq ssid
+               (enwc-nm-get-wireless-network-property (nth id
+                                                           enwc-access-points)
+                                                      "Ssid"))
+         (setq props (enwc-nm-create-settings wired ssid)))
+      (setq props enwc-nm-edit-info))
+
+    (print enwc-nm-edit-info)
+         ;; (setq uuid (enwc-nm-get-uuid-by-ssid ssid))
+         ;; (if uuid
+         ;;     (setq conn (enwc-nm-get-conn-by-uuid uuid)))))
+
+    ;; (setq props
+    ;;           (if conn
+    ;;               (enwc-nm-get-settings (enwc-nm-get-conn-by-nid id))
+    ;;             (enwc-nm-create-settings wired ssid)))
 
     (setcdr (assoc "type" (cadr (assoc "connection" props)))
            (list (list (cond (wired "802-3-ethernet")
                              ((not wired) "802-11-wireless")))))
 
-    (setcdr (assoc "addresses" (cadr (assoc "ipv4" props)))
-           (list (list (list (list (enwc-nm-addr-back
-                                    (cdr (assoc "addr" settings)))
-                                   (enwc-nm-netmask-to-prefix 
(enwc-nm-addr-back
-                                                               (cdr (assoc 
"netmask"
-                                                                           
settings))))
-                                   (enwc-nm-addr-back
-                                    (cdr (assoc "gateway" settings))))))))
-
-    (setcdr (assoc "dns" (cadr (assoc "ipv4" props)))
-           (list (list (list (enwc-nm-addr-back
-                              (cdr (assoc "dns1" settings)))
-                             (enwc-nm-addr-back
-                              (cdr (assoc "dns2" settings)))))))
+    (if (= (length (cdr (assoc "addr" settings))) 0)
+       (setcdr (assoc "addresses" (cadr (assoc "ipv4" props)))
+               (cons nil nil))
+
+      (setcdr (assoc "addresses" (cadr (assoc "ipv4" props)))
+             (list (list (list (list (enwc-nm-addr-back
+                                      (cdr (assoc "addr" settings)))
+                                     (enwc-nm-netmask-to-prefix 
(enwc-nm-addr-back
+                                                                 (cdr (assoc 
"netmask"
+                                                                             
settings))))
+                                     (enwc-nm-addr-back
+                                      (cdr (assoc "gateway" settings)))))))))
+
+    (if (= (length (cdr (assoc "dns1" settings))) 0)
+       (setcdr (assoc "dns" (cadr (assoc "ipv4" props)))
+               (cons nil nil))
+      (setcdr (assoc "dns" (cadr (assoc "ipv4" props)))
+             (list (list (list (enwc-nm-addr-back
+                                (cdr (assoc "dns1" settings)))
+                               (enwc-nm-addr-back
+                                (cdr (assoc "dns2" settings))))))))
 
     (setq props (enwc-nm-process-enctype settings props))
+    (print props)
 
     (enwc-nm-finalize-settings props)))
 
@@ -711,13 +818,15 @@ ID is the network id of the profile to save,
 WIRED denotes whether or not this is a wired profile,
 and SETTINGS is the list of settings."
   (let ((mod-sets (enwc-nm-setup-settings wired id settings)))
-    (dbus-call-method :system
-                     enwc-nm-dbus-service
-                     (nth id enwc-access-points)
-                     enwc-nm-dbus-connections-interface
-                     :timeout 25000
-                     "Update"
-                     mod-sets)))
+    (if (not nil)
+       (dbus-call-method :system
+                         enwc-nm-dbus-service
+                         (nth id enwc-access-points)
+                         enwc-nm-dbus-connections-interface
+                         (if (not enwc-nm-edit-info) "AddConnection"
+                           "Update")
+                         :timeout 25000
+                         :array mod-sets))))
 
 (defun enwc-nm-setup ()
   (setq enwc-nm-wired-dev (enwc-nm-get-device-by-name enwc-wired-device)
@@ -744,7 +853,7 @@ and SETTINGS is the list of settings."
                                          enwc-nm-dbus-wireless-interface
                                          "ActiveAccessPoint")))
          (if (string= cur-net "/")
-             -1
+             "/"
            cur-net)))
 
   (dbus-register-signal :system
diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
index aea9435..0062eff 100644
--- a/lisp/enwc-setup.el
+++ b/lisp/enwc-setup.el
@@ -39,6 +39,9 @@
          enwc-get-wireless-nw-prop-func (intern (concat "enwc-"
                                                         sym-name
                                                         
"-get-wireless-network-property"))
+         enwc-get-wireless-nw-props-func (intern (concat "enwc-"
+                                                         sym-name
+                                                         
"-get-wireless-nw-props"))
          enwc-details-list (symbol-value (intern (concat "enwc-"
                                                          sym-name
                                                          "-details-list")))
@@ -81,6 +84,9 @@
          enwc-get-dns-func (intern (concat "enwc-"
                                            sym-name
                                            "-get-dns"))
+         enwc-get-nw-info-func (intern (concat "enwc-"
+                                               sym-name
+                                               "-get-nw-info"))
          enwc-save-nw-settings-func (intern (concat "enwc-"
                                                     sym-name
                                                     "-save-nw-settings"))
@@ -88,8 +94,9 @@
     (funcall (intern (concat "enwc-" sym-name "-setup")))))
 
 (defun enwc-setup ()
-  "Sets up enwc mode and confirms that one of the backends
- can be found on D-Bus."
+  "Sets up ENWC.
+This setups ENWC and confirms that one of the backends can be found
+on D-Bus."
   (setq global-mode-string (append global-mode-string
                                   '(enwc-display-string)))
   (run-at-time t 1 'enwc-update-mode-line)
diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
index 94067ef..52adcc5 100644
--- a/lisp/enwc-wicd.el
+++ b/lisp/enwc-wicd.el
@@ -99,6 +99,11 @@ from wireless network with id ID."
   (enwc-wicd-dbus-wireless-call-method "GetWirelessProperty"
                                       id prop))
 
+(defun enwc-wicd-get-wireless-nw-props (id)
+  (mapcar (lambda (x)
+           (cons x (enwc-wicd-get-wireless-network-property id x)))
+         enwc-wicd-details-list))
+
 (defun enwc-wicd-get-encryption-type (id)
   "Wicd get encryption type function.
 This calls the D-Bus method on Wicd to get the encryption_method
@@ -202,6 +207,14 @@ functions, allowing for a single function that checks for 
wired."
       (enwc-wicd-get-wired-nw-prop id ent)
   (enwc-wicd-get-wireless-network-property id ent)))
 
+(defun enwc-wicd-get-nw-info (wired id)
+  (let ((dns-list (enwc-wicd-get-dns wired id)))
+    (list (cons (cons "addr" (enwc-wicd-get-ip-addr wired id)) nil)
+         (cons (cons "netmask" (enwc-wicd-get-netmask wired id)) nil)
+         (cons (cons "gateway" (enwc-wicd-get-gateway wired id)) nil)
+         (cons (cons "dns1" (nth 0 dns-list)) nil)
+         (cons (cons "dns2" (nth 1 dns-list)) nil))))
+
 (defun enwc-wicd-get-ip-addr (wired id)
   "Gets the IP Address from the network with id ID.
 Wired is set to indicate whether this is a wired network."
diff --git a/lisp/enwc.el b/lisp/enwc.el
index 7b443f4..9d5fa15 100644
--- a/lisp/enwc.el
+++ b/lisp/enwc.el
@@ -62,7 +62,7 @@
   :group 'enwc
   :type 'string)
 
-(defcustom enwc-backends '(wicd nm)
+(defcustom enwc-backends '(nm wicd)
   "The list of backends to be used by ENWC.
 These will be checked in the order designated here,
 and the first active backend found will be used."
@@ -85,6 +85,8 @@ This is redefined during setup to be the function to get the 
network
 This is redefined during setup to be the function to get
 a wireless network property.")
 
+(defvar enwc-get-wireless-nw-props-func nil)
+
 (defvar enwc-get-encryption-type-func nil
   "A function variable to be used in `enwc-get-encryption-type'.
 This is redefined during setup to be the function to get the encryption
@@ -160,6 +162,8 @@ the Gateway of a given network.")
 This is redefined during setup to be the function to get
 the DNS Server Addresses for a given network.")
 
+(defvar enwc-get-nw-info-func nil)
+
 (defvar enwc-save-nw-settings-func nil
   "The function variable to be used in `enwc-save-nw-settings'.
 This is redefined during setup to be the function to save
@@ -284,6 +288,9 @@ in progress.  Returns `non-NIL' if there is one,
 ID and returns it."
   (funcall enwc-get-wireless-nw-prop-func id prop))
 
+(defun enwc-get-wireless-nw-props (id)
+  (funcall enwc-get-wireless-nw-props-func id))
+
 (defun enwc-get-encryption-type (id)
   "Gets the encryption type used by the wireless
 network with id ID."
@@ -360,6 +367,9 @@ WIRED is set to indicate whether or not this is
 a wired network."
   (funcall enwc-get-dns-func wired id))
 
+(defun enwc-get-nw-info (wired id)
+  (funcall enwc-get-nw-info-func wired id))
+
 (defun enwc-save-nw-settings (wired id settings)
   "Saves network settings SETTINGS to the network profile with
 network id ID.
@@ -431,10 +441,13 @@ the scan results."
            enwc-essid-width 5)
       (setq enwc-last-scan
            (mapcar (lambda (x)
-                     (let ((ret-itm (cons (cons "id" cur-id) nil)))
+                     (let ((ret-itm (cons (cons "id" cur-id) nil))
+                           (prop-list (enwc-get-wireless-nw-props x))
+                           )
                        (setq cur-id (1+ cur-id))
                        (dolist (det enwc-details-list)
-                         (let ((cur-item (enwc-get-wireless-nw-prop x det))
+                         (let (;;(cur-item (enwc-get-wireless-nw-prop x det))
+                               (cur-item (cdr (assoc det prop-list)))
                                (ident (enwc-detail-to-ident det))
                                pos-len)
                            (if (string= ident "essid")
@@ -732,8 +745,8 @@ WIDGET is always the menu drop-down of security types."
     (if (string= (widget-value widget) "None")
        nil
       (setq type-wid-list
-           (cadr (assoc "reqs"
-                        (cdr (assoc (widget-value widget)
+           (cdr (assoc "reqs"
+                       (cadr (assoc (widget-value widget)
                                     (enwc-get-sec-types enwc-using-wired))))))
       (setq reqs
            (mapcar (lambda (x)
@@ -760,6 +773,8 @@ and redisplays the settings from the network profile
       (kill-buffer "*ENWC Edit*"))
   (with-current-buffer (get-buffer-create "*ENWC Edit*")
     (let ((sec-types (enwc-get-sec-types enwc-using-wired))
+         (nw-info (enwc-get-nw-info enwc-using-wired enwc-edit-id))
+         ip-addr netmask gateway dns-1 dns-2
          addr-wid net-wid gate-wid
          dns-1-wid dns-2-wid dns-list
          type-wid type-wid-list)
@@ -770,40 +785,38 @@ and redisplays the settings from the network profile
                                              enwc-last-scan)))
                             "\n"))
       (widget-insert "\n")
+      ;; ip
       (widget-insert "IPv4 Settings:\n")
       (setq addr-wid (widget-create 'editable-field
                                    :format "  Address: %v"
-                                   :value (enwc-get-ip-addr enwc-using-wired
-                                                            enwc-edit-id)))
-      ;;ip
+                                   :value (or (assoc "addr" nw-info) "")))
+      ;; netmask
       (setq net-wid (widget-create 'editable-field
                                   :format "  Netmask: %v"
-                                  :value (enwc-get-netmask enwc-using-wired
-                                                           enwc-edit-id)))
-      ;;netmask
+                                  :value (or (assoc "netmask" nw-info) "")))
+
+      ;; gateway
       (setq gate-wid (widget-create 'editable-field
                                    :format "  Gateway: %v"
-                                   :value (enwc-get-gateway enwc-using-wired
-                                                            enwc-edit-id)))
-      ;;gateway
+                                   :value (or (assoc "gateway" nw-info) "")))
+      ;; dns1
       (widget-insert "\n")
-      (setq dns-list (enwc-get-dns enwc-using-wired enwc-edit-id))
+      ;;(setq dns-list (enwc-get-dns enwc-using-wired enwc-edit-id))
       (setq dns-1-wid (widget-create 'editable-field
                                     :format "    DNS 1: %v"
-                                    :value (nth 0 dns-list)))
-      ;;dns1
+                                    :value (or (assoc "dns1" nw-info) "")))
+
+      ;; dns2
       (setq dns-2-wid (widget-create 'editable-field
                                     :format "    DNS 2: %v"
-                                    :value (nth 1 dns-list)))
-      ;;dns2
+                                    :value (or (assoc "dns2" nw-info) "")))
+
       (widget-insert "\n")
       (widget-insert "Security:\n")
       (setq type-wid (apply 'widget-create
                            'menu-choice
                                    :tag "Type "
-                           :value (enwc-get-nw-prop enwc-using-wired
-                                                    enwc-edit-id
-                                                    "enctype")
+                           :value (or (assoc "enctype" nw-info) "None")
                            :notify 'enwc-display-sec-reqs
                                    '(item :tag "No Encryption"
                                   :value "None")
@@ -879,6 +892,7 @@ and redisplays the settings from the network profile
                    (cons (cons (car x)
                                (widget-field-value-get (widget-at)))
                          nil))))
+    (print settings)
 
     (enwc-save-nw-settings enwc-using-wired enwc-edit-id settings)))
 

commit 936e5a72e4b072e79a3e4eb529fd49dce427a0a8
Author: Ian D <address@hidden>
Date:   Tue Jan 22 13:36:29 2013 -0500

    Updated support for Network Manager and network settings.

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index ff14250..9a72004 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -187,11 +187,17 @@ CONN is an object path to the connection."
            nil
          (setq cur-ssid
                (dbus-byte-array-to-string (car (cadr (assoc "ssid"
-                                                            (cadr (assoc 
"802-11-wireless" settings)))))))
+                                                            (cadr (assoc 
"802-11-wireless"
+                                                                         
settings)))))))
          (if (string= cur-ssid ssid)
-             (setq uuid (car (cadr (assoc "uuid" (cadr (assoc "connection" 
settings))))))))))))
+             (setq uuid
+                   (car (cadr (assoc "uuid"
+                                     (cadr (assoc "connection"
+                                                  settings))))))))))))
 
 (defun enwc-nm-get-uuid-by-id (id)
+  "Gets a network connection's uuid by the network's id.
+ID is a string that NetworkManager uses to identify this network."
   (let ((conns (enwc-nm-list-connections))
        cur-conn cur-id uuid)
     (while (and conns (not uuid))
@@ -218,13 +224,16 @@ CONN is an object path to the connection."
 (defun enwc-nm-get-conn-by-ssid (ssid)
   "Gets the connection path for the access point with ssid SSID."
   (let ((uuid (enwc-nm-get-uuid-by-ssid ssid)))
-    (enwc-nm-get-conn-by-uuid uuid)))
+    (if uuid
+       (enwc-nm-get-conn-by-uuid uuid)
+      nil)))
 
 (defun enwc-nm-get-conn-by-id (id)
+  "Gets a connection object with the id ID.
+ID is the identifier used by Network Manager."
   (let ((uuid (enwc-nm-get-uuid-by-id id)))
     (enwc-nm-get-conn-by-uuid uuid)))
 
-
 ;; Wireless
 (defun enwc-nm-scan ()
   "The NetworkManager scan function."
@@ -271,6 +280,15 @@ PROP from that access point.  It also sets the channel 
from the
                        ((= ret 2) "Infrastructure"))))
     ret))
 
+(defun enwc-nm-get-conn-by-nid (nid)
+  "Gets a connection object with the network id NID."
+  (let* ((ssid (enwc-nm-get-wireless-network-property (nth nid 
enwc-access-points)
+                                                     "Ssid"))
+        (uuid (enwc-nm-get-uuid-by-ssid ssid)))
+    (if uuid
+       (enwc-nm-get-conn-by-uuid uuid)
+      nil)))
+
 (defun enwc-nm-get-encryption-type (id)
   "The NetworkManager get encryption type function.
 This gets the WPA flags and RSN flags from access point in ID.
@@ -386,9 +404,26 @@ This simply checks for the active access point."
   "Get security types."
   (if wired
       nil
-    nil)
+    enwc-nm-sec-types)
   )
 
+(defun enwc-nm-gen-uuid ()
+  (random t)
+  (let ((hex-nums
+        (mapcar (lambda (x)
+                  (random 65535))
+                (number-sequence 0 7)))
+       fin-str)
+    (setq fin-str (format "%04x%04x-%04x-%04x-%04x-%04x%04x%04x"
+                         (nth 0 hex-nums)
+                         (nth 1 hex-nums)
+                         (nth 2 hex-nums)
+                         (nth 3 hex-nums)
+                         (nth 4 hex-nums)
+                         (nth 5 hex-nums)
+                         (nth 6 hex-nums)
+                         (nth 7 hex-nums)))))
+
 (defun enwc-nm-convert-addr (addr)
   (let* ((hex-addr (format "%08x" addr))
         (ret-addr (format "%i.%i.%i.%i"
@@ -452,48 +487,111 @@ PREFIX is an integer <= 32."
     (setq pf (1- pf)))
   netmask))
 
+
 (defun enwc-nm-get-ip-addr (wired id)
   "Gets the IP Address of a connection profile."
-  (let ((props (enwc-nm-get-settings (nth id enwc-access-points)))
+  (let ((props (enwc-nm-get-settings (enwc-nm-get-conn-by-nid id)))
        ipaddr ret-addr)
-    (setq ipaddr (nth 0 (caar (cadr (assoc "addresses"
-                                          (cadr (assoc "ipv4"
-                                                       props)))))))
-    (setq ret-addr (enwc-nm-convert-addr ipaddr))))
+    (if (not props)
+       (setq ret-addr "")
+      (setq ipaddr (nth 0 (caar (cadr (assoc "addresses"
+                                            (cadr (assoc "ipv4"
+                                                         props)))))))
+      (setq ret-addr (enwc-nm-convert-addr ipaddr)))))
 
 (defun enwc-nm-get-netmask (wired id)
   "Gets the Netmask of a connection profile."
-  (let ((props (enwc-nm-get-settings (nth id enwc-access-points)))
+  (let ((props (enwc-nm-get-settings (enwc-nm-get-conn-by-nid id)))
        ipaddr hex-addr ret-addr)
-    (setq ipaddr (nth 3 (caar (cadr (assoc "addresses"
-                                          (cadr (assoc "ipv4"
-                                                       props)))))))
-    (setq hex-addr (enwc-nm-prefix-to-netmask ipaddr))
-    (setq ret-addr (format "%i.%i.%i.%i"
-                          (logand hex-addr 255)
-                          (logand (lsh hex-addr -8) 255)
-                          (logand (lsh hex-addr -16) 255)
-                          (logand (lsh hex-addr -24) 255)))))
+    (if (not props)
+       (setq ret-addr "")
+      (setq ipaddr (nth 3 (caar (cadr (assoc "addresses"
+                                            (cadr (assoc "ipv4"
+                                                         props)))))))
+      (setq hex-addr (enwc-nm-prefix-to-netmask ipaddr))
+      (setq ret-addr (format "%i.%i.%i.%i"
+                            (logand hex-addr 255)
+                            (logand (lsh hex-addr -8) 255)
+                            (logand (lsh hex-addr -16) 255)
+                            (logand (lsh hex-addr -24) 255))))))
     
 
 (defun enwc-nm-get-gateway (wired id)
   "Gets the Gateway of a connection profile."
-  (let ((props (enwc-nm-get-settings (nth id enwc-access-points)))
+  (let ((props (enwc-nm-get-settings (enwc-nm-get-conn-by-nid id)))
        ipaddr ret-addr)
-    (setq ipaddr (nth 2 (caar (cadr (assoc "addresses"
-                                          (cadr (assoc "ipv4"
-                                                       props)))))))
-    (setq ret-addr (enwc-nm-convert-addr ipaddr))))
+    (if (not props)
+       (setq ret-addr "")
+      (setq ipaddr (nth 2 (caar (cadr (assoc "addresses"
+                                            (cadr (assoc "ipv4"
+                                                         props)))))))
+      (setq ret-addr (enwc-nm-convert-addr ipaddr)))))
 
 (defun enwc-nm-get-dns (wired id)
   "Gets the DNS settings of a connection profile."
-  (let ((props (enwc-nm-get-settings (nth id enwc-access-points)))
+  (let ((props (enwc-nm-get-settings (enwc-nm-get-conn-by-nid id)))
        dns-list)
     (setq dns-list (car (cadr (assoc "dns" (cadr (assoc "ipv4"
                                                        props))))))
     (mapcar 'enwc-nm-convert-addr
            dns-list)))
 
+(defun enwc-nm-process-enctype (settings nw-settings)
+  "Process the encryption type.
+Sets up the encryption type passed in through SETTINGS."
+  (let* ((ret-list nw-settings)
+        (req-list (nthcdr 6 settings))
+        (enctype (assoc "enctype" settings))
+        key-mgmt
+        new-list name-list
+        ;;(name-list (cdr (assoc "reqs" (cdr (assoc enctype 
enwc-nm-sec-types)))))
+        key-name)
+
+    ;; There is a possibility that any of these don't exist in
+    ;; nw-settings.
+
+    (setq new-list `("802-11-wireless-security" (("pairwise" (("wep40" 
"wep104")))
+                                                ("group" (("wep40" "wep104")))
+                                                ("auth-alg" (nil))
+                                                ("key-mgmt" (nil)))))
+
+    (if (not (assoc "802-11-wireless-security" ret-list))
+       (setq ret-list (append ret-list (list new-list))))
+
+    (if (or (string= enctype "eap-leap")
+           (string= enctype "eap-peap")
+           (string= enctype "eap-tls")
+           (string= enctype "eap-ttls"))
+       (progn
+         (setq key-name "802-1x")
+         (setq key-mgmt "ieee8021x")
+         (setcdr (assoc "eap" (cadr (assoc "802-1x" ret-list)))
+                 (list (list (list (substring enctype 3))))))
+      (setq key-name "802-11-wireless-security")
+      (setq key-mgmt
+           (cond ((string= enctype "wep") "none")
+                 ((string= enctype "wpa-psk") "wpa-psk")
+                 ((string= enctype "leap") "iee8021x"))))
+    (setcdr (assoc "key-mgmt" (cadr (assoc "802-11-wireless-security" 
ret-list)))
+           (list (list key-mgmt)))
+
+    (if (string= enctype "leap")
+       (setcdr (assoc "auth-alg" (cadr (assoc "802-11-wireless-security" 
ret-list)))
+               (list (list "leap"))))
+
+    (setq name-list (cons key-name
+                         (list (mapcar (lambda (x)
+                                         (cons (car x)
+                                               (cons (cons (cdr x) nil)
+                                                     nil)))
+                                       req-list))))
+
+    (if (not (assoc key-name ret-list))
+       (setq ret-list (append ret-list (list name-list)))
+      (setcdr (assoc key-name ret-list) (list name-list)))
+
+    ret-list))
+
 (defun enwc-nm-finalize-settings (settings)
   "Sets up all of the D-BUS types of a settings list.
 SETTINGS is the list of settings list to setup.
@@ -526,10 +624,68 @@ such as :array, :dict-entry, etc."
                settings)
          (nreverse first-one))))
 
+(defun enwc-nm-create-settings (wired ssid)
+  (let ((uuid (enwc-nm-gen-uuid))
+       (id (concat ssid " settings"))
+       type
+       ret-list
+       conn-list
+       ipv4-list ipv6-list
+       mod-list
+       new-ssid
+       80211-list)
+
+    (if (not wired)
+       (setq new-ssid (dbus-string-to-byte-array ssid))
+       (progn
+         (setq 80211-list `("802-11-wireless" (("security" (nil))
+                                               ("ssid" (,new-ssid))
+                                               ("mode" ("infrastructure")))))
+
+         (setq ret-list (append ret-list (list 80211-list))
+               type "802-11-wireless"))
+      (setq type "802-3-ethernet"))
+    (setq conn-list `("connection" (("id" (,id))
+                                   ("uuid" (,uuid))
+                                   ("autoconnect" (nil))
+                                   ("type" (,type)))))
+
+    (setq ipv4-list '("ipv4" (("addresses" (nil))
+                             ("dns" (nil))
+                             ("method" ("auto"))
+                             ("routes" (nil)))))
+
+    (setq ipv6-list '("ipv4" (("addresses" (nil))
+                             ("dns" (nil))
+                             ("method" ("auto"))
+                             ("routes" (nil)))))
+
+    (setq ret-list (append ret-list (list conn-list)))
+    (setq ret-list (append ret-list (list ipv4-list)))
+    (setq ret-list (append ret-list (list ipv6-list)))
+    ))
+
+(defun enwc-nm-setup-settings (wired id settings)
+  "Sets up NetworkManager settings.
+Gets the current network properties of network ID
+and uses the information in the association list SETTINGS
+to put it in the form that NetworkManager will recognize."
+  (let* ((ssid (enwc-nm-get-wireless-network-property (nth id 
enwc-access-points) "Ssid"))
+        (uuid (enwc-nm-get-uuid-by-ssid ssid))
+        conn props)
+
+    (if uuid
+       (setq conn (enwc-nm-get-conn-by-uuid uuid)))
+
+    (setq props
+         (if conn
+             (enwc-nm-get-settings (enwc-nm-get-conn-by-nid id))
+           (enwc-nm-create-settings wired ssid)))
+
+    (setcdr (assoc "type" (cadr (assoc "connection" props)))
+           (list (list (cond (wired "802-3-ethernet")
+                             ((not wired) "802-11-wireless")))))
 
-(defun enwc-nm-setup-settings (id settings)
-  (let ((props (enwc-nm-get-settings (nth id enwc-access-points)))
-       ret-list)
     (setcdr (assoc "addresses" (cadr (assoc "ipv4" props)))
            (list (list (list (list (enwc-nm-addr-back
                                     (cdr (assoc "addr" settings)))
@@ -538,25 +694,30 @@ such as :array, :dict-entry, etc."
                                                                            
settings))))
                                    (enwc-nm-addr-back
                                     (cdr (assoc "gateway" settings))))))))
+
     (setcdr (assoc "dns" (cadr (assoc "ipv4" props)))
            (list (list (list (enwc-nm-addr-back
                               (cdr (assoc "dns1" settings)))
                              (enwc-nm-addr-back
                               (cdr (assoc "dns2" settings)))))))
-    ))
+
+    (setq props (enwc-nm-process-enctype settings props))
+
+    (enwc-nm-finalize-settings props)))
 
 (defun enwc-nm-save-nw-settings (wired id settings)
   "Saves network settings.
 ID is the network id of the profile to save,
 WIRED denotes whether or not this is a wired profile,
 and SETTINGS is the list of settings."
-  (dbus-call-method :system
-                   enwc-nm-dbus-service
-                   (nth id enwc-access-points)
-                   enwc-nm-dbus-connections-interface
-                   :timeout 25000
-                   "Update"
-                   (enwc-nm-setup-settings id settings)))
+  (let ((mod-sets (enwc-nm-setup-settings wired id settings)))
+    (dbus-call-method :system
+                     enwc-nm-dbus-service
+                     (nth id enwc-access-points)
+                     enwc-nm-dbus-connections-interface
+                     :timeout 25000
+                     "Update"
+                     mod-sets)))
 
 (defun enwc-nm-setup ()
   (setq enwc-nm-wired-dev (enwc-nm-get-device-by-name enwc-wired-device)

commit 2a977ad3baf4b5678bc536bd8453a308f818ff3a
Author: Ian D <address@hidden>
Date:   Thu Jan 10 11:11:13 2013 -0500

    Cleaned compiled files.

diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
index 82594eb..ff14250 100644
--- a/lisp/enwc-nm.el
+++ b/lisp/enwc-nm.el
@@ -96,13 +96,15 @@
 
 (defvar enwc-nm-sec-types
   '(("eap-leap" . (("Name" . "eap-leap")
-                  ("reqs" . (("username" . "Username")
+                  ("reqs" . (("identity" . "Username")
                              ("password" . "Password")))))
     ("eap-peap" . (("Name" . "eap-peap")
                   ("reqs" . (("anonymous-identity" . "Anonymous Identity")
                              ("ca-cert" . "CA Certificate")
                              ("phase2-auth" . "Inner Authentication")
-                             ("phase1-peapver" . "PEAP Version")))))
+                             ("phase1-peapver" . "PEAP Version")
+                             ("identity" . "Username")
+                             ("password" . "Password")))))
     ("eap-tls" . (("Name" . "eap-tls")
                  ("reqs" . (("identity" . "Identity")
                             ("client-cert" . "User Certificate")
@@ -112,11 +114,14 @@
     ("eap-ttls" . (("Name" . "eap-ttls")
                   ("reqs" . (("anonymous-identity" . "Anonymous Identity")
                              ("ca-cert" . "CA Certificate")
-                             ("phase2-auth" . "Inner Authentication")))))
-    ("wpa" . (("Name" . "wpa2")
-             ("reqs" . (("psk" . "PSK")))))
+                             ("phase2-auth" . "Inner Authentication")
+                             ("identity" . "Username")
+                             ("password" . "Password")))))
+    ("wpa-psk" . (("Name" . "wpa2")
+                 ("reqs" . (("psk" . "PSK")))))
     ("wep" . (("Name" . "wep")
-             ("reqs" . (("wep-key0" . "WEP Key")))))
+             ("reqs" . (("wep-key0" . "WEP Key")
+                        ("wep-key-type" . "WEP Key Type")))))
     ("leap" . (("Name" . "leap")
               ("reqs" . (("leap-username" . "Username")
                          ("leap-password" . "Password")))))
diff --git a/lisp/enwc-nm.elc b/lisp/enwc-nm.elc
deleted file mode 100644
index 4e37941..0000000
Binary files a/lisp/enwc-nm.elc and /dev/null differ
diff --git a/lisp/enwc-setup.elc b/lisp/enwc-setup.elc
deleted file mode 100644
index a7829b3..0000000
Binary files a/lisp/enwc-setup.elc and /dev/null differ
diff --git a/lisp/enwc-wicd.elc b/lisp/enwc-wicd.elc
deleted file mode 100644
index 9ea32bd..0000000
Binary files a/lisp/enwc-wicd.elc and /dev/null differ
diff --git a/lisp/enwc.elc b/lisp/enwc.elc
deleted file mode 100644
index 54f8cb2..0000000
Binary files a/lisp/enwc.elc and /dev/null differ

commit 3d959b8ffb2a60c44b4d24c4690da4fa45252684
Author: Ian D <address@hidden>
Date:   Wed Dec 26 10:30:45 2012 -0500

    Initial Import

diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program 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 3 of the License, or
+    (at your option) any later version.
+
+    This program 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/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..81495bf
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,44 @@
+# This is part of ENWC
+#
+#  Copyright (C) 2012 Ian Dunn.
+#
+#  This program 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 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program 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/>.
+
+LISPDIR=lisp
+DOCDIR=doc/
+
+ALLSRC=$(wildcard $(LISPDIR)/*.el)
+ALLELC=$(wildcard $(LISPDIR)/*.elc)
+
+PREFIX=/usr/local
+INFODIR=$(PREFIX)/info
+SITELISP=$(PREFIX)/share/emacs/site-lisp/enwc
+
+.PHONY: all install lisp clean
+.PRECIOUS: %.elc
+all: lisp
+
+lisp:
+       $(MAKE) -C $(LISPDIR)
+
+install:
+       install -m 644 $(ALLELC) $(SITELISP)
+       install -m 644 $(ALLSRC) $(SITELISP)
+
+uninstall:
+       -rm -f $(SITELISP)/*.elc
+       -rm -f $(SITELISP)/*.el
+
+clean:
+       $(MAKE) -C $(LISPDIR) clean
diff --git a/doc/connman.txt b/doc/connman.txt
new file mode 100644
index 0000000..dafbe38
--- /dev/null
+++ b/doc/connman.txt
@@ -0,0 +1,7 @@
+net.connman.Manager.GetTechnologies():
+
+(("/net/connman/technology/ethernet" (("Name" ("Wired")) ("Type" ("ethernet")) 
("Powered" (t)) ("Connected" (nil)) ("Tethering" (nil)))) 
("/net/connman/technology/wifi" (("Name" ("WiFi")) ("Type" ("wifi")) ("Powered" 
(t)) ("Connected" (nil)) ("Tethering" (nil)))))
+
+net.connman.Manager.GetServices():
+
+(("/net/connman/service/wifi_0026b6e6518e_7270695f3830322e3178_managed_wep" 
(("Type" ("wifi")) ("Security" (("wep"))) ("State" ("idle")) ("Strength" (79)) 
("Favorite" (nil)) ("Immutable" (nil)) ("AutoConnect" (nil)) ("Name" 
("rpi_802.1x")) ("Ethernet" ((("Method" ("auto")) ("Interface" ("wlan0")) 
("Address" ("00:26:B6:E6:51:8E")) ("MTU" (1500))))) ("IPv4" (nil)) 
("IPv4.Configuration" ((("Method" ("dhcp"))))) ("IPv6" (nil)) 
("IPv6.Configuration" ((("Method" ("auto")) ("Privacy" ("disabled"))))) 
("Nameservers" (nil)) ("Nameservers.Configuration" (nil)) ("Timeservers" (nil)) 
("Timeservers.Configuration" (nil)) ("Domains" (nil)) ("Domains.Configuration" 
(nil)) ("Proxy" (nil)) ("Proxy.Configuration" (nil)) ("Provider" (nil)))) 
("/net/connman/service/wifi_0026b6e6518e_hidden_managed_none" (("Type" 
("wifi")) ("Security" (("none"))) ("State" ("idle")) ("Strength" (79)) 
("Favorite" (nil)) ("Immutable" (nil)) ("AutoConnect" (nil)) ("Ethernet" 
((("Method" ("auto")) ("Interface" ("wlan0")) ("Address" ("00:26:B6:E6:51:8E")) 
("MTU" (1500))))) ("IPv4" (nil)) ("IPv4.Configuration" ((("Method" ("dhcp"))))) 
("IPv6" (nil)) ("IPv6.Configuration" ((("Method" ("auto")) ("Privacy" 
("disabled"))))) ("Nameservers" (nil)) ("Nameservers.Configuration" (nil)) 
("Timeservers" (nil)) ("Timeservers.Configuration" (nil)) ("Domains" (nil)) 
("Domains.Configuration" (nil)) ("Proxy" (nil)) ("Proxy.Configuration" (nil)) 
("Provider" (nil)))) 
("/net/connman/service/wifi_0026b6e6518e_7270695f77706132_managed_ieee8021x" 
(("Type" ("wifi")) ("Security" (("ieee8021x"))) ("State" ("idle")) ("Strength" 
(74)) ("Favorite" (nil)) ("Immutable" (nil)) ("AutoConnect" (nil)) ("Name" 
("rpi_wpa2")) ("Ethernet" ((("Method" ("auto")) ("Interface" ("wlan0")) 
("Address" ("00:26:B6:E6:51:8E")) ("MTU" (1500))))) ("IPv4" (nil)) 
("IPv4.Configuration" ((("Method" ("dhcp"))))) ("IPv6" (nil)) 
("IPv6.Configuration" ((("Method" ("auto")) ("Privacy" ("disabled"))))) 
("Nameservers" (nil)) ("Nameservers.Configuration" (nil)) ("Timeservers" (nil)) 
("Timeservers.Configuration" (nil)) ("Domains" (nil)) ("Domains.Configuration" 
(nil)) ("Proxy" (nil)) ("Proxy.Configuration" (nil)) ("Provider" (nil)))))
diff --git a/doc/enwc.texi b/doc/enwc.texi
new file mode 100644
index 0000000..cc1a40f
--- /dev/null
+++ b/doc/enwc.texi
@@ -0,0 +1,78 @@
+\input texinfo @c -*-texinfo-*-
address@hidden %**start of header
address@hidden enwc.info
address@hidden ENWC Manual
address@hidden %**end of header
+
address@hidden version.texi
address@hidden fdl.texi
+
address@hidden Emacs
address@hidden
+* ENWC: (enwc).         The Emacs Network Client.
address@hidden direntry
+
address@hidden
+This manual is for ENWC, the Emacs Network Client.
+
+Copyright (C) 2012 Ian Dunn
+
address@hidden
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License, Version 1.3 or
+any later version published by the Free Software Foundation; with no
+Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
+Texts.  A copy of the license is included in the section entitled
+``GNU Free Documentation License''.
address@hidden quotation
address@hidden copying
+
address@hidden
address@hidden  ENWC
address@hidden Edition @value{EDITION}, for @code{enwc} version @value{VERSION}
address@hidden @value{UPDATED}
address@hidden by Ian Dunn
+
address@hidden
address@hidden 0pt plus 1filll
address@hidden
address@hidden titlepage
+
address@hidden
+
address@hidden
address@hidden Top
address@hidden ENWC
+
address@hidden
+
+This manual is for ENWC, the Emacs Network Client.
+
+This is edition @value{EDITION}, for @code{enwc} version @value{VERSION}
address@hidden ifnottex
+
address@hidden
+* Introduction::        Overview of ENWC.
+* Setup::               Getting ready to use ENWC.
+* Configuration::       All of the configuration options.
+* Commands::            The commands that ENWC uses.
address@hidden menu
+
address@hidden Introduction
address@hidden Introduction
+
+ENWC is the Emacs Network Client.  It uses several backends to allow the user 
to control network connections through GNU Emacs, while still allowing control 
to remain with the actual network manager.  ENWC makes uses of the D-Bus 
interfaces provided by these network managers.
+
address@hidden Setup
address@hidden Setup
+
+First, the path to ENWC must be added to the @var{load-path} variable.  Then, 
in the @file{.emacs} file, the following must be added:
+
address@hidden
+(require 'enwc-setup)
+(enwc-setup)
address@hidden lisp
+
+Now, simply press @kbd{M+x}, and type @kbd{ENWC}, and press @kbd{RET}.  ENWC 
will begin scanning for networks on the wireless interface, and display them in 
its buffer.
+
address@hidden
diff --git a/doc/fdl.texi b/doc/fdl.texi
new file mode 100644
index 0000000..cb71f05
--- /dev/null
+++ b/doc/fdl.texi
@@ -0,0 +1,505 @@
address@hidden The GNU Free Documentation License.
address@hidden Version 1.3, 3 November 2008
+
address@hidden This file is intended to be included within another document,
address@hidden hence no sectioning command or @node.
+
address@hidden
+Copyright @copyright{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, 
Inc.
address@hidden://fsf.org/}
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
address@hidden display
+
address@hidden 0
address@hidden
+PREAMBLE
+
+The purpose of this License is to make a manual, textbook, or other
+functional and useful document @dfn{free} in the sense of freedom: to
+assure everyone the effective freedom to copy and redistribute it,
+with or without modifying it, either commercially or noncommercially.
+Secondarily, this License preserves for the author and publisher a way
+to get credit for their work, while not being considered responsible
+for modifications made by others.
+
+This License is a kind of ``copyleft'', which means that derivative
+works of the document must themselves be free in the same sense.  It
+complements the GNU General Public License, which is a copyleft
+license designed for free software.
+
+We have designed this License in order to use it for manuals for free
+software, because free software needs free documentation: a free
+program should come with manuals providing the same freedoms that the
+software does.  But this License is not limited to software manuals;
+it can be used for any textual work, regardless of subject matter or
+whether it is published as a printed book.  We recommend this License
+principally for works whose purpose is instruction or reference.
+
address@hidden
+APPLICABILITY AND DEFINITIONS
+
+This License applies to any manual or other work, in any medium, that
+contains a notice placed by the copyright holder saying it can be
+distributed under the terms of this License.  Such a notice grants a
+world-wide, royalty-free license, unlimited in duration, to use that
+work under the conditions stated herein.  The ``Document'', below,
+refers to any such manual or work.  Any member of the public is a
+licensee, and is addressed as ``you''.  You accept the license if you
+copy, modify or distribute the work in a way requiring permission
+under copyright law.
+
+A ``Modified Version'' of the Document means any work containing the
+Document or a portion of it, either copied verbatim, or with
+modifications and/or translated into another language.
+
+A ``Secondary Section'' is a named appendix or a front-matter section
+of the Document that deals exclusively with the relationship of the
+publishers or authors of the Document to the Document's overall
+subject (or to related matters) and contains nothing that could fall
+directly within that overall subject.  (Thus, if the Document is in
+part a textbook of mathematics, a Secondary Section may not explain
+any mathematics.)  The relationship could be a matter of historical
+connection with the subject or with related matters, or of legal,
+commercial, philosophical, ethical or political position regarding
+them.
+
+The ``Invariant Sections'' are certain Secondary Sections whose titles
+are designated, as being those of Invariant Sections, in the notice
+that says that the Document is released under this License.  If a
+section does not fit the above definition of Secondary then it is not
+allowed to be designated as Invariant.  The Document may contain zero
+Invariant Sections.  If the Document does not identify any Invariant
+Sections then there are none.
+
+The ``Cover Texts'' are certain short passages of text that are listed,
+as Front-Cover Texts or Back-Cover Texts, in the notice that says that
+the Document is released under this License.  A Front-Cover Text may
+be at most 5 words, and a Back-Cover Text may be at most 25 words.
+
+A ``Transparent'' copy of the Document means a machine-readable copy,
+represented in a format whose specification is available to the
+general public, that is suitable for revising the document
+straightforwardly with generic text editors or (for images composed of
+pixels) generic paint programs or (for drawings) some widely available
+drawing editor, and that is suitable for input to text formatters or
+for automatic translation to a variety of formats suitable for input
+to text formatters.  A copy made in an otherwise Transparent file
+format whose markup, or absence of markup, has been arranged to thwart
+or discourage subsequent modification by readers is not Transparent.
+An image format is not Transparent if used for any substantial amount
+of text.  A copy that is not ``Transparent'' is called ``Opaque''.
+
+Examples of suitable formats for Transparent copies include plain
+ASCII without markup, Texinfo input format, address@hidden input
+format, SGML or XML using a publicly available
+DTD, and standard-conforming simple HTML,
+PostScript or PDF designed for human modification.  Examples
+of transparent image formats include PNG, XCF and
+JPG.  Opaque formats include proprietary formats that can be
+read and edited only by proprietary word processors, SGML or
+XML for which the DTD and/or processing tools are
+not generally available, and the machine-generated HTML,
+PostScript or PDF produced by some word processors for
+output purposes only.
+
+The ``Title Page'' means, for a printed book, the title page itself,
+plus such following pages as are needed to hold, legibly, the material
+this License requires to appear in the title page.  For works in
+formats which do not have any title page as such, ``Title Page'' means
+the text near the most prominent appearance of the work's title,
+preceding the beginning of the body of the text.
+
+The ``publisher'' means any person or entity that distributes copies
+of the Document to the public.
+
+A section ``Entitled XYZ'' means a named subunit of the Document whose
+title either is precisely XYZ or contains XYZ in parentheses following
+text that translates XYZ in another language.  (Here XYZ stands for a
+specific section name mentioned below, such as ``Acknowledgements'',
+``Dedications'', ``Endorsements'', or ``History''.)  To ``Preserve the Title''
+of such a section when you modify the Document means that it remains a
+section ``Entitled XYZ'' according to this definition.
+
+The Document may include Warranty Disclaimers next to the notice which
+states that this License applies to the Document.  These Warranty
+Disclaimers are considered to be included by reference in this
+License, but only as regards disclaiming warranties: any other
+implication that these Warranty Disclaimers may have is void and has
+no effect on the meaning of this License.
+
address@hidden
+VERBATIM COPYING
+
+You may copy and distribute the Document in any medium, either
+commercially or noncommercially, provided that this License, the
+copyright notices, and the license notice saying this License applies
+to the Document are reproduced in all copies, and that you add no other
+conditions whatsoever to those of this License.  You may not use
+technical measures to obstruct or control the reading or further
+copying of the copies you make or distribute.  However, you may accept
+compensation in exchange for copies.  If you distribute a large enough
+number of copies you must also follow the conditions in section 3.
+
+You may also lend copies, under the same conditions stated above, and
+you may publicly display copies.
+
address@hidden
+COPYING IN QUANTITY
+
+If you publish printed copies (or copies in media that commonly have
+printed covers) of the Document, numbering more than 100, and the
+Document's license notice requires Cover Texts, you must enclose the
+copies in covers that carry, clearly and legibly, all these Cover
+Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
+the back cover.  Both covers must also clearly and legibly identify
+you as the publisher of these copies.  The front cover must present
+the full title with all words of the title equally prominent and
+visible.  You may add other material on the covers in addition.
+Copying with changes limited to the covers, as long as they preserve
+the title of the Document and satisfy these conditions, can be treated
+as verbatim copying in other respects.
+
+If the required texts for either cover are too voluminous to fit
+legibly, you should put the first ones listed (as many as fit
+reasonably) on the actual cover, and continue the rest onto adjacent
+pages.
+
+If you publish or distribute Opaque copies of the Document numbering
+more than 100, you must either include a machine-readable Transparent
+copy along with each Opaque copy, or state in or with each Opaque copy
+a computer-network location from which the general network-using
+public has access to download using public-standard network protocols
+a complete Transparent copy of the Document, free of added material.
+If you use the latter option, you must take reasonably prudent steps,
+when you begin distribution of Opaque copies in quantity, to ensure
+that this Transparent copy will remain thus accessible at the stated
+location until at least one year after the last time you distribute an
+Opaque copy (directly or through your agents or retailers) of that
+edition to the public.
+
+It is requested, but not required, that you contact the authors of the
+Document well before redistributing any large number of copies, to give
+them a chance to provide you with an updated version of the Document.
+
address@hidden
+MODIFICATIONS
+
+You may copy and distribute a Modified Version of the Document under
+the conditions of sections 2 and 3 above, provided that you release
+the Modified Version under precisely this License, with the Modified
+Version filling the role of the Document, thus licensing distribution
+and modification of the Modified Version to whoever possesses a copy
+of it.  In addition, you must do these things in the Modified Version:
+
address@hidden A
address@hidden
+Use in the Title Page (and on the covers, if any) a title distinct
+from that of the Document, and from those of previous versions
+(which should, if there were any, be listed in the History section
+of the Document).  You may use the same title as a previous version
+if the original publisher of that version gives permission.
+
address@hidden
+List on the Title Page, as authors, one or more persons or entities
+responsible for authorship of the modifications in the Modified
+Version, together with at least five of the principal authors of the
+Document (all of its principal authors, if it has fewer than five),
+unless they release you from this requirement.
+
address@hidden
+State on the Title page the name of the publisher of the
+Modified Version, as the publisher.
+
address@hidden
+Preserve all the copyright notices of the Document.
+
address@hidden
+Add an appropriate copyright notice for your modifications
+adjacent to the other copyright notices.
+
address@hidden
+Include, immediately after the copyright notices, a license notice
+giving the public permission to use the Modified Version under the
+terms of this License, in the form shown in the Addendum below.
+
address@hidden
+Preserve in that license notice the full lists of Invariant Sections
+and required Cover Texts given in the Document's license notice.
+
address@hidden
+Include an unaltered copy of this License.
+
address@hidden
+Preserve the section Entitled ``History'', Preserve its Title, and add
+to it an item stating at least the title, year, new authors, and
+publisher of the Modified Version as given on the Title Page.  If
+there is no section Entitled ``History'' in the Document, create one
+stating the title, year, authors, and publisher of the Document as
+given on its Title Page, then add an item describing the Modified
+Version as stated in the previous sentence.
+
address@hidden
+Preserve the network location, if any, given in the Document for
+public access to a Transparent copy of the Document, and likewise
+the network locations given in the Document for previous versions
+it was based on.  These may be placed in the ``History'' section.
+You may omit a network location for a work that was published at
+least four years before the Document itself, or if the original
+publisher of the version it refers to gives permission.
+
address@hidden
+For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
+the Title of the section, and preserve in the section all the
+substance and tone of each of the contributor acknowledgements and/or
+dedications given therein.
+
address@hidden
+Preserve all the Invariant Sections of the Document,
+unaltered in their text and in their titles.  Section numbers
+or the equivalent are not considered part of the section titles.
+
address@hidden
+Delete any section Entitled ``Endorsements''.  Such a section
+may not be included in the Modified Version.
+
address@hidden
+Do not retitle any existing section to be Entitled ``Endorsements'' or
+to conflict in title with any Invariant Section.
+
address@hidden
+Preserve any Warranty Disclaimers.
address@hidden enumerate
+
+If the Modified Version includes new front-matter sections or
+appendices that qualify as Secondary Sections and contain no material
+copied from the Document, you may at your option designate some or all
+of these sections as invariant.  To do this, add their titles to the
+list of Invariant Sections in the Modified Version's license notice.
+These titles must be distinct from any other section titles.
+
+You may add a section Entitled ``Endorsements'', provided it contains
+nothing but endorsements of your Modified Version by various
+parties---for example, statements of peer review or that the text has
+been approved by an organization as the authoritative definition of a
+standard.
+
+You may add a passage of up to five words as a Front-Cover Text, and a
+passage of up to 25 words as a Back-Cover Text, to the end of the list
+of Cover Texts in the Modified Version.  Only one passage of
+Front-Cover Text and one of Back-Cover Text may be added by (or
+through arrangements made by) any one entity.  If the Document already
+includes a cover text for the same cover, previously added by you or
+by arrangement made by the same entity you are acting on behalf of,
+you may not add another; but you may replace the old one, on explicit
+permission from the previous publisher that added the old one.
+
+The author(s) and publisher(s) of the Document do not by this License
+give permission to use their names for publicity for or to assert or
+imply endorsement of any Modified Version.
+
address@hidden
+COMBINING DOCUMENTS
+
+You may combine the Document with other documents released under this
+License, under the terms defined in section 4 above for modified
+versions, provided that you include in the combination all of the
+Invariant Sections of all of the original documents, unmodified, and
+list them all as Invariant Sections of your combined work in its
+license notice, and that you preserve all their Warranty Disclaimers.
+
+The combined work need only contain one copy of this License, and
+multiple identical Invariant Sections may be replaced with a single
+copy.  If there are multiple Invariant Sections with the same name but
+different contents, make the title of each such section unique by
+adding at the end of it, in parentheses, the name of the original
+author or publisher of that section if known, or else a unique number.
+Make the same adjustment to the section titles in the list of
+Invariant Sections in the license notice of the combined work.
+
+In the combination, you must combine any sections Entitled ``History''
+in the various original documents, forming one section Entitled
+``History''; likewise combine any sections Entitled ``Acknowledgements'',
+and any sections Entitled ``Dedications''.  You must delete all
+sections Entitled ``Endorsements.''
+
address@hidden
+COLLECTIONS OF DOCUMENTS
+
+You may make a collection consisting of the Document and other documents
+released under this License, and replace the individual copies of this
+License in the various documents with a single copy that is included in
+the collection, provided that you follow the rules of this License for
+verbatim copying of each of the documents in all other respects.
+
+You may extract a single document from such a collection, and distribute
+it individually under this License, provided you insert a copy of this
+License into the extracted document, and follow this License in all
+other respects regarding verbatim copying of that document.
+
address@hidden
+AGGREGATION WITH INDEPENDENT WORKS
+
+A compilation of the Document or its derivatives with other separate
+and independent documents or works, in or on a volume of a storage or
+distribution medium, is called an ``aggregate'' if the copyright
+resulting from the compilation is not used to limit the legal rights
+of the compilation's users beyond what the individual works permit.
+When the Document is included in an aggregate, this License does not
+apply to the other works in the aggregate which are not themselves
+derivative works of the Document.
+
+If the Cover Text requirement of section 3 is applicable to these
+copies of the Document, then if the Document is less than one half of
+the entire aggregate, the Document's Cover Texts may be placed on
+covers that bracket the Document within the aggregate, or the
+electronic equivalent of covers if the Document is in electronic form.
+Otherwise they must appear on printed covers that bracket the whole
+aggregate.
+
address@hidden
+TRANSLATION
+
+Translation is considered a kind of modification, so you may
+distribute translations of the Document under the terms of section 4.
+Replacing Invariant Sections with translations requires special
+permission from their copyright holders, but you may include
+translations of some or all Invariant Sections in addition to the
+original versions of these Invariant Sections.  You may include a
+translation of this License, and all the license notices in the
+Document, and any Warranty Disclaimers, provided that you also include
+the original English version of this License and the original versions
+of those notices and disclaimers.  In case of a disagreement between
+the translation and the original version of this License or a notice
+or disclaimer, the original version will prevail.
+
+If a section in the Document is Entitled ``Acknowledgements'',
+``Dedications'', or ``History'', the requirement (section 4) to Preserve
+its Title (section 1) will typically require changing the actual
+title.
+
address@hidden
+TERMINATION
+
+You may not copy, modify, sublicense, or distribute the Document
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense, or distribute it is void, and
+will automatically terminate your rights under this License.
+
+However, if you cease all violation of this License, then your license
+from a particular copyright holder is reinstated (a) provisionally,
+unless and until the copyright holder explicitly and finally
+terminates your license, and (b) permanently, if the copyright holder
+fails to notify you of the violation by some reasonable means prior to
+60 days after the cessation.
+
+Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, receipt of a copy of some or all of the same material does
+not give you any rights to use it.
+
address@hidden
+FUTURE REVISIONS OF THIS LICENSE
+
+The Free Software Foundation may publish new, revised versions
+of the GNU Free Documentation License from time to time.  Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.  See
address@hidden://www.gnu.org/copyleft/}.
+
+Each version of the License is given a distinguishing version number.
+If the Document specifies that a particular numbered version of this
+License ``or any later version'' applies to it, you have the option of
+following the terms and conditions either of that specified version or
+of any later version that has been published (not as a draft) by the
+Free Software Foundation.  If the Document does not specify a version
+number of this License, you may choose any version ever published (not
+as a draft) by the Free Software Foundation.  If the Document
+specifies that a proxy can decide which future versions of this
+License can be used, that proxy's public statement of acceptance of a
+version permanently authorizes you to choose that version for the
+Document.
+
address@hidden
+RELICENSING
+
+``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
+World Wide Web server that publishes copyrightable works and also
+provides prominent facilities for anybody to edit those works.  A
+public wiki that anybody can edit is an example of such a server.  A
+``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
+site means any set of copyrightable works thus published on the MMC
+site.
+
+``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
+license published by Creative Commons Corporation, a not-for-profit
+corporation with a principal place of business in San Francisco,
+California, as well as future copyleft versions of that license
+published by that same organization.
+
+``Incorporate'' means to publish or republish a Document, in whole or
+in part, as part of another Document.
+
+An MMC is ``eligible for relicensing'' if it is licensed under this
+License, and if all works that were first published under this License
+somewhere other than this MMC, and subsequently incorporated in whole
+or in part into the MMC, (1) had no cover texts or invariant sections,
+and (2) were thus incorporated prior to November 1, 2008.
+
+The operator of an MMC Site may republish an MMC contained in the site
+under CC-BY-SA on the same site at any time before August 1, 2009,
+provided the MMC is eligible for relicensing.
+
address@hidden enumerate
+
address@hidden
address@hidden ADDENDUM: How to use this License for your documents
+
+To use this License in a document you have written, include a copy of
+the License in the document and put the following copyright and
+license notices just after the title page:
+
address@hidden
address@hidden
+  Copyright (C)  @var{year}  @var{your name}.
+  Permission is granted to copy, distribute and/or modify this document
+  under the terms of the GNU Free Documentation License, Version 1.3
+  or any later version published by the Free Software Foundation;
+  with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
+  Texts.  A copy of the license is included in the section entitled ``GNU
+  Free Documentation License''.
address@hidden group
address@hidden smallexample
+
+If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
+replace the address@hidden''@: line with this:
+
address@hidden
address@hidden
+    with the Invariant Sections being @var{list their titles}, with
+    the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
+    being @var{list}.
address@hidden group
address@hidden smallexample
+
+If you have Invariant Sections without Cover Texts, or some other
+combination of the three, merge those two alternatives to suit the
+situation.
+
+If your document contains nontrivial examples of program code, we
+recommend releasing these examples in parallel under your choice of
+free software license, such as the GNU General Public License,
+to permit their use in free software.
+
address@hidden Local Variables:
address@hidden ispell-local-pdict: "ispell-dict"
address@hidden End:
diff --git a/doc/nm-dbus.txt b/doc/nm-dbus.txt
new file mode 100644
index 0000000..89aa5a9
--- /dev/null
+++ b/doc/nm-dbus.txt
@@ -0,0 +1,356 @@
+NetworkManager:
+
+"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 
1.0//EN\"
+\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\";>
+<node>
+  <interface name=\"org.freedesktop.DBus.Introspectable\">
+    <method name=\"Introspect\">
+      <arg name=\"data\" direction=\"out\" type=\"s\"/>
+    </method>
+  </interface>
+  <interface name=\"org.freedesktop.DBus.Properties\">
+    <method name=\"Get\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"propname\" direction=\"in\" type=\"s\"/>
+      <arg name=\"value\" direction=\"out\" type=\"v\"/>
+    </method>
+    <method name=\"Set\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"propname\" direction=\"in\" type=\"s\"/>
+      <arg name=\"value\" direction=\"in\" type=\"v\"/>
+    </method>
+    <method name=\"GetAll\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>
+    </method>
+  </interface>
+  <interface name=\"org.freedesktop.NetworkManager\">
+    <method name=\"state\">
+      <arg name=\"state\" type=\"u\" direction=\"out\"/>
+    </method>
+    <method name=\"SetLogging\">
+      <arg name=\"level\" type=\"s\" direction=\"in\"/>
+      <arg name=\"domains\" type=\"s\" direction=\"in\"/>
+    </method>
+    <method name=\"GetPermissions\">
+      <arg name=\"permissions\" type=\"a{ss}\" direction=\"out\"/>
+    </method>
+    <method name=\"Enable\">
+      <arg name=\"enable\" type=\"b\" direction=\"in\"/>
+    </method>
+    <method name=\"Sleep\">
+      <arg name=\"sleep\" type=\"b\" direction=\"in\"/>
+    </method>
+    <method name=\"DeactivateConnection\">
+      <arg name=\"active_connection\" type=\"o\" direction=\"in\"/>
+    </method>
+    <method name=\"AddAndActivateConnection\">
+      <arg name=\"connection\" type=\"a{sa{sv}}\" direction=\"in\"/>
+      <arg name=\"device\" type=\"o\" direction=\"in\"/>
+      <arg name=\"specific_object\" type=\"o\" direction=\"in\"/>
+      <arg name=\"path\" type=\"o\" direction=\"out\"/>
+      <arg name=\"active_connection\" type=\"o\" direction=\"out\"/>
+    </method>
+    <method name=\"ActivateConnection\">
+      <arg name=\"connection\" type=\"o\" direction=\"in\"/>
+      <arg name=\"device\" type=\"o\" direction=\"in\"/>
+      <arg name=\"specific_object\" type=\"o\" direction=\"in\"/>
+      <arg name=\"active_connection\" type=\"o\" direction=\"out\"/>
+    </method>
+    <method name=\"GetDeviceByIpIface\">
+      <arg name=\"iface\" type=\"s\" direction=\"in\"/>
+      <arg name=\"device\" type=\"o\" direction=\"out\"/>
+    </method>
+    <method name=\"GetDevices\">
+      <arg name=\"devices\" type=\"ao\" direction=\"out\"/>
+    </method>
+    <signal name=\"DeviceRemoved\">
+      <arg type=\"o\"/>
+    </signal>
+    <signal name=\"DeviceAdded\">
+      <arg type=\"o\"/>
+    </signal>
+    <signal name=\"PropertiesChanged\">
+      <arg type=\"a{sv}\"/>
+    </signal>
+    <signal name=\"StateChanged\">
+      <arg type=\"u\"/>
+    </signal>
+    <signal name=\"CheckPermissions\">
+    </signal>
+    <property name=\"State\" type=\"u\" access=\"read\"/>
+    <property name=\"Version\" type=\"s\" access=\"read\"/>
+    <property name=\"ActiveConnections\" type=\"ao\" access=\"read\"/>
+    <property name=\"WimaxHardwareEnabled\" type=\"b\" access=\"read\"/>
+    <property name=\"WimaxEnabled\" type=\"b\" access=\"readwrite\"/>
+    <property name=\"WwanHardwareEnabled\" type=\"b\" access=\"read\"/>
+    <property name=\"WwanEnabled\" type=\"b\" access=\"readwrite\"/>
+    <property name=\"WirelessHardwareEnabled\" type=\"b\" access=\"read\"/>
+    <property name=\"WirelessEnabled\" type=\"b\" access=\"readwrite\"/>
+    <property name=\"NetworkingEnabled\" type=\"b\" access=\"read\"/>
+  </interface>
+  <node name=\"AccessPoint\"/>
+  <node name=\"AgentManager\"/>
+  <node name=\"Devices\"/>
+  <node name=\"Settings\"/>
+</node>
+"
+
+AccessPoint/*:
+
+"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 
1.0//EN\"
+\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\";>
+<node>
+  <interface name=\"org.freedesktop.DBus.Introspectable\">
+    <method name=\"Introspect\">
+      <arg name=\"data\" direction=\"out\" type=\"s\"/>
+    </method>
+  </interface>
+  <interface name=\"org.freedesktop.DBus.Properties\">
+    <method name=\"Get\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"propname\" direction=\"in\" type=\"s\"/>
+      <arg name=\"value\" direction=\"out\" type=\"v\"/>
+    </method>
+    <method name=\"Set\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"propname\" direction=\"in\" type=\"s\"/>
+      <arg name=\"value\" direction=\"in\" type=\"v\"/>
+    </method>
+    <method name=\"GetAll\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>
+    </method>
+  </interface>
+  <interface name=\"org.freedesktop.NetworkManager.AccessPoint\">
+    <signal name=\"PropertiesChanged\">
+      <arg type=\"a{sv}\"/>
+    </signal>
+    <property name=\"Strength\" type=\"y\" access=\"read\"/>
+    <property name=\"MaxBitrate\" type=\"u\" access=\"read\"/>
+    <property name=\"Mode\" type=\"u\" access=\"read\"/>
+    <property name=\"HwAddress\" type=\"s\" access=\"read\"/>
+    <property name=\"Frequency\" type=\"u\" access=\"read\"/>
+    <property name=\"Ssid\" type=\"ay\" access=\"read\"/>
+    <property name=\"RsnFlags\" type=\"u\" access=\"read\"/>
+    <property name=\"WpaFlags\" type=\"u\" access=\"read\"/>
+    <property name=\"Flags\" type=\"u\" access=\"read\"/>
+  </interface>
+</node>
+"
+
+Devices/*:
+
+"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 
1.0//EN\"
+\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\";>
+<node>
+  <interface name=\"org.freedesktop.DBus.Introspectable\">
+    <method name=\"Introspect\">
+      <arg name=\"data\" direction=\"out\" type=\"s\"/>
+    </method>
+  </interface>
+  <interface name=\"org.freedesktop.DBus.Properties\">
+    <method name=\"Get\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"propname\" direction=\"in\" type=\"s\"/>
+      <arg name=\"value\" direction=\"out\" type=\"v\"/>
+    </method>
+    <method name=\"Set\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"propname\" direction=\"in\" type=\"s\"/>
+      <arg name=\"value\" direction=\"in\" type=\"v\"/>
+    </method>
+    <method name=\"GetAll\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>
+    </method>
+  </interface>
+  <interface name=\"org.freedesktop.NetworkManager.Device\">
+    <method name=\"Disconnect\">
+    </method>
+    <signal name=\"StateChanged\">
+      <arg type=\"u\"/>
+      <arg type=\"u\"/>
+      <arg type=\"u\"/>
+    </signal>
+    <property name=\"DeviceType\" type=\"u\" access=\"read\"/>
+    <property name=\"FirmwareMissing\" type=\"b\" access=\"read\"/>
+    <property name=\"Autoconnect\" type=\"b\" access=\"readwrite\"/>
+    <property name=\"Managed\" type=\"b\" access=\"read\"/>
+    <property name=\"Dhcp6Config\" type=\"o\" access=\"read\"/>
+    <property name=\"Ip6Config\" type=\"o\" access=\"read\"/>
+    <property name=\"Dhcp4Config\" type=\"o\" access=\"read\"/>
+    <property name=\"Ip4Config\" type=\"o\" access=\"read\"/>
+    <property name=\"ActiveConnection\" type=\"o\" access=\"read\"/>
+    <property name=\"StateReason\" type=\"(uu)\" access=\"read\"/>
+    <property name=\"State\" type=\"u\" access=\"read\"/>
+    <property name=\"Ip4Address\" type=\"u\" access=\"read\"/>
+    <property name=\"Capabilities\" type=\"u\" access=\"read\"/>
+    <property name=\"FirmwareVersion\" type=\"s\" access=\"read\"/>
+    <property name=\"DriverVersion\" type=\"s\" access=\"read\"/>
+    <property name=\"Driver\" type=\"s\" access=\"read\"/>
+    <property name=\"IpInterface\" type=\"s\" access=\"read\"/>
+    <property name=\"Interface\" type=\"s\" access=\"read\"/>
+    <property name=\"Udi\" type=\"s\" access=\"read\"/>
+  </interface>
+  <interface name=\"org.freedesktop.NetworkManager.Device.Wireless\">
+    <method name=\"RequestScan\">
+      <arg name=\"options\" type=\"a{sv}\" direction=\"in\"/>
+    </method>
+    <method name=\"GetAccessPoints\">
+      <arg name=\"access_points\" type=\"ao\" direction=\"out\"/>
+    </method>
+    <signal name=\"AccessPointRemoved\">
+      <arg type=\"o\"/>
+    </signal>
+    <signal name=\"AccessPointAdded\">
+      <arg type=\"o\"/>
+    </signal>
+    <signal name=\"PropertiesChanged\">
+      <arg type=\"a{sv}\"/>
+    </signal>
+    <property name=\"WirelessCapabilities\" type=\"u\" access=\"read\"/>
+    <property name=\"ActiveAccessPoint\" type=\"o\" access=\"read\"/>
+    <property name=\"Bitrate\" type=\"u\" access=\"read\"/>
+    <property name=\"Mode\" type=\"u\" access=\"read\"/>
+    <property name=\"PermHwAddress\" type=\"s\" access=\"read\"/>
+    <property name=\"HwAddress\" type=\"s\" access=\"read\"/>
+  </interface>
+</node>
+"
+
+AgentManager:
+
+"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 
1.0//EN\"
+\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\";>
+<node>
+  <interface name=\"org.freedesktop.DBus.Introspectable\">
+    <method name=\"Introspect\">
+      <arg name=\"data\" direction=\"out\" type=\"s\"/>
+    </method>
+  </interface>
+  <interface name=\"org.freedesktop.DBus.Properties\">
+    <method name=\"Get\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"propname\" direction=\"in\" type=\"s\"/>
+      <arg name=\"value\" direction=\"out\" type=\"v\"/>
+    </method>
+    <method name=\"Set\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"propname\" direction=\"in\" type=\"s\"/>
+      <arg name=\"value\" direction=\"in\" type=\"v\"/>
+    </method>
+    <method name=\"GetAll\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>
+    </method>
+  </interface>
+  <interface name=\"org.freedesktop.NetworkManager.AgentManager\">
+    <method name=\"Unregister\">
+    </method>
+    <method name=\"Register\">
+      <arg name=\"identifier\" type=\"s\" direction=\"in\"/>
+    </method>
+  </interface>
+</node>
+"
+
+Settings:
+
+"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 
1.0//EN\"
+\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\";>
+<node>
+  <interface name=\"org.freedesktop.DBus.Introspectable\">
+    <method name=\"Introspect\">
+      <arg name=\"data\" direction=\"out\" type=\"s\"/>
+    </method>
+  </interface>
+  <interface name=\"org.freedesktop.DBus.Properties\">
+    <method name=\"Get\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"propname\" direction=\"in\" type=\"s\"/>
+      <arg name=\"value\" direction=\"out\" type=\"v\"/>
+    </method>
+    <method name=\"Set\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"propname\" direction=\"in\" type=\"s\"/>
+      <arg name=\"value\" direction=\"in\" type=\"v\"/>
+    </method>
+    <method name=\"GetAll\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>
+    </method>
+  </interface>
+  <interface name=\"org.freedesktop.NetworkManager.Settings\">
+    <method name=\"SaveHostname\">
+      <arg name=\"hostname\" type=\"s\" direction=\"in\"/>
+    </method>
+    <method name=\"AddConnection\">
+      <arg name=\"connection\" type=\"a{sa{sv}}\" direction=\"in\"/>
+      <arg name=\"path\" type=\"o\" direction=\"out\"/>
+    </method>
+    <method name=\"GetConnectionByUuid\">
+      <arg name=\"uuid\" type=\"s\" direction=\"in\"/>
+      <arg name=\"connection\" type=\"o\" direction=\"out\"/>
+    </method>
+    <method name=\"ListConnections\">
+      <arg name=\"connections\" type=\"ao\" direction=\"out\"/>
+    </method>
+    <signal name=\"NewConnection\">
+      <arg type=\"o\"/>
+    </signal>
+    <signal name=\"PropertiesChanged\">
+      <arg type=\"a{sv}\"/>
+    </signal>
+    <property name=\"CanModify\" type=\"b\" access=\"read\"/>
+    <property name=\"Hostname\" type=\"s\" access=\"read\"/>
+  </interface>
+  <node name=\"0\"/>
+</node>
+"
+Settings/0:
+
+"<!DOCTYPE node PUBLIC \"-//freedesktop//DTD D-BUS Object Introspection 
1.0//EN\"
+\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\";>
+<node>
+  <interface name=\"org.freedesktop.DBus.Introspectable\">
+    <method name=\"Introspect\">
+      <arg name=\"data\" direction=\"out\" type=\"s\"/>
+    </method>
+  </interface>
+  <interface name=\"org.freedesktop.DBus.Properties\">
+    <method name=\"Get\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"propname\" direction=\"in\" type=\"s\"/>
+      <arg name=\"value\" direction=\"out\" type=\"v\"/>
+    </method>
+    <method name=\"Set\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"propname\" direction=\"in\" type=\"s\"/>
+      <arg name=\"value\" direction=\"in\" type=\"v\"/>
+    </method>
+    <method name=\"GetAll\">
+      <arg name=\"interface\" direction=\"in\" type=\"s\"/>
+      <arg name=\"props\" direction=\"out\" type=\"a{sv}\"/>
+    </method>
+  </interface>
+  <interface name=\"org.freedesktop.NetworkManager.Settings.Connection\">
+    <method name=\"GetSecrets\">
+      <arg name=\"setting_name\" type=\"s\" direction=\"in\"/>
+      <arg name=\"secrets\" type=\"a{sa{sv}}\" direction=\"out\"/>
+    </method>
+    <method name=\"GetSettings\">
+      <arg name=\"settings\" type=\"a{sa{sv}}\" direction=\"out\"/>
+    </method>
+    <method name=\"Delete\">
+    </method>
+    <method name=\"Update\">
+      <arg name=\"properties\" type=\"a{sa{sv}}\" direction=\"in\"/>
+    </method>
+    <signal name=\"Removed\">
+    </signal>
+    <signal name=\"Updated\">
+    </signal>
+  </interface>
+</node>
+"
diff --git a/doc/settings.txt b/doc/settings.txt
new file mode 100644
index 0000000..02a55da
--- /dev/null
+++ b/doc/settings.txt
@@ -0,0 +1,11 @@
+IPv4 settings:
+  Address - text input
+  Prefix - text input
+  Gateway - text input
+
+DNS Settings:
+  3 DNS Servers - text input
+
+Encryption Type
+  - Check box to use encryption
+  - Drop-down list of encryption types available.
diff --git a/doc/version.texi b/doc/version.texi
new file mode 100644
index 0000000..f910a9b
--- /dev/null
+++ b/doc/version.texi
@@ -0,0 +1,4 @@
address@hidden UPDATED 15 December 2012
address@hidden UPDATED-MONTH December 2012
address@hidden EDITION 1.0
address@hidden VERSION 1.0
diff --git a/lisp/Makefile b/lisp/Makefile
new file mode 100644
index 0000000..c3a0ad5
--- /dev/null
+++ b/lisp/Makefile
@@ -0,0 +1,35 @@
+# This is part of ENWC
+#
+#  Copyright (C) 2012 Ian Dunn.
+#
+#  This program 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 3 of the License, or
+#  (at your option) any later version.
+#
+#  This program 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/>.
+
+
+
+EMACS=emacs
+ALLSRC=enwc.el enwc-wicd.el enwc-nm.el enwc-setup.el
+ALLELC=$(wildcard *.elc)
+EXPER=enwc-cm.el
+SOURCE=$(ALLSRC)
+TARGET=$(patsubst %.el,%.elc,$(SOURCE))
+
+all: $(TARGET)
+
+%.elc: %.el
+       @$(EMACS) -q --batch \
+       --eval "(add-to-list 'load-path \".\")" \
+       -f batch-byte-compile $<
+
+clean:
+       -rm -f *.elc
diff --git a/lisp/enwc-cm.el b/lisp/enwc-cm.el
new file mode 100644
index 0000000..e5a1663
--- /dev/null
+++ b/lisp/enwc-cm.el
@@ -0,0 +1,153 @@
+;; enwc-cm.el
+
+;; Copyright (C) 2012 Ian Dunn
+
+;; Author: Ian Dunn
+;; Keywords: enwc, network, wicd, manager, nm
+
+;; This file is part of ENWC
+
+;; ENWC 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 3, or (at your option)
+;; any later version.
+
+;; ENWC 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 ENWC; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;; connect
+;; disconnect
+;; scan
+;; get-prop
+;; save-profile
+;; get-networks
+;; check-connecting
+;; get-current-nw-id
+
+
+(require 'enwc)
+
+(defgroup enwc-cm nil
+  "*ConnMan variables for ENWC"
+  :prefix "ewnc-cm-"
+  :group 'enwc)
+
+(defcustom enwc-cm-dbus-service "net.connman"
+  "ConnMan D-Bus service."
+  :group 'enwc-cm
+  :type 'string)
+
+
+;; DEMAND TO SEE LIFE'S MANAGER!!
+
+(defcustom enwc-cm-dbus-manager-interface "net.connman.Manager"
+  "ConnMan D-Bus Manager interface."
+  :group 'enwc-cm
+  :type 'string)
+
+(defcustom enwc-cm-dbus-service-interface "net.connman.Service"
+  "ConnMan D-Bus Service interface."
+  :group 'enwc-cm
+  :type 'string)
+
+(defvar enwc-cm-details-list
+  '("Name" "bssid" "Strength" "Security" "mode" "channel"))
+
+(defun enwc-cm-get-services ()
+  (dbus-call-method :system
+                   enwc-cm-dbus-service
+                   "/"
+                   enwc-cm-dbus-manager-interface
+                   "GetServices"))
+
+(defun enwc-cm-get-networks ()
+  (let ((services (enwc-cm-get-services)))
+    (mapcar 'car services)))
+
+(defun enwc-cm-get-network (id)
+  (nth id (enwc-cm-get-services)))
+
+;; scan
+(defun enwc-cm-scan (wired)
+  (dbus-call-method :system
+                   enwc-cm-dbus-service
+                   "/net/connman/technology/(ethernet|wifi)"
+                   "net.connman.Technology"
+                   "Scan"))
+
+;; connect
+(defun enwc-cm-connect (wired id)
+  (dbus-call-method :system
+                   enwc-cm-dbus-service
+                   "/net/connman/service/serviceID"
+                   enwc-cm-dbus-service-interface
+                   "Connect"))
+
+
+(defun enwc-cm-disconnect (wired)
+  (dbus-call-method :system
+                   enwc-cm-dbus-service
+                   "/net/connman/service/CONNECTED-SERVICE"
+                   enwc-cm-dbus-service-interface
+                   "Disconnect"))
+
+(defun enwc-cm-get-nw-prop (id prop)
+  (let ((network (enwc-cm-get-network id)))
+    (car (cadr (assoc prop (cadr network))))))
+
+(defun enwc-cm-get-wireless-network-property (id prop)
+  (enwc-cm-get-nw-prop id prop))
+
+(defun enwc-cm-get-encryption-type (id)
+  (enwc-cm-get-nw-prop id "Security"))
+
+(defun enwc-cm-get-ip-addr (wired id)
+  (let ((ipv4-config (enwc-cm-get-nw-prop id "IPv4.Configuration")))
+    (car (cadr (assoc "Address" ipv4-config)))))
+
+(defun enwc-cm-get-netmask (wired id)
+  (let ((ipv4-config (enwc-cm-get-nw-prop id "IPv4.Configuration")))
+    (car (cadr (assoc "Netmask" ipv4-config)))))
+
+(defun enwc-cm-get-gateway (wired id)
+  (let ((ipv4-config (enwc-cm-get-nw-prop id "IPv4.Configuration")))
+    (car (cadr (assoc "Gateway" ipv4-config)))))
+
+(defun enwc-cm-get-dns (wired id)
+  (enwc-cm-get-nw-prop id "Nameservers.Configuration"))
+
+(defun enwc-cm-set-nw-prop (wired id prop val)
+  (dbus-call-method :system
+                   enwc-cm-dbus-service
+                   (car (enwc-cm-get-network id))
+                   enwc-cm-dbus-service-interface
+                   "SetProperty"
+                   prop
+                   val))
+
+(defun enwc-cm-save-nw-settings (wired id settings)
+  (let* ((ipv4 (enwc-cm-get-nw-prop id "IPv4.Configuration"))
+        (method (car (cadr (assoc "Method" ipv4))))
+        (ip-addr (cdr (assoc "addr" settings)))
+        (netmask (cdr (assoc "netmask" settings)))
+        (gateway (cdr (assoc "gateway" settings)))
+        new-ipv4-config new-dns-config)
+    (setq new-ipv4-config
+         (list (list (cons "Method" (cons (cons method nil) nil))
+                     (cons "Address" (cons (cons ip-addr nil) nil))
+                     (cons "Netmask" (cons (cons netmask nil) nil))
+                     (cons "Gateway" (cons (cons gateway nil) nil)))))
+    (setq new-dns-config
+         (list (list (cdr (assoc "dns1" settings))
+                     (cdr (assoc "dns2" settings)))))
+    (enwc-cm-set-nw-prop wired id "IPv4.Configuration"
+                        new-ipv4-config)
+    (enwc-cm-set-nw-prop wired id "Nameservers.Configuration"
+                        new-dns-config)))
diff --git a/lisp/enwc-nm.el b/lisp/enwc-nm.el
new file mode 100644
index 0000000..82594eb
--- /dev/null
+++ b/lisp/enwc-nm.el
@@ -0,0 +1,624 @@
+;;; enwc-nm.el - The NetworkManager backend to ENWC
+
+;; Copyright (C) 2012 Ian Dunn
+
+;; Author: Ian Dunn
+;; Keywords: enwc, network, wicd, manager, nm
+
+;; This file is part of ENWC
+
+;; ENWC 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 3, or (at your option)
+;; any later version.
+
+;; ENWC 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 ENWC; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+
+;;; Commentary:
+;;
+;;   This requires NetworkManager >= 0.9.6
+;;
+
+(require 'enwc)
+
+(defgroup enwc-nm nil
+  "*NetworkManager variables for ENWC"
+  :prefix "enwc-nm-"
+  :group 'enwc)
+
+(defcustom enwc-nm-dbus-service "org.freedesktop.NetworkManager"
+  "NetworkManager D-Bus service."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-path "/org/freedesktop/NetworkManager"
+  "The default D-Bus path for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-settings-path 
"/org/freedesktop/NetworkManager/Settings"
+  "The settings D-Bus path for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-interface "org.freedesktop.NetworkManager"
+  "The default D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-wireless-interface 
"org.freedesktop.NetworkManager.Device.Wireless"
+  "The wireless D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-wired-interface 
"org.freedesktop.NetworkManager.Device.Wired"
+  "The wired D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-device-interface 
"org.freedesktop.NetworkManager.Device"
+  "The device D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-accesspoint-interface 
"org.freedesktop.NetworkManager.AccessPoint"
+  "The access point D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-settings-interface 
"org.freedesktop.NetworkManager.Settings"
+  "The settings D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-connections-interface 
"org.freedesktop.NetworkManager.Settings.Connection"
+  "The connections D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defcustom enwc-nm-dbus-active-interface 
"org.freedesktop.NetworkManager.Connection.Active"
+  "The active connection D-Bus interface for NetworkManager."
+  :group 'enwc-nm
+  :type 'string)
+
+(defvar enwc-nm-details-list
+  '("Ssid" "HwAddress" "Strength" "Flags" "Mode" "Frequency")
+  "The list of the desired details to be obtained from each network.")
+
+(defvar enwc-nm-sec-types
+  '(("eap-leap" . (("Name" . "eap-leap")
+                  ("reqs" . (("username" . "Username")
+                             ("password" . "Password")))))
+    ("eap-peap" . (("Name" . "eap-peap")
+                  ("reqs" . (("anonymous-identity" . "Anonymous Identity")
+                             ("ca-cert" . "CA Certificate")
+                             ("phase2-auth" . "Inner Authentication")
+                             ("phase1-peapver" . "PEAP Version")))))
+    ("eap-tls" . (("Name" . "eap-tls")
+                 ("reqs" . (("identity" . "Identity")
+                            ("client-cert" . "User Certificate")
+                            ("ca-cert" . "CA Certificate")
+                            ("private-key" . "Private Key")
+                            ("private-key-password" . "Private Key 
Password")))))
+    ("eap-ttls" . (("Name" . "eap-ttls")
+                  ("reqs" . (("anonymous-identity" . "Anonymous Identity")
+                             ("ca-cert" . "CA Certificate")
+                             ("phase2-auth" . "Inner Authentication")))))
+    ("wpa" . (("Name" . "wpa2")
+             ("reqs" . (("psk" . "PSK")))))
+    ("wep" . (("Name" . "wep")
+             ("reqs" . (("wep-key0" . "WEP Key")))))
+    ("leap" . (("Name" . "leap")
+              ("reqs" . (("leap-username" . "Username")
+                         ("leap-password" . "Password")))))
+    )
+  "The security types for NetworkManager.
+This is still in the process of being worked on."
+  )
+
+(defvar enwc-nm-wired-dev nil
+  "The wired device object path.")
+
+(defvar enwc-nm-wireless-dev nil
+  "The wireless device object path.")
+
+(defvar enwc-nm-active-ap nil
+  "The active access point object path.")
+
+(defvar enwc-nm-connecting-p nil
+  "Whether or not NetworkManager is connecting.")
+
+(defvar enwc-nm-wired-p nil
+  "Whether or not NetworkManager is wired.")
+
+(defun enwc-nm-get-settings (conn)
+  "Gets the connection settings.
+CONN is an object path to the connection."
+  (dbus-call-method :system
+                   enwc-nm-dbus-service
+                   conn
+                   enwc-nm-dbus-connections-interface
+                   "GetSettings"
+                   :timeout 25000))
+  
+
+(defun enwc-nm-list-connections ()
+  "List the connections."
+  (dbus-call-method :system
+                   enwc-nm-dbus-service
+                   enwc-nm-dbus-settings-path
+                   enwc-nm-dbus-settings-interface
+                   "ListConnections"
+                   :timeout 25000))
+
+;; Default
+(defun enwc-nm-get-device-by-name (name)
+  (dbus-call-method :system
+                   enwc-nm-dbus-service
+                   enwc-nm-dbus-path
+                   enwc-nm-dbus-interface
+                   "GetDeviceByIpIface"
+                   :timeout 25000
+                   :string name))
+
+;; Settings, Connections
+(defun enwc-nm-get-uuid-by-ssid (ssid)
+  "Gets the uuid of the network with ssid SSID."
+  (let ((conns (enwc-nm-list-connections))
+       cur-conn cur-ssid uuid)
+    (while (and conns (not uuid))
+      (setq cur-conn (pop conns))
+      (let ((settings (enwc-nm-get-settings cur-conn)))
+       (if (not (assoc "802-11-wireless" settings))
+           nil
+         (setq cur-ssid
+               (dbus-byte-array-to-string (car (cadr (assoc "ssid"
+                                                            (cadr (assoc 
"802-11-wireless" settings)))))))
+         (if (string= cur-ssid ssid)
+             (setq uuid (car (cadr (assoc "uuid" (cadr (assoc "connection" 
settings))))))))))))
+
+(defun enwc-nm-get-uuid-by-id (id)
+  (let ((conns (enwc-nm-list-connections))
+       cur-conn cur-id uuid)
+    (while (and conns (not uuid))
+      (setq cur-conn (pop conns))
+      (let ((settings (enwc-nm-get-settings cur-conn))
+           conn-set)
+       (if (not (assoc "connection" settings))
+           nil
+         (setq conn-set (assoc "connection" settings))
+         (setq cur-id (car (cadr (assoc "id" (cadr conn-set)))))
+         (if (string= cur-id id)
+             (setq uuid (car (cadr (assoc "uuid" (cadr conn-set)))))))))))
+
+(defun enwc-nm-get-conn-by-uuid (uuid)
+  (dbus-call-method :system
+                   enwc-nm-dbus-service
+                   enwc-nm-dbus-settings-path
+                   enwc-nm-dbus-settings-interface
+                   "GetConnectionByUuid"
+                   :timeout 25000
+                   uuid))
+
+;; Settings
+(defun enwc-nm-get-conn-by-ssid (ssid)
+  "Gets the connection path for the access point with ssid SSID."
+  (let ((uuid (enwc-nm-get-uuid-by-ssid ssid)))
+    (enwc-nm-get-conn-by-uuid uuid)))
+
+(defun enwc-nm-get-conn-by-id (id)
+  (let ((uuid (enwc-nm-get-uuid-by-id id)))
+    (enwc-nm-get-conn-by-uuid uuid)))
+
+
+;; Wireless
+(defun enwc-nm-scan ()
+  "The NetworkManager scan function."
+  (dbus-call-method :system
+                   enwc-nm-dbus-service
+                   enwc-nm-wireless-dev
+                   enwc-nm-dbus-wireless-interface
+                   "RequestScan"
+                   :timeout 25000
+                   '(:array :signature "{sv}")))
+
+;; Wireless
+(defun enwc-nm-get-networks ()
+  "The NetworkManager get networks function.
+This returns a list of D-Bus paths to the access points."
+  (dbus-call-method :system
+                   enwc-nm-dbus-service
+                   enwc-nm-wireless-dev
+                   enwc-nm-dbus-wireless-interface
+
+                   "GetAccessPoints"))
+
+;; Accesspoint
+(defun enwc-nm-get-wireless-network-property (id prop)
+  "The NetworkManager get wireless network property function.
+This runs like normal, using element ID of `enwc-access-points'
+ to determine the access point path, then obtains the property
+PROP from that access point.  It also sets the channel from the
+ frequency if necessary."
+  (let ((ap (nth id enwc-access-points))
+       ret)
+    (setq ret (dbus-get-property :system
+                                enwc-nm-dbus-service
+                                ap
+                                enwc-nm-dbus-accesspoint-interface
+                                prop))
+    (if (string= prop "Frequency")
+       (setq ret (number-to-string (1+ (/ (- ret 2412) 5)))))
+    (if (string= prop "Ssid")
+       (setq ret (dbus-byte-array-to-string ret)))
+    (if (string= prop "Mode")
+       (setq ret (cond ((= ret 0) "Unknown")
+                       ((= ret 1) "Ad-Hoc")
+                       ((= ret 2) "Infrastructure"))))
+    ret))
+
+(defun enwc-nm-get-encryption-type (id)
+  "The NetworkManager get encryption type function.
+This gets the WPA flags and RSN flags from access point in ID.
+If both are 0, then it returns WEP, otherwise WPA."
+  (let ((wpa-flags (enwc-nm-get-wireless-network-property id "WpaFlags"))
+       (rsn-flags (enwc-nm-get-wireless-network-property id "RsnFlags")))
+    (if (and (= wpa-flags 0) (= rsn-flags 0))
+       "WEP"
+      "WPA")))
+
+;; Default
+(defun enwc-nm-connect (id)
+  "The NetworkManager connect function.
+This gets the connection path from ID, and connects to it."
+  (let ((ssid (enwc-nm-get-wireless-network-property id "Ssid")))
+    (dbus-call-method :system
+                     enwc-nm-dbus-service
+                     enwc-nm-dbus-path
+                     enwc-nm-dbus-interface
+                     "ActivateConnection"
+                     :timeout 25000
+                     :object-path (enwc-nm-get-conn-by-ssid ssid)
+                     :object-path enwc-nm-wireless-dev
+                     :object-path (nth id enwc-access-points))))
+
+
+(defun enwc-nm-string-idx (obj list)
+  (let ((tmp-list list)
+       (cur-pos -1)
+       cur-obj)
+    (while (and (not cur-obj) tmp-list)
+      (setq cur-obj (pop tmp-list))
+      (setq cur-pos (1+ cur-pos))
+      (if (not (string= obj cur-obj))
+         (setq cur-obj nil)))
+    cur-pos))
+
+(defun enwc-nm-wireless-prop-changed (props)
+  (if (assoc "ActiveAccessPoint" props)
+      (setq enwc-nm-active-ap (car (cadr (assoc "ActiveAccessPoint"
+                                               props))))))
+
+;; Wireless
+(defun enwc-nm-get-current-nw-id (wired)
+  "The NetworkManager get current network id function.
+This simply checks for the active access point."
+  (if (or wired (string= enwc-nm-active-ap "/"))
+      -1
+    (enwc-nm-string-idx enwc-nm-active-ap enwc-access-points)))
+
+(defun enwc-nm-prop-changed (state)
+  (setq enwc-nm-connecting-p (eq state 40)))
+
+;; Default
+(defun enwc-nm-check-connecting ()
+  "The NetworkManager check connecting function."
+  enwc-nm-connecting-p)
+
+;; Device
+(defun enwc-nm-disconnect-wireless ()
+  (dbus-call-method :system
+                   enwc-nm-dbus-service
+                   enwc-nm-wireless-dev
+                   enwc-nm-dbus-device-interface
+                   "Disconnect"))
+
+;; Settings, Connections
+(defun enwc-nm-get-wired-profiles ()
+  (let ((profs-list (enwc-nm-list-connections)))
+    (mapcar (lambda (x)
+             (let ((props (enwc-nm-get-settings x)))
+               (if (string= (caar props) "connection")
+                   (car (cadr (car (cadr (car props))))))))
+           profs-list)))
+
+(defun enwc-nm-wired-connect (id)
+  (let ((nid (nth id enwc-access-points)))
+    (dbus-call-method :system
+                     enwc-nm-dbus-service
+                     enwc-nm-dbus-path
+                     enwc-nm-dbus-interface
+                     :timeout 25000
+                     :object-path (enwc-nm-get-conn-by-id nid)
+                     :object-path enwc-nm-wired-dev
+                     :objec-path "/")))
+
+;; Device
+(defun enwc-nm-wired-disconnect ()
+  (dbus-call-method :system
+                   enwc-nm-dbus-service
+                   enwc-nm-wired-dev
+                   enwc-nm-dbus-device-interface
+                   "Disconnect"))
+
+(defun enwc-nm-dev-prop-changed (new-state old-state reason)
+  (setq enwc-nm-wired-p (eq new-state 100)))
+
+;; Default
+(defun enwc-nm-is-wired ()
+  enwc-nm-wired-p)
+
+;; Each entry in sec-types should be:
+;; ("IDENT" (("Name" . "NAME") ("reqs" . (("key1" . "Entry1") ("key2" . 
"Entry2") ... ))))
+;; Where:
+;;  "IDENT" => String that identifies this to the backend.
+;;  "NAME" => String that ENWC displays
+;;  "reqs" => Constant string, but the association list holds entries
+;;              required by the security type, i.e. user, passphrase, etc.
+;;  "keyXX" => String that the backend uses for this security entry.
+;;  "EntryXX" => String that ENWC displays for this security entry.
+
+(defun enwc-nm-get-sec-types (wired)
+  "Get security types."
+  (if wired
+      nil
+    nil)
+  )
+
+(defun enwc-nm-convert-addr (addr)
+  (let* ((hex-addr (format "%08x" addr))
+        (ret-addr (format "%i.%i.%i.%i"
+                          (string-to-number (substring hex-addr
+                                                       6 8)
+                                            16)
+                          (string-to-number (substring hex-addr
+                                                       4 6)
+                                            16)
+                          (string-to-number (substring hex-addr
+                                                       2 4)
+                                            16)
+                          (string-to-number (substring hex-addr
+                                                       0 2)
+                                            16))))
+    ret-addr))
+
+(defun enwc-nm-addr-back (addr)
+  (let ((bytes (split-string addr "."))
+        ret-val)
+    (setq ret-val (logior (lsh (string-to-number (nth 3 bytes))
+                              0)
+                         (lsh (string-to-number (nth 2 bytes))
+                              1)
+                         (lsh (string-to-number (nth 1 bytes))
+                              2)
+                         (lsh (string-to-number (nth 0 bytes))
+                              3)))))
+
+;; These next two come from libnm-util/nm-utils.c in NM's source.
+
+(defun enwc-nm-netmask-to-prefix (netmask)
+  "Converts a netmask to a prefix.
+NETMASK is an ip address in network byte order."
+  (let* ((mask netmask)
+        (cur-pos 3)
+        (cur-mark (logand (lsh mask (* -8 cur-pos)) 255))
+        (pf 0))
+    (while (and (eq cur-mark 255) (>= cur-pos 0))
+      (setq pf (+ pf 8))
+      (setq cur-pos (1- cur-pos))
+      (setq cur-mark (logand (lsh mask (* -8 cur-pos)) 255))
+    )
+
+    (if (>= cur-pos 0)
+       (let ((v (logand (lsh mask (* -8 cur-pos)) 255)))
+         (while (not (eq v 0))
+           (setq pf (1+ pf))
+           (setq v (lsh v 1)))))
+    pf))
+
+(defun enwc-nm-prefix-to-netmask (prefix)
+  "Converts a prefix to a netmask.
+PREFIX is an integer <= 32."
+  (let ((pf prefix)
+       (netmask 0)
+       (msk #x80000000))
+  (while (> pf 0)
+    (setq netmask (logior netmask msk))
+    (setq msk (lsh msk -1))
+    (setq pf (1- pf)))
+  netmask))
+
+(defun enwc-nm-get-ip-addr (wired id)
+  "Gets the IP Address of a connection profile."
+  (let ((props (enwc-nm-get-settings (nth id enwc-access-points)))
+       ipaddr ret-addr)
+    (setq ipaddr (nth 0 (caar (cadr (assoc "addresses"
+                                          (cadr (assoc "ipv4"
+                                                       props)))))))
+    (setq ret-addr (enwc-nm-convert-addr ipaddr))))
+
+(defun enwc-nm-get-netmask (wired id)
+  "Gets the Netmask of a connection profile."
+  (let ((props (enwc-nm-get-settings (nth id enwc-access-points)))
+       ipaddr hex-addr ret-addr)
+    (setq ipaddr (nth 3 (caar (cadr (assoc "addresses"
+                                          (cadr (assoc "ipv4"
+                                                       props)))))))
+    (setq hex-addr (enwc-nm-prefix-to-netmask ipaddr))
+    (setq ret-addr (format "%i.%i.%i.%i"
+                          (logand hex-addr 255)
+                          (logand (lsh hex-addr -8) 255)
+                          (logand (lsh hex-addr -16) 255)
+                          (logand (lsh hex-addr -24) 255)))))
+    
+
+(defun enwc-nm-get-gateway (wired id)
+  "Gets the Gateway of a connection profile."
+  (let ((props (enwc-nm-get-settings (nth id enwc-access-points)))
+       ipaddr ret-addr)
+    (setq ipaddr (nth 2 (caar (cadr (assoc "addresses"
+                                          (cadr (assoc "ipv4"
+                                                       props)))))))
+    (setq ret-addr (enwc-nm-convert-addr ipaddr))))
+
+(defun enwc-nm-get-dns (wired id)
+  "Gets the DNS settings of a connection profile."
+  (let ((props (enwc-nm-get-settings (nth id enwc-access-points)))
+       dns-list)
+    (setq dns-list (car (cadr (assoc "dns" (cadr (assoc "ipv4"
+                                                       props))))))
+    (mapcar 'enwc-nm-convert-addr
+           dns-list)))
+
+(defun enwc-nm-finalize-settings (settings)
+  "Sets up all of the D-BUS types of a settings list.
+SETTINGS is the list of settings list to setup.
+This will place all of the necessary markers in the list,
+such as :array, :dict-entry, etc."
+  (cons :array
+       (let (first-one)
+         (mapc (lambda (x)
+                 (setq first-one (cons :dict-entry first-one))
+                 (setq first-one
+                       (cons (cons :string
+                                   (cons (car x)
+                                         (cons (cons :array
+                                                     (let (this-one)
+                                                       (mapc (lambda (y)
+                                                               (setq this-one
+                                                                     (cons 
:dict-entry this-one))
+                                                               (setq this-one
+                                                                     (cons 
(list :string (car y)
+                                                                               
  :variant
+                                                                               
  (if (string= (car y) "ssid")
+                                                                               
      (cons (dbus-string-to-byte-array
+                                                                               
             (dbus-byte-array-to-string (car (cadr y))))
+                                                                               
            nil)
+                                                                               
    (cadr y)))
+                                                                           
this-one)))
+                                                             (cadr x))
+                                                       (nreverse this-one))) 
nil)))
+                             first-one)))
+               settings)
+         (nreverse first-one))))
+
+
+(defun enwc-nm-setup-settings (id settings)
+  (let ((props (enwc-nm-get-settings (nth id enwc-access-points)))
+       ret-list)
+    (setcdr (assoc "addresses" (cadr (assoc "ipv4" props)))
+           (list (list (list (list (enwc-nm-addr-back
+                                    (cdr (assoc "addr" settings)))
+                                   (enwc-nm-netmask-to-prefix 
(enwc-nm-addr-back
+                                                               (cdr (assoc 
"netmask"
+                                                                           
settings))))
+                                   (enwc-nm-addr-back
+                                    (cdr (assoc "gateway" settings))))))))
+    (setcdr (assoc "dns" (cadr (assoc "ipv4" props)))
+           (list (list (list (enwc-nm-addr-back
+                              (cdr (assoc "dns1" settings)))
+                             (enwc-nm-addr-back
+                              (cdr (assoc "dns2" settings)))))))
+    ))
+
+(defun enwc-nm-save-nw-settings (wired id settings)
+  "Saves network settings.
+ID is the network id of the profile to save,
+WIRED denotes whether or not this is a wired profile,
+and SETTINGS is the list of settings."
+  (dbus-call-method :system
+                   enwc-nm-dbus-service
+                   (nth id enwc-access-points)
+                   enwc-nm-dbus-connections-interface
+                   :timeout 25000
+                   "Update"
+                   (enwc-nm-setup-settings id settings)))
+
+(defun enwc-nm-setup ()
+  (setq enwc-nm-wired-dev (enwc-nm-get-device-by-name enwc-wired-device)
+       enwc-nm-wireless-dev (enwc-nm-get-device-by-name enwc-wireless-device))
+
+  (dbus-register-signal :system
+                       enwc-nm-dbus-service
+                       enwc-nm-wireless-dev
+                       enwc-nm-dbus-wireless-interface
+                       "AccessPointAdded"
+                       'enwc-process-scan)
+
+  (dbus-register-signal :system
+                       enwc-nm-dbus-service
+                       enwc-nm-wireless-dev
+                       enwc-nm-dbus-wireless-interface
+                       "AccessPointRemoved"
+                       'enwc-process-scan)
+
+  (setq enwc-nm-active-ap
+       (let ((cur-net (dbus-get-property :system
+                                         enwc-nm-dbus-service
+                                         enwc-nm-wireless-dev
+                                         enwc-nm-dbus-wireless-interface
+                                         "ActiveAccessPoint")))
+         (if (string= cur-net "/")
+             -1
+           cur-net)))
+
+  (dbus-register-signal :system
+                       enwc-nm-dbus-service
+                       enwc-nm-wireless-dev
+                       enwc-nm-dbus-wireless-interface
+                       "PropertiesChanged"
+                       'enwc-nm-wireless-prop-changed)
+
+  (setq enwc-nm-connecting-p
+       (let ((state (dbus-get-property :system
+                                       enwc-nm-dbus-service
+                                       enwc-nm-dbus-path
+                                       enwc-nm-dbus-interface
+                                       "State")))
+         (eq state 40)))
+
+  (dbus-register-signal :system
+                       enwc-nm-dbus-service
+                       enwc-nm-wired-dev
+                       enwc-nm-dbus-device-interface
+                       "StateChanged"
+                       'enwc-nm-dev-prop-changed)
+
+  (setq enwc-nm-wired-p
+       (let ((state (dbus-get-property :system
+                                       enwc-nm-dbus-service
+                                       enwc-nm-wired-dev
+                                       enwc-nm-dbus-device-interface
+                                       "State")))
+         (eq state 100)))
+  (dbus-register-signal :system
+                       enwc-nm-dbus-service
+                       enwc-nm-dbus-path
+                       enwc-nm-dbus-interface
+                       "StateChanged"
+                       'enwc-nm-prop-changed)
+  )
+
+
+(provide 'enwc-nm)
+
+;;; End of File.
diff --git a/lisp/enwc-nm.elc b/lisp/enwc-nm.elc
new file mode 100644
index 0000000..4e37941
Binary files /dev/null and b/lisp/enwc-nm.elc differ
diff --git a/lisp/enwc-setup.el b/lisp/enwc-setup.el
new file mode 100644
index 0000000..aea9435
--- /dev/null
+++ b/lisp/enwc-setup.el
@@ -0,0 +1,112 @@
+;; enwc-setup.el - Setup routines for ENWC
+
+;; Copyright (C) 2012 Ian Dunn
+
+;; Author: Ian Dunn
+;; Keywords: enwc, network, wicd, manager, nm
+
+;; This file is part of ENWC
+
+;; ENWC 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 3, or (at your option)
+;; any later version.
+
+;; ENWC 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 ENWC; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+
+(require 'enwc)
+(require 'enwc-wicd)
+(require 'enwc-nm)
+
+(defun enwc-setup-backend (cur-back)
+  "Sets up ENWC to use the correct function for the backend CUR-BACK."
+  (let ((sym-name (symbol-name cur-back)))
+    (setq enwc-scan-func (intern (concat "enwc-"
+                                        sym-name
+                                        "-scan"))
+         enwc-get-nw-func (intern (concat "enwc-"
+                                          sym-name
+                                          "-get-networks"))
+         enwc-get-wireless-nw-prop-func (intern (concat "enwc-"
+                                                        sym-name
+                                                        
"-get-wireless-network-property"))
+         enwc-details-list (symbol-value (intern (concat "enwc-"
+                                                         sym-name
+                                                         "-details-list")))
+         enwc-get-encryption-type-func (intern (concat "enwc-"
+                                                       sym-name
+                                                       "-get-encryption-type"))
+         enwc-wireless-connect-func (intern (concat "enwc-"
+                                                    sym-name
+                                                    "-connect"))
+         enwc-get-current-nw-id-func (intern (concat "enwc-"
+                                                     sym-name
+                                                     "-get-current-nw-id"))
+         enwc-check-connecting-func (intern (concat "enwc-"
+                                                    sym-name
+                                                    "-check-connecting"))
+         enwc-get-wired-profiles-func (intern (concat "enwc-"
+                                                      sym-name
+                                                      "-get-wired-profiles"))
+         enwc-is-wired-func (intern (concat "enwc-"
+                                            sym-name
+                                            "-is-wired"))
+         enwc-wired-connect-func (intern (concat "enwc-"
+                                                 sym-name
+                                                 "-wired-connect"))
+         enwc-wired-disconnect-func (intern (concat "enwc-"
+                                                    sym-name
+                                                    "-wired-disconnect"))
+         enwc-get-sec-types-func (intern (concat "enwc-"
+                                                 sym-name
+                                                 "-get-sec-types"))
+         enwc-get-ip-addr-func (intern (concat "enwc-"
+                                               sym-name
+                                               "-get-ip-addr"))
+         enwc-get-netmask-func (intern (concat "enwc-"
+                                               sym-name
+                                               "-get-netmask"))
+         enwc-get-gateway-func (intern (concat "enwc-"
+                                               sym-name
+                                               "-get-gateway"))
+         enwc-get-dns-func (intern (concat "enwc-"
+                                           sym-name
+                                           "-get-dns"))
+         enwc-save-nw-settings-func (intern (concat "enwc-"
+                                                    sym-name
+                                                    "-save-nw-settings"))
+         )
+    (funcall (intern (concat "enwc-" sym-name "-setup")))))
+
+(defun enwc-setup ()
+  "Sets up enwc mode and confirms that one of the backends
+ can be found on D-Bus."
+  (setq global-mode-string (append global-mode-string
+                                  '(enwc-display-string)))
+  (run-at-time t 1 'enwc-update-mode-line)
+
+  (let ((cur-back nil)
+       (back-list enwc-backends))
+    (while (and back-list (not cur-back))
+      (setq cur-back (pop back-list))
+      (if (not (dbus-ping :system
+                         (symbol-value (intern (concat "enwc-"
+                                                       (symbol-name cur-back)
+                                                       "-dbus-service")))))
+         (setq cur-back nil)))
+    (if cur-back
+       (enwc-setup-backend cur-back)
+      (error "No usable backend found."))))
+
+(provide 'enwc-setup)
+
+;;; End of File.
diff --git a/lisp/enwc-setup.elc b/lisp/enwc-setup.elc
new file mode 100644
index 0000000..a7829b3
Binary files /dev/null and b/lisp/enwc-setup.elc differ
diff --git a/lisp/enwc-wicd.el b/lisp/enwc-wicd.el
new file mode 100644
index 0000000..94067ef
--- /dev/null
+++ b/lisp/enwc-wicd.el
@@ -0,0 +1,282 @@
+;;; enwc-wicd.el --- The Wicd backend to ENWC
+
+;; Copyright (C) 2012 Ian Dunn
+
+;; Author: Ian Dunn
+;; Keywords: enwc, network, wicd, manager, nm
+
+;; This file is part of ENWC
+
+;; ENWC 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 3, or (at your option)
+;; any later version.
+
+;; ENWC 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 ENWC; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+
+;;; Commentary:
+
+
+(require 'enwc)
+
+(defgroup enwc-wicd nil
+  "*Wicd variables for ENWC."
+  :prefix "enwc-wicd-"
+  :group 'enwc)
+
+(defcustom enwc-wicd-dbus-service "org.wicd.daemon"
+  "The wicd D-Bus service identifier."
+  :group 'enwc-wicd
+  :type 'string)
+
+(defcustom enwc-wicd-dbus-wireless-path "/org/wicd/daemon/wireless"
+  "The wicd wireless D-Bus path."
+  :group 'enwc-wicd
+  :type 'string)
+
+(defcustom enwc-wicd-dbus-wireless-interface "org.wicd.daemon.wireless"
+  "The wicd wireless D-Bus interface."
+  :group 'enwc-wicd
+  :type 'string)
+
+(defcustom enwc-wicd-dbus-wired-path "/org/wicd/daemon/wired"
+  "The wicd wired D-Bus path."
+  :group 'enwc-wicd
+  :type 'string)
+
+(defcustom enwc-wicd-dbus-wired-interface "org.wicd.daemon.wired"
+  "The wicd wired D-Bus interface."
+  :group 'enwc-wicd
+  :type 'string)
+
+(defvar enwc-wicd-details-list
+  '("essid" "bssid" "quality" "encryption" "mode" "channel")
+  "The list of the desired details to be obtained from each network.")
+
+(defun enwc-wicd-dbus-wireless-call-method (method &rest args)
+  "Calls D-Bus method METHOD with arguments ARGS within
+the wicd wireless interface."
+  (apply 'dbus-call-method :system
+        enwc-wicd-dbus-service
+        enwc-wicd-dbus-wireless-path
+        enwc-wicd-dbus-wireless-interface
+        method
+        :timeout 25000
+        args))
+
+(defun enwc-wicd-dbus-wired-call-method (method &rest args)
+  "Calls D-Bus method METHOD with arguments ARGS within
+the wicd wired interface."
+  (apply 'dbus-call-method :system
+        enwc-wicd-dbus-service
+        enwc-wicd-dbus-wired-path
+        enwc-wicd-dbus-wired-interface
+        method
+        :timeout 25000
+        args))
+
+(defun enwc-wicd-scan ()
+  "Wicd scan function."
+  (enwc-wicd-dbus-wireless-call-method "Scan"))
+
+(defun enwc-wicd-get-networks ()
+  "Wicd get networks function.  Just returns a number sequence."
+  (number-sequence 0 (1- (enwc-wicd-dbus-wireless-call-method 
"GetNumberOfNetworks"))))
+
+(defun enwc-wicd-get-wireless-network-property (id prop)
+  "Wicd get wireless network property function.
+This calls the D-Bus method on Wicd to get the property PROP
+from wireless network with id ID."
+  (enwc-wicd-dbus-wireless-call-method "GetWirelessProperty"
+                                      id prop))
+
+(defun enwc-wicd-get-encryption-type (id)
+  "Wicd get encryption type function.
+This calls the D-Bus method on Wicd to get the encryption_method
+property from wireless network with id ID."
+  (enwc-wicd-dbus-wireless-call-method "GetWirelessProperty"
+                                      id "encryption_method"))
+
+(defun enwc-wicd-connect (id)
+  "Wicd connect function.
+This calls the D-Bus method on Wicd to connect to wireless
+network with id ID."
+  (enwc-wicd-dbus-wireless-call-method "ConnectWireless" id))
+
+(defun enwc-wicd-get-current-nw-id (wired)
+  "Wicd get current network id function.
+This calls the D-Bus method on Wicd to get the current
+wireless network id."
+  (enwc-wicd-dbus-wireless-call-method "GetCurrentNetworkID"))
+
+(defun enwc-wicd-check-connecting ()
+  "The Wicd check connecting function."
+  (enwc-wicd-dbus-wireless-call-method "CheckIfWirelessConnecting"))
+
+(defun enwc-wicd-disconnect ()
+  "Wicd disconnect function."
+  (enwc-wicd-dbus-wireless-call-method "DisconnectWireless"))
+
+(defun enwc-wicd-get-wired-profiles ()
+  "Gets the list of wired network profiles."
+  (enwc-wicd-dbus-wired-call-method "GetWiredProfileList"))
+
+(defun enwc-wicd-wired-connect (id)
+  "Connects to the wired network with profile id ID."
+  (let* ((profs (enwc-get-wired-profiles))
+        (prf (nth id profs)))
+    (enwc-wicd-dbus-wired-call-method "ReadWiredNetworkProfile" prf)
+    (enwc-wicd-dbus-wired-call-method "ConnectWired")))
+
+(defun enwc-wicd-wired-disconnect ()
+  "Disconnects from the wired connection."
+  (enwc-wicd-dbus-wired-call-method "DisconnectWired"))
+
+(defun enwc-wicd-is-wired ()
+  "Checks to see if wired is connected."
+  (not (not (enwc-wicd-dbus-wired-call-method "GetWiredIP"))))
+
+(defun enwc-wicd-get-wired-nw-prop (id det)
+  "Gets property DET from the wired network with id ID."
+  (enwc-wicd-dbus-wired-call-method "GetWiredProperty" id det))
+
+;; Each entry in sec-types should be:
+;; ("IDENT" (("Name" . "NAME") ("reqs" . (("key1" . "Entry1") ("key2" . 
"Entry2") ... ))))
+;; Where:
+;;  "IDENT" => String that identifies this to the backend.
+;;  "NAME" => String that ENWC displays
+;;  "reqs" => Constant string, but the association list holds entries
+;;              required by the security type, i.e. user, passphrase, etc.
+;;  "keyXX" => String that the backend uses for this security entry.
+;;  "EntryXX" => String that ENWC displays for this security entry.
+
+(defun enwc-wicd-get-sec-types (wired)
+  "Gets the list of security types.
+WIRED indicates whether this is a wired connection.
+The returned list will be in the format:
+ (name . ((\"Name\" . \"DISPLAY-NAME\")
+          (\"reqs\" . ((\"Display\" . \"id\") ...))))"
+  (let (sec-types
+       ret-list)
+    (with-temp-buffer
+      (insert-file-contents (concat "/etc/wicd/encryption/templates/active"
+                                   (if wired
+                                       "_wired")))
+      (setq sec-types (split-string (buffer-string) "\n")))
+    (setq ret-list
+         (mapcar (lambda (x)
+                   (if (not (eq (length x) 0))
+                       (let (name reqs)
+                         (with-temp-buffer
+                           (insert-file-contents (concat 
"/etc/wicd/encryption/templates/"
+                                                         x))
+                           (re-search-forward "name[ \t]*=[ 
\t]*\\([^\n]*\\)[\n]")
+                           (setq name (match-string 1))
+                           (re-search-forward "require[ \t]*\\([^\n]*\\)[\n]")
+                           (let ((str-reqs (split-string (match-string 1) " 
")))
+                             (while str-reqs
+                               (setq reqs
+                                     (append reqs
+                                             (cons (cons (pop str-reqs)
+                                                         (pop str-reqs))
+                                                   nil)))))
+                           (cons x (cons (cons "Name" name) (cons (cons "reqs" 
(cons reqs nil)) nil)))
+                           ))))
+                 sec-types))))
+
+(defun enwc-wicd-get-profile-ent (wired id ent)
+  "Gets profile entry ENT from the network with id ID.
+WIRED is set to indicate whether this is a wired network.
+This function is a wrapper around the *-get-(wired|wireless)-nw-prop
+functions, allowing for a single function that checks for wired."
+  (if wired
+      (enwc-wicd-get-wired-nw-prop id ent)
+  (enwc-wicd-get-wireless-network-property id ent)))
+
+(defun enwc-wicd-get-ip-addr (wired id)
+  "Gets the IP Address from the network with id ID.
+Wired is set to indicate whether this is a wired network."
+  (or (enwc-wicd-get-profile-ent wired id "ip") ""))
+
+(defun enwc-wicd-get-netmask (wired id)
+  "Gets the Netmask from the network with id ID.
+WIRED is set to indicate whether this is a wired network."
+  (or (enwc-wicd-get-profile-ent wired id "netmask") ""))
+
+(defun enwc-wicd-get-gateway (wired id)
+    "Gets the Gateway from the network with id ID.
+WIRED is set to indicate whether this is a wired network."
+  (or (enwc-wicd-get-profile-ent wired id "gateway") ""))
+
+(defun enwc-wicd-get-dns (wired id)
+    "Gets the list of DNS servers from the network with id ID.
+WIRED is set to indicate whether this is a wired network."
+  (list (or (enwc-wicd-get-profile-ent wired id "dns1") "")
+       (or (enwc-wicd-get-profile-ent wired id "dns2") "")
+       (or (enwc-wicd-get-profile-ent wired id "dns3") "")))
+
+(defun enwc-wicd-set-nw-prop (wired id prop val)
+  "Sets the network property PROP of the network with id ID
+to VAL.
+WIRED indicates whether this is a wired network."
+  (if wired
+      (enwc-wicd-dbus-wired-call-method "SetWiredProperty"
+                                       id prop val)
+    (enwc-wicd-dbus-wireless-call-method "SetWirelessProperty"
+                                        id prop val)))
+
+(defun enwc-wicd-save-nw-profile (wired id)
+  "Save the network profile with for the network with id ID.
+WIRED indicates whether this is a wired network."
+  (if wired
+      (enwc-wicd-dbus-wired-call-method "SaveWiredNetworkProfile" id)
+    (enwc-wicd-dbus-wireless-call-method "SaveWirelessNetworkProfile" id)))
+
+(defun enwc-wicd-save-nw-settings (wired id settings)
+  "Saves the settings indicated by the association list SETTINGS for
+the network with id ID."
+  (let ((enctype (cdr (assoc "enctype" settings))))
+
+    (enwc-wicd-set-nw-prop wired id "ip"
+                          (cdr (assoc "addr" settings)))
+    (enwc-wicd-set-nw-prop wired id "netmask"
+                          (cdr (assoc "netmask" settings)))
+    (enwc-wicd-set-nw-prop wired id "gateway"
+                          (cdr (assoc "gateway" settings)))
+
+    (enwc-wicd-set-nw-prop wired id "dns1"
+                          (cdr (assoc "dns1" settings)))
+    (enwc-wicd-set-nw-prop wired id "dns2"
+                          (cdr (assoc "dns2" settings)))
+
+    (enwc-wicd-set-nw-prop wired id "enctype" enctype)
+    (if (not (string= enctype "None"))
+       (dolist (x (cadr (assoc "reqs"
+                               (cdr (assoc enctype
+                                           (enwc-wicd-get-sec-types wired))))))
+         (enwc-wicd-set-nw-prop wired id (car x)
+                                (cdr (assoc (car x) settings)))))
+    (enwc-wicd-save-nw-profile wired id))
+  )
+
+(defun enwc-wicd-setup ()
+  ;; Thanks to Michael Albinus for pointing out this signal.
+  (dbus-register-signal :system
+                       enwc-wicd-dbus-service
+                       enwc-wicd-dbus-wireless-path
+                       enwc-wicd-dbus-wireless-interface
+                       "SendEndScanSignal"
+                       'enwc-process-scan))
+
+(provide 'enwc-wicd)
+
+;;; End of File
diff --git a/lisp/enwc-wicd.elc b/lisp/enwc-wicd.elc
new file mode 100644
index 0000000..9ea32bd
Binary files /dev/null and b/lisp/enwc-wicd.elc differ
diff --git a/lisp/enwc.el b/lisp/enwc.el
new file mode 100644
index 0000000..7b443f4
--- /dev/null
+++ b/lisp/enwc.el
@@ -0,0 +1,929 @@
+;;; enwc.el --- The Emacs Network Client
+
+;; Copyright (C) 2012 Ian Dunn
+
+;; Author: Ian Dunn
+;; Keywords: enwc, network, wicd, manager, nm
+
+;; This file is part of ENWC
+
+;; ENWC 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 3, or (at your option)
+;; any later version.
+
+;; ENWC 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 ENWC; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+;; 02110-1301, USA.
+
+;; connect
+;; disconnect
+;; scan
+;; get-prop
+;; save-profile
+;; get-networks
+;; check-connecting
+;; get-current-nw-id
+
+;;; Commentary:
+;; In order to use this, add
+;;
+;; (require 'enwc-setup)
+;; (enwc-setup)
+;; 
+;; to your .emacs file.
+
+(require 'dbus)
+(require 'wid-edit)
+
+;;; Code:
+
+(eval-when-compile
+  (require 'cl))
+
+(defgroup enwc nil
+  "*The Emacs Network Client"
+  :prefix "ewnc-"
+  :group 'applications)
+
+(defcustom enwc-wireless-device "wlan0"
+  "The wireless device to use for ENWC."
+  :group 'enwc
+  :type 'string)
+
+(defcustom enwc-wired-device "eth0"
+  "The wired device to use for ENWC."
+  :group 'enwc
+  :type 'string)
+
+(defcustom enwc-backends '(wicd nm)
+  "The list of backends to be used by ENWC.
+These will be checked in the order designated here,
+and the first active backend found will be used."
+  :group 'enwc
+  :type 'list)
+
+;;; The function variables for the abstract layer.
+
+(defvar enwc-scan-func nil
+  "The function variable for the scan function.
+This variable is set during setup.")
+
+(defvar enwc-get-nw-func nil
+  "A function variable to be used in `enwc-get-nw'.
+This is redefined during setup to be the function to get the network
+ list.")
+
+(defvar enwc-get-wireless-nw-prop-func nil
+  "A function variable to be used in `enwc-get-wireless-nw-prop'.
+This is redefined during setup to be the function to get
+a wireless network property.")
+
+(defvar enwc-get-encryption-type-func nil
+  "A function variable to be used in `enwc-get-encryption-type'.
+This is redefined during setup to be the function to get the encryption
+type for the selected backend.")
+
+(defvar enwc-wireless-connect-func nil
+  "The function variable for the wireless connect function.
+This is redefined during setup to be the function to connect
+for the selected backend.")
+
+(defvar enwc-get-current-nw-id-func nil
+  "The function variable to be used in `enwc-get-current-nw-id'.
+This is redefined during setup to be the function to get
+the current network id.")
+
+(defvar enwc-check-connecting-func nil
+  "The function variable to be used in `enwc-check-connecting'.
+This is redefined during setup to be the function to
+check whether or not ENWC is connecting.")
+
+(defvar enwc-wireless-disconnect-func nil
+  "The function variable for the wireless disconnect function.
+This is redefined during setup to be the function to
+disconnect from the wireless network.")
+
+(defvar enwc-get-wired-profiles-func nil
+  "The function variable to be used in `enwc-get-wired-profiles'.
+This is redefined during setup to be the function to
+get the list of wired network profiles.")
+
+(defvar enwc-wired-connect-func nil
+  "The function variable for the wired connect function.
+This is redefined during setup to be the function
+to connect to a wired network.")
+
+(defvar enwc-wired-disconnect-func nil
+  "The function variable for the wired disconnect function.
+This is redefined during setup to be the function
+to disconnect from a wired network.")
+
+(defvar enwc-is-wired-func nil
+  "The function variable to be used in `enwc-is-wired'.
+This is redefined during setup to be the function to
+check whether or not a wired connection is active.")
+
+(defvar enwc-get-wired-nw-prop-func nil
+  "The function variable to be used in `enwc-get-wired-nw-prop'.
+This is redefined during setup to be the function to get
+a network property from a wired network.")
+
+(defvar enwc-get-sec-types-func nil
+  "The function variable to be used in `enwc-get-sec-types'.
+This is redefined during setup to be the function to get
+the security types for a given network.")
+
+(defvar enwc-get-ip-addr-func nil
+  "The function variable to be used in `enwc-get-ip-addr'.
+This is redefined during setup to be the function to get
+the IP Address of a given network.")
+
+(defvar enwc-get-netmask-func nil
+  "The function variable to be used in `enwc-get-netmask'.
+This is redefined during setup to be the function to get
+the Netmask of a given network.")
+
+(defvar enwc-get-gateway-func nil
+  "The function variable to be used in `enwc-get-gateway'.
+This is redefined during setup to be the function to get
+the Gateway of a given network.")
+
+(defvar enwc-get-dns-func nil
+  "The function variable to be used in `enwc-get-dns'.
+This is redefined during setup to be the function to get
+the DNS Server Addresses for a given network.")
+
+(defvar enwc-save-nw-settings-func nil
+  "The function variable to be used in `enwc-save-nw-settings'.
+This is redefined during setup to be the function to save
+the network settings of a given network.")
+
+(defvar enwc-details-list nil
+  "The network details list.
+
+This is redefined during setup to be the details list
+for the selected backend.
+
+This usually includes signal strength, essid, encryption type,
+bssid, mode, and channel.")
+
+(defvar enwc-display-string " [0%] "
+  "The mode line display string.
+This is altered every second to display the current network strength
+in `enwc-update-mode-line'.")
+
+(defvar enwc-wireless-headers '("ID" "STR" "ESSID"
+                               "ENCRYPT" "BSSID" "MODE" "CHNL")
+  "The list of headers to be displayed in the ENWC buffer.
+These correspond to the details in `enwc-details-list'.")
+
+(defvar enwc-id-width 3
+  "The width of the id column.")
+(defvar enwc-str-width 5
+  "The width of the strength column.")
+(defvar enwc-essid-width 5
+  "The initial width of the essid column.
+This is reset in wicd-scan-internal.")
+(defvar enwc-encrypt-width 10
+  "The width of the encryption column.")
+(defvar enwc-bssid-width 18
+  "The width of the bssid column.")
+(defvar enwc-mode-width 16
+  "The width of the mode column.")
+(defvar enwc-chnl-width 3
+  "The width of the channel column.")
+
+(defvar enwc-last-scan nil
+  "The most recent scan results.")
+
+(defvar enwc-access-points nil
+  "The most recent access point list.")
+
+(defvar enwc-using-wired nil
+  "Whether or not wired mode is active.
+
+This is `non-NIL' if ENWC is using wired connections.
+Note that this is NOT the same as `enwc-is-wired'.  This checks
+whether or not ENWC is in wired mode.")
+
+(defvar enwc-scan-done nil
+  "Whether or not a scan is finished.")
+
+(defvar enwc-edit-id nil
+  "This is the network id of the network being edited.")
+
+(defvar enwc-scan-requested nil)
+
+(make-local-variable 'enwc-edit-id)
+;; The Fonts
+
+(defface enwc-header-face
+  '((((class color) (background light))
+     (:foreground "Blue"))
+    (((class color) (background dark))
+     (:foreground "Blue"))
+    (t (:background "Blue")))
+  "The face for the headers."
+  :group 'enwc)
+
+(defface enwc-connected-face
+  '((((class color) (background dark))
+     (:foreground "Green"))
+    (((class color) (background light))
+     (:foreground "Green"))
+    (t (:background "Green")))
+  "The face for the connected network."
+  :group 'enwc)
+
+
+;; Small helper function.
+
+(defun enwc-detail-to-ident (detail)
+  "Converts detail DETAIL to a constant identifier."
+  (case (intern detail)
+    ((essid Ssid) "essid")
+    ((bssid HwAddress) "bssid")
+    ((quality Strength) "quality")
+    ((encryption Flags) "encryption")
+    ((mode Mode) "mode")
+    ((channel Frequency) "channel")))
+
+;;;;;;;;;;;;;;;;;;;;
+;; ENWC functions
+;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-do-scan ()
+  "Runs a backend scan."
+  (funcall enwc-scan-func))
+
+(defun enwc-get-nw ()
+  "Gets the identifiers for the access points
+from a previous scan."
+  (funcall enwc-get-nw-func))
+
+(defun enwc-get-current-nw-id ()
+  "Gets the id of the current network id,
+or `nil' if there isn't one."
+  (funcall enwc-get-current-nw-id-func enwc-using-wired))
+
+(defun enwc-check-connecting-p ()
+  "Checks to see if there is a connection
+in progress.  Returns `non-NIL' if there is one,
+`NIL' otherwise."
+  (funcall enwc-check-connecting-func))
+
+(defun enwc-get-wireless-nw-prop (id prop)
+  "Gets property PROP from wireless network with id
+ID and returns it."
+  (funcall enwc-get-wireless-nw-prop-func id prop))
+
+(defun enwc-get-encryption-type (id)
+  "Gets the encryption type used by the wireless
+network with id ID."
+  (funcall enwc-get-encryption-type-func id))
+
+(defun enwc-get-wired-profiles ()
+  "Gets the list of wired profiles."
+  (funcall enwc-get-wired-profiles-func))
+
+(defun enwc-wireless-connect (id)
+  "Begins a connection to wireless network with
+id ID."
+  (funcall enwc-wireless-connect-func id))
+
+(defun enwc-wireless-disconnect ()
+  "Disconnects the wireless."
+  (funcall enwc-wireless-disconnect-func))
+
+(defun enwc-wired-connect (id)
+  "Connects to the wired profile with id ID."
+  (funcall enwc-wired-connect-func id))
+
+(defun enwc-wired-disconnect ()
+  "Disconnects from the current network."
+  (funcall enwc-wired-disconnect-func))
+
+(defun enwc-is-wired-p ()
+  "Checks whether or not ENWC is connected to
+a wired network.
+Note that this is NOT the same as `enwc-using-wired'.
+This checks for an active wired connection."
+  (funcall enwc-is-wired-func))
+
+(defun enwc-get-sec-types (wired)
+  "Gets the security types for network.
+WIRED is set to indicate whether or not this is
+a wired network."
+  (funcall enwc-get-sec-types-func wired))
+
+(defun enwc-get-network-ent (wired id ent)
+  "Gets network entry ENT from the network with network id ID.
+WIRED is set to indicate whether or not this is
+a wired network."
+  (if wired
+      nil
+    (enwc-get-wireless-nw-prop id ent)))
+
+(defun enwc-get-wired-nw-prop (id prop)
+  "Gets network property PROP from
+ the wired network with network id ID."
+  (funcall enwc-get-wired-nw-prop-func id prop))
+
+(defun enwc-get-ip-addr (wired id)
+  "Gets the IP Address from the network with network id ID.
+WIRED is set to indicate whether or not this is
+a wired network."
+  (funcall enwc-get-ip-addr-func wired id))
+
+(defun enwc-get-netmask (wired id)
+  "Gets the Netmask from the network with network id ID.
+WIRED is set to indicate whether or not this is
+a wired network."
+  (funcall enwc-get-netmask-func wired id))
+
+(defun enwc-get-gateway (wired id)
+  "Gets the Gateway from the network with network id ID.
+WIRED is set to indicate whether or not this is
+a wired network."
+  (funcall enwc-get-gateway-func wired id))
+
+(defun enwc-get-dns (wired id)
+  "Gets the DNS Servers from the network with network id ID.
+WIRED is set to indicate whether or not this is
+a wired network."
+  (funcall enwc-get-dns-func wired id))
+
+(defun enwc-save-nw-settings (wired id settings)
+  "Saves network settings SETTINGS to the network profile with
+network id ID.
+SETTINGS is an association list with entries for the IP Address,
+Netmask, Gateway, DNS Servers, and Security.
+WIRED is set to indicate whether or not this is
+a wired network."
+  (funcall enwc-save-nw-settings-func wired id settings))
+
+;;;;;;;;;;;;;;;;;;;;;
+;; Actual Functions
+;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-is-valid-nw-id (id)
+  "Confirms that ID is a valid network id."
+  (<= 0 id))
+
+(defun enwc-get-nw-prop (wired id prop)
+  "Small function to get network property PROP from the network
+with network id ID.
+WIRED indicates whether or not this is a wired connection."
+  (if wired
+      (enwc-get-wired-nw-prop id prop)
+    (enwc-get-wireless-nw-prop id prop)))
+
+(defun enwc-update-mode-line ()
+  "Updates the mode line with the current network strength.
+If no network is connected, then prints 0%.
+If wired is active, then prints 100%.
+If ENWC is in the process of connecting, then prints *%.
+This is initiated during setup, and runs once every second."
+ (let ((cur-id (enwc-get-current-nw-id))
+       (conn (enwc-check-connecting-p))
+       str)
+    (setq str
+         (if (enwc-is-wired-p)
+             100
+           (if (enwc-is-valid-nw-id cur-id)
+               (cdr (assoc "quality" (nth cur-id enwc-last-scan)))
+             0)))
+    (setq enwc-display-string (concat " ["
+                                     (if conn
+                                         "*"
+                                       (number-to-string str))
+                                     "%] "))))
+
+;;;;;;;;;;;;;;;;;;
+;; Scan internal
+;;;;;;;;;;;;;;;;;;
+
+(defun enwc-scan-internal-wireless ()
+  "The initial scan routine.
+This initiates a scan using D-Bus, then exits,
+waiting for the callback."
+  (message "Scanning...")
+  (setq enwc-scan-requested t)
+  (enwc-do-scan))
+
+(defun enwc-process-scan (&rest args)
+  "The scanning callback.
+After a scan has been performed, this processes and displays
+the scan results."
+  (if (or enwc-using-wired (not enwc-scan-requested))
+      nil
+    (setq enwc-scan-requested nil)
+    (let ((cur-id 0))
+      (message "Scanning... Done")
+      (setq enwc-access-points (enwc-get-nw)
+           enwc-essid-width 5)
+      (setq enwc-last-scan
+           (mapcar (lambda (x)
+                     (let ((ret-itm (cons (cons "id" cur-id) nil)))
+                       (setq cur-id (1+ cur-id))
+                       (dolist (det enwc-details-list)
+                         (let ((cur-item (enwc-get-wireless-nw-prop x det))
+                               (ident (enwc-detail-to-ident det))
+                               pos-len)
+                           (if (string= ident "essid")
+                               (progn
+                                 (setq pos-len (length cur-item))
+                                 (setq enwc-essid-width
+                                       (max enwc-essid-width
+                                            pos-len))))
+                           (if (string= ident "encryption")
+                               (setq cur-item
+                                     (if cur-item
+                                         (enwc-get-encryption-type x)
+                                       "Unsecured"))
+                             )
+                           (setq ret-itm (append ret-itm
+                                                 (cons (cons ident
+                                                             cur-item)
+                                                       nil)))))
+                       ret-itm))
+                   (number-sequence 0 (1- (length enwc-access-points))))))
+    (setq enwc-essid-width (1+ enwc-essid-width))
+    (enwc-display-wireless-networks enwc-last-scan)
+    (goto-char 0)
+    (forward-line)))
+
+(defun enwc-scan-internal-wired ()
+  "The scanning routine for a wired connection.
+This gets the list of wired network profiles."
+  (message "Updating Profiles...")
+  (let ((profs (enwc-get-wired-profiles))
+       cur-prof fin-profs)
+    (while profs
+      (setq cur-prof (pop profs))
+      (if cur-prof
+         (setq fin-profs (cons cur-prof
+                               fin-profs))))
+    (message "Updating Profiles... Done")
+    (setq enwc-access-points fin-profs)
+    (setq enwc-last-scan fin-profs)
+    fin-profs))
+
+(defun enwc-scan-internal ()
+  "The entry point for the internal scan routines.
+This checks whether or not wired is being used,
+ and runs the appropriate function."
+  (if enwc-using-wired
+      (enwc-scan-internal-wired)
+    (enwc-scan-internal-wireless)))
+
+;;;;;;;;;;;;;;;;;;;;;
+;; Display Networks
+;;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-display-wired-networks (networks)
+  "Displays the wired networks specified in the list NETWORKS.
+NETWORKS must be in the form returned from
+`enwc-scan-internal-wired'."
+  (if (not (listp networks))
+      (error "NETWORKS must be a list of networks."))
+  (let ((inhibit-read-only t))
+    (erase-buffer)
+    (insert (propertize "Profile" 'face 'enwc-header-face))
+    (insert "\n")
+    (dolist (pr networks)
+      (insert pr)
+      (insert "\n"))))
+
+(defun enwc-insert-ent (ent width)
+  "Small function to insert a network property entry.
+ENT is the entry, and WIDTH is the column width."
+  (insert ent)
+  (insert-char 32 (- width (length ent))))
+
+(defun enwc-display-wireless-networks (networks)
+  "Displays the networks in the list NETWORKS in the current buffer.
+NETWORKS must be in the format returned
+ by `enwc-scan-internal-wireless'."
+  (if (not (eq major-mode 'enwc-mode))
+          (enwc-setup-buffer))
+  (if (not (listp networks))
+      (error "NETWORKS must be a list of association lists."))
+  (let ((inhibit-read-only t)
+       (cur-id (enwc-get-current-nw-id)))
+    (erase-buffer)
+    (let ((header enwc-wireless-headers)
+         (pos 0))
+
+      (dolist (hd header)
+       (insert (propertize hd 'face 'enwc-header-face))
+       (setq pos (length hd))
+       (insert-char 32 (- (symbol-value (intern (concat "enwc-"
+                                                        (downcase hd)
+                                                        "-width")))
+                          pos))))
+    (insert "\n")
+
+    (dolist (nw networks)
+      (let* ((id (propertize (number-to-string (cdr (assoc "id" nw)))
+                            'width enwc-id-width))
+            (str (propertize (concat (number-to-string (cdr (assoc "quality"
+                                                                   nw)))
+                                     "%")
+                             'width enwc-str-width))
+            (essid (propertize (cdr (assoc "essid" nw))
+                               'width enwc-essid-width))
+            (encrypt (propertize (cdr (assoc "encryption" nw))
+                                 'width enwc-encrypt-width))
+            (bssid (propertize (cdr (assoc "bssid" nw))
+                               'width enwc-bssid-width))
+            (mode (propertize (cdr (assoc "mode" nw))
+                              'width enwc-mode-width))
+            (chnl (propertize (cdr (assoc "channel" nw))
+                              'width enwc-chnl-width))
+            props)
+
+       (setq props (list id str essid encrypt bssid mode chnl))
+
+       (dolist (ent props)
+         (if (eq (string-to-number id) cur-id)
+             (setq ent (propertize ent 'face 'enwc-connected-face)))
+         (enwc-insert-ent ent (get-text-property 0 'width ent)))
+       (insert "\n")))))
+
+(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."
+  (if (not (eq major-mode 'enwc-mode))
+      (enwc-setup-buffer))
+  (if (not (listp networks))
+      (error "NETWORKS must be a list."))
+  (if enwc-using-wired
+      (enwc-display-wired-networks networks)
+    (enwc-display-wireless-networks networks)))
+
+(defun enwc-scan ()
+  "The frontend of the scanning routine.  Sets up and moves to
+the ENWC buffer if necessary, and scans and displays the networks."
+  (interactive)
+  (if (not (eq major-mode 'enwc-mode))
+      (switch-to-buffer "*ENWC*"))
+  (if enwc-using-wired
+      (progn
+       (setq enwc-last-scan (enwc-scan-internal))
+       (enwc-display-networks enwc-last-scan)
+       (goto-char 0)
+       (forward-line))
+    (enwc-scan-internal)))
+  
+(defun enwc-find-network (essid &optional networks)
+  "Checks through NETWORKS for the network with essid ESSID,
+and returns the network identifier.  Uses `enwc-last-scan' if
+NETWORKS is nil.  If the network is not found, then it returns nil.
+
+   When called interactively, this only prints out what it finds.
+Otherwise, it actually returns it."
+  (interactive "sNetwork ESSID: ")
+  (let ((nets (or networks enwc-last-scan))
+       need-break cur-net)
+    (if (not nets)
+       (setq nets enwc-last-scan))
+    (while (and nets (not need-break))
+      (let (cur-essid)
+       (setq cur-net (pop nets))
+       (setq cur-essid (cdr (assoc "essid" cur-net)))
+       (if (string= cur-essid essid)
+           (setq need-break t))))
+    (if need-break
+       (if (called-interactively-p 'any)
+           (message (number-to-string (cdr (assoc "id" cur-net))))
+         (cdr (assoc "id" cur-net)))
+      (if (called-interactively-p 'any)
+         (message "Network not found.")
+       nil))))
+
+;;;;;;;;;;;;;;;;;;;;
+;; Connect Network
+;;;;;;;;;;;;;;;;;;;;
+
+(defun enwc-connect-network (id)
+  "Connect to network with id ID.
+This is an entry point for the internal connection functions,
+and checks whether or not ENWC is using wired."
+  (let (cur-net)
+    (if enwc-using-wired
+       (progn
+         (enwc-wired-connect id)
+         (setq cur-net (nth id (enwc-get-wired-profiles))))
+      (enwc-wireless-connect id)
+      (setq cur-net (enwc-get-wireless-nw-prop id "essid")))
+    cur-net))
+
+(defun enwc-connect-to-network (net-id)
+  "Connects the the network with network id NET-ID.
+Confirms that NET-ID is a valid network id.
+This calls `enwc-connect-network' as a subroutine."
+  (interactive "nNetwork ID: ")
+  (if (not (numberp net-id))
+      (error "NET-ID must be a number"))
+  (let ((num-ids (length enwc-last-scan))
+       cur-net)
+    (if (or (< net-id 0) (>= net-id num-ids))
+       (error "Invalid network id."))
+    (setq cur-net (enwc-connect-network net-id))
+    (message (concat "Connecting to " cur-net))))
+
+(defun enwc-connect-to-network-essid (essid)
+  "Connects to the network with essid ESSID."
+  (interactive "sNetwork ESSID: ")
+  (let ((net-id (enwc-find-network essid)))
+    (if net-id
+       (enwc-connect-to-network net-id)
+      (message "Network not found."))))
+
+(defun enwc-connect-to-network-at-point ()
+  "Connects to the network at the current line number.
+Moves to the enwc buffer if necessary."
+  (interactive)
+  (if (not (eq major-mode 'enwc-mode))
+      (enwc-setup-buffer))
+  (let ((id (- (line-number-at-pos) 2)))
+    (enwc-connect-to-network id)))
+
+(defun enwc-disconnect ()
+  "Disconnects from the network, if any."
+  (interactive)
+  (if (not (eq major-mode 'enwc-mode))
+      (enwc-setup-buffer))
+  (if enwc-using-wired
+      (enwc-wired-disconnect)
+    (enwc-wireless-disconnect)))
+
+(defun enwc-toggle-wired ()
+  "Toggle the display and mode between wireless and wired.
+This function also sets the variable `enwc-using-wired'."
+  (interactive)
+  (if (not (eq major-mode 'enwc-mode))
+      (enwc-setup-buffer))
+  (let ((inhibit-read-only t))
+    (erase-buffer)
+    (setq enwc-using-wired (not enwc-using-wired))
+    (enwc-scan)))
+
+(defun enwc ()
+  "The main front-end to ENWC.
+This sets up the buffer and scans for networks.
+In order to use this, one must have already run
+`enwc-setup'.
+
+\\{enwc-mode-map}"
+  (interactive)
+  (enwc-setup-buffer)
+  (enwc-scan))
+
+;; Settings for access point AP
+;;
+;; IPv4 Settings:
+;;   Address =
+;;   Netmask =
+;;   Gateway =
+;;
+;;   DNS 1   =
+;;   DNS 2   =
+;;
+;; Security:
+;;   Type    =
+;;
+
+(defun enwc-edit-view-entry ()
+  "View the text of the entry at point.
+This is mostly useful to view the text of the hidden entries."
+  (interactive)
+  (if (not (get-buffer "*ENWC Edit*"))
+      (error "Not editing a network entry."))
+  (if (not (eq (current-buffer) (get-buffer "*ENWC Edit*")))
+      (switch-to-buffer "*ENWC Edit*"))
+  (if (not (widget-at))
+      (error "No widget at point"))
+  (message (widget-field-value-get (widget-at))))
+
+(defun enwc-display-sec-reqs (widget &rest stuff)
+  "Display the security requirements.
+This is a callback to the security selection widget.
+WIDGET is always the menu drop-down of security types."
+  (let (reqs
+       (inhibit-read-only t)
+       type-wid-list)
+    ;; First, erase any of the old ones.
+    (goto-char (1+ (widget-get widget :to)))
+    (widget-forward 1)
+    (while (>= (point) (widget-get widget :to))
+      (widget-delete (widget-at))
+      (widget-forward 1))
+    (goto-char (point-max))
+    ;; Then check to see if widget-value is None
+    (if (string= (widget-value widget) "None")
+       nil
+      (setq type-wid-list
+           (cadr (assoc "reqs"
+                        (cdr (assoc (widget-value widget)
+                                    (enwc-get-sec-types enwc-using-wired))))))
+      (setq reqs
+           (mapcar (lambda (x)
+                     (if (not (eq (length (cdr x)) 0))
+                         (widget-create 'editable-field
+                                        :format (concat "  "
+                                                        (cdr x)
+                                                        ": %v")
+                                        :secret ?*
+                                        :keymap 'enwc-edit-field-map
+                                        :value (or (enwc-get-nw-prop 
enwc-using-wired
+                                                                     
enwc-edit-id
+                                                                     (car x))
+                                                   ""))))
+                   type-wid-list))
+      (widget-setup)
+      reqs)))
+
+(defun enwc-setup-edit-buffer ()
+  "Setup the edit buffer.  This removes the old one if neccessary,
+and redisplays the settings from the network profile
+ with id `enwc-edit-id', which is set in `enwc-edit-entry-at-point'."
+  (if (get-buffer "*ENWC Edit*")
+      (kill-buffer "*ENWC Edit*"))
+  (with-current-buffer (get-buffer-create "*ENWC Edit*")
+    (let ((sec-types (enwc-get-sec-types enwc-using-wired))
+         addr-wid net-wid gate-wid
+         dns-1-wid dns-2-wid dns-list
+         type-wid type-wid-list)
+
+      (widget-insert (concat "Settings for access point "
+                            (cdr (assoc "essid"
+                                        (nth enwc-edit-id
+                                             enwc-last-scan)))
+                            "\n"))
+      (widget-insert "\n")
+      (widget-insert "IPv4 Settings:\n")
+      (setq addr-wid (widget-create 'editable-field
+                                   :format "  Address: %v"
+                                   :value (enwc-get-ip-addr enwc-using-wired
+                                                            enwc-edit-id)))
+      ;;ip
+      (setq net-wid (widget-create 'editable-field
+                                  :format "  Netmask: %v"
+                                  :value (enwc-get-netmask enwc-using-wired
+                                                           enwc-edit-id)))
+      ;;netmask
+      (setq gate-wid (widget-create 'editable-field
+                                   :format "  Gateway: %v"
+                                   :value (enwc-get-gateway enwc-using-wired
+                                                            enwc-edit-id)))
+      ;;gateway
+      (widget-insert "\n")
+      (setq dns-list (enwc-get-dns enwc-using-wired enwc-edit-id))
+      (setq dns-1-wid (widget-create 'editable-field
+                                    :format "    DNS 1: %v"
+                                    :value (nth 0 dns-list)))
+      ;;dns1
+      (setq dns-2-wid (widget-create 'editable-field
+                                    :format "    DNS 2: %v"
+                                    :value (nth 1 dns-list)))
+      ;;dns2
+      (widget-insert "\n")
+      (widget-insert "Security:\n")
+      (setq type-wid (apply 'widget-create
+                           'menu-choice
+                                   :tag "Type "
+                           :value (enwc-get-nw-prop enwc-using-wired
+                                                    enwc-edit-id
+                                                    "enctype")
+                           :notify 'enwc-display-sec-reqs
+                                   '(item :tag "No Encryption"
+                                  :value "None")
+                           (mapcar (lambda (x)
+                                     `(item :format "%t\n"
+                                            :value ,(car x)
+                                            :tag ,(cdr (assoc "Name" (cdr 
x)))))
+                                           sec-types)))
+      (enwc-display-sec-reqs type-wid)
+      (use-local-map enwc-edit-map)
+      (widget-setup)))
+
+  (switch-to-buffer "*ENWC Edit*"))
+
+(defun enwc-edit-save ()
+  "Save the network settings."
+  ;; Basically, just iterate through the widgets,
+  ;; retrieving values from each.
+  (interactive)
+  (if (not (get-buffer "*ENWC Edit*"))
+      (error "Not editing a network entry."))
+  (if (not (eq (current-buffer) (get-buffer "*ENWC Edit*")))
+      (switch-to-buffer "*ENWC Edit*"))
+  (goto-char 0)
+  (let (settings start-pos type-wid-list)
+
+    (widget-forward 1)
+    (setq settings
+         (append settings
+                 (cons (cons "addr"
+                             (widget-field-value-get (widget-at)))
+                       nil)))
+    (widget-forward 1)
+    (setq settings
+         (append settings
+                 (cons (cons "netmask"
+                             (widget-field-value-get (widget-at)))
+                       nil)))
+    (widget-forward 1)
+    (setq settings
+         (append settings
+                 (cons (cons "gateway"
+                             (widget-field-value-get (widget-at)))
+                       nil)))
+    (widget-forward 1)
+    (setq settings
+         (append settings
+                 (cons (cons "dns1"
+                             (widget-field-value-get (widget-at)))
+                       nil)))
+    (widget-forward 1)
+    (setq settings
+         (append settings
+                 (cons (cons "dns2"
+                             (widget-field-value-get (widget-at)))
+                       nil)))
+    (widget-forward 1)
+    (setq settings
+         (append settings
+                 (cons (cons "enctype"
+                             (widget-value (widget-at)))
+                       nil)))
+    (setq start-pos (widget-get (widget-at) :to))
+    (if (not (string= (widget-value (widget-at)) "None"))
+       (setq type-wid-list
+             (cadr (assoc "reqs"
+                          (cdr (assoc (widget-value (widget-at))
+                                      (enwc-get-sec-types 
enwc-using-wired)))))))
+    (dolist (x type-wid-list)
+      (widget-forward 1)
+      (setq settings
+           (append settings
+                   (cons (cons (car x)
+                               (widget-field-value-get (widget-at)))
+                         nil))))
+
+    (enwc-save-nw-settings enwc-using-wired enwc-edit-id settings)))
+
+(defun enwc-edit-entry-at-point ()
+  "Edit the current network entry."
+  (interactive)
+  (setq enwc-edit-id (- (line-number-at-pos) 2))
+  (select-window (split-window))
+  (enwc-setup-edit-buffer))
+
+(defvar enwc-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "R") 'enwc-scan)
+    (define-key map (kbd "C") 'enwc-connect-to-network-essid)
+    (define-key map (kbd "D") 'enwc-disconnect)
+    (define-key map (kbd "W") 'enwc-toggle-wired)
+    (define-key map (kbd "E") 'enwc-edit-entry-at-point)
+    (define-key map (kbd "RET") 'enwc-connect-to-network-at-point)
+    map)
+  "The keymap for network display in ENWC.")
+
+(defvar enwc-edit-map
+  (let ((map (copy-keymap widget-keymap)))
+    (define-key map (kbd "C-x C-s") 'enwc-edit-save)
+    map)
+  "The keymap for editing network profiles with ENWC.")
+
+(defvar enwc-edit-field-map
+  (let ((map (copy-keymap widget-field-keymap)))
+    (define-key map (kbd "C-x C-a") 'enwc-edit-view-entry)
+    map)
+  "The keymap for editable fields within the ENWC edit buffer.")
+
+(defun enwc-setup-buffer ()
+  "Sets up the ENWC buffer.
+This first checks to see that it exists,
+and if it doesn't, then create it."
+  (if (not (get-buffer "*ENWC*"))
+      (with-current-buffer (get-buffer-create "*ENWC*")
+       (use-local-map enwc-mode-map)
+       (setq major-mode 'enwc-mode
+             mode-name "enwc")
+       (setq buffer-read-only t)))
+  (switch-to-buffer "*ENWC*"))
+
+(provide 'enwc)
+
+;;; enwc.el ends here
diff --git a/lisp/enwc.elc b/lisp/enwc.elc
new file mode 100644
index 0000000..54f8cb2
Binary files /dev/null and b/lisp/enwc.elc differ

-----------------------------------------------------------------------

Summary of changes:
 packages/enwc/Makefile    |   44 ++++++++++++++++++++++++++++++++++++++++++++
 packages/enwc/enwc-pkg.el |    1 -
 packages/enwc/enwc.el     |    1 +
 3 files changed, 45 insertions(+), 1 deletions(-)
 create mode 100644 packages/enwc/Makefile
 delete mode 100644 packages/enwc/enwc-pkg.el


hooks/post-receive
-- 
ELPA



reply via email to

[Prev in Thread] Current Thread [Next in Thread]