Merge lp:~manishsinha/zeitgeist-datasources/fix-tomboy-mimetype-mono-dependency into lp:zeitgeist-datasources/0.8

Status: Merged
Approved by: Seif Lotfy
Approved revision: 104
Merged at revision: 97
Proposed branch: lp:~manishsinha/zeitgeist-datasources/fix-tomboy-mimetype-mono-dependency
Merge into: lp:zeitgeist-datasources/0.8
Diff against target: 790 lines (+435/-255)
12 files modified
.bzrignore (+6/-0)
configure.ac (+50/-4)
tomboy/AssemblyInfo.cs (+27/-0)
tomboy/Makefile.am (+48/-0)
tomboy/NoteHandler.cs (+69/-0)
tomboy/Zeitgeist.addin.xml (+0/-21)
tomboy/Zeitgeist.cs (+72/-189)
tomboy/Zeitgeist.mdp (+0/-28)
tomboy/ZeitgeistAddin.cs (+90/-0)
tomboy/ZeitgeistDataprovider.addin.xml (+21/-0)
tomboy/ZeitgeistDataprovider.csproj (+52/-0)
tomboy/install.sh (+0/-13)
To merge this branch: bzr merge lp:~manishsinha/zeitgeist-datasources/fix-tomboy-mimetype-mono-dependency
Reviewer Review Type Date Requested Status
Michal Hruby (community) build system Approve
Review via email: mp+40475@code.launchpad.net

Commit message

A working Tomboy dataprovider which logs the following events
* Open Note
* Close Note
* Add Note
* Delete Note

Uses zeitgeist-sharp 0.1.0.3 package which can be installed from
https://launchpad.net/zeitgeist-sharp/+milestone/0.1.0.1

1) Change the mimetype from x-tomboy to x-note
2) Remove the hard dependency on mono. The build script just checks for availability of mono

Description of the change

A working Tomboy dataprovider which logs the following events
* Open Note
* Close Note
* Add Note
* Delete Note

Uses zeitgeist-sharp 0.1.0.3 package which can be installed from
https://launchpad.net/zeitgeist-sharp/+milestone/0.1.0.1

1) Change the mimetype from x-tomboy to x-note
2) Remove the hard dependency on mono. The build script just checks for availability of mono

To post a comment you must log in.
101. By Manish Sinha (मनीष सिन्हा)

Added check for gtk-sharp and fixed indentation

102. By Manish Sinha (मनीष सिन्हा)

Changed compulsary checking of packages in tomboy section

Revision history for this message
Michal Hruby (mhr3) wrote :

I think the with/without-mono option isn't really necessary, with-mono is covered by --enable-all-plugins and without is detected automatically, and moreover if one specifies only --with-mono, configure will basically ignore it if mono dependencies are not installed.

The only question is what should happen if one would configure with "--enable-all-plugins --without-mono"

review: Needs Information
Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

if you try to configure with "--enable-all-plugins --without-mono"
then the configure fails, since mono is required for tomboy. The output is
http://paste.ubuntu.com/529369/

Revision history for this message
Michal Hruby (mhr3) wrote :

Which further proves my point that the option is useless, please remove it.

review: Needs Fixing
103. By Manish Sinha (मनीष सिन्हा)

Changed configure.ac for the configure script to not fail if mono is not available or --with-mono=no with --enable-all-plugins

Revision history for this message
Michal Hruby (mhr3) wrote :

Approving from the configure/make POV, if someone wants to take a close look on the DP itself, please go ahead...

review: Approve (build system)
Revision history for this message
Seif Lotfy (seif) wrote :

works like charm

104. By Manish Sinha (मनीष सिन्हा)

Merge Markus Korn's (thekorn) tomboy local-install and local-uninstall implementation

Revision history for this message
Seif Lotfy (seif) wrote :

Tomboy crashes upon opening a note
------------------------------------

seif@Wumbo:~/Projects$ tomboy
[INFO 13:59:30.892] Initializing Mono.Addins
Zg#: init new
Zg#: init new
Zg#: Note window opened: Events
Operation AccessEvent successful
Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.Exception: org.freedesktop.DBus.Error.NoReply: Message did not receive a reply (timeout by message bus)
  at Zeitgeist.Client.ILogProxy.InsertEvents (Zeitgeist.Datamodel.RawEvent[] events) [0x00000] in <filename unknown>:0
  at Zeitgeist.LogClient.InsertEvents (System.Collections.Generic.List`1 events) [0x00000] in <filename unknown>:0
  at Tomboy.Zeitgeist.ZeitgeistHandler.SendEvent (System.Collections.Generic.List`1 e) [0x00000] in <filename unknown>:0
  at Tomboy.Zeitgeist.ZeitgeistHandler+<SendEvent>c__AnonStorey0.<>m__0 () [0x00000] in <filename unknown>:0
  at GLib.Idle+IdleProxy.Handler () [0x00000] in <filename unknown>:0
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal)
   at GLib.Idle+IdleProxy.Handler()
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at Gnome.Program.Run()
   at Tomboy.GnomeApplication.StartMainLoop()
   at Tomboy.Application.StartMainLoop()
   at Tomboy.Tomboy.StartTrayIcon()
   at Tomboy.Tomboy.Main(System.String[] args)

Revision history for this message
Seif Lotfy (seif) wrote :

Scratch that invalid comment due testing a broken zeitgeist DB

> Tomboy crashes upon opening a note
> ------------------------------------
>
> seif@Wumbo:~/Projects$ tomboy
> [INFO 13:59:30.892] Initializing Mono.Addins
> Zg#: init new
> Zg#: init new
> Zg#: Note window opened: Events
> Operation AccessEvent successful
> Exception in Gtk# callback delegate
> Note: Applications can use GLib.ExceptionManager.UnhandledException to
> handle the exception.
> System.Exception: org.freedesktop.DBus.Error.NoReply: Message did not receive
> a reply (timeout by message bus)
> at Zeitgeist.Client.ILogProxy.InsertEvents (Zeitgeist.Datamodel.RawEvent[]
> events) [0x00000] in <filename unknown>:0
> at Zeitgeist.LogClient.InsertEvents (System.Collections.Generic.List`1
> events) [0x00000] in <filename unknown>:0
> at Tomboy.Zeitgeist.ZeitgeistHandler.SendEvent
> (System.Collections.Generic.List`1 e) [0x00000] in <filename unknown>:0
> at Tomboy.Zeitgeist.ZeitgeistHandler+<SendEvent>c__AnonStorey0.<>m__0 ()
> [0x00000] in <filename unknown>:0
> at GLib.Idle+IdleProxy.Handler () [0x00000] in <filename unknown>:0
> at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e,
> Boolean is_terminal)
> at GLib.Idle+IdleProxy.Handler()
> at Gtk.Application.gtk_main()
> at Gtk.Application.Run()
> at Gnome.Program.Run()
> at Tomboy.GnomeApplication.StartMainLoop()
> at Tomboy.Application.StartMainLoop()
> at Tomboy.Tomboy.StartTrayIcon()
> at Tomboy.Tomboy.Main(System.String[] args)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2010-05-12 06:44:01 +0000
+++ .bzrignore 2010-11-12 17:39:29 +0000
@@ -1,3 +1,9 @@
1firefox*/*.xpi1firefox*/*.xpi
2firefox-libzg/extension/components/zeitgeist.h2firefox-libzg/extension/components/zeitgeist.h
3firefox-libzg/extension/components/zeitgeist.xpt3firefox-libzg/extension/components/zeitgeist.xpt
4Makefile
5Makefile.in
6.deps
7.libs
8*.la
9*.lo
410
=== modified file 'configure.ac'
--- configure.ac 2010-11-02 21:04:17 +0000
+++ configure.ac 2010-11-12 17:39:29 +0000
@@ -35,6 +35,20 @@
35AM_CONDITIONAL(ENABLE_VALA, test "x$with_vala" = "xyes")35AM_CONDITIONAL(ENABLE_VALA, test "x$with_vala" = "xyes")
3636
37dnl ==============================================37dnl ==============================================
38dnl Check for Mono
39dnl ==============================================
40
41AC_ARG_WITH([mono],
42 AS_HELP_STRING([--without-mono],
43 [Disables Mono plugins]),
44 [],[with_mono=yes])
45
46AM_CONDITIONAL(ENABLE_MONO, test "x$with_mono" = "xyes")
47
48AC_PATH_PROG(GMCS, gmcs, no)
49AC_PATH_PROG(XBUILD, xbuild, no)
50
51dnl ==============================================
38dnl Check commonly used packages52dnl Check commonly used packages
39dnl ==============================================53dnl ==============================================
4054
@@ -51,8 +65,8 @@
51AC_MSG_RESULT($all_plugins)65AC_MSG_RESULT($all_plugins)
5266
53# The full list of plugins67# The full list of plugins
54allowed_plugins="bzr chrome eog firefox-libzg geany gedit rhythmbox totem-libzg vim emacs"68allowed_plugins="bzr chrome eog firefox-libzg geany gedit rhythmbox totem-libzg vim emacs tomboy"
55# currently disabled = "epiphany tomboy"69# currently disabled = "epiphany"
5670
57# npapi-plugin has a template Makefile.am, but don't use it directly71# npapi-plugin has a template Makefile.am, but don't use it directly
58# - see chrome's Makefile.am for how to compile it72# - see chrome's Makefile.am for how to compile it
@@ -152,8 +166,36 @@
152 fi166 fi
153 ;;167 ;;
154 tomboy)168 tomboy)
155 # not supported atm169 if test "${with_mono}" != "yes" ; then
156 continue170 continue
171 fi
172 PKG_CHECK_MODULES(ZEITGEIST_SHARP, zeitgeist-sharp,
173 ENABLE_ZEITGEIST_SHARP=yes, ENABLE_ZEITGEIST_SHARP=no)
174 PKG_CHECK_MODULES(TOMBOY_ADDINS, tomboy-addins)
175 PKG_CHECK_MODULES(GTK_SHARP, gtk-sharp-2.0,
176 HAS_GTK_SHARP=yes, HAS_GTK_SHARP=no)
177 if test "${ENABLE_ZEITGEIST_SHARP}" = "no" ; then
178 plugin_error_or_ignore "zeitgeist-sharp package not found"
179 continue
180 fi
181 AC_PATH_PROG(TOMBOY, tomboy, no)
182 if test "x$TOMBOY" = "xno"; then
183 plugin_error_or_ignore "You need to install tomboy"
184 continue
185 fi
186 if test "x$GMCS" = "xno"; then
187 plugin_error_or_ignore "You need to install gmcs"
188 continue
189 fi
190 if test "x$XBUILD" = "xno"; then
191 plugin_error_or_ignore "You need to install xbuild"
192 continue
193 fi
194 if test "x$GTK_SHARP" = "xno"; then
195 plugin_error_or_ignore "You need to install gtk-sharp"
196 continue
197 fi
198 AC_SUBST(ZEITGEIST_SHARP_LIBS)
157 ;;199 ;;
158 totem*)200 totem*)
159 if test "${with_vala}" != "yes" ; then201 if test "${with_vala}" != "yes" ; then
@@ -241,6 +283,10 @@
241 AC_CONFIG_FILES([geany/Makefile])283 AC_CONFIG_FILES([geany/Makefile])
242 continue 2284 continue 2
243 ;;285 ;;
286 tomboy)
287 AC_CONFIG_FILES([tomboy/Makefile])
288 continue 2
289 ;;
244 gedit)290 gedit)
245 AC_CONFIG_FILES([gedit/Makefile])291 AC_CONFIG_FILES([gedit/Makefile])
246 continue 2292 continue 2
247293
=== added file 'tomboy/AssemblyInfo.cs'
--- tomboy/AssemblyInfo.cs 1970-01-01 00:00:00 +0000
+++ tomboy/AssemblyInfo.cs 2010-11-12 17:39:29 +0000
@@ -0,0 +1,27 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3
4// Information about this assembly is defined by the following attributes.
5// Change them to the values specific to your project.
6
7[assembly: AssemblyTitle("ZeitgeistDataProvider")]
8[assembly: AssemblyDescription("Handles the pushing of Tomboy events to Zeitgeist")]
9[assembly: AssemblyConfiguration("")]
10[assembly: AssemblyCompany("")]
11[assembly: AssemblyProduct("")]
12[assembly: AssemblyCopyright("")]
13[assembly: AssemblyTrademark("")]
14[assembly: AssemblyCulture("")]
15
16// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17// The form "{Major}.{Minor}.*" will automatically update the build and revision,
18// and "{Major}.{Minor}.{Build}.*" will update just the revision.
19
20[assembly: AssemblyVersion("1.0.*")]
21
22// The following attributes are used to specify the signing key for the assembly,
23// if desired. See the Mono documentation for more information about signing.
24
25//[assembly: AssemblyDelaySign(false)]
26//[assembly: AssemblyKeyFile("")]
27
028
=== added file 'tomboy/Makefile.am'
--- tomboy/Makefile.am 1970-01-01 00:00:00 +0000
+++ tomboy/Makefile.am 2010-11-12 17:39:29 +0000
@@ -0,0 +1,48 @@
1CSFLAGS = \
2 -debug \
3 -define:DEBUG \
4 -target:library
5
6ASSEMBLIES = \
7 $(TOMBOY_ADDINS_LIBS) \
8 $(GTK_SHARP_LIBS) \
9 $(ZEITGEIST_SHARP_LIBS) \
10 -r:Mono.Posix
11
12ADDIN_NAME = ZeitgeistDataprovider
13TARGET = $(ADDIN_NAME).dll
14CSFILES = \
15 $(srcdir)/Zeitgeist.cs \
16 $(srcdir)/ZeitgeistAddin.cs \
17 $(srcdir)/NoteHandler.cs \
18 $(srcdir)/AssemblyInfo.cs
19RESOURCES = \
20 -resource:$(srcdir)/$(ADDIN_NAME).addin.xml
21
22$(TARGET): $(CSFILES)
23 $(GMCS) -out:$@ $(CSFLAGS) $(ASSEMBLIES) $(CSFILES) $(RESOURCES)
24
25
26addinsdir = $(libdir)/tomboy/addins
27addins_DATA = $(TARGET)
28
29EXTRA_DIST = \
30 $(CSFILES) \
31 $(srcdir)/$(ADDIN_NAME).addin.xml
32
33DISTCLEANFILES = \
34 $(TARGET) \
35 $(TARGET).mdb
36
37TOMBOY_ADDIN_HOME_DIR = ~/.config/tomboy/addins
38
39local-install: $(addins_DATA)
40 mkdir -p $(TOMBOY_ADDIN_HOME_DIR)
41 cp $(addins_DATA) $(TOMBOY_ADDIN_HOME_DIR)
42
43local-uninstall:
44 for f in $(addins_DATA); \
45 do \
46 echo remove $$f; \
47 rm -f $(TOMBOY_ADDIN_HOME_DIR)/$$f; \
48 done
049
=== added file 'tomboy/NoteHandler.cs'
--- tomboy/NoteHandler.cs 1970-01-01 00:00:00 +0000
+++ tomboy/NoteHandler.cs 2010-11-12 17:39:29 +0000
@@ -0,0 +1,69 @@
1using System;
2using Zeitgeist.Datamodel;
3using System.Collections.Generic;
4
5namespace Tomboy.Zeitgeist
6{
7 public class NoteHandler
8 {
9 public NoteHandler(Note note)
10 {
11 // Check if the Note has already been processes.
12 // Whent he note is being processed, event handlers are attached to
13 if (handledNotes.Contains(note) == false)
14 {
15 this._note = note;
16
17 note.Opened += HandleNoteOpened;
18 if (note.HasWindow)
19 {
20 HandleNoteOpened();
21 }
22 }
23 }
24
25 void HandleNoteOpened (object sender, EventArgs e)
26 {
27 HandleNoteOpened();
28 }
29
30 void HandleNoteOpened()
31 {
32 this._note.Window.Hidden += HandleNoteWindowHidden;
33 this._note.Window.Shown += HandleNoteWindowShown;
34 this._note.Renamed += HandleNoteRenamed;
35 if (this._note.Window.Visible)
36 {
37 HandleNoteWindowShown();
38 }
39 }
40
41 void HandleNoteRenamed (Note sender, string old_title)
42 {
43 Console.WriteLine("Zg#: Renamed: " + this._note.Title);
44 ZeitgeistHandler.SendEvent(sender, Interpretation.Instance.EventInterpretation.ModifyEvent);
45 }
46
47 void HandleNoteWindowShown (object sender, EventArgs e)
48 {
49 HandleNoteWindowShown();
50 }
51
52 void HandleNoteWindowShown ()
53 {
54 Console.WriteLine("Zg#: Note window opened: " + this._note.Title);
55 ZeitgeistHandler.SendEvent(this._note, Interpretation.Instance.EventInterpretation.AccessEvent);
56 }
57
58 void HandleNoteWindowHidden (object sender, EventArgs e)
59 {
60 Console.WriteLine("Zg#: Note window closed: " + this._note.Title);
61 ZeitgeistHandler.SendEvent(this._note, Interpretation.Instance.EventInterpretation.LeaveEvent);
62 }
63
64 private Note _note;
65
66 private static List<Note> handledNotes = new List<Note>();
67 }
68}
69
070
=== removed file 'tomboy/Zeitgeist.addin.xml'
--- tomboy/Zeitgeist.addin.xml 2010-08-16 11:07:09 +0000
+++ tomboy/Zeitgeist.addin.xml 1970-01-01 00:00:00 +0000
@@ -1,21 +0,0 @@
1<Addin id="Zeitgeist"
2 namespace="Tomboy"
3 name="Zeitgeist Integration"
4 author="Laszlo Pandy laszlok2@gmail.com"
5 description="Logs usage data to Zeitgeist."
6 category="Desktop Integration"
7 defaultEnabled="true"
8 version="0.1">
9
10 <Runtime>
11 <Import assembly="Zeitgeist.dll" />
12 </Runtime>
13
14 <Dependencies>
15 <Addin id="Tomboy" version="0.10" />
16 </Dependencies>
17
18 <Extension path="/Tomboy/ApplicationAddins">
19 <ApplicationAddin type="Tomboy.Zeitgeist.ZeitgeistAddin" />
20 </Extension>
21</Addin>
220
=== modified file 'tomboy/Zeitgeist.cs'
--- tomboy/Zeitgeist.cs 2010-08-19 10:33:11 +0000
+++ tomboy/Zeitgeist.cs 2010-11-12 17:39:29 +0000
@@ -1,200 +1,83 @@
1
2using System;1using System;
2using Zeitgeist.Datamodel;
3using Zeitgeist;
3using System.Collections.Generic;4using System.Collections.Generic;
4using Tomboy;5using Tomboy;
5using NDesk.DBus;
6using Gtk;
7using GLib;
8using Mono.Unix.Native;
96
10namespace Tomboy.Zeitgeist7namespace Tomboy.Zeitgeist
11{8{
12 class NoteHandler 9 public class ZeitgeistHandler
13 {10 {
14 private static List<string> handled_notes = new List<string>();11 public static bool SendEvent(Note note, NameUri eventInterpretation)
15 private Note note;12 {
16 13 NameUri eventManifestation = Manifestation.Instance.EventManifestation.UserActivity;
17 public NoteHandler(Note note) {14
18 if (handled_notes.Contains(note.Id) == false) {15 NameUri subjectInterpretation = Interpretation.Instance.Document.Document;
19 this.note = note;16 NameUri subjectManifestation = Manifestation.Instance.FileDataObject.FileDataObject;
20 note.Opened += HandleNoteOpened;17
21 if (note.HasWindow) {18 Event ev = EventCreator.CreateEvent(note, eventInterpretation, eventManifestation, subjectInterpretation, subjectManifestation);
22 HandleNoteOpened();19
23 }20
24 }21 try
25 }22 {
26 23 List<Event> listOfEvents = new List<Event>();
27 void HandleNoteOpened (object sender, EventArgs e) {24 listOfEvents.Add(ev);
28 HandleNoteOpened();25
29 }26 GLib.Idle.Add(delegate()
30 void HandleNoteOpened() {27 {
31 note.Window.Hidden += HandleNoteWindowHidden;28 SendEvent(listOfEvents);
32 note.Window.Shown += HandleNoteWindowShown;29 return false;
33 note.Renamed += HandleNoteRenamed;30 });
34 if (note.Window.Visible) {31
35 HandleNoteWindowShown(); 32 Console.WriteLine(string.Format("Operation {0} successful", ev.Interpretation.Name));
36 }33 return true;
37 }34 }
3835 catch(Exception e)
39 void HandleNoteRenamed (Note sender, string old_title)36 {
40 {37 Console.WriteLine(e.StackTrace);
41 Console.WriteLine("Zg: Renamed: " + note.Title);38
42 ZeitgeistDbus.SendToZeitgeist(note, ZeitgeistDbus.EventInterpretation.ModifyEvent);
43 }
44
45 void HandleNoteWindowShown (object sender, EventArgs e) {
46 HandleNoteWindowShown();
47 }
48 void HandleNoteWindowShown ()
49 {
50 Console.WriteLine("Zg: Note window opened: " + note.Title);
51 ZeitgeistDbus.SendToZeitgeist(note, ZeitgeistDbus.EventInterpretation.OpenEvent);
52 }
53
54 void HandleNoteWindowHidden (object sender, EventArgs e)
55 {
56 Console.WriteLine("Zg: Note window closed: " + note.Title);
57 ZeitgeistDbus.SendToZeitgeist(note, ZeitgeistDbus.EventInterpretation.CloseEvent);
58 }
59 }
60
61 class ZeitgeistDbus
62 {
63 private static ILogger zeitgeist_proxy =
64 Bus.Session.GetObject<ILogger>("org.gnome.zeitgeist.Engine",
65 new ObjectPath("/org/gnome/zeitgeist/log/activity"));
66
67 public enum EventInterpretation {
68 OpenEvent,
69 CloseEvent,
70 CreateEvent,
71 ModifyEvent,
72 }
73
74 private static string GetEventInterpetation(EventInterpretation e) {
75 switch(e) {
76 case EventInterpretation.OpenEvent:
77 return "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#AccessEvent";
78 case EventInterpretation.CloseEvent:
79 return "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#LeaveEvent";
80 case EventInterpretation.CreateEvent:
81 return "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#CreateEvent";
82 case EventInterpretation.ModifyEvent:
83 return "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#ModifyEvent";
84 default:
85 return null;
86 }
87 }
88
89 public static void SendToZeitgeist(Note note, EventInterpretation ev_interp) {
90 if (zeitgeist_proxy == null) {
91 Console.WriteLine("Zg: cannot connect to zeitgeist, dbus proxy is null");
92 return;
93 }
94
95 string ev_interp_string = GetEventInterpetation(ev_interp);
96 if (ev_interp_string == null) {
97 Console.WriteLine("Zg: unknown interpretation type: " + ev_interp.ToString());
98 return;
99 }
100
101 Timeval t;
102 Syscall.gettimeofday(out t);
103 long millis_now = (t.tv_sec * 1000) + (t.tv_usec / 1000);
104
105 Event e = new Event();
106 e.metadata = new string[5];
107 e.metadata[0] = ""; //id (filled in by Zeitgeist)
108 e.metadata[1] = millis_now.ToString();
109 e.metadata[2] = ev_interp_string;
110 e.metadata[3] = "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#UserActivity";
111 e.metadata[4] = "application://tomboy.desktop";
112
113 string[] subject = new string[7];
114 subject[0] = note.Uri;
115 subject[1] = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Document";
116 subject[2] = "http://www.semanticdesktop.org/ontologies/nfo#FileDataObject";
117 subject[3] = ""; //origin
118 subject[4] = "application/x-tomboy"; //mimetype
119 subject[5] = note.Title;
120 subject[6] = ""; //storage id
121
122 e.subjects = new string[][] { subject };
123 e.payload = new byte[0];
124
125 GLib.Idle.Add(delegate() {
126 SendEvent(e);
127 return false;39 return false;
128 });40 }
129 }41 }
130 42
131 private static void SendEvent(Event e) {43 private static void SendEvent(List<Event> e)
132 int[] inserted;44 {
133 try {45 LogClient client = new LogClient();
134 inserted = zeitgeist_proxy.InsertEvents(new Event[] { e }); 46 client.InsertEvents(e);
135 } catch (Exception ex) {47 }
136 Console.WriteLine("Zg: insertion failed: " + ex.Message);48 }
137 return;49
138 }50 public class EventCreator
139
140 if (inserted.Length > 0) {
141 Console.WriteLine("Zg: Inserted event: " + inserted[0]);
142 }
143 else {
144 Console.WriteLine("Zg: Insertion failed");
145 }
146 return;
147 }
148 }
149
150 [NDesk.DBus.Interface ("org.gnome.zeitgeist.Log")]
151 interface ILogger {
152 int[] InsertEvents(Event[] events);
153 }
154
155 struct Event {
156 public string[] metadata;
157 public string[][] subjects;
158 public byte[] payload;
159 }
160
161 public class ZeitgeistAddin : ApplicationAddin
162 {51 {
163 private bool _init = false;52 public static Event CreateEvent(Note note,
164 public override bool Initialized {53 NameUri eventInterpretation,
165 get { return _init; }54 NameUri eventManifestation,
166 }55 NameUri subjectInterpretation,
167 56 NameUri subjectManifestation)
168 public override57 {
169 void Initialize() {58 Event ev = new Event();
170 Console.WriteLine("Zg: init new");59
171 init_handlers();60
172 _init = true;61 ev.Id = 0;
173 }62 ev.Timestamp = DateTime.Now;
174 63 ev.Interpretation = eventInterpretation;
175 public override64 ev.Manifestation = eventManifestation;
176 void Shutdown() {65 ev.Actor = ZeitgeistAddin.TomboyUri;
177 Console.WriteLine("Zg: shutdown");66
178 }67 Subject sub = new Subject();
179 68
180 void HandleNoteAdded(object sender, Note new_note) {69 sub.Uri = note.Uri;
181 Console.WriteLine("Zg: Note added: " + new_note.Title);70 sub.Interpretation = subjectInterpretation;
182 Console.WriteLine("\t" + new_note.Uri);71 sub.Manifestation = subjectManifestation;
183 72 sub.Origin = string.Empty;
184 new NoteHandler(new_note);73 sub.MimeType = ZeitgeistAddin.NoteMimetype;
185 ZeitgeistDbus.SendToZeitgeist(new_note, ZeitgeistDbus.EventInterpretation.CreateEvent);74 sub.Text = note.Title;
186 }75 sub.Storage = string.Empty;
187 76
188 public void init_handlers() {77 ev.Subjects.Add(sub);
189 foreach (Note note in Tomboy.DefaultNoteManager.Notes) {78
190 new NoteHandler(note);79 return ev;
191 }
192
193 Tomboy.DefaultNoteManager.NoteAdded -= HandleNoteAdded;
194 Tomboy.DefaultNoteManager.NoteAdded += HandleNoteAdded;
195 }80 }
196 }81 }
197
198
199
200}82}
83
20184
=== removed file 'tomboy/Zeitgeist.mdp'
--- tomboy/Zeitgeist.mdp 2010-08-16 10:57:40 +0000
+++ tomboy/Zeitgeist.mdp 1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
1<Project name="Zeitgeist" fileversion="2.0" DefaultNamespace="Zeitgeist" language="C#" targetFramework="2.0" ctype="DotNetProject">
2 <Configurations active="Debug">
3 <Configuration name="Debug" ctype="DotNetProjectConfiguration">
4 <Output directory="bin/Debug" assembly="Zeitgeist" />
5 <Build debugmode="True" target="Library" />
6 <Execution consolepause="False" runwithwarnings="True" runtime="MsNet" />
7 <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
8 </Configuration>
9 <Configuration name="Release" ctype="DotNetProjectConfiguration">
10 <Output directory="bin/Release" assembly="Zeitgeist" />
11 <Build debugmode="False" target="Library" />
12 <Execution consolepause="False" runwithwarnings="True" runtime="MsNet" />
13 <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
14 </Configuration>
15 </Configurations>
16 <Contents>
17 <File subtype="Code" buildaction="Compile" name="Zeitgeist.cs" />
18 <File subtype="Code" buildaction="EmbedAsResource" name="Zeitgeist.addin.xml" />
19 </Contents>
20 <References>
21 <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
22 <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
23 <ProjectReference type="Gac" localcopy="True" refto="NDesk.DBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099" />
24 <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
25 <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
26 <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="/usr/lib/tomboy/Tomboy.exe" />
27 </References>
28</Project>
290
=== added file 'tomboy/ZeitgeistAddin.cs'
--- tomboy/ZeitgeistAddin.cs 1970-01-01 00:00:00 +0000
+++ tomboy/ZeitgeistAddin.cs 2010-11-12 17:39:29 +0000
@@ -0,0 +1,90 @@
1using System;
2using Tomboy;
3using System.Collections.Generic;
4using System.IO;
5using Zeitgeist.Datamodel;
6
7namespace Tomboy.Zeitgeist
8{
9 public class ZeitgeistAddin : ApplicationAddin
10 {
11 public ZeitgeistAddin ()
12 {
13 notesList = new List<NoteHandler>();
14 }
15
16 #region Overridden methods
17
18 public override bool Initialized
19 {
20 get
21 {
22 return _init;
23 }
24 }
25
26 public override void Initialize()
27 {
28 Console.WriteLine("Zg#: init new");
29
30 // Initialize the handlers for hooking into Tomboy
31 InitHandlers();
32
33 _init = true;
34 }
35
36 public override void Shutdown()
37 {
38 Console.WriteLine("Zg#: shutdown");
39 }
40
41 #endregion
42
43 public void InitHandlers()
44 {
45 // For every note present in the store
46
47 foreach (Note note in Tomboy.DefaultNoteManager.Notes)
48 {
49 notesList.Add(new NoteHandler(note));
50 }
51
52 Tomboy.DefaultNoteManager.NoteAdded -= HandleNoteAdded;
53 Tomboy.DefaultNoteManager.NoteAdded += HandleNoteAdded;
54
55 Tomboy.DefaultNoteManager.NoteDeleted -= HandleNoteDeleted;
56 Tomboy.DefaultNoteManager.NoteDeleted += HandleNoteDeleted;
57 }
58
59 void HandleNoteAdded(object sender, Note new_note)
60 {
61 Console.WriteLine("Zg#: Note added: " + new_note.Title);
62 Console.WriteLine("\t" + new_note.Uri);
63
64 notesList.Add(new NoteHandler(new_note));
65
66 ZeitgeistHandler.SendEvent(new_note, Interpretation.Instance.EventInterpretation.CreateEvent);
67 }
68
69 void HandleNoteDeleted(object sender, Note new_note)
70 {
71 Console.WriteLine("Zg#: Note deleted: " + new_note.Title);
72 Console.WriteLine("\t" + new_note.Uri);
73
74 ZeitgeistHandler.SendEvent(new_note, Interpretation.Instance.EventInterpretation.DeleteEvent);
75 }
76
77 List<NoteHandler> notesList;
78
79 private bool _init = false;
80
81 #region Public Constants
82
83 public const string TomboyUri = "application://tomboy.desktop";
84
85 public const string NoteMimetype = "application/x-note";
86
87 #endregion
88 }
89}
90
091
=== added file 'tomboy/ZeitgeistDataprovider.addin.xml'
--- tomboy/ZeitgeistDataprovider.addin.xml 1970-01-01 00:00:00 +0000
+++ tomboy/ZeitgeistDataprovider.addin.xml 2010-11-12 17:39:29 +0000
@@ -0,0 +1,21 @@
1<Addin id="ZeitgeistDataprovider"
2 namespace="Tomboy"
3 name="Zeitgeist Dataprovider Add-in"
4 author="Manish Sinha"
5 description="Pushes Tomboy events like open/close/delete notes into Zeitgeist"
6 category="Logging"
7 defaultEnabled="false"
8 version="0.1">
9
10 <Runtime>
11 <Import assembly="ZeitgeistDataprovider.dll" />
12 </Runtime>
13
14 <Dependencies>
15 <Addin id="Tomboy" version="0.10" />
16 </Dependencies>
17
18 <Extension path="/Tomboy/ApplicationAddins">
19 <ApplicationAddin type="Tomboy.Zeitgeist.ZeitgeistAddin" />
20 </Extension>
21</Addin>
022
=== added file 'tomboy/ZeitgeistDataprovider.csproj'
--- tomboy/ZeitgeistDataprovider.csproj 1970-01-01 00:00:00 +0000
+++ tomboy/ZeitgeistDataprovider.csproj 2010-11-12 17:39:29 +0000
@@ -0,0 +1,52 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3 <PropertyGroup>
4 <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5 <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6 <ProductVersion>9.0.21022</ProductVersion>
7 <SchemaVersion>2.0</SchemaVersion>
8 <ProjectGuid>{7F5F22BD-EF5D-4A73-AD3A-BEFF422E5CD0}</ProjectGuid>
9 <OutputType>Library</OutputType>
10 <RootNamespace>ZeitgeistDataProvider</RootNamespace>
11 <AssemblyName>ZeitgeistDataProvider</AssemblyName>
12 <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
13 </PropertyGroup>
14 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
15 <DebugSymbols>true</DebugSymbols>
16 <DebugType>full</DebugType>
17 <Optimize>false</Optimize>
18 <OutputPath>bin\Debug</OutputPath>
19 <DefineConstants>DEBUG</DefineConstants>
20 <ErrorReport>prompt</ErrorReport>
21 <WarningLevel>4</WarningLevel>
22 <ConsolePause>false</ConsolePause>
23 </PropertyGroup>
24 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25 <DebugType>none</DebugType>
26 <Optimize>false</Optimize>
27 <OutputPath>bin\Release</OutputPath>
28 <ErrorReport>prompt</ErrorReport>
29 <WarningLevel>4</WarningLevel>
30 <ConsolePause>false</ConsolePause>
31 </PropertyGroup>
32 <ItemGroup>
33 <Reference Include="System" />
34 <Reference Include="zeitgeist-sharp, Version=0.1.0.1, Culture=neutral, PublicKeyToken=e3e10a585a87d40c">
35 <Package>zeitgeist-sharp</Package>
36 </Reference>
37 </ItemGroup>
38 <ItemGroup>
39 <EmbeddedResource Include="ZeitgeistDataprovider.addin.xml" />
40 </ItemGroup>
41 <ItemGroup>
42 <Compile Include="PushEvents.cs" />
43 <Compile Include="AssemblyInfo.cs" />
44 </ItemGroup>
45 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
46 <ItemGroup>
47 <ProjectReference Include="..\..\..\Tomboy.csproj">
48 <Project>{315DBB30-1461-4A41-A23F-A888D84E1EA0}</Project>
49 <Name>Tomboy</Name>
50 </ProjectReference>
51 </ItemGroup>
52</Project>
053
=== removed file 'tomboy/install.sh'
--- tomboy/install.sh 2010-02-03 16:06:55 +0000
+++ tomboy/install.sh 1970-01-01 00:00:00 +0000
@@ -1,13 +0,0 @@
1#!/bin/sh
2
3mkdir -p ~/.config/tomboy/addins/
4
5# Please install monodevelop to get mdtool.
6# Please edit Zeitgeist.mdp and change the local path of Tomboy.exe
7# to the correct one for your environment (so it can link to the
8# correct version of Tomboy).
9mdtool build Zeitgeist.mdp
10
11cp bin/Debug/Zeitgeist.dll ~/.config/tomboy/addins/Zeitgeist.dll
12
13

Subscribers

People subscribed via source and target branches