<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -29,7 +29,7 @@ class FileMonitor(object):
     FileMonitor Class keeps track of all files down a tree starting at the root
     &quot;&quot;&quot;
 
-    def __init__(self, db_wrapper, root, config):
+    def __init__(self, db_wrapper, root, config, on_complete=None):
         self._file_count = 0
         self._db_wrapper = db_wrapper
         self._root = os.path.realpath(root)
@@ -45,7 +45,7 @@ class FileMonitor(object):
         self._notifier.start()
 
         # initial walk
-        self.add_dir(self._root)
+        self.add_dir(self._root, on_complete = on_complete)
 
     def _set_ignore_list(self):
         log.info(&quot;[FileMonitor] Set Regexs for Ignore List&quot;)
@@ -59,14 +59,14 @@ class FileMonitor(object):
             log.debug(&quot;[FileMonitor] Ignore Regex = %s&quot; % ignore)
             self._ignore_regexs.append(re.compile(ignore))
 
-    def add_dir(self, path):
+    def add_dir(self, path, on_complete=None):
         &quot;&quot;&quot;
         Starts a WalkDirectoryThread to add the directory
         &quot;&quot;&quot;
         if self.validate(path, is_file=False):
             self._watch_manager.add_watch(path, EVENT_MASK, rec=True)
             self._walk_thread = WalkDirectoryThread(self, path,
-                self._ignore_regexs)
+                self._ignore_regexs, on_complete)
 
     def _make_relative_path(self, path):
         if path.startswith(self._root):
@@ -128,12 +128,13 @@ class WalkDirectoryThread(Thread):
     to the database.
     &quot;&quot;&quot;
 
-    def __init__(self, file_monitor, root, ignore_regexs):
+    def __init__(self, file_monitor, root, ignore_regexs, on_complete=None):
         log.debug(&quot;[FileMonitor] WalkDirectoryThread Root: %s&quot; % root)
         Thread.__init__(self)
         self._file_monitor = file_monitor
         self._root = root
         self._ignore_regexs = ignore_regexs
+        self._on_complete = on_complete
         self.start()
 
     def run(self):
@@ -149,6 +150,8 @@ class WalkDirectoryThread(Thread):
                     if not os.path.isdir(os.path.join(path, name)):
                         self._file_monitor.add_file(path, name)
         log.info(&quot;***** Total files %s *****&quot; % (self._file_monitor._file_count, ))
+        if self._on_complete:
+            self._on_complete()
 
     def _walk_file_system(self, root):
         &quot;&quot;&quot;</diff>
      <filename>gedit-openfiles/FileMonitor.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>58a7eefa2e952a482deba8a504e556dca60d12d5</id>
    </parent>
  </parents>
  <author>
    <name>Tim Cuthbertson</name>
    <email>tim3d.junk@gmail.com</email>
  </author>
  <url>http://github.com/gfxmonk/file-finder/commit/ec0a87af5df1c484a65f65ce874e37748e069507</url>
  <id>ec0a87af5df1c484a65f65ce874e37748e069507</id>
  <committed-date>2009-11-02T19:55:02-08:00</committed-date>
  <authored-date>2009-11-02T19:55:02-08:00</authored-date>
  <message>added on_complete callback handler to FileMonitor for notification of initial scan completion

Conflicts:

	gedit-openfiles/FileMonitor.py</message>
  <tree>6031eb24853c9c1a57b95aa644478ed58fc07e8c</tree>
  <committer>
    <name>Tim Cuthbertson</name>
    <email>tim3d.junk@gmail.com</email>
  </committer>
</commit>
