wok-6.x rev 2274
tazndis: Add GUI interface (tazndisbox)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Wed Feb 18 16:27:01 2009 +0100 (2009-02-18) |
parents | 9229b32500c7 |
children | 10ef56b7f468 |
files | tazndis/stuff/applications/tazndisbox.desktop tazndis/stuff/tazndisbox |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tazndis/stuff/applications/tazndisbox.desktop Wed Feb 18 16:27:01 2009 +0100 1.3 @@ -0,0 +1,8 @@ 1.4 +[Desktop Entry] 1.5 +Encoding=UTF-8 1.6 +Name=Manage Windows drivers 1.7 +Name[fr]=Gestion de pilotes Windows 1.8 +Exec=subox tazndisbox 1.9 +Icon=/usr/share/icons/Tango/16x16/apps/system-installer.png 1.10 +Type=Application 1.11 +Categories=System;
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/tazndis/stuff/tazndisbox Wed Feb 18 16:27:01 2009 +0100 2.3 @@ -0,0 +1,158 @@ 2.4 +#!/bin/sh 2.5 +# 2.6 +# GTKdialog interface to tazndis: let users manage easly Windows drivers. 2.7 +# Use tabs to indent, split commands from the GUI and use functions. 2.8 +# 2.9 +# (c) 2009 SliTaz GNU/Linux - GNU gpl v3 2.10 +# 2.11 + 2.12 +# Languages messages translations 2.13 + 2.14 +case $LANG in 2.15 + fr*) 2.16 + REMOVE_DRIVER_MSG="Double clique sur un driver pour le supprimer." 2.17 + FILE_ENTRY_MSG="Fichier (.inf):" 2.18 + BUTTON_MSG="Installer" 2.19 + MODULE_STATUS_MSG="Module noyau ndiswrapper" 2.20 + LOADED_STATUS_MSG="chargé" 2.21 + UNLOADED_STATUS_MSG="déchargé" 2.22 + LOAD_BUTTON="Charger" 2.23 + UNLOAD_BUTTON="Décharger" 2.24 + EXIT_BUTTON="Quitter" ;; 2.25 + *) 2.26 + REMOVE_DRIVER_MSG="Please double clic on a driver to remove it." 2.27 + FILE_ENTRY_MSG="File (.inf):" 2.28 + BUTTON_MSG="Install" 2.29 + MODULE_STATUS_MSG="Ndiswrapper Kernel module" 2.30 + LOADED_STATUS_MSG="loaded" 2.31 + UNLOADED_STATUS_MSG="unloaded" 2.32 + LOAD_BUTTON="Load" 2.33 + UNLOAD_BUTTON="Unload" 2.34 + EXIT_BUTTON="Exit" ;; 2.35 +esac 2.36 + 2.37 +# Tazndisbox is only for root. 2.38 +if test $(id -u) != 0 ; then 2.39 + exec subox tazndisbox 2.40 + exit 0 2.41 +fi 2.42 + 2.43 +# Functions 2.44 + 2.45 +list_drivers() 2.46 +{ 2.47 + tazndis -l | sed 's/:/|/' 2.48 +} 2.49 + 2.50 +install_driver() 2.51 +{ 2.52 + xterm -bg gray93 -fg black -geometry 60x12 -title "Tazndis install" \ 2.53 + -e "echo N | tazndis -i $NEW_DRIVER" 2.54 +} 2.55 + 2.56 +remove_driver() 2.57 +{ 2.58 + tazndis -r $DRIVER 2.59 +} 2.60 + 2.61 +module_status() 2.62 +{ 2.63 + if lsmod | grep -q ndiswrapper; then 2.64 + STATUS="$LOADED_STATUS_MSG" 2.65 + else 2.66 + STATUS="$UNLOADED_STATUS_MSG" 2.67 + fi 2.68 + echo -n "$MODULE_STATUS_MSG ($STATUS)" 2.69 +} 2.70 + 2.71 +load_module() 2.72 +{ 2.73 + if ! lsmod | grep -q ^ndiswrapper; then 2.74 + modprobe ndiswrapper 2.75 + fi 2.76 +} 2.77 + 2.78 +unload_module() 2.79 +{ 2.80 + if lsmod | grep -q ^ndiswrapper; then 2.81 + rmmod ndiswrapper 2.82 + fi 2.83 +} 2.84 + 2.85 +# GUI 2.86 + 2.87 +export MAIN_DIALOG=" 2.88 +<window title=\"Tazndisbox\" icon-name=\"system-installer\"> 2.89 +<vbox> 2.90 + 2.91 + <tree> 2.92 + <width>510</width><height>140</height> 2.93 + <variable>DRIVER</variable> 2.94 + <label>Driver|Info</label> 2.95 + <input>$0 list_drivers</input> 2.96 + <action>$0 remove_driver</action> 2.97 + <action>refresh:DRIVER</action> 2.98 + </tree> 2.99 + 2.100 + <hbox> 2.101 + <text width-chars=\"56\"> 2.102 + <label>\"$REMOVE_DRIVER_MSG\"</label> 2.103 + </text> 2.104 + </hbox> 2.105 + 2.106 + <hbox> 2.107 + <text> 2.108 + <label>$FILE_ENTRY_MSG</label> 2.109 + </text> 2.110 + <entry accept=\"filename\"> 2.111 + <label>Select a driver</label> 2.112 + <variable>NEW_DRIVER</variable> 2.113 + </entry> 2.114 + <button> 2.115 + <input file stock=\"gtk-open\"></input> 2.116 + <action type=\"fileselect\">NEW_DRIVER</action> 2.117 + </button> 2.118 + <button> 2.119 + <label>$BUTTON_MSG</label> 2.120 + <input file icon=\"forward\"></input> 2.121 + <action>$0 install_driver</action> 2.122 + <action>refresh:DRIVER</action> 2.123 + <action>refresh:MODULE</action> 2.124 + <action>clear:NEW_DRIVER</action> 2.125 + </button> 2.126 + </hbox> 2.127 + 2.128 + <hbox> 2.129 + <text> 2.130 + <variable>MODULE</variable> 2.131 + <input>$0 module_status</input> 2.132 + </text> 2.133 + <button> 2.134 + <label>$LOAD_BUTTON</label> 2.135 + <input file icon=\"forward\"></input> 2.136 + <action>$0 load_module</action> 2.137 + <action>refresh:MODULE</action> 2.138 + </button> 2.139 + <button> 2.140 + <label>$UNLOAD_BUTTON</label> 2.141 + <input file icon=\"undo\"></input> 2.142 + <action>$0 unload_module</action> 2.143 + <action>refresh:MODULE</action> 2.144 + </button> 2.145 + <button> 2.146 + <label>$EXIT_BUTTON</label> 2.147 + <input file icon=\"exit\"></input> 2.148 + <action type=\"exit\">Exit</action> 2.149 + </button> 2.150 + </hbox> 2.151 + 2.152 +</vbox> 2.153 +</window>" 2.154 + 2.155 +if [ -n "$1" ]; then 2.156 + $1 2.157 +else 2.158 + gtkdialog --center --program=MAIN_DIALOG #>/dev/null 2.159 +fi 2.160 + 2.161 +exit 0