Merge into trunk : plugin-manager-service : Code : Do

Do

Merge lp://staging/~alexlauni/do/plugin-manager-service into lp://staging/do

Proposed by Alex Launi
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~alexlauni/do/plugin-manager-service
Merge into: lp://staging/do
Diff against target: None lines
To merge this branch: bzr merge lp://staging/~alexlauni/do/plugin-manager-service
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Robert Dyer (community) Needs Information
Review via email: mp+7816@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Alex Launi (alexlauni) wrote :

Adds a service to allow interaction with the plugin manager. This again will be used with coming merges that the IStrict merge deals with. The ultimate goal is tighter integration Do with the host operating system.

Revision history for this message
Robert Dyer (psybers) wrote :

So why does PluginManager.GetAddins() return an IEnumerable and PluginManagerService.GetAddins() return an array? For consistency you should probably make them both return the same type (IEnumerable).

review: Needs Information
Revision history for this message
Alex Launi (alexlauni) wrote :

Initially IPluginManager was going to be exposed over DBus, which would
require an array, but I wanted to keep the lower level in the actual plugin
mananger consistent with the rest of Do so it was an IEnumerable. I scrapped
the DBus jawn but forgot to change the API. Pushed.

1252. By Alex Launi

Make API more consistent using IEnumerable everywhere instead of []

1253. By Alex Launi

merge trunk

1254. By Alex Launi

Refactor a little bit to keep PluginManager in charge of addins

1255. By Alex Launi

Use Addin.Enabled property instead of registry manager

1256. By Alex Launi

merge trunk

1257. By Alex Launi

merge

Revision history for this message
Jason Smith (jassmith) wrote :

Looks good with the changes made post request

review: Approve

Preview Diff

Failed to fetch available diffs.

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Do.Platform.Linux/Do.Platform.Linux.mdp'
2--- Do.Platform.Linux/Do.Platform.Linux.mdp 2009-06-19 07:41:21 +0000
3+++ Do.Platform.Linux/Do.Platform.Linux.mdp 2009-06-23 15:35:41 +0000
4@@ -71,5 +71,6 @@
5 <ProjectReference type="Gac" localcopy="True" refto="gnome-vfs-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
6 <ProjectReference type="Gac" localcopy="True" refto="gnome-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
7 <ProjectReference type="Gac" localcopy="True" refto="nunit.framework, Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
8+ <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
9 </References>
10 </Project>
11\ No newline at end of file
12
13=== modified file 'Do.Platform/Do.Platform.mdp'
14--- Do.Platform/Do.Platform.mdp 2009-06-10 05:30:30 +0000
15+++ Do.Platform/Do.Platform.mdp 2009-06-23 15:35:41 +0000
16@@ -79,16 +79,18 @@
17 <File name="src/Do.Platform/INetworkService.cs" subtype="Code" buildaction="Compile" />
18 <File name="src/Do.Platform/NetworkStateChangedEventArgs.cs" subtype="Code" buildaction="Compile" />
19 <File name="src/Do.Platform/Do.Platform.Default/NetworkService.cs" subtype="Code" buildaction="Compile" />
20+ <File name="src/Do.Platform/IPluginManagerService.cs" subtype="Code" buildaction="Compile" />
21+ <File name="src/Do.Platform/Do.Platform.Default/PluginManagerService.cs" subtype="Code" buildaction="Compile" />
22 </Contents>
23 <References>
24 <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
25 <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
26 <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
27- <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
28 <ProjectReference type="Project" localcopy="True" refto="Do.Universe" />
29 <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
30 <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
31 <ProjectReference type="Gac" localcopy="True" refto="gnome-vfs-sharp, Version=2.24.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
32 <ProjectReference type="Gac" localcopy="True" refto="nunit.framework, Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77" />
33+ <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
34 </References>
35 </Project>
36\ No newline at end of file
37
38=== modified file 'Do.Platform/Makefile.am'
39--- Do.Platform/Makefile.am 2009-06-10 05:30:30 +0000
40+++ Do.Platform/Makefile.am 2009-06-23 15:35:41 +0000
41@@ -21,6 +21,7 @@
42 src/Do.Platform/Do.Platform.Default/EnvironmentService.cs \
43 src/Do.Platform/Do.Platform.Default/LogService.cs \
44 src/Do.Platform/Do.Platform.Default/NotificationsService.cs \
45+ src/Do.Platform/Do.Platform.Default/PluginManagerService.cs \
46 src/Do.Platform/Do.Platform.Default/PreferencesService.cs \
47 src/Do.Platform/Do.Platform.Default/SecurePreferencesService.cs \
48 src/Do.Platform/Do.Platform.Default/UniverseFactoryService.cs \
49@@ -34,6 +35,7 @@
50 src/Do.Platform/IEnvironmentService.cs \
51 src/Do.Platform/ILogService.cs \
52 src/Do.Platform/INotificationsService.cs \
53+ src/Do.Platform/IPluginManagerService.cs \
54 src/Do.Platform/IPreferences.cs \
55 src/Do.Platform/IPreferencesService.cs \
56 src/Do.Platform/ISecurePreferencesService.cs \
57
58=== added file 'Do.Platform/src/Do.Platform/Do.Platform.Default/PluginManagerService.cs'
59--- Do.Platform/src/Do.Platform/Do.Platform.Default/PluginManagerService.cs 1970-01-01 00:00:00 +0000
60+++ Do.Platform/src/Do.Platform/Do.Platform.Default/PluginManagerService.cs 2009-06-23 16:25:39 +0000
61@@ -0,0 +1,44 @@
62+// PluginManagerService.cs
63+//
64+// GNOME Do is the legal property of its developers. Please refer to the
65+// COPYRIGHT file distributed with this source distribution.
66+//
67+// This program is free software: you can redistribute it and/or modify
68+// it under the terms of the GNU General Public License as published by
69+// the Free Software Foundation, either version 3 of the License, or
70+// (at your option) any later version.
71+//
72+// This program is distributed in the hope that it will be useful,
73+// but WITHOUT ANY WARRANTY; without even the implied warranty of
74+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
75+// GNU General Public License for more details.
76+//
77+// You should have received a copy of the GNU General Public License
78+// along with this program. If not, see <http://www.gnu.org/licenses/>.
79+
80+using System;
81+
82+using Mono.Addins;
83+
84+using Do.Platform.ServiceStack;
85+
86+namespace Do.Platform.Default
87+{
88+ /// <summary>
89+ /// If this class loads, we have a serious plugin because that probably means we have no plugin manager.
90+ /// </summary>
91+ public class PluginManagerService : IPluginManagerService
92+ {
93+ public Addin [] GetAddins ()
94+ {
95+ Log<PluginManagerService>.Error ("Using default service, could not locate any addins");
96+ return new Addin [] { };
97+ }
98+
99+ public void Install (Addin addin)
100+ {
101+ Log<PluginManagerService>.Error ("Using default service, could not install addin.");
102+ return;
103+ }
104+ }
105+}
106
107=== added file 'Do.Platform/src/Do.Platform/IPluginManagerService.cs'
108--- Do.Platform/src/Do.Platform/IPluginManagerService.cs 1970-01-01 00:00:00 +0000
109+++ Do.Platform/src/Do.Platform/IPluginManagerService.cs 2009-06-23 16:25:39 +0000
110@@ -0,0 +1,33 @@
111+// %filename
112+//
113+// GNOME Do is the legal property of its developers. Please refer to the
114+// COPYRIGHT file distributed with this source distribution.
115+//
116+// This program is free software: you can redistribute it and/or modify
117+// it under the terms of the GNU General Public License as published by
118+// the Free Software Foundation, either version 3 of the License, or
119+// (at your option) any later version.
120+//
121+// This program is distributed in the hope that it will be useful,
122+// but WITHOUT ANY WARRANTY; without even the implied warranty of
123+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
124+// GNU General Public License for more details.
125+//
126+// You should have received a copy of the GNU General Public License
127+// along with this program. If not, see <http://www.gnu.org/licenses/>.
128+
129+using System;
130+
131+using Mono.Addins;
132+
133+using Do.Platform.ServiceStack;
134+
135+namespace Do.Platform
136+{
137+
138+ public interface IPluginManagerService : IService
139+ {
140+ Addin [] GetAddins ();
141+ void Install (Addin addin);
142+ }
143+}
144
145=== modified file 'Do.Platform/src/Do.Platform/Services.cs'
146--- Do.Platform/src/Do.Platform/Services.cs 2009-06-10 05:30:30 +0000
147+++ Do.Platform/src/Do.Platform/Services.cs 2009-06-23 15:35:41 +0000
148@@ -35,15 +35,17 @@
149
150 static ICoreService core;
151 static PathsService paths;
152+ static INetworkService network;
153 static IWindowingService windowing;
154 static AbstractSystemService system;
155 static IEnumerable<ILogService> logs;
156 static PreferencesFactory preferences;
157- static AbstractApplicationService application;
158 static IEnvironmentService environment;
159 static INotificationsService notifications;
160+ static IPluginManagerService plugin_manager;
161+ static AbstractApplicationService application;
162 static IUniverseFactoryService universe_factory;
163- static INetworkService network;
164+
165
166 /// <summary>
167 /// Initializes the class. Must be called after Mono.Addins is initialized; if this is
168@@ -79,29 +81,29 @@
169 }
170
171 // Dirty the appropriate cache.
172+ if (service is ILogService)
173+ logs = null;
174 if (service is ICoreService)
175 core = null;
176- if (service is IEnvironmentService)
177- environment = null;
178+ if (service is PathsService)
179+ paths = null;
180+ if (service is INetworkService)
181+ network = null;
182+ if (service is IWindowingService)
183+ windowing = null;
184 // Although it is not obvious, this also takes care of the ISecurePreferences service.
185 if (service is IPreferencesService)
186 preferences = null;
187- if (service is ILogService)
188- logs = null;
189- if (service is IUniverseFactoryService)
190- universe_factory = null;
191+ if (service is IEnvironmentService)
192+ environment = null;
193+ if (service is AbstractSystemService)
194+ system = null;
195 if (service is INotificationsService)
196 notifications = null;
197- if (service is IWindowingService)
198- windowing = null;
199- if (service is PathsService)
200- paths = null;
201+ if (service is IUniverseFactoryService)
202+ universe_factory = null;
203 if (service is AbstractApplicationService)
204 application = null;
205- if (service is AbstractSystemService)
206- system = null;
207- if (service is INetworkService)
208- network = null;
209 }
210
211 /// <summary>
212@@ -185,7 +187,15 @@
213 network = LocateService<INetworkService, Default.NetworkService> ();
214 return network;
215 }
216- }
217+ }
218+
219+ public static IPluginManagerService PluginManager {
220+ get {
221+ if (plugin_manager == null)
222+ plugin_manager = LocateService<IPluginManagerService, Default.PluginManagerService> ();
223+ return plugin_manager;
224+ }
225+ }
226
227 public static PreferencesFactory Preferences {
228 get {
229
230=== modified file 'Do/Do.mdp'
231--- Do/Do.mdp 2009-06-17 01:44:57 +0000
232+++ Do/Do.mdp 2009-06-23 16:25:39 +0000
233@@ -89,13 +89,11 @@
234 <File name="src/Do.Core/Shortcut.cs" subtype="Code" buildaction="Compile" />
235 <File name="src/Do.Core/ShortcutCallback.cs" subtype="Code" buildaction="Compile" />
236 <File name="src/Do.Core/Do.Core.Addins/DockletAddinClassifier.cs" subtype="Code" buildaction="Compile" />
237+ <File name="src/Do.Platform/PluginManagerService.cs" subtype="Code" buildaction="Compile" />
238 </Contents>
239 <References>
240 <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
241 <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
242- <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.2.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
243- <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins.Gui, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
244- <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins.Setup, Version=0.3.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
245 <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
246 <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
247 <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
248@@ -107,6 +105,9 @@
249 <ProjectReference type="Gac" localcopy="True" refto="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
250 <ProjectReference type="Project" localcopy="True" refto="Do.Interface.Linux.AnimationBase" />
251 <ProjectReference type="Gac" localcopy="True" refto="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
252+ <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
253+ <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins.Gui, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
254+ <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins.Setup, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
255 </References>
256 <LanguageParameters ApplicationIcon="../../../../../jason/do/trunk-merge/Do" ctype="CSharpProjectParameters" />
257 <Deployment.LinuxDeployData scriptName="gnome-do" />
258
259=== modified file 'Do/Makefile.am'
260--- Do/Makefile.am 2009-06-17 01:44:57 +0000
261+++ Do/Makefile.am 2009-06-23 15:35:41 +0000
262@@ -41,6 +41,7 @@
263 src/Do.Platform/CoreService.cs \
264 src/Do.Platform/ApplicationService.cs \
265 src/Do.Platform/WindowingService.cs \
266+ src/Do.Platform/PluginManagerService.cs \
267 src/Do.UI/ColorConfigurationWidget.cs \
268 src/Do.UI/DoAddinInstallerDialog.cs \
269 src/Do.UI/GeneralPreferencesWidget.cs \
270
271=== modified file 'Do/Resources/Do.addin.xml'
272--- Do/Resources/Do.addin.xml 2009-01-15 07:05:51 +0000
273+++ Do/Resources/Do.addin.xml 2009-06-23 15:35:41 +0000
274@@ -11,8 +11,9 @@
275
276 <Extension path="/Do/Service">
277 <Service type="Do.Platform.CoreService" />
278+ <Service type="Do.Platform.WindowingService" />
279 <Service type="Do.Platform.ApplicationService" />
280- <Service type="Do.Platform.WindowingService" />
281+ <Service type="Do.Platform.PluginManagerService" />
282 </Extension>
283
284 <Extension path="/Do/ItemSource">
285
286=== modified file 'Do/gtk-gui/Do.UI.DoAddinInstallerDialog.cs'
287--- Do/gtk-gui/Do.UI.DoAddinInstallerDialog.cs 2009-05-27 14:56:37 +0000
288+++ Do/gtk-gui/Do.UI.DoAddinInstallerDialog.cs 2009-06-23 16:25:39 +0000
289@@ -122,7 +122,7 @@
290 w11.Spacing = 2;
291 // Container child GtkHBox1.Gtk.Container+ContainerChild
292 Gtk.Image w12 = new Gtk.Image();
293- w12.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-ok", Gtk.IconSize.Button, 16);
294+ w12.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-ok", Gtk.IconSize.Button, 20);
295 w11.Add(w12);
296 // Container child GtkHBox1.Gtk.Container+ContainerChild
297 Gtk.Label w14 = new Gtk.Label();
298
299=== modified file 'Do/gtk-gui/Do.UI.ManagePluginsPreferencesWidget.cs'
300--- Do/gtk-gui/Do.UI.ManagePluginsPreferencesWidget.cs 2009-05-27 14:56:37 +0000
301+++ Do/gtk-gui/Do.UI.ManagePluginsPreferencesWidget.cs 2009-06-23 16:25:39 +0000
302@@ -124,7 +124,7 @@
303 w9.Spacing = 2;
304 // Container child GtkHBox.Gtk.Container+ContainerChild
305 Gtk.Image w10 = new Gtk.Image();
306- w10.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-preferences", Gtk.IconSize.Button, 16);
307+ w10.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-preferences", Gtk.IconSize.Button, 20);
308 w9.Add(w10);
309 // Container child GtkHBox.Gtk.Container+ContainerChild
310 Gtk.Label w12 = new Gtk.Label();
311
312=== modified file 'Do/gtk-gui/gui.stetic'
313--- Do/gtk-gui/gui.stetic 2009-06-21 02:20:30 +0000
314+++ Do/gtk-gui/gui.stetic 2009-06-23 16:48:52 +0000
315@@ -5,10 +5,10 @@
316 <target-gtk-version>2.12</target-gtk-version>
317 </configuration>
318 <import>
319- <widget-library name="Mono.Addins.Gui, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
320 <widget-library name="../../Do.Platform.Linux/bin/Debug/Do.Platform.Linux.dll" />
321 <widget-library name="../../Do.Interface.Linux/bin/Debug/Do.Interface.Linux.dll" />
322 <widget-library name="../../Do.Interface.Linux.AnimationBase/bin/Debug/Do.Interface.Linux.AnimationBase.dll" />
323+ <widget-library name="Mono.Addins.Gui, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
324 <widget-library name="../bin/Debug/Do.exe" internal="true" />
325 </import>
326 <widget class="Gtk.Window" id="Do.UI.PreferencesWindow" design-size="450 470">
327
328=== modified file 'Do/src/Do.Core/PluginManager.cs'
329--- Do/src/Do.Core/PluginManager.cs 2009-06-05 19:45:45 +0000
330+++ Do/src/Do.Core/PluginManager.cs 2009-06-23 15:35:41 +0000
331@@ -42,7 +42,7 @@
332 /// <summary>
333 /// PluginManager serves as Do's primary interface to Mono.Addins.
334 /// </summary>
335- internal class PluginManager
336+ public class PluginManager
337 {
338 const string DefaultPluginIcon = "folder_tar";
339
340@@ -103,6 +103,11 @@
341 manual.ForEach (dll => File.Delete (dll));
342 }
343
344+ public static IEnumerable<Addin> GetAddins ()
345+ {
346+ return AddinManager.Registry.GetAddins ();
347+ }
348+
349 public static bool PluginClassifiesAs (AddinRepositoryEntry entry, string className)
350 {
351 AddinClassifier classifier = Classifiers.FirstOrDefault (c => c.Name == className);
352
353=== added file 'Do/src/Do.Platform/PluginManagerService.cs'
354--- Do/src/Do.Platform/PluginManagerService.cs 1970-01-01 00:00:00 +0000
355+++ Do/src/Do.Platform/PluginManagerService.cs 2009-06-23 16:48:52 +0000
356@@ -0,0 +1,45 @@
357+// PluginManagerService.cs
358+//
359+// GNOME Do is the legal property of its developers. Please refer to the
360+// COPYRIGHT file distributed with this source distribution.
361+//
362+// This program is free software: you can redistribute it and/or modify
363+// it under the terms of the GNU General Public License as published by
364+// the Free Software Foundation, either version 3 of the License, or
365+// (at your option) any later version.
366+//
367+// This program is distributed in the hope that it will be useful,
368+// but WITHOUT ANY WARRANTY; without even the implied warranty of
369+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
370+// GNU General Public License for more details.
371+//
372+// You should have received a copy of the GNU General Public License
373+// along with this program. If not, see <http://www.gnu.org/licenses/>.
374+
375+using System;
376+using System.Linq;
377+using System.Collections.Generic;
378+
379+using Mono.Addins;
380+
381+using Do.Core;
382+
383+namespace Do.Platform
384+{
385+
386+ public class PluginManagerService : IPluginManagerService
387+ {
388+#region IPluginManagerService Implementation
389+ public Addin [] GetAddins ()
390+ {
391+ return PluginManager.GetAddins ().ToArray ();
392+ }
393+
394+ public void Install (Addin addin)
395+ {
396+ addin.Enabled = true;
397+ Do.UniverseManager.Reload ();
398+ }
399+#endregion
400+ }
401+}