Merge lp:~manishsinha/zeitgeist-datasources/fix-tomboy-mimetype-mono-dependency into lp:zeitgeist-datasources/0.8
- fix-tomboy-mimetype-mono-dependency
- Merge into trunk
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 |
Related bugs: |
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:/
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:/
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
- 101. By Manish Sinha (मनीष सिन्हा)
-
Added check for gtk-sharp and fixed indentation
- 102. By Manish Sinha (मनीष सिन्हा)
-
Changed compulsary checking of packages in tomboy section
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : | # |
if you try to configure with "--enable-
then the configure fails, since mono is required for tomboy. The output is
http://
Michal Hruby (mhr3) wrote : | # |
Which further proves my point that the option is useless, please remove it.
- 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
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...
Seif Lotfy (seif) wrote : | # |
works like charm
- 104. By Manish Sinha (मनीष सिन्हा)
-
Merge Markus Korn's (thekorn) tomboy local-install and local-uninstall implementation
Seif Lotfy (seif) wrote : | # |
Tomboy crashes upon opening a note
-------
seif@Wumbo:
[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.ExceptionM
System.Exception: org.freedesktop
at Zeitgeist.
at Zeitgeist.
at Tomboy.
at Tomboy.
at GLib.Idle+
at GLib.ExceptionM
at GLib.Idle+
at Gtk.Application
at Gtk.Application
at Gnome.Program.Run()
at Tomboy.
at Tomboy.
at Tomboy.
at Tomboy.
Seif Lotfy (seif) wrote : | # |
Scratch that invalid comment due testing a broken zeitgeist DB
> Tomboy crashes upon opening a note
> -------
>
> seif@Wumbo:
> [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.ExceptionM
> handle the exception.
> System.Exception: org.freedesktop
> a reply (timeout by message bus)
> at Zeitgeist.
> events) [0x00000] in <filename unknown>:0
> at Zeitgeist.
> events) [0x00000] in <filename unknown>:0
> at Tomboy.
> (System.
> at Tomboy.
> [0x00000] in <filename unknown>:0
> at GLib.Idle+
> at GLib.ExceptionM
> Boolean is_terminal)
> at GLib.Idle+
> at Gtk.Application
> at Gtk.Application
> at Gnome.Program.Run()
> at Tomboy.
> at Tomboy.
> at Tomboy.
> at Tomboy.
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2010-05-12 06:44:01 +0000 |
3 | +++ .bzrignore 2010-11-12 17:39:29 +0000 |
4 | @@ -1,3 +1,9 @@ |
5 | firefox*/*.xpi |
6 | firefox-libzg/extension/components/zeitgeist.h |
7 | firefox-libzg/extension/components/zeitgeist.xpt |
8 | +Makefile |
9 | +Makefile.in |
10 | +.deps |
11 | +.libs |
12 | +*.la |
13 | +*.lo |
14 | |
15 | === modified file 'configure.ac' |
16 | --- configure.ac 2010-11-02 21:04:17 +0000 |
17 | +++ configure.ac 2010-11-12 17:39:29 +0000 |
18 | @@ -35,6 +35,20 @@ |
19 | AM_CONDITIONAL(ENABLE_VALA, test "x$with_vala" = "xyes") |
20 | |
21 | dnl ============================================== |
22 | +dnl Check for Mono |
23 | +dnl ============================================== |
24 | + |
25 | +AC_ARG_WITH([mono], |
26 | + AS_HELP_STRING([--without-mono], |
27 | + [Disables Mono plugins]), |
28 | + [],[with_mono=yes]) |
29 | + |
30 | +AM_CONDITIONAL(ENABLE_MONO, test "x$with_mono" = "xyes") |
31 | + |
32 | +AC_PATH_PROG(GMCS, gmcs, no) |
33 | +AC_PATH_PROG(XBUILD, xbuild, no) |
34 | + |
35 | +dnl ============================================== |
36 | dnl Check commonly used packages |
37 | dnl ============================================== |
38 | |
39 | @@ -51,8 +65,8 @@ |
40 | AC_MSG_RESULT($all_plugins) |
41 | |
42 | # The full list of plugins |
43 | -allowed_plugins="bzr chrome eog firefox-libzg geany gedit rhythmbox totem-libzg vim emacs" |
44 | -# currently disabled = "epiphany tomboy" |
45 | +allowed_plugins="bzr chrome eog firefox-libzg geany gedit rhythmbox totem-libzg vim emacs tomboy" |
46 | +# currently disabled = "epiphany" |
47 | |
48 | # npapi-plugin has a template Makefile.am, but don't use it directly |
49 | # - see chrome's Makefile.am for how to compile it |
50 | @@ -152,8 +166,36 @@ |
51 | fi |
52 | ;; |
53 | tomboy) |
54 | - # not supported atm |
55 | - continue |
56 | + if test "${with_mono}" != "yes" ; then |
57 | + continue |
58 | + fi |
59 | + PKG_CHECK_MODULES(ZEITGEIST_SHARP, zeitgeist-sharp, |
60 | + ENABLE_ZEITGEIST_SHARP=yes, ENABLE_ZEITGEIST_SHARP=no) |
61 | + PKG_CHECK_MODULES(TOMBOY_ADDINS, tomboy-addins) |
62 | + PKG_CHECK_MODULES(GTK_SHARP, gtk-sharp-2.0, |
63 | + HAS_GTK_SHARP=yes, HAS_GTK_SHARP=no) |
64 | + if test "${ENABLE_ZEITGEIST_SHARP}" = "no" ; then |
65 | + plugin_error_or_ignore "zeitgeist-sharp package not found" |
66 | + continue |
67 | + fi |
68 | + AC_PATH_PROG(TOMBOY, tomboy, no) |
69 | + if test "x$TOMBOY" = "xno"; then |
70 | + plugin_error_or_ignore "You need to install tomboy" |
71 | + continue |
72 | + fi |
73 | + if test "x$GMCS" = "xno"; then |
74 | + plugin_error_or_ignore "You need to install gmcs" |
75 | + continue |
76 | + fi |
77 | + if test "x$XBUILD" = "xno"; then |
78 | + plugin_error_or_ignore "You need to install xbuild" |
79 | + continue |
80 | + fi |
81 | + if test "x$GTK_SHARP" = "xno"; then |
82 | + plugin_error_or_ignore "You need to install gtk-sharp" |
83 | + continue |
84 | + fi |
85 | + AC_SUBST(ZEITGEIST_SHARP_LIBS) |
86 | ;; |
87 | totem*) |
88 | if test "${with_vala}" != "yes" ; then |
89 | @@ -241,6 +283,10 @@ |
90 | AC_CONFIG_FILES([geany/Makefile]) |
91 | continue 2 |
92 | ;; |
93 | + tomboy) |
94 | + AC_CONFIG_FILES([tomboy/Makefile]) |
95 | + continue 2 |
96 | + ;; |
97 | gedit) |
98 | AC_CONFIG_FILES([gedit/Makefile]) |
99 | continue 2 |
100 | |
101 | === added file 'tomboy/AssemblyInfo.cs' |
102 | --- tomboy/AssemblyInfo.cs 1970-01-01 00:00:00 +0000 |
103 | +++ tomboy/AssemblyInfo.cs 2010-11-12 17:39:29 +0000 |
104 | @@ -0,0 +1,27 @@ |
105 | +using System.Reflection; |
106 | +using System.Runtime.CompilerServices; |
107 | + |
108 | +// Information about this assembly is defined by the following attributes. |
109 | +// Change them to the values specific to your project. |
110 | + |
111 | +[assembly: AssemblyTitle("ZeitgeistDataProvider")] |
112 | +[assembly: AssemblyDescription("Handles the pushing of Tomboy events to Zeitgeist")] |
113 | +[assembly: AssemblyConfiguration("")] |
114 | +[assembly: AssemblyCompany("")] |
115 | +[assembly: AssemblyProduct("")] |
116 | +[assembly: AssemblyCopyright("")] |
117 | +[assembly: AssemblyTrademark("")] |
118 | +[assembly: AssemblyCulture("")] |
119 | + |
120 | +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". |
121 | +// The form "{Major}.{Minor}.*" will automatically update the build and revision, |
122 | +// and "{Major}.{Minor}.{Build}.*" will update just the revision. |
123 | + |
124 | +[assembly: AssemblyVersion("1.0.*")] |
125 | + |
126 | +// The following attributes are used to specify the signing key for the assembly, |
127 | +// if desired. See the Mono documentation for more information about signing. |
128 | + |
129 | +//[assembly: AssemblyDelaySign(false)] |
130 | +//[assembly: AssemblyKeyFile("")] |
131 | + |
132 | |
133 | === added file 'tomboy/Makefile.am' |
134 | --- tomboy/Makefile.am 1970-01-01 00:00:00 +0000 |
135 | +++ tomboy/Makefile.am 2010-11-12 17:39:29 +0000 |
136 | @@ -0,0 +1,48 @@ |
137 | +CSFLAGS = \ |
138 | + -debug \ |
139 | + -define:DEBUG \ |
140 | + -target:library |
141 | + |
142 | +ASSEMBLIES = \ |
143 | + $(TOMBOY_ADDINS_LIBS) \ |
144 | + $(GTK_SHARP_LIBS) \ |
145 | + $(ZEITGEIST_SHARP_LIBS) \ |
146 | + -r:Mono.Posix |
147 | + |
148 | +ADDIN_NAME = ZeitgeistDataprovider |
149 | +TARGET = $(ADDIN_NAME).dll |
150 | +CSFILES = \ |
151 | + $(srcdir)/Zeitgeist.cs \ |
152 | + $(srcdir)/ZeitgeistAddin.cs \ |
153 | + $(srcdir)/NoteHandler.cs \ |
154 | + $(srcdir)/AssemblyInfo.cs |
155 | +RESOURCES = \ |
156 | + -resource:$(srcdir)/$(ADDIN_NAME).addin.xml |
157 | + |
158 | +$(TARGET): $(CSFILES) |
159 | + $(GMCS) -out:$@ $(CSFLAGS) $(ASSEMBLIES) $(CSFILES) $(RESOURCES) |
160 | + |
161 | + |
162 | +addinsdir = $(libdir)/tomboy/addins |
163 | +addins_DATA = $(TARGET) |
164 | + |
165 | +EXTRA_DIST = \ |
166 | + $(CSFILES) \ |
167 | + $(srcdir)/$(ADDIN_NAME).addin.xml |
168 | + |
169 | +DISTCLEANFILES = \ |
170 | + $(TARGET) \ |
171 | + $(TARGET).mdb |
172 | + |
173 | +TOMBOY_ADDIN_HOME_DIR = ~/.config/tomboy/addins |
174 | + |
175 | +local-install: $(addins_DATA) |
176 | + mkdir -p $(TOMBOY_ADDIN_HOME_DIR) |
177 | + cp $(addins_DATA) $(TOMBOY_ADDIN_HOME_DIR) |
178 | + |
179 | +local-uninstall: |
180 | + for f in $(addins_DATA); \ |
181 | + do \ |
182 | + echo remove $$f; \ |
183 | + rm -f $(TOMBOY_ADDIN_HOME_DIR)/$$f; \ |
184 | + done |
185 | |
186 | === added file 'tomboy/NoteHandler.cs' |
187 | --- tomboy/NoteHandler.cs 1970-01-01 00:00:00 +0000 |
188 | +++ tomboy/NoteHandler.cs 2010-11-12 17:39:29 +0000 |
189 | @@ -0,0 +1,69 @@ |
190 | +using System; |
191 | +using Zeitgeist.Datamodel; |
192 | +using System.Collections.Generic; |
193 | + |
194 | +namespace Tomboy.Zeitgeist |
195 | +{ |
196 | + public class NoteHandler |
197 | + { |
198 | + public NoteHandler(Note note) |
199 | + { |
200 | + // Check if the Note has already been processes. |
201 | + // Whent he note is being processed, event handlers are attached to |
202 | + if (handledNotes.Contains(note) == false) |
203 | + { |
204 | + this._note = note; |
205 | + |
206 | + note.Opened += HandleNoteOpened; |
207 | + if (note.HasWindow) |
208 | + { |
209 | + HandleNoteOpened(); |
210 | + } |
211 | + } |
212 | + } |
213 | + |
214 | + void HandleNoteOpened (object sender, EventArgs e) |
215 | + { |
216 | + HandleNoteOpened(); |
217 | + } |
218 | + |
219 | + void HandleNoteOpened() |
220 | + { |
221 | + this._note.Window.Hidden += HandleNoteWindowHidden; |
222 | + this._note.Window.Shown += HandleNoteWindowShown; |
223 | + this._note.Renamed += HandleNoteRenamed; |
224 | + if (this._note.Window.Visible) |
225 | + { |
226 | + HandleNoteWindowShown(); |
227 | + } |
228 | + } |
229 | + |
230 | + void HandleNoteRenamed (Note sender, string old_title) |
231 | + { |
232 | + Console.WriteLine("Zg#: Renamed: " + this._note.Title); |
233 | + ZeitgeistHandler.SendEvent(sender, Interpretation.Instance.EventInterpretation.ModifyEvent); |
234 | + } |
235 | + |
236 | + void HandleNoteWindowShown (object sender, EventArgs e) |
237 | + { |
238 | + HandleNoteWindowShown(); |
239 | + } |
240 | + |
241 | + void HandleNoteWindowShown () |
242 | + { |
243 | + Console.WriteLine("Zg#: Note window opened: " + this._note.Title); |
244 | + ZeitgeistHandler.SendEvent(this._note, Interpretation.Instance.EventInterpretation.AccessEvent); |
245 | + } |
246 | + |
247 | + void HandleNoteWindowHidden (object sender, EventArgs e) |
248 | + { |
249 | + Console.WriteLine("Zg#: Note window closed: " + this._note.Title); |
250 | + ZeitgeistHandler.SendEvent(this._note, Interpretation.Instance.EventInterpretation.LeaveEvent); |
251 | + } |
252 | + |
253 | + private Note _note; |
254 | + |
255 | + private static List<Note> handledNotes = new List<Note>(); |
256 | + } |
257 | +} |
258 | + |
259 | |
260 | === removed file 'tomboy/Zeitgeist.addin.xml' |
261 | --- tomboy/Zeitgeist.addin.xml 2010-08-16 11:07:09 +0000 |
262 | +++ tomboy/Zeitgeist.addin.xml 1970-01-01 00:00:00 +0000 |
263 | @@ -1,21 +0,0 @@ |
264 | -<Addin id="Zeitgeist" |
265 | - namespace="Tomboy" |
266 | - name="Zeitgeist Integration" |
267 | - author="Laszlo Pandy laszlok2@gmail.com" |
268 | - description="Logs usage data to Zeitgeist." |
269 | - category="Desktop Integration" |
270 | - defaultEnabled="true" |
271 | - version="0.1"> |
272 | - |
273 | - <Runtime> |
274 | - <Import assembly="Zeitgeist.dll" /> |
275 | - </Runtime> |
276 | - |
277 | - <Dependencies> |
278 | - <Addin id="Tomboy" version="0.10" /> |
279 | - </Dependencies> |
280 | - |
281 | - <Extension path="/Tomboy/ApplicationAddins"> |
282 | - <ApplicationAddin type="Tomboy.Zeitgeist.ZeitgeistAddin" /> |
283 | - </Extension> |
284 | -</Addin> |
285 | |
286 | === modified file 'tomboy/Zeitgeist.cs' |
287 | --- tomboy/Zeitgeist.cs 2010-08-19 10:33:11 +0000 |
288 | +++ tomboy/Zeitgeist.cs 2010-11-12 17:39:29 +0000 |
289 | @@ -1,200 +1,83 @@ |
290 | - |
291 | using System; |
292 | +using Zeitgeist.Datamodel; |
293 | +using Zeitgeist; |
294 | using System.Collections.Generic; |
295 | using Tomboy; |
296 | -using NDesk.DBus; |
297 | -using Gtk; |
298 | -using GLib; |
299 | -using Mono.Unix.Native; |
300 | |
301 | namespace Tomboy.Zeitgeist |
302 | { |
303 | - class NoteHandler |
304 | - { |
305 | - private static List<string> handled_notes = new List<string>(); |
306 | - private Note note; |
307 | - |
308 | - public NoteHandler(Note note) { |
309 | - if (handled_notes.Contains(note.Id) == false) { |
310 | - this.note = note; |
311 | - note.Opened += HandleNoteOpened; |
312 | - if (note.HasWindow) { |
313 | - HandleNoteOpened(); |
314 | - } |
315 | - } |
316 | - } |
317 | - |
318 | - void HandleNoteOpened (object sender, EventArgs e) { |
319 | - HandleNoteOpened(); |
320 | - } |
321 | - void HandleNoteOpened() { |
322 | - note.Window.Hidden += HandleNoteWindowHidden; |
323 | - note.Window.Shown += HandleNoteWindowShown; |
324 | - note.Renamed += HandleNoteRenamed; |
325 | - if (note.Window.Visible) { |
326 | - HandleNoteWindowShown(); |
327 | - } |
328 | - } |
329 | - |
330 | - void HandleNoteRenamed (Note sender, string old_title) |
331 | - { |
332 | - Console.WriteLine("Zg: Renamed: " + note.Title); |
333 | - ZeitgeistDbus.SendToZeitgeist(note, ZeitgeistDbus.EventInterpretation.ModifyEvent); |
334 | - } |
335 | - |
336 | - void HandleNoteWindowShown (object sender, EventArgs e) { |
337 | - HandleNoteWindowShown(); |
338 | - } |
339 | - void HandleNoteWindowShown () |
340 | - { |
341 | - Console.WriteLine("Zg: Note window opened: " + note.Title); |
342 | - ZeitgeistDbus.SendToZeitgeist(note, ZeitgeistDbus.EventInterpretation.OpenEvent); |
343 | - } |
344 | - |
345 | - void HandleNoteWindowHidden (object sender, EventArgs e) |
346 | - { |
347 | - Console.WriteLine("Zg: Note window closed: " + note.Title); |
348 | - ZeitgeistDbus.SendToZeitgeist(note, ZeitgeistDbus.EventInterpretation.CloseEvent); |
349 | - } |
350 | - } |
351 | - |
352 | - class ZeitgeistDbus |
353 | - { |
354 | - private static ILogger zeitgeist_proxy = |
355 | - Bus.Session.GetObject<ILogger>("org.gnome.zeitgeist.Engine", |
356 | - new ObjectPath("/org/gnome/zeitgeist/log/activity")); |
357 | - |
358 | - public enum EventInterpretation { |
359 | - OpenEvent, |
360 | - CloseEvent, |
361 | - CreateEvent, |
362 | - ModifyEvent, |
363 | - } |
364 | - |
365 | - private static string GetEventInterpetation(EventInterpretation e) { |
366 | - switch(e) { |
367 | - case EventInterpretation.OpenEvent: |
368 | - return "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#AccessEvent"; |
369 | - case EventInterpretation.CloseEvent: |
370 | - return "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#LeaveEvent"; |
371 | - case EventInterpretation.CreateEvent: |
372 | - return "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#CreateEvent"; |
373 | - case EventInterpretation.ModifyEvent: |
374 | - return "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#ModifyEvent"; |
375 | - default: |
376 | - return null; |
377 | - } |
378 | - } |
379 | - |
380 | - public static void SendToZeitgeist(Note note, EventInterpretation ev_interp) { |
381 | - if (zeitgeist_proxy == null) { |
382 | - Console.WriteLine("Zg: cannot connect to zeitgeist, dbus proxy is null"); |
383 | - return; |
384 | - } |
385 | - |
386 | - string ev_interp_string = GetEventInterpetation(ev_interp); |
387 | - if (ev_interp_string == null) { |
388 | - Console.WriteLine("Zg: unknown interpretation type: " + ev_interp.ToString()); |
389 | - return; |
390 | - } |
391 | - |
392 | - Timeval t; |
393 | - Syscall.gettimeofday(out t); |
394 | - long millis_now = (t.tv_sec * 1000) + (t.tv_usec / 1000); |
395 | - |
396 | - Event e = new Event(); |
397 | - e.metadata = new string[5]; |
398 | - e.metadata[0] = ""; //id (filled in by Zeitgeist) |
399 | - e.metadata[1] = millis_now.ToString(); |
400 | - e.metadata[2] = ev_interp_string; |
401 | - e.metadata[3] = "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#UserActivity"; |
402 | - e.metadata[4] = "application://tomboy.desktop"; |
403 | - |
404 | - string[] subject = new string[7]; |
405 | - subject[0] = note.Uri; |
406 | - subject[1] = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Document"; |
407 | - subject[2] = "http://www.semanticdesktop.org/ontologies/nfo#FileDataObject"; |
408 | - subject[3] = ""; //origin |
409 | - subject[4] = "application/x-tomboy"; //mimetype |
410 | - subject[5] = note.Title; |
411 | - subject[6] = ""; //storage id |
412 | - |
413 | - e.subjects = new string[][] { subject }; |
414 | - e.payload = new byte[0]; |
415 | - |
416 | - GLib.Idle.Add(delegate() { |
417 | - SendEvent(e); |
418 | + public class ZeitgeistHandler |
419 | + { |
420 | + public static bool SendEvent(Note note, NameUri eventInterpretation) |
421 | + { |
422 | + NameUri eventManifestation = Manifestation.Instance.EventManifestation.UserActivity; |
423 | + |
424 | + NameUri subjectInterpretation = Interpretation.Instance.Document.Document; |
425 | + NameUri subjectManifestation = Manifestation.Instance.FileDataObject.FileDataObject; |
426 | + |
427 | + Event ev = EventCreator.CreateEvent(note, eventInterpretation, eventManifestation, subjectInterpretation, subjectManifestation); |
428 | + |
429 | + |
430 | + try |
431 | + { |
432 | + List<Event> listOfEvents = new List<Event>(); |
433 | + listOfEvents.Add(ev); |
434 | + |
435 | + GLib.Idle.Add(delegate() |
436 | + { |
437 | + SendEvent(listOfEvents); |
438 | + return false; |
439 | + }); |
440 | + |
441 | + Console.WriteLine(string.Format("Operation {0} successful", ev.Interpretation.Name)); |
442 | + return true; |
443 | + } |
444 | + catch(Exception e) |
445 | + { |
446 | + Console.WriteLine(e.StackTrace); |
447 | + |
448 | return false; |
449 | - }); |
450 | - } |
451 | - |
452 | - private static void SendEvent(Event e) { |
453 | - int[] inserted; |
454 | - try { |
455 | - inserted = zeitgeist_proxy.InsertEvents(new Event[] { e }); |
456 | - } catch (Exception ex) { |
457 | - Console.WriteLine("Zg: insertion failed: " + ex.Message); |
458 | - return; |
459 | - } |
460 | - |
461 | - if (inserted.Length > 0) { |
462 | - Console.WriteLine("Zg: Inserted event: " + inserted[0]); |
463 | - } |
464 | - else { |
465 | - Console.WriteLine("Zg: Insertion failed"); |
466 | - } |
467 | - return; |
468 | - } |
469 | - } |
470 | - |
471 | - [NDesk.DBus.Interface ("org.gnome.zeitgeist.Log")] |
472 | - interface ILogger { |
473 | - int[] InsertEvents(Event[] events); |
474 | - } |
475 | - |
476 | - struct Event { |
477 | - public string[] metadata; |
478 | - public string[][] subjects; |
479 | - public byte[] payload; |
480 | - } |
481 | - |
482 | - public class ZeitgeistAddin : ApplicationAddin |
483 | + } |
484 | + } |
485 | + |
486 | + private static void SendEvent(List<Event> e) |
487 | + { |
488 | + LogClient client = new LogClient(); |
489 | + client.InsertEvents(e); |
490 | + } |
491 | + } |
492 | + |
493 | + public class EventCreator |
494 | { |
495 | - private bool _init = false; |
496 | - public override bool Initialized { |
497 | - get { return _init; } |
498 | - } |
499 | - |
500 | - public override |
501 | - void Initialize() { |
502 | - Console.WriteLine("Zg: init new"); |
503 | - init_handlers(); |
504 | - _init = true; |
505 | - } |
506 | - |
507 | - public override |
508 | - void Shutdown() { |
509 | - Console.WriteLine("Zg: shutdown"); |
510 | - } |
511 | - |
512 | - void HandleNoteAdded(object sender, Note new_note) { |
513 | - Console.WriteLine("Zg: Note added: " + new_note.Title); |
514 | - Console.WriteLine("\t" + new_note.Uri); |
515 | - |
516 | - new NoteHandler(new_note); |
517 | - ZeitgeistDbus.SendToZeitgeist(new_note, ZeitgeistDbus.EventInterpretation.CreateEvent); |
518 | - } |
519 | - |
520 | - public void init_handlers() { |
521 | - foreach (Note note in Tomboy.DefaultNoteManager.Notes) { |
522 | - new NoteHandler(note); |
523 | - } |
524 | - |
525 | - Tomboy.DefaultNoteManager.NoteAdded -= HandleNoteAdded; |
526 | - Tomboy.DefaultNoteManager.NoteAdded += HandleNoteAdded; |
527 | + public static Event CreateEvent(Note note, |
528 | + NameUri eventInterpretation, |
529 | + NameUri eventManifestation, |
530 | + NameUri subjectInterpretation, |
531 | + NameUri subjectManifestation) |
532 | + { |
533 | + Event ev = new Event(); |
534 | + |
535 | + |
536 | + ev.Id = 0; |
537 | + ev.Timestamp = DateTime.Now; |
538 | + ev.Interpretation = eventInterpretation; |
539 | + ev.Manifestation = eventManifestation; |
540 | + ev.Actor = ZeitgeistAddin.TomboyUri; |
541 | + |
542 | + Subject sub = new Subject(); |
543 | + |
544 | + sub.Uri = note.Uri; |
545 | + sub.Interpretation = subjectInterpretation; |
546 | + sub.Manifestation = subjectManifestation; |
547 | + sub.Origin = string.Empty; |
548 | + sub.MimeType = ZeitgeistAddin.NoteMimetype; |
549 | + sub.Text = note.Title; |
550 | + sub.Storage = string.Empty; |
551 | + |
552 | + ev.Subjects.Add(sub); |
553 | + |
554 | + return ev; |
555 | } |
556 | } |
557 | - |
558 | - |
559 | - |
560 | } |
561 | + |
562 | |
563 | === removed file 'tomboy/Zeitgeist.mdp' |
564 | --- tomboy/Zeitgeist.mdp 2010-08-16 10:57:40 +0000 |
565 | +++ tomboy/Zeitgeist.mdp 1970-01-01 00:00:00 +0000 |
566 | @@ -1,28 +0,0 @@ |
567 | -<Project name="Zeitgeist" fileversion="2.0" DefaultNamespace="Zeitgeist" language="C#" targetFramework="2.0" ctype="DotNetProject"> |
568 | - <Configurations active="Debug"> |
569 | - <Configuration name="Debug" ctype="DotNetProjectConfiguration"> |
570 | - <Output directory="bin/Debug" assembly="Zeitgeist" /> |
571 | - <Build debugmode="True" target="Library" /> |
572 | - <Execution consolepause="False" runwithwarnings="True" runtime="MsNet" /> |
573 | - <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> |
574 | - </Configuration> |
575 | - <Configuration name="Release" ctype="DotNetProjectConfiguration"> |
576 | - <Output directory="bin/Release" assembly="Zeitgeist" /> |
577 | - <Build debugmode="False" target="Library" /> |
578 | - <Execution consolepause="False" runwithwarnings="True" runtime="MsNet" /> |
579 | - <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> |
580 | - </Configuration> |
581 | - </Configurations> |
582 | - <Contents> |
583 | - <File subtype="Code" buildaction="Compile" name="Zeitgeist.cs" /> |
584 | - <File subtype="Code" buildaction="EmbedAsResource" name="Zeitgeist.addin.xml" /> |
585 | - </Contents> |
586 | - <References> |
587 | - <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> |
588 | - <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
589 | - <ProjectReference type="Gac" localcopy="True" refto="NDesk.DBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099" /> |
590 | - <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
591 | - <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> |
592 | - <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="/usr/lib/tomboy/Tomboy.exe" /> |
593 | - </References> |
594 | -</Project> |
595 | |
596 | === added file 'tomboy/ZeitgeistAddin.cs' |
597 | --- tomboy/ZeitgeistAddin.cs 1970-01-01 00:00:00 +0000 |
598 | +++ tomboy/ZeitgeistAddin.cs 2010-11-12 17:39:29 +0000 |
599 | @@ -0,0 +1,90 @@ |
600 | +using System; |
601 | +using Tomboy; |
602 | +using System.Collections.Generic; |
603 | +using System.IO; |
604 | +using Zeitgeist.Datamodel; |
605 | + |
606 | +namespace Tomboy.Zeitgeist |
607 | +{ |
608 | + public class ZeitgeistAddin : ApplicationAddin |
609 | + { |
610 | + public ZeitgeistAddin () |
611 | + { |
612 | + notesList = new List<NoteHandler>(); |
613 | + } |
614 | + |
615 | + #region Overridden methods |
616 | + |
617 | + public override bool Initialized |
618 | + { |
619 | + get |
620 | + { |
621 | + return _init; |
622 | + } |
623 | + } |
624 | + |
625 | + public override void Initialize() |
626 | + { |
627 | + Console.WriteLine("Zg#: init new"); |
628 | + |
629 | + // Initialize the handlers for hooking into Tomboy |
630 | + InitHandlers(); |
631 | + |
632 | + _init = true; |
633 | + } |
634 | + |
635 | + public override void Shutdown() |
636 | + { |
637 | + Console.WriteLine("Zg#: shutdown"); |
638 | + } |
639 | + |
640 | + #endregion |
641 | + |
642 | + public void InitHandlers() |
643 | + { |
644 | + // For every note present in the store |
645 | + |
646 | + foreach (Note note in Tomboy.DefaultNoteManager.Notes) |
647 | + { |
648 | + notesList.Add(new NoteHandler(note)); |
649 | + } |
650 | + |
651 | + Tomboy.DefaultNoteManager.NoteAdded -= HandleNoteAdded; |
652 | + Tomboy.DefaultNoteManager.NoteAdded += HandleNoteAdded; |
653 | + |
654 | + Tomboy.DefaultNoteManager.NoteDeleted -= HandleNoteDeleted; |
655 | + Tomboy.DefaultNoteManager.NoteDeleted += HandleNoteDeleted; |
656 | + } |
657 | + |
658 | + void HandleNoteAdded(object sender, Note new_note) |
659 | + { |
660 | + Console.WriteLine("Zg#: Note added: " + new_note.Title); |
661 | + Console.WriteLine("\t" + new_note.Uri); |
662 | + |
663 | + notesList.Add(new NoteHandler(new_note)); |
664 | + |
665 | + ZeitgeistHandler.SendEvent(new_note, Interpretation.Instance.EventInterpretation.CreateEvent); |
666 | + } |
667 | + |
668 | + void HandleNoteDeleted(object sender, Note new_note) |
669 | + { |
670 | + Console.WriteLine("Zg#: Note deleted: " + new_note.Title); |
671 | + Console.WriteLine("\t" + new_note.Uri); |
672 | + |
673 | + ZeitgeistHandler.SendEvent(new_note, Interpretation.Instance.EventInterpretation.DeleteEvent); |
674 | + } |
675 | + |
676 | + List<NoteHandler> notesList; |
677 | + |
678 | + private bool _init = false; |
679 | + |
680 | + #region Public Constants |
681 | + |
682 | + public const string TomboyUri = "application://tomboy.desktop"; |
683 | + |
684 | + public const string NoteMimetype = "application/x-note"; |
685 | + |
686 | + #endregion |
687 | + } |
688 | +} |
689 | + |
690 | |
691 | === added file 'tomboy/ZeitgeistDataprovider.addin.xml' |
692 | --- tomboy/ZeitgeistDataprovider.addin.xml 1970-01-01 00:00:00 +0000 |
693 | +++ tomboy/ZeitgeistDataprovider.addin.xml 2010-11-12 17:39:29 +0000 |
694 | @@ -0,0 +1,21 @@ |
695 | +<Addin id="ZeitgeistDataprovider" |
696 | + namespace="Tomboy" |
697 | + name="Zeitgeist Dataprovider Add-in" |
698 | + author="Manish Sinha" |
699 | + description="Pushes Tomboy events like open/close/delete notes into Zeitgeist" |
700 | + category="Logging" |
701 | + defaultEnabled="false" |
702 | + version="0.1"> |
703 | + |
704 | + <Runtime> |
705 | + <Import assembly="ZeitgeistDataprovider.dll" /> |
706 | + </Runtime> |
707 | + |
708 | + <Dependencies> |
709 | + <Addin id="Tomboy" version="0.10" /> |
710 | + </Dependencies> |
711 | + |
712 | + <Extension path="/Tomboy/ApplicationAddins"> |
713 | + <ApplicationAddin type="Tomboy.Zeitgeist.ZeitgeistAddin" /> |
714 | + </Extension> |
715 | +</Addin> |
716 | |
717 | === added file 'tomboy/ZeitgeistDataprovider.csproj' |
718 | --- tomboy/ZeitgeistDataprovider.csproj 1970-01-01 00:00:00 +0000 |
719 | +++ tomboy/ZeitgeistDataprovider.csproj 2010-11-12 17:39:29 +0000 |
720 | @@ -0,0 +1,52 @@ |
721 | +<?xml version="1.0" encoding="utf-8"?> |
722 | +<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
723 | + <PropertyGroup> |
724 | + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
725 | + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
726 | + <ProductVersion>9.0.21022</ProductVersion> |
727 | + <SchemaVersion>2.0</SchemaVersion> |
728 | + <ProjectGuid>{7F5F22BD-EF5D-4A73-AD3A-BEFF422E5CD0}</ProjectGuid> |
729 | + <OutputType>Library</OutputType> |
730 | + <RootNamespace>ZeitgeistDataProvider</RootNamespace> |
731 | + <AssemblyName>ZeitgeistDataProvider</AssemblyName> |
732 | + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> |
733 | + </PropertyGroup> |
734 | + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
735 | + <DebugSymbols>true</DebugSymbols> |
736 | + <DebugType>full</DebugType> |
737 | + <Optimize>false</Optimize> |
738 | + <OutputPath>bin\Debug</OutputPath> |
739 | + <DefineConstants>DEBUG</DefineConstants> |
740 | + <ErrorReport>prompt</ErrorReport> |
741 | + <WarningLevel>4</WarningLevel> |
742 | + <ConsolePause>false</ConsolePause> |
743 | + </PropertyGroup> |
744 | + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
745 | + <DebugType>none</DebugType> |
746 | + <Optimize>false</Optimize> |
747 | + <OutputPath>bin\Release</OutputPath> |
748 | + <ErrorReport>prompt</ErrorReport> |
749 | + <WarningLevel>4</WarningLevel> |
750 | + <ConsolePause>false</ConsolePause> |
751 | + </PropertyGroup> |
752 | + <ItemGroup> |
753 | + <Reference Include="System" /> |
754 | + <Reference Include="zeitgeist-sharp, Version=0.1.0.1, Culture=neutral, PublicKeyToken=e3e10a585a87d40c"> |
755 | + <Package>zeitgeist-sharp</Package> |
756 | + </Reference> |
757 | + </ItemGroup> |
758 | + <ItemGroup> |
759 | + <EmbeddedResource Include="ZeitgeistDataprovider.addin.xml" /> |
760 | + </ItemGroup> |
761 | + <ItemGroup> |
762 | + <Compile Include="PushEvents.cs" /> |
763 | + <Compile Include="AssemblyInfo.cs" /> |
764 | + </ItemGroup> |
765 | + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
766 | + <ItemGroup> |
767 | + <ProjectReference Include="..\..\..\Tomboy.csproj"> |
768 | + <Project>{315DBB30-1461-4A41-A23F-A888D84E1EA0}</Project> |
769 | + <Name>Tomboy</Name> |
770 | + </ProjectReference> |
771 | + </ItemGroup> |
772 | +</Project> |
773 | |
774 | === removed file 'tomboy/install.sh' |
775 | --- tomboy/install.sh 2010-02-03 16:06:55 +0000 |
776 | +++ tomboy/install.sh 1970-01-01 00:00:00 +0000 |
777 | @@ -1,13 +0,0 @@ |
778 | -#!/bin/sh |
779 | - |
780 | -mkdir -p ~/.config/tomboy/addins/ |
781 | - |
782 | -# Please install monodevelop to get mdtool. |
783 | -# Please edit Zeitgeist.mdp and change the local path of Tomboy.exe |
784 | -# to the correct one for your environment (so it can link to the |
785 | -# correct version of Tomboy). |
786 | -mdtool build Zeitgeist.mdp |
787 | - |
788 | -cp bin/Debug/Zeitgeist.dll ~/.config/tomboy/addins/Zeitgeist.dll |
789 | - |
790 | - |
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"