meld r1150 - trunk



Author: kaiw
Date: Sun Feb  1 14:11:54 2009
New Revision: 1150
URL: http://svn.gnome.org/viewvc/meld?rev=1150&view=rev

Log:
Move URI opening to misc

For launching context-sensitive help (e.g., from the preferences dialog) we
want uri_open() outside of MeldApp.


Modified:
   trunk/meldapp.py
   trunk/misc.py

Modified: trunk/meldapp.py
==============================================================================
--- trunk/meldapp.py	(original)
+++ trunk/meldapp.py	Sun Feb  1 14:11:54 2009
@@ -770,25 +770,14 @@
     #
     # Toolbar and menu items (help)
     #
-    def _open_uri(self, uri, timestamp=0):
-        # TODO: should be 2.14 when released
-        if gtk.pygtk_version >= (2, 13, 0):
-            gtk.show_uri(gtk.gdk.screen_get_default(), uri, timestamp)
-        else:
-            try:
-                import gnome
-                gnome.url_show(uri)
-            except ImportError:
-                pass
-
     def on_menu_help_activate(self, button):
-        self._open_uri("ghelp:///"+os.path.abspath(paths.help_dir("C/meld.xml")))
+        misc.open_uri("ghelp:///"+os.path.abspath(paths.help_dir("C/meld.xml")))
 
     def on_menu_help_bug_activate(self, button):
-        self._open_uri("http://bugzilla.gnome.org/buglist.cgi?query=product%3Ameld";)
+        misc.open_uri("http://bugzilla.gnome.org/buglist.cgi?query=product%3Ameld";)
 
     def on_menu_about_activate(self, *extra):
-        gtk.about_dialog_set_url_hook(lambda dialog, uri: self._open_uri(uri))
+        gtk.about_dialog_set_url_hook(lambda dialog, uri: misc.open_uri(uri))
         about = gtk.glade.XML(paths.share_dir("glade2/meldapp.glade"),"about").get_widget("about")
         about.props.version = version
         about.set_transient_for(self.widget)

Modified: trunk/misc.py
==============================================================================
--- trunk/misc.py	(original)
+++ trunk/misc.py	Sun Feb  1 14:11:54 2009
@@ -63,6 +63,17 @@
     d.destroy()
     return ret
 
+def open_uri(uri, timestamp=0):
+    # TODO: should be 2.14 when released
+    if gtk.pygtk_version >= (2, 13, 0):
+        gtk.show_uri(gtk.gdk.screen_get_default(), uri, timestamp)
+    else:
+        try:
+            import gnome
+            gnome.url_show(uri)
+        except ImportError:
+            pass
+
 class struct(object):
     """Similar to a dictionary except that members may be accessed as s.member.
 



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