[rhythmbox] Remove gnome-vfs support in rb python bindings



commit 53f32ed3c2252f049094d8d2f5361ad8d1f2ed1e
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Dec 10 16:16:22 2009 +0000

    Remove gnome-vfs support in rb python bindings
    
    https://bugzilla.gnome.org/show_bug.cgi?id=604186

 plugins/rb/Loader.py |  165 ++------------------------------------------------
 1 files changed, 5 insertions(+), 160 deletions(-)
---
diff --git a/plugins/rb/Loader.py b/plugins/rb/Loader.py
index 7d7c91e..4ac9c9a 100644
--- a/plugins/rb/Loader.py
+++ b/plugins/rb/Loader.py
@@ -185,168 +185,13 @@ class GioUpdateCheck(object):
 		self._cancel.cancel()
 
 
-class GnomeVFSLoader (object):
-	def __init__ (self):
-		self.chunk = 4096
-
-	def _read_cb (self, handle, buffer, exc_type, bytes_req):
-		if exc_type:
-			if issubclass (exc_type, gnomevfs.EOFError):
-				callback_with_gdk_lock (self.callback, self.data, self.args)
-				handle.close (lambda *args: None)
-			else:
-				callback_with_gdk_lock (self.callback, None, self.args)
-				handle.close (lambda *args: None)
-			return
- 			
-		self.data += buffer
-		handle.read (self.chunk, self._read_cb)
-
-	def _open_cb (self, handle, exc_type):
-		if exc_type:
-			callback_with_gdk_lock (self.callback, None, self.args)
-			return
-
-		self.handle = handle
-		self.data = ""
-		handle.read (self.chunk, self._read_cb)
-    
-	def get_url (self, url, callback, *args):
-		self.url = url
-		self.callback = callback
-		self.args = args
-		gnomevfs.async.open (url, self._open_cb)
-
-	def cancel (self):
-		self.handle.cancel()
-
-
-class GnomeVFSChunkLoader (object):
-	def __init__ (self):
-		pass
-
-	def _callback(self, result):
-		return self.callback(result, self.total, *self.args)
-
-	def _callback_gdk(self, result):
-		gtk.gdk.threads_enter()
-		try:
-			v = self._callback(result)
-			gtk.gdk.threads_leave()
-			return v
-		except Exception, e:
-			gtk.gdk.threads_leave()
-			raise e
-
-	def _read_cb (self, handle, buffer, exc_type, bytes_requested):
-		if exc_type:
-			if issubclass (exc_type, gnomevfs.EOFError):
-				self._callback_gdk (None)
-			else:
-				self._callback_gdk (exc_type())
-			handle.close (lambda *args: None)
-		else:
-			if self._callback_gdk (buffer) is False:
-				handle.close(lambda *args: None)
-			else:
-				handle.read (self.chunksize, self._read_cb)
-
-
-	def _open_cb (self, handle, exc_type):
-		if exc_type:
-			self._callback_gdk (exc_type())
-		else:
-			handle.read (self.chunksize, self._read_cb)
-
-	def _info_cb (self, handle, results):
-		try:
-			(uri, exc, info) = results[0]
-			self.total = info.size
-		except ValueError:
-			pass
-
-		self.handle = gnomevfs.async.open (self.vfs_uri, self._open_cb)
-
-	def get_url_chunks (self, uri, chunksize, want_size, callback, *args):
-		self.uri = uri
-		self.chunksize = chunksize
-		self.total = 0
-		self.callback = callback
-		self.args = args
-		self.vfs_uri = gnomevfs.URI(uri)
-		if want_size:
-			self.handle = gnomevfs.async.get_file_info ((self.vfs_uri,), self._info_cb)
-		else:
-			self.handle = gnomevfs.async.open (self.vfs_uri, self._open_cb)
-
-	def cancel (self):
-		if self.handle:
-			self.handle.cancel()
-
-
-class GnomeVFSUpdateCheck (object):
-	def __init__ (self):
-		pass
-
-	def _info_cb (self, handle, results):
-		(local_uri, local_exc, local_info) = results[0]
-		(remote_uri, remote_exc, remote_info) = results[1]
-
-		result = True
-
-		if remote_exc:
-			print "error checking remote URI %s: %s" % (self.remote, remote_exc)
-			result = False
-		elif local_exc:
-			if issubclass (local_exc, gnomevfs.NotFoundError):
-				print "local URI %s not found" % self.local
-			else:
-				print "error checking local URI %s: %s" % (self.local, local_exc)
-		else:
-			try:
-				result = (remote_info.mtime > local_info.mtime)
-			except ValueError, e:
-				print "error comparing modification times: %s" % e
-		
-		callback_with_gdk_lock (self.callback, result, self.args)
-
-
-	def check_for_update (self, local, remote, callback, *args):
-		self.callback = callback
-		self.args = args
-		self.local = local
-		self.remote = remote
-
-		uris = (gnomevfs.URI(local), gnomevfs.URI(remote))
-		self.handle = gnomevfs.async.get_file_info (uris, self._info_cb)
-
-	def cancel (self):
-		self.handle.cancel ()
-
-
-
-
 
 
 # now figure out which set of implementations to use
 
-use_gio = False
-try:
-	import gio
-	# before 2.16.0, file.load_contents_async didn't work correctly
-	if gio.pygio_version > (2,15,4):
-		use_gio = True
-except:
-	# probably don't have gio at all
-	pass
-
-if use_gio:
-	Loader = GioLoader
-	ChunkLoader = GioChunkLoader
-	UpdateCheck = GioUpdateCheck
-else:
-	import gnomevfs
-	Loader = GnomeVFSLoader
-	ChunkLoader = GnomeVFSChunkLoader
-	UpdateCheck = GnomeVFSUpdateCheck
+import gio
+
+Loader = GioLoader
+ChunkLoader = GioChunkLoader
+UpdateCheck = GioUpdateCheck
 



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