[totem] Fix the iPlayer plugin to use the latest PyGObject GTK+ overrides



commit 70a36edbe499aa18b756ad6814efda86881b705a
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Nov 14 12:19:24 2010 +0000

    Fix the iPlayer plugin to use the latest PyGObject GTK+ overrides

 src/plugins/iplayer/iplayer.py |   36 +++++++++++++++++++-----------------
 1 files changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/src/plugins/iplayer/iplayer.py b/src/plugins/iplayer/iplayer.py
index 18720c3..84405bb 100644
--- a/src/plugins/iplayer/iplayer.py
+++ b/src/plugins/iplayer/iplayer.py
@@ -66,7 +66,7 @@ class IplayerPlugin (gobject.GObject, Peas.Activatable):
 			self.totem.action_error (_('Error listing channel categories'), _('There was an unknown error getting the list of television channels available on BBC iPlayer.'))
 			return False
 
-		(b, parent_iter) = tree_store.get_iter (parent_path)
+		parent_iter = tree_store.get_iter (parent_path)
 		category_iter = tree_store.append (parent_iter, values)
 
 		# Append a dummy child row so that the expander's visible; we can
@@ -91,8 +91,8 @@ class IplayerPlugin (gobject.GObject, Peas.Activatable):
 
 	def _row_activated_cb (self, tree_view, path, view_column):
 		tree_store = tree_view.get_model ()
-		(b, tree_iter) = tree_store.get_iter (path)
-		if b == False:
+		tree_iter = tree_store.get_iter (path)
+		if tree_iter == None:
 			return
 
 		mrl = tree_store.get_value (tree_iter, 2)
@@ -119,21 +119,23 @@ class IplayerPlugin (gobject.GObject, Peas.Activatable):
 			self.totem.action_error (_('Error getting programme feed'), _('There was an error getting the list of programmes for this channel and category combination.'))
 			return False
 
-		(b, category_iter) = tree_store.get_iter (category_path)
-		tree_store.append (category_iter, values)
+		category_iter = tree_store.get_iter (category_path)
+		if category_iter != None:
+			tree_store.append (category_iter, values)
 
 		# Remove the placeholder row
-		(b, children) = tree_store.iter_children (category_iter)
-		if remove_placeholder and b:
+		children = tree_store.iter_children (category_iter)
+		if remove_placeholder and children != None:
 			tree_store.remove (children)
 
 		return False
 
 def get_iter_level (tree_model, tree_iter):
-	i = -1;
-	valid = True
-	while valid == True:
-		(valid, tree_iter) = tree_model.iter_parent (tree_iter)
+	i = 0;
+	while True:
+		tree_iter = tree_model.iter_parent (tree_iter)
+		if tree_iter == None:
+			break
 		i += 1
 	return i
 
@@ -150,8 +152,8 @@ class PopulateChannelsThread (threading.Thread):
 
 	def run (self):
 		shown_error = False
-		(valid, tree_iter) = self.tree_model.get_iter_first ()
-		while (valid == True):
+		tree_iter = self.tree_model.get_iter_first ()
+		while (tree_iter != None):
 			channel_id = self.tree_model.get_value (tree_iter, 1)
 			parent_path = self.tree_model.get_path (tree_iter)
 
@@ -168,7 +170,7 @@ class PopulateChannelsThread (threading.Thread):
 					gobject.idle_add (self.plugin._populate_channel_list_cb, self.tree_model, parent_path, None)
 					shown_error = True
 
-			valid = self.tree_model.iter_next (tree_iter)
+			tree_iter = self.tree_model.iter_next (tree_iter)
 
 class PopulateProgrammesThread (threading.Thread):
 	# Class to populate the programme list for a channel/category combination from the Internet
@@ -182,14 +184,14 @@ class PopulateProgrammesThread (threading.Thread):
 	def run (self):
 		self.plugin.programme_download_lock.acquire ()
 
-		(b, category_iter) = self.tree_model.get_iter (self.category_path)
-		if b == False:
+		category_iter = self.tree_model.get_iter (self.category_path)
+		if category_iter == None:
 			gobject.idle_add (self.plugin._populate_programme_list_cb, self.tree_model, self.category_path, None, False)
 			self.plugin.programme_download_lock.release ()
 			return
 
 		category_id = self.tree_model.get_value (category_iter, 1)
-		(v, parent_iter) = self.tree_model.iter_parent (category_iter)
+		parent_iter = self.tree_model.iter_parent (category_iter)
 		channel_id = self.tree_model.get_value (parent_iter, 1)
 
 		# Retrieve the programmes and return them



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