Merge lp:~nmarshall23/do-plugins/spellcheck-plugin into lp:do-plugins

Proposed by Nicholas Marshall
Status: Needs review
Proposed branch: lp:~nmarshall23/do-plugins/spellcheck-plugin
Merge into: lp:do-plugins
Diff against target: 627 lines
13 files modified
.bzrignore (+5/-0)
CheckSpelling/AssemblyInfo.cs (+42/-0)
CheckSpelling/CheckSpelling.mdp (+37/-0)
CheckSpelling/Makefile.am (+21/-0)
CheckSpelling/Resources/CheckSpelling.addin.xml.in (+31/-0)
CheckSpelling/src/CheckSpellingAction.cs (+137/-0)
CheckSpelling/src/DictionaryItem.cs (+62/-0)
CheckSpelling/src/DictionaryItemSource.cs (+96/-0)
DoPlugins.mds (+22/-0)
Makefile.am (+1/-0)
WindowManager/WindowManager.mdp (+1/-0)
configure.ac (+24/-0)
po/POTFILES.in (+2/-0)
To merge this branch: bzr merge lp:~nmarshall23/do-plugins/spellcheck-plugin
Reviewer Review Type Date Requested Status
Alex Launi Pending
Review via email: mp+13595@code.launchpad.net

This proposal supersedes a proposal from 2009-08-17.

To post a comment you must log in.
Revision history for this message
Nicholas Marshall (nmarshall23) wrote : Posted in a previous version of this proposal

The Spellcheck plugin requires libenchant-cil

I have made a project for that here is the bzr branch,
https://launchpad.net/libenchantnet/trunk

and here is the PPA with Ubuntu debs
https://launchpad.net/~enchant-net-maintainers/+archive/ppa

Revision history for this message
Chris S. (cszikszoy) wrote : Posted in a previous version of this proposal

I haven't had a chance to see if this builds / works, so I'm just going by the merge diff right now.

You seem to have done a very good job integrating this with our build system, thanks!

First and foremost: We require that all new plugin submissions follow Mono's coding style guidelines (here: http://www.mono-project.com/Coding_Guidelines).

It seems unnecessary to create a new instance of Broker every time you run the perform action, why don't you make Broker a property, (private Broker EnchantBroker { get; set; }) and then use the action's constructor to create a new instance of the broker when the action is initialized (ie, when M.A. loads your plugin).

You could greatly simlify the way you return suggested items. For example, using Linq and lamdas you could do:

List<Item> suggestions = new List<Item> ();
dictionary.Suggest (sub).ForEach ( sug => { suggestions.Add (new TextItem (sug) as Item); });
yield return suggestions;

When working with Enumerables, use yield, not plain-old return. So at the end of the perform action, use yield break;

I'm not familiar with Enchant, does it support multiple languages? I see you hardcoded en-US, if it does support multiple languages it would be nice to make a small config widget so that the user could change the language of the dictionary.

Those are a few initial comments, fix those and I'll take another look. When you're done, come back to this merge request, and look near the top. There should be a yellow "edit" icon near the "Status" description. Click that, then on the next page click on "Resubmit". It will ask you to confirm the new revisions to the branch, just click OK. This will make reviewing much easier because it will generate a new and updated merge diff.

Thanks!

review: Needs Fixing
Revision history for this message
Alex Launi (alexlauni) wrote : Posted in a previous version of this proposal

On Wed, Aug 12, 2009 at 3:07 PM, Chris S. <email address hidden> wrote:

> I see you hardcoded en-US, if it does support multiple languages it would
> be nice to make a small config widget so that the user could change the
> language of the dictionary.
>

it would be better to check the user's locale, and use that.

--
--Alex Launi

Revision history for this message
Chris S. (cszikszoy) wrote : Posted in a previous version of this proposal

>>  I see you hardcoded en-US, if it does support multiple languages it would
>> be nice to make a small config widget so that the user could change the
>> language of the dictionary.
>>
>
> it would be better to check the user's locale, and use that.
>

As a default yes, that would be nice. But my locale is en-us, what if
I wanted to use the dictionary for German words?

Revision history for this message
Alex Launi (alexlauni) wrote : Posted in a previous version of this proposal

I just think it's silly to create a config widget for one option in a corner
case which is probably never going to pop up. The BEST solution would be to
parse the word, create a list of possible languages based on some heuristic
(there is research in this area), and check each dictionary to see if it's
spelled correctly!

But that might be more work than our friendly new contributer wants to do..
:P

--
-- Alex Launi

Revision history for this message
Chris S. (cszikszoy) wrote : Posted in a previous version of this proposal

How many dictionaries are supported? Instead of a config widget, what
about making an Item out of each dictinoary, and using those as
dynamic modifier items?

Revision history for this message
Nicholas Marshall (nmarshall23) wrote : Posted in a previous version of this proposal

> it would be better to check the user's locale, and use that.
Chris this sound resonable, I will start working on that.
Every app I have looked at seems to do just that.

Now as an aditional action after CheckSpelling has been selected, if you
could change Dictionaries sure, that seems to fit in the use case.

I have mixed feeling on a config widget, sure it maybe useful.. but I can't
see it being used all that much. We will just have to think about it, and
get feedback from users.

Nicholas Marshall

On 8/13/09, Alex Launi <email address hidden> wrote:
>
> I just think it's silly to create a config widget for one option in a
> corner
> case which is probably never going to pop up. The BEST solution would be to
> parse the word, create a list of possible languages based on some heuristic
> (there is research in this area), and check each dictionary to see if it's
> spelled correctly!
>
> But that might be more work than our friendly new contributer wants to do..
> :P
>
> --
> -- Alex Launi
>
>
> https://code.launchpad.net/~nmarshall23/do-plugins/spellcheck-plugin/+merge/10048
> You are the owner of lp:~nmarshall23/do-plugins/spellcheck-plugin.
>

--
И

Revision history for this message
Nicholas Marshall (nmarshall23) wrote : Posted in a previous version of this proposal

>How many dictionaries are supported?
I don't know, you can install support for individual Dictionaries, I will
check.

>Making an Item out of each dictionary, and using those as dynamic modifier
items?
I like this idea and will start working on it.. However if there are a lot
of Dictionaries installed by default, then I see no other option but to
write a config widget.

About libenchantnet, I didn't write these bindings. They were originally
intended for use on MS windows. I found them while completing writing my
own, it seemed strange that there wasn't mono bindings for some kind of
spell check.. So I am sure they are quirky. All I did was change one line so
that it loaded the right shared library. And then run the nunit tests to see
if that was all that was required.

>You seem to have done a very good job integrating this with our build
system, thanks!
I spend a week, learning Ubuntu Packaging and autoconfig. I figured it was
my job to package libenchantnet if I really wanted to see it used.

I still have plenty of questions on how is the best way of packaging mono
applications.

Nicholas Marshall

PS: gee, that was funny, guy writes spell checking code then forgets to
check spelling..

On 8/13/09, Chris S. <email address hidden> wrote:
>
> How many dictionaries are supported? Instead of a config widget, what
> about making an Item out of each dictinoary, and using those as
> dynamic modifier items?
> --
>
> https://code.launchpad.net/~nmarshall23/do-plugins/spellcheck-plugin/+merge/10048
> You are the owner of lp:~nmarshall23/do-plugins/spellcheck-plugin.
>

--
И

Revision history for this message
Nicholas Marshall (nmarshall23) wrote : Posted in a previous version of this proposal

> all new plugin submissions follow Mono's coding style guidelines Done! >I
see you hardcoded en-US I over sight on my part, Now it gets the current
locate's dictionary. > Instead of a config widget, what about making an Item
out of each dictionary, > and using those as dynamic modifier items? This is
done! It could use more testing, however it does seems to work for me.
When LP finishes processing my last push, I will Resubmit.

Nicholas Marshall

On Thu, Aug 13, 2009 at 1:06 PM, Chris S. <email address hidden> wrote:

> How many dictionaries are supported? Instead of a config widget, what
> about making an Item out of each dictinoary, and using those as
> dynamic modifier items?
> --
>
> https://code.launchpad.net/~nmarshall23/do-plugins/spellcheck-plugin/+merge/10048
> You are the owner of lp:~nmarshall23/do-plugins/spellcheck-plugin.
>

Revision history for this message
Alex Launi (alexlauni) wrote : Posted in a previous version of this proposal

This looks good, but please remove the Makefile.in file from the tree, and find an icon for your dictionaries item source.

review: Needs Fixing

Unmerged revisions

659. By Nicholas Marshall

rm CheckSpelling/Makefile.in and added a icon to DItemSource

658. By Nicholas Marshall

/CheckSpellingAction.cs DictionaryItemSource.cs added Finalizers to free our Dictionaries, this only comes up when you switch dictionaries..

657. By Nicholas Marshall

CheckSpellingAction can now use a mod DictionaryItem to switch the locate dictionary

656. By Nicholas Marshall

fixed DictionaryItemSource need to s/_/-/ for CultureInfo on DictionaryItem Language items

655. By Nicholas Marshall

using CultureInfo to get Display name of locates

654. By Nicholas Marshall

Working on dictionary switching

653. By Nicholas Marshall

code cleanup using Linq

652. By Nicholas Marshall

removed last of GUI config boilerplate

651. By Nicholas Marshall

Reformated code to follow Mono's coding style guidelines

650. By Nicholas Marshall

Building debs in a separate branch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file '.bzrignore'
2--- .bzrignore 1970-01-01 00:00:00 +0000
3+++ .bzrignore 2009-10-19 20:05:23 +0000
4@@ -0,0 +1,5 @@
5+*.pidb
6+DoPlugins.userprefs
7+DoPlugins.usertasks
8+bin
9+CheckSpelling/gtk-gui
10
11=== added directory 'CheckSpelling'
12=== added file 'CheckSpelling/AssemblyInfo.cs'
13--- CheckSpelling/AssemblyInfo.cs 1970-01-01 00:00:00 +0000
14+++ CheckSpelling/AssemblyInfo.cs 2009-10-19 20:05:23 +0000
15@@ -0,0 +1,42 @@
16+//
17+// Copyright (C) 2009 Nicholas Marshall
18+//
19+// This program is free software: you can redistribute it and/or modify
20+// it under the terms of the GNU General Public License as published by
21+// the Free Software Foundation, either version 3 of the License, or
22+// (at your option) any later version.
23+//
24+// This program is distributed in the hope that it will be useful,
25+// but WITHOUT ANY WARRANTY; without even the implied warranty of
26+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27+// GNU General Public License for more details.
28+//
29+// You should have received a copy of the GNU General Public License
30+// along with this program. If not, see <http://www.gnu.org/licenses/>.
31+//
32+using System.Reflection;
33+using System.Runtime.CompilerServices;
34+
35+// Information about this assembly is defined by the following attributes.
36+// Change them to the values specific to your project.
37+
38+[assembly: AssemblyTitle("CheckSpelling")]
39+[assembly: AssemblyDescription("")]
40+[assembly: AssemblyConfiguration("")]
41+[assembly: AssemblyCompany("")]
42+[assembly: AssemblyProduct("")]
43+[assembly: AssemblyCopyright("")]
44+[assembly: AssemblyTrademark("")]
45+[assembly: AssemblyCulture("")]
46+
47+// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
48+// The form "{Major}.{Minor}.*" will automatically update the build and revision,
49+// and "{Major}.{Minor}.{Build}.*" will update just the revision.
50+
51+[assembly: AssemblyVersion("1.0.*")]
52+
53+// The following attributes are used to specify the signing key for the assembly,
54+// if desired. See the Mono documentation for more information about signing.
55+
56+[assembly: AssemblyDelaySign(false)]
57+[assembly: AssemblyKeyFile("")]
58
59=== added file 'CheckSpelling/CheckSpelling.mdp'
60--- CheckSpelling/CheckSpelling.mdp 1970-01-01 00:00:00 +0000
61+++ CheckSpelling/CheckSpelling.mdp 2009-10-19 20:05:23 +0000
62@@ -0,0 +1,37 @@
63+<Project name="CheckSpelling" fileversion="2.0" language="C#" targetFramework="3.5" ctype="DotNetProject">
64+ <Policies>
65+ <TextStylePolicy FileWidth="80" TabWidth="8" TabsToSpaces="True" NoTabsAfterNonTabs="False" RemoveTrailingWhitespace="True" EolMarker="Unix" />
66+ </Policies>
67+ <Configurations active="Debug">
68+ <Configuration name="Debug" ctype="DotNetProjectConfiguration">
69+ <Output directory="bin/Debug" assembly="CheckSpelling" />
70+ <Build debugmode="True" target="Library" />
71+ <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" />
72+ <EnvironmentVariables />
73+ <CodeGeneration compiler="Mcs" warninglevel="3" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
74+ </Configuration>
75+ <Configuration name="Release" ctype="DotNetProjectConfiguration">
76+ <Output directory="bin/Release" assembly="CheckSpelling" />
77+ <Build debugmode="False" target="Library" />
78+ <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" />
79+ <EnvironmentVariables />
80+ <CodeGeneration compiler="Mcs" warninglevel="3" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
81+ </Configuration>
82+ </Configurations>
83+ <Contents>
84+ <File name="AssemblyInfo.cs" subtype="Code" buildaction="Compile" />
85+ <File name="Resources/CheckSpelling.addin.xml.in" subtype="Code" buildaction="Nothing" />
86+ <File name="src/CheckSpellingAction.cs" subtype="Code" buildaction="Compile" />
87+ <File name="gtk-gui/gui.stetic" subtype="Code" buildaction="EmbedAsResource" />
88+ <File name="gtk-gui/generated.cs" subtype="Code" buildaction="Compile" />
89+ <File name="src/DictionaryItemSource.cs" subtype="Code" buildaction="Compile" />
90+ <File name="src/DictionaryItem.cs" subtype="Code" buildaction="Compile" />
91+ </Contents>
92+ <References>
93+ <ProjectReference type="Gac" localcopy="True" refto="EnchantNet, Version=0.1.0.0, Culture=neutral, PublicKeyToken=111ed4e2b4e5adb0" />
94+ <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
95+ <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />
96+ <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
97+ <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
98+ </References>
99+</Project>
100\ No newline at end of file
101
102=== added file 'CheckSpelling/Makefile.am'
103--- CheckSpelling/Makefile.am 1970-01-01 00:00:00 +0000
104+++ CheckSpelling/Makefile.am 2009-10-19 20:05:23 +0000
105@@ -0,0 +1,21 @@
106+include $(top_srcdir)/build.rules.mk
107+
108+ASSEMBLY=CheckSpelling
109+
110+FILES = \
111+ src/CheckSpellingAction.cs \
112+ src/DictionaryItem.cs \
113+ src/DictionaryItemSource.cs
114+
115+
116+RESOURCES = \
117+ Resources/CheckSpelling.addin.xml
118+
119+REFERENCES = \
120+ System \
121+ System.Core \
122+ $(ENCHANTNET_LIBS) \
123+ $(GTK_SHARP_20_LIBS) \
124+ $(DO_PLATFORM_LIBS) \
125+ $(DO_PLATFORM_LINUX_LIBS) \
126+ $(DO_UNIVERSE_LIBS)
127
128=== added directory 'CheckSpelling/Resources'
129=== added file 'CheckSpelling/Resources/CheckSpelling.addin.xml.in'
130--- CheckSpelling/Resources/CheckSpelling.addin.xml.in 1970-01-01 00:00:00 +0000
131+++ CheckSpelling/Resources/CheckSpelling.addin.xml.in 2009-10-19 20:05:23 +0000
132@@ -0,0 +1,31 @@
133+<Addin
134+ id="CheckSpelling"
135+ namespace="Do"
136+ version="1.1"
137+ name="CheckSpelling"
138+ description="Fix your spelling"
139+ author="Nicholas Marshall"
140+ category="Community"
141+ defaultEnabled="false"
142+ >
143+
144+ <Runtime>
145+ <Import assembly="CheckSpelling.dll"/>
146+ </Runtime>
147+
148+ <Localizer type="Gettext" catalog="gnome-do-plugins" location="@expanded_datadir@/locale" />
149+
150+ <Dependencies>
151+ <Addin id="Universe" version="1.0" />
152+ </Dependencies>
153+
154+ <!-- Extensions included in this assembly -->
155+ <Extension path="/Do/ItemSource">
156+ <ItemSource type="CheckSpelling.DictionaryItemSource" />
157+ </Extension>
158+
159+ <!-- Extensions included in this assembly -->
160+ <Extension path= "/Do/Action">
161+ <Action type="CheckSpelling.CheckSpellingAction" />
162+ </Extension>
163+</Addin>
164
165=== added directory 'CheckSpelling/src'
166=== added file 'CheckSpelling/src/CheckSpellingAction.cs'
167--- CheckSpelling/src/CheckSpellingAction.cs 1970-01-01 00:00:00 +0000
168+++ CheckSpelling/src/CheckSpellingAction.cs 2009-10-19 20:05:23 +0000
169@@ -0,0 +1,137 @@
170+//
171+// Copyright (C) 2009 Nicholas Marshall
172+//
173+// This program is free software: you can redistribute it and/or modify
174+// it under the terms of the GNU General Public License as published by
175+// the Free Software Foundation, either version 3 of the License, or
176+// (at your option) any later version.
177+//
178+// This program is distributed in the hope that it will be useful,
179+// but WITHOUT ANY WARRANTY; without even the implied warranty of
180+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
181+// GNU General Public License for more details.
182+//
183+// You should have received a copy of the GNU General Public License
184+// along with this program. If not, see <http://www.gnu.org/licenses/>.
185+//
186+
187+
188+
189+using System;
190+using System.Collections.Generic;
191+using System.Linq;
192+using System.Text.RegularExpressions;
193+using System.Globalization;
194+
195+using Enchant;
196+using Mono.Addins;
197+
198+using Do.Universe;
199+using Do.Universe.Common;
200+
201+
202+namespace CheckSpelling
203+{
204+ public class CheckSpellingAction: Act
205+ {
206+
207+
208+
209+ public override string Name {
210+ get {
211+ return AddinManager.CurrentLocalizer.GetString ("Check Spelling");
212+ }
213+ }
214+
215+ public override string Description {
216+ get {
217+ return AddinManager.CurrentLocalizer.GetString ("Suggests corrected spelling");
218+ }
219+ }
220+
221+ public override string Icon {
222+ get {
223+ return "tools-check-spelling";
224+ }
225+ }
226+
227+ private Enchant.Dictionary dictionary;
228+ private Enchant.Dictionary Dictionary{
229+ get{
230+ if(dictionary == null)
231+ dictionary = EnchantBroker.RequestDictionary(
232+ CultureInfo.CurrentCulture.Name);
233+
234+ return dictionary;
235+ }
236+ }
237+
238+ private Broker enchantBroker;
239+ private Broker EnchantBroker {
240+ get {
241+ if(enchantBroker == null)
242+ enchantBroker = new Broker();
243+
244+ return enchantBroker;
245+ }
246+ }
247+
248+ public override IEnumerable<Type> SupportedItemTypes {
249+ get {
250+ yield return typeof (ITextItem);
251+ }
252+ }
253+
254+ public override IEnumerable<Type> SupportedModifierItemTypes {
255+ get { yield return typeof (DictionaryItem); }
256+ }
257+
258+ public override bool ModifierItemsOptional {
259+ get { return true; }
260+ }
261+
262+ ~CheckSpellingAction()
263+ {
264+ dictionary.Dispose();
265+ EnchantBroker.Dispose();
266+ }
267+
268+
269+ public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems)
270+ {
271+/*
272+ * How are Items split? They seem to be on new lines
273+ *
274+ * Take the first item, spit it into words then for each suggest corrections.
275+ * return those suggestions
276+ *
277+ */
278+// if (!(items.First () is ITextItem))
279+// yield break;
280+ string text = (items.First () as ITextItem).Text;
281+
282+ if (modItems.Any ()) {
283+ Dictionary.Dispose();
284+
285+
286+ DictionaryItem modDic = (modItems.First() as DictionaryItem);
287+ dictionary = EnchantBroker.RequestDictionary( modDic.Name );
288+
289+ }
290+
291+ foreach (string sub in Regex.Split(text,@"\W")) {
292+
293+ if(!Dictionary.Check (sub)) {
294+ var suggestions =
295+ from word in Dictionary.Suggest (sub)
296+ select new TextItem (word) as Item;
297+
298+ return suggestions;
299+ }
300+ }
301+
302+ return items;
303+ }
304+ }
305+
306+}
307
308=== added file 'CheckSpelling/src/DictionaryItem.cs'
309--- CheckSpelling/src/DictionaryItem.cs 1970-01-01 00:00:00 +0000
310+++ CheckSpelling/src/DictionaryItem.cs 2009-10-19 20:05:23 +0000
311@@ -0,0 +1,62 @@
312+//
313+// Copyright (C) 2009 Nicholas Marshall
314+//
315+// This program is free software: you can redistribute it and/or modify
316+// it under the terms of the GNU General Public License as published by
317+// the Free Software Foundation, either version 3 of the License, or
318+// (at your option) any later version.
319+//
320+// This program is distributed in the hope that it will be useful,
321+// but WITHOUT ANY WARRANTY; without even the implied warranty of
322+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
323+// GNU General Public License for more details.
324+//
325+// You should have received a copy of the GNU General Public License
326+// along with this program. If not, see <http://www.gnu.org/licenses/>.
327+//
328+
329+using System;
330+using System.Collections.Generic;
331+using System.Linq;
332+using System.Text.RegularExpressions;
333+using System.Globalization;
334+
335+using Enchant;
336+using Mono.Addins;
337+
338+using Do.Universe;
339+using Do.Universe.Common;
340+
341+namespace CheckSpelling
342+{
343+
344+
345+ public class DictionaryItem : Item
346+ {
347+ string name;
348+ string description;
349+
350+ public override string Name {
351+ get { return name; }
352+ }
353+
354+ public string MyName {
355+ set { name = value; }
356+ }
357+
358+ public override string Description {
359+ get { return description; }
360+ }
361+
362+ public string MyDescription {
363+ set { description = value; }
364+ }
365+
366+ public override string Icon {
367+ get { return "accessories-dictionary.png"; }
368+ }
369+
370+
371+
372+ }
373+}
374
375=== added file 'CheckSpelling/src/DictionaryItemSource.cs'
376--- CheckSpelling/src/DictionaryItemSource.cs 1970-01-01 00:00:00 +0000
377+++ CheckSpelling/src/DictionaryItemSource.cs 2009-10-19 20:05:23 +0000
378@@ -0,0 +1,96 @@
379+//
380+// Copyright (C) 2009 Nicholas Marshall
381+//
382+// This program is free software: you can redistribute it and/or modify
383+// it under the terms of the GNU General Public License as published by
384+// the Free Software Foundation, either version 3 of the License, or
385+// (at your option) any later version.
386+//
387+// This program is distributed in the hope that it will be useful,
388+// but WITHOUT ANY WARRANTY; without even the implied warranty of
389+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
390+// GNU General Public License for more details.
391+//
392+// You should have received a copy of the GNU General Public License
393+// along with this program. If not, see <http://www.gnu.org/licenses/>.
394+//
395+
396+using System;
397+using System.Collections.Generic;
398+using System.Linq;
399+using System.Text.RegularExpressions;
400+using System.Globalization;
401+
402+using Enchant;
403+using Mono.Addins;
404+
405+using Do.Universe;
406+using Do.Universe.Common;
407+
408+namespace CheckSpelling
409+{
410+ /// <summary>
411+ /// A source for Installed Locate Dictionary
412+ /// </summary>
413+ public class DictionaryItemSource: ItemSource
414+ {
415+ private Broker enchantBroker;
416+ private Broker EnchantBroker {
417+ get {
418+ if(enchantBroker == null)
419+ enchantBroker = new Broker();
420+
421+ return enchantBroker;
422+ }
423+ }
424+
425+ public override string Name {
426+ get { return AddinManager.CurrentLocalizer.GetString ("Dictionaries"); }
427+ }
428+
429+ public override string Description {
430+ get { return AddinManager.CurrentLocalizer.GetString ("Spell checker dictionaries"); }
431+ }
432+
433+ public override string Icon {
434+
435+ get { return "accessories-dictionary.png"; } //Is there anything better? Locate flags?
436+ }
437+
438+ public override IEnumerable<Type> SupportedItemTypes
439+ {
440+ get { yield return typeof (DictionaryItem); }
441+ }
442+
443+ public override IEnumerable<Item> Items
444+ {
445+ get { return SetupItems(); }
446+ }
447+
448+ private IEnumerable<Item> SetupItems()
449+ {
450+
451+ List<Item> dictionaryItems = new List<Item>();
452+ foreach(DictionaryInfo dic in EnchantBroker.Dictionaries) {
453+ try {
454+ dictionaryItems.Add( new DictionaryItem{
455+ MyName = dic.Language,
456+ MyDescription = CultureInfo.GetCultureInfo(
457+ Regex.Replace(dic.Language,"_","-")).DisplayName
458+ } as Item);
459+ }
460+ catch (System.ArgumentException e ) {
461+ System.Console.WriteLine("Error language {0} is unknown",e.ParamName);
462+ }
463+
464+ }
465+
466+ return dictionaryItems;
467+ }
468+
469+ ~DictionaryItemSource ( )
470+ {
471+ EnchantBroker.Dispose();
472+ }
473+ }
474+}
475
476=== modified file 'DoPlugins.mds'
477--- DoPlugins.mds 2009-10-02 02:12:39 +0000
478+++ DoPlugins.mds 2009-10-19 20:05:23 +0000
479@@ -1,4 +1,10 @@
480 <Combine fileversion="2.0" outputpath="build/bin/" name="DoPlugins" releaseversion="0.4.9.9">
481+ <Policies>
482+ <DotNetNamingPolicy DirectoryNamespaceAssociation="None" ResourceNamePolicy="FileFormatDefault" />
483+ <StandardHeader inheritsSet="LGPLv2License" />
484+ <VersionControlPolicy inheritsSet="Mono" />
485+ <TextStylePolicy FileWidth="120" TabWidth="8" TabsToSpaces="True" NoTabsAfterNonTabs="False" RemoveTrailingWhitespace="True" EolMarker="Unix" />
486+ </Policies>
487 <Configurations active="Debug">
488 <Configuration name="Debug" ctype="CombineConfiguration">
489 <Entry build="True" name="Rhythmbox" configuration="Debug" />
490@@ -74,9 +80,13 @@
491 <Entry build="True" name="Emesene" configuration="Debug" />
492 <Entry build="True" name="Dropbox" configuration="Debug" />
493 <Entry build="True" name="RemindMe" configuration="Debug" />
494+<<<<<<< TREE
495 <Entry build="True" name="Qalculate" configuration="Debug" />
496 <Entry build="True" name="Baconator" configuration="Debug" />
497 <Entry build="True" name="Chromium" configuration="Debug" />
498+=======
499+ <Entry build="True" name="CheckSpelling" configuration="Debug" />
500+>>>>>>> MERGE-SOURCE
501 </Configuration>
502 <Configuration name="Release" ctype="CombineConfiguration">
503 <Entry build="True" name="Rhythmbox" configuration="Release" />
504@@ -152,9 +162,13 @@
505 <Entry build="True" name="Emesene" configuration="Release" />
506 <Entry build="True" name="Dropbox" configuration="Release" />
507 <Entry build="True" name="RemindMe" configuration="Release" />
508+<<<<<<< TREE
509 <Entry build="True" name="Qalculate" configuration="Release" />
510 <Entry build="True" name="Baconator" configuration="Release" />
511 <Entry build="True" name="Chromium" configuration="Release" />
512+=======
513+ <Entry build="True" name="CheckSpelling" configuration="Release" />
514+>>>>>>> MERGE-SOURCE
515 </Configuration>
516 </Configurations>
517 <StartMode startupentry="Rhythmbox" single="True">
518@@ -231,9 +245,13 @@
519 <Execute type="None" entry="Emesene" />
520 <Execute type="None" entry="Dropbox" />
521 <Execute type="None" entry="RemindMe" />
522+<<<<<<< TREE
523 <Execute type="None" entry="Qalculate" />
524 <Execute type="None" entry="Baconator" />
525 <Execute type="None" entry="Chromium" />
526+=======
527+ <Execute type="None" entry="CheckSpelling" />
528+>>>>>>> MERGE-SOURCE
529 </StartMode>
530 <MonoDevelop.ChangeLogAddIn.ChangeLogInfo policy="UpdateNearestChangeLog" />
531 <Entries>
532@@ -310,8 +328,12 @@
533 <Entry filename="Emesene/Emesene.mdp" />
534 <Entry filename="Dropbox/Dropbox.mdp" />
535 <Entry filename="RemindMe/RemindMe.mdp" />
536+<<<<<<< TREE
537 <Entry filename="Qalculate/Qalculate.mdp" />
538 <Entry filename="Baconator/Baconator.mdp" />
539 <Entry filename="Chromium/Chromium.mdp" />
540+=======
541+ <Entry filename="CheckSpelling/CheckSpelling.mdp" />
542+>>>>>>> MERGE-SOURCE
543 </Entries>
544 </Combine>
545\ No newline at end of file
546
547=== modified file 'Makefile.am'
548--- Makefile.am 2009-09-21 12:21:23 +0000
549+++ Makefile.am 2009-10-19 20:05:23 +0000
550@@ -10,6 +10,7 @@
551 Baconator \
552 Banshee \
553 Bibtex \
554+ CheckSpelling \
555 Cl.ickable \
556 ClawsMail \
557 Confluence \
558
559=== modified file 'RememberTheMilk/RTM.mdp'
560=== modified file 'WindowManager/WindowManager.mdp'
561--- WindowManager/WindowManager.mdp 2009-06-29 08:47:41 +0000
562+++ WindowManager/WindowManager.mdp 2009-10-19 20:05:24 +0000
563@@ -51,6 +51,7 @@
564 <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" />
565 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />
566 <ProjectReference type="Gac" localcopy="True" refto="Do.Interface.Wink, Version=0.9.0.0, Culture=neutral" />
567+ <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
568 <ProjectReference type="Gac" localcopy="True" refto="Do.Interface.Wink, Version=1.0.3375.29611, Culture=neutral" />
569 </References>
570 <LanguageParameters ApplicationIcon="." ctype="CSharpProjectParameters" />
571
572=== modified file 'configure.ac'
573--- configure.ac 2009-10-01 04:57:09 +0000
574+++ configure.ac 2009-10-19 20:05:23 +0000
575@@ -80,6 +80,25 @@
576 AC_SUBST([EVOLUTION_SHARP_LIBS])
577 dnl }}}
578
579+dnl {{{ check for Enchant
580+AC_ARG_ENABLE(enchant,
581+ AC_HELP_STRING([--enable-enchant], [Build plugin to check spelling using enchant (default: auto)]),
582+ enable_enchant=$enableval,
583+ enable_enchant=auto)
584+
585+if test "x$enable_enchant" != "xno"; then
586+ PKG_CHECK_MODULES([ENCHANTNET], [enchant-net], HAVE_ENCHANT=yes, HAVE_ENCHANT=no)
587+
588+ if test "x$enable_enchant" = "xyes" -a "x$HAVE_ENCHANT" = "xno"; then
589+ AC_MSG_ERROR([Enchant support explicitly requested but dependencies not found])
590+ fi
591+fi
592+
593+AM_CONDITIONAL(HAVE_ENCHANT, test "x$HAVE_ENCHANT" = "xyes")
594+
595+AC_SUBST([ENCHANTNET_LIBS])
596+dnl }}}
597+
598 dnl {{{ check for Flickr
599 AC_ARG_ENABLE(flickr,
600 AC_HELP_STRING([--enable-flickr], [Build plugin to interact with flickr using flickrnet (default: auto)]),
601@@ -252,8 +271,13 @@
602 Banshee/Resources/Banshee.addin.xml
603 Bibtex/Makefile
604 Bibtex/Resources/Bibtex.addin.xml
605+<<<<<<< TREE
606 Chromium/Makefile
607 Chromium/Resources/Chromium.addin.xml
608+=======
609+CheckSpelling/Makefile
610+CheckSpelling/Resources/CheckSpelling.addin.xml
611+>>>>>>> MERGE-SOURCE
612 Cl.ickable/Makefile
613 Cl.ickable/Resources/Cl.ickable.addin.xml
614 ClawsMail/Makefile
615
616=== modified file 'po/POTFILES.in'
617--- po/POTFILES.in 2009-07-09 08:02:29 +0000
618+++ po/POTFILES.in 2009-10-19 20:05:24 +0000
619@@ -14,6 +14,8 @@
620 Banshee/src/PreviousAction.cs
621 Banshee/src/SearchCollectionAction.cs
622 Bibtex/gtk-gui/Bibtex.Configuration.cs
623+CheckSpelling/src/CheckSpellingAction.cs
624+CheckSpelling/src/DictionaryItemSource.cs
625 ClawsMail/src/ClawsContactDetailItem.cs
626 ClawsMail/src/ClawsContactsItemSource.cs
627 Cl.ickable/src/ClickableItemSource.cs

Subscribers

People subscribed via source and target branches