Check-in [2203405fe9]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

SHA1 Hash:2203405fe9b4bdec73c9ed69fa4e5995bce9f452
Date: 2012-01-07 04:33:00
User: BarryK
Comment:Simple Network Setup now has profiles management in main window

Tags And Properties
Changes

Changes to woof-code/rootfs-skeleton/usr/local/simple_network_setup/help_security

@@ -1,8 +1,11 @@
 #!/bin/sh
 
-export WIN_DLG="<window title=\"SNS: Help on security\" icon-name=\"gtk-network\">
+GTKDIALOGEXE="gtkdialog"
+[ "`which gtkdialog4`" ] && GTKDIALOGEXE="gtkdialog4"
+
+export SNS_HELP1_DLG="<window title=\"SNS: Help on security\" icon-name=\"gtk-network\" resizable=\"false\">
 <vbox>
 <text use-markup=\"true\"><label>\"<b>No security</b>
 The wireless network is not encrypted, so anybody can access it. Some wireless routers are setup for MAC Address filtering, restricting which clients can access, so this is a form of security for an un-encrypted network.
 There is no need to type any 'Key' as it is not used.\"</label></text>
 <text use-markup=\"true\"><label>\"<b>WEP</b>
@@ -9,12 +12,12 @@
 This is an 'older' method of encryption that is less secure than WPA. Basically, it is a case of 'the weakest link in the chain' -- if any client on the network supports only WEP then all clients must use WEP (and the wireless router must be set to WEP).
 The 'Key' must be a hexadecimal number (composed of the digits 0-9 and a-f) and either 13 or 26 digits long.\"</label></text>
 <text use-markup=\"true\"><label>\"<b>WPA</b>
 This is more secure than WEP and is the recommended choice if your router and Linux driver supports it. There are ctually two types WPA and WPA2, but ticking the 'WPA' radiobutton will use whichever of these is available. Also, there are two encryption management schemes, known as 'TKIP' and 'AES' -- again, whichever is available will be automatically used.
 The 'Key' (sometimes known as the 'passphrase' or 'password') can be composed of any numerical or alphanumeric characters, from 8 to 63 characters long (even spaces are allowed)\"</label></text>
-<text><label>\"  \"</label></text>
+
 </vbox>
 </window>"
 
-gtkdialog3 --program=WIN_DLG
+${GTKDIALOGEXE} --program=SNS_HELP1_DLG
 
 ###END###

Changes to woof-code/rootfs-skeleton/usr/local/simple_network_setup/rc.network

@@ -11,11 +11,10 @@
 #100703 fix disconnect/reconnect.
 #100804 while testing for module loaded, also test for valid macaddress.
 #101122 wait for module to load.
 #101216 more logging, to /tmp/simple_network_setup.
 #110203 improve scanning.
-#120104 try longer wait for modules to load and interface to become available (12 to 16 seconds).
 
 #each line of /etc/simple_network_setup/connections has everything known about a connection:
 #(please ignore spaces, put here for readability only)
 #Wireless:
 #        1         2          3         4       5                                   6                 7           8                 9            10           11                 12         13                         14       15         16          17
@@ -67,11 +66,11 @@
  while [ 1 ];do #101122 wait for module to load.
   [ "`lsmod  | grep -v '^Module' | cut -f 1 -d ' ' | grep "$oPATTERN"`" != "" ] && break
   [ "`echo "$TESTLIST" | grep "$mPATTERN"`" != "" ] && continue 2 #avoid re-waiting on same module
   sleep 1
   WAITCNT=$(($WAITCNT + 1))
-  [ $WAITCNT -gt 12 ] && continue 2 #no module loaded. 120104 8 to 12.
+  [ $WAITCNT -gt 8 ] && continue 2 #no module loaded.
  done
  MACADDRESSES="`grep "$mPATTERN" /etc/simple_network_setup/connections | cut -f 6 -d '|' | sort -u | tr '\n' ' '`" #100804
  for MACADDRESS in $MACADDRESSES #100804
  do
   while [ 1 ];do
@@ -82,11 +81,11 @@
     MACMATCH="`grep "$mPATTERN" /etc/simple_network_setup/connections | grep "$macPATTERN"`"
     [ "$MACMATCH" ] && echo "$MACMATCH" >> /tmp/sns_connections_available
     break
    fi
    WAITCNT=`expr $WAITCNT + 1`
-   [ $WAITCNT -gt 16 ] && break 2 #timeout. 120104 12 to 16.
+   [ $WAITCNT -gt 12 ] && break 2 #timeout.
    sleep 1
   done
  done
 done
 

Changes to woof-code/rootfs-skeleton/usr/local/simple_network_setup/sns

@@ -19,10 +19,11 @@
 #100703 extra flush seems to be needed when release interface.
 #101029 fix when no wireless networks found.
 #101118 bugfix, so network-disconnect works.
 #110203 improve scanning.
 #110505 support sudo for non-root user.
+#120107 gtkdialog3 to gtkdialog4, new 'Profile' frame in main window, new profiles help window.
 
 [ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505
 
 #each line of /etc/simple_network_setup/connections has everything known about a connection:
 #(please ignore spaces, put here for readability only)
@@ -39,10 +40,13 @@
 #IF_NUM=`ifconfig -a | grep -Fc 'Link encap:Ethernet'`
 #if [ $IF_NUM -eq 0 ];then
 # xmessage -center -bg red "SORRY, CANNOT FIND ANY NETWORK INTERFACES"
 # exit
 #fi
+
+GTKDIALOGEXE="gtkdialog"
+[ "`which gtkdialog4`" ] && GTKDIALOGEXE="gtkdialog4"
 
 BIGGESTCNT=0
 echo -n '' > /tmp/sns_interfaces
 INTERFACES="`ifconfig -a | grep -F 'Link encap:Ethernet' | cut -f1 -d' ' | tr '\n' ' '`"
 for INTERFACE in $INTERFACES #exs: wlan0 eth0
@@ -149,47 +153,88 @@
   <button><label>Windows</label><action type=\"exit\">Interface_Windows</action></button>"
 fi
 
 #   <text><label>Find out stuff about what is currently working (if anything)</label></text>
 
+#120107 new 'Profile' frame...
+PROFILE_XML=""
+echo "<b>Interface</b>" >/tmp/sns_I_P;  echo "<b>Type</b>" >/tmp/sns_T_P; echo "<b>Driver</b>" >/tmp/sns_D_P; echo "<b>Bus</b>" >/tmp/sns_B_P; echo "<b>Hardware</b>" >/tmp/sns_M_P; echo "" >/tmp/sns_S_P; echo "" >/tmp/sns_DEL_BTN; echo "" >/tmp/sns_CNT_P; echo "<b>Security</b>" >/tmp/sns_SEC_P
+if [ -s /etc/simple_network_setup/connections ];then
+ CNT=0
+ [ "grep '|Wireless|' /etc/simple_network_setup/connections" != "" ] && echo "<b>Network</b>" >/tmp/sns_S_P
+ cat /etc/simple_network_setup/connections |
+ while read ONECONNECTION
+ do
+  CNT=$(($CNT + 1))
+  echo "<b>$CNT</b>" >> /tmp/sns_CNT_P
+  INTERFACE_P="`echo -n "$ONECONNECTION" | cut -f 1 -d '|'`"
+  echo "$INTERFACE_P" >> /tmp/sns_I_P
+  TYPE_P="`echo -n "$ONECONNECTION" | cut -f 2 -d '|'`"
+  echo "$TYPE_P" >> /tmp/sns_T_P
+  DRIVER_P="`echo -n "$ONECONNECTION" | cut -f 3 -d '|'`"
+  echo "$DRIVER_P" >> /tmp/sns_D_P
+  BUS_P="`echo -n "$ONECONNECTION" | cut -f 4 -d '|'`"
+  echo "$BUS_P" >> /tmp/sns_B_P
+  MAC_P="`echo -n "$ONECONNECTION" | cut -f 6 -d '|'`"
+  echo "$MAC_P" >> /tmp/sns_M_P
+  if [ "$TYPE_P" = "Wireless" ];then
+   SSID_P="`echo -n "$ONECONNECTION" | cut -f 12 -d '|'`"
+   echo "$SSID_P" >> /tmp/sns_S_P
+   SEC_P="`echo -n "$ONECONNECTION" | cut -f 14 -d '|'`"
+   [ "$SEC_P" = "" ] && SEC_P="none"
+   echo "$SEC_P" >> /tmp/sns_SEC_P
+  else
+   echo "" >> /tmp/sns_S_P
+   echo "" >> /tmp/sns_SEC_P
+  fi
+  if [ $CNT -gt 12 ];then
+   echo "<i>more...</i>"  >> /tmp/sns_I_P
+   break
+  fi
+  echo "<button><label>${CNT}</label><action>grep -v '${ONECONNECTION}' /etc/simple_network_setup/connections > /tmp/sns_action1</action><action>mv -f /tmp/sns_action1 /etc/simple_network_setup/connections</action><action type=\"exit\">EXITRESTART></action></button>" >> /tmp/sns_DEL_BTN
+ done
+ if [ "$FLAGINTERNETSTATUS" = "yes" ];then
+  CONNECTBTN_XML="<button><label>DISCONNECT NOW</label><action>/usr/sbin/networkdisconnect</action><action type=\"exit\">EXITNOW</action></button>"
+ else
+  CONNECTBTN_XML="<button><label>CONNECT NOW</label><action>/usr/sbin/networkdisconnect</action><action>/usr/local/simple_network_setup/rc.network start</action><action>sleep 1</action><action type=\"exit\">EXITNOW</action></button>"
+ fi
+ PROFILE_XML="<frame Profiles>
+ <text><label>Connection profiles have previously been created with SNS. These are:</label></text>
+ <hbox spacing=\"10\"><text use-markup=\"true\"><label>\"`cat /tmp/sns_CNT_P`\"</label></text><text use-markup=\"true\"><label>\"`cat /tmp/sns_I_P`\"</label></text><text use-markup=\"true\"><label>\"`cat /tmp/sns_T_P`\"</label></text><text use-markup=\"true\"><label>\"`cat /tmp/sns_D_P`\"</label></text><text use-markup=\"true\"><label>\"`cat /tmp/sns_B_P`\"</label></text><text use-markup=\"true\"><label>\"`cat /tmp/sns_M_P`\"</label></text><text use-markup=\"true\"><label>\"`cat /tmp/sns_S_P`\"</label></text><text use-markup=\"true\"><label>\"`cat /tmp/sns_SEC_P`\"</label></text></hbox>
+ <hbox><text><label>Delete:</label></text>`cat /tmp/sns_DEL_BTN`
+   <text><label>\"          \"</label></text>
+   ${CONNECTBTN_XML}
+   <hbox><button><input file>/usr/local/lib/X11/mini-icons/mini-question.xpm</input><action>/usr/local/simple_network_setup/help_profiles & </action></button></hbox>
+ </hbox>
+</frame>"
+fi
+
 #bring up the main window...
-export WIN1_DLG="<window title=\"Simple Network Setup\" icon-name=\"gtk-network\">
+export WIN1_DLG="<window title=\"Simple Network Setup\" icon-name=\"gtk-network\" resizable=\"false\">
  <vbox>
  <text use-markup=\"true\"><label>\"<b>Welcome to Barry's Simple Network Setup!</b>\"</label></text>
  <frame Current status>
    ${MSGSTATUS}
    <hbox>
      <text><label>Detailed network interface Information:</label></text>
      <button><input file>/usr/local/lib/X11/mini-icons/info16.xpm</input><action>ipinfo & </action></button>
    </hbox>
  </frame>
+ ${PROFILE_XML}
  <frame Interfaces>
    ${CLICKMSG}
    ${INTERFACEDESCR}
    <hbox>${INTERFACEBUTTONS}</hbox>
  </frame>
  </vbox>
 </window>"
 
-#need to set window width, as gtkdialog gets it wrong...
-WINWIDTH=546
-CHARWIDTH=8
-XFTDPI=`grep '^Xft.dpi:' /root/.Xresources | tr '\t' ' ' | tr -s ' ' | cut -f 2 -d ' '`
-if [ $XFTDPI ];then
- WINWIDTH=`expr $XFTDPI \* 7` #78*7 = 546
- CHARWIDTH=`expr $XFTDPI \/ 9` #78/9 = 8
-fi
-if [ $BIGGESTCNT -gt 45 ];then
- WIDTHEXTRA=`expr $BIGGESTCNT - 45`
- WIDTHEXTRA=`expr $WIDTHEXTRA \* $CHARWIDTH`
- WINWIDTH=`expr $WINWIDTH + $WIDTHEXTRA`
-fi
-
-RETSTRING="`gtkdialog3 --geometry=${WINWIDTH}x0 --program=WIN1_DLG --center`" ###main window###
+RETSTRING="`${GTKDIALOGEXE} --program=WIN1_DLG --center`" ###main window###
 
 echo "$RETSTRING"
 EXIT="`echo "$RETSTRING" | grep '^EXIT' | cut -f2 -d'"'`" #'geany
+[ "`echo "$EXIT" | grep 'EXITRESTART'`" != "" ] && exec sns ###restarting sns###
 [ "`echo "$EXIT" | grep 'Interface'`" = "" ] && exit
 
 INTERFACE="`echo -n "$EXIT" | cut -f2 -d '_'`" #ex: wlan1
 
 if [ "$INTERFACE" == "Windows" ];then #100313
@@ -213,11 +258,11 @@
     <button ok></button>
     <button cancel></button>
   </hbox>
  </vbox>
  </window>"
- RETSTRND="`gtkdialog3 --program=NDISWRAPPER_DLG`"
+ RETSTRND="`${GTKDIALOGEXE} --program=NDISWRAPPER_DLG`"
  if [ "`echo "$RETSTRND" | grep '^EXIT' | grep 'OK'`" != "" ];then
   INFFILE="`echo "$RETSTRND" | grep '^INF_FILE_NAME' | cut -f 2 -d '"'`" #'geany
   case "$INFFILE" in
    *.[iI][nN][fF])
     FLAGND=""
@@ -361,11 +406,11 @@
     ${WIN2BUT1}
     <button><label>GO BACK TO MAIN WINDOW</label><action type=\"exit\">BUT_GOBACK</action></button>
    </hbox>
   </vbox>
   </window>"
-  RETSTRING="`gtkdialog3 --program=WIN2_DLG --center`"
+  RETSTRING="`${GTKDIALOGEXE} --program=WIN2_DLG --center`"
   [ "`echo "$RETSTRING" | grep '^EXIT' | grep 'BUT_GOBACK'`" != "" ] && exec sns
   [ "`echo "$RETSTRING" | grep '^EXIT' | grep 'BUT_CONNECT'`" == "" ] && exit
 
   SEC_MGMT=""; WPA_ENC=""
   SEC_KEY="`echo "$RETSTRING" | grep '^BOX_KEY' | cut -f 2 -d '"' | tr -d '-'`" #'geany
@@ -616,11 +661,11 @@
          <hbox>
           <button ok></button>
          </hbox>
         </vbox>
         </window>"
-        RETSTR3="`gtkdialog3 --program=WIN3_DLG --center`"
+        RETSTR3="`${GTKDIALOGEXE} --program=WIN3_DLG --center`"
         if [ "`echo "$RETSTR3" | grep '^CHK_SNSDEF' | grep 'true'`" != "" ];then
          echo -e '#!/bin/sh\nexec sns' > /usr/local/bin/defaultconnect
         else
          echo -e '#!/bin/sh\nexec connectwizard' > /usr/local/bin/defaultconnect
         fi
@@ -669,11 +714,11 @@
     <button><label>GO BACK TO MAIN WINDOW</label><action type=\"exit\">BUT_GOBACK</action></button>
     <button><label>QUIT</label><action type=\"exit\">BUT_QUIT</action></button>
    </hbox>
  </vbox>
 </window>"
-  RETSTRING="`gtkdialog3 --program=WIN3_DLG --center`"
+  RETSTRING="`${GTKDIALOGEXE} --program=WIN3_DLG --center`"
   [ "`echo "$RETSTRING" | grep '^EXIT' | grep 'BUT_GOBACK'`" != "" ] && exec sns
  fi
 
  exit
 fi #end test "$IF_INTTYPE" == "Wireless"
@@ -713,11 +758,11 @@
      <button><label>GO BACK TO MAIN WINDOW</label><action type=\"exit\">BUT_GOBACK</action></button>
      <button><label>QUIT</label><action type=\"exit\">BUT_QUIT</action></button>
     </hbox>
   </vbox>
  </window>"
-       RETSTRING="`gtkdialog3 --program=WIN4_DLG --center`"
+       RETSTRING="`${GTKDIALOGEXE} --program=WIN4_DLG --center`"
        [ "`echo "$RETSTRING" | grep '^EXIT' | grep 'BUT_GOBACK'`" != "" ] && exec sns
        exit
       fi
      fi
     fi
@@ -747,11 +792,11 @@
   <text><label>Recommend leave this checkbox ticked, so that Puppy will use SNS to automatically connect to the Internet at bootup. Also clicking the 'connect' icon on the desktop will immediately launch SNS...</label></text>
   <checkbox><label>Set SNS as default network setup tool</label><default>true</default><variable>CHK_SNSDEF</variable></checkbox>
   <hbox><button ok></button></hbox>
  </vbox>
 </window>"
-  RETSTR5="`gtkdialog3 --program=WIN5_DLG --center`"
+  RETSTR5="`${GTKDIALOGEXE} --program=WIN5_DLG --center`"
   if [ "`echo "$RETSTR5" | grep '^CHK_SNSDEF' | grep 'true'`" != "" ];then
    echo -e '#!/bin/sh\nexec sns' > /usr/local/bin/defaultconnect
   else
    echo -e '#!/bin/sh\nexec connectwizard' > /usr/local/bin/defaultconnect
   fi
@@ -780,12 +825,12 @@
     <button><label>GO BACK TO MAIN WINDOW</label><action type=\"exit\">BUT_GOBACK</action></button>
     <button><label>QUIT</label><action type=\"exit\">BUT_QUIT</action></button>
    </hbox>
  </vbox>
 </window>"
-  RETSTRING="`gtkdialog3 --program=WIN6_DLG --center`"
+  RETSTRING="`${GTKDIALOGEXE} --program=WIN6_DLG --center`"
   [ "`echo "$RETSTRING" | grep '^EXIT' | grep 'BUT_GOBACK'`" != "" ] && exec sns
  fi
  exit
 fi
 
 ###END###