diff -Nru gnome-netstatus/ChangeLog gnome-netstatus.hacked/ChangeLog
--- gnome-netstatus/ChangeLog	2004-06-21 17:30:00.000000000 -0400
+++ gnome-netstatus.hacked/ChangeLog	2004-06-22 04:49:47.737007240 -0400
@@ -1,3 +1,10 @@
+2004-06-20  Mark Carey <mcarey@sun.com>
+
+	* Added dialogs for wireless interface configuration.  Many
+	changes.  Many stabalizations and bug fixes since inital submit
+	to Sun internal review.  Cleaned up all formatting and source 
+	"beauty" issues (per Glynn Foster).
+
 2004-06-17  Mark McLoughlin  <mark@skynet.ie>
 
 	* src/netstatus-dialog.c: (print_bytes_string): for once
diff -Nru gnome-netstatus/configure.in gnome-netstatus.hacked/configure.in
--- gnome-netstatus/configure.in	2004-06-06 10:13:24.000000000 -0400
+++ gnome-netstatus.hacked/configure.in	2004-06-10 11:33:14.000000000 -0400
@@ -43,6 +43,9 @@
    AC_SUBST(DISABLE_DEPRECATED_CFLAGS)
 fi
 
+# Check for the presense of libiw (wireless tools support libraries)
+AC_CHECK_LIB(iw, iw_get_basic_config)
+
 PKG_CHECK_MODULES(NETSTATUS, libgnomeui-2.0 >= 2.5.2
 			     libglade-2.0 >= 2.0.0
 			     libpanelapplet-2.0 >= 2.0.0
diff -Nru gnome-netstatus/src/GNOME_NetstatusApplet.xml gnome-netstatus.hacked/src/GNOME_NetstatusApplet.xml
--- gnome-netstatus/src/GNOME_NetstatusApplet.xml	2004-06-21 17:30:01.000000000 -0400
+++ gnome-netstatus.hacked/src/GNOME_NetstatusApplet.xml	2004-06-22 04:41:36.821637720 -0400
@@ -4,6 +4,10 @@
       <menuitem name="Netstatus Properties Item" verb="NetstatusProperties"
                 _label="_Properties" pixtype="stock" pixname="gtk-properties"/>
       <menuitem name="Netstatus Help Item" verb="NetstatusHelp" _label="_Help" pixtype="stock" pixname="gtk-help"/>
+      <menuitem name="Netstatus Connect Item" verb="NetstatusConnect" _label="_Connect..."
+                pixtype="stock" pixname="gtk-apply"/>
+      <menuitem name="Netstatus Disconnect Item" verb="NetstatusDisconnect" _label="_Disconnect"
+                pixtype="stock" pixname="gnome-stock-not"/>
       <menuitem name="Netstatus About Item" verb="NetstatusAbout" _label="_About"
                 pixtype="stock" pixname="gnome-stock-about"/>
     </popup>
diff -Nru gnome-netstatus/src/Makefile.am gnome-netstatus.hacked/src/Makefile.am
--- gnome-netstatus/src/Makefile.am	2004-02-11 06:44:55.000000000 -0500
+++ gnome-netstatus.hacked/src/Makefile.am	2004-06-21 14:48:14.000000000 -0400
@@ -16,6 +16,13 @@
 
 gnome_netstatus_applet_LDADD = $(NETSTATUS_LIBS)
 
+WIRELESSFILES=			\
+	netstatus-wireless-connection-prefs.c	\
+	netstatus-wireless-connection-prefs.h	\
+	wireless-api.c				\
+	wireless-api.h
+
+
 gnome_netstatus_applet_SOURCES = \
 	netstatus-applet.c \
 	netstatus-applet.h \
@@ -31,7 +38,8 @@
 	netstatus-dialog.h \
 	netstatus-fallback-pixbuf.h \
 	netstatus-enums.c \
-	netstatus-enums.h
+	netstatus-enums.h \
+	$(WIRELESSFILES)
 
 netstatus_enum_headers = $(srcdir)/netstatus-util.h
 
@@ -74,7 +82,7 @@
 noinst_DATA = netstatus-fallback-pixbuf.h
 
 gladedir   = $(datadir)/gnome-netstatus
-glade_DATA = gnome-netstatus.glade
+glade_DATA = gnome-netstatus.glade connection_prefs.glade
 
 serverdir       = $(libdir)/bonobo/servers
 server_in_files = GNOME_NetstatusApplet_Factory.server.in
diff -Nru gnome-netstatus/src/connected_pixdata.h gnome-netstatus.hacked/src/connected_pixdata.h
--- gnome-netstatus/src/connected_pixdata.h	1969-12-31 19:00:00.000000000 -0500
+++ gnome-netstatus.hacked/src/connected_pixdata.h	2004-06-22 03:06:44.135802448 -0400
@@ -0,0 +1,267 @@
+/* GdkPixbuf RGBA C-Source image dump 1-byte-run-length-encoded */
+
+static const GdkPixdata connected_pixdata = {
+  0x47646b50, /* Pixbuf magic: 'GdkP' */
+  24 + 5585, /* header length + pixel_data length */
+  0x2010002, /* pixdata_type */
+  192, /* rowstride */
+  48, /* width */
+  48, /* height */
+  /* pixel_data: */
+  "\300\0\0\0\0\235\0\0\0\377\203\0\0\0\1\217\0\0\0\0\1\0\0\0\377\235\377"
+  "\377\377\377\3\0\0\0\377\0\0\0\11\0\0\0\10\216\0\0\0\0\2\0\0\0\377\377"
+  "\377\377\377\204\303\303\303\377\207\302\302\302\377\206\303\303\303"
+  "\377\213\302\302\302\377\4\303\303\303\377aaa\377\0\0\0\377\0\0\0\36"
+  "\216\0\0\0\0\2\0\0\0\377\377\377\377\377\232\303\303\303\377\6\303\304"
+  "\303\377\302\302\302\377\303\303\303\377aaa\377\0\0\0\377\0\0\0=\215"
+  "\0\0\0\0\5\0\0\0\1\0\0\0\377\377\377\377\377\302\302\302\377\303\303"
+  "\303\377\230aaa\377\202\302\302\302\377\4\303\303\303\377aaa\377\0\0"
+  "\0\377\0\0\0R\215\0\0\0\0\3\0\0\0\2\0\0\0\377\377\377\377\377\202\303"
+  "\303\303\377\36aaa\377\326\327\346\377\322\323\345\377\316\320\342\377"
+  "\312\314\340\377\307\311\336\377\303\306\334\377\277\301\331\377\274"
+  "\276\327\377\270\273\325\377\265\267\322\377\262\263\320\377\256\260"
+  "\316\377\252\254\314\377\246\250\311\377\242\245\307\377\237\242\305"
+  "\377\233\235\303\377\230\232\301\377\224\227\276\377\221\223\275\377"
+  "\214\220\272\377\211\214\270\377\205\210\266\377\377\377\377\377\302"
+  "\302\302\377\303\303\303\377aaa\377\0\0\0\377\0\0\0Z\215\0\0\0\0\36\0"
+  "\0\0\2\0\0\0\377\377\377\377\377\302\302\302\377\303\303\303\377aaa\377"
+  "\323\324\344\377\317\321\342\377\313\315\340\377\310\311\336\377\305"
+  "\306\333\377\301\302\331\377\274\277\327\377\271\273\325\377\266\270"
+  "\323\377\262\264\320\377\256\261\317\377\253\255\315\377\247\251\312"
+  "\377\243\245\310\377\240\242\305\377\234\236\304\377\230\233\301\377"
+  "\224\227\277\377\221\224\275\377\216\221\273\377\211\215\270\377\206"
+  "\211\267\377\202\205\264\377\377\377\377\377\202\303\303\303\377\3aa"
+  "a\377\0\0\0\377\0\0\0\\\215\0\0\0\0\36\0\0\0\3\0\0\0\377\377\377\377"
+  "\377\302\302\302\377\303\303\303\377aaa\377\320\321\343\377\314\316\340"
+  "\377\310\312\336\377\305\306\334\377\301\303\332\377\275\277\327\377"
+  "\272\274\325\377\266\270\323\377\263\265\321\377\257\262\317\377\253"
+  "\255\315\377\250\252\312\377\244\246\310\377\240\243\306\377\234\237"
+  "\304\377\230\234\302\377\225\230\300\377\222\224\276\377\216\221\273"
+  "\377\213\216\271\377\207\212\267\377\203\207\264\377\200\202\262\377"
+  "\377\377\377\377\202\303\303\303\377\3aaa\377\0\0\0\377\0\0\0\\\206\0"
+  "\0\0\0\2\0\0\0\1\0\0\0\2\203\0\0\0\1\40\0\0\0\0\0\0\0\1\0\0\0\2\0\0\0"
+  "\377\377\377\377\377\302\302\302\377\303\303\303\377aaa\377\315\316\341"
+  "\377\311\312\337\377\305\307\335\377\302\304\332\377\277\300\330\377"
+  "\273\274\326\377\267\270\323\377\264\265\322\377\260\262\320\377\254"
+  "\256\315\377\250\252\313\377\245\247\310\377\241\244\306\377\236\240"
+  "\304\377\232\234\302\377\226\231\300\377\222\225\276\377\217\221\274"
+  "\377\213\216\272\377\210\212\267\377\203\207\265\377\200\203\263\377"
+  "|\177\260\377\377\377\377\377\202\303\303\303\377\3aaa\377\0\0\0\377"
+  "\0\0\0\\\202\0\0\0\0\235\0\0\0\377\23\236\240\304\377\232\235\303\377"
+  "\226\232\301\377\223\226\276\377\217\223\274\377\214\217\271\377\210"
+  "\213\267\377\204\207\266\377\201\204\263\377}\200\261\377z}\256\377\377"
+  "\377\377\377\302\302\302\377\303\303\303\377aaa\377\0\0\0\377\0\0\0\\"
+  "\0\0\0\0\0\0\0\377\235\377\377\377\377\23\0\0\0\377\230\233\301\377\224"
+  "\226\276\377\220\223\274\377\214\217\272\377\210\214\270\377\205\210"
+  "\266\377\201\205\263\377~\201\261\377z~\257\377wz\255\377\377\377\377"
+  "\377\302\302\302\377\303\303\303\377aaa\377\0\0\0\377\0\0\0\\\0\0\0\377"
+  "\377\377\377\377\204\303\303\303\377\207\302\302\302\377\206\303\303"
+  "\303\377\213\302\302\302\377\24\303\303\303\377aaa\377\0\0\0\377\221"
+  "\224\275\377\215\221\273\377\212\214\270\377\206\211\266\377\202\206"
+  "\264\377~\201\261\377{\177\257\377wz\255\377sw\253\377\377\377\377\377"
+  "\302\302\302\377\303\303\303\377aaa\377\0\0\0\377\0\0\0\\\0\0\0\377\377"
+  "\377\377\377\232\303\303\303\377\30\303\304\303\377\302\302\302\377\303"
+  "\303\303\377aaa\377\0\0\0\377\216\221\273\377\212\215\271\377\206\212"
+  "\267\377\202\206\264\377\177\202\262\377{\177\260\377w{\256\377tw\253"
+  "\377pt\251\377\377\377\377\377\302\302\302\377\303\303\303\377aaa\377"
+  "\0\0\0\377\0\0\0\\\0\0\0\377\377\377\377\377\302\302\302\377\303\303"
+  "\303\377\230aaa\377\202\302\302\302\377\24\303\303\303\377aaa\377\0\0"
+  "\0\377\213\216\271\377\207\212\267\377\203\207\264\377\200\203\262\377"
+  "|\200\260\377x|\256\377uy\254\377qu\251\377mq\250\377\377\377\377\377"
+  "\302\302\302\377\303\303\303\377aaa\377\0\0\0\377\0\0\0\\\0\0\0\377\377"
+  "\377\377\377\202\303\303\303\377Iaaa\377\326\327\346\377\322\323\345"
+  "\377\316\320\342\377\312\314\340\377\307\311\336\377\303\306\334\377"
+  "\277\301\331\377\274\276\327\377\270\273\325\377\265\267\322\377\262"
+  "\263\320\377\256\260\316\377\252\254\314\377\246\250\311\377\242\245"
+  "\307\377\237\242\305\377\233\235\303\377\230\232\301\377\224\227\276"
+  "\377\221\223\275\377\214\220\272\377\211\214\270\377\205\210\266\377"
+  "\377\377\377\377\302\302\302\377\303\303\303\377aaa\377\0\0\0\377\210"
+  "\213\267\377\204\210\265\377\201\204\263\377|\200\261\377y}\256\377u"
+  "y\254\377rv\253\377or\250\377ko\246\377\377\377\377\377\302\302\302\377"
+  "\303\303\303\377aaa\377\0\0\0\377\0\0\0\\\0\0\0\377\377\377\377\377\302"
+  "\302\302\377\303\303\303\377aaa\377\323\324\344\377\317\321\342\377\313"
+  "\315\340\377\310\311\336\377\305\306\333\377\301\302\331\377\274\277"
+  "\327\377\271\273\325\377\266\270\323\377\262\264\320\377\256\261\317"
+  "\377\253\255\315\377\247\251\312\377\243\245\310\377\240\242\305\377"
+  "\234\236\304\377\230\233\301\377\224\227\277\377\221\224\275\377\216"
+  "\221\273\377\211\215\270\377\206\211\267\377\202\205\264\377\377\377"
+  "\377\377\202\303\303\303\377.aaa\377\0\0\0\377\204\210\266\377\201\204"
+  "\264\377}\201\261\377z}\257\377vz\255\377rv\252\377or\251\377ko\246\377"
+  "gl\244\377\377\377\377\377\302\302\302\377\303\303\303\377aaa\377\0\0"
+  "\0\377\0\0\0\\\0\0\0\377\377\377\377\377\302\302\302\377\303\303\303"
+  "\377aaa\377\320\321\343\377\314\316\340\377\310\312\336\377\305\306\334"
+  "\377\301\303\332\377\275\277\327\377\272\274\325\377\266\270\323\377"
+  "\263\265\321\377\257\262\317\377\253\255\315\377\250\252\312\377\244"
+  "\246\310\377\240\243\306\377\234\237\304\377\230\234\302\377\225\230"
+  "\300\377\222\224\276\377\216\221\273\377\213\216\271\377\207\212\267"
+  "\377\203\207\264\377\200\202\262\377\377\377\377\377\202\303\303\303"
+  "\377\23aaa\377\0\0\0\377\202\205\264\377\177\202\261\377z~\257\377w{"
+  "\255\377sw\253\377pt\251\377lp\246\377hl\245\377ei\242\377\377\377\377"
+  "\377\302\302\302\377\303\303\303\377aaa\377\0\0\0\377\0\0\0\\\0\0\0\377"
+  "\377\377\377\377\202\303\303\303\377\31aaa\377\315\316\341\377\311\312"
+  "\337\377\305\307\335\377\302\304\332\377\277\300\330\377\273\274\326"
+  "\377\267\270\323\377\264\265\322\377\260\262\320\377\254\256\315\377"
+  "\250\252\313\377\245\247\310\377\241\244\306\377\236\240\304\377\232"
+  "\234\302\377\226\231\300\377\222\225\276\377\217\221\274\377\213\216"
+  "\272\377\210\212\267\377\203\207\265\377\200\203\263\377|\177\260\377"
+  "\377\377\377\377\202\303\303\303\377\23aaa\377\0\0\0\377~\203\262\377"
+  "{\177\260\377w{\256\377tx\253\377pt\251\377mp\247\377hm\245\377fi\243"
+  "\377af\240\377\377\377\377\377\302\302\302\377\303\303\303\377aaa\377"
+  "\0\0\0\377\0\0\0\\\0\0\0\377\377\377\377\377\202\303\303\303\377.aaa"
+  "\377\312\313\337\377\307\310\335\377\303\305\333\377\277\301\330\377"
+  "\273\275\326\377\270\272\325\377\264\266\322\377\261\262\320\377\255"
+  "\257\315\377\251\253\314\377\245\250\311\377\242\244\307\377\236\240"
+  "\304\377\232\235\303\377\226\232\301\377\223\226\276\377\217\223\274"
+  "\377\214\217\271\377\210\213\267\377\204\207\266\377\201\204\263\377"
+  "}\200\261\377z}\256\377\377\377\377\377\302\302\302\377\303\303\303\377"
+  "aaa\377\0\0\0\377|\177\261\377x|\256\377ux\254\377qu\251\377nq\247\377"
+  "jn\245\377fj\243\377bg\241\377_c\237\377\377\377\377\377\302\302\302"
+  "\377\303\303\303\377aaa\377\0\0\0\377\0\0\0\\\0\0\0\377\377\377\377\377"
+  "\202\303\303\303\377^aaa\377\307\310\335\377\303\305\333\377\277\301"
+  "\331\377\274\276\327\377\270\273\324\377\265\267\322\377\261\263\320"
+  "\377\255\260\316\377\251\254\314\377\246\250\312\377\242\245\310\377"
+  "\236\241\305\377\233\236\303\377\230\233\301\377\224\226\276\377\220"
+  "\223\274\377\214\217\272\377\210\214\270\377\205\210\266\377\201\205"
+  "\263\377~\201\261\377z~\257\377wz\255\377\377\377\377\377\302\302\302"
+  "\377\303\303\303\377aaa\377\0\0\0\377x|\257\377uy\254\377rv\252\377n"
+  "r\250\377jn\245\377gk\244\377bg\241\377_c\240\377[`\235\377\377\377\377"
+  "\377\302\302\302\377\303\303\303\377aaa\377\0\0\0\377\0\0\0\\\0\0\0\377"
+  "\377\377\377\377\302\302\302\377\303\303\303\377aaa\377\304\306\334\377"
+  "\300\302\332\377\274\277\327\377\271\273\325\377\265\270\323\377\261"
+  "\264\320\377\256\260\316\377\252\254\314\377\247\251\312\377\243\245"
+  "\310\377\237\242\306\377\234\237\303\377\230\233\301\377\224\227\277"
+  "\377\221\224\275\377\215\221\273\377\212\214\270\377\206\211\266\377"
+  "\202\206\264\377~\201\261\377{\177\257\377wz\255\377sw\253\377\377\377"
+  "\377\377\302\302\302\377\303\303\303\377aaa\377\0\0\0\377vz\255\377r"
+  "w\253\377ns\251\377ko\246\377gk\243\377dh\242\377`d\237\377\\a\236\377"
+  "Y]\234\377\377\377\377\377\302\302\302\377\303\303\303\377aaa\377\0\0"
+  "\0\377\0\0\0\\\0\0\0\377\377\377\377\377\202\303\303\303\377.aaa\377"
+  "\301\303\332\377\276\300\327\377\271\274\325\377\266\270\323\377\262"
+  "\264\321\377\257\261\317\377\253\255\315\377\247\251\313\377\243\246"
+  "\311\377\240\242\306\377\235\237\304\377\231\233\301\377\224\230\277"
+  "\377\221\224\275\377\216\221\273\377\212\215\271\377\206\212\267\377"
+  "\202\206\264\377\177\202\262\377{\177\260\377w{\256\377tw\253\377pt\251"
+  "\377\377\377\377\377\302\302\302\377\303\303\303\377aaa\377\0\0\0\377"
+  "sw\253\377os\251\377lo\246\377hl\244\377dh\242\377af\240\377]a\236\377"
+  "Y^\234\377UZ\231\377\377\377\377\377\302\302\302\377\303\303\303\377"
+  "aaa\377\0\0\0\377\0\0\0\\\0\0\0\377\377\377\377\377\202\303\303\303\377"
+  "}aaa\377\276\300\330\377\273\275\325\377\267\271\324\377\263\265\322"
+  "\377\260\262\320\377\253\256\315\377\250\253\312\377\245\247\311\377"
+  "\241\244\306\377\235\240\305\377\231\234\302\377\225\231\300\377\222"
+  "\225\276\377\216\222\273\377\213\216\271\377\207\212\267\377\203\207"
+  "\264\377\200\203\262\377|\200\260\377x|\256\377uy\254\377qu\251\377m"
+  "q\250\377\377\377\377\377\302\302\302\377\303\303\303\377aaa\377\0\0"
+  "\0\377pt\251\377lq\247\377hm\245\377ei\243\377bf\240\377]c\236\377Z^"
+  "\234\377V[\231\377SW\230\377\377\377\377\377\302\302\302\377\303\303"
+  "\303\377aaa\377\0\0\0\377\0\0\0\\\0\0\0\377\377\377\377\377\302\302\302"
+  "\377\303\303\303\377aaa\377\274\275\326\377\267\271\324\377\263\266\322"
+  "\377\260\262\320\377\254\257\315\377\250\253\314\377\245\247\311\377"
+  "\241\244\307\377\235\241\305\377\232\235\302\377\226\231\300\377\223"
+  "\226\276\377\220\222\274\377\214\217\271\377\210\213\267\377\204\210"
+  "\265\377\201\204\263\377|\200\261\377y}\256\377uy\254\377rv\253\377o"
+  "r\250\377ko\246\377\377\377\377\377\302\302\302\377\303\303\303\377a"
+  "aa\377\0\0\0\377mq\247\377jn\245\377fj\243\377bg\241\377_c\237\377[_"
+  "\234\377W\\\233\377TX\230\377PT\225\377\377\377\377\377\302\302\302\377"
+  "\303\303\303\377aaa\377\0\0\0\377\0\0\0\\\0\0\0\377\377\377\377\377\303"
+  "\303\303\377\302\302\302\377aaa\377\270\272\324\377\265\266\322\377\261"
+  "\263\320\377\255\257\316\377\251\254\314\377\246\250\312\377\242\244"
+  "\307\377\237\241\305\377\233\236\303\377\227\232\301\377\223\227\277"
+  "\377\220\223\275\377\215\217\272\377\211\214\270\377\204\210\266\377"
+  "\201\204\264\377}\201\261\377z}\257\377vz\255\377rv\252\377or\251\377"
+  "ko\246\377gl\244\377\377\377\377\377\302\302\302\377\303\303\303\377"
+  "aaa\377\0\0\0\377\212\377\377\377\377&\302\302\302\377\303\303\303\377"
+  "aaa\377\0\0\0\377\0\0\0\\\0\0\0\377\377\377\377\377\303\303\303\377\302"
+  "\302\302\377aaa\377\265\267\322\377\261\263\320\377\256\260\316\377\252"
+  "\255\314\377\246\251\312\377\243\245\307\377\237\242\306\377\233\236"
+  "\304\377\230\233\301\377\224\227\277\377\220\223\275\377\214\220\272"
+  "\377\211\214\270\377\205\211\266\377\202\205\264\377\177\202\261\377"
+  "z~\257\377w{\255\377sw\253\377pt\251\377lp\246\377hl\245\377ei\242\377"
+  "\377\377\377\377\302\302\302\377\303\303\303\377aaa\377\0\0\0\377\213"
+  "\302\302\302\377%\303\303\303\377aaa\377\0\0\0\377\0\0\0\\\0\0\0\377"
+  "\377\377\377\377\303\303\303\377\302\302\302\377aaa\377\262\264\321\377"
+  "\256\260\316\377\253\255\314\377\247\252\312\377\243\246\310\377\240"
+  "\243\306\377\234\237\303\377\230\233\302\377\224\227\300\377\221\224"
+  "\276\377\215\220\273\377\212\215\270\377\206\212\267\377\202\206\265"
+  "\377~\203\262\377{\177\260\377w{\256\377tx\253\377pt\251\377mp\247\377"
+  "hm\245\377fi\243\377af\240\377\377\377\377\377\302\302\302\377\303\303"
+  "\303\377aaa\377\0\0\0\377\212\302\302\302\377\202\303\303\303\377\5a"
+  "aa\377\0\0\0\377\0\0\0\\\0\0\0\377\377\377\377\377\202\303\303\303\377"
+  "\35aaa\377\257\262\317\377\254\256\315\377\250\252\313\377\244\246\311"
+  "\377\241\244\306\377\234\240\304\377\231\235\301\377\226\231\300\377"
+  "\222\225\275\377\217\221\274\377\212\215\271\377\207\212\267\377\203"
+  "\207\264\377\200\203\263\377|\177\261\377x|\256\377ux\254\377qu\251\377"
+  "nq\247\377jn\245\377fj\243\377bg\241\377_c\237\377\377\377\377\377\302"
+  "\302\302\377\303\303\303\377aaa\377\0\0\0\377\214aaa\377\5\0\0\0\377"
+  "\0\0\0c\0\0\0Y\0\0\0\377\377\377\377\377\202\303\303\303\377\35aaa\377"
+  "\254\257\315\377\250\253\313\377\245\247\311\377\241\244\307\377\235"
+  "\240\305\377\232\234\303\377\227\231\300\377\222\225\276\377\217\222"
+  "\273\377\213\217\271\377\207\213\267\377\204\207\265\377\200\204\263"
+  "\377}\200\261\377x|\257\377uy\254\377rv\252\377nr\250\377jn\245\377g"
+  "k\244\377bg\241\377_c\240\377[`\235\377\377\377\377\377\302\302\302\377"
+  "\303\303\303\377aaa\377\0\0\0\377\203\302\302\302\377\202\0\377\0\377"
+  "\204\302\302\302\377\1aaa\377\202\0\0\0\377\5\0\0\0d\0\0\0^\0\0\0P\0"
+  "\0\0\377\377\377\377\377\202\303\303\303\377\35aaa\377\251\254\314\377"
+  "\245\250\311\377\242\245\307\377\237\241\305\377\232\236\302\377\227"
+  "\232\301\377\223\226\276\377\217\223\274\377\214\217\272\377\210\213"
+  "\270\377\205\210\266\377\201\205\263\377}\201\261\377z}\257\377vz\255"
+  "\377rw\253\377ns\251\377ko\246\377gk\243\377dh\242\377`d\237\377\\a\236"
+  "\377Y]\234\377\377\377\377\377\302\302\302\377\303\303\303\377aaa\377"
+  "\0\0\0\377\211aaa\377\10\0\0\0\377\0\0\0d\0\0\0b\0\0\0\\\0\0\0Q\0\0\0"
+  "=\0\0\0\377\377\377\377\377\202\303\303\303\377\34aaa\377\246\251\312"
+  "\377\243\246\307\377\237\242\306\377\233\236\303\377\230\233\301\377"
+  "\224\227\277\377\220\223\274\377\215\220\273\377\211\214\270\377\205"
+  "\211\266\377\202\205\263\377~\201\262\377z~\257\377w{\256\377sw\253\377"
+  "os\251\377lo\246\377hl\244\377dh\242\377af\240\377]a\236\377Y^\234\377"
+  "UZ\231\377\377\377\377\377\302\302\302\377\303\303\303\377aaa\377\212"
+  "\0\0\0\377\10\0\0\0d\0\0\0_\0\0\0V\0\0\0I\0\0\0""8\0\0\0$\0\0\0\377\377"
+  "\377\377\377\202\303\303\303\377\35aaa\377\243\246\310\377\237\243\305"
+  "\377\234\237\304\377\230\233\302\377\224\230\300\377\221\224\275\377"
+  "\215\220\273\377\212\215\270\377\206\211\266\377\202\206\264\377~\203"
+  "\262\377{\177\260\377w{\256\377tw\253\377pt\251\377lq\247\377hm\245\377"
+  "ei\243\377bf\240\377]c\236\377Z^\234\377V[\231\377SW\230\377\377\377"
+  "\377\377\302\302\302\377\303\303\303\377aaa\377\0\0\0\377\205\377\377"
+  "\377\377\14\302\302\302\377\0\0\0\377\0\0\0e\0\0\0b\0\0\0\\\0\0\0R\0"
+  "\0\0@\0\0\0-\0\0\0\35\0\0\0\20\0\0\0\377\377\377\377\377\202\303\303"
+  "\303\377\35aaa\377\240\243\306\377\235\240\304\377\231\234\301\377\225"
+  "\230\277\377\222\224\276\377\216\221\273\377\212\216\271\377\207\212"
+  "\267\377\203\207\265\377\177\203\262\377{\177\260\377x|\256\377ux\254"
+  "\377qu\252\377mq\247\377jn\245\377fj\243\377bg\241\377_c\237\377[_\234"
+  "\377W\\\233\377TX\230\377PT\225\377\377\377\377\377\302\302\302\377\303"
+  "\303\303\377aaa\377\0\0\0\377\202\303\303\303\377\203\302\302\302\377"
+  "\14aaa\377\0\0\0\377\0\0\0b\0\0\0Z\0\0\0L\0\0\0:\0\0\0&\0\0\0\24\0\0"
+  "\0\12\0\0\0\4\0\0\0\377\377\377\377\377\202\303\303\303\377\1\302\302"
+  "\302\377\230\377\377\377\377\4\302\302\302\377\303\303\303\377aaa\377"
+  "\0\0\0\377\206aaa\377\13\0\0\0\377\0\0\0_\0\0\0O\0\0\0""6\0\0\0\40\0"
+  "\0\0\20\0\0\0\6\0\0\0\2\0\0\0\0\0\0\0\377\377\377\377\377\221\303\303"
+  "\303\377\213\302\302\302\377\2\303\303\303\377aaa\377\210\0\0\0\377\6"
+  "\0\0\0\\\0\0\0F\0\0\0'\0\0\0\20\0\0\0\5\0\0\0\1\202\0\0\0\0\2\0\0\0\377"
+  "\377\377\377\377\233\302\302\302\377\202\303\303\303\377\2aaa\377\0\0"
+  "\0\377\202\0\0\0b\2\0\0\0_\0\0\0]\202\0\0\0\\\6\0\0\0Z\0\0\0S\0\0\0>"
+  "\0\0\0\40\0\0\0\12\0\0\0\2\204\0\0\0\0\1\0\0\0\377\235aaa\377\2\0\0\0"
+  "\377\0\0\0d\202\0\0\0W\2\0\0\0M\0\0\0F\202\0\0\0D\6\0\0\0C\0\0\0=\0\0"
+  "\0-\0\0\0\26\0\0\0\6\0\0\0\1\205\0\0\0\0\202\0\0\0\377\1aaa\377\221\302"
+  "\302\302\377\202\0\377\0\377\204\302\302\302\377\1aaa\377\202\0\0\0\377"
+  "\2\0\0\0d\0\0\0_\202\0\0\0A\2\0\0\0""0\0\0\0&\202\0\0\0\"\5\0\0\0!\0"
+  "\0\0\36\0\0\0\26\0\0\0\13\0\0\0\3\206\0\0\0\0\3\0\0\0""0\0\0\0@\0\0\0"
+  "\377\227aaa\377\5\0\0\0\377\0\0\0e\0\0\0b\0\0\0\\\0\0\0R\202\0\0\0&\2"
+  "\0\0\0\25\0\0\0\15\203\0\0\0\12\4\0\0\0\11\0\0\0\6\0\0\0\3\0\0\0\1\206"
+  "\0\0\0\0\3\0\0\0\25\0\0\0&\0\0\0""8\227\0\0\0\377\5\0\0\0d\0\0\0a\0\0"
+  "\0Y\0\0\0K\0\0\0""9\202\0\0\0\20\2\0\0\0\7\0\0\0\3\202\0\0\0\2\203\0"
+  "\0\0\1\210\0\0\0\0\6\0\0\0\6\0\0\0\20\0\0\0\35\0\0\0-\0\0\0|\0\0\0\377"
+  "\220\377\377\377\377\11\302\302\302\377\0\0\0\377\0\0\0e\0\0\0b\0\0\0"
+  "^\0\0\0W\0\0\0H\0\0\0""3\0\0\0\37\202\0\0\0\4\1\0\0\0\1\216\0\0\0\0\7"
+  "\0\0\0\1\0\0\0\4\0\0\0\12\0\0\0\24\0\0\0S\0\0\0\377\377\377\377\377\210"
+  "\302\302\302\377\204\303\303\303\377\203\302\302\302\377\11aaa\377\0"
+  "\0\0\377\0\0\0b\0\0\0Z\0\0\0N\0\0\0B\0\0\0""1\0\0\0\34\0\0\0\14\202\0"
+  "\0\0\1\221\0\0\0\0\5\0\0\0\2\0\0\0\6\0\0\0'\0\0\0\377\302\302\302\377"
+  "\220aaa\377\10\0\0\0\377\0\0\0_\0\0\0O\0\0\0""8\0\0\0%\0\0\0\30\0\0\0"
+  "\14\0\0\0\4\224\0\0\0\0\2\0\0\0\1\0\0\0\14\223\0\0\0\377\7\0\0\0\\\0"
+  "\0\0F\0\0\0(\0\0\0\22\0\0\0\10\0\0\0\3\0\0\0\1\225\0\0\0\0\6\0\0\0\2"
+  "\0\0\0\12\0\0\0\40\0\0\0>\0\0\0S\0\0\0Z\215\0\0\0\\\6\0\0\0Z\0\0\0S\0"
+  "\0\0>\0\0\0\40\0\0\0\12\0\0\0\2\227\0\0\0\0\6\0\0\0\1\0\0\0\6\0\0\0\26"
+  "\0\0\0-\0\0\0=\0\0\0C\215\0\0\0D\6\0\0\0C\0\0\0=\0\0\0-\0\0\0\26\0\0"
+  "\0\6\0\0\0\1\230\0\0\0\0\5\0\0\0\3\0\0\0\13\0\0\0\26\0\0\0\36\0\0\0!"
+  "\215\0\0\0\"\5\0\0\0!\0\0\0\36\0\0\0\26\0\0\0\13\0\0\0\3\222\0\0\0\0",
+};
+
+
diff -Nru gnome-netstatus/src/connection_prefs.glade gnome-netstatus.hacked/src/connection_prefs.glade
--- gnome-netstatus/src/connection_prefs.glade	1969-12-31 19:00:00.000000000 -0500
+++ gnome-netstatus.hacked/src/connection_prefs.glade	2004-06-10 11:28:16.000000000 -0400
@@ -0,0 +1,1389 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkDialog" id="connection_prefs">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Wireless Network Preferences</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox1">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+	<widget class="GtkHButtonBox" id="dialog-action_area1">
+	  <property name="visible">True</property>
+	  <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+	  <child>
+	    <widget class="GtkButton" id="helpbutton1">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-help</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-11</property>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="closebutton1">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-close</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-7</property>
+	    </widget>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">True</property>
+	  <property name="pack_type">GTK_PACK_END</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkVBox" id="vbox4">
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">0</property>
+
+	  <child>
+	    <widget class="GtkTable" id="table1">
+	      <property name="border_width">6</property>
+	      <property name="visible">True</property>
+	      <property name="n_rows">2</property>
+	      <property name="n_columns">2</property>
+	      <property name="homogeneous">False</property>
+	      <property name="row_spacing">6</property>
+	      <property name="column_spacing">6</property>
+
+	      <child>
+		<widget class="GtkVBox" id="available_btn_vbox">
+		  <property name="visible">True</property>
+		  <property name="homogeneous">False</property>
+		  <property name="spacing">6</property>
+
+		  <child>
+		    <widget class="GtkButton" id="connect_btn">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+
+		      <child>
+			<widget class="GtkAlignment" id="alignment3">
+			  <property name="visible">True</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xscale">0</property>
+			  <property name="yscale">0</property>
+			  <property name="top_padding">0</property>
+			  <property name="bottom_padding">0</property>
+			  <property name="left_padding">0</property>
+			  <property name="right_padding">0</property>
+
+			  <child>
+			    <widget class="GtkHBox" id="hbox5">
+			      <property name="visible">True</property>
+			      <property name="homogeneous">False</property>
+			      <property name="spacing">2</property>
+
+			      <child>
+				<widget class="GtkImage" id="image3">
+				  <property name="visible">True</property>
+				  <property name="stock">gtk-jump-to</property>
+				  <property name="icon_size">4</property>
+				  <property name="xalign">0.5</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xpad">0</property>
+				  <property name="ypad">0</property>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
+
+			      <child>
+				<widget class="GtkLabel" id="label17">
+				  <property name="visible">True</property>
+				  <property name="label" translatable="yes">_Connect</property>
+				  <property name="use_underline">True</property>
+				  <property name="use_markup">False</property>
+				  <property name="justify">GTK_JUSTIFY_LEFT</property>
+				  <property name="wrap">False</property>
+				  <property name="selectable">False</property>
+				  <property name="xalign">0.5</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xpad">0</property>
+				  <property name="ypad">0</property>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
+			    </widget>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkButton" id="refresh_btn">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label">gtk-refresh</property>
+		      <property name="use_stock">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkButton" id="pref_properties_btn">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="label">gtk-properties</property>
+		      <property name="use_stock">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="spacer_lbl">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes"></property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkButton" id="new_net_btn">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+
+		      <child>
+			<widget class="GtkAlignment" id="alignment4">
+			  <property name="visible">True</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xscale">0</property>
+			  <property name="yscale">0</property>
+			  <property name="top_padding">0</property>
+			  <property name="bottom_padding">0</property>
+			  <property name="left_padding">0</property>
+			  <property name="right_padding">0</property>
+
+			  <child>
+			    <widget class="GtkHBox" id="hbox6">
+			      <property name="visible">True</property>
+			      <property name="homogeneous">False</property>
+			      <property name="spacing">2</property>
+
+			      <child>
+				<widget class="GtkImage" id="image4">
+				  <property name="visible">True</property>
+				  <property name="stock">gtk-new</property>
+				  <property name="icon_size">4</property>
+				  <property name="xalign">0.5</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xpad">0</property>
+				  <property name="ypad">0</property>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
+
+			      <child>
+				<widget class="GtkLabel" id="label18">
+				  <property name="visible">True</property>
+				  <property name="label" translatable="yes">_New Network...</property>
+				  <property name="use_underline">True</property>
+				  <property name="use_markup">False</property>
+				  <property name="justify">GTK_JUSTIFY_LEFT</property>
+				  <property name="wrap">False</property>
+				  <property name="selectable">False</property>
+				  <property name="xalign">0.5</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xpad">0</property>
+				  <property name="ypad">0</property>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
+			    </widget>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkButton" id="add_to_pref_btn">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+
+		      <child>
+			<widget class="GtkAlignment" id="alignment1">
+			  <property name="visible">True</property>
+			  <property name="xalign">0.5</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xscale">0</property>
+			  <property name="yscale">0</property>
+			  <property name="top_padding">0</property>
+			  <property name="bottom_padding">0</property>
+			  <property name="left_padding">0</property>
+			  <property name="right_padding">0</property>
+
+			  <child>
+			    <widget class="GtkHBox" id="hbox3">
+			      <property name="visible">True</property>
+			      <property name="homogeneous">False</property>
+			      <property name="spacing">2</property>
+
+			      <child>
+				<widget class="GtkImage" id="image1">
+				  <property name="visible">True</property>
+				  <property name="stock">gtk-add</property>
+				  <property name="icon_size">4</property>
+				  <property name="xalign">0.5</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xpad">0</property>
+				  <property name="ypad">0</property>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
+
+			      <child>
+				<widget class="GtkLabel" id="label14">
+				  <property name="visible">True</property>
+				  <property name="label" translatable="yes">_Add to Preferred...</property>
+				  <property name="use_underline">True</property>
+				  <property name="use_markup">False</property>
+				  <property name="justify">GTK_JUSTIFY_LEFT</property>
+				  <property name="wrap">False</property>
+				  <property name="selectable">False</property>
+				  <property name="xalign">0.5</property>
+				  <property name="yalign">0.5</property>
+				  <property name="xpad">0</property>
+				  <property name="ypad">0</property>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
+			    </widget>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="left_attach">1</property>
+		  <property name="right_attach">2</property>
+		  <property name="top_attach">1</property>
+		  <property name="bottom_attach">2</property>
+		  <property name="x_options">fill</property>
+		  <property name="y_options">fill</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="label3">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">_Available networks, in order of preference:</property>
+		  <property name="use_underline">True</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		</widget>
+		<packing>
+		  <property name="left_attach">0</property>
+		  <property name="right_attach">2</property>
+		  <property name="top_attach">0</property>
+		  <property name="bottom_attach">1</property>
+		  <property name="x_options">fill</property>
+		  <property name="y_options"></property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkScrolledWindow" id="available_scrolled">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+		  <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+		  <property name="shadow_type">GTK_SHADOW_IN</property>
+		  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+		  <child>
+		    <widget class="GtkTreeView" id="available_list">
+		      <property name="visible">True</property>
+		      <property name="can_focus">True</property>
+		      <property name="headers_visible">True</property>
+		      <property name="rules_hint">False</property>
+		      <property name="reorderable">False</property>
+		      <property name="enable_search">True</property>
+		    </widget>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="left_attach">0</property>
+		  <property name="right_attach">1</property>
+		  <property name="top_attach">1</property>
+		  <property name="bottom_attach">2</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkTable" id="table3">
+	      <property name="border_width">6</property>
+	      <property name="visible">True</property>
+	      <property name="n_rows">2</property>
+	      <property name="n_columns">3</property>
+	      <property name="homogeneous">False</property>
+	      <property name="row_spacing">3</property>
+	      <property name="column_spacing">6</property>
+
+	      <child>
+		<widget class="GtkCheckButton" id="check_encrypted_only">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">Show encryp_ted networks only</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		</widget>
+		<packing>
+		  <property name="left_attach">0</property>
+		  <property name="right_attach">3</property>
+		  <property name="top_attach">0</property>
+		  <property name="bottom_attach">1</property>
+		  <property name="x_options">fill</property>
+		  <property name="y_options"></property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkCheckButton" id="check_preferred_only">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">Show p_referred networks only</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		</widget>
+		<packing>
+		  <property name="left_attach">0</property>
+		  <property name="right_attach">2</property>
+		  <property name="top_attach">1</property>
+		  <property name="bottom_attach">2</property>
+		  <property name="y_options"></property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkButton" id="edit_preferred_btn">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">Edit Pre_ferred Networks...</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		</widget>
+		<packing>
+		  <property name="left_attach">2</property>
+		  <property name="right_attach">3</property>
+		  <property name="top_attach">1</property>
+		  <property name="bottom_attach">2</property>
+		  <property name="x_options">fill</property>
+		  <property name="y_options"></property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+<widget class="GtkDialog" id="preferred_networks">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Preferred Wireless Networks</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox2">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+	<widget class="GtkHButtonBox" id="dialog-action_area2">
+	  <property name="visible">True</property>
+	  <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+	  <child>
+	    <widget class="GtkButton" id="helpbutton2">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-help</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-11</property>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="closebutton2">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-close</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-7</property>
+	    </widget>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">True</property>
+	  <property name="pack_type">GTK_PACK_END</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkTable" id="table2">
+	  <property name="border_width">6</property>
+	  <property name="visible">True</property>
+	  <property name="n_rows">3</property>
+	  <property name="n_columns">2</property>
+	  <property name="homogeneous">False</property>
+	  <property name="row_spacing">6</property>
+	  <property name="column_spacing">6</property>
+
+	  <child>
+	    <widget class="GtkLabel" id="label4">
+	      <property name="visible">True</property>
+	      <property name="label" translatable="yes">Pre_ferred Networks:</property>
+	      <property name="use_underline">True</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">0</property>
+	      <property name="right_attach">1</property>
+	      <property name="top_attach">0</property>
+	      <property name="bottom_attach">1</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkVBox" id="vbox3">
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">6</property>
+
+	      <child>
+		<widget class="GtkButton" id="up_btn">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label">gtk-go-up</property>
+		  <property name="use_stock">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkButton" id="down_btn">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label">gtk-go-down</property>
+		  <property name="use_stock">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkButton" id="remove_btn">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label">gtk-remove</property>
+		  <property name="use_stock">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkButton" id="props_btn">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label">gtk-properties</property>
+		  <property name="use_stock">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">1</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">1</property>
+	      <property name="bottom_attach">2</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options">fill</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkCheckButton" id="auto_connect_cb">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">_Automatically connect to available networks in this order</property>
+	      <property name="use_underline">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="active">False</property>
+	      <property name="inconsistent">False</property>
+	      <property name="draw_indicator">True</property>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">0</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">2</property>
+	      <property name="bottom_attach">3</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkScrolledWindow" id="preferred_scroll">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+	      <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+	      <property name="shadow_type">GTK_SHADOW_IN</property>
+	      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+	      <child>
+		<widget class="GtkTreeView" id="preferred_list">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="headers_visible">False</property>
+		  <property name="rules_hint">False</property>
+		  <property name="reorderable">False</property>
+		  <property name="enable_search">True</property>
+		</widget>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">0</property>
+	      <property name="right_attach">1</property>
+	      <property name="top_attach">1</property>
+	      <property name="bottom_attach">2</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+<widget class="GtkDialog" id="network_props">
+  <property name="visible">True</property>
+  <property name="title" translatable="yes">Network Properties</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">False</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="decorated">True</property>
+  <property name="skip_taskbar_hint">False</property>
+  <property name="skip_pager_hint">False</property>
+  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialog-vbox4">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+	<widget class="GtkHButtonBox" id="dialog-action_area4">
+	  <property name="visible">True</property>
+	  <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+	  <child>
+	    <widget class="GtkButton" id="helpbutton4">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-help</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-11</property>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="cancel_btn">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-cancel</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-6</property>
+	    </widget>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="ok_btn">
+	      <property name="visible">True</property>
+	      <property name="can_default">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-ok</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="response_id">-5</property>
+	    </widget>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">True</property>
+	  <property name="pack_type">GTK_PACK_END</property>
+	</packing>
+      </child>
+
+      <child>
+	<widget class="GtkVBox" id="dlg_vbox">
+	  <property name="border_width">12</property>
+	  <property name="visible">True</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">12</property>
+
+	  <child>
+	    <widget class="GtkHBox" id="name_hbox">
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">6</property>
+
+	      <child>
+		<widget class="GtkLabel" id="name_lbl">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">_Name (SSID):</property>
+		  <property name="use_underline">True</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		  <property name="mnemonic_widget">name_entry</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkEntry" id="name_entry">
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="editable">True</property>
+		  <property name="visibility">True</property>
+		  <property name="max_length">0</property>
+		  <property name="text" translatable="yes">Office - First Floor</property>
+		  <property name="has_frame">True</property>
+		  <property name="invisible_char" translatable="yes">*</property>
+		  <property name="activates_default">False</property>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkFrame" id="encrypt_frame">
+	      <property name="visible">True</property>
+	      <property name="label_xalign">0</property>
+	      <property name="label_yalign">0.5</property>
+	      <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+	      <child>
+		<widget class="GtkHBox" id="hbox2">
+		  <property name="visible">True</property>
+		  <property name="homogeneous">False</property>
+		  <property name="spacing">0</property>
+
+		  <child>
+		    <widget class="GtkLabel" id="label12">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">    </property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkTable" id="encrypt_table">
+		      <property name="visible">True</property>
+		      <property name="n_rows">6</property>
+		      <property name="n_columns">3</property>
+		      <property name="homogeneous">False</property>
+		      <property name="row_spacing">6</property>
+		      <property name="column_spacing">6</property>
+
+		      <child>
+			<widget class="GtkLabel" id="wep_key_lbl">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">Network (WEP) _key:</property>
+			  <property name="use_underline">True</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			  <property name="mnemonic_widget">wep_key_entry</property>
+			</widget>
+			<packing>
+			  <property name="left_attach">0</property>
+			  <property name="right_attach">1</property>
+			  <property name="top_attach">1</property>
+			  <property name="bottom_attach">2</property>
+			  <property name="x_options">fill</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="key_format_lbl">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">Key _format:</property>
+			  <property name="use_underline">True</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="left_attach">0</property>
+			  <property name="right_attach">1</property>
+			  <property name="top_attach">2</property>
+			  <property name="bottom_attach">3</property>
+			  <property name="x_options">fill</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="key_length_lbl">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">Key _length:</property>
+			  <property name="use_underline">True</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="left_attach">0</property>
+			  <property name="right_attach">1</property>
+			  <property name="top_attach">3</property>
+			  <property name="bottom_attach">4</property>
+			  <property name="x_options">fill</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="key_index_lbl">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes">Key inde_x:</property>
+			  <property name="use_underline">True</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			  <property name="mnemonic_widget">key_index_spin</property>
+			</widget>
+			<packing>
+			  <property name="left_attach">0</property>
+			  <property name="right_attach">1</property>
+			  <property name="top_attach">4</property>
+			  <property name="bottom_attach">5</property>
+			  <property name="x_options">fill</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkComboBoxEntry" id="key_length_combo">
+			  <property name="visible">True</property>
+			  <property name="items" translatable="yes">40 Bit Key
+128 Bit Key
+256 Bit Key
+</property>
+			</widget>
+			<packing>
+			  <property name="left_attach">1</property>
+			  <property name="right_attach">3</property>
+			  <property name="top_attach">3</property>
+			  <property name="bottom_attach">4</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkComboBoxEntry" id="key_format_combo">
+			  <property name="visible">True</property>
+			  <property name="items" translatable="yes">As Is
+Hex Digits
+Text Passphrase
+</property>
+			</widget>
+			<packing>
+			  <property name="left_attach">1</property>
+			  <property name="right_attach">3</property>
+			  <property name="top_attach">2</property>
+			  <property name="bottom_attach">3</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkEntry" id="wep_key_entry">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="editable">True</property>
+			  <property name="visibility">False</property>
+			  <property name="max_length">0</property>
+			  <property name="text" translatable="yes">0000000000</property>
+			  <property name="has_frame">True</property>
+			  <property name="invisible_char" translatable="yes">*</property>
+			  <property name="activates_default">False</property>
+			</widget>
+			<packing>
+			  <property name="left_attach">1</property>
+			  <property name="right_attach">3</property>
+			  <property name="top_attach">1</property>
+			  <property name="bottom_attach">2</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkLabel" id="label13">
+			  <property name="visible">True</property>
+			  <property name="label" translatable="yes"></property>
+			  <property name="use_underline">False</property>
+			  <property name="use_markup">False</property>
+			  <property name="justify">GTK_JUSTIFY_LEFT</property>
+			  <property name="wrap">False</property>
+			  <property name="selectable">False</property>
+			  <property name="xalign">0</property>
+			  <property name="yalign">0.5</property>
+			  <property name="xpad">0</property>
+			  <property name="ypad">0</property>
+			</widget>
+			<packing>
+			  <property name="left_attach">2</property>
+			  <property name="right_attach">3</property>
+			  <property name="top_attach">4</property>
+			  <property name="bottom_attach">5</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkSpinButton" id="key_index_spin">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="climb_rate">1</property>
+			  <property name="digits">0</property>
+			  <property name="numeric">True</property>
+			  <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+			  <property name="snap_to_ticks">False</property>
+			  <property name="wrap">False</property>
+			  <property name="adjustment">1 1 4 1 1 1</property>
+			</widget>
+			<packing>
+			  <property name="left_attach">1</property>
+			  <property name="right_attach">2</property>
+			  <property name="top_attach">4</property>
+			  <property name="bottom_attach">5</property>
+			  <property name="x_options">fill</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkTable" id="encrypt_reqts_table">
+			  <property name="border_width">6</property>
+			  <property name="visible">True</property>
+			  <property name="n_rows">3</property>
+			  <property name="n_columns">2</property>
+			  <property name="homogeneous">False</property>
+			  <property name="row_spacing">6</property>
+			  <property name="column_spacing">6</property>
+
+			  <child>
+			    <widget class="GtkCheckButton" id="wep_cb">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">_Data encryption (WEP)</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+			      <property name="active">True</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">1</property>
+			      <property name="right_attach">2</property>
+			      <property name="top_attach">1</property>
+			      <property name="bottom_attach">2</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options"></property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkCheckButton" id="authentication_cb">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">_Authentication (Shared mode)</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">True</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">1</property>
+			      <property name="right_attach">2</property>
+			      <property name="top_attach">2</property>
+			      <property name="bottom_attach">3</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options"></property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkLabel" id="label11">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">Network requires a key for:</property>
+			      <property name="use_underline">False</property>
+			      <property name="use_markup">False</property>
+			      <property name="justify">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap">False</property>
+			      <property name="selectable">False</property>
+			      <property name="xalign">0</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">0</property>
+			      <property name="right_attach">2</property>
+			      <property name="top_attach">0</property>
+			      <property name="bottom_attach">1</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options"></property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkLabel" id="label19">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">    </property>
+			      <property name="use_underline">False</property>
+			      <property name="use_markup">False</property>
+			      <property name="justify">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap">False</property>
+			      <property name="selectable">False</property>
+			      <property name="xalign">0</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			    </widget>
+			    <packing>
+			      <property name="left_attach">0</property>
+			      <property name="right_attach">1</property>
+			      <property name="top_attach">1</property>
+			      <property name="bottom_attach">3</property>
+			      <property name="x_options">fill</property>
+			      <property name="y_options"></property>
+			    </packing>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="left_attach">0</property>
+			  <property name="right_attach">3</property>
+			  <property name="top_attach">0</property>
+			  <property name="bottom_attach">1</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkCheckButton" id="auto_key_cb">
+			  <property name="visible">True</property>
+			  <property name="can_focus">True</property>
+			  <property name="label" translatable="yes">Key is provided au_tomatically</property>
+			  <property name="use_underline">True</property>
+			  <property name="relief">GTK_RELIEF_NORMAL</property>
+			  <property name="focus_on_click">True</property>
+			  <property name="active">False</property>
+			  <property name="inconsistent">False</property>
+			  <property name="draw_indicator">True</property>
+			</widget>
+			<packing>
+			  <property name="left_attach">0</property>
+			  <property name="right_attach">3</property>
+			  <property name="top_attach">5</property>
+			  <property name="bottom_attach">6</property>
+			  <property name="x_options">fill</property>
+			  <property name="y_options"></property>
+			</packing>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
+		    </packing>
+		  </child>
+		</widget>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="frame_lbl">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">&lt;b&gt;Encryption&lt;/b&gt;</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">True</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		</widget>
+		<packing>
+		  <property name="type">label_item</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkHBox" id="hbox7">
+	      <property name="visible">True</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">0</property>
+
+	      <child>
+		<widget class="GtkLabel" id="label20">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">Channel</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		</widget>
+		<packing>
+		  <property name="padding">17</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+
+	      <child>
+		<widget class="GtkComboBoxEntry" id="chanel_combo_box">
+		  <property name="visible">True</property>
+		  <property name="items" translatable="yes">Automatic
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+</property>
+		</widget>
+		<packing>
+		  <property name="padding">64</property>
+		  <property name="expand">True</property>
+		  <property name="fill">True</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkCheckButton" id="adhoc_cb">
+	      <property name="visible">True</property>
+	      <property name="can_focus">True</property>
+	      <property name="label" translatable="yes">This is an ad-_hoc (computer-to-computer) network</property>
+	      <property name="use_underline">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <property name="active">False</property>
+	      <property name="inconsistent">False</property>
+	      <property name="draw_indicator">True</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">False</property>
+	</packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>
diff -Nru gnome-netstatus/src/netstatus-applet.c gnome-netstatus.hacked/src/netstatus-applet.c
--- gnome-netstatus/src/netstatus-applet.c	2004-05-14 03:20:49.000000000 -0400
+++ gnome-netstatus.hacked/src/netstatus-applet.c	2004-06-21 16:21:13.744232440 -0400
@@ -18,6 +18,7 @@
 
  * Authors:
  *      Mark McLoughlin <mark@skynet.ie>
+ *      Mark Carey <mark.carey@sun.com> (wireless functionality)
  */
 
 #include <config.h>
@@ -35,6 +36,7 @@
 #include "netstatus-icon.h"
 #include "netstatus-iface.h"
 #include "netstatus-dialog.h"
+#include "netstatus-wireless-connection-prefs.h"
 
 struct _NetstatusAppletPrivate
 {
@@ -44,6 +46,7 @@
   
   GtkWidget      *status_dialog;
   GtkWidget      *about_dialog;
+  GtkWidget      *connect_dialog;
   
   GConfClient    *client;
   guint           notify_id;
@@ -65,7 +68,11 @@
 							    NetstatusApplet      *applet);
 static void     netstatus_applet_display_status_dialog     (NetstatusApplet      *applet);
 static void     netstatus_applet_iface_name_changed        (NetstatusApplet      *applet);
-
+static void     netstatus_applet_disconnect                (BonoboUIComponent    *uic,
+							    NetstatusApplet      *applet);
+static void     netstatus_applet_display_connect_dialog    (BonoboUIComponent    *uic,
+							    NetstatusApplet      *applet);
+                  
 static GObjectClass *parent_class;
 
 static const BonoboUIVerb netstatus_menu_verbs [] =
@@ -73,6 +80,8 @@
     BONOBO_UI_UNSAFE_VERB ("NetstatusProperties", netstatus_applet_display_properties_dialog),
     BONOBO_UI_UNSAFE_VERB ("NetstatusHelp", netstatus_applet_display_help),
     BONOBO_UI_UNSAFE_VERB ("NetstatusAbout", netstatus_applet_display_about_dialog),
+    BONOBO_UI_UNSAFE_VERB ("NetstatusConnect", netstatus_applet_display_connect_dialog),
+    BONOBO_UI_UNSAFE_VERB ("NetstatusDisconnect", netstatus_applet_disconnect),
     
     BONOBO_UI_VERB_END
   };
@@ -164,6 +173,10 @@
     gtk_widget_destroy (applet->priv->status_dialog);
   applet->priv->status_dialog = NULL;
 
+  if (applet->priv->connect_dialog)
+    gtk_widget_destroy (applet->priv->connect_dialog);
+  applet->priv->connect_dialog = NULL;
+  
   if (applet->priv->about_dialog)
     gtk_widget_destroy (applet->priv->about_dialog);
   applet->priv->about_dialog = NULL;
@@ -230,6 +243,39 @@
   gtk_widget_show (GTK_WIDGET (applet->priv->status_dialog));
 }
 
+/* Cause disconnection from the wireless network we are connected to. */
+static void netstatus_applet_disconnect (BonoboUIComponent *uic,
+                                         NetstatusApplet *applet)
+{
+	/* Disconnect to do (disconnect from the applet->priv->iface by downing the interface */
+  netstatus_iface_clr_flag((unsigned char *) netstatus_iface_get_name (applet->priv->iface), IFF_UP);
+}
+
+/* Display the connect dialog */
+static void netstatus_applet_display_connect_dialog (BonoboUIComponent *uic,
+                                                     NetstatusApplet *applet)
+{
+  if (applet->priv->connect_dialog)
+  {
+    gtk_window_set_screen (GTK_WINDOW (applet->priv->connect_dialog),
+                           gtk_widget_get_screen (GTK_WIDGET (applet)));
+    gtk_window_present (GTK_WINDOW (applet->priv->connect_dialog));
+    return;
+  }
+
+  applet->priv->connect_dialog = netstatus_connection_prefs_new (applet->priv->iface);
+
+  gtk_window_set_screen (GTK_WINDOW (applet->priv->connect_dialog),
+			                   gtk_widget_get_screen (GTK_WIDGET (applet)));
+
+  g_signal_connect (applet->priv->connect_dialog,
+		                "destroy",
+                    G_CALLBACK (gtk_widget_destroyed),
+                    &applet->priv->connect_dialog);
+
+  gtk_widget_show (GTK_WIDGET (applet->priv->connect_dialog));
+}
+
 static void
 netstatus_applet_display_help (BonoboUIComponent *uic,
 			       NetstatusApplet   *applet)
@@ -265,6 +311,7 @@
       "Mark McLoughlin <mark@skynet.ie>",
       "Erwann Chenede <erwann.chenede@sun.com>",
       "Calum Benson <calum.benson@sun.com>",
+      "Mark Carey <mark.carey@sun.com>",
       NULL
     };
   const char *documenters [] = { NULL };
@@ -288,7 +335,7 @@
 
   applet->priv->about_dialog =
     gnome_about_new (_("Network Monitor"), VERSION,
-		     "Copyright \xc2\xa9 2003 Sun Microsystems, Inc.\n",
+		     "Copyright \xc2\xa9 2003-2004 Sun Microsystems, Inc.\n",
 		     _("The Network Monitor displays the status of a network device."),
 		     authors,
 		     documenters,
diff -Nru gnome-netstatus/src/netstatus-dialog.c gnome-netstatus.hacked/src/netstatus-dialog.c
--- gnome-netstatus/src/netstatus-dialog.c	2004-06-21 17:30:01.000000000 -0400
+++ gnome-netstatus.hacked/src/netstatus-dialog.c	2004-06-22 04:39:07.020410968 -0400
@@ -40,7 +40,8 @@
 static const char *network_config_tools[] = {
   "network-admin --configure %i",
   "redhat-config-network",
-  "system-control-network"
+  "system-control-network",
+  "yast2 network"
 };
 
 #define UNKNOWN_STR(t,s) G_STMT_START {       \
diff -Nru gnome-netstatus/src/netstatus-iface.c gnome-netstatus.hacked/src/netstatus-iface.c
--- gnome-netstatus/src/netstatus-iface.c	2004-05-09 19:24:35.000000000 -0400
+++ gnome-netstatus.hacked/src/netstatus-iface.c	2004-06-21 17:07:08.910383520 -0400
@@ -20,6 +20,7 @@
  * Authors:
  *    Erwann Chenede  <erwann.chenede@sun.com>
  *    Mark McLoughlin  <mark@skynet.ie>
+ *    Michael Magin  <mmagin@sun.com>  (listing interfaces without IPs)
  *
  * Support for the various hardware types is adapted from the
  * net-tools package (version 1.60) which is also distributed
@@ -33,6 +34,8 @@
 
 #include <libgnome/gnome-i18n.h>
 
+#include <ctype.h>
+#include <stdio.h>
 #include <sys/ioctl.h>
 #ifdef HAVE_SYS_SOCKIO_H
 #include <sys/sockio.h>
@@ -1186,12 +1189,74 @@
   return retval;
 }
 
+/* next two functions based on some code in net-tools lib/interface.c */
+#define _PATH_PROCNET_DEV "/proc/net/dev"
+
+/* just as in lib/interface.c, but reformatted (and renamed for namespacing) */
+static char 
+*netstatus_list_interface_names_get_name(char *name, char *p)
+{
+  while (isspace(*p))
+    p++;
+  while (*p) {
+    if (isspace(*p))
+      break;
+    if (*p == ':') {        /* could be an alias */
+      char *dot = p, *dotname = name;
+      *name++ = *p++;
+      while (isdigit(*p))
+        *name++ = *p++;
+      if (*p != ':') {    /* it wasn't, backup */
+        p = dot;
+        name = dotname;
+      }
+      if (*p == '\0')
+        return NULL;
+      p++;
+      break;
+    }
+    *name++ = *p++;
+  }
+  *name++ = '\0';
+  return p;
+}
+
+/* read /proc/net/dev, put the interface names in a GList, which
+   netstatus_list_interface_names can merge with what it has found */
+GList *
+netstatus_list_interface_names_proc(GError **error)
+{
+  FILE *fh;
+  char buf[512];
+  GList *interfaces = NULL;
+
+  fh = fopen(_PATH_PROCNET_DEV, "r");
+  if(!fh) {
+    /* FIXME g_error stuff */
+  }
+  fgets(buf, sizeof buf, fh); /* eat line */
+  fgets(buf, sizeof buf, fh);
+
+  while(fgets(buf, sizeof buf, fh)) {
+    char *s, name[IF_NAMESIZE];
+    s = netstatus_list_interface_names_get_name(name, buf);
+    interfaces = netstatus_list_insert_unique (interfaces,
+                                               g_strndup(name, IF_NAMESIZE-1));
+  }
+  if(ferror(fh)) {
+    /* FIXME g_error stuff */
+  }
+
+  fclose(fh);
+  return interfaces;
+}
+
 GList *
 netstatus_list_interface_names (GError **error)
 {
 
   struct ifconf *if_conf;
-  GList         *interfaces;
+  GList         *interfaces, *proc_interfaces, *main_tmp = NULL, *sec_tmp = NULL;
   GList         *loopbacks;
   char          *p;
   int            fd;
@@ -1245,6 +1310,33 @@
 
   interfaces = g_list_concat (interfaces, loopbacks);
 
+  proc_interfaces = netstatus_list_interface_names_proc(error);
+  
+  /* Loop and see if we have each element already */
+  main_tmp = interfaces;
+  
+  while (main_tmp)
+  {
+    sec_tmp = proc_interfaces; 
+    while (sec_tmp)
+    {
+      if ( ! strncmp( (char *)main_tmp->data, (char *)sec_tmp->data, IF_NAMESIZE-1) )
+      {
+        /* match, removed from secondary list. */
+        if ( g_list_remove_link (proc_interfaces, sec_tmp) == NULL )
+        {
+          /* no elements remain.  Set list to null */
+          proc_interfaces = NULL;
+          break;
+        }
+      }
+      sec_tmp = sec_tmp->next;
+    }
+    main_tmp = main_tmp->next;
+  }
+  
+  interfaces = g_list_concat (proc_interfaces,
+                              interfaces);
   g_free (if_conf->ifc_buf);
   g_free (if_conf);
   close (fd);
@@ -1256,3 +1348,45 @@
 
   return interfaces;
 }
+
+/* Ripped from ifconfig.c */
+int netstatus_iface_set_flag(char *ifname, short flag)
+{
+    struct ifreq ifr;
+    
+    int skfd = socket(AF_INET, SOCK_DGRAM, 0);
+ 
+    strncpy(ifr.ifr_name, ifname, IF_NAMESIZE);
+    if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0) {
+        close(skfd);
+        return (-1);
+    }
+    strncpy(ifr.ifr_name, ifname, IF_NAMESIZE);
+    ifr.ifr_flags |= flag;
+    if (ioctl(skfd, SIOCSIFFLAGS, &ifr) < 0) {
+        close(skfd);
+        return -1;
+    }
+    return (0);
+}
+
+int netstatus_iface_clr_flag(char *ifname, short flag)
+{
+    struct ifreq ifr;
+    int skfd = socket(AF_INET, SOCK_DGRAM, 0);
+
+    strncpy(ifr.ifr_name, ifname, IF_NAMESIZE);
+    if (ioctl(skfd, SIOCGIFFLAGS, &ifr) < 0) {
+        close(skfd);
+        return -1;
+    }
+    
+    strncpy(ifr.ifr_name, ifname, IF_NAMESIZE);
+    ifr.ifr_flags &= ~flag;
+    if (ioctl(skfd, SIOCSIFFLAGS, &ifr) < 0) {
+        close(skfd);
+        return -1;
+    }
+    return (0);
+}
+
diff -Nru gnome-netstatus/src/netstatus-iface.h gnome-netstatus.hacked/src/netstatus-iface.h
--- gnome-netstatus/src/netstatus-iface.h	2004-03-17 18:41:09.000000000 -0500
+++ gnome-netstatus.hacked/src/netstatus-iface.h	2004-06-21 12:22:30.473715256 -0400
@@ -90,6 +90,8 @@
 							      const char     **hw_name,
 							      char           **hw_addr);
 gboolean               netstatus_iface_get_is_loopback       (NetstatusIface  *iface);
+int                    netstatus_iface_set_flag              (char *ifname, short flag);
+int                    netstatus_iface_clr_flag              (char *ifname, short flag);
 
 G_END_DECLS
 
diff -Nru gnome-netstatus/src/netstatus-wireless-connection-prefs.c gnome-netstatus.hacked/src/netstatus-wireless-connection-prefs.c
--- gnome-netstatus/src/netstatus-wireless-connection-prefs.c	1969-12-31 19:00:00.000000000 -0500
+++ gnome-netstatus.hacked/src/netstatus-wireless-connection-prefs.c	2004-06-22 04:16:19.738269448 -0400
@@ -0,0 +1,2512 @@
+/*
+ * Copyright (C) 2004 Sun Microsystems, 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 2 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ *      Mark Carey <mark.carey@sun.com>
+ */
+
+#include <config.h>
+
+#include "netstatus-wireless-connection-prefs.h"
+
+#include <string.h>
+#include <time.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <glade/glade-xml.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnomeui/gnome-help.h>
+#include <gconf/gconf-client.h>
+
+#include "netstatus-icon.h"
+#include "netstatus-util.h"
+#include <gdk-pixbuf/gdk-pixdata.h>
+#include "connected_pixdata.h"
+
+/* Wireless application specific stuff */
+#include "wireless-api.h"
+
+
+/* Define the gconf pathing stuff */
+#define NETWORK_CONFIG_WIRELESS_GCONF_MAX_PATH (256)
+#define NETWORK_CONFIG_WIRELESS_DIR             "/apps/netstatus_applet/wireless"
+#define NETWORK_CONFIG_WIRELESS_MASTER_KEY NETWORK_CONFIG_WIRELESS_DIR "/present"
+#define NETWORK_CONFIG_WIRELESS_RESTRICTED_KEY NETWORK_CONFIG_WIRELESS_DIR "/restricted"
+#define NETWORK_CONFIG_WIRELESS_AUTO_CONNECT_KEY NETWORK_CONFIG_WIRELESS_DIR "/autoconnect"
+#define NETWORK_CONFIG_WIRELESS_ENC_KEY         "/encryptedonly"
+#define NETWORK_CONFIG_WIRELESS_PREF_KEY        "/preferredonly"
+#define NETWORK_CONFIG_WIRELESS_NETWORKS_DIR NETWORK_CONFIG_WIRELESS_DIR "/networks"
+
+#define MAX_KEY_PATH_LEN2 (strlen(NETWORK_CONFIG_WIRELESS_NETWORKS_DIR) + 1 + (IW_ESSID_MAX_SIZE +1) + 10)
+
+/* Anyone with over 512 preferred networks seems unlikely. */
+#define MAX_PREFERRED_NET (512)
+#define LOCAL_MAX_PATH    (512)
+
+/* Define the interface "up" commands for each os in this array */
+typedef struct _IFUpCommands {
+  char *probe_file_name;
+  char *command;
+} IFUpCommands;
+
+
+IFUpCommands interface_up_commands[] = 
+{
+  {"/etc/init.d/net.%s", "/etc/init.d/net.%s"},     /* Gentoo */
+  {"/etc/sysconfig/net/ifcfg-%s", "/sbin/ifup %s"}, /* SuSE / RedHat */
+  {"/sbin/dhcpcd", "/sbin/dhcpcd %s"},              /* Last resort */
+  { NULL, NULL}
+};
+
+/* Here we have structures for each dialog.  These are specific to each dialog
+ * since we mill be interacting heavilty with the data structures during 
+ * operation of the dialog
+ */
+
+typedef struct
+{
+  GtkWidget      *dialog;
+
+  NetstatusIface *iface;
+  NetstatusIcon  *icon;
+  guint           listener;
+
+  /* Widgets go here. */
+  GtkWidget      *lb_avail_networks;
+  GtkWidget      *check_encrypted_only;
+  GtkWidget      *check_preferred_only;
+  GtkWidget      *props_btn;
+  GtkWidget      *add_to_pref_btn;
+  GtkWidget      *connect_btn;
+
+  /* Configuration parameters */
+  gboolean        adm_restricted;
+  gboolean        enc_only;
+  gboolean        pref_only;
+
+  /* AP Listing stuff. */
+  AP_type       **ap_array;
+  guint           ap_list_monitor;
+  gulong          ap_list_checksum;
+  
+  /* Pixmaps for the connection indicator */
+  GdkPixbuf      *empty_pixbuf;
+  GdkPixbuf      *connected_pixbuf;
+
+  GConfClient    *client;
+
+}
+NetstatusConnectionPrefsData;
+
+
+typedef struct
+{
+  char  essid[IW_ESSID_MAX_SIZE +1];
+  gint  order;
+}
+prefNet;
+
+typedef struct
+{
+  GtkWidget                      *dialog;
+
+  NetstatusIface                 *iface;
+  NetstatusIcon                  *icon;
+  guint                           listener;
+
+  /* Widgets go here. */
+  GtkWidget                      *lb_preferred_networks;
+  GtkWidget                      *check_auto_connect;
+  GtkWidget                      *up_btn;
+  GtkWidget                      *down_btn;
+  GtkWidget                      *remove_btn;
+  GtkWidget                      *props_btn;
+
+  GConfClient                    *client;
+
+  /* Data array of network essids and priorities */
+  prefNet                         preferred_networks[MAX_PREFERRED_NET];
+  guint                           net_count;
+
+}
+NetstatusPreferredNetworksData;
+
+typedef struct
+{
+  GtkWidget                      *dialog;
+
+  NetstatusIface                 *iface;
+  NetstatusIcon                  *icon;
+  guint                           listener;
+
+  /* Store a copy of the saved structure from the network object load. */
+  NetstatusNetworkData           *nnd_store;
+
+  /* Widgets go here. */
+  GtkWidget                      *name_entry;
+  GtkWidget                      *wep_cb;
+  GtkWidget                      *authentication_cb;
+  GtkWidget                      *wep_key_entry;
+  GtkWidget                      *key_format_combo;
+  GtkWidget                      *key_length_combo;
+  GtkWidget                      *key_index_spin;
+  GtkWidget                      *auto_key_cb;
+  GtkWidget                      *adhoc_cb;
+  GtkWidget                      *chanel_combo_box;
+
+  GConfClient                    *client;
+
+}
+NetstatusNetworkPropsData;
+
+enum
+{ 
+  COLUMN_IMG = 0,
+  COLUMN_APNAME,
+  COLUMN_STRENGTH,
+  COLUMN_AP_POINTER,
+  NUM_COLS
+};
+
+
+/* Module local prototypes */
+
+/* Methods for Network Preferences Dialog */
+static void netstatus_connprefs_response_prefs (GtkWidget *dialog, int response);
+static void netstatus_connprefs_destroy_prefs (GtkWidget *dialog);
+static void netstatus_connprefs_connect (GtkWidget *dialog, NetstatusConnectionPrefsData *data);
+static void netstatus_connprefs_refresh (GtkWidget *dialog, NetstatusConnectionPrefsData *data);
+static void netstatus_connprefs_open_properties (GtkWidget *dialog, NetstatusConnectionPrefsData *data);
+static void netstatus_connprefs_new_net (GtkWidget *dialog, NetstatusConnectionPrefsData *data);
+static void netstatus_connprefs_add_to_pref (GtkWidget *dialog, NetstatusConnectionPrefsData *data);
+static void netstatus_connprefs_open_prefered_networks (GtkWidget *dialog, NetstatusConnectionPrefsData *data);
+static void netstatus_connprefs_enc_only_clicked (GtkWidget *dialog, NetstatusConnectionPrefsData *data);
+static void netstatus_connprefs_pref_only_clicked (GtkWidget *dialog, NetstatusConnectionPrefsData *data);
+static void netstatus_connprefs_populate_available (GtkWidget *dialog, NetstatusConnectionPrefsData *data);
+static void netstatus_connprefs_save_all_prefs (GtkWidget *dialog, NetstatusConnectionPrefsData *data);
+static void netstatus_connprefs_load_all_prefs (GtkWidget *dialog, NetstatusConnectionPrefsData *data);
+static void netstatus_connprefs_pref_changed (GtkWidget *dialog, NetstatusConnectionPrefsData *data);
+GSourceFunc netstatus_connprefs_refresh_callback(NetstatusConnectionPrefsData *data);
+
+/* Methods for preferred netowrks dialog */
+static void netstatus_connprefs_response_pref_net (GtkWidget *dialog, int response);
+static void netstatus_connprefs_destroy_pref_net (GtkWidget *dialog);
+static void netstatus_connprefs_pn_up_btn_clicked (GtkWidget *widg, NetstatusPreferredNetworksData *data);
+static void netstatus_connprefs_pn_down_btn_clicked (GtkWidget *widg, NetstatusPreferredNetworksData *data);
+static void netstatus_connprefs_pn_remove_btn_clicked (GtkWidget *widg, NetstatusPreferredNetworksData *data);
+static void netstatus_connprefs_pn_props_btn_clicked (GtkWidget *widg, NetstatusPreferredNetworksData *data);
+static void netstatus_connprefs_pn_autocb_btn_clicked (GtkWidget *widg, NetstatusPreferredNetworksData *data);
+static void netstatus_connprefs_pn_sort_networks(NetstatusPreferredNetworksData *data);
+static void netstatus_connprefs_pn_refresh_list(NetstatusPreferredNetworksData *data);
+static void netstatus_connprefs_pn_store_networks(NetstatusPreferredNetworksData *data);
+static void netstatus_connprefs_pn_reload_networks(NetstatusPreferredNetworksData *data);
+static void netstatus_connprefs_pn_list_changed(GtkWidget *widget, NetstatusPreferredNetworksData *data);
+
+/* Methods for the network properties dialog */
+static void netstatus_connprefs_response_net_props (GtkWidget *dialog, int response);
+static void netstatus_connprefs_destroy_net_props (GtkWidget *dialog);
+static void netstatus_connprefs_props_changed (GtkWidget *widg, NetstatusNetworkPropsData *data);
+static void netstatus_connprefs_props_ok_btn_clicked (GtkWidget *widg, NetstatusNetworkPropsData *data);
+static void netstatus_connprefs_props_cancel_btn_clicked (GtkWidget *widg, NetstatusNetworkPropsData *data);
+
+/* Common methods */
+NetstatusNetworkData *load_network_object(GConfClient *gc_client, char *essid);
+static void save_network_object(GConfClient *gc_client, char *essid, NetstatusNetworkData *data);
+static void translate_ap_to_nnd(AP_type *from, NetstatusNetworkData *to);
+NetstatusNetworkData *get_all_preferred_network_objects (GConfClient *gc_client, unsigned int *count);
+void safe_save_network_object(AP_type *this_ap, GConfClient *g_client);
+void q_sort(prefNet nets[], int left, int right);
+
+/* Response methods */
+static void
+netstatus_connprefs_response_prefs (GtkWidget *dialog,
+                                    int        response)
+{
+  switch (response)
+  {
+  case GTK_RESPONSE_HELP:
+    {
+      GError    *error = NULL;
+      GdkScreen *screen;
+
+      screen = gtk_window_get_screen (GTK_WINDOW (dialog));
+
+      gnome_help_display_on_screen ("gnome-netstatus", NULL, screen, &error);
+
+      if (error)
+      {
+        GtkWidget *message_dialog;
+
+        message_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
+                         GTK_DIALOG_DESTROY_WITH_PARENT,
+                         GTK_MESSAGE_ERROR,
+                         GTK_BUTTONS_CLOSE,
+                         _("There was an error displaying help:\n%s"),
+                         error->message);
+
+        gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE);
+        gtk_window_set_screen (GTK_WINDOW (message_dialog), screen);
+
+        g_signal_connect (message_dialog, "response",
+                          G_CALLBACK (gtk_widget_destroy),
+                          NULL);
+
+        gtk_widget_show (message_dialog);
+
+        g_error_free (error);
+      }
+    }
+    break;
+  default:
+    gtk_widget_hide (dialog);
+    break;
+  }
+}
+
+static void
+netstatus_connprefs_response_pref_net (GtkWidget *dialog,
+                                       int        response)
+{
+  switch (response)
+  {
+    case GTK_RESPONSE_HELP:
+      {
+        GError    *error = NULL;
+        GdkScreen *screen;
+
+        screen = gtk_window_get_screen (GTK_WINDOW (dialog));
+
+        gnome_help_display_on_screen ("gnome-netstatus", NULL, screen, &error);
+
+        if (error)
+        {
+          GtkWidget *message_dialog;
+
+          message_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
+                                                  GTK_DIALOG_DESTROY_WITH_PARENT,
+                                                  GTK_MESSAGE_ERROR,
+                                                  GTK_BUTTONS_CLOSE,
+                                                  _("There was an error displaying help:\n%s"),
+                                                  error->message);
+
+          gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE);
+          gtk_window_set_screen (GTK_WINDOW (message_dialog), screen);
+
+          g_signal_connect (message_dialog, "response",
+                           G_CALLBACK (gtk_widget_destroy),
+                           NULL);
+
+          gtk_widget_show (message_dialog);
+
+          g_error_free (error);
+        }
+      }
+      break;
+    default:
+      gtk_widget_hide (dialog);
+    break;
+  }
+}
+
+static void
+netstatus_connprefs_response_net_props (GtkWidget *dialog,
+                                        int        response)
+{
+  switch (response)
+  {
+  case GTK_RESPONSE_HELP:
+    {
+      GError    *error = NULL;
+      GdkScreen *screen;
+
+      screen = gtk_window_get_screen (GTK_WINDOW (dialog));
+
+      gnome_help_display_on_screen ("gnome-netstatus", NULL, screen, &error);
+
+      if (error)
+      {
+        GtkWidget *message_dialog;
+
+        message_dialog = gtk_message_dialog_new (GTK_WINDOW (dialog),
+                         GTK_DIALOG_DESTROY_WITH_PARENT,
+                         GTK_MESSAGE_ERROR,
+                         GTK_BUTTONS_CLOSE,
+                         _("There was an error displaying help:\n%s"),
+                         error->message);
+
+        gtk_window_set_resizable (GTK_WINDOW (message_dialog), FALSE);
+        gtk_window_set_screen (GTK_WINDOW (message_dialog), screen);
+
+        g_signal_connect (message_dialog, "response",
+                          G_CALLBACK (gtk_widget_destroy),
+                          NULL);
+
+        gtk_widget_show (message_dialog);
+
+        g_error_free (error);
+      }
+    }
+    break;
+  default:
+    gtk_widget_hide (dialog);
+    break;
+  }
+}
+
+/* Destroy Method. */
+static void
+netstatus_connprefs_destroy_prefs (GtkWidget *dialog)
+{
+  NetstatusConnectionPrefsData *data;
+
+  data = g_object_get_data (G_OBJECT (dialog), "netstatus-connprefs-data-prefs");
+  if (!data)
+    return;
+
+  if (data->listener)
+  {
+    g_assert (data->client != NULL);
+
+    gconf_client_notify_remove (data->client, data->listener);
+    data->listener = 0;
+  }
+
+  if (data->client)
+    g_object_unref (data->client);
+  data->client = NULL;
+
+  if (data->iface)
+    g_object_unref (data->iface);
+  data->iface = NULL;
+
+  g_free (data);
+}
+
+static void
+netstatus_connprefs_destroy_pref_net (GtkWidget *dialog)
+{
+  NetstatusPreferredNetworksData *data;
+
+  data = g_object_get_data (G_OBJECT (dialog), "netstatus-connprefs-data-pref-net");
+  if (!data)
+    return;
+
+  if (data->listener)
+  {
+    g_assert (data->client != NULL);
+
+    gconf_client_notify_remove (data->client, data->listener);
+    data->listener = 0;
+  }
+
+  if (data->client)
+    g_object_unref (data->client);
+  data->client = NULL;
+
+  if (data->iface)
+    g_object_unref (data->iface);
+  data->iface = NULL;
+
+  g_free (data);
+}
+
+static void
+netstatus_connprefs_destroy_net_props (GtkWidget *dialog)
+{
+  NetstatusNetworkPropsData *data;
+
+  data = g_object_get_data (G_OBJECT (dialog), "netstatus-connprefs-data-net-props");
+  if (!data)
+    return;
+
+  if (data->nnd_store)
+    g_free (data->nnd_store);
+
+
+  if (data->listener)
+  {
+    g_assert (data->client != NULL);
+
+    gconf_client_notify_remove (data->client, data->listener);
+    data->listener = 0;
+  }
+
+  if (data->client)
+    g_object_unref (data->client);
+  data->client = NULL;
+
+  if (data->iface)
+    g_object_unref (data->iface);
+  data->iface = NULL;
+
+  g_free (data);
+}
+
+
+/* Init methods */
+GtkWidget *netstatus_connection_prefs_new (NetstatusIface *iface)
+{
+  NetstatusConnectionPrefsData *data;
+  GladeXML                     *xml;
+  GtkListStore                 *list_store;
+  GtkCellRenderer              *renderer;
+  GtkTreeViewColumn            *column;
+  GdkPixbuf                    *tmp_pixbuf;
+
+  xml = glade_xml_new (NETSTATUS_GLADEDIR "/connection_prefs.glade", "connection_prefs", NULL);
+  if (!xml)
+    return NULL;
+
+  data = g_new0 (NetstatusConnectionPrefsData, 1);
+  if (data == NULL)
+    return NULL;
+
+
+  /* Init gconf */
+  data->client = gconf_client_get_default ();
+
+  gconf_client_add_dir (data->client, NETWORK_CONFIG_WIRELESS_DIR, GCONF_CLIENT_PRELOAD_NONE, NULL);
+
+  data->dialog = glade_xml_get_widget (xml, "connection_prefs");
+  if (data->dialog == NULL)
+    return NULL;
+
+  g_object_set_data (G_OBJECT (data->dialog), "netstatus-connprefs-data-prefs", data);
+
+  data->iface = g_object_ref (iface);
+
+  /* Wire the help and minimize responses. */
+  g_signal_connect (data->dialog, "response",
+                    G_CALLBACK (netstatus_connprefs_response_prefs), NULL);
+
+  g_signal_connect (data->dialog, "destroy",
+                    G_CALLBACK (netstatus_connprefs_destroy_prefs), NULL);
+
+
+
+  /* Wire up the dialog specific portions here. */
+  g_signal_connect ( glade_xml_get_widget (xml, "connect_btn"), "clicked", G_CALLBACK ( netstatus_connprefs_connect ), data);
+
+  g_signal_connect ( glade_xml_get_widget (xml, "refresh_btn"), "clicked", G_CALLBACK ( netstatus_connprefs_refresh ), data);
+
+  g_signal_connect ( glade_xml_get_widget (xml, "pref_properties_btn"), "clicked", G_CALLBACK (netstatus_connprefs_open_properties), data);
+
+  g_signal_connect ( glade_xml_get_widget (xml, "new_net_btn"), "clicked", G_CALLBACK ( netstatus_connprefs_new_net ), data);
+
+  g_signal_connect ( glade_xml_get_widget (xml, "add_to_pref_btn"), "clicked", G_CALLBACK ( netstatus_connprefs_add_to_pref ), data);
+
+  g_signal_connect ( glade_xml_get_widget (xml, "edit_preferred_btn"), "clicked", G_CALLBACK (netstatus_connprefs_open_prefered_networks), data);
+
+  g_signal_connect ( glade_xml_get_widget (xml, "check_encrypted_only"), "clicked", G_CALLBACK (netstatus_connprefs_enc_only_clicked), data);
+
+  g_signal_connect ( glade_xml_get_widget (xml, "check_preferred_only"), "clicked", G_CALLBACK (netstatus_connprefs_pref_only_clicked), data);
+
+  g_signal_connect ( glade_xml_get_widget (xml, "available_list"), "cursor_changed", G_CALLBACK (netstatus_connprefs_pref_changed), data);
+
+
+  /* Bind the available list, and check boxes to widget handles. */
+  data->lb_avail_networks = glade_xml_get_widget (xml, "available_list");
+  data->check_encrypted_only = glade_xml_get_widget (xml, "check_encrypted_only");
+  data->check_preferred_only = glade_xml_get_widget (xml, "check_preferred_only");
+  data->props_btn = glade_xml_get_widget (xml, "pref_properties_btn");
+  data->add_to_pref_btn = glade_xml_get_widget (xml, "add_to_pref_btn");
+
+  data->connect_btn = glade_xml_get_widget (xml, "connect_btn");
+
+  /* Init the list store and bind it to the widget */
+  list_store = gtk_list_store_new (NUM_COLS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
+
+  /* List store is now bound to the model. */
+  gtk_tree_view_set_model ( GTK_TREE_VIEW (data->lb_avail_networks), GTK_TREE_MODEL(list_store) );
+
+  g_object_unref (list_store);
+
+  /* Pull the images */
+  data->empty_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 1, 1);
+  gdk_pixbuf_fill (data->empty_pixbuf,0);
+  
+  tmp_pixbuf = gdk_pixbuf_from_pixdata ( (const GdkPixdata *) &connected_pixdata, TRUE, NULL);
+  data->connected_pixbuf = gdk_pixbuf_scale_simple(tmp_pixbuf, 16, 16, GDK_INTERP_BILINEAR);
+  gdk_pixbuf_unref (tmp_pixbuf);
+  
+  /* setup the columns */
+  renderer = gtk_cell_renderer_pixbuf_new ();
+  column = gtk_tree_view_column_new_with_attributes ( _("On"), renderer, "pixbuf", COLUMN_IMG, NULL);
+  gtk_tree_view_column_set_sort_column_id (column, COLUMN_IMG);
+  gtk_tree_view_append_column ( GTK_TREE_VIEW(data->lb_avail_networks), column);
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes ( _("Net Name"), renderer, "text", COLUMN_APNAME, NULL);
+  gtk_tree_view_column_set_sort_column_id (column, COLUMN_APNAME);
+  gtk_tree_view_append_column ( GTK_TREE_VIEW(data->lb_avail_networks), column);
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes ( _("Signal"), renderer, "text", COLUMN_STRENGTH, NULL);
+  gtk_tree_view_column_set_sort_column_id (column, COLUMN_STRENGTH);
+  gtk_tree_view_append_column ( GTK_TREE_VIEW(data->lb_avail_networks), column);
+
+  /* Scan the initial network environment and load preferences */
+  netstatus_connprefs_load_all_prefs (data->dialog, data);
+  
+  /* Set insensative on the properties button */
+  gtk_widget_set_sensitive(data->props_btn, FALSE);
+  gtk_widget_set_sensitive(data->add_to_pref_btn, FALSE);
+  gtk_widget_set_sensitive(data->connect_btn, FALSE);
+
+  /* Setup the signal refresh timeout */
+  data->ap_list_monitor = g_timeout_add (5 * 1000, (GSourceFunc) netstatus_connprefs_refresh_callback, data);
+  netstatus_connprefs_populate_available (data->dialog, data);
+
+  g_object_unref (xml);
+
+  return data->dialog;
+}
+
+GtkWidget *netstatus_preferred_networks_new (NetstatusIface *iface)
+{
+  NetstatusPreferredNetworksData  *data;
+  GladeXML                        *xml;
+  GtkListStore                    *list_store;
+  GtkCellRenderer                 *renderer;
+  GtkTreeViewColumn               *column;
+
+  xml = glade_xml_new (NETSTATUS_GLADEDIR "/connection_prefs.glade", "preferred_networks", NULL);
+  if (!xml)
+    return NULL;
+
+  data = g_new0 (NetstatusPreferredNetworksData, 1);
+  if (data == NULL)
+    return NULL;
+
+  data->dialog = glade_xml_get_widget (xml, "preferred_networks");
+  if (data->dialog == NULL)
+    return NULL;
+
+  g_object_set_data (G_OBJECT (data->dialog), "netstatus-connprefs-data-pref-net", data);
+
+  data->iface = g_object_ref (iface);
+
+  /* Init gconf */
+  data->client = gconf_client_get_default ();
+
+  gconf_client_add_dir (data->client, NETWORK_CONFIG_WIRELESS_DIR, GCONF_CLIENT_PRELOAD_NONE, NULL);
+
+  /* Wire the help and minimize responses. */
+  g_signal_connect (data->dialog, "response", G_CALLBACK (netstatus_connprefs_response_pref_net), NULL);
+
+  g_signal_connect (data->dialog, "destroy", G_CALLBACK (netstatus_connprefs_destroy_pref_net), NULL);
+
+  /* Wire up the dialog specific portions here. */
+  g_signal_connect ( glade_xml_get_widget (xml, "up_btn"), "clicked", G_CALLBACK (netstatus_connprefs_pn_up_btn_clicked), data);
+
+  g_signal_connect ( glade_xml_get_widget (xml, "down_btn"), "clicked", G_CALLBACK (netstatus_connprefs_pn_down_btn_clicked), data);
+
+  g_signal_connect ( glade_xml_get_widget (xml, "remove_btn"), "clicked", G_CALLBACK (netstatus_connprefs_pn_remove_btn_clicked), data);
+
+  g_signal_connect ( glade_xml_get_widget (xml, "props_btn"), "clicked", G_CALLBACK (netstatus_connprefs_pn_props_btn_clicked), data);
+
+  g_signal_connect ( glade_xml_get_widget (xml, "auto_connect_cb"), "clicked", G_CALLBACK (netstatus_connprefs_pn_autocb_btn_clicked), data);
+
+  g_signal_connect ( glade_xml_get_widget (xml, "preferred_list"), "cursor_changed", G_CALLBACK (netstatus_connprefs_pn_list_changed), data);
+
+
+
+  /* Widget wireup to dialog control handles */
+  data->lb_preferred_networks = glade_xml_get_widget (xml, "preferred_list");
+  data->check_auto_connect = glade_xml_get_widget (xml, "auto_connect_cb");
+  data->up_btn = glade_xml_get_widget (xml, "up_btn");
+  data->down_btn = glade_xml_get_widget (xml, "down_btn");
+  data->remove_btn = glade_xml_get_widget (xml, "remove_btn");
+  data->props_btn = glade_xml_get_widget (xml, "props_btn");
+
+
+  /* Setup the list/tree view and data model.
+   * Init the list store and bind it to the widget
+   */
+  list_store = gtk_list_store_new ( 2, G_TYPE_STRING, G_TYPE_INT);  /* Name and preference order */
+
+  /* List store is now bound to the model. */
+  gtk_tree_view_set_model ( GTK_TREE_VIEW (data->lb_preferred_networks), GTK_TREE_MODEL(list_store) );
+
+  g_object_unref (list_store);
+
+  /* setup the columns */
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes ( _("Network Name"), renderer, "text", 0, NULL);
+  gtk_tree_view_column_set_sort_column_id (column, 0);
+  gtk_tree_view_append_column ( GTK_TREE_VIEW(data->lb_preferred_networks), column);
+
+  renderer = gtk_cell_renderer_text_new ();
+  column = gtk_tree_view_column_new_with_attributes ( _("Order"), renderer, "text", 1, NULL);
+  gtk_tree_view_column_set_sort_column_id (column, 1);
+  gtk_tree_view_append_column ( GTK_TREE_VIEW(data->lb_preferred_networks), column);
+
+  /* Set all buttons insensative until click */
+  gtk_widget_set_sensitive(data->up_btn, FALSE);
+  gtk_widget_set_sensitive(data->down_btn, FALSE);
+  gtk_widget_set_sensitive(data->props_btn, FALSE);
+  gtk_widget_set_sensitive(data->remove_btn, FALSE);
+
+  /* Populate the dialog with preferred networks from the gconf database */
+  netstatus_connprefs_pn_reload_networks(data);
+  netstatus_connprefs_pn_sort_networks(data);
+  netstatus_connprefs_pn_refresh_list(data);
+
+  /* Load the preference */
+  gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->check_auto_connect),
+                                 gconf_client_get_bool (data->client, NETWORK_CONFIG_WIRELESS_AUTO_CONNECT_KEY, NULL) );  
+
+  g_object_unref (xml);
+
+  return data->dialog;
+}
+
+GtkWidget *netstatus_network_props_new (NetstatusIface *iface, unsigned char *essid)
+{
+  NetstatusNetworkPropsData *data = NULL;
+  GladeXML                  *xml = NULL;
+  NetstatusNetworkData      *local_nnd = NULL;
+
+  xml = glade_xml_new (NETSTATUS_GLADEDIR "/connection_prefs.glade", "network_props", NULL);
+  if (!xml)
+    return NULL;
+
+  data = g_new0 (NetstatusNetworkPropsData, 1);
+  if (data == NULL)
+    return NULL;
+
+  data->dialog = glade_xml_get_widget (xml, "network_props");
+  if (data->dialog == NULL)
+    return NULL;
+
+  /* GConf wireup. */
+  data->client = gconf_client_get_default ();
+
+  g_object_set_data (G_OBJECT (data->dialog), "netstatus-connprefs-data-net-props", data);
+
+  data->iface = g_object_ref (iface);
+
+  /* Wire the help and minimize responses. */
+  g_signal_connect (data->dialog, "response",
+                    G_CALLBACK (netstatus_connprefs_response_net_props), NULL);
+
+  g_signal_connect (data->dialog, "destroy",
+                    G_CALLBACK (netstatus_connprefs_destroy_net_props), NULL);
+
+  /* Wire up the dialog specific portions here. */
+
+  /* Signal Wireup for buttons */
+  g_signal_connect ( glade_xml_get_widget (xml, "ok_btn"), "clicked", G_CALLBACK (netstatus_connprefs_props_ok_btn_clicked), data);
+  g_signal_connect ( glade_xml_get_widget (xml, "cancel_btn"), "clicked", G_CALLBACK (netstatus_connprefs_props_cancel_btn_clicked), data);
+
+  /* Widget associations. */
+  data->name_entry = glade_xml_get_widget (xml, "name_entry");
+  data->wep_cb  = glade_xml_get_widget (xml, "wep_cb");
+  data->authentication_cb  = glade_xml_get_widget (xml, "authentication_cb");
+  data->wep_key_entry  = glade_xml_get_widget (xml, "wep_key_entry");
+  data->key_format_combo  = glade_xml_get_widget (xml, "key_format_combo");
+  data->key_length_combo  = glade_xml_get_widget (xml, "key_length_combo");
+  data->key_index_spin  = glade_xml_get_widget (xml, "key_index_spin");
+  data->auto_key_cb  = glade_xml_get_widget (xml, "auto_key_cb");
+  data->adhoc_cb  = glade_xml_get_widget (xml, "adhoc_cb");
+  data->chanel_combo_box = glade_xml_get_widget (xml, "chanel_combo_box");
+
+  /* Wireup the change detection function for button greyout, etc. */
+  g_signal_connect ( data->wep_cb, "clicked", G_CALLBACK (netstatus_connprefs_props_changed), data);
+  g_signal_connect ( data->authentication_cb, "clicked", G_CALLBACK (netstatus_connprefs_props_changed), data);
+  g_signal_connect ( data->auto_key_cb, "clicked", G_CALLBACK (netstatus_connprefs_props_changed), data);
+
+  /* Pull the data from the network repository and assign it to the widgets. */
+  if (essid != NULL)
+    local_nnd = load_network_object(data->client, essid);
+
+  /* check for validity.  If not, present an empty box for the user to fill in. */
+  if (local_nnd == NULL)
+  {
+    /* Set widget states for an empty dialog
+     * Default state is a non-wep network.
+     */
+    gtk_widget_set_sensitive(data->wep_key_entry, FALSE);
+    gtk_widget_set_sensitive(data->key_format_combo, FALSE);
+    gtk_widget_set_sensitive(data->key_length_combo, FALSE);
+    gtk_widget_set_sensitive(data->key_index_spin, FALSE);
+    gtk_widget_set_sensitive(data->auto_key_cb, FALSE);
+    gtk_entry_set_text ( GTK_ENTRY(data->name_entry), "");
+    gtk_entry_set_text ( GTK_ENTRY(data->wep_key_entry), "");
+    gtk_combo_box_set_active (  GTK_COMBO_BOX (data->key_format_combo), 1); /* Hex Digits */
+    gtk_combo_box_set_active (  GTK_COMBO_BOX (data->key_length_combo), 1); /* 128 bit */
+    gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->wep_cb), FALSE);
+    gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->auto_key_cb), FALSE);
+    gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->authentication_cb), FALSE);
+    gtk_combo_box_set_active ( GTK_COMBO_BOX (data->chanel_combo_box), 0); /* default to automatic frequency selection */
+
+    local_nnd = g_malloc0 (sizeof(NetstatusNetworkData));
+    if (local_nnd == NULL)
+    {
+      g_object_unref(xml);
+      netstatus_connprefs_destroy_net_props (data->dialog);
+      return NULL;
+    }
+    data->nnd_store = local_nnd;
+    g_object_unref(xml);
+    return data->dialog;
+  }
+  else  /* we've got a network data structure.  Fill in the dialog widgets */
+  {
+    int isHex = TRUE;
+
+    /* Trap empty ESSIDs (Some wireless networks DO have no ESSID) */
+    if (local_nnd->essid != NULL)
+      gtk_entry_set_text ( GTK_ENTRY(data->name_entry), local_nnd->essid);
+    else
+      gtk_entry_set_text ( GTK_ENTRY(data->name_entry), "");
+
+    /* Set some bogus text in the widget space */
+    gtk_entry_set_text ( GTK_ENTRY(data->wep_key_entry), "");
+
+    /* Check first char of encoding token: */
+    if (local_nnd->encryption_key[0] == 'p' || local_nnd->encryption_key[0] == 'P' ||
+        local_nnd->encryption_key[0] == 's' || local_nnd->encryption_key[0] == 'S')
+    {
+      /* String token */
+      gtk_combo_box_set_active (  GTK_COMBO_BOX (data->key_format_combo), 2);
+    }
+    else
+    {
+      int idx = 0;
+
+      /* Check for hex. */
+      for (idx = 0; idx < strlen(local_nnd->encryption_key); idx++)
+        if (!isxdigit(local_nnd->encryption_key[idx]))
+        {
+          isHex = FALSE;
+        }
+
+      if (isHex == TRUE)
+        gtk_combo_box_set_active (  GTK_COMBO_BOX (data->key_format_combo), 1);
+      else
+        gtk_combo_box_set_active (  GTK_COMBO_BOX (data->key_format_combo), 0); /* defualt to as is */
+    }
+
+    switch (local_nnd->encryption_present)
+    {
+    case NSW_ENCRYPTION_40_BIT:
+      gtk_combo_box_set_active (  GTK_COMBO_BOX (data->key_length_combo), 0); /* 40 bit */
+      break;
+
+    case NSW_ENCRYPTION_128_BIT:
+      gtk_combo_box_set_active (  GTK_COMBO_BOX (data->key_length_combo), 1); /* 128 bit */
+      break;
+
+    case NSW_ENCRYPTION_256_BIT:
+      gtk_combo_box_set_active (  GTK_COMBO_BOX (data->key_length_combo), 2); /* 256 bit */
+
+    default:
+      gtk_combo_box_set_active (  GTK_COMBO_BOX (data->key_length_combo), 1); /* default to 128 */
+      break;
+
+    }
+
+
+    if (local_nnd->encryption_present != NSW_ENCRYPTION_NONE)
+      gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->wep_cb), TRUE);
+    else
+      gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->wep_cb), FALSE);
+
+    if (local_nnd->shared_auth_network == TRUE)
+      gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->auto_key_cb), TRUE);
+    else
+      gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->auto_key_cb), FALSE);
+
+    /* Call the widget sensativity setup method. */
+    netstatus_connprefs_props_changed (data->dialog, data);
+
+    /* Auto Keyed Network Property */
+    if (local_nnd->shared_auth_network)
+    {
+      gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->authentication_cb), TRUE);
+    }
+    else
+    {
+      gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->authentication_cb), FALSE);
+    }
+
+    if (local_nnd->autokeyed_network)
+    {
+      gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->auto_key_cb), TRUE);
+    }
+    else
+    {
+      gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->auto_key_cb), FALSE);
+    }
+
+    if ( strncmp(local_nnd->mode, "adhoc", IW_MODE_STR_MAX + 1) == 0)
+    {
+      gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->adhoc_cb), TRUE);
+    }
+    else
+    {
+      gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->adhoc_cb), FALSE);
+    }
+
+    gtk_spin_button_set_value ( GTK_SPIN_BUTTON(data->key_index_spin), local_nnd->key_number);
+  }
+  if (local_nnd->frequency > 0 && local_nnd->frequency <= 14)
+    gtk_combo_box_set_active ( GTK_COMBO_BOX (data->chanel_combo_box), local_nnd->frequency);
+  else
+    gtk_combo_box_set_active ( GTK_COMBO_BOX (data->chanel_combo_box), 0);
+
+  g_object_unref (xml);
+
+  /* If we didn't have a local structure, allocate one for the dialog holding area */
+  if (local_nnd == NULL)
+    data->nnd_store = g_malloc0 (sizeof(NetstatusNetworkData));
+  else
+    data->nnd_store = local_nnd;
+
+  return data->dialog;
+}
+
+
+
+/* Individual methods for handling button presses, etc. */
+static void netstatus_connprefs_connect (GtkWidget *dialog, NetstatusConnectionPrefsData *data)
+{
+  GtkTreeSelection      *tree_sel = NULL;
+  GtkTreeModel          *liststore;
+  GtkTreeIter            iter;
+  NetstatusNetworkData  *local_nnd = NULL;
+  AP_type               *model_ap = NULL;
+  unsigned char          new_wep_key[(IW_ENCODING_TOKEN_MAX*2)+1];
+  unsigned char         *wep_key = NULL;
+  unsigned char         *iface_name = NULL;
+  gboolean               item_selected = 0;
+
+  /* Clear iter */
+  memset (&iter, 0, sizeof(iter));
+
+  /* Get the list item */
+  tree_sel = gtk_tree_view_get_selection  ( GTK_TREE_VIEW (data->lb_avail_networks) );
+  if (tree_sel == NULL)
+    return;
+
+  g_object_ref(tree_sel);
+
+  item_selected = gtk_tree_selection_get_selected (GTK_TREE_SELECTION(tree_sel), &liststore, &iter);
+
+  if (liststore == NULL || item_selected == FALSE)
+    return;
+
+  g_object_ref (liststore);
+
+  /* Pull the reference to the AP Data. */
+  gtk_tree_model_get ( liststore, &iter, COLUMN_AP_POINTER, &model_ap, -1);
+
+  if (model_ap == NULL)
+  {
+    g_object_unref(liststore);
+    g_object_unref(tree_sel);
+    return;
+  }
+
+  /* Pull the network from the repository (inserted upon AP scan, so it has to be here. */
+  local_nnd =  load_network_object(data->client, model_ap->essid);
+
+  /* Unreference the GUI pieces now, we've got what we need. */
+  g_object_unref(liststore);
+  g_object_unref(tree_sel);
+
+  if (local_nnd == NULL)
+  {
+    /* Failure of some kind. */
+    return;
+  }
+
+  /* Check for user wep.  (If net is encrypted, user has not enetered key, and networks is not autokeyed. */
+  if (local_nnd->encryption_present != IW_ENCRYPTION_NONE && !local_nnd->user_entered_key && !local_nnd->autokeyed_network)
+  {
+    /* clear this in case we need it. */
+    memset( new_wep_key, 0, (IW_ENCODING_TOKEN_MAX*2)+1);
+
+    if (wep_key == NULL)
+    {
+      GtkWidget  *wep_dialog = NULL;
+      GtkWidget  *label = NULL, *entry_label = NULL, *passwd_entry = NULL, *hbox = NULL, *vbox = NULL;
+      gint result;
+
+      wep_dialog = gtk_dialog_new_with_buttons ( _("WEP Password Entry"),
+                   GTK_WINDOW(data->dialog),
+                   GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+                   GTK_STOCK_OK,
+                   GTK_RESPONSE_ACCEPT,
+                   GTK_STOCK_CANCEL,
+                   GTK_RESPONSE_REJECT,
+                   NULL
+                                               );
+
+      label = gtk_label_new( _("You are attempting to connect to a\nsecure wireless network.  Enter the\nencryption key (WEP) to continue.") );
+      entry_label = gtk_label_new( _("Encryption key:") );
+      passwd_entry = gtk_entry_new();
+      gtk_entry_set_invisible_char( GTK_ENTRY(passwd_entry), '*');
+      vbox = gtk_vbox_new(FALSE, 0);
+      hbox = gtk_hbox_new(FALSE, 0);
+
+      gtk_box_pack_start_defaults( GTK_BOX(hbox), GTK_WIDGET(entry_label) );
+      gtk_box_pack_start_defaults( GTK_BOX(hbox), GTK_WIDGET(passwd_entry) );
+      gtk_box_pack_start_defaults( GTK_BOX(vbox), GTK_WIDGET(label) );
+      gtk_box_pack_start_defaults( GTK_BOX(vbox), GTK_WIDGET(hbox) );
+      gtk_box_pack_start( GTK_BOX(GTK_DIALOG(wep_dialog)->vbox), GTK_WIDGET(vbox), FALSE, FALSE, 0);
+      gtk_widget_show_all(GTK_WIDGET(GTK_DIALOG(wep_dialog)));
+
+      result = gtk_dialog_run (GTK_DIALOG (wep_dialog));
+      switch (result)
+      {
+      case GTK_RESPONSE_ACCEPT:
+        strncpy (new_wep_key, gtk_entry_get_text( GTK_ENTRY(passwd_entry) ), IW_ENCODING_TOKEN_MAX*2);
+        break;
+      default:
+        break;
+      }
+      gtk_widget_destroy (wep_dialog);
+
+      if (new_wep_key[0] != '\0')
+      {
+        /* save back to repository */
+        strncpy(local_nnd->encryption_key, new_wep_key, IW_ENCODING_TOKEN_MAX*2);
+        local_nnd->user_entered_key = TRUE;
+        save_network_object(data->client, local_nnd->essid, local_nnd);
+
+      }
+      else
+        return;
+    }
+  }
+
+  iface_name = (unsigned char *) netstatus_iface_get_name(data->iface);
+
+  set_essid(iface_name, local_nnd->essid);
+  /* This should be managed/ad-hoc for now
+   * Wiredness here.  iwlib returns Master mode, but cards will not work
+   * with anything but managed...
+   */
+  set_mode(iface_name, local_nnd->mode);
+  set_frequency(iface_name, local_nnd->frequency);
+  if (local_nnd->encryption_present != IW_ENCRYPTION_NONE && local_nnd->encryption_key[0] != '\0')
+  {
+    set_encryption(iface_name, local_nnd->encryption_key, local_nnd->key_number);
+  }
+
+  /* Commit.  Even if the driver doesn't support it, nothing bad will happen. */
+  wapi_commit(iface_name);
+  
+  char *name_buffer = NULL;
+  struct stat dummy_stats;
+  unsigned int i = 0;
+  
+  /* Commit is Ok, now bring up the interface (if it's not already up) */
+  netstatus_iface_set_flag((unsigned char *) netstatus_iface_get_name (data->iface), (IFF_UP | IFF_RUNNING));
+  
+  /* Search the list of propable names */
+  while (interface_up_commands[i].probe_file_name != NULL)
+  {
+    /* See if we have to do str replacement */
+    if ( index(interface_up_commands[i].probe_file_name, '%') )
+    {
+      name_buffer = g_strdup_printf(interface_up_commands[i].probe_file_name, iface_name);
+    }
+    else
+    {
+      name_buffer = g_strdup_printf(interface_up_commands[i].probe_file_name);
+    }
+    
+    /* Check for the config file presence */
+    if (stat(name_buffer, &dummy_stats) == 0)
+    {
+      g_free(name_buffer);
+      /* Success, we have the config file.  So, now execute the configuration command. */
+      if ( index(interface_up_commands[i].command, '%') )
+      {
+        name_buffer = g_strdup_printf(interface_up_commands[i].command, iface_name);
+      }
+      else
+      {
+        name_buffer = g_strdup_printf(interface_up_commands[i].command);
+      }
+      
+      /* Pop a dialog to let the user know that we're working on OS level interface configuration. */
+      dialog = gtk_message_dialog_new ( NULL,
+                                      GTK_DIALOG_DESTROY_WITH_PARENT,
+                                      GTK_MESSAGE_INFO,
+                                      GTK_BUTTONS_NONE,
+                                      _("Now trying to connect to network: '%s'?"),
+                                      local_nnd->essid);
+                                      
+      /* Nonmodal, run a iteration to draw the window then do our business. */
+      gtk_widget_show_all(dialog);
+      gtk_main_iteration_do(FALSE);
+      
+      /* Execute the expanded command */
+      system(name_buffer);
+      g_free(name_buffer);
+      
+      /* We made it.  Get rid of the dialog */
+      gtk_widget_destroy (dialog);
+      
+      break;  /* Break the while */
+    }
+    g_free(name_buffer);
+    i++;
+  }
+
+  /* Error will be obvious in icon on pannel, so no dialog. */
+  
+}
+
+static void netstatus_connprefs_refresh (GtkWidget *dialog, NetstatusConnectionPrefsData *data)
+{
+  GtkListStore *liststore;
+  GtkTreeIter iter;
+  int i, net_count = 0;
+  NetstatusNetworkData *preferred_nnds = NULL, *iter_nnd = NULL;
+  gchar *active_essid;
+  
+  active_essid = get_essid( (unsigned char *) netstatus_iface_get_name (data->iface));
+
+  memset( &iter, 0, sizeof(GtkTreeIter));
+
+  /* Check for existing data in tha ap cache */
+  if (data->ap_array != NULL)
+  {
+    int i;
+
+    for (i = 0; (i < 256) && data->ap_array[i] != NULL; i++)
+      free(data->ap_array[i]);
+    free (data->ap_array);
+    data->ap_array = NULL;
+  }
+
+
+  /* Bring the interface online. */
+  netstatus_iface_set_flag((unsigned char *) netstatus_iface_get_name (data->iface), (IFF_UP | IFF_RUNNING));
+
+  /* Grab all available networks from the scanning function */
+  data->ap_array = get_ap_list ( (unsigned char *) netstatus_iface_get_name (data->iface) );
+
+
+  /* If we have preferred only, pull the list. (We check for null at list iteration time.) */
+  if ( data->pref_only )
+    preferred_nnds = get_all_preferred_network_objects (data->client, &net_count);
+
+  /* Unbind the model and view, update the model, then reattach to the view. */
+  liststore = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (data->lb_avail_networks) ) );
+
+  g_object_ref (liststore);
+
+  gtk_tree_view_set_model ( GTK_TREE_VIEW (data->lb_avail_networks), NULL);
+
+  /* Clear the existing data from the tree and dump the data from the
+   * ap_array to the tree.
+   */
+  i = 0;
+  gtk_list_store_clear (liststore);
+
+  if (data->ap_array == NULL)
+  {
+    gtk_list_store_append ( liststore, &iter);
+    gtk_list_store_set ( liststore, &iter, COLUMN_IMG, data->empty_pixbuf, COLUMN_APNAME, _("No Access Points!"), COLUMN_STRENGTH, _("!"), COLUMN_AP_POINTER, NULL, -1);
+  }
+  else
+    while (data->ap_array[i] != NULL)
+    {
+      char tmpBuffer[10];
+      int j, match;
+
+      /* Non-Destructivly save the network information (only if it's not already there.) */
+      safe_save_network_object(data->ap_array[i], data->client);
+
+      /* Exclusive check.  Preferred is the first filter.*/
+
+      /* Iterate over list of preferred nets and see if we match */
+      match = 0;
+      iter_nnd = preferred_nnds;
+      for (j = 0; j < net_count; j++)
+      {
+
+        if ( !strncmp(data->ap_array[i]->essid, iter_nnd->essid, IW_ESSID_MAX_SIZE) )
+        {
+          match = 1;
+          break;
+        }
+        iter_nnd++;
+      }
+
+      if (data->pref_only && match == 0)
+      {
+        i++;
+        continue;
+      }
+
+      /* Now check for Encrypted only. */
+      if (data->enc_only && data->ap_array[i]->encryption_present == IW_ENCRYPTION_NONE)
+      {
+        i++;
+        continue;
+      }
+
+      gtk_list_store_append ( liststore, &iter);
+      g_snprintf (tmpBuffer, 9, "%d%%", data->ap_array[i]->signal_strength);
+      if (strncmp( active_essid, data->ap_array[i]->essid, IW_ESSID_MAX_SIZE) == 0 )
+        gtk_list_store_set ( liststore, &iter, COLUMN_IMG, data->connected_pixbuf, COLUMN_APNAME, data->ap_array[i]->essid, COLUMN_STRENGTH, tmpBuffer, COLUMN_AP_POINTER, data->ap_array[i], -1);
+      else
+        gtk_list_store_set ( liststore, &iter, COLUMN_IMG, data->empty_pixbuf, COLUMN_APNAME, data->ap_array[i]->essid, COLUMN_STRENGTH, tmpBuffer, COLUMN_AP_POINTER, data->ap_array[i], -1);
+      i++;
+    }
+
+  gtk_tree_view_set_model ( GTK_TREE_VIEW (data->lb_avail_networks), GTK_TREE_MODEL(liststore));
+
+  g_free (preferred_nnds);
+
+  if (active_essid) free(active_essid);
+
+  g_object_unref (liststore);
+}
+
+static void netstatus_connprefs_open_properties (GtkWidget *dialog, NetstatusConnectionPrefsData *data)
+{
+  GtkTreeSelection      *tree_sel = NULL;
+  GtkTreeModel          *liststore;
+  GtkTreeIter            iter;
+  AP_type               *model_ap = NULL;
+  unsigned char         local_essid[IW_ESSID_MAX_SIZE+1];
+  gboolean               item_selected = 0;
+
+
+  /* Clear iter */
+  memset (&iter, 0, sizeof(iter));
+
+  /* Get the list item */
+  tree_sel = gtk_tree_view_get_selection  ( GTK_TREE_VIEW (data->lb_avail_networks) );
+  if (tree_sel == NULL)
+    return;
+
+  g_object_ref(tree_sel);
+
+  item_selected = gtk_tree_selection_get_selected (tree_sel, &liststore, &iter);
+
+  if (liststore == NULL || item_selected == FALSE)
+    return;
+
+  g_object_ref (liststore);
+
+  /* pull all data from the selected network. */
+
+  /* Pull the reference to the AP Data. */
+  gtk_tree_model_get ( liststore, &iter, COLUMN_AP_POINTER, &model_ap, -1);
+
+  if (model_ap == NULL)
+  {
+    g_object_unref(liststore);
+    g_object_unref(tree_sel);
+    return;
+  }
+
+  /* Unreference the GUI pieces now, we've got what we need. */
+  g_object_unref(liststore);
+  g_object_unref(tree_sel);
+
+  /* Copy the essid name */
+  strncpy( local_essid, model_ap->essid, IW_ESSID_MAX_SIZE+1);
+
+  /* Check for successful copy. */
+  if (local_essid[0] == '\0')
+  {
+    return;
+  }
+
+  /* Display the new dialog. */
+  netstatus_network_props_new (data->iface, local_essid);
+}
+
+static void netstatus_connprefs_new_net (GtkWidget *dialog, NetstatusConnectionPrefsData *data)
+{
+  /* pop the new net dialog (empty network properties dlg) */
+  netstatus_network_props_new (data->iface, NULL);
+
+
+  /* Save the applet prefs */
+  netstatus_connprefs_save_all_prefs (data->dialog, data);
+}
+
+static void netstatus_connprefs_add_to_pref (GtkWidget *dialog, NetstatusConnectionPrefsData *data)
+{
+  GtkTreeSelection      *tree_sel = NULL;
+  GtkTreeModel          *liststore;
+  GtkTreeIter            iter;
+  AP_type               *local_ap = NULL, *model_ap = NULL;
+  NetstatusNetworkData  *local_nnd = NULL;
+  NetstatusNetworkData  *count_nnd = NULL;
+  guint                  preferred_count = 0;
+  gboolean               item_selected = 0;
+
+
+  /* Clear iter */
+  memset (&iter, 0, sizeof(iter));
+
+  /* Get the list item */
+  tree_sel = gtk_tree_view_get_selection  ( GTK_TREE_VIEW (data->lb_avail_networks) );
+  if (tree_sel == NULL)
+    return;
+
+  g_object_ref(tree_sel);
+
+  item_selected = gtk_tree_selection_get_selected (tree_sel, &liststore, &iter);
+
+  if (liststore == NULL || item_selected == FALSE)
+    return;
+
+  g_object_ref (liststore);
+
+  /* pull all data from the selected network. */
+  local_ap = g_malloc0 (sizeof(AP_type));
+
+  /* If we don't have enough memory to copy the structure, fail misserably.  (The rest of the
+   * desktop is probably doing so already if we hit this point.)
+   */
+  if (local_ap == NULL)
+  {
+    g_object_unref(liststore);
+    g_object_unref(tree_sel);
+    return;
+  }
+
+  /* Pull the reference to the AP Data. */
+  gtk_tree_model_get ( liststore, &iter, COLUMN_AP_POINTER, &model_ap, -1);
+
+  if (model_ap == NULL)
+  {
+    g_object_unref(liststore);
+    g_object_unref(tree_sel);
+    g_free (local_ap);
+    return;
+  }
+
+  /* Unreference the GUI pieces now, we've got what we need. */
+  g_object_unref(liststore);
+  g_object_unref(tree_sel);
+
+  memcpy(local_ap, model_ap, sizeof(AP_type));
+
+  /* Check for successful copy. */
+  if (local_ap->essid[0] == '\0')
+  {
+    g_free (local_ap);
+    return;
+  }
+
+  /* Allocate a NetstatusNetworkData strucutre */
+  local_nnd = g_malloc0 (sizeof(NetstatusNetworkData));
+
+  if (local_nnd == NULL)
+  {
+    g_free (local_ap);
+    return;
+  }
+
+  translate_ap_to_nnd(local_ap, local_nnd);
+
+  /* Set preferred status */
+  local_nnd->preferred_network = TRUE;
+
+  /* This should call and get the tail number + 1 of the preferred max network */
+  count_nnd = get_all_preferred_network_objects (data->client, &preferred_count);
+  local_nnd->preferred_order = preferred_count+1;
+
+  /* free the counting array. */
+  g_free (count_nnd);
+
+  /* Store the network in the repository */
+  save_network_object(data->client, local_nnd->essid, local_nnd);
+
+  g_free (local_ap);
+
+  /* Save the applet prefs */
+  netstatus_connprefs_save_all_prefs (data->dialog, data);
+
+}
+
+static void netstatus_connprefs_open_prefered_networks (GtkWidget *dialog, NetstatusConnectionPrefsData *data)
+{
+  if (data == NULL)
+    return;
+
+
+  /* Save the applet state */
+  netstatus_connprefs_save_all_prefs (dialog, data);
+
+  /* Display the new dialog. */
+  netstatus_preferred_networks_new (data->iface);
+}
+
+static void netstatus_connprefs_enc_only_clicked (GtkWidget *dialog, NetstatusConnectionPrefsData *data)
+{
+  /* Refresh the list with new restrictions */
+  data->enc_only = !data->enc_only;
+  netstatus_connprefs_populate_available (data->dialog, data);
+  netstatus_connprefs_save_all_prefs (data->dialog, data);
+}
+
+static void netstatus_connprefs_pref_only_clicked (GtkWidget *dialog, NetstatusConnectionPrefsData *data)
+{
+  /* Refresh the list with new restrictions */
+  data->pref_only = !data->pref_only;
+  netstatus_connprefs_populate_available (data->dialog, data);
+  netstatus_connprefs_save_all_prefs (dialog, data);
+}
+
+GSourceFunc
+netstatus_connprefs_refresh_callback(NetstatusConnectionPrefsData *data)
+{
+  /* This should be fixed.  Eventially this should reselect the previous network entry if it is still in range. */
+  netstatus_connprefs_refresh (data->dialog, data);
+  gtk_widget_set_sensitive(data->props_btn, FALSE);
+  gtk_widget_set_sensitive(data->add_to_pref_btn, FALSE);
+  gtk_widget_set_sensitive(data->connect_btn, FALSE);
+  return NULL;
+}
+
+static void netstatus_connprefs_populate_available (GtkWidget *dialog, NetstatusConnectionPrefsData *data)
+{
+  netstatus_connprefs_refresh (data->dialog, data);
+}
+
+/* Load and save methods for gconfd informaiton. */
+static void netstatus_connprefs_save_all_prefs (GtkWidget *dialog, NetstatusConnectionPrefsData *data)
+{
+  const char *iface_name;
+  char *key;
+
+  if (data->client != NULL)
+  {
+
+    /* Construct our interface name. */
+    iface_name = netstatus_iface_get_name (data->iface);
+
+    /* This is for the status stripts really. */
+    gconf_client_set_string (data->client, NETWORK_CONFIG_WIRELESS_MASTER_KEY, "MasterKeyPresent", NULL);
+
+    /* Store the encrypted networks only mode key
+     * Construct the Key Path: Encrypted Only.
+     */
+    key = g_strdup_printf("%s/%s%s", NETWORK_CONFIG_WIRELESS_DIR, iface_name, NETWORK_CONFIG_WIRELESS_ENC_KEY);
+    gconf_client_set_bool (data->client, key, data->enc_only, NULL);
+    g_free(key);
+
+    /* Store the preferred networks only flag */
+    key = g_strdup_printf("%s/%s%s", NETWORK_CONFIG_WIRELESS_DIR, iface_name, NETWORK_CONFIG_WIRELESS_PREF_KEY);
+    gconf_client_set_bool (data->client, key, data->pref_only, NULL);
+    g_free(key);
+  }
+}
+
+static void netstatus_connprefs_load_all_prefs (GtkWidget *dialog, NetstatusConnectionPrefsData *data)
+{
+  char *tmp_str, *iface_name, *key;
+
+  if (data->client != NULL)
+  {
+
+    /* Construct our interface name. */
+    iface_name = (unsigned char *) netstatus_iface_get_name (data->iface);
+
+    /* Have we been configured before?  This is for the status stripts really. */
+    tmp_str = gconf_client_get_string (data->client, NETWORK_CONFIG_WIRELESS_MASTER_KEY, NULL);
+
+    /* Pull the restricted mode flag (this effects the behavior of the ap listing and auto accept modes) */
+    data->adm_restricted = gconf_client_get_bool (data->client, NETWORK_CONFIG_WIRELESS_RESTRICTED_KEY, NULL);
+
+    /* Pull the encrypted networks only mode key
+     * Construct the Key Path: Encrypted Only.
+     */
+    key = g_strdup_printf("%s/%s%s", NETWORK_CONFIG_WIRELESS_DIR, iface_name, NETWORK_CONFIG_WIRELESS_ENC_KEY);
+    data->enc_only = gconf_client_get_bool (data->client, key, NULL);
+    g_free(key);
+    gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->check_encrypted_only), data->enc_only);
+
+    /* Pull the preferred networks only flag */
+    key = g_strdup_printf("%s/%s%s", NETWORK_CONFIG_WIRELESS_DIR, iface_name, NETWORK_CONFIG_WIRELESS_PREF_KEY);
+    data->pref_only = gconf_client_get_bool (data->client, key, NULL);
+    g_free(key);
+    gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(data->check_preferred_only), data->pref_only);
+  }
+}
+
+
+/* Check to see if something is selected, if so, enable properties button, if not, disable */
+static void
+netstatus_connprefs_pref_changed (GtkWidget *dialog, NetstatusConnectionPrefsData *data)
+{
+  GtkTreeSelection      *tree_sel = NULL;
+
+  /* Get the list item */
+  tree_sel = gtk_tree_view_get_selection  ( GTK_TREE_VIEW (data->lb_avail_networks) );
+
+  if (tree_sel != NULL)
+  {
+    /* Something is selected */
+    gtk_widget_set_sensitive(data->props_btn, TRUE);
+    gtk_widget_set_sensitive(data->add_to_pref_btn, TRUE);
+    gtk_widget_set_sensitive(data->connect_btn, TRUE);
+  }
+  else
+  {
+    /* Nothing selected */
+    gtk_widget_set_sensitive(data->props_btn, FALSE);
+    gtk_widget_set_sensitive(data->add_to_pref_btn, FALSE);
+    gtk_widget_set_sensitive(data->connect_btn, FALSE);
+  }
+}
+
+/* DEMARKATION POINT for Prefered Networks Dialog Functions */
+static void
+netstatus_connprefs_pn_up_btn_clicked (GtkWidget *widg, NetstatusPreferredNetworksData *data)
+{
+  /* Move the network up in preference order. */
+
+  /* pull the selected order */
+  GtkTreeSelection      *tree_sel = NULL;
+  GtkTreeModel          *liststore;
+  GtkTreeIter            iter;
+  unsigned char         *local_essid;
+  guint                  i, pivot = 0;
+  gboolean               item_selected = 0;
+
+  /* Clear iter */
+  memset (&iter, 0, sizeof(iter));
+
+  /* Get the list item */
+  tree_sel = gtk_tree_view_get_selection  ( GTK_TREE_VIEW (data->lb_preferred_networks) );
+  if (tree_sel == NULL)
+    return;
+
+  g_object_ref(tree_sel);
+
+  item_selected = gtk_tree_selection_get_selected (tree_sel, &liststore, &iter);
+
+  if (liststore == NULL || item_selected == FALSE)
+    return;
+
+  g_object_ref (liststore);
+
+  /* pull all data from the selected network. */
+  local_essid = NULL;
+
+  /* Pull the reference to the essid */
+  gtk_tree_model_get (liststore, &iter, 0, &local_essid, -1);
+
+  /* Unreference the GUI pieces now, we've got what we need. */
+  g_object_unref(liststore);
+  g_object_unref(tree_sel);
+
+  /* Check for successful copy. */
+  if (local_essid == NULL)
+  {
+    /* Error */
+    return;
+  }
+
+  /* if the order is 1, do nothing */
+  for (i = 0; i < data->net_count; i++)
+  {
+    if (!strncmp( local_essid, data->preferred_networks[i].essid, IW_ESSID_MAX_SIZE) )
+    {
+      /* this is the one we're moving.
+       * if it's order is 1, do nothing.
+       */
+      if (data->preferred_networks[i].order == 1)
+        return;
+      else /* set the value as our pivot. */
+      {
+        pivot = data->preferred_networks[i].order-1;
+        break;
+      }
+    }
+  }
+
+  /* if the order is 1, do nothing */
+  for (i = 0; i < data->net_count; i++)
+  {
+    if (!strncmp( local_essid, data->preferred_networks[i].essid, IW_ESSID_MAX_SIZE) )
+    {
+      /* decriment it's order (move up) */
+      data->preferred_networks[i].order--;
+    }
+    else
+    {
+      /* if this is the one above, move it down */
+      if (data->preferred_networks[i].order == pivot)
+        data->preferred_networks[i].order++;
+    }
+  }
+
+  /* save the re-ordered networks */
+  netstatus_connprefs_pn_store_networks(data);
+
+  /* reload and refresh */
+  netstatus_connprefs_pn_reload_networks(data);
+  netstatus_connprefs_pn_sort_networks(data);
+  netstatus_connprefs_pn_refresh_list(data);
+}
+
+static void
+netstatus_connprefs_pn_down_btn_clicked (GtkWidget *widg, NetstatusPreferredNetworksData *data)
+{
+
+  /* pull the selected order */
+  GtkTreeSelection      *tree_sel = NULL;
+  GtkTreeModel          *liststore;
+  GtkTreeIter            iter;
+  unsigned char         *local_essid;
+  guint                  i, pivot = 0;
+  gboolean               item_selected = 0;
+
+
+  /* Clear iter */
+  memset (&iter, 0, sizeof(iter));
+
+  /* Get the list item */
+  tree_sel = gtk_tree_view_get_selection  ( GTK_TREE_VIEW (data->lb_preferred_networks) );
+  if (tree_sel == NULL)
+    return;
+
+  g_object_ref(tree_sel);
+
+  item_selected = gtk_tree_selection_get_selected (tree_sel, &liststore, &iter);
+
+  if (liststore == NULL || item_selected == FALSE)
+    return;
+
+  g_object_ref (liststore);
+
+  /* pull all data from the selected network. */
+  local_essid = NULL;
+
+  /* Pull the reference to the essid */
+  gtk_tree_model_get (liststore, &iter, 0, &local_essid, -1);
+
+  /* Unreference the GUI pieces now, we've got what we need. */
+  g_object_unref(liststore);
+  g_object_unref(tree_sel);
+
+  /* Check for successful copy. */
+  if (local_essid == NULL)
+  {
+    /* Error. */
+    return;
+  }
+
+  /* if the order is max, do nothing */
+  for (i = 0; i < data->net_count; i++)
+  {
+    if (!strncmp( local_essid, data->preferred_networks[i].essid, IW_ESSID_MAX_SIZE) )
+    {
+      /* this is the one we're moving. */
+      /* if it's order is max, do nothing. */
+      if (data->preferred_networks[i].order == data->net_count)
+        return;
+      else /* set the value as our pivot. */
+      {
+        pivot = data->preferred_networks[i].order+1;
+        break;
+      }
+    }
+  }
+
+  for (i = 0; i < data->net_count; i++)
+  {
+    if (!strncmp( local_essid, data->preferred_networks[i].essid, IW_ESSID_MAX_SIZE) )
+    {
+      /* incriment it's order (move down) */
+      data->preferred_networks[i].order++;
+    }
+    else
+    {
+      /* not the one we are moving down, move up instead */
+      if (data->preferred_networks[i].order == pivot)
+        data->preferred_networks[i].order--;
+    }
+  }
+
+  /* save the re-ordered networks */
+  netstatus_connprefs_pn_store_networks(data);
+
+  /* reload and refresh */
+  netstatus_connprefs_pn_reload_networks(data);
+  netstatus_connprefs_pn_sort_networks(data);
+  netstatus_connprefs_pn_refresh_list(data);
+}
+
+static void
+netstatus_connprefs_pn_remove_btn_clicked (GtkWidget *widg, NetstatusPreferredNetworksData *data)
+{
+  /* Pull the network from the preferred list
+   * Simpley remove it's preferred bit and write it back
+   * Pull the selection from the tree and set it's preferred bit to false
+   */
+  GtkTreeSelection      *tree_sel = NULL;
+  GtkTreeModel          *liststore;
+  GtkTreeIter            iter;
+  unsigned char         *local_essid;
+  gchar                  *nw_path = NULL, *key = NULL;
+  GtkWidget             *dialog;
+  gboolean               item_selected = 0;
+
+  /* Clear iter */
+  memset (&iter, 0, sizeof(iter));
+
+  /* Get the list item */
+  tree_sel = gtk_tree_view_get_selection  ( GTK_TREE_VIEW (data->lb_preferred_networks) );
+  if (tree_sel == NULL)
+    return;
+
+  g_object_ref(tree_sel);
+
+  item_selected = gtk_tree_selection_get_selected (tree_sel, &liststore, &iter);
+
+  if (liststore == NULL || item_selected == FALSE)
+    return;
+
+  g_object_ref (liststore);
+
+  /* pull all data from the selected network. */
+  local_essid = NULL;
+
+  /* Pull the reference to the essid */
+  gtk_tree_model_get (liststore, &iter, 0, &local_essid, -1);
+
+  /* Unreference the GUI pieces now, we've got what we need. */
+  g_object_unref(liststore);
+  g_object_unref(tree_sel);
+
+  /* Check for successful copy. */
+  if (local_essid == NULL)
+  {
+    /* Error */
+    return;
+  }
+
+  /* Verify that the user REALLY wants to do this. */
+  dialog = gtk_message_dialog_new ( GTK_WINDOW(data->dialog),
+                                  GTK_DIALOG_DESTROY_WITH_PARENT,
+                                  GTK_MESSAGE_QUESTION,
+                                  GTK_BUTTONS_YES_NO,
+                                  _("Do you really want to remove preferred status from network: '%s'?"),
+                                  local_essid);
+  if (GTK_RESPONSE_NO == gtk_dialog_run (GTK_DIALOG (dialog)) )
+  {
+    gtk_widget_destroy (dialog);
+    return;
+  }
+  else
+  {
+    gtk_widget_destroy (dialog);
+  }
+
+  /* Do the array deletion and write it back to the database */
+
+  /* We know which ESSID to clobber.  Now do so. */
+  nw_path = g_strdup_printf("%s/%s", NETWORK_CONFIG_WIRELESS_NETWORKS_DIR, local_essid);
+
+  /* Write the key as a non-preferred network. */
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_PREFERRED_NET);
+  gconf_client_set_bool (data->client, key, 0, NULL);
+  g_free(key);
+  g_free(nw_path);
+
+  /* Reload the preferred networks data. */
+  netstatus_connprefs_pn_reload_networks(data);
+  netstatus_connprefs_pn_sort_networks(data);
+  netstatus_connprefs_pn_refresh_list(data);
+  /* Reorder networks and re-display the GtkTreeView object. */
+}
+
+static void
+netstatus_connprefs_pn_props_btn_clicked (GtkWidget *widg, NetstatusPreferredNetworksData *data)
+{
+  /* Pull the selection from the tree and open properties on it. */
+  GtkTreeSelection      *tree_sel = NULL;
+  GtkTreeModel          *liststore;
+  GtkTreeIter            iter;
+  unsigned char         *local_essid;
+  gboolean               item_selected = 0;
+
+
+  /* Clear iter */
+  memset (&iter, 0, sizeof(iter));
+
+  /* Get the list item */
+  tree_sel = gtk_tree_view_get_selection  ( GTK_TREE_VIEW (data->lb_preferred_networks) );
+  if (tree_sel == NULL)
+    return;
+
+  g_object_ref(tree_sel);
+
+  item_selected = gtk_tree_selection_get_selected (tree_sel, &liststore, &iter);
+
+  if (liststore == NULL || item_selected == FALSE)
+    return;
+
+  g_object_ref (liststore);
+
+  /* pull all data from the selected network. */
+  local_essid = NULL;
+
+  /* Pull the reference to the essid */
+  gtk_tree_model_get (liststore, &iter, 0, &local_essid, -1);
+
+  /* Unreference the GUI pieces now, we've got what we need. */
+  g_object_unref(liststore);
+  g_object_unref(tree_sel);
+
+  /* Check for successful copy. */
+  if (local_essid == NULL)
+  {
+    /* Error */
+    return;
+  }
+
+  /* Display the new dialog. */
+  netstatus_network_props_new (data->iface, local_essid);
+}
+
+static void
+netstatus_connprefs_pn_autocb_btn_clicked (GtkWidget *widg, NetstatusPreferredNetworksData *data)
+{
+  /* Set the check box status. */
+  gconf_client_set_bool (data->client, NETWORK_CONFIG_WIRELESS_AUTO_CONNECT_KEY,
+                         gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(data->check_auto_connect) ),
+                         NULL);
+}
+
+static void
+netstatus_connprefs_pn_reload_networks(NetstatusPreferredNetworksData *data)
+{
+  NetstatusNetworkData         *local_nndlist = NULL, *tmp_nnd = NULL;
+  unsigned int                  local_nndcount = 0, i = 0;
+
+  /* clear the array */
+  memset(data->preferred_networks, 0, sizeof(prefNet) * MAX_PREFERRED_NET);
+
+  local_nndlist = get_all_preferred_network_objects (data->client, &local_nndcount);
+
+  tmp_nnd = local_nndlist;
+
+  if (local_nndcount > 0)
+  {
+    /* Set the array count */
+    data->net_count = local_nndcount;
+
+    for (i = 0; i < local_nndcount; i++)
+    {
+      /* Store the relevant network details. */
+      strncpy( data->preferred_networks[i].essid, tmp_nnd->essid, IW_ESSID_MAX_SIZE);
+      data->preferred_networks[i].essid[IW_ESSID_MAX_SIZE] = '\0';
+
+      data->preferred_networks[i].order = tmp_nnd->preferred_order;
+
+      tmp_nnd++;
+    }
+  }
+  else
+  {
+    data->net_count = 0;
+  }
+
+  g_free(local_nndlist);
+
+}
+
+
+/* Sorts the preferred networks in the array (simple qiuck sort) */
+static void
+netstatus_connprefs_pn_sort_networks(NetstatusPreferredNetworksData *data)
+{
+  q_sort(data->preferred_networks, 0, data->net_count - 1);
+}
+
+/* Re-displays the list in the dialog */
+static void
+netstatus_connprefs_pn_refresh_list(NetstatusPreferredNetworksData *data)
+{
+  GtkListStore                 *list_store;
+  GtkTreeIter                   iter;
+  unsigned int                  i = 0;
+
+
+  list_store = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (data->lb_preferred_networks) ) );
+
+  g_object_ref (list_store);
+
+  gtk_tree_view_set_model ( GTK_TREE_VIEW (data->lb_preferred_networks), NULL);
+
+  gtk_list_store_clear (list_store);
+
+  if (data->net_count > 0)
+  {
+    for (i = 0; i < data->net_count; i++)
+    {
+      /* Insert in order */
+      gtk_list_store_append ( list_store, &iter);
+      gtk_list_store_set ( list_store, &iter, 0, data->preferred_networks[i].essid, 1, data->preferred_networks[i].order, -1);
+    }
+  }
+  else
+  {
+    gtk_list_store_append ( list_store, &iter);
+    gtk_list_store_set ( list_store, &iter, 0, _("No Preferred Networks"), 1, 0, -1);
+  }
+  gtk_tree_view_set_model ( GTK_TREE_VIEW (data->lb_preferred_networks), GTK_TREE_MODEL(list_store));
+
+  g_object_unref (list_store);
+
+
+  /* Desensatize all buttons */
+  gtk_widget_set_sensitive(data->up_btn, FALSE);
+  gtk_widget_set_sensitive(data->down_btn, FALSE);
+  gtk_widget_set_sensitive(data->props_btn, FALSE);
+  gtk_widget_set_sensitive(data->remove_btn, FALSE);
+}
+
+/* Activate the buttons (or deactivate) */
+static void
+netstatus_connprefs_pn_list_changed(GtkWidget *widget, NetstatusPreferredNetworksData *data)
+{
+  /* Pull the selection from the tree if we have one. */
+  GtkTreeSelection      *tree_sel = NULL;
+
+
+  /* Get the list item */
+  tree_sel = gtk_tree_view_get_selection  ( GTK_TREE_VIEW (data->lb_preferred_networks) );
+  if (tree_sel == NULL)
+  {
+    /* nothing selected.  Dsensatize */
+    gtk_widget_set_sensitive(data->up_btn, FALSE);
+    gtk_widget_set_sensitive(data->down_btn, FALSE);
+    gtk_widget_set_sensitive(data->props_btn, FALSE);
+    gtk_widget_set_sensitive(data->remove_btn, FALSE);
+  }
+  else
+  {
+    /* Something selected, sensatize */
+    gtk_widget_set_sensitive(data->up_btn, TRUE);
+    gtk_widget_set_sensitive(data->down_btn, TRUE);
+    gtk_widget_set_sensitive(data->props_btn, TRUE);
+    gtk_widget_set_sensitive(data->remove_btn, TRUE);
+  }
+
+}
+
+/* Stores the preferred networks back to the gconf database */
+static void
+netstatus_connprefs_pn_store_networks(NetstatusPreferredNetworksData *data)
+{
+  gchar *nw_path = NULL, *key = NULL;
+  guint i = 0;
+
+  /* Resort so we write in order. */
+  netstatus_connprefs_pn_sort_networks(data);
+
+  for (i = 0; i < data->net_count; i++)
+  {
+    nw_path = g_strdup_printf("%s/%s", NETWORK_CONFIG_WIRELESS_NETWORKS_DIR, data->preferred_networks[i].essid);
+    
+    /* We write these out as the index+1 in order to preserve linier single incrimenation */
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_PREFERRED_ORDER);
+    gconf_client_set_int (data->client, key, i+1, NULL);
+    g_free(key);
+    
+    g_free(nw_path);
+  }
+}
+
+/* Return network object, user responsible for g_free ing the object. */
+NetstatusNetworkData *
+load_network_object(GConfClient *gc_client, char *essid)
+{
+  gchar *nw_path = NULL, *key = NULL, *tmp_str = NULL;
+  NetstatusNetworkData *local;
+  
+  nw_path = g_strdup_printf("%s/%s", NETWORK_CONFIG_WIRELESS_NETWORKS_DIR, essid);
+
+  if (gconf_client_dir_exists(gc_client, nw_path, NULL) == TRUE)
+  {
+    /* We have an existing dir for that data
+     * Grab a chunk of memory
+     */
+    local = g_malloc0 (sizeof(NetstatusNetworkData));
+    if (local == NULL)
+    {
+      if (nw_path) g_free(nw_path);
+      return NULL;
+    }
+
+    /* Pull the data (one element at a time) from the gcfon database. */
+
+    /* Normal Strings */
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_ESSID);    
+    tmp_str = gconf_client_get_string (gc_client, key, NULL);
+    g_free (key);
+    if (tmp_str)
+    {
+      strncpy( local->essid, tmp_str, IW_ESSID_MAX_SIZE+1);
+      g_free(tmp_str);
+      tmp_str = NULL;
+    }
+    else
+    {
+      if (nw_path) g_free(nw_path);
+      return NULL;
+    }
+
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_MODE);
+    tmp_str = gconf_client_get_string (gc_client, key, NULL);
+    g_free(key);
+    if (tmp_str)
+    {
+      strncpy( local->mode, tmp_str, IW_MODE_STR_MAX+1);
+      g_free(tmp_str);
+      tmp_str = NULL;
+    }
+    else
+    {
+      if (nw_path) g_free(nw_path);
+      return NULL;
+    }
+
+    /* Normal Floats */
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_FREQ);
+    local->frequency = gconf_client_get_float (gc_client, key, NULL);
+    g_free(key);
+
+    /* Normal Ints */
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_ENC);
+    local->encryption_present = gconf_client_get_int (gc_client, key, NULL);
+    g_free(key);
+
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_KEYMODE);
+    local->key_mode = gconf_client_get_int (gc_client, key, NULL);
+    g_free(key);
+
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_KEY_NUM);
+    local->key_number = gconf_client_get_int (gc_client, key, NULL);
+    g_free(key);
+
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_ENCODE_MODE);
+    local->encode_mode = gconf_client_get_int (gc_client, key, NULL);
+    g_free(key);
+
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_PREFERRED_ORDER);
+    local->preferred_order = gconf_client_get_int (gc_client, key, NULL);
+    g_free(key);
+
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_LAST_ACCESS);
+    local->last_accessed = gconf_client_get_int (gc_client, key, NULL);
+    g_free(key);
+
+    /* Normal Booleans */
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_USER_ENTERED_KEY);
+    local->user_entered_key = gconf_client_get_bool (gc_client, key, NULL);
+    g_free(key);
+
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_PREFERRED_NET);
+    local->preferred_network = gconf_client_get_bool (gc_client, key, NULL);
+    g_free(key);
+
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_AUTO_KEYED_NET);
+    local->autokeyed_network = gconf_client_get_bool (gc_client, key, NULL);
+    g_free(key);
+
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_SHARED_AUTH_NET);
+    local->shared_auth_network = gconf_client_get_bool (gc_client, key, NULL);
+    g_free(key);
+
+    /* Deal with mac ID */
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_MACID);
+    tmp_str = gconf_client_get_string (gc_client, key, NULL);
+    g_free(key);
+    if (tmp_str)
+    {
+      sscanf(tmp_str, "%02x%02x%02x%02x%02x%02x", \
+             (unsigned int *) &local->mac_id.ether_addr_octet[0], (unsigned int *) &local->mac_id.ether_addr_octet[1], \
+             (unsigned int *) &local->mac_id.ether_addr_octet[2], (unsigned int *) &local->mac_id.ether_addr_octet[3], \
+             (unsigned int *) &local->mac_id.ether_addr_octet[4], (unsigned int *) &local->mac_id.ether_addr_octet[5]);
+      g_free(tmp_str);
+      tmp_str = NULL;
+    }
+
+    /* Deal with the Encryption keys */
+    key = g_strdup_printf("%s/%s", nw_path, NSW_NW_ENC_KEY);
+    tmp_str = gconf_client_get_string (gc_client, key, NULL);
+    g_free(key);
+
+    if (tmp_str)
+    {
+      strncpy(local->encryption_key, tmp_str, IW_ENCODING_TOKEN_MAX*2);
+
+      /* Be sure we're NULL terminated. */
+      local->encryption_key[IW_ENCODING_TOKEN_MAX*2] = '\0';
+
+      g_free (tmp_str);
+      tmp_str = NULL;
+    }
+  }
+  else
+  {
+    /* No such beast, return null */
+    if (nw_path) g_free(nw_path);
+    return NULL;
+  }
+
+  /* Free any allocated memory. */
+  if (nw_path) g_free(nw_path);
+  
+  /* Return the pointer to the data structure */
+  return local;
+}
+
+static void
+save_network_object(GConfClient *gc_client, char *essid, NetstatusNetworkData *data)
+{
+  gchar *nw_path = NULL, *key = NULL, tmp_key[512];
+
+  nw_path = g_strdup_printf("%s/%s", NETWORK_CONFIG_WIRELESS_NETWORKS_DIR, essid);
+
+  /* Init the key at this level. */
+  gconf_client_set_int (gc_client, nw_path, 1, NULL);
+  /* Set each element */
+
+  /* Normal Strings */
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_ESSID);
+  gconf_client_set_string (gc_client, key, data->essid, NULL);
+  g_free(key);
+
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_MODE);
+  gconf_client_set_string (gc_client, key, data->mode, NULL);
+
+  /* Normal Floats */
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_FREQ);
+  gconf_client_set_float (gc_client, key, data->frequency, NULL);
+  g_free(key);
+  
+  /* Normal Ints */
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_ENC);
+  gconf_client_set_int (gc_client, key, data->encryption_present, NULL);
+  g_free(key);
+
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_KEYMODE);
+  gconf_client_set_int (gc_client, key, data->key_mode, NULL);
+  g_free(key);
+
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_KEY_NUM);
+  gconf_client_set_int (gc_client, key, data->key_number, NULL);
+  g_free(key);
+
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_ENCODE_MODE);
+  gconf_client_set_int (gc_client, key, data->encode_mode, NULL);
+  g_free(key);
+
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_PREFERRED_ORDER);
+  gconf_client_set_int (gc_client, key, data->preferred_order, NULL);
+  g_free(key);
+
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_LAST_ACCESS);
+  gconf_client_set_int (gc_client, key, data->last_accessed, NULL);
+  g_free(key);
+
+  /* Normal Booleans */
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_USER_ENTERED_KEY);
+  gconf_client_set_bool (gc_client, key, data->user_entered_key, NULL);
+  g_free(key);
+
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_PREFERRED_NET);
+  gconf_client_set_bool (gc_client, key, data->preferred_network, NULL);
+  g_free(key);
+
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_AUTO_KEYED_NET);
+  gconf_client_set_bool (gc_client, key, data->autokeyed_network, NULL);
+  g_free(key);
+
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_SHARED_AUTH_NET);
+  gconf_client_set_bool (gc_client, key, data->shared_auth_network, NULL);
+  g_free(key);
+
+  /* Deal with mac ID */
+  g_snprintf(tmp_key, 512, "%02x%02x%02x%0x2%0x2%02x",\
+             (unsigned char) data->mac_id.ether_addr_octet[0], (unsigned char) data->mac_id.ether_addr_octet[1], \
+             (unsigned char) data->mac_id.ether_addr_octet[2], (unsigned char) data->mac_id.ether_addr_octet[3], \
+             (unsigned char) data->mac_id.ether_addr_octet[4], (unsigned char) data->mac_id.ether_addr_octet[5] );
+
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_MACID);
+  gconf_client_set_string (gc_client, key, tmp_key, NULL);
+  g_free(key);
+
+  /* Deal with the Encryption keys */
+  key = g_strdup_printf("%s/%s", nw_path, NSW_NW_ENC_KEY);
+  if (data->encryption_key[0] != '\0')
+  {
+    gconf_client_set_string (gc_client, key, data->encryption_key, NULL);
+  }
+  g_free(key);
+  
+  g_free(nw_path);
+}
+
+void translate_ap_to_nnd(AP_type *from, NetstatusNetworkData *to)
+{
+  /* Make sure we don't blow up. */
+  if (from == NULL || to == NULL)
+    return;
+
+  /* Deal with the simple copies first */
+  to->frequency = from->frequency;
+  to->encryption_present = from->encryption_present;
+  to->key_number = from->key_number;
+  to->encode_mode = from->encode_mode;
+  to->key_mode = NSW_KEY_MODE_RAW;
+
+  /* Default all stuff to false. */
+  to->user_entered_key = FALSE;
+  to->preferred_network = FALSE;
+  to->autokeyed_network = FALSE;
+  to->shared_auth_network = FALSE;
+  to->preferred_order = 0;
+  to->last_accessed = time(NULL); /* current time */
+
+  /* copy all strings. */
+  strncpy( to->essid, from->essid, IW_ESSID_MAX_SIZE+1);
+  strncpy( to->mode, from->mode, IW_MODE_STR_MAX+1);
+  strncpy( to->encryption_key, from->encryption_key, IW_ENCODING_TOKEN_MAX*2);
+  memcpy (&to->mac_id, &from->mac_id, sizeof(struct ether_addr));
+}
+
+
+void
+safe_save_network_object(AP_type *this_ap, GConfClient *g_client)
+{
+  NetstatusNetworkData *local_nnd = NULL;
+
+  /* Failure is imminent, return. */
+  if (g_client == NULL)
+    return;
+
+  /* If we've got an object AND it's a preferred network, EXIT fn */
+  local_nnd = load_network_object(g_client, this_ap->essid);
+
+  /* If there's nothing there, then save what we have. */
+  if (local_nnd == NULL)
+  {
+    /* We've got nothing.  Translate and save. */
+    local_nnd = g_malloc0(sizeof(NetstatusNetworkData));
+    if (local_nnd == NULL)
+      return;
+    translate_ap_to_nnd(this_ap, local_nnd);
+    save_network_object(g_client, local_nnd->essid, local_nnd);
+    g_free(local_nnd);
+    return;
+  }
+
+  /* Preferred netowrk.  Do not overwrite. */
+  if (local_nnd->preferred_network)
+    return;
+
+  /* If we have an already stored version of this network AND the key is set
+   * AND the chanel AND the adhoc settings are the same, then DO NOT save.
+   * EXIT fn
+   */
+
+  if ( (local_nnd->user_entered_key == TRUE) && (this_ap->frequency == local_nnd->frequency) && (  ! strncmp(this_ap->mode, local_nnd->mode, IW_MODE_STR_MAX+1) ) )
+    return;
+
+  /* If the user has not entered a key then overwrite what is there with the
+   * current settings.
+   */
+  translate_ap_to_nnd(this_ap, local_nnd);
+  save_network_object(g_client, local_nnd->essid, local_nnd);
+  g_free(local_nnd);
+
+  /* Otherwise EXIT fn */
+}
+
+
+NetstatusNetworkData *
+get_all_preferred_network_objects (GConfClient *gc_client, unsigned int *count)
+{
+  GSList                  *dir_list = NULL, *tmp_dir = NULL;
+  gchar                   *key = NULL;;
+  unsigned int             local_count = 0;
+  NetstatusNetworkData    *local_nnd = NULL, *tmp_nnd = NULL, *iter_nnd = NULL;
+
+  /* Get a list of all entries */
+  dir_list = gconf_client_all_dirs (gc_client, NETWORK_CONFIG_WIRELESS_NETWORKS_DIR, NULL);
+
+  if (dir_list == NULL)
+  {
+    if (count != NULL)
+      *count = 0;
+    return NULL;
+  }
+
+  tmp_dir = dir_list;
+
+  while (tmp_dir)
+  {
+    /* Check the dir for */
+    key = g_strdup_printf("%s/%s", (char *)tmp_dir->data, NSW_NW_PREFERRED_NET);
+    if ( gconf_client_get_bool (gc_client, key, NULL) )
+      local_count++;
+    tmp_dir = tmp_dir->next;
+    g_free(key);
+  }
+
+  /* Allocate an array structure to hold all of the objects */
+  local_nnd = g_malloc0 (sizeof(NetstatusNetworkData) * local_count);
+
+  if (local_nnd == NULL)
+  {
+    if (count != NULL)
+      *count = 0;
+    return NULL;
+  }
+
+  /* Now iterate and copy them in in) -- Sorting is the callers responsability */
+  tmp_dir = dir_list;
+  tmp_nnd = NULL;
+  iter_nnd = local_nnd;
+
+  /* Reference the object so it doesn't go away during transit back to the other function. */
+
+  while (tmp_dir)
+  {
+    /* Check the dir for */
+    key = g_strdup_printf("%s/%s", (char *)tmp_dir->data, NSW_NW_PREFERRED_NET);
+    if ( gconf_client_get_bool (gc_client, key, NULL) )
+    {
+      g_free(key);
+      /* Pull the essid and load the object */
+      key = g_strdup_printf("%s", (unsigned char *) (rindex(tmp_dir->data, '/')) + 1);
+      tmp_nnd = load_network_object(gc_client, key);
+
+      memcpy(iter_nnd, tmp_nnd, sizeof(NetstatusNetworkData));
+      g_free(tmp_nnd);
+
+      /* Next object please */
+      iter_nnd++;
+    }
+    g_free(key);
+    tmp_dir = tmp_dir->next;
+  }
+
+  /* Now free the big mess this apparently frees all elements as well, documentation unclear --MC */
+  g_slist_free (dir_list);
+
+  *count = local_count;
+
+  return local_nnd;
+}
+
+static void
+netstatus_connprefs_props_changed (GtkWidget *widg, NetstatusNetworkPropsData *data)
+{
+  /* If wep OR auth is active
+   * if autokey is NOT active
+   * enable all wep buttons
+   * else
+   * diable wep stuff (key, key_type, key_index)
+   * else
+   * disable all wep stuff
+   */
+
+  if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->wep_cb))
+     || gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->authentication_cb)) )
+  {
+    if ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(data->auto_key_cb) ) )
+    {
+      gtk_widget_set_sensitive(data->wep_key_entry, FALSE);
+      gtk_widget_set_sensitive(data->key_format_combo, FALSE);
+      gtk_widget_set_sensitive(data->key_length_combo, FALSE);
+      gtk_widget_set_sensitive(data->key_index_spin, FALSE);
+      gtk_widget_set_sensitive(data->auto_key_cb, TRUE);
+    }
+    else
+    {
+      gtk_widget_set_sensitive(data->wep_key_entry, TRUE);
+      gtk_widget_set_sensitive(data->key_format_combo, TRUE);
+      gtk_widget_set_sensitive(data->key_length_combo, TRUE);
+      gtk_widget_set_sensitive(data->key_index_spin, TRUE);
+      gtk_widget_set_sensitive(data->auto_key_cb, TRUE);
+    }
+  }
+  else
+  {
+    gtk_widget_set_sensitive(data->wep_key_entry, FALSE);
+    gtk_widget_set_sensitive(data->key_format_combo, FALSE);
+    gtk_widget_set_sensitive(data->key_length_combo, FALSE);
+    gtk_widget_set_sensitive(data->key_index_spin, FALSE);
+    gtk_widget_set_sensitive(data->auto_key_cb, FALSE);
+  }
+}
+
+/* Set the data and save the network object. */
+static void netstatus_connprefs_props_ok_btn_clicked (GtkWidget *widg, NetstatusNetworkPropsData *data)
+{
+  NetstatusNetworkData         *local_nnd = NULL;
+  unsigned char                *tmp_str = NULL;
+  gint                          list_index = 0;
+
+  /* This should always be valid */
+  local_nnd = data->nnd_store;
+  g_assert(local_nnd != NULL);
+
+  /* Convert String or hex to RAW form if key type is set to one of them */
+  list_index = gtk_combo_box_get_active ( GTK_COMBO_BOX (data->key_format_combo) );
+
+  switch (list_index)
+  {
+  case 1:
+    /* NSW_KEY_MODE_HEX: */
+    {
+      tmp_str = (unsigned char *) gtk_entry_get_text( GTK_ENTRY(data->wep_key_entry));
+      strncpy(local_nnd->encryption_key, tmp_str, IW_ENCODING_TOKEN_MAX*2);
+      local_nnd->user_entered_key = TRUE;
+    }
+    break;
+  case 2:
+    /* NSW_KEY_MODE_ASCII: */
+    {
+      /* We just prepend the p: and iwlib converts everything. */
+      tmp_str = (unsigned char *) gtk_entry_get_text( GTK_ENTRY(data->wep_key_entry) );
+      snprintf(local_nnd->encryption_key, IW_ENCODING_TOKEN_MAX*2, "p:%s", tmp_str);
+      local_nnd->user_entered_key = TRUE;
+    }
+    break;
+    /* Implicit default of do nothing. */
+  }
+
+  tmp_str = (unsigned char *) gtk_entry_get_text (GTK_ENTRY(data->name_entry));
+  if (tmp_str)
+    strncpy ( local_nnd->essid, tmp_str, IW_ESSID_MAX_SIZE);
+
+  /* Pull WEP status. */
+  if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(data->wep_cb)) )
+  {
+    list_index = gtk_combo_box_get_active ( GTK_COMBO_BOX (data->key_length_combo) );
+    switch (list_index)
+    {
+    case 0:
+      local_nnd->encryption_present = NSW_ENCRYPTION_40_BIT;
+      break;
+    case 1:
+      local_nnd->encryption_present = NSW_ENCRYPTION_128_BIT;
+      break;
+    case 2:
+      local_nnd->encryption_present = NSW_ENCRYPTION_256_BIT;
+      break;
+    default:  /* Should never happen but... */
+      local_nnd->encryption_present = NSW_ENCRYPTION_NONE;
+      break;
+    }
+
+    local_nnd->shared_auth_network = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(data->authentication_cb));
+    local_nnd->key_number = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(data->key_index_spin));
+    local_nnd->autokeyed_network = gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(data->auto_key_cb));
+  }
+  else
+    local_nnd->encryption_present = NSW_ENCRYPTION_NONE;
+  /* We support ad-hoc and managed for now, and nothing else. */
+  if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(data->adhoc_cb)) )
+    strncpy(local_nnd->mode, "ad-hoc", 7);
+  else /* if it's ad-hoc now, set it to Managed, otherwise leave it alone. */
+    strncpy(local_nnd->mode, "managed", 8);
+
+  list_index = gtk_combo_box_get_active ( GTK_COMBO_BOX (data->chanel_combo_box));
+  if (list_index == 0)
+  {
+    /* Automatic mode */
+    local_nnd->frequency = 0;
+  }
+  else
+  {
+    /* Anything other than 0 means that we've got a valid user selected chanel */
+    local_nnd->frequency = (float) list_index;
+  }
+
+  /* Save the data. */
+  save_network_object(data->client, local_nnd->essid, local_nnd);
+
+  /* Now close the dialog */
+  gtk_signal_emit_by_name ( GTK_OBJECT(data->dialog), "destroy");
+}
+
+static void netstatus_connprefs_props_cancel_btn_clicked (GtkWidget *widg, NetstatusNetworkPropsData *data)
+{
+  /* Cancel was pressed.  Just go away. */
+  gtk_signal_emit_by_name ( GTK_OBJECT(data->dialog), "destroy");
+}
+
+
+/* General use quicksort for sorting priorities in prefered nets. */
+void q_sort(prefNet nets[], int left, int right)
+{
+  int pivot, l_hold, r_hold;
+  unsigned char pivot_str[IW_ESSID_MAX_SIZE+1];
+
+  l_hold = left;
+  r_hold = right;
+
+  pivot = nets[left].order;
+  strncpy( pivot_str, nets[left].essid, IW_ESSID_MAX_SIZE);
+
+  while (left < right)
+  {
+    while ((nets[right].order >= pivot) && (left < right))
+      right--;
+    if (left != right)
+    {
+      strncpy( nets[left].essid, nets[right].essid, IW_ESSID_MAX_SIZE);
+      nets[left].order = nets[right].order;
+      left++;
+    }
+    while ((nets[left].order <= pivot) && (left < right))
+      left++;
+    if (left != right)
+    {
+      strncpy( nets[right].essid, nets[left].essid, IW_ESSID_MAX_SIZE);
+      nets[right].order = nets[left].order;
+      right--;
+    }
+  }
+  nets[left].order = pivot;
+  strncpy( nets[left].essid, pivot_str, IW_ESSID_MAX_SIZE);
+  pivot = left;
+  left = l_hold;
+  right = r_hold;
+  if (left < pivot)
+    q_sort(nets, left, pivot-1);
+  if (right > pivot)
+    q_sort(nets, pivot+1, right);
+}
+
diff -Nru gnome-netstatus/src/netstatus-wireless-connection-prefs.h gnome-netstatus.hacked/src/netstatus-wireless-connection-prefs.h
--- gnome-netstatus/src/netstatus-wireless-connection-prefs.h	1969-12-31 19:00:00.000000000 -0500
+++ gnome-netstatus.hacked/src/netstatus-wireless-connection-prefs.h	2004-06-22 03:39:09.220359712 -0400
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2004 Sun Microsystems, 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 2 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+
+ * Authors:
+ *      Mark Carey <mark.carey@sun.com>
+ */
+
+#ifndef __NETSTATUS_WIRELESS_CONNECTION_PREFS_H__
+#define __NETSTATUS_WIRELESS_CONNECTION_PREFS_H__
+
+#include <gtk/gtk.h>
+
+/* I HATE THIS.  Unfortunatly, the kernel version of the wireless header
+ * is what it needed, not the userland include.  In most cases this does
+ * not match.  Someone with more clout than I have needs to beat someone 
+ * over the head about this one. -MC.
+ */
+#define WEXT_HEADER "/usr/src/linux/include/linux/wireless.h"
+#include <iwlib.h>
+
+#include "wireless-api.h"
+#include "netstatus-iface.h"
+
+G_BEGIN_DECLS
+
+GtkWidget *netstatus_connection_prefs_new (NetstatusIface *iface);
+GtkWidget *netstatus_preferred_networks_new (NetstatusIface *iface);
+GtkWidget *netstatus_network_props_new (NetstatusIface *iface, unsigned char *essid);
+
+/* Encryption classes */
+#define NSW_ENCRYPTION_NONE    (0)
+#define NSW_ENCRYPTION_40_BIT  (1)
+#define NSW_ENCRYPTION_128_BIT (2)
+#define NSW_ENCRYPTION_256_BIT (3)
+#define NSW_ENCRYPTION_NO_DATA (4)
+
+/* Encoding modes */
+#define NSW_SEC_MODE_RESTRICTED (1)
+#define NSW_SEC_MODE_OPEN       (2)
+
+#define NSW_KEY_MODE_HEX        (1)
+#define NSW_KEY_MODE_ASCII      (2)
+#define NSW_KEY_MODE_RAW        (3)
+
+#define NSW_NW_ESSID  "nwESSID"
+#define NSW_NW_FREQ   "nwFREQUENCY"
+#define NSW_NW_MODE "nwMODE"
+#define NSW_NW_MACID "nwMACID"
+#define NSW_NW_ENC "nwENCRYPTION"
+#define NSW_NW_KEYMODE "nwKEYMODE"
+#define NSW_NW_ENC_KEY "nwENCRYPTION_KEY"
+#define NSW_NW_KEY_NUM "nwKEY_NUMBER"
+#define NSW_NW_ENCODE_MODE "nwENCODE_MODE"
+#define NSW_NW_USER_ENTERED_KEY "nwUSER_HAS_ENTERED_KEY"
+#define NSW_NW_PREFERRED_NET "nwPREFERRED_NET"
+#define NSW_NW_AUTO_KEYED_NET "nwAUTO_KEYED_NET"
+#define NSW_NW_SHARED_AUTH_NET "nwSHARED_AUTH_NET"
+#define NSW_NW_PREFERRED_ORDER "nwPREFERRED_ORDER"
+#define NSW_NW_LAST_ACCESS "nwLAST_ACCESS"
+
+
+typedef struct _NetstatusNetworkData {
+	char              essid[IW_ESSID_MAX_SIZE+1];   /* ESSID of the AP. */
+	float             frequency;                    /* Frequency of the AP */
+	char              mode[IW_MODE_STR_MAX+1];      /*  managed,ad-hoc for now. */
+	struct ether_addr mac_id;                       /* mac address of the AP  -- We do not do multi celled nets right now. */
+	unsigned int      encryption_present;           /* Encryption was present on the network the last time we checked. */
+  unsigned int      key_mode;                     /* NSW_KEY_MODE_HEX / NSW_KEY_MODE_ASCII */
+  char              encryption_key[(IW_ENCODING_TOKEN_MAX*2)+1]; /* The encryption key (in packed hex string is max size). */
+  unsigned int      key_number;                   /* Key Index */
+  unsigned int      encode_mode;                  /* Open or Restricted */
+  gboolean          user_entered_key;             /* has the user entered a key for this network? */
+  gboolean          preferred_network;            /* is this a prefered network? */
+  gboolean          autokeyed_network;            /* Automaticly keyed network */
+  gboolean          shared_auth_network;          /* Shared Authentiction key */
+  unsigned int      preferred_order;              /* networks order in preference list */
+  
+  unsigned long     last_accessed;                /* last access time in Unix Seconds since 1970 */
+
+} NetstatusNetworkData;
+
+G_END_DECLS
+
+#endif /* __NETSTATUS_WIRELESS_CONNECTION_PREFS_H__ */
diff -Nru gnome-netstatus/src/wireless-api.c gnome-netstatus.hacked/src/wireless-api.c
--- gnome-netstatus/src/wireless-api.c	1969-12-31 19:00:00.000000000 -0500
+++ gnome-netstatus.hacked/src/wireless-api.c	2004-06-21 17:40:15.046444944 -0400
@@ -0,0 +1,890 @@
+/*
+ * Copyright (C) 2004 Sun Microsystems, 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 2 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ *      Mark Carey <mark.carey@sun.com>
+ */
+
+/* Standard headers */
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <netdb.h>              /* gethostbyname, getnetbyname */
+#include <net/ethernet.h>       /* struct ether_addr */
+#include <sys/time.h>           /* struct timeval */
+#include <unistd.h>
+#include <stdio.h>
+
+#include <linux/types.h>                /* for "caddr_t" et al          */
+#include <linux/socket.h>               /* for "struct sockaddr" et al  */
+#include <linux/if.h>                   /* for IFNAMSIZ and co... */
+
+/* I HATE THIS.  Unfortunatly, the kernel version of the wireless header
+ * is what it needed, not the userland include.  In most cases this does
+ * not match.  Someone with more clout than I have needs to beat someone
+ * over the head about this one. -MC. 
+ */
+#define WEXT_HEADER "/usr/src/linux/include/linux/wireless.h"
+#include <iwlib.h>
+#include "wireless-api.h"
+
+/* Local definitions */
+#define IW_MAX_APS          (256)
+
+/* If we dont' have standard TRUE/FALSE defs do them here */
+#ifndef TRUE
+#define TRUE (1)
+#endif
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
+
+/* External imports */
+extern const char * const iw_operation_mode[];
+
+/* Module private functions */
+void iw_api_init(void);
+
+/* Module globals */
+unsigned int g_iw_api_init = FALSE;
+int g_iw_socket = 0;
+
+void iw_api_init(void)
+{
+  /* do any init required */
+
+  /* Open our socket. */
+  g_iw_socket = iw_sockets_open();
+
+  if (g_iw_socket < 0)
+  {
+    return;
+  }
+
+  /* set the init variable to TRUE */
+  g_iw_api_init = TRUE;
+}
+
+/* Gets/Sets the ESSID value from the interface.
+ * Get returns: String name of ESSID upon success, NULL upon failure.
+ * Set Returns: 0 (IW_API_SUCCESS) for success, 1 (IW_API_FAILURE) for error.
+ */
+unsigned char *get_essid(unsigned char *iface)
+{
+  int ret_code = 0;
+  wireless_config info;
+  unsigned char *ret_val;
+
+  /* Make sure we've got init. */
+  if (g_iw_api_init != TRUE)
+    iw_api_init();
+
+  ret_code = iw_get_basic_config(g_iw_socket, iface, &info);
+
+  /* If we've failed, return IW_API_FAILURE */
+  if (ret_code < 0)
+    return NULL;
+
+  /* malloc and copy a string out. */
+  ret_val = malloc(IW_ESSID_MAX_SIZE + 1);
+
+  if (ret_val == NULL)
+    return NULL;
+
+  /* copy in the string. */
+  if (!info.essid_on)
+  {
+    if (ret_val)
+      free (ret_val);
+    return NULL;
+  }
+  else
+  {
+    strncpy(ret_val, info.essid, IW_ESSID_MAX_SIZE);
+    return ret_val;
+  }
+}
+
+unsigned int set_essid(unsigned char *iface, unsigned char *essid_str)
+{
+  int ret_code = 0;
+  wireless_config info;
+
+  /* Make sure we've got init. */
+  if (g_iw_api_init != TRUE)
+    iw_api_init();
+
+  ret_code = iw_get_basic_config(g_iw_socket, iface, &info);
+
+  /* If we've failed, return IW_API_FAILURE */
+  if (ret_code < 0)
+    return IW_API_FAILURE;
+
+  /* Got the basic info, now set essid and set info. */
+  if (essid_str != NULL)
+  {
+    strncpy(info.essid, essid_str, IW_ESSID_MAX_SIZE);
+    info.essid_on = 1;  /* No docs on this, just followed examples */
+  }
+
+  /* Now do the set. */
+  ret_code = iw_set_basic_config(g_iw_socket, iface, &info);
+
+  if (ret_code < 0)
+    return IW_API_FAILURE;
+  else
+    return IW_API_SUCCESS;
+}
+
+/* Gets/Sets the Mode
+ * Valid modes are: auto, managed, master, ad-hoc, repeater, secondary, monitor
+ * these are from linux/wireless.h (see definitions)
+ * Get returns: Mode string as described above, NULL upon failure.
+ * Set Returns: 0 (IW_API_SUCCESS) for success, 1 (IW_API_FAILURE) for error.
+ */
+unsigned char *get_mode(unsigned char *iface)
+{
+  int ret_code = 0;
+  wireless_config info;
+  unsigned char *ret_val;
+
+  /* Make sure we've got init. */
+  if (g_iw_api_init != TRUE)
+    iw_api_init();
+
+  ret_code = iw_get_basic_config(g_iw_socket, iface, &info);
+
+  /* If we've failed, return IW_API_FAILURE */
+  if (ret_code < 0)
+    return NULL;
+
+  /* malloc and copy a string out. */
+  ret_val = malloc(IW_MODE_STR_MAX+1);
+
+  if (ret_val == NULL)
+    return NULL;
+
+  /* copy in the string. */
+  if (!info.has_mode)
+  {
+    if (ret_val)
+      free (ret_val);
+    return NULL;
+  }
+  else
+  {
+    /* This is safe since iwlib supplied both index and array */
+    strncpy(ret_val, iw_operation_mode[info.mode], IW_MODE_STR_MAX);
+    return ret_val;
+  }
+}
+
+unsigned int set_mode(unsigned char *iface, unsigned char *modeStr)
+{
+  int ret_code = 0;
+  wireless_config info;
+
+  /* Make sure we've got init. */
+  if (g_iw_api_init != TRUE)
+    iw_api_init();
+
+  ret_code = iw_get_basic_config(g_iw_socket, iface, &info);
+
+  /* If we've failed, return IW_API_FAILURE */
+  if (ret_code < 0)
+    return IW_API_FAILURE;
+
+  /* Got the basic info, now set essid and set info. */
+  if (modeStr != NULL)
+  {
+    /* loop through the modes in the allowed strings and match one or none */
+    int i = 0, winner = 0;
+
+    /* XXX -- BROKEN!  There is no definition for the max index of the modes array.
+     * Since the string is external, we can't do any fun tricks either.  SO for now,
+     * I have just listed the maximum mode as IW_MODE_SECOND -- yucky, I do not like.
+     */
+    for (i = 0 ; i < IW_MODE_SECOND; i++)
+    {
+      if (strncasecmp(modeStr, iw_operation_mode[i], IW_MODE_STR_MAX) == 0)
+      {
+        /* We've got a winner. */
+        winner = TRUE;
+        info.has_mode = 1;
+        info.mode = i; /* these values map through the array to defines in linux/wireless.h */
+      }
+    }
+
+    if (winner == FALSE)
+      return IW_API_FAILURE;
+  }
+  else
+    return IW_API_FAILURE;
+
+  /* Now do the set. */
+  ret_code = iw_set_basic_config(g_iw_socket, iface, &info);
+
+  if (ret_code < 0)
+    return IW_API_FAILURE;
+  else
+    return IW_API_SUCCESS;
+}
+
+/* Gets/Sets the Frequency
+ * Frequencies are of the form "nnn.nnnn"  (Depriciated, use channels)
+ * Get returns: Frequency float in string form, NULL upon failure
+ * Set Returns: 0 (IW_API_SUCCESS) for success, 1 (IW_API_FAILURE) for error.
+ */
+unsigned char *get_frequency(unsigned char *iface)
+{
+  int ret_code = 0;
+  wireless_config info;
+  unsigned char *ret_val;
+
+  /* Make sure we've got init. */
+  if (g_iw_api_init != TRUE)
+    iw_api_init();
+
+  ret_code = iw_get_basic_config(g_iw_socket, iface, &info);
+
+  /* If we've failed, return IW_API_FAILURE */
+  if (ret_code < 0)
+    return NULL;
+
+  if (!info.has_freq)
+    return NULL;
+
+  /* malloc and copy a string out. */
+  ret_val = malloc((sizeof(float) * 4) + 1);
+
+  if (ret_val == NULL)
+    return NULL;
+
+  /* print to the string. */
+  if(info.freq < KILO)
+    sprintf(ret_val, "%g", info.freq);
+  else
+  {
+    if(info.freq >= GIGA)
+      sprintf(ret_val, "%gGHz", info.freq / GIGA);
+    else
+    {
+      if(info.freq >= MEGA)
+        sprintf(ret_val, "%gMHz", info.freq / MEGA);
+      else
+        sprintf(ret_val, "%gkHz", info.freq / KILO);
+    }
+  }
+  return ret_val;
+}
+
+unsigned int set_frequency(unsigned char *iface, double freq)
+{
+  int ret_code = 0;
+  wireless_config info;
+
+  /* Make sure we've got init. */
+  if (g_iw_api_init != TRUE)
+    iw_api_init();
+
+  ret_code = iw_get_basic_config(g_iw_socket, iface, &info);
+
+  /* If we've failed, return IW_API_FAILURE */
+  if (ret_code < 0)
+    return IW_API_FAILURE;
+
+  /* Got the basic info, now set freq and set info. */
+  if (freq > 0)
+  {
+    /* Yes, I know.  No one SHOULD pass a channel to a freq call, or a
+     * freq to a channel call, but it inevitabley will happen.  So make sure
+     * that both calls can handle both types.
+     */
+
+    info.has_freq = 1;  /* No docs on this, just followed examples */
+    iw_float2freq(freq, (iwfreq *)&(info.freq));
+  }
+  /* implicit else
+   * set frequncy to auto selected, do nothing.  this will happen
+   * automatically if none is specified.
+   */
+
+  /* Now do the set. */
+  ret_code = iw_set_basic_config(g_iw_socket, iface, &info);
+
+  if (ret_code < 0)
+    return IW_API_FAILURE;
+  else
+    return IW_API_SUCCESS;
+}
+
+/* Gets/Sets the Channel
+ * Get returns: Integer as a string of the channel, NULL upon failure.
+ * Set Returns: 0 (IW_API_SUCCESS) for success, 1 (IW_API_FAILURE) for error.
+ */
+unsigned char *get_channel(unsigned char *iface)
+{
+  int ret_code = 0;
+  wireless_config info;
+  unsigned char *ret_val;
+
+  /* Make sure we've got init. */
+  if (g_iw_api_init != TRUE)
+    iw_api_init();
+
+  ret_code = iw_get_basic_config(g_iw_socket, iface, &info);
+
+  /* If we've failed, return IW_API_FAILURE */
+  if (ret_code < 0)
+    return NULL;
+
+  if (!info.has_freq)
+    return NULL;
+
+  /* malloc and copy a string out. */
+  ret_val = malloc((sizeof(float) * 4) + 1);
+
+  if (ret_val == NULL)
+    return NULL;
+
+  /* print to the string. */
+  if(info.freq < KILO)
+    sprintf(ret_val, "%g", info.freq);
+  else
+  {
+    if(info.freq >= GIGA)
+      sprintf(ret_val, "%gGHz", info.freq / GIGA);
+    else
+    {
+      if(info.freq >= MEGA)
+        sprintf(ret_val, "%gMHz", info.freq / MEGA);
+      else
+        sprintf(ret_val, "%gkHz", info.freq / KILO);
+    }
+  }
+
+  return ret_val;
+}
+
+unsigned int set_channel(unsigned char *iface, unsigned char *channel_str)
+{
+  int ret_code = 0;
+  wireless_config info;
+
+  /* Make sure we've got init. */
+  if (g_iw_api_init != TRUE)
+    iw_api_init();
+
+  ret_code = iw_get_basic_config(g_iw_socket, iface, &info);
+
+  /* If we've failed, return IW_API_FAILURE */
+  if (ret_code < 0)
+    return IW_API_FAILURE;
+
+  /* Got the basic info, now set essid and set info. */
+  if (channel_str != NULL)
+  {
+    /* Yes, I know.  No one SHOULD pass a channel to a freq call, or a
+     * freq to a channel call, but it inevitabley will happen.  So make sure
+     * that both calls can handle both types.
+     */
+    double freq = 0.0;
+
+    info.has_freq = 1;  /* No docs on this, just followed examples */
+
+    if(sscanf(channel_str, "%lg", &(freq)) != 1)
+      return IW_API_FAILURE;
+
+    if(index(channel_str, 'G'))
+      freq *= GIGA;
+    if(index(channel_str, 'M'))
+      freq *= MEGA;
+    if(index(channel_str, 'k'))
+      freq *= KILO;
+
+    iw_float2freq(freq, (iwfreq *)&(info.freq));
+  }
+  else
+    return IW_API_FAILURE;
+  /* Now do the set. */
+  ret_code = iw_set_basic_config(g_iw_socket, iface, &info);
+
+  if (ret_code < 0)
+    return IW_API_FAILURE;
+  else
+    return IW_API_SUCCESS;
+}
+
+/* Gets/Sets the encryption keys.
+ * Valid values: Packed Binary String of the form NNNN-NNNN-NN (56/40 bit),
+ * or NNNN-NNNN-NNNN-NNNN-NNNN-NNNN-NN (128 bit key)
+ * Get returns: Key in string form (only if root), or NULL upon failure.
+ * Set Returns: 0 (IW_API_SUCCESS) for success, 1 (IW_API_FAILURE) for error.
+ */
+ 
+unsigned char *get_encryption(unsigned char *iface)
+{
+  int ret_code = 0;
+  wireless_config info;
+  unsigned char *ret_val;
+
+  /* Make sure we've got init. */
+  if (g_iw_api_init != TRUE)
+    iw_api_init();
+
+  ret_code = iw_get_basic_config(g_iw_socket, iface, &info);
+
+  /* If we've failed, return IW_API_FAILURE */
+  if (ret_code < 0)
+    return NULL;
+
+  /* malloc and copy a string out. */
+  /* size = max binary size * 2 chars per hex digit + 1 null */
+  ret_val = malloc(IW_ENCODING_TOKEN_MAX + 1);
+
+  if (ret_val == NULL)
+    return NULL;
+
+  /* copy in the string. */
+  if (!info.has_key)
+  {
+    if (ret_val)
+      free (ret_val);
+    return NULL;
+  }
+  else
+  {
+    memcpy( ret_val, info.key, info.key_size);
+    return ret_val;
+  }
+}
+
+unsigned int set_encryption(unsigned char *iface, unsigned char *encryption_str, unsigned int key_index)
+{
+  int ret_code = 0, keylen = 0;
+  unsigned char key[IW_ENCODING_TOKEN_MAX];
+  struct iwreq  wrq;
+
+  /* Make sure we've got init. */
+  if (g_iw_api_init != TRUE)
+    iw_api_init();
+
+  /* Slear the structure */
+  memset( &wrq, 0, sizeof(struct iwreq));
+
+  /* If we've failed, return IW_API_FAILURE */
+  if (ret_code < 0)
+    return IW_API_FAILURE;
+
+  if (encryption_str[0] == '\0')
+  {
+    /* set to disabled */
+    wrq.u.data.flags |= IW_ENCODE_DISABLED;
+  }
+  else
+  {
+    keylen = iw_in_key(encryption_str, key);
+    if(keylen > 0)
+    {
+      wrq.u.data.length = keylen;
+      wrq.u.data.pointer = (caddr_t) key;
+      if ((key_index > 0) && (key_index < IW_ENCODE_INDEX))
+      {
+        wrq.u.encoding.flags |= key_index;
+      }
+    }
+  }
+
+  /* Now do the set. */
+  ret_code = iw_set_ext(g_iw_socket, iface, SIOCSIWENCODE, &wrq);
+
+  if (ret_code < 0)
+    return IW_API_FAILURE;
+  else
+    return IW_API_SUCCESS;
+}
+
+/* Get the power level of the card.
+ * 
+ */
+unsigned int get_signal_strength(unsigned char *iface)
+{
+  iwstats         stats;
+  iwrange         range;
+  iwqual          *qual;
+  int             has_range, has_stats, quality;
+
+  if (g_iw_api_init != TRUE)
+    iw_api_init();
+
+  /* If we don't have stats, we can't figure out signal quality. */
+  has_stats = iw_get_stats(g_iw_socket, iface, &(stats));
+  if (has_stats >= 0)
+    has_stats = TRUE;
+  else
+    return 0;
+
+  has_range = iw_get_range_info(g_iw_socket, iface, &(range));
+  if (has_range >= 0)
+    has_range = TRUE;
+  else
+    has_range = FALSE;
+
+  qual = &stats.qual;
+  /* all's well.  Calcualte and return information */
+  stats.qual.updated = 0x0;   /* Not that reliable, disable */
+  
+  /* Just do it */
+  if(has_range && (qual->level != 0))
+  {
+    /* If the statistics are in dBm */
+    if(qual->level > range.max_qual.level)
+    {
+      /* Statistics are in dBm (absolute power measurement) */
+      /* calcualte percentage */
+      quality = ((float) qual->qual / (float) range.max_qual.qual) * (float) 100.0;
+    }
+    else
+    {
+      /* Statistics are relative values (0 -> max) */
+      /* calculate percentage */
+      quality = ((float) qual->qual / (float) range.max_qual.qual) * (float) 100.0;
+    }
+  }
+  else
+  {
+    /* We can't read the range, so we don't know...
+     * Ugly.  We map numbers from 0 to 100 here.  No need to check fo rnegative, unsigned int in qual->qual
+     * No better way of doing this without implementing a sliding scale based on historical signal quality.
+     * There must be a simple and good way to do this...
+     */
+     
+    if (qual->qual > 100)
+      quality = 100;
+    else
+      quality = qual->qual;
+  }
+
+  return (unsigned int)quality;
+
+}
+
+/* Commit the changes to the configuration.  Most of the time this is
+ * not needed, but we should call it anyway in order to activate changes
+ * on drivers which need it.
+ * Returns: 0 (IW_API_SUCCESS) for success, 1 (IW_API_FAILURE) for error.
+ */
+unsigned int wapi_commit(unsigned char *iface)
+{
+  struct  iwreq   wrq;
+  int             ret_code = 0;
+  
+  memset(&wrq, 0, sizeof(struct iwreq));
+  
+  if (g_iw_api_init != TRUE)
+    iw_api_init();
+
+  /* Execute the commit.  No arguments, just a placeholder iwreq */
+  ret_code = iw_set_ext(g_iw_socket, iface, SIOCSIWCOMMIT, &wrq);
+
+  if (ret_code < 0)
+    return IW_API_FAILURE;
+  else
+    return IW_API_SUCCESS;
+}
+
+
+/* Retrieves a list of access points available
+ * returns: Array of access points, or NULL upon failure.
+ * Inputs: unsigned char
+ */
+
+AP_type **get_ap_list(unsigned char *iface)
+{
+
+  struct iwreq          wrq;
+  unsigned char         buffer[IW_SCAN_MAX_DATA];       /* Results */
+  struct timeval        tv;                             /* Select timeout */
+  int                   timeout = 5000000;              /* 5s */
+
+  if (g_iw_api_init != TRUE)
+    iw_api_init();
+
+
+  if (iface == NULL)
+  {
+    return NULL;
+  }
+
+  /* Init timeout value -> 250ms*/
+  tv.tv_sec = 0;
+  tv.tv_usec = 250000;
+
+  /* Default scan type (client only for this app) */
+  wrq.u.param.flags = IW_SCAN_DEFAULT;
+  wrq.u.param.value = 0;                /* Later */
+
+  /* Initiate Scanning */
+  if(iw_set_ext(g_iw_socket, iface, SIOCSIWSCAN, &wrq) < 0)
+  {
+    if(errno != EPERM)
+    {
+      /* Scanning is not supported on this interface */
+      return(NULL);
+    }
+    tv.tv_usec = 0;
+  }
+  timeout -= tv.tv_usec;
+
+  while(1)
+  {
+    fd_set            rfds;           /* File descriptors for select */
+    int               last_fd;        /* Last fd */
+    int               ret;
+
+    /* Guess what ? We must re-generate rfds each time */
+    FD_ZERO(&rfds);
+    last_fd = -1;
+
+    /* In here, add the rtnetlink fd in the list */
+
+    /* Wait until something happens */
+    ret = select(last_fd + 1, &rfds, NULL, NULL, &tv);
+
+    /* Check if there was an error */
+    if(ret < 0)
+    {
+      if(errno == EAGAIN || errno == EINTR)
+        continue;
+      return(NULL);
+    }
+
+    /* Check if there was a timeout */
+    if(ret == 0)
+    {
+      /* Try to read the results */
+      wrq.u.data.pointer = buffer;
+      wrq.u.data.flags = 0;
+      wrq.u.data.length = sizeof(buffer);
+      if(iw_get_ext(g_iw_socket, iface, SIOCGIWSCAN, &wrq) < 0)
+      {
+        /* Check if results not available yet */
+        if(errno == EAGAIN)
+        {
+          /* Restart timer for only 100ms */
+          tv.tv_sec = 0;
+          tv.tv_usec = 100000;
+          timeout -= tv.tv_usec;
+          if(timeout > 0)
+            continue;   /* Try again later */
+        }
+        /* Bad error */
+        return(NULL);
+      }
+      else
+        /* We have the results, go to process them */
+        break;
+    }
+
+  }
+
+  if(wrq.u.data.length)
+  {
+    struct iw_event           iwe;
+    struct stream_descr       stream;
+    int                       ret;
+    struct iw_range           range;
+    int                       has_range;
+    AP_type                 **ap_return_list = NULL;
+    signed int              return_index = -1;
+
+
+    /* Allocate room for IW_MAX_APS access points. */
+    ap_return_list = malloc(IW_MAX_APS * sizeof(AP_type));
+
+    memset( ap_return_list, 0, (IW_MAX_APS * sizeof(AP_type)) );
+
+    /* Pull range data if it's present. */
+    has_range = (iw_get_range_info(g_iw_socket, iface, &range) >= 0);
+
+    /* Start the event strem to read from the hardware */
+    iw_init_event_stream(&stream, buffer, wrq.u.data.length);
+    do
+    {
+      /* Extract an event and store it */
+      ret = iw_extract_event_stream(&stream, &iwe);
+      if(ret > 0)
+      {
+        /* Check the return code for a new AP cell header.  If found, bump
+         * the counter and malloc a new structure for the ap data. 
+         */
+
+        if (iwe.cmd == SIOCGIWAP)
+        {
+          /* bump the return_index */
+          return_index++;
+          ap_return_list[return_index] = malloc (sizeof(AP_type));
+          /* Clear the structure for use. */
+          memset( ap_return_list[return_index], 0, sizeof(AP_type));
+
+          /* Capture the dest mac_id. */
+          memcpy( &ap_return_list[return_index]->mac_id, iwe.u.ap_addr.sa_data, sizeof(struct ether_addr));
+        }
+        else
+        {
+          /* Catch any stray tokens at the onset of the barrage. */
+          if (return_index < 0)
+            continue;
+          switch(iwe.cmd)
+          {
+
+          case SIOCGIWESSID:  /* ESSID */
+            if((iwe.u.essid.pointer) && (iwe.u.essid.length))
+            {
+              memcpy(ap_return_list[return_index]->essid, iwe.u.essid.pointer, iwe.u.essid.length);
+              ap_return_list[return_index]->essid[iwe.u.essid.length] = '\0';
+            }
+            else
+              strncpy(ap_return_list[return_index]->essid, "Off", 4);
+            break;
+
+          case SIOCGIWFREQ: /* Frequency */
+            ap_return_list[return_index]->frequency =  iw_freq2float(&(iwe.u.freq));
+            break;
+
+          case SIOCGIWMODE: /* AP Mode */
+            strncpy(ap_return_list[return_index]->mode, iw_operation_mode[iwe.u.mode], IW_MODE_STR_MAX);
+            break;
+
+          case SIOCGIWENCODE: /* Encryption */
+            {
+              /* If we've got key, copy it in. */
+              if(iwe.u.data.pointer)
+              {
+                if (iwe.u.data.length == 5)
+                {
+                  ap_return_list[return_index]->encryption_present = IW_ENCRYPTION_40_BIT;
+                  memcpy(ap_return_list[return_index]->encryption_key, iwe.u.essid.pointer, 5);
+                }
+                else if (iwe.u.data.length == 16)
+                {
+                  ap_return_list[return_index]->encryption_present = IW_ENCRYPTION_128_BIT;
+                  memcpy(ap_return_list[return_index]->encryption_key, iwe.u.essid.pointer, 16);
+                }
+                else if (iwe.u.data.length == 32)
+                {
+                  ap_return_list[return_index]->encryption_present = IW_ENCRYPTION_256_BIT;
+                  memcpy(ap_return_list[return_index]->encryption_key, iwe.u.essid.pointer, 32);
+                }
+                else
+                {
+                  ap_return_list[return_index]->encryption_present = IW_ENCRYPTION_NO_DATA;
+                  memset(ap_return_list[return_index]->encryption_key, 0, IW_ENCODING_TOKEN_MAX);
+                  iwe.u.data.flags |= IW_ENCODE_NOKEY;
+                }
+              }
+              else
+              {
+                /* If we've got nothing, null the keyspace (no leftovers please). */
+                memset(ap_return_list[return_index]->encryption_key, 0, IW_ENCODING_TOKEN_MAX);
+                iwe.u.data.flags |= IW_ENCODE_NOKEY;
+              }
+
+              if(iwe.u.data.flags & IW_ENCODE_DISABLED)
+              {
+                ap_return_list[return_index]->encryption_present = IW_ENCRYPTION_NONE;
+              }
+              else
+              {
+                /* Other info... */
+                if((iwe.u.data.flags & IW_ENCODE_INDEX) >= 1)
+                  ap_return_list[return_index]->key_number = iwe.u.data.flags & IW_ENCODE_INDEX;
+                else
+                  ap_return_list[return_index]->key_number = 0;
+
+                if(iwe.u.data.flags & IW_ENCODE_RESTRICTED)
+                  ap_return_list[return_index]->encode_mode = IW_SEC_MODE_RESTRICTED;
+                if(iwe.u.data.flags & IW_ENCODE_OPEN)
+                  ap_return_list[return_index]->encode_mode = IW_SEC_MODE_OPEN;
+              }
+            }
+            break;
+          case IWEVQUAL:
+            {
+              iwqual     *qual = NULL;
+              int             has_range = 0, quality = 0;
+
+              iwe.u.qual.updated = 0x0;    /* Not that reliable, disable */
+              qual = &iwe.u.qual;
+
+              if (has_range >= 0)
+                has_range = TRUE;
+              else
+                has_range = FALSE;
+
+              if(has_range && (qual->level != 0))
+              {
+                quality = qual->level / 4;
+              }
+              else
+              {
+                /* We can't read the range, so we don't know... */
+                /* Ugly.  We map numbers from 0 to 100 here.  No need to check fo rnegative, unsigned int in qual->qual
+                 * No better way of doing this without implementing a sliding scale based on historical signal quality.
+                 * There must be a simple and good way to do this...
+                 */
+                if (qual->qual > 100)
+                  quality = 100;
+                else
+                  quality = qual->qual;
+              }
+              ap_return_list[return_index]->signal_strength = (unsigned int)quality;
+            }
+            break;
+          default:
+            break;
+          }
+        }
+      }
+    }
+    while(ret > 0)
+      ;
+
+    /* Do the happy dance, we've got results. */
+    return ap_return_list;
+
+  }
+  else
+  {
+    /* No scan results, return nothing/error */
+    return (NULL);
+  }
+
+
+  /* Failure.  Return null. */
+  return NULL;
+}
+
diff -Nru gnome-netstatus/src/wireless-api.h gnome-netstatus.hacked/src/wireless-api.h
--- gnome-netstatus/src/wireless-api.h	1969-12-31 19:00:00.000000000 -0500
+++ gnome-netstatus.hacked/src/wireless-api.h	2004-06-21 17:03:39.188266128 -0400
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2004 Sun Microsystems, 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 2 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Authors:
+ *      Mark Carey <mark.carey@sun.com>
+ *
+ */
+
+
+#ifndef __WIRELESS_API_H__
+#define __WIRELESS_API_H__
+
+/* Definitions */
+/* General case success and failure definitions */
+#define IW_API_SUCCESS  (0)
+#define IW_API_FAILURE  (1)
+
+/* Maximum length of 30 characters. */
+#define IW_MODE_STR_MAX (30)
+
+/* Encryption classes for AP_type.encryptionPresent */
+#define IW_ENCRYPTION_NONE    (0)
+#define IW_ENCRYPTION_40_BIT  (1)
+#define IW_ENCRYPTION_128_BIT (2)
+#define IW_ENCRYPTION_256_BIT (3)
+#define IW_ENCRYPTION_NO_DATA (4)
+
+/* Encoding modes */
+#define IW_SEC_MODE_RESTRICTED (1)
+#define IW_SEC_MODE_OPEN       (2)
+
+
+/* Gets/Sets the ESSID value from the interface.
+ * Get returns: String name of ESSID upon success, NULL upon failure.
+ * Set Returns: 0 (IW_API_SUCCESS) for success, 1 (IW_API_FAILURE) for error.
+ */
+unsigned char *get_essid(unsigned char *iface);
+unsigned int set_essid(unsigned char *iface, unsigned char *essid_str);
+
+
+/* Gets/Sets the Mode
+ * Valid modes are: auto, managed, master, ad-hoc, repeater, secondary, monitor
+ * Get returns: Mode string as described above, NULL upon failure.
+ * Set Returns: 0 (IW_API_SUCCESS) for success, 1 (IW_API_FAILURE) for error.
+ */
+unsigned char *get_mode(unsigned char *iface);
+unsigned int set_mode(unsigned char *iface, unsigned char *mode_str);
+
+/* Gets/Sets the Frequency
+ * Frequencies are of the form "nnn.nnnn"  (Depriciated, use channels)
+ * Get returns: Frequency float in string form, NULL upon failure
+ * Set Returns: 0 (IW_API_SUCCESS) for success, 1 (IW_API_FAILURE) for error.
+ */
+unsigned char *get_frequency(unsigned char *iface);
+unsigned int set_frequency(unsigned char *iface, double freq);
+
+/* Gets/Sets the Channel
+ * Get returns: Integer as a string of the channel, NULL upon failure.
+ * Set Returns: 0 (IW_API_SUCCESS) for success, 1 (IW_API_FAILURE) for error.
+ */
+unsigned char *get_channel(unsigned char *iface);
+unsigned int set_channel(unsigned char *iface, unsigned char *channel_str);
+
+/* Gets/Sets the encryption keys.
+ * Valid values: Packed Binary String of the form NNNN-NNNN-NN (56/40 bit),
+ * or NNNN-NNNN-NNNN-NNNN-NNNN-NNNN-NN (128 bit key)
+ * Get returns: Key in string form (only if root), or NULL upon failure.
+ * Set Returns: 0 (IW_API_SUCCESS) for success, 1 (IW_API_FAILURE) for error.
+ */
+unsigned char *get_encryption(unsigned char *iface);
+unsigned int set_encryption(unsigned char *iface, unsigned char *encryption_str, unsigned int key_index);
+
+/* Returns the signal quality as a integer percentage (0-100)
+ * Inputs: Interface name as a string.
+ */
+unsigned int get_signal_strength(unsigned char *iface);
+
+
+/* Commit the changes to the configuration.  Most of the time this is
+ * not needed, but we should call it anyway in order to activate changes
+ * on drivers which need it. (New in Wireless Extensions >= 19?)
+ * Returns: 0 (IW_API_SUCCESS) for success, 1 (IW_API_FAILURE) for error.
+ */
+unsigned int wapi_commit(unsigned char *iface);
+
+
+/* Scanning for access points results structure */
+
+typedef struct _APStructure {
+  char              essid[IW_ESSID_MAX_SIZE+1];
+  float             frequency;
+  char              mode[IW_MODE_STR_MAX+1];
+  struct ether_addr mac_id;
+  unsigned int      encryption_present;
+  char              encryption_key[IW_ENCODING_TOKEN_MAX+1];
+  unsigned int      key_number;
+  unsigned int      encode_mode;
+  unsigned int      signal_strength; /* As an integer percentage */
+} AP_type;
+
+/* Retrieves a list of access points available
+ * returns: Array of access points, or NULL upon failure.
+ * Inputs: unsigned char
+ */
+
+AP_type **get_ap_list(unsigned char *iface);
+
+#endif
