~cszikszoy/do-plugins/pastebin

« back to all changes in this revision

Viewing changes to Tomboy/src/TomboyItem.cs

Spring cleaning. God Monodevelop is a luxury.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
20
using System;
21
 
using System.Threading;
22
 
 
23
 
using Do.Addins;
24
21
using Do.Universe;
25
22
 
26
 
namespace Do.Addins.Tomboy
 
23
namespace Tomboy
27
24
{
28
 
        
29
25
        public class TomboyItem : IOpenableItem
30
26
        {
31
27
                string title;
32
 
                long changed_date;
 
28
                
33
29
                /// <summary>
34
30
                /// The Tomboy Item only has one property, the title
35
31
                /// </summary>
36
32
                /// <param name="note_title">
37
33
                /// A <see cref="System.String"/>
38
34
                /// </param>
39
 
                public TomboyItem(TomboyItemSource.NoteStruct note)
 
35
                public TomboyItem (string title)
40
36
                {
41
 
                        this.title = note.title;
42
 
                        this.changed_date = note.changed_date;
43
 
                }
44
 
                
45
 
                public string Name { get { return title; } }
 
37
                        this.title = title;
 
38
                }
 
39
                
 
40
                public string Name {
 
41
                        get { return title; }
 
42
                }
 
43
                
46
44
                public string Description {
47
45
                        get { 
48
 
                                // This is an example of a UNIX timestamp for the date/time 11-04-2005 09:25.
49
 
                                // First make a System.DateTime equivalent to the UNIX Epoch.
50
 
                                System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0);
51
 
 
52
 
                                // Add the number of seconds in UNIX timestamp to be converted.
53
 
                                dateTime = dateTime.AddSeconds(changed_date);
54
 
 
55
 
                                // The dateTime now contains the right date/time so to format the string,
56
 
                                // use the standard formatting methods of the DateTime object.
57
 
                                string printDate = dateTime.ToShortDateString() +" "+ dateTime.ToShortTimeString();
58
 
 
59
 
                                // Print the date and time
60
 
                                string desc = "Last changed at: " + printDate; 
61
 
                                return desc; 
 
46
                                return "Tomboy note"; 
62
47
                        } 
63
48
                }
64
 
                public string Icon { get { return "tomboy"; } }
 
49
                
 
50
                public string Icon {
 
51
                        get {
 
52
                                return "tomboy";
 
53
                        }
 
54
                }
65
55
                
66
56
                /// <summary>
67
 
                /// This is because we implement IRunnableItem
 
57
                /// This is because we implement IOpenableItem
68
58
                /// We use this method to run this instance of the item
69
59
                /// </summary>
70
 
                public void Open () {
71
 
                        TomboyDBus tomboy_instance = new TomboyDBus();
72
 
                        tomboy_instance.OpenNote(title);
 
60
                public void Open ()
 
61
                {
 
62
                        new TomboyDBus ().OpenNote (title);
73
63
                }
74
64
        }
75
65
}