[gedit] Use the FileEnumerator as an iterable data.



commit ab7f3788a18447b9a88f0d1dbda892e6c452c9af
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Wed Jan 19 17:34:49 2011 +0100

    Use the FileEnumerator as an iterable data.

 plugins/quickopen/quickopen/popup.py |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/plugins/quickopen/quickopen/popup.py b/plugins/quickopen/quickopen/popup.py
index 899ebd0..d64084f 100644
--- a/plugins/quickopen/quickopen/popup.py
+++ b/plugins/quickopen/quickopen/popup.py
@@ -141,22 +141,13 @@ class Popup(Gtk.Dialog):
 
                 children = []
 
-                # FIXME: this sucks, let's fix it once the GFileEnumerator becomes an iterator
-                if isinstance(gfile, VirtualDirectory):
-                        for entry in entries:
-                                children.append((entry, entry.get_name(), entry.get_file_type(), entry.get_icon()))
-                else:
-
-                        while True:
-                                try:
-                                        info = entries.next_file(None)
-                                except GLib.Error:
-                                        pass
-
-                                if not info:
-                                        break
+                for entry in entries:
+                        if isinstance(gfile, VirtualDirectory):
+                                child = entry
+                        else:
+                                child = gfile.get_child(entry.get_name())
 
-                                children.append((gfile.get_child(info.get_name()), info.get_name(), info.get_file_type(), info.get_icon()))
+                        children.append((child, entry.get_name(), entry.get_file_type(), entry.get_icon()))
 
                 return children
 



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