refactoring main GUI application to
[wifi-assistant] / package / src / wifi_assistant / gui / about_dialog.py
diff --git a/package/src/wifi_assistant/gui/about_dialog.py b/package/src/wifi_assistant/gui/about_dialog.py
new file mode 100644 (file)
index 0000000..f7cee7e
--- /dev/null
@@ -0,0 +1,47 @@
+#!/usr/bin/python2.5
+import gtk, hildon
+
+def _(str):
+    return str
+
+class AboutDialog():
+    
+    BUG_BUTTON = 1
+    DONATE_BUTTON = 2
+    CLOSE_BUTTON = 3
+    
+    BUG_URL = 'http://wifi-assistant.garage.maemo.org/bugs/'
+    DONATE_URL = 'http://wifi-assistant.garage.maemo.org/donate/'
+
+    def __init__(self, launcher, parent_window):
+        self._launcher = launcher
+        self._parent_window = parent_window
+
+
+    def show(self):
+        dialog = gtk.Dialog(_('About Wifi Jail Brekaout Assistant'), self._parent_window)
+        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, " + \
+            "licensed 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'), AboutDialog.BUG_BUTTON)
+        dialog.add_button(_('Donate'), AboutDialog.DONATE_BUTTON)
+        dialog.add_button(_('Close'), AboutDialog.CLOSE_BUTTON)
+        
+        dialog.show_all()
+        result = self._runDialog(dialog)
+        dialog.hide()
+        
+        if result == AboutDialog.BUG_BUTTON:
+            self._launcher.openUrl(_(AboutDialog.BUG_URL))
+        if result == AboutDialog.DONATE_BUTTON:
+            self._launcher.openUrl(_(AboutDialog.DONATE_URL))
+    
+
+    def _runDialog(self, dialog):
+        result = dialog.run()
+        return result