[alacarte] MenuEditor: Clean up more code



commit a8b35f0f0c8aa75a6e40dc4c05bd5652af135485
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Jun 20 15:15:48 2012 -0400

    MenuEditor: Clean up more code

 Alacarte/MenuEditor.py |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/Alacarte/MenuEditor.py b/Alacarte/MenuEditor.py
index d2634a0..6628150 100644
--- a/Alacarte/MenuEditor.py
+++ b/Alacarte/MenuEditor.py
@@ -138,19 +138,18 @@ class MenuEditor(object):
         item_iter = menu.iter()
         item_type = item_iter.next()
         while item_type != GMenu.TreeItemType.INVALID:
-            if item_type == GMenu.TreeItemType.SEPARATOR:
+            item = None
+            if item_type == GMenu.TreeItemType.ENTRY:
+                item = item_iter.get_entry()
+            elif item_type == GMenu.TreeItemType.DIRECTORY:
+                item = item_iter.get_directory()
+            elif item_type == GMenu.TreeItemType.HEADER:
+                item = item_iter.get_header()
+            elif item_type == GMenu.TreeItemType.ALIAS:
+                item = item_iter.get_alias()
+            elif item_type == GMenu.TreeItemType.SEPARATOR:
                 item = item_iter.get_separator()
-                yield (item, True)
-            else:
-                if item_type == GMenu.TreeItemType.ENTRY:
-                    item = item_iter.get_entry()
-                elif item_type == GMenu.TreeItemType.DIRECTORY:
-                    item = item_iter.get_directory()
-                elif item_type == GMenu.TreeItemType.HEADER:
-                    item = item_iter.get_header()
-                elif item_type == GMenu.TreeItemType.ALIAS:
-                    item = item_iter.get_alias()
-                yield (item, self.isVisible(item))
+            yield (item, self.isVisible(item))
             item_type = item_iter.next()
 
     def canRevert(self, item):



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