~ubuntu-branches/ubuntu/lucid/tomboy/lucid-proposed

« back to all changes in this revision

Viewing changes to Tomboy/RemoteControl.cs

  • Committer: Bazaar Package Importer
  • Author(s): Brandon Hale
  • Date: 2004-10-11 09:31:35 UTC
  • Revision ID: james.westby@ubuntu.com-20041011093135-00f2snu2ny5i6wto
Tags: upstream-0.2.0
ImportĀ upstreamĀ versionĀ 0.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
using DBus;
 
3
using System;
 
4
 
 
5
namespace Tomboy
 
6
{
 
7
        public class RemoteControl : RemoteControlProxy
 
8
        {
 
9
                private NoteManager note_manager;
 
10
 
 
11
                public RemoteControl (NoteManager mgr)
 
12
                {
 
13
                        note_manager = mgr;
 
14
                }
 
15
 
 
16
                public override bool DisplayNote (string uri)
 
17
                {
 
18
                        Note note;
 
19
 
 
20
                        note = note_manager.FindByUri (uri);
 
21
                        if (note == null)
 
22
                                return false;
 
23
 
 
24
                        note.Window.Present ();
 
25
                        return true;
 
26
                }
 
27
 
 
28
                public override string FindNote (string linked_title)
 
29
                {
 
30
                        Note note;
 
31
                        note = note_manager.Find (linked_title);
 
32
                        return (note == null) ? "" : note.Uri;
 
33
                }
 
34
 
 
35
                public override string CreateNote ()
 
36
                {
 
37
                        Note note;
 
38
                        note = note_manager.Create ();
 
39
                        return note.Uri;
 
40
                }
 
41
 
 
42
                public override string CreateNamedNote (string linked_title)
 
43
                {
 
44
                        Note note;
 
45
                        
 
46
                        note = note_manager.Find (linked_title);
 
47
                        if (note != null)
 
48
                                return "";
 
49
 
 
50
                        note = note_manager.Create (linked_title);
 
51
                        return note.Uri;
 
52
                }
 
53
 
 
54
                public override bool DeleteNote (string uri)
 
55
                {
 
56
                        Note note;
 
57
 
 
58
                        note = note_manager.FindByUri (uri);
 
59
                        if (note == null)
 
60
                                return false;
 
61
 
 
62
                        note_manager.Delete (note);
 
63
                        return true;
 
64
                }
 
65
        }
 
66
}