Status: | Needs review |
---|---|
Proposed branch: | lp:~joehillen/do-plugins/Help |
Merge into: | lp:do-plugins |
Diff against target: |
483 lines (+225/-168) 11 files modified
Help/Help.mdp (+28/-0) Help/Makefile.am (+17/-0) Help/Resources/Help.addin.xml.in (+27/-0) Help/src/Help.cs (+76/-0) Help/src/ManPages.cs (+74/-0) Makefile.am (+1/-1) ManLookUp/Makefile.am (+0/-15) ManLookUp/ManLookUp.mdp (+0/-28) ManLookUp/Resources/ManLookUp.addin.xml.in (+0/-26) ManLookUp/src/ReadManualPageAction.cs (+0/-96) configure.ac (+2/-2) |
To merge this branch: | bzr merge lp:~joehillen/do-plugins/Help |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Do Plugins Team | Pending | ||
Review via email: mp+15392@code.launchpad.net |
Commit message
Description of the change
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 | === added directory 'Help' | |||
2 | === added file 'Help/Help.mdp' | |||
3 | --- Help/Help.mdp 1970-01-01 00:00:00 +0000 | |||
4 | +++ Help/Help.mdp 2009-11-30 02:30:24 +0000 | |||
5 | @@ -0,0 +1,28 @@ | |||
6 | 1 | <Project name="Help" fileversion="2.0" language="C#" targetFramework="3.5" ctype="DotNetProject"> | ||
7 | 2 | <Configurations active="Debug"> | ||
8 | 3 | <Configuration name="Debug" ctype="DotNetProjectConfiguration"> | ||
9 | 4 | <Output directory="bin/Debug" assembly="Help" /> | ||
10 | 5 | <Build debugmode="True" target="Library" /> | ||
11 | 6 | <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" /> | ||
12 | 7 | <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> | ||
13 | 8 | </Configuration> | ||
14 | 9 | <Configuration name="Release" ctype="DotNetProjectConfiguration"> | ||
15 | 10 | <Output directory="." assembly="Help" /> | ||
16 | 11 | <Build debugmode="False" target="Library" /> | ||
17 | 12 | <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" /> | ||
18 | 13 | <EnvironmentVariables /> | ||
19 | 14 | <CodeGeneration compiler="Mcs" warninglevel="4" optimize="False" unsafecodeallowed="False" generateoverflowchecks="False" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> | ||
20 | 15 | </Configuration> | ||
21 | 16 | </Configurations> | ||
22 | 17 | <Contents> | ||
23 | 18 | <File name="src/Help.cs" subtype="Code" buildaction="Compile" /> | ||
24 | 19 | <File name="Resources/Help.addin.xml" subtype="Code" buildaction="EmbedAsResource" /> | ||
25 | 20 | <File name="Resources/icons/search-help.png" subtype="Code" buildaction="EmbedAsResource" /> | ||
26 | 21 | </Contents> | ||
27 | 22 | <References> | ||
28 | 23 | <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" /> | ||
29 | 24 | <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> | ||
30 | 25 | <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | ||
31 | 26 | <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | ||
32 | 27 | </References> | ||
33 | 28 | </Project> | ||
34 | 0 | \ No newline at end of file | 29 | \ No newline at end of file |
35 | 1 | 30 | ||
36 | === added file 'Help/Makefile.am' | |||
37 | --- Help/Makefile.am 1970-01-01 00:00:00 +0000 | |||
38 | +++ Help/Makefile.am 2009-11-30 02:30:24 +0000 | |||
39 | @@ -0,0 +1,17 @@ | |||
40 | 1 | include $(top_srcdir)/build.rules.mk | ||
41 | 2 | |||
42 | 3 | ASSEMBLY=Help | ||
43 | 4 | |||
44 | 5 | FILES = \ | ||
45 | 6 | src/Help.cs \ | ||
46 | 7 | src/ManPages.cs | ||
47 | 8 | |||
48 | 9 | RESOURCES = \ | ||
49 | 10 | Resources/Help.addin.xml \ | ||
50 | 11 | Resources/icons/search-help.png \ | ||
51 | 12 | Resources/icons/search-man.png | ||
52 | 13 | |||
53 | 14 | REFERENCES = \ | ||
54 | 15 | System \ | ||
55 | 16 | $(DO_PLATFORM_LIBS) \ | ||
56 | 17 | $(DO_UNIVERSE_LIBS) | ||
57 | 0 | 18 | ||
58 | === added directory 'Help/Resources' | |||
59 | === added file 'Help/Resources/Help.addin.xml.in' | |||
60 | --- Help/Resources/Help.addin.xml.in 1970-01-01 00:00:00 +0000 | |||
61 | +++ Help/Resources/Help.addin.xml.in 2009-11-30 02:30:24 +0000 | |||
62 | @@ -0,0 +1,27 @@ | |||
63 | 1 | <Addin | ||
64 | 2 | id="Help" | ||
65 | 3 | namespace="Do" | ||
66 | 4 | version="1.2" | ||
67 | 5 | name="Help" | ||
68 | 6 | description="Use Gnome Do to find Help." | ||
69 | 7 | author="Joe Hillenbrand and J. Carlos Navea" | ||
70 | 8 | category="Community" | ||
71 | 9 | defaultEnabled="false" | ||
72 | 10 | > | ||
73 | 11 | |||
74 | 12 | <Runtime> | ||
75 | 13 | <Import assembly="Help.dll"/> | ||
76 | 14 | </Runtime> | ||
77 | 15 | |||
78 | 16 | <Localizer type="Gettext" catalog="gnome-do-plugins" location="@expanded_datadir@/locale" /> | ||
79 | 17 | |||
80 | 18 | <Dependencies> | ||
81 | 19 | <Addin id="Universe" version="1.0" /> | ||
82 | 20 | </Dependencies> | ||
83 | 21 | |||
84 | 22 | <Extension path = "/Do/Action"> | ||
85 | 23 | <Action type="Help.HelpAction" /> | ||
86 | 24 | <Action type="Help.ManPagesAction" /> | ||
87 | 25 | </Extension> | ||
88 | 26 | |||
89 | 27 | </Addin> | ||
90 | 0 | 28 | ||
91 | === added directory 'Help/Resources/icons' | |||
92 | === added file 'Help/Resources/icons/search-help.png' | |||
93 | 1 | Binary files Help/Resources/icons/search-help.png 1970-01-01 00:00:00 +0000 and Help/Resources/icons/search-help.png 2009-11-30 02:30:24 +0000 differ | 29 | Binary files Help/Resources/icons/search-help.png 1970-01-01 00:00:00 +0000 and Help/Resources/icons/search-help.png 2009-11-30 02:30:24 +0000 differ |
94 | === added file 'Help/Resources/icons/search-man.png' | |||
95 | 2 | Binary files Help/Resources/icons/search-man.png 1970-01-01 00:00:00 +0000 and Help/Resources/icons/search-man.png 2009-11-30 02:30:24 +0000 differ | 30 | Binary files Help/Resources/icons/search-man.png 1970-01-01 00:00:00 +0000 and Help/Resources/icons/search-man.png 2009-11-30 02:30:24 +0000 differ |
96 | === added directory 'Help/src' | |||
97 | === added file 'Help/src/Help.cs' | |||
98 | --- Help/src/Help.cs 1970-01-01 00:00:00 +0000 | |||
99 | +++ Help/src/Help.cs 2009-11-30 02:30:24 +0000 | |||
100 | @@ -0,0 +1,76 @@ | |||
101 | 1 | // Help.cs | ||
102 | 2 | // by Joe Hillenbrand <joehillen@gmail.com> | ||
103 | 3 | // | ||
104 | 4 | // based on ManLookUp | ||
105 | 5 | // by J. Carlos Navea <loconet@gmail.com> | ||
106 | 6 | // | ||
107 | 7 | // This program is free software: you can redistribute it and/or modify | ||
108 | 8 | // it under the terms of the GNU General Public License as published by | ||
109 | 9 | // the Free Software Foundation, either version 3 of the License, or | ||
110 | 10 | // (at your option) any later version. | ||
111 | 11 | // | ||
112 | 12 | // This program is distributed in the hope that it will be useful, | ||
113 | 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
114 | 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
115 | 15 | // GNU General Public License for more details. | ||
116 | 16 | // | ||
117 | 17 | // You should have received a copy of the GNU General Public License | ||
118 | 18 | // along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
119 | 19 | // | ||
120 | 20 | |||
121 | 21 | using System; | ||
122 | 22 | using System.Linq; | ||
123 | 23 | using System.Diagnostics; | ||
124 | 24 | using System.Collections.Generic; | ||
125 | 25 | using System.Text.RegularExpressions; | ||
126 | 26 | |||
127 | 27 | using Mono.Addins; | ||
128 | 28 | |||
129 | 29 | using Do.Universe; | ||
130 | 30 | |||
131 | 31 | namespace Help { | ||
132 | 32 | |||
133 | 33 | /// <summary> | ||
134 | 34 | /// HelpAction - use yelp to search for help | ||
135 | 35 | /// </summary> | ||
136 | 36 | public class HelpAction : Act { | ||
137 | 37 | |||
138 | 38 | public override string Name { | ||
139 | 39 | get { return AddinManager.CurrentLocalizer.GetString ("Get Help"); } | ||
140 | 40 | } | ||
141 | 41 | |||
142 | 42 | public override string Description { | ||
143 | 43 | get { return AddinManager.CurrentLocalizer.GetString ("Search Gnome's Help for an Aplication or Text"); } | ||
144 | 44 | } | ||
145 | 45 | |||
146 | 46 | public override string Icon { | ||
147 | 47 | get { return "search-help.png@" + GetType ().Assembly.FullName; } | ||
148 | 48 | } | ||
149 | 49 | |||
150 | 50 | public override IEnumerable<Type> SupportedItemTypes { | ||
151 | 51 | get { | ||
152 | 52 | yield return typeof (ITextItem); | ||
153 | 53 | yield return typeof (IRunnableItem); | ||
154 | 54 | } | ||
155 | 55 | } | ||
156 | 56 | |||
157 | 57 | public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems) | ||
158 | 58 | { | ||
159 | 59 | string keyword = ""; | ||
160 | 60 | foreach (Item i in items) { | ||
161 | 61 | if (i is ITextItem){ | ||
162 | 62 | keyword = (i as ITextItem).Text; | ||
163 | 63 | } else if (i is IRunnableItem) { | ||
164 | 64 | keyword = (i as IRunnableItem).Name; | ||
165 | 65 | } | ||
166 | 66 | if (!string.IsNullOrEmpty (keyword)) { | ||
167 | 67 | Process term = new Process (); | ||
168 | 68 | term.StartInfo.FileName = "yelp"; | ||
169 | 69 | term.StartInfo.Arguments = " 'x-yelp-search:"+keyword+"' "; | ||
170 | 70 | term.Start (); | ||
171 | 71 | } | ||
172 | 72 | } | ||
173 | 73 | yield break; | ||
174 | 74 | } | ||
175 | 75 | } | ||
176 | 76 | } | ||
177 | 0 | 77 | ||
178 | === added file 'Help/src/ManPages.cs' | |||
179 | --- Help/src/ManPages.cs 1970-01-01 00:00:00 +0000 | |||
180 | +++ Help/src/ManPages.cs 2009-11-30 02:30:24 +0000 | |||
181 | @@ -0,0 +1,74 @@ | |||
182 | 1 | // ManPageAction.cs | ||
183 | 2 | // by J. Carlos Navea <loconet@gmail.com> | ||
184 | 3 | // | ||
185 | 4 | // | ||
186 | 5 | // This program is free software: you can redistribute it and/or modify | ||
187 | 6 | // it under the terms of the GNU General Public License as published by | ||
188 | 7 | // the Free Software Foundation, either version 3 of the License, or | ||
189 | 8 | // (at your option) any later version. | ||
190 | 9 | // | ||
191 | 10 | // This program is distributed in the hope that it will be useful, | ||
192 | 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
193 | 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
194 | 13 | // GNU General Public License for more details. | ||
195 | 14 | // | ||
196 | 15 | // You should have received a copy of the GNU General Public License | ||
197 | 16 | // along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
198 | 17 | // | ||
199 | 18 | |||
200 | 19 | using System; | ||
201 | 20 | using System.Linq; | ||
202 | 21 | using System.Diagnostics; | ||
203 | 22 | using System.Collections.Generic; | ||
204 | 23 | using System.Text.RegularExpressions; | ||
205 | 24 | |||
206 | 25 | using Mono.Addins; | ||
207 | 26 | |||
208 | 27 | using Do.Universe; | ||
209 | 28 | |||
210 | 29 | namespace Help { | ||
211 | 30 | |||
212 | 31 | /// <summary> | ||
213 | 32 | /// ManPagesAction - find a man page using yelp | ||
214 | 33 | /// </summary> | ||
215 | 34 | public class ManPagesAction : Act { | ||
216 | 35 | |||
217 | 36 | public override string Name { | ||
218 | 37 | get { return AddinManager.CurrentLocalizer.GetString ("Look up man page"); } | ||
219 | 38 | } | ||
220 | 39 | |||
221 | 40 | public override string Description { | ||
222 | 41 | get { return AddinManager.CurrentLocalizer.GetString ("Find a manual for this..."); } | ||
223 | 42 | } | ||
224 | 43 | |||
225 | 44 | public override string Icon { | ||
226 | 45 | get { return "search-man.png@" + GetType ().Assembly.FullName; } | ||
227 | 46 | } | ||
228 | 47 | |||
229 | 48 | /// <value> | ||
230 | 49 | /// Supported items: ITextItem and IRunnableItem | ||
231 | 50 | /// </value> | ||
232 | 51 | public override IEnumerable<Type> SupportedItemTypes { | ||
233 | 52 | get { | ||
234 | 53 | yield return typeof (ITextItem); | ||
235 | 54 | } | ||
236 | 55 | } | ||
237 | 56 | |||
238 | 57 | public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems) | ||
239 | 58 | { | ||
240 | 59 | string keyword = ""; | ||
241 | 60 | foreach (Item i in items) { | ||
242 | 61 | if (i is ITextItem) { | ||
243 | 62 | keyword = (i as ITextItem).Text; | ||
244 | 63 | } | ||
245 | 64 | if (!string.IsNullOrEmpty (keyword)) { | ||
246 | 65 | Process term = new Process (); | ||
247 | 66 | term.StartInfo.FileName = "yelp"; | ||
248 | 67 | term.StartInfo.Arguments = " 'man:"+keyword+"' "; | ||
249 | 68 | term.Start (); | ||
250 | 69 | } | ||
251 | 70 | } | ||
252 | 71 | yield break; | ||
253 | 72 | } | ||
254 | 73 | } | ||
255 | 74 | } | ||
256 | 0 | 75 | ||
257 | === modified file 'Makefile.am' | |||
258 | --- Makefile.am 2009-11-08 23:58:01 +0000 | |||
259 | +++ Makefile.am 2009-11-30 02:30:24 +0000 | |||
260 | @@ -36,11 +36,11 @@ | |||
261 | 36 | GoogleDocs \ | 36 | GoogleDocs \ |
262 | 37 | GoogleMaps \ | 37 | GoogleMaps \ |
263 | 38 | GoogleSearch \ | 38 | GoogleSearch \ |
264 | 39 | Help \ | ||
265 | 39 | ImageShack \ | 40 | ImageShack \ |
266 | 40 | JIRA \ | 41 | JIRA \ |
267 | 41 | Launchpad \ | 42 | Launchpad \ |
268 | 42 | LocateFiles \ | 43 | LocateFiles \ |
269 | 43 | ManLookUp \ | ||
270 | 44 | Microblogging \ | 44 | Microblogging \ |
271 | 45 | MPD \ | 45 | MPD \ |
272 | 46 | NX \ | 46 | NX \ |
273 | 47 | 47 | ||
274 | === removed directory 'ManLookUp' | |||
275 | === removed file 'ManLookUp/Makefile.am' | |||
276 | --- ManLookUp/Makefile.am 2009-06-22 04:05:16 +0000 | |||
277 | +++ ManLookUp/Makefile.am 1970-01-01 00:00:00 +0000 | |||
278 | @@ -1,15 +0,0 @@ | |||
279 | 1 | include $(top_srcdir)/build.rules.mk | ||
280 | 2 | |||
281 | 3 | ASSEMBLY=ManLookUp | ||
282 | 4 | |||
283 | 5 | FILES = \ | ||
284 | 6 | src/ReadManualPageAction.cs | ||
285 | 7 | |||
286 | 8 | RESOURCES = \ | ||
287 | 9 | Resources/ManLookUp.addin.xml | ||
288 | 10 | |||
289 | 11 | REFERENCES = \ | ||
290 | 12 | System \ | ||
291 | 13 | System.Core \ | ||
292 | 14 | $(DO_PLATFORM_LIBS) \ | ||
293 | 15 | $(DO_UNIVERSE_LIBS) | ||
294 | 16 | 0 | ||
295 | === removed file 'ManLookUp/ManLookUp.mdp' | |||
296 | --- ManLookUp/ManLookUp.mdp 2009-06-29 08:47:41 +0000 | |||
297 | +++ ManLookUp/ManLookUp.mdp 1970-01-01 00:00:00 +0000 | |||
298 | @@ -1,28 +0,0 @@ | |||
299 | 1 | <Project name="ManLookUp" fileversion="2.0" language="C#" Description="Gnome-do plugin" clr-version="Net_2_0" targetFramework="3.5" ctype="DotNetProject"> | ||
300 | 2 | <Configurations active="Debug"> | ||
301 | 3 | <Configuration name="Debug" ctype="DotNetProjectConfiguration"> | ||
302 | 4 | <Output directory="bin/Debug" assemblyKeyFile="." assembly="ManLookUp" /> | ||
303 | 5 | <Build debugmode="True" target="Library" /> | ||
304 | 6 | <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" /> | ||
305 | 7 | <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> | ||
306 | 8 | </Configuration> | ||
307 | 9 | <Configuration name="Release" ctype="DotNetProjectConfiguration"> | ||
308 | 10 | <Output directory="bin/Release" assembly="ManLookUp" /> | ||
309 | 11 | <Build debugmode="False" target="Library" /> | ||
310 | 12 | <Execution runwithwarnings="True" consolepause="True" runtime="MsNet" clr-version="Net_2_0" /> | ||
311 | 13 | <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> | ||
312 | 14 | </Configuration> | ||
313 | 15 | </Configurations> | ||
314 | 16 | <Contents> | ||
315 | 17 | <File name="src" subtype="Directory" buildaction="Compile" /> | ||
316 | 18 | <File name="src/ReadManualPageAction.cs" subtype="Code" buildaction="Compile" /> | ||
317 | 19 | <File name="Resources/ManLookUp.addin.xml" subtype="Code" buildaction="EmbedAsResource" /> | ||
318 | 20 | </Contents> | ||
319 | 21 | <References> | ||
320 | 22 | <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | ||
321 | 23 | <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> | ||
322 | 24 | <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> | ||
323 | 25 | <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" /> | ||
324 | 26 | <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" /> | ||
325 | 27 | </References> | ||
326 | 28 | </Project> | ||
327 | 29 | \ No newline at end of file | 0 | \ No newline at end of file |
328 | 30 | 1 | ||
329 | === removed directory 'ManLookUp/Resources' | |||
330 | === removed file 'ManLookUp/Resources/ManLookUp.addin.xml.in' | |||
331 | --- ManLookUp/Resources/ManLookUp.addin.xml.in 2009-06-22 21:50:13 +0000 | |||
332 | +++ ManLookUp/Resources/ManLookUp.addin.xml.in 1970-01-01 00:00:00 +0000 | |||
333 | @@ -1,26 +0,0 @@ | |||
334 | 1 | <Addin | ||
335 | 2 | id="ManPages" | ||
336 | 3 | namespace="Do" | ||
337 | 4 | version="1.2" | ||
338 | 5 | name="Read Manual Pages (man)" | ||
339 | 6 | description="Search and view manual pages." | ||
340 | 7 | author="J. Carlos Navea" | ||
341 | 8 | category="Community" | ||
342 | 9 | defaultEnabled="false" | ||
343 | 10 | > | ||
344 | 11 | |||
345 | 12 | <Runtime> | ||
346 | 13 | <Import assembly="ManLookUp.dll"/> | ||
347 | 14 | </Runtime> | ||
348 | 15 | |||
349 | 16 | <Localizer type="Gettext" catalog="gnome-do-plugins" location="@expanded_datadir@/locale" /> | ||
350 | 17 | |||
351 | 18 | <Dependencies> | ||
352 | 19 | <Addin id="Universe" version="1.0" /> | ||
353 | 20 | </Dependencies> | ||
354 | 21 | |||
355 | 22 | <Extension path = "/Do/Action"> | ||
356 | 23 | <Action type="ManPages.ReadManualPageAction" /> | ||
357 | 24 | </Extension> | ||
358 | 25 | |||
359 | 26 | </Addin> | ||
360 | 27 | 0 | ||
361 | === removed directory 'ManLookUp/src' | |||
362 | === removed file 'ManLookUp/src/ReadManualPageAction.cs' | |||
363 | --- ManLookUp/src/ReadManualPageAction.cs 2009-06-22 04:05:16 +0000 | |||
364 | +++ ManLookUp/src/ReadManualPageAction.cs 1970-01-01 00:00:00 +0000 | |||
365 | @@ -1,96 +0,0 @@ | |||
366 | 1 | // ReadManualPageAction.cs | ||
367 | 2 | // | ||
368 | 3 | // J. Carlos Navea <loconet@gmail.com> | ||
369 | 4 | // | ||
370 | 5 | // This program is free software: you can redistribute it and/or modify | ||
371 | 6 | // it under the terms of the GNU General Public License as published by | ||
372 | 7 | // the Free Software Foundation, either version 3 of the License, or | ||
373 | 8 | // (at your option) any later version. | ||
374 | 9 | // | ||
375 | 10 | // This program is distributed in the hope that it will be useful, | ||
376 | 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
377 | 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
378 | 13 | // GNU General Public License for more details. | ||
379 | 14 | // | ||
380 | 15 | // You should have received a copy of the GNU General Public License | ||
381 | 16 | // along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
382 | 17 | // | ||
383 | 18 | |||
384 | 19 | using System; | ||
385 | 20 | using System.Linq; | ||
386 | 21 | using System.Diagnostics; | ||
387 | 22 | using System.Collections.Generic; | ||
388 | 23 | using System.Text.RegularExpressions; | ||
389 | 24 | |||
390 | 25 | using Mono.Addins; | ||
391 | 26 | |||
392 | 27 | using Do.Universe; | ||
393 | 28 | |||
394 | 29 | namespace ManPages { | ||
395 | 30 | |||
396 | 31 | /// <summary> | ||
397 | 32 | /// ReadManualPageAction - the main action for our plugin. | ||
398 | 33 | /// Allows us to hook up to Gnome-Do as a command | ||
399 | 34 | /// that can be applied to raw text or our own man page items. | ||
400 | 35 | /// </summary> | ||
401 | 36 | public class ReadManualPageAction : Act { | ||
402 | 37 | |||
403 | 38 | /// <value> | ||
404 | 39 | /// The name of the action | ||
405 | 40 | /// </value> | ||
406 | 41 | public override string Name { | ||
407 | 42 | get { return AddinManager.CurrentLocalizer.GetString ("Read manual page (man)"); } | ||
408 | 43 | } | ||
409 | 44 | |||
410 | 45 | /// <value> | ||
411 | 46 | /// Action's description | ||
412 | 47 | /// </value> | ||
413 | 48 | public override string Description { | ||
414 | 49 | get { return AddinManager.CurrentLocalizer.GetString ("Look up and read a manual page."); } | ||
415 | 50 | } | ||
416 | 51 | |||
417 | 52 | /// <value> | ||
418 | 53 | /// The pretty icon | ||
419 | 54 | /// </value> | ||
420 | 55 | public override string Icon { | ||
421 | 56 | get { return "applications-office"; } | ||
422 | 57 | } | ||
423 | 58 | |||
424 | 59 | /// <value> | ||
425 | 60 | /// List of supported items (ITextItem) | ||
426 | 61 | /// </value> | ||
427 | 62 | public override IEnumerable<Type> SupportedItemTypes { | ||
428 | 63 | get { | ||
429 | 64 | yield return typeof (ITextItem); | ||
430 | 65 | } | ||
431 | 66 | } | ||
432 | 67 | |||
433 | 68 | /// <summary> | ||
434 | 69 | /// Called by Gnome-Do in order to perform our action. | ||
435 | 70 | /// </summary> | ||
436 | 71 | /// <param name="items"> | ||
437 | 72 | /// List of <see cref="Item"/> objects, either raw text or custom look up items | ||
438 | 73 | /// </param> | ||
439 | 74 | /// <param name="modItems"> | ||
440 | 75 | /// List of <see cref="Item"/> objects, action modifiers | ||
441 | 76 | /// </param> | ||
442 | 77 | /// <returns> | ||
443 | 78 | /// List of <see cref="Item"/> | ||
444 | 79 | /// </returns> | ||
445 | 80 | public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems) | ||
446 | 81 | { | ||
447 | 82 | string keyword; | ||
448 | 83 | foreach (Item i in items) | ||
449 | 84 | { | ||
450 | 85 | keyword = (i as ITextItem).Text; | ||
451 | 86 | if (!string.IsNullOrEmpty (keyword)) { | ||
452 | 87 | Process term = new Process (); | ||
453 | 88 | term.StartInfo.FileName = "yelp"; | ||
454 | 89 | term.StartInfo.Arguments = " 'man:"+keyword+"' "; | ||
455 | 90 | term.Start (); | ||
456 | 91 | } | ||
457 | 92 | } | ||
458 | 93 | yield break; | ||
459 | 94 | } | ||
460 | 95 | } | ||
461 | 96 | } | ||
462 | 97 | 0 | ||
463 | === modified file 'configure.ac' | |||
464 | --- configure.ac 2009-11-08 23:58:01 +0000 | |||
465 | +++ configure.ac 2009-11-30 02:30:24 +0000 | |||
466 | @@ -304,6 +304,8 @@ | |||
467 | 304 | GoogleMaps/Resources/GoogleMaps.addin.xml | 304 | GoogleMaps/Resources/GoogleMaps.addin.xml |
468 | 305 | GoogleSearch/Makefile | 305 | GoogleSearch/Makefile |
469 | 306 | GoogleSearch/Resources/GoogleSearch.addin.xml | 306 | GoogleSearch/Resources/GoogleSearch.addin.xml |
470 | 307 | Help/Makefile | ||
471 | 308 | Help/Resources/Help.addin.xml | ||
472 | 307 | ImageShack/Makefile | 309 | ImageShack/Makefile |
473 | 308 | ImageShack/Resources/ImageShack.addin.xml | 310 | ImageShack/Resources/ImageShack.addin.xml |
474 | 309 | JIRA/Makefile | 311 | JIRA/Makefile |
475 | @@ -312,8 +314,6 @@ | |||
476 | 312 | Launchpad/Resources/Launchpad.addin.xml | 314 | Launchpad/Resources/Launchpad.addin.xml |
477 | 313 | LocateFiles/Makefile | 315 | LocateFiles/Makefile |
478 | 314 | LocateFiles/Resources/LocateFiles.addin.xml | 316 | LocateFiles/Resources/LocateFiles.addin.xml |
479 | 315 | ManLookUp/Makefile | ||
480 | 316 | ManLookUp/Resources/ManLookUp.addin.xml | ||
481 | 317 | Microblogging/Makefile | 317 | Microblogging/Makefile |
482 | 318 | Microblogging/Resources/Microblogging.addin.xml | 318 | Microblogging/Resources/Microblogging.addin.xml |
483 | 319 | MPD/Makefile | 319 | MPD/Makefile |
Added my plugin to search Gnome's Help and integrated ManLookUp into it.