diff options
author | Manish Sinha <manishsinha@ubuntu.com> | 2011-04-27 00:08:12 +0530 |
---|---|---|
committer | Manish Sinha <manishsinha@ubuntu.com> | 2011-04-27 00:08:12 +0530 |
commit | 4fd2287916b0c2790aa0684b41c6160d2f1c71e6 (patch) | |
tree | d79f3b9426241401113c8049cc70aabbc24336a3 /tomboy/NoteHandler.cs | |
parent | 6aade94fa6358f881cfb75122a1f08b370e64852 (diff) |
Fixed the Tomboy dataprovider to not connect and then disconnect to the SessionBus every time a single event is pushed. Keep it connected and push only when needed
Diffstat (limited to 'tomboy/NoteHandler.cs')
-rw-r--r-- | tomboy/NoteHandler.cs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tomboy/NoteHandler.cs b/tomboy/NoteHandler.cs index 5e44a10..afe842f 100644 --- a/tomboy/NoteHandler.cs +++ b/tomboy/NoteHandler.cs @@ -6,13 +6,14 @@ namespace Tomboy.Zeitgeist { public class NoteHandler { - public NoteHandler(Note note) + public NoteHandler(Note note, ZeitgeistHandler handler) { // Check if the Note has already been processes. // Whent he note is being processed, event handlers are attached to if (handledNotes.Contains(note) == false) { this._note = note; + this._handler = handler; note.Opened += HandleNoteOpened; if (note.HasWindow) @@ -41,7 +42,7 @@ namespace Tomboy.Zeitgeist void HandleNoteRenamed (Note sender, string old_title) { Console.WriteLine("Zg#: Renamed: " + this._note.Title); - ZeitgeistHandler.SendEvent(sender, Interpretation.Instance.EventInterpretation.ModifyEvent); + this._handler.SendEvent(sender, Interpretation.Instance.EventInterpretation.ModifyEvent); } void HandleNoteWindowShown (object sender, EventArgs e) @@ -52,18 +53,20 @@ namespace Tomboy.Zeitgeist void HandleNoteWindowShown () { Console.WriteLine("Zg#: Note window opened: " + this._note.Title); - ZeitgeistHandler.SendEvent(this._note, Interpretation.Instance.EventInterpretation.AccessEvent); + this._handler.SendEvent(this._note, Interpretation.Instance.EventInterpretation.AccessEvent); } void HandleNoteWindowHidden (object sender, EventArgs e) { Console.WriteLine("Zg#: Note window closed: " + this._note.Title); - ZeitgeistHandler.SendEvent(this._note, Interpretation.Instance.EventInterpretation.LeaveEvent); + this._handler.SendEvent(this._note, Interpretation.Instance.EventInterpretation.LeaveEvent); } private Note _note; private static List<Note> handledNotes = new List<Note>(); + + private ZeitgeistHandler _handler; } } |