Merge lp:~manishsinha/zeitgeist-datasources/reworked-tomboy into lp:zeitgeist-datasources/0.8

Status: Rejected
Rejected by: Seif Lotfy
Proposed branch: lp:~manishsinha/zeitgeist-datasources/reworked-tomboy
Merge into: lp:zeitgeist-datasources/0.8
Diff against target: 962 lines (+528/-247)
13 files modified
Makefile.include (+118/-0)
configure.ac (+28/-4)
tomboy/AssemblyInfo.cs (+27/-0)
tomboy/Makefile.am (+103/-0)
tomboy/NoteHandler.cs (+69/-0)
tomboy/Tomboy.Zeitgeist.csproj (+65/-0)
tomboy/Tomboy.Zeitgeist.sln (+20/-0)
tomboy/Zeitgeist.addin.xml (+2/-2)
tomboy/Zeitgeist.cs (+0/-200)
tomboy/Zeitgeist.mdp (+0/-28)
tomboy/ZeitgeistAddin.cs (+90/-0)
tomboy/install.sh (+0/-13)
tomboy/tomboy.zeitgeist.pc (+6/-0)
To merge this branch: bzr merge lp:~manishsinha/zeitgeist-datasources/reworked-tomboy
Reviewer Review Type Date Requested Status
Michal Hruby Pending
Review via email: mp+35961@code.launchpad.net

This proposal supersedes a proposal from 2010-09-19.

Description of the change

Reimplemented Tomboy's data provider using zeitgeist-sharp
http://launchpad.net/zeitgeist-sharp

To post a comment you must log in.
Revision history for this message
Michal Hruby (mhr3) wrote : Posted in a previous version of this proposal

From a quick look (I'm not using Tomboy):
- 'TomboyUri' should be just application://tomboy.desktop
- please get rid of the install.sh script, everything is now done using Makefiles
- I really don't like the bundled dll library, isn't there another way to check for it?

review: Needs Fixing
Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote : Posted in a previous version of this proposal

> From a quick look (I'm not using Tomboy):
> - 'TomboyUri' should be just application://tomboy.desktop
Doing it.

> - please get rid of the install.sh script, everything is now done using
> Makefiles
Yeah. Have to get it working. I just kept the old way of building.
> - I really don't like the bundled dll library, isn't there another way to
> check for it?
Until zeitgeist-sharp is not made available in the PPA/Repo, till then we have to keep it here. Once it is made available, then we can get rid of this. BTW this bundled dll is just a workaround till zg-sharp makes it into APT repo

Unmerged revisions

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

Removed the old mdp based builds

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

Modified build to include tomboy too

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

Added Simple Makefile support with most common targets. The config script does the basic package dependency checking

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

Changed the App name to application://tomboy.desktop and created a sln file

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

Implemented Note open, closed, deleted, hidden and renamed

Zeitgeist.dll is added in the source control. Once it is packages and available in the APT repos, it can be removed from the source code

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

Created the basic infrastructure for using Zeitgeist.dll. At present Logging is not implemented

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'Makefile.include'
2--- Makefile.include 1970-01-01 00:00:00 +0000
3+++ Makefile.include 2010-09-19 19:02:39 +0000
4@@ -0,0 +1,118 @@
5+VALID_CULTURES = ar bg ca zh-CHS cs da de el en es fi fr he hu is it ja ko nl no pl pt ro ru hr sk sq sv th tr id uk be sl et lv lt fa vi hy eu mk af ka fo hi sw gu ta te kn mr gl kok ar-SA bg-BG ca-ES zh-TW cs-CZ da-DK de-DE el-GR en-US fi-FI fr-FR he-IL hu-HU is-IS it-IT ja-JP ko-KR nl-NL nb-NO pl-PL pt-BR ro-RO ru-RU hr-HR sk-SK sq-AL sv-SE th-TH tr-TR id-ID uk-UA be-BY sl-SI et-EE lv-LV lt-LT fa-IR vi-VN hy-AM eu-ES mk-MK af-ZA ka-GE fo-FO hi-IN sw-KE gu-IN ta-IN te-IN kn-IN mr-IN gl-ES kok-IN ar-IQ zh-CN de-CH en-GB es-MX fr-BE it-CH nl-BE nn-NO pt-PT sv-FI ar-EG zh-HK de-AT en-AU es-ES fr-CA ar-LY zh-SG de-LU en-CA es-GT fr-CH ar-DZ zh-MO en-NZ es-CR fr-LU ar-MA en-IE es-PA ar-TN en-ZA es-DO ar-OM es-VE ar-YE es-CO ar-SY es-PE ar-JO en-TT es-AR ar-LB en-ZW es-EC ar-KW en-PH es-CL ar-AE es-UY ar-BH es-PY ar-QA es-BO es-SV es-HN es-NI es-PR zh-CHT
6+
7+s2q=$(subst \ ,?,$1)
8+q2s=$(subst ?,\ ,$1)
9+# use this when result will be quoted
10+unesc2=$(subst ?, ,$1)
11+
12+build_sources = $(FILES) $(GENERATED_FILES)
13+build_sources_esc= $(call s2q,$(build_sources))
14+# use unesc2, as build_sources_embed is quoted
15+build_sources_embed= $(call unesc2,$(build_sources_esc:%='$(srcdir)/%'))
16+
17+comma__=,
18+get_resource_name = $(firstword $(subst $(comma__), ,$1))
19+get_culture = $(lastword $(subst ., ,$(basename $1)))
20+is_cultured_resource = $(and $(word 3,$(subst ., ,$1)), $(filter $(VALID_CULTURES),$(lastword $(subst ., ,$(basename $1)))))
21+
22+RESOURCES_ESC=$(call s2q,$(RESOURCES))
23+
24+build_resx_list = $(foreach res, $(RESOURCES_ESC), $(if $(filter %.resx, $(call get_resource_name,$(res))),$(res),))
25+build_non_culture_resx_list = $(foreach res, $(build_resx_list),$(if $(call is_cultured_resource,$(call get_resource_name,$(res))),,$(res)))
26+build_non_culture_others_list = $(foreach res, $(filter-out $(build_resx_list),$(RESOURCES_ESC)),$(if $(call is_cultured_resource,$(call get_resource_name,$(res))),,$(res)))
27+build_others_list = $(build_non_culture_others_list)
28+build_xamlg_list = $(filter %.xaml.g.cs, $(FILES))
29+
30+# resgen all .resx resources
31+build_resx_files = $(foreach res, $(build_resx_list), $(call get_resource_name,$(res)))
32+build_resx_resources_esc = $(build_resx_files:.resx=.resources)
33+build_resx_resources = $(call q2s,$(build_resx_resources_esc))
34+
35+# embed resources for the main assembly
36+build_resx_resources_hack = $(subst .resx,.resources, $(build_non_culture_resx_list))
37+# use unesc2, as build_resx_resources_embed is quoted
38+build_resx_resources_embed = $(call unesc2,$(build_resx_resources_hack:%='-resource:%'))
39+build_others_files = $(call q2s,$(foreach res, $(build_others_list),$(call get_resource_name,$(res))))
40+build_others_resources = $(build_others_files)
41+# use unesc2, as build_others_resources_embed is quoted
42+build_others_resources_embed = $(call unesc2,$(build_others_list:%='-resource:$(srcdir)/%'))
43+
44+build_resources = $(build_resx_resources) $(build_others_resources)
45+build_resources_embed = $(build_resx_resources_embed) $(build_others_resources_embed)
46+
47+# -usesourcepath is available only for resgen2
48+emit_resgen_target_1=$(call q2s,$1) : $(call q2s,$(subst .resources,.resx,$1)); cd '$$(shell dirname '$$<')' && MONO_IOMAP=drive $$(RESGEN) '$$(shell basename '$$<')' '$$(shell basename '$$@')'
49+emit_resgen_target_2=$(call q2s,$1) : $(call q2s,$(subst .resources,.resx,$1)); MONO_IOMAP=drive $$(RESGEN) -usesourcepath '$$<' '$$@'
50+
51+emit_resgen_target=$(if $(filter resgen2,$(RESGEN)),$(emit_resgen_target_2),$(emit_resgen_target_1))
52+emit_resgen_targets=$(foreach res,$(build_resx_resources_esc),$(eval $(call emit_resgen_target,$(res))))
53+
54+build_references_ref = $(call q2s,$(foreach ref, $(call s2q,$(REFERENCES)), $(if $(filter -pkg:%, $(ref)), $(ref), $(if $(filter -r:%, $(ref)), $(ref), -r:$(ref)))))
55+build_references_ref += $(call q2s,$(foreach ref, $(call s2q,$(DLL_REFERENCES)), -r:$(ref)))
56+build_references_ref += $(call q2s,$(foreach ref, $(call s2q,$(PROJECT_REFERENCES)), -r:$(ref)))
57+
58+s2q2s=$(call unesc2,$(call s2q,$1))
59+cp_actual=test -z $1 || cp $1 $2
60+cp=$(call cp_actual,'$(call s2q2s,$1)','$(call s2q2s,$2)')
61+
62+rm_actual=test -z '$1' || rm -f '$2'
63+rm=$(call rm_actual,$(call s2q2s,$1),$(call s2q2s,$2)/$(shell basename '$(call s2q2s,$1)'))
64+
65+EXTRA_DIST += $(build_sources) $(build_resx_files) $(build_others_files) $(ASSEMBLY_WRAPPER_IN) $(EXTRAS) $(DATA_FILES) $(build_culture_res_files)
66+CLEANFILES += $(ASSEMBLY) $(ASSEMBLY).mdb $(BINARIES) $(build_resx_resources) $(build_satellite_assembly_list)
67+DISTCLEANFILES = $(GENERATED_FILES) $(pc_files) $(BUILD_DIR)/*
68+
69+pkglib_SCRIPTS = $(ASSEMBLY)
70+bin_SCRIPTS = $(BINARIES)
71+
72+programfilesdir = @libdir@/@PACKAGE@
73+programfiles_DATA = $(PROGRAMFILES)
74+linuxpkgconfigdir = @libdir@/pkgconfig
75+linuxpkgconfig_DATA = $(LINUX_PKGCONFIG)
76+
77+
78+# macros
79+
80+# $(call emit-deploy-target,deploy-variable-name)
81+define emit-deploy-target
82+$($1): $($1_SOURCE)
83+ mkdir -p '$$(shell dirname '$$@')'
84+ cp '$$<' '$$@'
85+endef
86+
87+# $(call emit-deploy-wrapper,wrapper-variable-name,wrapper-sourcefile,x)
88+# assumes that for a wrapper foo.pc its source template is foo.pc.in
89+# if $3 is non-empty then wrapper is marked exec
90+define emit-deploy-wrapper
91+$($1): $2
92+ mkdir -p '$$(shell dirname '$$@')'
93+ cp '$$<' '$$@'
94+ $(if $3,chmod +x '$$@')
95+
96+endef
97+
98+# generating satellite assemblies
99+
100+culture_resources = $(foreach res, $(RESOURCES_ESC), $(if $(call is_cultured_resource,$(call get_resource_name, $(res))),$(res)))
101+cultures = $(sort $(foreach res, $(culture_resources), $(call get_culture,$(call get_resource_name,$(res)))))
102+culture_resource_dependencies = $(call q2s,$(BUILD_DIR)/$1/$(SATELLITE_ASSEMBLY_NAME): $(subst .resx,.resources,$2))
103+culture_resource_commandlines = $(call unesc2,cmd_line_satellite_$1 += '/embed:$(subst .resx,.resources,$2)')
104+build_satellite_assembly_list = $(call q2s,$(cultures:%=$(BUILD_DIR)/%/$(SATELLITE_ASSEMBLY_NAME)))
105+build_culture_res_files = $(call q2s,$(foreach res, $(culture_resources),$(call get_resource_name,$(res))))
106+install_satellite_assembly_list = $(subst $(BUILD_DIR),$(DESTDIR)$(libdir)/$(PACKAGE),$(build_satellite_assembly_list))
107+
108+$(eval $(foreach res, $(culture_resources), $(eval $(call culture_resource_dependencies,$(call get_culture,$(call get_resource_name,$(res))),$(call get_resource_name,$(res))))))
109+$(eval $(foreach res, $(culture_resources), $(eval $(call culture_resource_commandlines,$(call get_culture,$(call get_resource_name,$(res))),$(res)))))
110+
111+$(build_satellite_assembly_list): $(BUILD_DIR)/%/$(SATELLITE_ASSEMBLY_NAME):
112+ mkdir -p '$(@D)'
113+ $(AL) -out:'$@' -culture:$* -t:lib $(cmd_line_satellite_$*)
114+
115+$(install_satellite_assembly_list):
116+ mkdir -p '$(@D)'
117+ cp $(subst $(DESTDIR)$(libdir)/$(PACKAGE), $(BUILD_DIR), $@) $@
118+
119+install-satellite-assemblies: $(install_satellite_assembly_list)
120+
121+uninstall-satellite-assemblies:
122+ rm -rf $(install_satellite_assembly_list)
123\ No newline at end of file
124
125=== modified file 'configure.ac'
126--- configure.ac 2010-08-05 20:45:47 +0000
127+++ configure.ac 2010-09-19 19:02:39 +0000
128@@ -51,8 +51,8 @@
129 AC_MSG_RESULT($all_plugins)
130
131 # The full list of plugins
132-allowed_plugins="bzr chrome eog firefox-libzg geany gedit rhythmbox totem-libzg vim emacs"
133-# currently disabled = "epiphany tomboy"
134+allowed_plugins="bzr chrome eog firefox-libzg geany gedit rhythmbox totem-libzg vim emacs tomboy"
135+# currently disabled = "epiphany"
136
137 # npapi-plugin has a template Makefile.am, but don't use it directly
138 # - see chrome's Makefile.am for how to compile it
139@@ -152,8 +152,31 @@
140 fi
141 ;;
142 tomboy)
143- # not supported atm
144- continue
145+ AC_PATH_PROG(GMCS, gmcs, no)
146+ PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0])
147+ if test "x$GMCS" = "xno"; then
148+ AC_MSG_ERROR([gmcs Not found])
149+ fi
150+ AC_ARG_ENABLE(debug,
151+ AC_HELP_STRING([--enable-debug],
152+ [Use 'DEBUG' Configuration [default=NO]]),
153+ enable_debug=yes, enable_debug=no)
154+ AM_CONDITIONAL(ENABLE_DEBUG, test x$enable_debug = xyes)
155+ if test "x$enable_debug" = "xyes" ; then
156+ CONFIG_REQUESTED="yes"
157+ fi
158+ AC_ARG_ENABLE(release,
159+ AC_HELP_STRING([--enable-release],
160+ [Use 'RELEASE' Configuration [default=YES]]),
161+ enable_release=yes, enable_release=no)
162+ AM_CONDITIONAL(ENABLE_RELEASE, test x$enable_release = xyes)
163+ if test "x$enable_release" = "xyes" ; then
164+ CONFIG_REQUESTED="yes"
165+ fi
166+ if test -z "$CONFIG_REQUESTED" ; then
167+ AM_CONDITIONAL(ENABLE_RELEASE, true)
168+ enable_release=yes
169+ fi
170 ;;
171 totem*)
172 if test "${with_vala}" != "yes" ; then
173@@ -217,6 +240,7 @@
174 totem-libzg/Makefile
175 vim/Makefile
176 emacs/Makefile
177+tomboy/Makefile
178 ])
179
180 AC_MSG_NOTICE([Zeitgeist-dataproviders was configured with the following options:])
181
182=== added file 'tomboy/AssemblyInfo.cs'
183--- tomboy/AssemblyInfo.cs 1970-01-01 00:00:00 +0000
184+++ tomboy/AssemblyInfo.cs 2010-09-19 19:02:39 +0000
185@@ -0,0 +1,27 @@
186+using System.Reflection;
187+using System.Runtime.CompilerServices;
188+
189+// Information about this assembly is defined by the following attributes.
190+// Change them to the values specific to your project.
191+
192+[assembly: AssemblyTitle("Tomboy.Zeitgeist")]
193+[assembly: AssemblyDescription("")]
194+[assembly: AssemblyConfiguration("")]
195+[assembly: AssemblyCompany("")]
196+[assembly: AssemblyProduct("")]
197+[assembly: AssemblyCopyright("Zeitgeist Sharp Developers")]
198+[assembly: AssemblyTrademark("")]
199+[assembly: AssemblyCulture("")]
200+
201+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
202+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
203+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
204+
205+[assembly: AssemblyVersion("0.1.0.*")]
206+
207+// The following attributes are used to specify the signing key for the assembly,
208+// if desired. See the Mono documentation for more information about signing.
209+
210+//[assembly: AssemblyDelaySign(false)]
211+//[assembly: AssemblyKeyFile("")]
212+
213
214=== added file 'tomboy/Makefile.am'
215--- tomboy/Makefile.am 1970-01-01 00:00:00 +0000
216+++ tomboy/Makefile.am 2010-09-19 19:02:39 +0000
217@@ -0,0 +1,103 @@
218+
219+EXTRA_DIST = expansions.m4 /usr/lib/tomboy/Tomboy.exe Zeitgeist.dll
220+
221+#Warning: This is an automatically generated file, do not edit!
222+if ENABLE_DEBUG
223+ SUBDIRS = .
224+endif
225+if ENABLE_RELEASE
226+ SUBDIRS = .
227+endif
228+
229+
230+
231+# Warning: This is an automatically generated file, do not edit!
232+
233+if ENABLE_DEBUG
234+ASSEMBLY_COMPILER_COMMAND = gmcs
235+ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -optimize- -debug "-define:DEBUG"
236+ASSEMBLY = bin/Debug/Tomboy.Zeitgeist.dll
237+ASSEMBLY_MDB = $(ASSEMBLY).mdb
238+COMPILE_TARGET = library
239+PROJECT_REFERENCES =
240+BUILD_DIR = bin/Debug
241+
242+ZEITGEIST_DLL_SOURCE=Zeitgeist.dll
243+TOMBOY_ZEITGEIST_DLL_MDB_SOURCE=bin/Debug/Tomboy.Zeitgeist.dll.mdb
244+TOMBOY_ZEITGEIST_DLL_MDB=$(BUILD_DIR)/Tomboy.Zeitgeist.dll.mdb
245+
246+endif
247+
248+if ENABLE_RELEASE
249+ASSEMBLY_COMPILER_COMMAND = gmcs
250+ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -optimize-
251+ASSEMBLY = bin/Release/Tomboy.Zeitgeist.dll
252+ASSEMBLY_MDB =
253+COMPILE_TARGET = library
254+PROJECT_REFERENCES =
255+BUILD_DIR = bin/Release
256+
257+ZEITGEIST_DLL_SOURCE=Zeitgeist.dll
258+TOMBOY_ZEITGEIST_DLL_MDB=
259+
260+endif
261+
262+AL=al2
263+SATELLITE_ASSEMBLY_NAME=$(notdir $(basename $(ASSEMBLY))).resources.dll
264+
265+PROGRAMFILES = \
266+ $(ZEITGEIST_DLL) \
267+ $(TOMBOY_ZEITGEIST_DLL_MDB)
268+
269+LINUX_PKGCONFIG = \
270+ $(TOMBOY_ZEITGEIST_PC)
271+
272+
273+RESGEN=resgen2
274+
275+all: $(ASSEMBLY) $(PROGRAMFILES) $(LINUX_PKGCONFIG)
276+
277+FILES = \
278+ AssemblyInfo.cs \
279+ ZeitgeistAddin.cs \
280+ NoteHandler.cs \
281+ Zeitgeist.cs
282+
283+DATA_FILES =
284+
285+RESOURCES = \
286+ Zeitgeist.addin.xml,Tomboy.Zeitgeist.Zeitgeist.addin.xml
287+
288+EXTRAS = \
289+ tomboy.zeitgeist.pc.in
290+
291+REFERENCES = \
292+ System \
293+ $(GTK_SHARP_20_LIBS) \
294+ Mono.Posix \
295+ $(GLIB_SHARP_20_LIBS)
296+
297+DLL_REFERENCES = \
298+ /usr/lib/tomboy/Tomboy.exe \
299+ Zeitgeist.dll
300+
301+CLEANFILES = $(PROGRAMFILES) $(LINUX_PKGCONFIG)
302+
303+include $(top_srcdir)/Makefile.include
304+
305+ZEITGEIST_DLL = $(BUILD_DIR)/Zeitgeist.dll
306+TOMBOY_ZEITGEIST_PC = $(BUILD_DIR)/tomboy.zeitgeist.pc
307+
308+$(eval $(call emit-deploy-target,ZEITGEIST_DLL))
309+$(eval $(call emit-deploy-wrapper,TOMBOY_ZEITGEIST_PC,tomboy.zeitgeist.pc))
310+
311+
312+$(eval $(call emit_resgen_targets))
313+$(build_xamlg_list): %.xaml.g.cs: %.xaml
314+ xamlg '$<'
315+
316+$(ASSEMBLY_MDB): $(ASSEMBLY)
317+
318+$(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) $(DLL_REFERENCES) $(PROJECT_REFERENCES) $(build_xamlg_list) $(build_satellite_assembly_list)
319+ mkdir -p $(shell dirname $(ASSEMBLY))
320+ $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$(ASSEMBLY) -target:$(COMPILE_TARGET) $(build_sources_embed) $(build_resources_embed) $(build_references_ref)
321
322=== added file 'tomboy/NoteHandler.cs'
323--- tomboy/NoteHandler.cs 1970-01-01 00:00:00 +0000
324+++ tomboy/NoteHandler.cs 2010-09-19 19:02:39 +0000
325@@ -0,0 +1,69 @@
326+using System;
327+using Zeitgeist.Datamodel;
328+using System.Collections.Generic;
329+
330+namespace Tomboy.Zeitgeist
331+{
332+ public class NoteHandler
333+ {
334+ public NoteHandler(Note note)
335+ {
336+ // Check if the Note has already been processes.
337+ // Whent he note is being processed, event handlers are attached to
338+ if (handledNotes.Contains(note) == false)
339+ {
340+ this._note = note;
341+
342+ note.Opened += HandleNoteOpened;
343+ if (note.HasWindow)
344+ {
345+ HandleNoteOpened();
346+ }
347+ }
348+ }
349+
350+ void HandleNoteOpened (object sender, EventArgs e)
351+ {
352+ HandleNoteOpened();
353+ }
354+
355+ void HandleNoteOpened()
356+ {
357+ this._note.Window.Hidden += HandleNoteWindowHidden;
358+ this._note.Window.Shown += HandleNoteWindowShown;
359+ this._note.Renamed += HandleNoteRenamed;
360+ if (this._note.Window.Visible)
361+ {
362+ HandleNoteWindowShown();
363+ }
364+ }
365+
366+ void HandleNoteRenamed (Note sender, string old_title)
367+ {
368+ Console.WriteLine("Zg#: Renamed: " + this._note.Title);
369+ ZeitgeistHandler.SendEvent(sender, Interpretation.Instance.EventInterpretation.ModifyEvent);
370+ }
371+
372+ void HandleNoteWindowShown (object sender, EventArgs e)
373+ {
374+ HandleNoteWindowShown();
375+ }
376+
377+ void HandleNoteWindowShown ()
378+ {
379+ Console.WriteLine("Zg#: Note window opened: " + this._note.Title);
380+ ZeitgeistHandler.SendEvent(this._note, Interpretation.Instance.EventInterpretation.AccessEvent);
381+ }
382+
383+ void HandleNoteWindowHidden (object sender, EventArgs e)
384+ {
385+ Console.WriteLine("Zg#: Note window closed: " + this._note.Title);
386+ ZeitgeistHandler.SendEvent(this._note, Interpretation.Instance.EventInterpretation.LeaveEvent);
387+ }
388+
389+ private Note _note;
390+
391+ private static List<Note> handledNotes = new List<Note>();
392+ }
393+}
394+
395
396=== added file 'tomboy/Tomboy.Zeitgeist.csproj'
397--- tomboy/Tomboy.Zeitgeist.csproj 1970-01-01 00:00:00 +0000
398+++ tomboy/Tomboy.Zeitgeist.csproj 2010-09-19 19:02:39 +0000
399@@ -0,0 +1,65 @@
400+<?xml version="1.0" encoding="utf-8"?>
401+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
402+ <PropertyGroup>
403+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
404+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
405+ <ProductVersion>9.0.21022</ProductVersion>
406+ <SchemaVersion>2.0</SchemaVersion>
407+ <ProjectGuid>{4DC09956-B20D-4ECA-8ACD-17E7609BAE41}</ProjectGuid>
408+ <OutputType>Library</OutputType>
409+ <RootNamespace>Tomboy.Zeitgeist</RootNamespace>
410+ <AssemblyName>Tomboy.Zeitgeist</AssemblyName>
411+ </PropertyGroup>
412+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
413+ <DebugSymbols>true</DebugSymbols>
414+ <DebugType>full</DebugType>
415+ <Optimize>false</Optimize>
416+ <OutputPath>bin\Debug</OutputPath>
417+ <DefineConstants>DEBUG</DefineConstants>
418+ <ErrorReport>prompt</ErrorReport>
419+ <WarningLevel>4</WarningLevel>
420+ <ConsolePause>false</ConsolePause>
421+ </PropertyGroup>
422+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
423+ <DebugType>none</DebugType>
424+ <Optimize>false</Optimize>
425+ <OutputPath>bin\Release</OutputPath>
426+ <ErrorReport>prompt</ErrorReport>
427+ <WarningLevel>4</WarningLevel>
428+ <ConsolePause>false</ConsolePause>
429+ </PropertyGroup>
430+ <ItemGroup>
431+ <Reference Include="System" />
432+ <Reference Include="Tomboy, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
433+ <SpecificVersion>False</SpecificVersion>
434+ <HintPath>\usr\lib\tomboy\Tomboy.exe</HintPath>
435+ <Private>False</Private>
436+ </Reference>
437+ <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
438+ <Package>gtk-sharp-2.0</Package>
439+ </Reference>
440+ <Reference Include="Mono.Posix" />
441+ <Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
442+ <Package>glib-sharp-2.0</Package>
443+ </Reference>
444+ <Reference Include="Zeitgeist, Version=1.0.3914.35475, Culture=neutral, PublicKeyToken=null">
445+ <SpecificVersion>False</SpecificVersion>
446+ <HintPath>Zeitgeist.dll</HintPath>
447+ </Reference>
448+ </ItemGroup>
449+ <ItemGroup>
450+ <Compile Include="AssemblyInfo.cs" />
451+ <Compile Include="ZeitgeistAddin.cs" />
452+ <Compile Include="NoteHandler.cs" />
453+ <Compile Include="Zeitgeist.cs" />
454+ </ItemGroup>
455+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
456+ <ItemGroup>
457+ <EmbeddedResource Include="Zeitgeist.addin.xml" />
458+ </ItemGroup>
459+ <ProjectExtensions>
460+ <MonoDevelop>
461+ <Properties InternalTargetFrameworkVersion="3.5" />
462+ </MonoDevelop>
463+ </ProjectExtensions>
464+</Project>
465
466=== added file 'tomboy/Tomboy.Zeitgeist.sln'
467--- tomboy/Tomboy.Zeitgeist.sln 1970-01-01 00:00:00 +0000
468+++ tomboy/Tomboy.Zeitgeist.sln 2010-09-19 19:02:39 +0000
469@@ -0,0 +1,20 @@
470+
471+Microsoft Visual Studio Solution File, Format Version 9.00
472+# Visual Studio 2005
473+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tomboy.Zeitgeist", "Tomboy.Zeitgeist.csproj", "{2591D85F-7B39-486E-8260-D9022DE8BDE6}"
474+EndProject
475+Global
476+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
477+ Debug|Any CPU = Debug|Any CPU
478+ Release|Any CPU = Release|Any CPU
479+ EndGlobalSection
480+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
481+ {2591D85F-7B39-486E-8260-D9022DE8BDE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
482+ {2591D85F-7B39-486E-8260-D9022DE8BDE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
483+ {2591D85F-7B39-486E-8260-D9022DE8BDE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
484+ {2591D85F-7B39-486E-8260-D9022DE8BDE6}.Release|Any CPU.Build.0 = Release|Any CPU
485+ EndGlobalSection
486+ GlobalSection(MonoDevelopProperties) = preSolution
487+ StartupItem = Tomboy.Zeitgeist.csproj
488+ EndGlobalSection
489+EndGlobal
490
491=== modified file 'tomboy/Zeitgeist.addin.xml'
492--- tomboy/Zeitgeist.addin.xml 2010-08-16 11:07:09 +0000
493+++ tomboy/Zeitgeist.addin.xml 2010-09-19 19:02:39 +0000
494@@ -1,14 +1,14 @@
495 <Addin id="Zeitgeist"
496 namespace="Tomboy"
497 name="Zeitgeist Integration"
498- author="Laszlo Pandy laszlok2@gmail.com"
499+ author="Manish Sinha"
500 description="Logs usage data to Zeitgeist."
501 category="Desktop Integration"
502 defaultEnabled="true"
503 version="0.1">
504
505 <Runtime>
506- <Import assembly="Zeitgeist.dll" />
507+ <Import assembly="Tomboy.Zeitgeist.dll" />
508 </Runtime>
509
510 <Dependencies>
511
512=== added file 'tomboy/Zeitgeist.cs'
513--- tomboy/Zeitgeist.cs 1970-01-01 00:00:00 +0000
514+++ tomboy/Zeitgeist.cs 2010-09-19 19:02:39 +0000
515@@ -0,0 +1,83 @@
516+using System;
517+using Zeitgeist.Datamodel;
518+using Zeitgeist;
519+using System.Collections.Generic;
520+using Tomboy;
521+
522+namespace Tomboy.Zeitgeist
523+{
524+ public class ZeitgeistHandler
525+ {
526+ public static bool SendEvent(Note note, KeyValuePair<string,string> eventInterpretation)
527+ {
528+ KeyValuePair<string,string> eventManifestation = Manifestation.Instance.EventManifestation.UserActivity;
529+
530+ KeyValuePair<string,string> subjectInterpretation = Interpretation.Instance.Document.Document;
531+ KeyValuePair<string,string> subjectManifestation = Manifestation.Instance.FileDataObject.FileDataObject;
532+
533+ Event ev = EventCreator.CreateEvent(note, eventInterpretation, eventManifestation, subjectInterpretation, subjectManifestation);
534+
535+
536+ try
537+ {
538+ List<Event> listOfEvents = new List<Event>();
539+ listOfEvents.Add(ev);
540+
541+ GLib.Idle.Add(delegate()
542+ {
543+ SendEvent(listOfEvents);
544+ return false;
545+ });
546+
547+ Console.WriteLine(string.Format("Operation {0} successful", ev.Interpretation.Key));
548+ return true;
549+ }
550+ catch(Exception e)
551+ {
552+ Console.WriteLine(e.StackTrace);
553+
554+ return false;
555+ }
556+ }
557+
558+ private static void SendEvent(List<Event> e)
559+ {
560+ LogClient client = new LogClient();
561+ client.InsertEvents(e);
562+ }
563+ }
564+
565+ public class EventCreator
566+ {
567+ public static Event CreateEvent(Note note,
568+ KeyValuePair<string,string> eventInterpretation,
569+ KeyValuePair<string,string> eventManifestation,
570+ KeyValuePair<string,string> subjectInterpretation,
571+ KeyValuePair<string,string> subjectManifestation)
572+ {
573+ Event ev = new Event();
574+
575+
576+ ev.Id = 0;
577+ ev.Timestamp = DateTime.Now;
578+ ev.Interpretation = eventInterpretation;
579+ ev.Manifestation = eventManifestation;
580+ ev.Actor = ZeitgeistAddin.TomboyUri;
581+
582+ Subject sub = new Subject();
583+
584+ sub.Uri = note.Uri;
585+ sub.Interpretation = subjectInterpretation;
586+ sub.Manifestation = subjectManifestation;
587+ sub.Origin = string.Empty;
588+ sub.MimeType = ZeitgeistAddin.NoteMimetype;
589+ sub.Text = note.Title;
590+ sub.Storage = string.Empty;
591+
592+ ev.Subjects.Add(sub);
593+
594+ return ev;
595+ }
596+ }
597+}
598+
599
600=== removed file 'tomboy/Zeitgeist.cs'
601--- tomboy/Zeitgeist.cs 2010-08-19 10:33:11 +0000
602+++ tomboy/Zeitgeist.cs 1970-01-01 00:00:00 +0000
603@@ -1,200 +0,0 @@
604-
605-using System;
606-using System.Collections.Generic;
607-using Tomboy;
608-using NDesk.DBus;
609-using Gtk;
610-using GLib;
611-using Mono.Unix.Native;
612-
613-namespace Tomboy.Zeitgeist
614-{
615- class NoteHandler
616- {
617- private static List<string> handled_notes = new List<string>();
618- private Note note;
619-
620- public NoteHandler(Note note) {
621- if (handled_notes.Contains(note.Id) == false) {
622- this.note = note;
623- note.Opened += HandleNoteOpened;
624- if (note.HasWindow) {
625- HandleNoteOpened();
626- }
627- }
628- }
629-
630- void HandleNoteOpened (object sender, EventArgs e) {
631- HandleNoteOpened();
632- }
633- void HandleNoteOpened() {
634- note.Window.Hidden += HandleNoteWindowHidden;
635- note.Window.Shown += HandleNoteWindowShown;
636- note.Renamed += HandleNoteRenamed;
637- if (note.Window.Visible) {
638- HandleNoteWindowShown();
639- }
640- }
641-
642- void HandleNoteRenamed (Note sender, string old_title)
643- {
644- Console.WriteLine("Zg: Renamed: " + note.Title);
645- ZeitgeistDbus.SendToZeitgeist(note, ZeitgeistDbus.EventInterpretation.ModifyEvent);
646- }
647-
648- void HandleNoteWindowShown (object sender, EventArgs e) {
649- HandleNoteWindowShown();
650- }
651- void HandleNoteWindowShown ()
652- {
653- Console.WriteLine("Zg: Note window opened: " + note.Title);
654- ZeitgeistDbus.SendToZeitgeist(note, ZeitgeistDbus.EventInterpretation.OpenEvent);
655- }
656-
657- void HandleNoteWindowHidden (object sender, EventArgs e)
658- {
659- Console.WriteLine("Zg: Note window closed: " + note.Title);
660- ZeitgeistDbus.SendToZeitgeist(note, ZeitgeistDbus.EventInterpretation.CloseEvent);
661- }
662- }
663-
664- class ZeitgeistDbus
665- {
666- private static ILogger zeitgeist_proxy =
667- Bus.Session.GetObject<ILogger>("org.gnome.zeitgeist.Engine",
668- new ObjectPath("/org/gnome/zeitgeist/log/activity"));
669-
670- public enum EventInterpretation {
671- OpenEvent,
672- CloseEvent,
673- CreateEvent,
674- ModifyEvent,
675- }
676-
677- private static string GetEventInterpetation(EventInterpretation e) {
678- switch(e) {
679- case EventInterpretation.OpenEvent:
680- return "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#AccessEvent";
681- case EventInterpretation.CloseEvent:
682- return "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#LeaveEvent";
683- case EventInterpretation.CreateEvent:
684- return "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#CreateEvent";
685- case EventInterpretation.ModifyEvent:
686- return "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#ModifyEvent";
687- default:
688- return null;
689- }
690- }
691-
692- public static void SendToZeitgeist(Note note, EventInterpretation ev_interp) {
693- if (zeitgeist_proxy == null) {
694- Console.WriteLine("Zg: cannot connect to zeitgeist, dbus proxy is null");
695- return;
696- }
697-
698- string ev_interp_string = GetEventInterpetation(ev_interp);
699- if (ev_interp_string == null) {
700- Console.WriteLine("Zg: unknown interpretation type: " + ev_interp.ToString());
701- return;
702- }
703-
704- Timeval t;
705- Syscall.gettimeofday(out t);
706- long millis_now = (t.tv_sec * 1000) + (t.tv_usec / 1000);
707-
708- Event e = new Event();
709- e.metadata = new string[5];
710- e.metadata[0] = ""; //id (filled in by Zeitgeist)
711- e.metadata[1] = millis_now.ToString();
712- e.metadata[2] = ev_interp_string;
713- e.metadata[3] = "http://www.zeitgeist-project.com/ontologies/2010/01/27/zg#UserActivity";
714- e.metadata[4] = "application://tomboy.desktop";
715-
716- string[] subject = new string[7];
717- subject[0] = note.Uri;
718- subject[1] = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Document";
719- subject[2] = "http://www.semanticdesktop.org/ontologies/nfo#FileDataObject";
720- subject[3] = ""; //origin
721- subject[4] = "application/x-tomboy"; //mimetype
722- subject[5] = note.Title;
723- subject[6] = ""; //storage id
724-
725- e.subjects = new string[][] { subject };
726- e.payload = new byte[0];
727-
728- GLib.Idle.Add(delegate() {
729- SendEvent(e);
730- return false;
731- });
732- }
733-
734- private static void SendEvent(Event e) {
735- int[] inserted;
736- try {
737- inserted = zeitgeist_proxy.InsertEvents(new Event[] { e });
738- } catch (Exception ex) {
739- Console.WriteLine("Zg: insertion failed: " + ex.Message);
740- return;
741- }
742-
743- if (inserted.Length > 0) {
744- Console.WriteLine("Zg: Inserted event: " + inserted[0]);
745- }
746- else {
747- Console.WriteLine("Zg: Insertion failed");
748- }
749- return;
750- }
751- }
752-
753- [NDesk.DBus.Interface ("org.gnome.zeitgeist.Log")]
754- interface ILogger {
755- int[] InsertEvents(Event[] events);
756- }
757-
758- struct Event {
759- public string[] metadata;
760- public string[][] subjects;
761- public byte[] payload;
762- }
763-
764- public class ZeitgeistAddin : ApplicationAddin
765- {
766- private bool _init = false;
767- public override bool Initialized {
768- get { return _init; }
769- }
770-
771- public override
772- void Initialize() {
773- Console.WriteLine("Zg: init new");
774- init_handlers();
775- _init = true;
776- }
777-
778- public override
779- void Shutdown() {
780- Console.WriteLine("Zg: shutdown");
781- }
782-
783- void HandleNoteAdded(object sender, Note new_note) {
784- Console.WriteLine("Zg: Note added: " + new_note.Title);
785- Console.WriteLine("\t" + new_note.Uri);
786-
787- new NoteHandler(new_note);
788- ZeitgeistDbus.SendToZeitgeist(new_note, ZeitgeistDbus.EventInterpretation.CreateEvent);
789- }
790-
791- public void init_handlers() {
792- foreach (Note note in Tomboy.DefaultNoteManager.Notes) {
793- new NoteHandler(note);
794- }
795-
796- Tomboy.DefaultNoteManager.NoteAdded -= HandleNoteAdded;
797- Tomboy.DefaultNoteManager.NoteAdded += HandleNoteAdded;
798- }
799- }
800-
801-
802-
803-}
804
805=== added file 'tomboy/Zeitgeist.dll'
806Binary files tomboy/Zeitgeist.dll 1970-01-01 00:00:00 +0000 and tomboy/Zeitgeist.dll 2010-09-19 19:02:39 +0000 differ
807=== removed file 'tomboy/Zeitgeist.mdp'
808--- tomboy/Zeitgeist.mdp 2010-08-16 10:57:40 +0000
809+++ tomboy/Zeitgeist.mdp 1970-01-01 00:00:00 +0000
810@@ -1,28 +0,0 @@
811-<Project name="Zeitgeist" fileversion="2.0" DefaultNamespace="Zeitgeist" language="C#" targetFramework="2.0" ctype="DotNetProject">
812- <Configurations active="Debug">
813- <Configuration name="Debug" ctype="DotNetProjectConfiguration">
814- <Output directory="bin/Debug" assembly="Zeitgeist" />
815- <Build debugmode="True" target="Library" />
816- <Execution consolepause="False" runwithwarnings="True" runtime="MsNet" />
817- <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
818- </Configuration>
819- <Configuration name="Release" ctype="DotNetProjectConfiguration">
820- <Output directory="bin/Release" assembly="Zeitgeist" />
821- <Build debugmode="False" target="Library" />
822- <Execution consolepause="False" runwithwarnings="True" runtime="MsNet" />
823- <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
824- </Configuration>
825- </Configurations>
826- <Contents>
827- <File subtype="Code" buildaction="Compile" name="Zeitgeist.cs" />
828- <File subtype="Code" buildaction="EmbedAsResource" name="Zeitgeist.addin.xml" />
829- </Contents>
830- <References>
831- <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
832- <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
833- <ProjectReference type="Gac" localcopy="True" refto="NDesk.DBus, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099" />
834- <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
835- <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
836- <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="/usr/lib/tomboy/Tomboy.exe" />
837- </References>
838-</Project>
839
840=== added file 'tomboy/ZeitgeistAddin.cs'
841--- tomboy/ZeitgeistAddin.cs 1970-01-01 00:00:00 +0000
842+++ tomboy/ZeitgeistAddin.cs 2010-09-19 19:02:39 +0000
843@@ -0,0 +1,90 @@
844+using System;
845+using Tomboy;
846+using System.Collections.Generic;
847+using System.IO;
848+using Zeitgeist.Datamodel;
849+
850+namespace Tomboy.Zeitgeist
851+{
852+ public class ZeitgeistAddin : ApplicationAddin
853+ {
854+ public ZeitgeistAddin ()
855+ {
856+ notesList = new List<NoteHandler>();
857+ }
858+
859+ #region Overridden methods
860+
861+ public override bool Initialized
862+ {
863+ get
864+ {
865+ return _init;
866+ }
867+ }
868+
869+ public override void Initialize()
870+ {
871+ Console.WriteLine("Zg#: init new");
872+
873+ // Initialize the handlers for hooking into Tomboy
874+ InitHandlers();
875+
876+ _init = true;
877+ }
878+
879+ public override void Shutdown()
880+ {
881+ Console.WriteLine("Zg#: shutdown");
882+ }
883+
884+ #endregion
885+
886+ public void InitHandlers()
887+ {
888+ // For every note present in the store
889+
890+ foreach (Note note in Tomboy.DefaultNoteManager.Notes)
891+ {
892+ notesList.Add(new NoteHandler(note));
893+ }
894+
895+ Tomboy.DefaultNoteManager.NoteAdded -= HandleNoteAdded;
896+ Tomboy.DefaultNoteManager.NoteAdded += HandleNoteAdded;
897+
898+ Tomboy.DefaultNoteManager.NoteDeleted -= HandleNoteDeleted;
899+ Tomboy.DefaultNoteManager.NoteDeleted += HandleNoteDeleted;
900+ }
901+
902+ void HandleNoteAdded(object sender, Note new_note)
903+ {
904+ Console.WriteLine("Zg#: Note added: " + new_note.Title);
905+ Console.WriteLine("\t" + new_note.Uri);
906+
907+ notesList.Add(new NoteHandler(new_note));
908+
909+ ZeitgeistHandler.SendEvent(new_note, Interpretation.Instance.EventInterpretation.CreateEvent);
910+ }
911+
912+ void HandleNoteDeleted(object sender, Note new_note)
913+ {
914+ Console.WriteLine("Zg#: Note deleted: " + new_note.Title);
915+ Console.WriteLine("\t" + new_note.Uri);
916+
917+ ZeitgeistHandler.SendEvent(new_note, Interpretation.Instance.EventInterpretation.DeleteEvent);
918+ }
919+
920+ List<NoteHandler> notesList;
921+
922+ private bool _init = false;
923+
924+ #region Public Constants
925+
926+ public const string TomboyUri = "application://tomboy.desktop";
927+
928+ public const string NoteMimetype = "application/x-tomboy";
929+
930+ #endregion
931+ }
932+}
933+
934
935=== removed file 'tomboy/install.sh'
936--- tomboy/install.sh 2010-02-03 16:06:55 +0000
937+++ tomboy/install.sh 1970-01-01 00:00:00 +0000
938@@ -1,13 +0,0 @@
939-#!/bin/sh
940-
941-mkdir -p ~/.config/tomboy/addins/
942-
943-# Please install monodevelop to get mdtool.
944-# Please edit Zeitgeist.mdp and change the local path of Tomboy.exe
945-# to the correct one for your environment (so it can link to the
946-# correct version of Tomboy).
947-mdtool build Zeitgeist.mdp
948-
949-cp bin/Debug/Zeitgeist.dll ~/.config/tomboy/addins/Zeitgeist.dll
950-
951-
952
953=== added file 'tomboy/tomboy.zeitgeist.pc'
954--- tomboy/tomboy.zeitgeist.pc 1970-01-01 00:00:00 +0000
955+++ tomboy/tomboy.zeitgeist.pc 2010-09-19 19:02:39 +0000
956@@ -0,0 +1,6 @@
957+Name: Tomboy.Zeitgeist
958+Description: Tomboy.Zeitgeist
959+Version: 0.1
960+
961+Requires:
962+Libs: -r:@expanded_libdir@/@PACKAGE@/Tomboy.Zeitgeist.dll

Subscribers

People subscribed via source and target branches