<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>FAQ</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -51,6 +51,10 @@
       be there as well when restoring the session. Formerly the main window
       would always be shown.
 
+    * Empty directories are not shown in the tree view. This includes
+      directories that contain no playable files. Directories which only
+      contain empty subdirectories are not shown as well, recursively.
+
 
 0.5.1	2007-08-25
 </diff>
      <filename>NEWS</filename>
    </modified>
    <modified>
      <diff>@@ -22,6 +22,7 @@ class TreeView(kdeui.KListView):
         self.root = None
         self.timer = qt.QTimer(self, 'tree view timer')
         self.iterator = None
+        self.empty_directories = set()
         self.automatically_opened = set()
 
         self.addColumn('')
@@ -106,6 +107,7 @@ class TreeView(kdeui.KListView):
     def slot_show_directory(self, directory):
         &quot;&quot;&quot;Changes the TreeView root to the specified directory.&quot;&quot;&quot;
         self.clear()
+        self.empty_directories.clear()
         self.automatically_opened.clear()
         self.setUpdatesEnabled(True) # can be unset if not finished populating
         self.root = util.kurl_to_path(directory)
@@ -128,6 +130,9 @@ class TreeView(kdeui.KListView):
             self.iterator = None
             self.setUpdatesEnabled(True)
             self.repaint()
+            for item in self.empty_directories:
+                (item.parent() or self).takeItem(item)
+                del item # necessary?
             self.emit(qt.PYSIGNAL('scan_in_progress'), (False,))
 
     def slot_search_finished(self, null_search):
@@ -332,16 +337,33 @@ class TreeViewSearchLineWidget(kdeui.KListViewSearchLineWidget):
 ##
 
 def _populate_tree(parent, directory):
-    &quot;&quot;&quot;A helper function to populate either a TreeView or a DirectoryItem.&quot;&quot;&quot;
+    &quot;&quot;&quot;A helper function to populate either a TreeView or a DirectoryItem.
+    
+    It updates TreeView's empty_directories set as appropriate.
+    &quot;&quot;&quot;
     try:
         files = os.listdir(directory)
     except OSError, e:
         minirok.logger.warn('could not list directory: %s', e)
         return
 
+    try:
+        listview = parent.listView()
+    except AttributeError:
+        listview = parent
+
+    has_children = False
+
     for filename in files:
         path = os.path.join(directory, filename)
         if os.path.isdir(path):
-            DirectoryItem(parent, path)
+            item = DirectoryItem(parent, path)
+            listview.empty_directories.add(item)
         elif minirok.Globals.engine.can_play(path):
             FileItem(parent, path)
+            has_children = True
+
+    if has_children:
+        while parent:
+            listview.empty_directories.discard(parent)
+            parent = parent.parent()</diff>
      <filename>minirok/tree_view.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>d16827f9764a5887151e88ff9df26aa23d5ed9f7</id>
    </parent>
  </parents>
  <author>
    <name>Adeodato Sim&#243;</name>
    <email>dato@net.com.org.es</email>
  </author>
  <url>http://github.com/dato/minirok/commit/eab7ea3a2d7f51fdd36a5ffe64328d1a05a51d6f</url>
  <id>eab7ea3a2d7f51fdd36a5ffe64328d1a05a51d6f</id>
  <committed-date>2007-09-04T02:32:14-07:00</committed-date>
  <authored-date>2007-09-04T02:32:14-07:00</authored-date>
  <message>Do not show empty directories in the tree view.</message>
  <tree>d06e905565ff5e27636f9aa9cd81d2fc424bff84</tree>
  <committer>
    <name>Adeodato Sim&#243;</name>
    <email>dato@net.com.org.es</email>
  </committer>
</commit>
