[PATCHES] Don't use gnomevfs unless available
- From: Vincent Legoll <vincent legoll gmail com>
- To: meld-list <meld-list gnome org>
- Subject: [PATCHES] Don't use gnomevfs unless available
- Date: Tue, 14 Apr 2009 23:56:22 +0200
2 new uses of gnomevfs crept in since last December
when people worked helping Greg Bowyer to integrate
parts of his patch to make meld work on windows.
The 2 uses can be made conditional upon gnomevfs
module availability.
--
Vincent Legoll
Index: meldapp.py
===================================================================
--- meldapp.py (revision 1347)
+++ meldapp.py (working copy)
@@ -25,8 +25,14 @@
import gtk.glade
import gobject
import pango
-import gnomevfs
+# Drag'N'Drop support needs gnomevfs
+try:
+ import gnomevfs
+ gnomevfs_available = True
+except ImportError:
+ gnomevfs_available = False
+
# project
import paths
import prefs
@@ -563,7 +569,8 @@
gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_HIGHLIGHT | gtk.DEST_DEFAULT_DROP,
[ ('text/uri-list', 0, 0) ],
gtk.gdk.ACTION_COPY)
- self.widget.connect('drag_data_received', self.on_widget_drag_data_received)
+ if gnomevfs_available:
+ self.widget.connect('drag_data_received', self.on_widget_drag_data_received)
self.toolbar.set_style( self.prefs.get_toolbar_style() )
self.prefs.notify_add(self.on_preference_changed)
self.idle_hooked = 0
Index: sourceviewer.py
===================================================================
--- sourceviewer.py (revision 1347)
+++ sourceviewer.py (working copy)
@@ -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]