[gnoduino] Bug 670311 - get rid of the gnome-vfs dependency



commit 2c89fb9da7dba65d7fd75951911f104187915269
Author: speps <dreamspepser yahoo it>
Date:   Fri Mar 30 21:23:43 2012 +0200

    Bug 670311 - get rid of the gnome-vfs dependency

 src/misc.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/misc.py b/src/misc.py
index 7d62c8f..80d813d 100644
--- a/src/misc.py
+++ b/src/misc.py
@@ -17,7 +17,7 @@
 
 import os
 import glib
-import gnomevfs
+from xdg import Mime
 import gtk
 import hashlib
 import logging
@@ -216,15 +216,15 @@ def runProgOutput(console, cmdline):
 	return True
 
 def get_mime_type(content):
-	mime = gnomevfs.get_mime_type_for_data(content)
+	mime = Mime.get_type_by_data(content)
 	"""try harder to guess mime type"""
 	"""sometimes helps to trim leading newlines"""
 	"""FIXME: try with smaller chunk of content"""
-	if mime == "text/plain":
-		tmpmime = gnomevfs.get_mime_type_for_data(content.strip("\n"))
-		if tmpmime != "text/plain": mime = tmpmime
+	if mime is None or mime == "text/plain":
+		tmpmime = Mime.get_type_by_data(content.strip("\n"))
+		if tmpmime and tmpmime != "text/plain": mime = tmpmime
 		else: mime = "text/x-csrc"
-	return mime
+	return str(mime)
 
 def merge_font_name(widget, font):
 	if widget == None: return



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