Fix for Tomboy indexing
- From: Larry Reaves <larry moonshinecomputers com>
- To: dashboard-hackers gnome org
- Subject: Fix for Tomboy indexing
- Date: Tue, 25 Jan 2005 19:23:04 -0500
Attached is a simple patch to fix a bug in the Tomboy indexer. After
the initial installation of Tomboy, there is no Backup Directory created
until a note is deleted. These changes enable it to work without the
Backup directory and, if it is created, starts to watch it too. Patch
is against current CVS.
Larry Reaves
--- beagle/beagled/TomboyQueryable/TomboyQueryable.cs 2005-01-25 18:14:22.736263736 -0500
+++ beagle-tomboyfix/beagled/TomboyQueryable/TomboyQueryable.cs 2005-01-25 19:11:03.540262944 -0500
@@ -54,10 +54,10 @@
{
base.Start ();
- // FIXME: We should do something more reasonable if
- // ~/.tomboy doesn't exist.
- if (! (Directory.Exists (notesDir) && Directory.Exists (backupDir)))
+ if (! Directory.Exists (notesDir) ) {
+ log.Info("Failed to Scan Tomboy, perhaps it is not installed");
return;
+ }
Inotify.EventType mask;
mask = Inotify.EventType.MovedTo
@@ -67,7 +67,9 @@
| Inotify.EventType.Modify;
wdNotes = Inotify.Watch (notesDir, mask);
- wdBackup = Inotify.Watch (backupDir, mask);
+
+ if ( Directory.Exists (backupDir) )
+ wdBackup = Inotify.Watch (backupDir, mask);
Inotify.Event += OnInotifyEvent;
@@ -104,11 +106,22 @@
//Console.WriteLine ("*** {0} {1} {2}", path, subitem, type);
// Ignore backup files, tmp files, etc.
- if (Path.GetExtension (subitem) != ".note")
+ if (subitem != "Backup" && Path.GetExtension (subitem) != ".note")
return;
if (wd == wdNotes && type == Inotify.EventType.MovedTo) {
- IndexNote (new FileInfo (Path.Combine (path, subitem)), Scheduler.Priority.Immediate);
+ if (subitem == "Backup") {
+ Inotify.EventType mask;
+ mask = Inotify.EventType.MovedTo
+ | Inotify.EventType.MovedFrom
+ | Inotify.EventType.CreateFile
+ | Inotify.EventType.DeleteFile
+ | Inotify.EventType.Modify;
+
+ wdBackup = Inotify.Watch (backupDir, mask);
+ log.Info("Tomboy: Backup dir was created, adding file descriptor");
+ } else
+ IndexNote (new FileInfo (Path.Combine (path, subitem)), Scheduler.Priority.Immediate);
//Console.WriteLine ("Indexed {0}", Path.Combine (path, subitem));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]