meld r1350 - trunk



Author: vincele
Date: Wed Apr 15 22:21:37 2009
New Revision: 1350
URL: http://svn.gnome.org/viewvc/meld?rev=1350&view=rev

Log:
Make the use of gnomevfs conditional upon its availability.
The "sourceview" module will only be activated if gnomevfs is present too.


Modified:
   trunk/sourceviewer.py

Modified: trunk/sourceviewer.py
==============================================================================
--- trunk/sourceviewer.py	(original)
+++ trunk/sourceviewer.py	Wed Apr 15 22:21:37 2009
@@ -71,7 +71,10 @@
     srcviewer_module = "sourceview"
 
     def version_check(self):
-        pass
+        # ImportError exceptions are caught, so we
+        # won't use 'sourceview' without gnomevfs
+        import gnomevfs
+        self.gvfs = gnomevfs
 
     def overrides(self):
         self.GtkTextView = self.gsv.SourceView
@@ -90,9 +93,8 @@
         return self.get_language_manager().get_language_from_mime_type(mime_type)
 
     def get_language_from_file(self, filename):
-        import gnomevfs
-        mime_type = gnomevfs.get_mime_type(
-                gnomevfs.make_uri_from_input(os.path.abspath(filename)))
+        mime_type = self.gvfs.get_mime_type(
+                self.gvfs.make_uri_from_input(os.path.abspath(filename)))
         return self.get_language_from_mime_type(mime_type)
 
 class gtksourceview(sourceview):



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