Merge lp:~manishsinha/zeitgeist-datasources/monodevelop into lp:zeitgeist-datasources/0.8
- monodevelop
- Merge into trunk
Proposed by
Manish Sinha (मनीष सिन्हा)
Status: | Merged |
---|---|
Merged at revision: | 159 |
Proposed branch: | lp:~manishsinha/zeitgeist-datasources/monodevelop |
Merge into: | lp:zeitgeist-datasources/0.8 |
Diff against target: |
668 lines (+533/-19) 9 files modified
.bzrignore (+17/-0) configure.ac (+43/-18) monodevelop/AssemblyInfo.cs (+53/-0) monodevelop/Makefile.am (+35/-0) monodevelop/MonoDevelop.Zeitgeist.addin.xml (+19/-0) monodevelop/StartupHandler.cs (+134/-0) monodevelop/TrackedDocument.cs (+78/-0) monodevelop/ZeitgeistClient.cs (+153/-0) tomboy/Makefile.am (+1/-1) |
To merge this branch: | bzr merge lp:~manishsinha/zeitgeist-datasources/monodevelop |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zeitgeist Data-Sources Team | Pending | ||
Review via email: mp+80168@code.launchpad.net |
Commit message
Description of the change
Added monodevelop addin.
Logs
* File Open
* File Close
* File Added
* File Deleted
* Solution opened
* Solution Closed
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2010-11-08 19:44:34 +0000 |
3 | +++ .bzrignore 2011-10-24 01:40:30 +0000 |
4 | @@ -7,3 +7,20 @@ |
5 | .libs |
6 | *.la |
7 | *.lo |
8 | +aclocal.m4 |
9 | +autom4te.cache/ |
10 | +config.guess |
11 | +config.log |
12 | +config.status |
13 | +config.sub |
14 | +configure |
15 | +depcomp |
16 | +elisp-comp |
17 | +install-sh |
18 | +libtool |
19 | +ltmain.sh |
20 | +missing |
21 | +*.dll |
22 | +*.mdb |
23 | +emacs/elc-stamp |
24 | + |
25 | |
26 | === modified file 'configure.ac' |
27 | --- configure.ac 2011-09-14 19:29:53 +0000 |
28 | +++ configure.ac 2011-10-24 01:40:30 +0000 |
29 | @@ -63,7 +63,7 @@ |
30 | AC_MSG_NOTICE([Requested to enable all plugins: ${all_plugins}]) |
31 | |
32 | # The full list of plugins |
33 | -allowed_plugins="bzr chrome eog geany gedit vim emacs tomboy telepathy xchat rhythmbox firefox totem-libzg firefox-36-libzg" |
34 | +allowed_plugins="bzr chrome eog geany gedit vim emacs tomboy telepathy xchat rhythmbox firefox totem-libzg firefox-36-libzg monodevelop" |
35 | # currently disabled = "epiphany" |
36 | |
37 | # npapi-plugin has a template Makefile.am, but don't use it directly |
38 | @@ -86,8 +86,7 @@ |
39 | error_on_bad_plugin="0" |
40 | fi |
41 | |
42 | -AC_PATH_PROG(GMCS, gmcs, no) |
43 | -AC_PATH_PROG(XBUILD, xbuild, no) |
44 | +AC_PATH_PROG(DMCS, dmcs, no) |
45 | |
46 | # Check for plugin-specific requirements and error if necessary |
47 | for plugin in ${used_plugins}; do |
48 | @@ -166,6 +165,32 @@ |
49 | continue |
50 | fi |
51 | ;; |
52 | + monodevelop) |
53 | + if test "${with_mono}" != "yes" ; then |
54 | + continue |
55 | + fi |
56 | + PKG_CHECK_MODULES(ZEITGEIST_SHARP, zeitgeist-sharp, |
57 | + ENABLE_ZEITGEIST_SHARP=yes, ENABLE_ZEITGEIST_SHARP=no) |
58 | + PKG_CHECK_MODULES(MONODEVELOP, monodevelop, |
59 | + HAS_MONODEVELOP=yes, HAS_MONODEVELOP=no) |
60 | + PKG_CHECK_MODULES(MONO_ADDINS, mono-addins, |
61 | + HAS_MONO_ADDINS=yes, HAS_MONO_ADDINS=no) |
62 | + |
63 | + if test "${ENABLE_ZEITGEIST_SHARP}" = "no" ; then |
64 | + plugin_error_or_ignore "zeitgeist-sharp package not found" |
65 | + continue |
66 | + fi |
67 | + if test "x$HAS_MONODEVELOP" = "xno"; then |
68 | + plugin_error_or_ignore "You need to install monodevelop" |
69 | + continue |
70 | + fi |
71 | + if test "x$HAS_MONO_ADDINS" = "xno"; then |
72 | + plugin_error_or_ignore "You need to install mono-addins" |
73 | + continue |
74 | + fi |
75 | + AC_SUBST(MONODEVELOP_LIBS) |
76 | + AC_SUBST(MONO_ADDINS_LIBS) |
77 | + ;; |
78 | npapi-plugin) |
79 | if test "${HAVE_LIBZG}" != "yes" ; then |
80 | plugin_error_or_ignore "libzeitgeist not found" |
81 | @@ -181,7 +206,7 @@ |
82 | PKG_CHECK_MODULES(TOMBOY_ADDINS, tomboy-addins, |
83 | HAS_TOMBOY_ADDINS=yes, HAS_TOMBOY_ADDINS=no) |
84 | PKG_CHECK_MODULES(GTK_SHARP, gtk-sharp-2.0, |
85 | - HAS_GTK_SHARP=yes, GTK_SHARP=no) |
86 | + HAS_GTK_SHARP=yes, HAS_GTK_SHARP=no) |
87 | |
88 | if test "${ENABLE_ZEITGEIST_SHARP}" = "no" ; then |
89 | plugin_error_or_ignore "zeitgeist-sharp package not found" |
90 | @@ -193,12 +218,8 @@ |
91 | plugin_error_or_ignore "You need to install tomboy" |
92 | continue |
93 | fi |
94 | - if test "x$GMCS" = "xno"; then |
95 | - plugin_error_or_ignore "You need to install gmcs" |
96 | - continue |
97 | - fi |
98 | - if test "x$XBUILD" = "xno"; then |
99 | - plugin_error_or_ignore "You need to install xbuild for tomboy" |
100 | + if test "x$DMCS" = "xno"; then |
101 | + plugin_error_or_ignore "You need to install dmcs" |
102 | continue |
103 | fi |
104 | if test "x$HAS_GTK_SHARP" = "xno"; then |
105 | @@ -308,7 +329,7 @@ |
106 | AC_CONFIG_FILES([geany/Makefile]) |
107 | continue 2 |
108 | ;; |
109 | - gedit) |
110 | + gedit) |
111 | AC_CONFIG_FILES([gedit/Makefile]) |
112 | continue 2 |
113 | ;; |
114 | @@ -316,14 +337,18 @@ |
115 | AC_CONFIG_FILES([tomboy/Makefile]) |
116 | continue 2 |
117 | ;; |
118 | - rhythmbox) |
119 | + rhythmbox) |
120 | AC_CONFIG_FILES([rhythmbox/Makefile]) |
121 | continue 2 |
122 | ;; |
123 | - totem-libzg) |
124 | + totem-libzg) |
125 | AC_CONFIG_FILES([totem-libzg/Makefile]) |
126 | continue 2 |
127 | ;; |
128 | + monodevelop) |
129 | + AC_CONFIG_FILES([monodevelop/Makefile]) |
130 | + continue 2 |
131 | + ;; |
132 | vim) |
133 | AC_CONFIG_FILES([vim/Makefile]) |
134 | continue 2 |
135 | @@ -332,11 +357,11 @@ |
136 | AC_CONFIG_FILES([emacs/Makefile]) |
137 | continue 2 |
138 | ;; |
139 | - telepathy) |
140 | - AC_CONFIG_FILES([telepathy/Makefile]) |
141 | - continue 2 |
142 | - ;; |
143 | - xchat) |
144 | + telepathy) |
145 | + AC_CONFIG_FILES([telepathy/Makefile]) |
146 | + continue 2 |
147 | + ;; |
148 | + xchat) |
149 | AC_CONFIG_FILES([xchat/Makefile]) |
150 | continue 2 |
151 | ;; |
152 | |
153 | === added directory 'monodevelop' |
154 | === added file 'monodevelop/AssemblyInfo.cs' |
155 | --- monodevelop/AssemblyInfo.cs 1970-01-01 00:00:00 +0000 |
156 | +++ monodevelop/AssemblyInfo.cs 2011-10-24 01:40:30 +0000 |
157 | @@ -0,0 +1,53 @@ |
158 | +// |
159 | +// AssemblyInfo.cs |
160 | +// |
161 | +// Author: |
162 | +// Patrick McEvoy <patrick@qmtech.net> |
163 | +// |
164 | +// Copyright (c) 2011 QMTech. |
165 | +// |
166 | +// Permission is hereby granted, free of charge, to any person obtaining a copy of this |
167 | +// software and associated documentation files (the "Software"), to deal in the Software |
168 | +// without restriction, including without limitation the rights to use, copy, modify, |
169 | +// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to |
170 | +// permit persons to whom the Software is furnished to do so, subject to the following |
171 | +// conditions: |
172 | +// |
173 | +// The above copyright notice and this permission notice shall be included in all copies or |
174 | +// substantial portions of the Software. |
175 | +// |
176 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
177 | +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
178 | +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
179 | +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
180 | +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
181 | +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
182 | +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
183 | + |
184 | +using System.Reflection; |
185 | +using System.Runtime.CompilerServices; |
186 | + |
187 | +// Information about this assembly is defined by the following attributes. |
188 | +// Change them to the values specific to your project. |
189 | + |
190 | +[assembly: AssemblyTitle("MonoDevelop.Zeitgeist")] |
191 | +[assembly: AssemblyDescription("")] |
192 | +[assembly: AssemblyConfiguration("")] |
193 | +[assembly: AssemblyCompany("QMTech")] |
194 | +[assembly: AssemblyProduct("")] |
195 | +[assembly: AssemblyCopyright("Copyright QMTech 2011. All rights reserved")] |
196 | +[assembly: AssemblyTrademark("")] |
197 | +[assembly: AssemblyCulture("")] |
198 | + |
199 | +// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". |
200 | +// The form "{Major}.{Minor}.*" will automatically update the build and revision, |
201 | +// and "{Major}.{Minor}.{Build}.*" will update just the revision. |
202 | + |
203 | +[assembly: AssemblyVersion("1.0.*")] |
204 | + |
205 | +// The following attributes are used to specify the signing key for the assembly, |
206 | +// if desired. See the Mono documentation for more information about signing. |
207 | + |
208 | +//[assembly: AssemblyDelaySign(false)] |
209 | +//[assembly: AssemblyKeyFile("")] |
210 | + |
211 | |
212 | === added file 'monodevelop/Makefile.am' |
213 | --- monodevelop/Makefile.am 1970-01-01 00:00:00 +0000 |
214 | +++ monodevelop/Makefile.am 2011-10-24 01:40:30 +0000 |
215 | @@ -0,0 +1,35 @@ |
216 | +CSFLAGS = \ |
217 | + -debug \ |
218 | + -define:DEBUG \ |
219 | + -target:library |
220 | + |
221 | +ASSEMBLIES = \ |
222 | + $(MONODEVELOP_LIBS) \ |
223 | + $(ZEITGEIST_SHARP_LIBS) \ |
224 | + $(MONO_ADDINS_LIBS) \ |
225 | + -r:Mono.Posix |
226 | + |
227 | +ADDIN_NAME = ZeitgeistDataprovider |
228 | +TARGET = $(ADDIN_NAME).dll |
229 | +CSFILES = \ |
230 | + $(srcdir)/StartupHandler.cs \ |
231 | + $(srcdir)/TrackedDocument.cs \ |
232 | + $(srcdir)/ZeitgeistClient.cs \ |
233 | + $(srcdir)/AssemblyInfo.cs |
234 | +RESOURCES = \ |
235 | + -resource:$(srcdir)/MonoDevelop.Zeitgeist.addin.xml |
236 | + |
237 | +$(TARGET): $(CSFILES) |
238 | + $(DMCS) -out:$@ $(CSFLAGS) $(ASSEMBLIES) $(CSFILES) $(RESOURCES) |
239 | + |
240 | + |
241 | +addinsdir = $(libdir)/monodevelop/Addins |
242 | +addins_DATA = $(TARGET) |
243 | + |
244 | +EXTRA_DIST = \ |
245 | + $(CSFILES) \ |
246 | + $(srcdir)/$(ADDIN_NAME).addin.xml |
247 | + |
248 | +DISTCLEANFILES = \ |
249 | + $(TARGET) \ |
250 | + $(TARGET).mdb |
251 | |
252 | === added file 'monodevelop/MonoDevelop.Zeitgeist.addin.xml' |
253 | --- monodevelop/MonoDevelop.Zeitgeist.addin.xml 1970-01-01 00:00:00 +0000 |
254 | +++ monodevelop/MonoDevelop.Zeitgeist.addin.xml 2011-10-24 01:40:30 +0000 |
255 | @@ -0,0 +1,19 @@ |
256 | +<Addin id = "Zeitgeist" |
257 | + namespace = "MonoDevelop" |
258 | + name = "Zeitgeist Support" |
259 | + author = "Patrick McEvoy and Manish Sinha" |
260 | + copyright = "MIT X11" |
261 | + url = "http://github.com/firegrass/" |
262 | + description = "Log activity to Zeitgeist." |
263 | + category = "Logging" |
264 | + version = "0.1"> |
265 | + |
266 | + <Runtime> |
267 | + <Import assembly="MonoDevelop.Zeitgeist.dll"/> |
268 | + </Runtime> |
269 | + |
270 | + <Dependencies> |
271 | + <Addin id="Ide" version="2.6.0"/> |
272 | + </Dependencies> |
273 | + |
274 | +</Addin> |
275 | \ No newline at end of file |
276 | |
277 | === added file 'monodevelop/StartupHandler.cs' |
278 | --- monodevelop/StartupHandler.cs 1970-01-01 00:00:00 +0000 |
279 | +++ monodevelop/StartupHandler.cs 2011-10-24 01:40:30 +0000 |
280 | @@ -0,0 +1,134 @@ |
281 | +// |
282 | +// StartupHandler.cs |
283 | +// |
284 | +// Author: |
285 | +// Patrick McEvoy <patrick@qmtech.net> |
286 | +// Manish Sinha <manishsinha@ubuntu.com> |
287 | +// |
288 | +// Copyright (c) 2011 QMTech. |
289 | +// Copyright (c) 2011 Manish Sinha <manishsinha@ubuntu.com> |
290 | +// |
291 | +// Permission is hereby granted, free of charge, to any person obtaining a copy of this |
292 | +// software and associated documentation files (the "Software"), to deal in the Software |
293 | +// without restriction, including without limitation the rights to use, copy, modify, |
294 | +// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to |
295 | +// permit persons to whom the Software is furnished to do so, subject to the following |
296 | +// conditions: |
297 | +// |
298 | +// The above copyright notice and this permission notice shall be included in all copies or |
299 | +// substantial portions of the Software. |
300 | +// |
301 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
302 | +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
303 | +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
304 | +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
305 | +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
306 | +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
307 | +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
308 | + |
309 | +using System; |
310 | +using Mono.Addins; |
311 | +using MonoDevelop.Components.Commands; |
312 | +using MonoDevelop.Ide.Extensions; |
313 | +using MonoDevelop.Projects; |
314 | +using MonoDevelop.Ide.Gui; |
315 | +using System.Collections.Generic; |
316 | +using MonoDevelop.Core; |
317 | +using System.Linq; |
318 | + |
319 | +namespace MonoDevelop.Zeitgeist |
320 | +{ |
321 | + [Extension ("/MonoDevelop/Ide/StartupHandlers", NodeName="Class")] |
322 | + public class StartupHandler: CommandHandler |
323 | + { |
324 | + ZeitgeistClient client; |
325 | + IList<TrackedDocument> documents = new List<TrackedDocument> (); |
326 | + |
327 | + public StartupHandler () |
328 | + { |
329 | + client = new ZeitgeistClient (); |
330 | + } |
331 | + |
332 | + protected override void Run () |
333 | + { |
334 | + // TODO Don't log files as opened until they before active through usage when opening a project/solu |
335 | + // IDEA: Auto-close tabs that aren't being used |
336 | + Ide.IdeApp.Workbench.DocumentOpened += HandleDocumentOpened; |
337 | + |
338 | + MonoDevelop.Core.FileService.FileCreated += HandleMonoDevelopCoreFileServiceFileCreated; |
339 | + MonoDevelop.Core.FileService.FileRenamed += HandleMonoDevelopCoreFileServiceFileRenamed; |
340 | + MonoDevelop.Core.FileService.FileRemoved += HandleMonoDevelopCoreFileServiceFileRemoved; |
341 | + |
342 | + Ide.IdeApp.Workspace.SolutionLoaded += HandleIdeIdeAppWorkspaceSolutionLoaded; |
343 | + Ide.IdeApp.Workspace.SolutionUnloaded += HandleIdeIdeAppWorkspaceSolutionUnloaded; |
344 | + } |
345 | + |
346 | + void HandleMonoDevelopCoreFileServiceFileCreated (object sender, FileEventArgs e) |
347 | + { |
348 | + foreach(var fileInfo in e.ToList()) |
349 | + { |
350 | + if(!fileInfo.IsDirectory) |
351 | + { |
352 | + MonoDevelop.Core.LoggingService.LogInfo ("File {0} created", |
353 | + fileInfo.FileName.FileName); |
354 | + client.SendFilePath (fileInfo.FileName, EventType.Create); |
355 | + } |
356 | + } |
357 | + } |
358 | + |
359 | + void HandleMonoDevelopCoreFileServiceFileRemoved (object sender, FileEventArgs e) |
360 | + { |
361 | + foreach(var fileInfo in e.ToList()) |
362 | + { |
363 | + if(!fileInfo.IsDirectory) |
364 | + { |
365 | + MonoDevelop.Core.LoggingService.LogInfo ("File {0} deleted", |
366 | + fileInfo.FileName.FileName); |
367 | + client.SendFilePath (fileInfo.FileName, EventType.Delete); |
368 | + } |
369 | + } |
370 | + } |
371 | + |
372 | + void HandleMonoDevelopCoreFileServiceFileRenamed (object sender, FileCopyEventArgs e) |
373 | + { |
374 | + foreach(FileCopyEventInfo evInfo in e.ToList()) |
375 | + { |
376 | + if(!evInfo.IsDirectory) |
377 | + { |
378 | + MonoDevelop.Core.LoggingService.LogInfo ("Renamed {0} to {1}", |
379 | + evInfo.SourceFile.FileName, evInfo.TargetFile.FileName); |
380 | + client.SendFilePath (evInfo.SourceFile, evInfo.TargetFile, EventType.Move); |
381 | + } |
382 | + } |
383 | + } |
384 | + |
385 | + void HandleIdeIdeAppWorkspaceSolutionUnloaded (object sender, SolutionEventArgs e) |
386 | + { |
387 | + MonoDevelop.Core.LoggingService.LogInfo ("Solution Unloaded: {0}", e.Solution.FileName.FileName); |
388 | + client.SendFilePath (e.Solution.FileName, EventType.Leave); |
389 | + } |
390 | + |
391 | + void HandleIdeIdeAppWorkspaceSolutionLoaded (object sender, SolutionEventArgs e) |
392 | + { |
393 | + MonoDevelop.Core.LoggingService.LogInfo ("Solution Loaded: {0}", e.Solution.FileName.FileName); |
394 | + client.SendFilePath (e.Solution.FileName, EventType.Access); |
395 | + } |
396 | + |
397 | + void HandleDocumentOpened (object sender, DocumentEventArgs e) |
398 | + { |
399 | + if (!e.Document.IsFile) |
400 | + return; |
401 | + |
402 | + MonoDevelop.Core.LoggingService.LogInfo ("Logging access of {0} to Zeitgeist", e.Document.FileName.FileName); |
403 | + var tracked = new TrackedDocument (client, e.Document); |
404 | + tracked.Destroyed += delegate { |
405 | + foreach (var t in documents) |
406 | + if (!t.IsCurrent ()) |
407 | + documents.Remove (t); |
408 | + }; |
409 | + documents.Add (tracked); |
410 | + client.SendFilePath (e.Document.FileName, EventType.Access); |
411 | + } |
412 | + } |
413 | +} |
414 | + |
415 | |
416 | === added file 'monodevelop/TrackedDocument.cs' |
417 | --- monodevelop/TrackedDocument.cs 1970-01-01 00:00:00 +0000 |
418 | +++ monodevelop/TrackedDocument.cs 2011-10-24 01:40:30 +0000 |
419 | @@ -0,0 +1,78 @@ |
420 | +// |
421 | +// TrackedDocument.cs |
422 | +// |
423 | +// Author: |
424 | +// Patrick McEvoy <patrick@qmtech.net> |
425 | +// |
426 | +// Copyright (c) 2011 QMTech. |
427 | +// |
428 | +// Permission is hereby granted, free of charge, to any person obtaining a copy of this |
429 | +// software and associated documentation files (the "Software"), to deal in the Software |
430 | +// without restriction, including without limitation the rights to use, copy, modify, |
431 | +// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to |
432 | +// permit persons to whom the Software is furnished to do so, subject to the following |
433 | +// conditions: |
434 | +// |
435 | +// The above copyright notice and this permission notice shall be included in all copies or |
436 | +// substantial portions of the Software. |
437 | +// |
438 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
439 | +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
440 | +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
441 | +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
442 | +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
443 | +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
444 | +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
445 | + |
446 | +using System; |
447 | +using MonoDevelop.Ide.Gui; |
448 | +using MonoDevelop.Core; |
449 | + |
450 | +namespace MonoDevelop.Zeitgeist |
451 | +{ |
452 | + internal class TrackedDocument |
453 | + { |
454 | + public Document Document { get; set; } |
455 | + public FilePath FilePath { get; set; } |
456 | + |
457 | + ZeitgeistClient client; |
458 | + |
459 | + public TrackedDocument (ZeitgeistClient _client, Document doc) |
460 | + { |
461 | + client = _client; |
462 | + |
463 | + doc.Closed += HandleDocClosed; |
464 | + doc.Saved += HandleDocSaved; |
465 | + Document = doc; |
466 | + FilePath = new FilePath (doc.FileName); |
467 | + } |
468 | + |
469 | + void HandleDocSaved (object sender, EventArgs e) |
470 | + { |
471 | + MonoDevelop.Core.LoggingService.LogInfo ("Logging modify of {0} to Zeitgeist", Document.FileName.FileName); |
472 | + client.SendFilePath (FilePath, EventType.Modify); |
473 | + } |
474 | + |
475 | + void HandleDocClosed (object sender, EventArgs e) |
476 | + { |
477 | + MonoDevelop.Core.LoggingService.LogInfo ("Logging leave of {0} to Zeitgeist", FilePath.FileName); |
478 | + client.SendFilePath (FilePath, EventType.Leave); |
479 | + } |
480 | + |
481 | + public virtual void Dispose () |
482 | + { |
483 | + if (Destroyed != null) |
484 | + Destroyed (this, EventArgs.Empty); |
485 | + } |
486 | + |
487 | + public event EventHandler Destroyed; |
488 | + |
489 | + public bool IsCurrent () |
490 | + { |
491 | + if (Document == null) |
492 | + return false; |
493 | + return true; |
494 | + } |
495 | + } |
496 | +} |
497 | + |
498 | |
499 | === added file 'monodevelop/ZeitgeistClient.cs' |
500 | --- monodevelop/ZeitgeistClient.cs 1970-01-01 00:00:00 +0000 |
501 | +++ monodevelop/ZeitgeistClient.cs 2011-10-24 01:40:30 +0000 |
502 | @@ -0,0 +1,153 @@ |
503 | +// |
504 | +// ZeitgeistClient.cs |
505 | +// |
506 | +// Author: |
507 | +// Patrick McEvoy <patrick@qmtech.net> |
508 | +// Manish Sinha <manishsinha@ubuntu.com> |
509 | +// |
510 | +// Copyright (c) 2011 QMTech. |
511 | +// Copyright (c) 2011 Manish Sinha <manishsinha@ubuntu.com> |
512 | +// |
513 | +// Permission is hereby granted, free of charge, to any person obtaining a copy of this |
514 | +// software and associated documentation files (the "Software"), to deal in the Software |
515 | +// without restriction, including without limitation the rights to use, copy, modify, |
516 | +// merge, publish, distribute, sublicense, and/or sell copies of the Software, and to |
517 | +// permit persons to whom the Software is furnished to do so, subject to the following |
518 | +// conditions: |
519 | +// |
520 | +// The above copyright notice and this permission notice shall be included in all copies or |
521 | +// substantial portions of the Software. |
522 | +// |
523 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
524 | +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
525 | +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
526 | +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
527 | +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
528 | +// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
529 | +// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
530 | + |
531 | +using System; |
532 | + |
533 | +using MonoDevelop.Ide.Gui; |
534 | + |
535 | +using Zeitgeist.Datamodel; |
536 | +using Zeitgeist; |
537 | +using System.Collections.Generic; |
538 | +using MonoDevelop.Ide; |
539 | +using MonoDevelop.Projects; |
540 | +using MonoDevelop.Core; |
541 | + |
542 | +namespace MonoDevelop.Zeitgeist |
543 | +{ |
544 | + internal enum EventType { |
545 | + Access, |
546 | + Modify, |
547 | + Leave, |
548 | + Move, |
549 | + Create, |
550 | + Delete, |
551 | + } |
552 | + |
553 | + internal class ZeitgeistClient |
554 | + { |
555 | + public const string MonoDevelopUri = "application://monodevelop.desktop"; |
556 | + public const string Mimetype = "text/plain"; |
557 | + |
558 | + const string monodevelopDataSourceId = "org.gnome.MonoDevelop,dataprovider"; |
559 | + const string monodevelopDataSourceName = "MonoDevelop Datasource"; |
560 | + const string monodevelopDataSourceDesc = "This datasource pushes the file open, delete, modify events for files and directories edited in MonoDevelop"; |
561 | + |
562 | + DataSourceClient dsReg; |
563 | + LogClient client; |
564 | + |
565 | + public ZeitgeistClient () |
566 | + { |
567 | + dsReg = new DataSourceClient (); |
568 | + |
569 | + MonoDevelop.Core.LoggingService.LogInfo ("Zg#: init new"); |
570 | + |
571 | + Event ev = new Event (); |
572 | + ev.Actor = MonoDevelopUri; |
573 | + Subject sub = new Subject (); |
574 | + sub.Interpretation = Interpretation.Instance.Document.Document; |
575 | + sub.Manifestation = Manifestation.Instance.FileDataObject.FileDataObject; |
576 | + ev.Subjects.Add (sub); |
577 | + |
578 | + try { |
579 | + dsReg.RegisterDataSources (monodevelopDataSourceId, |
580 | + monodevelopDataSourceName, |
581 | + monodevelopDataSourceDesc, |
582 | + new List<Event> (){ev}); |
583 | + client = new LogClient (); |
584 | + } catch (Exception ex) { |
585 | + MonoDevelop.Core.LoggingService.LogError ("Error init", ex); |
586 | + } |
587 | + } |
588 | + |
589 | + public void SendFilePath (FilePath oldPath, FilePath newPath, EventType type) |
590 | + { |
591 | + var eventManifestation = Manifestation.Instance.EventManifestation.UserActivity; |
592 | + var subjectInterpretation = Interpretation.Instance.Document.TextDocument.PlainTextDocument.SourceCode; |
593 | + var subjectManifestation = Manifestation.Instance.FileDataObject.FileDataObject; |
594 | + |
595 | + var interpretation = Interpretation.Instance.EventInterpretation.ModifyEvent; |
596 | + switch (type) { |
597 | + case EventType.Access: |
598 | + interpretation = Interpretation.Instance.EventInterpretation.AccessEvent; |
599 | + break; |
600 | + case EventType.Leave: |
601 | + interpretation = Interpretation.Instance.EventInterpretation.LeaveEvent; |
602 | + break; |
603 | + case EventType.Modify: |
604 | + interpretation = Interpretation.Instance.EventInterpretation.ModifyEvent; |
605 | + break; |
606 | + case EventType.Move: |
607 | + interpretation = Interpretation.Instance.EventInterpretation.MoveEvent; |
608 | + break; |
609 | + case EventType.Create: |
610 | + interpretation = Interpretation.Instance.EventInterpretation.CreateEvent; |
611 | + break; |
612 | + case EventType.Delete: |
613 | + interpretation = Interpretation.Instance.EventInterpretation.DeleteEvent; |
614 | + break; |
615 | + } |
616 | + |
617 | + Event ev = new Event (); |
618 | + |
619 | + ev.Id = 0; |
620 | + ev.Timestamp = DateTime.Now; |
621 | + ev.Interpretation = interpretation; |
622 | + ev.Manifestation = eventManifestation; |
623 | + ev.Actor = MonoDevelopUri; |
624 | + |
625 | + Subject sub = new Subject (); |
626 | + |
627 | + sub.Uri = "file://" + oldPath.FullPath; |
628 | + if(newPath != null) |
629 | + sub.CurrentUri = "file://" + newPath.FullPath; |
630 | + |
631 | + sub.Interpretation = subjectInterpretation; |
632 | + sub.Manifestation = subjectManifestation; |
633 | + |
634 | + FilePath path = newPath != null? newPath : oldPath; |
635 | + MonoDevelop.Core.LoggingService.LogInfo ("File Opened: {0}", path.FullPath); |
636 | + sub.Origin = path.FullPath.ParentDirectory; |
637 | + sub.MimeType = DesktopService.GetMimeTypeForUri (path.FullPath); |
638 | + sub.Text = path.FileName; |
639 | + sub.Storage = string.Empty; |
640 | + |
641 | + ev.Subjects.Add (sub); |
642 | + |
643 | + List<Event> listOfEvents = new List<Event> (); |
644 | + listOfEvents.Add (ev); |
645 | + |
646 | + client.InsertEvents (listOfEvents); |
647 | + } |
648 | + |
649 | + public void SendFilePath (FilePath filePath, EventType type) |
650 | + { |
651 | + SendFilePath(filePath, null, type); |
652 | + } |
653 | + } |
654 | +} |
655 | + |
656 | |
657 | === modified file 'tomboy/Makefile.am' |
658 | --- tomboy/Makefile.am 2010-11-12 17:07:03 +0000 |
659 | +++ tomboy/Makefile.am 2011-10-24 01:40:30 +0000 |
660 | @@ -20,7 +20,7 @@ |
661 | -resource:$(srcdir)/$(ADDIN_NAME).addin.xml |
662 | |
663 | $(TARGET): $(CSFILES) |
664 | - $(GMCS) -out:$@ $(CSFLAGS) $(ASSEMBLIES) $(CSFILES) $(RESOURCES) |
665 | + $(DMCS) -out:$@ $(CSFLAGS) $(ASSEMBLIES) $(CSFILES) $(RESOURCES) |
666 | |
667 | |
668 | addinsdir = $(libdir)/tomboy/addins |