initial commit/release
authorFredrik Wendt <fredrik@wendt.se>
Sat, 24 Jul 2010 13:02:29 +0000 (14:02 +0100)
committerFredrik Wendt <fredrik@wendt.se>
Sat, 24 Jul 2010 13:02:29 +0000 (14:02 +0100)
17 files changed:
package/Makefile [new file with mode: 0644]
package/debian/README [new file with mode: 0644]
package/debian/changelog [new file with mode: 0644]
package/debian/compat [new file with mode: 0644]
package/debian/control [new file with mode: 0644]
package/debian/copyright [new file with mode: 0644]
package/debian/dirs [new file with mode: 0644]
package/debian/docs [new file with mode: 0644]
package/debian/rules [new file with mode: 0755]
package/debian/wifi-assistant.postinst [new file with mode: 0644]
package/share/wifi-assistant.desktop [new file with mode: 0644]
package/share/wifi-assistant.desktop~ [new file with mode: 0644]
package/share/wifi-assistant.service [new file with mode: 0644]
package/share/wifi-assistant.service~ [new file with mode: 0644]
package/src/config-gui.py [new file with mode: 0644]
package/src/daemon.py [new file with mode: 0644]
www/index.html [new file with mode: 0644]

diff --git a/package/Makefile b/package/Makefile
new file mode 100644 (file)
index 0000000..567dac3
--- /dev/null
@@ -0,0 +1,36 @@
+#
+# Makefile for Hermes: Contacts Updated
+# (c) Andrew Flegg 2009. Released under the Artistic Licence.
+
+DEBVERS := $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
+
+compile:
+       #perl -pi -e "s/(WimpWorks\.__init__.*?version\s*=\s*)['\"].*?['\"]/\1'${DEBVERS}'/" src/org/maemo/wifi-assistant/gui/gtkui.py
+       perl -ni -e 'print; exit if /^XB-Maemo-Icon-26:$$/' debian/control
+       uuencode -m share/wifi-assistant-48.png - | perl -ne 'print " $$_" unless $$. == 1 or /^====$$/' >>debian/control
+       py_compilefiles `find src -type f -name '*.py'`
+       #cd po && $(MAKE) compile
+       mkdir bin
+
+install:
+       mkdir -p ${DESTDIR}/opt/wifi-assistant/lib ${DESTDIR}/opt/wifi-assistant/bin ${DESTDIR}/opt/wifi-assistant/share
+       ln -s ../lib/config-gui.py ${DESTDIR}/opt/wifi-assistant/bin/wifi-assistant
+       cp -r src/* ${DESTDIR}/opt/wifi-assistant/lib/
+       chown -R root:root ${DESTDIR}/opt/wifi-assistant/lib/
+       install -D -m 0644 -o root -g root src/*.py* ${DESTDIR}/opt/wifi-assistant/lib/
+       install -D -m 0644 -o root -g root share/wifi-assistant-64.png ${DESTDIR}/usr/share/icons/hicolor/scalable/hildon/wifi-assistant.png
+       install -D -m 0644 -o root -g root share/wifi-assistant-48.png ${DESTDIR}/usr/share/icons/hicolor/48x48/hildon/wifi-assistant.png
+       install -D -m 0644 -o root -g root share/wifi-assistant.desktop ${DESTDIR}/usr/share/applications/hildon/wifi-assistant.desktop
+       install -D -m 0644 -o root -g root share/wifi-assistant.service ${DESTDIR}/usr/share/dbus-1/services/wifi-assistant.service
+       chmod 755 ${DESTDIR}/opt/wifi-assistant/lib/config-gui.py
+       #cd po && $(MAKE) install 
+
+clean:
+       rm -f `find src -type f -name '*.pyo' -o -name '*.pyc'`
+       rm -f build-stamp configure-stamp
+       rm -rf debian/wifi-assistant bin
+       find . -name *~ -exec rm -f {} \;
+       #cd po && $(MAKE) clean
+
+package:
+       dpkg-buildpackage -rfakeroot -uc -us
diff --git a/package/debian/README b/package/debian/README
new file mode 100644 (file)
index 0000000..aa3f97c
--- /dev/null
@@ -0,0 +1,3 @@
+The Debian Package wifi-assistant
+----------------------------
+
diff --git a/package/debian/changelog b/package/debian/changelog
new file mode 100644 (file)
index 0000000..3664365
--- /dev/null
@@ -0,0 +1,5 @@
+hermes (0.0.1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Andrew Flegg <andrew@bleb.org>  Wed, 30 Sep 2009 21:21:27 +0100
diff --git a/package/debian/compat b/package/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/package/debian/control b/package/debian/control
new file mode 100644 (file)
index 0000000..08190bf
--- /dev/null
@@ -0,0 +1,15 @@
+Source: wifi-assistant
+Section: user/utilities
+Priority: extra
+Maintainer: Fredrik Wendt <fredrik@wendt.se>
+Build-Depends: debhelper (>= 5), python-runtime | python2.5-runtime, sharutils
+Standards-Version: 3.7.2
+
+Package: wifi-assistant
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}, python-osso | 
+ python2.5-osso, python-hildon | python2.5-hildon, 
+ gnome-python, python-gobject (>= 2.16), python-conic
+Description: FIXME
+XB-Maemo-Display-Name: Hermes
+XSBC-Bugtracker: http://wifi-assistant.garage.maemo.org/bugs/
diff --git a/package/debian/copyright b/package/debian/copyright
new file mode 100644 (file)
index 0000000..6760fba
--- /dev/null
@@ -0,0 +1,24 @@
+Copyright (c) 2010, Fredrik Wendt <fredrik@wendt.se>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in the
+      documentation and/or other materials provided with the distribution.
+    * Neither the name of Wendt Systemutveckling nor the
+      names of its contributors may be used to endorse or promote products
+      derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL Fredrik Wendt BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/package/debian/dirs b/package/debian/dirs
new file mode 100644 (file)
index 0000000..ca882bb
--- /dev/null
@@ -0,0 +1,2 @@
+usr/bin
+usr/sbin
diff --git a/package/debian/docs b/package/debian/docs
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/package/debian/rules b/package/debian/rules
new file mode 100755 (executable)
index 0000000..f5f950d
--- /dev/null
@@ -0,0 +1,98 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       # Add here commands to configure the package.
+
+       touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+       dh_testdir
+
+       # Add here commands to compile the package.
+       $(MAKE)
+       #docbook-to-man debian/wifi-assistant.sgml > wifi-assistant.1
+
+       touch $@
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+
+       # Add here commands to clean up after the build process.
+       -$(MAKE) clean
+
+       dh_clean 
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+
+       # Add here commands to install the package into debian/wifi-assistant.
+       $(MAKE) DESTDIR=$(CURDIR)/debian/wifi-assistant install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+#      dh_installchangelogs 
+#      dh_installdocs
+#      dh_installexamples
+#      dh_install
+#      dh_installmenu
+#      dh_installdebconf       
+#      dh_installlogrotate
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installmime
+#      dh_python
+#      dh_installinit
+#      dh_installcron
+#      dh_installinfo
+#      dh_installman
+       dh_link
+       dh_strip
+       dh_compress
+       dh_fixperms
+#      dh_perl
+#      dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
diff --git a/package/debian/wifi-assistant.postinst b/package/debian/wifi-assistant.postinst
new file mode 100644 (file)
index 0000000..594d878
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+gconftool-2 -s /apps/maemo/wifi-assistant/url_to_open "http://wifi-assistant.garage.maemo.org/ping/" --type string
+gconftool-2 -s /apps/maemo/wifi-assistant/popup "true" --type boolean
+
+# Hacky fix for NB#136012
+gconftool-2 -s /desktop/gnome/url-handlers/http/command 'dbus-send --type=method_call --dest=com.nokia.osso_browser /com/nokia/osso_browser com.nokia.osso_browser.load_url string:"%s"' --type string 
+
+gtk-update-icon-cache -f /usr/share/icons/hicolor
diff --git a/package/share/wifi-assistant.desktop b/package/share/wifi-assistant.desktop
new file mode 100644 (file)
index 0000000..4da7ee9
--- /dev/null
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Name=Wifi Assistant
+Icon=wifi-assistant
+Exec=/opt/wifi-assistant/bin/wifi-assistant
+X-Osso-Service=org.maemo.wifi-assistant-config-gui
+Type=Application
diff --git a/package/share/wifi-assistant.desktop~ b/package/share/wifi-assistant.desktop~
new file mode 100644 (file)
index 0000000..5b9658d
--- /dev/null
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Version=1.0
+Encoding=UTF-8
+Name=Wifi Assistant
+Icon=wifi-assistant
+Exec=/opt/wifi-assistant/bin/wifi-assistant-config-gui
+X-Osso-Service=org.maemo.wifi-assistant-config-gui
+Type=Application
diff --git a/package/share/wifi-assistant.service b/package/share/wifi-assistant.service
new file mode 100644 (file)
index 0000000..9afc4b1
--- /dev/null
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.maemo.wifi-assistant-config-gui
+Exec=/opt/wifi-assistant/bin/wifi-assistant
diff --git a/package/share/wifi-assistant.service~ b/package/share/wifi-assistant.service~
new file mode 100644 (file)
index 0000000..ded8fa6
--- /dev/null
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=org.maemo.wifi-assistant-config-gui
+Exec=/opt/wifi-assistant/bin/wifi-assistant-config-gui
diff --git a/package/src/config-gui.py b/package/src/config-gui.py
new file mode 100644 (file)
index 0000000..3148b55
--- /dev/null
@@ -0,0 +1,205 @@
+import gtk, hildon, gobject
+from gnome import gconf
+import webbrowser
+import osso
+
+def _(str):
+    return str
+
+_gc = gconf.client_get_default()
+prefix = '/apps/maemo/wbl/launch'
+GCONF_KEY_URL = '/apps/maemo/wbl/url_to_open'
+GCONF_KEY_POPUP = '/apps/maemo/wbl/popup'
+
+program = hildon.Program.get_instance()
+
+# Create the main window
+win = hildon.StackableWindow()
+
+def launch_browser(url):
+    osso_context = osso.Context("org.maemo.touchsearch", "1.1", False)
+    osso_rpc = osso.Rpc(osso_context)
+    osso_rpc.rpc_run_with_defaults("osso_browser", "open_new_window", (url,))
+
+def show_about(x):
+    dialog = gtk.Dialog('About', win)
+    
+    text = "I got tired of not being able to connect easily to networks guarded by a login page, " + \
+        "so I created this app to scratch that itch. It's free to use, inspect, adapt and share, " + \
+        "licencsed under a BSD type license.\nI hope you enjoy it!"
+    about_label = gtk.Label(text)
+    about_label.set_line_wrap(True)
+    dialog.vbox.add(about_label)
+    
+    dialog.add_button(_('File a bug'), 1)
+    dialog.add_button(_('Donate'), 2)
+    dialog.add_button(_('Close'), 3)
+    
+    dialog.show_all()
+    result = dialog.run()
+    dialog.hide()
+    
+    if result == 1:
+        launch_browser('http://wifi-assistant.garage.maemo.org/bugs/')
+    if result == 2:
+        launch_browser('http://wifi-assistant.garage.maemo.org/donate/')
+
+    
+def show_settings(x):
+    checkbox = hildon.CheckButton(gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT)
+    checkbox.set_label('Show popup when connected to a new SSID')
+    checkbox.set_active(_gc.get_bool(GCONF_KEY_POPUP))
+    
+    url_label = gtk.Label('URL to open when launching browser:') # IMPROVEMENT: caption?
+    url_label.set_alignment(0, 0.5)
+    url_label.set_padding(5, 5)
+    url_field = hildon.Entry(gtk.HILDON_SIZE_AUTO)
+    url_field.set_text(_gc.get_string(GCONF_KEY_URL))
+    
+    dialog = gtk.Dialog('Settings', win)
+    dialog.vbox.set_homogeneous(False)
+    
+    dialog.vbox.add(checkbox)
+    dialog.vbox.add(url_label)
+    dialog.vbox.add(url_field)
+    
+    dialog.add_button(_('Cancel'), gtk.RESPONSE_CANCEL)
+    dialog.add_button(_('Save'), gtk.RESPONSE_YES)
+    
+    dialog.show_all()
+    result = dialog.run()
+    dialog.hide()
+    
+    if (result == gtk.RESPONSE_YES):
+        _gc.set_string(GCONF_KEY_URL, url_field.get_text())
+        _gc.set_bool(GCONF_KEY_POPUP, checkbox.get_active())
+
+
+def create_menu():
+    menu = hildon.AppMenu()
+    settings = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
+    command_id = "Settings"
+    settings.set_label(command_id)
+    settings.connect("clicked", show_settings)
+    menu.append(settings)
+    
+    about = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
+    command_id = "About"
+    about.set_label(command_id)
+    about.connect("clicked", show_about)
+    menu.append(about)
+    
+    menu.show_all()
+    return menu
+
+def create_ssid_model():
+    store = gtk.ListStore(str, gobject.TYPE_BOOLEAN)
+    
+    entries = _gc.all_entries(prefix)
+    for entry in entries:
+        ssidName = entry.get_key()[len(prefix) + 1:]
+        launchBrowser = entry.get_value().get_bool()
+        store.append([ssidName, launchBrowser])
+        print ssidName
+        print launchBrowser
+    
+    return store
+
+def edit_ssid(ssid, parent, model, iter):
+    dialog = gtk.Dialog(ssid, parent)
+    dialog.vbox.set_homogeneous(False)
+    
+    dialog.add_button(_('No'), gtk.RESPONSE_NO)
+    dialog.add_button(_('Yes'), gtk.RESPONSE_YES)
+    
+    label = gtk.Label(_('After being connected to ' + ssid + ' do you wish to launch a browser?'))
+    label.set_line_wrap(True)
+    label.set_justify(gtk.JUSTIFY_LEFT)
+    label.set_alignment(0, 0.5)
+    dialog.vbox.add(label)
+
+    dialog.show_all()
+    result = dialog.run()
+    dialog.hide()
+    
+    launchBrowser = (result == gtk.RESPONSE_YES)
+    _gc.set_bool('/apps/maemo/wbl/launch/' + ssid, launchBrowser)
+    model.set(iter, 1, launchBrowser)
+
+
+def create_ssid_view():
+    model = create_ssid_model()
+    view = gtk.TreeView(model)
+    view.set_border_width(5)
+    
+    tvcolumn = gtk.TreeViewColumn('SSID', gtk.CellRendererText(), text = 0)
+    tvcolumn.set_expand(True)
+    view.append_column(tvcolumn)
+
+    def boolean_func(column, cell, model, iter):
+        if model.get_value(iter, 1):
+            stock_id = 'gtk-yes'
+        else:
+            stock_id = 'gtk-no'
+        cell.set_property('stock-id', stock_id)
+        
+    view.insert_column_with_data_func(1, 'Launch', gtk.CellRendererPixbuf(), boolean_func)
+    
+    def row_activated(treeview, path, view_column):
+        model = treeview.get_model()
+        iter = model.get_iter(path)
+        ssid = model.get_value(iter, 0)
+        print ssid
+        edit_ssid(ssid, win, model, iter)
+    
+    view.connect('row-activated', row_activated)
+    view.set_search_column(0)
+    tvcolumn.set_sort_column_id(0)
+    
+    return view
+    
+def create_table():
+    table = gtk.Table(rows=10, columns=2)
+    table.set_col_spacings(5)
+    table.set_row_spacings(5)
+    table.set_border_width(5)
+    
+    row = 0
+    entries = xrange(5)
+    for entry in entries:
+        def l(i):
+            if (i == 0):
+                return ""
+            return "x" + l(i-1)
+        
+        ssid = "SSID " + l(row) 
+        ssid_label = gtk.Label(ssid)
+        ssid_label.set_alignment(0, 0.5)
+        table.attach(ssid_label, 0, 1, row, row+1, xoptions=gtk.FILL)
+        table.attach(gtk.Label("On"), 1, 2, row, row+1, xoptions=gtk.SHRINK)
+        row = row + 1
+    
+    return table
+    
+def main():
+    win.set_title("Browser Launcher Configuration")
+#    pannable_area = hildon.PannableArea()
+    
+    ssid_view = create_ssid_view()
+    
+#    pannable_area.add_with_viewport(ssid_view)
+    
+#    win.add(pannable_area)
+    win.add(ssid_view)
+        
+    win.set_app_menu(create_menu())
+    win.connect("destroy", gtk.main_quit, None)
+    win.show_all()
+    gtk.main()
+if __name__ == "__main__":
+    main()
\ No newline at end of file
diff --git a/package/src/daemon.py b/package/src/daemon.py
new file mode 100644 (file)
index 0000000..276e970
--- /dev/null
@@ -0,0 +1,58 @@
+import gtk, hildon
+from gnome import gconf
+import webbrowser
+import osso
+
+def _(str):
+    return str
+
+_gc = gconf.client_get_default()
+parent = gtk.Window()
+
+def launch_browser():
+    url = _gc.get_string('/apps/maemo/wbl/url_to_open')
+    osso_context = osso.Context("org.maemo.touchsearch", "1.1", False)
+    osso_rpc = osso.Rpc(osso_context)
+    osso_rpc.rpc_run_with_defaults("osso_browser", "open_new_window", (url,))
+
+def show_decision_dialog(ssid):
+    dialog = gtk.Dialog(ssid, parent)
+    dialog.vbox.set_homogeneous(False)
+    
+    dialog.add_button(_('No'), gtk.RESPONSE_NO)
+    dialog.add_button(_('Yes'), gtk.RESPONSE_YES)
+    
+    label = gtk.Label(_('New network connection established - do you wish to launch a browser?'))
+    label.set_line_wrap(True)
+    #label.set_justify(gtk.JUSTIFY_LEFT)
+    #label.set_alignment(0, 0.5)
+    dialog.vbox.add(label)
+
+    checkbox = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
+    checkbox.set_label(_('Remember this decision'))
+    checkbox.set_active(True)
+    dialog.vbox.add(checkbox)
+    
+    dialog.show_all()
+    result = dialog.run()
+    dialog.hide()
+    
+    launchBrowser = (result == gtk.RESPONSE_YES)
+    if (checkbox.get_active()):
+        _gc.set_bool('/apps/maemo/wbl/launch/' + ssid, launchBrowser)
+    
+    return launchBrowser
+
+def connection_established(ssid):
+    value = _gc.get_without_default('/apps/maemo/wbl/launch/' + ssid)
+    print value
+    if value is None:
+        if show_decision_dialog(ssid):
+            launch_browser()
+        return
+
+    if value.get_bool():
+        launch_browser()
+import sys
+connection_established(sys.argv[1])
diff --git a/www/index.html b/www/index.html
new file mode 100644 (file)
index 0000000..0c0bc06
--- /dev/null
@@ -0,0 +1,2 @@
+<h1>Wifi Jail Breakout Assistant</h1>
+Lots of things todo :)