[gnome-python-desktop] Bug 600952 - examples/wnck_example.py has crazy O(n^2) loop



commit 7202f8a0ec0144bd03ac09a162e04ef429a7ffa1
Author: Gustavo Carneiro <gjc inescporto pt>
Date:   Sat Dec 5 18:32:14 2009 +0000

    Bug 600952 -  examples/wnck_example.py has crazy O(n^2) loop

 examples/wnck_example.py |   24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)
---
diff --git a/examples/wnck_example.py b/examples/wnck_example.py
index 52c3bc6..a8cc663 100644
--- a/examples/wnck_example.py
+++ b/examples/wnck_example.py
@@ -1,7 +1,4 @@
-import pygtk
-pygtk.require('2.0')
 import gtk
-
 import wnck
 
 def main():
@@ -10,17 +7,16 @@ def main():
     while gtk.events_pending():
         gtk.main_iteration()
     for window in screen.get_windows():
-        for window in screen.get_windows():
-            # A XID is a number that identifies a X window.
-            xid = window.get_xid()
-            # By calling gtk.gdk.window_foreign_new(xid), we are creating
-            # a gtk.gdk.Window which wraps the window that is identified by
-            # the XID. It will return None if it can't find the X window
-            # identified by the XID in question.
-            wrapped_window = gtk.gdk.window_foreign_new(xid)
-            # We are maximizing the window here, but
-            # you can do almost anything with a gtk.gdk.Window.
-            wrapped_window.maximize()
+        # A XID is a number that identifies a X window.
+        xid = window.get_xid()
+        # By calling gtk.gdk.window_foreign_new(xid), we are creating
+        # a gtk.gdk.Window which wraps the window that is identified by
+        # the XID. It will return None if it can't find the X window
+        # identified by the XID in question.
+        wrapped_window = gtk.gdk.window_foreign_new(xid)
+        # We are maximizing the window here, but
+        # you can do almost anything with a gtk.gdk.Window.
+        wrapped_window.maximize()
 
 if __name__ == '__main__':
     main()



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