[billreminder] using gtk.show_uri to display links; minor cleanup



commit fb66e320bafe7d7a51626e22e51705be7616fe4d
Author: Toms Bauģis <toms baugis gmail com>
Date:   Sun Nov 29 13:17:23 2009 +0000

    using gtk.show_uri to display links; minor cleanup

 src/gui/aboutdialog.py |   38 ++++++++++++--------------------------
 1 files changed, 12 insertions(+), 26 deletions(-)
---
diff --git a/src/gui/aboutdialog.py b/src/gui/aboutdialog.py
index 6e89263..21389ac 100644
--- a/src/gui/aboutdialog.py
+++ b/src/gui/aboutdialog.py
@@ -1,39 +1,25 @@
 # -*- coding: utf-8 -*-
-
-__all__ = ['AboutDialog']
-
-import pygtk
-pygtk.require('2.0')
-
 import gtk
+from lib import i18n
 import lib.common as common
 
-# Internationalization
-from lib import i18n
 
-try:
-  import gnomevfs
-  def open_url(url): gnomevfs.url_show(url)
-except:
-  import os
-  def open_url(url): os.system("xdg-open %s" % url)
+def on_email(about, mail):
+    gtk.show_uri(gtk.gdk.Screen(), "mailto:%s"; % mail, 0L)
 
-TRANSLATORS = _("translator-credits")
+def on_url(about, link):
+    gtk.show_uri(gtk.gdk.Screen(), link, 0L)
+
+gtk.about_dialog_set_email_hook(on_email)
+gtk.about_dialog_set_url_hook(on_url)
 
-gtk.about_dialog_set_url_hook(lambda dialog, url, data: open_url(url), None)
+TRANSLATORS = _("translator-credits")
 
 class AboutDialog(gtk.AboutDialog):
-    """
-    About dialog class.
-    """
-    def __init__(self, parent=None):
+    def __init__(self, parent = None):
         gtk.AboutDialog.__init__(self)
-
-        # Set up the UI
-        self._initialize_dialog_widgets()
         self.set_icon_from_file(common.APP_ICON)
 
-    def _initialize_dialog_widgets(self):
         self.set_name(common.APPNAME)
         self.set_version(common.APPVERSION)
         self.set_copyright(common.COPYRIGHTS)
@@ -44,6 +30,6 @@ class AboutDialog(gtk.AboutDialog):
         self.set_website_label(_("BillReminder Website"))
         self.set_authors(common.AUTHORS)
         self.set_artists(common.ARTISTS)
-
-        # Show all widgets
+    
+        self.connect("response", lambda self, *args: self.destroy())
         self.show_all()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]