2
// AddinManagerDialog.cs
7
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
9
// Permission is hereby granted, free of charge, to any person obtaining
10
// a copy of this software and associated documentation files (the
11
// "Software"), to deal in the Software without restriction, including
12
// without limitation the rights to use, copy, modify, merge, publish,
13
// distribute, sublicense, and/or sell copies of the Software, and to
14
// permit persons to whom the Software is furnished to do so, subject to
15
// the following conditions:
17
// The above copyright notice and this permission notice shall be
18
// included in all copies or substantial portions of the Software.
20
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
using Mono.Addins.Setup;
34
namespace Mono.Addins.Gui
36
partial class AddinManagerDialog : Dialog, IDisposable
39
SetupService service = new SetupService ();
41
public AddinManagerDialog (Window parent)
44
TransientFor = parent;
45
imageInstall.Stock = "md-software-update";
46
imageInstall.IconSize = (int)IconSize.Dialog;
48
tree = new AddinTreeWidget (addinTree);
53
public override void Dispose ()
59
internal void OnSelectionChanged (object sender, EventArgs args)
64
internal void OnInstall (object sender, EventArgs e)
66
AddinInstallDialog dlg = new AddinInstallDialog (service);
75
internal void OnUpdate (object sender, EventArgs e)
79
internal void OnUninstall (object sender, EventArgs e)
81
AddinHeader info = (AddinHeader) tree.ActiveAddin;
82
AddinInstallDialog dlg = new AddinInstallDialog (service);
84
dlg.SetUninstallMode (info);
92
internal void OnEnable (object sender, EventArgs e)
95
Addin sinfo = (Addin) tree.ActiveAddinData;
101
catch (Exception ex) {
102
Services.ShowError (ex, null, this, true);
106
internal void OnDisable (object sender, EventArgs e)
109
Addin sinfo = (Addin) tree.ActiveAddinData;
112
sinfo.Enabled = false;
115
catch (Exception ex) {
116
Services.ShowError (ex, null, this, true);
120
internal void OnShowInfo (object sender, EventArgs e)
122
Addin sinfo = (Addin) tree.ActiveAddinData;
126
AddinInfoDialog dlg = new AddinInfoDialog (SetupService.GetAddinHeader (sinfo));
134
internal void OnManageRepos (object sender, EventArgs e)
136
ManageSitesDialog dlg = new ManageSitesDialog (service);
146
object s = tree.SaveStatus ();
149
foreach (Addin ainfo in AddinManager.Registry.GetAddins ()) {
150
if (Services.InApplicationNamespace (service, ainfo.Id))
151
tree.AddAddin (SetupService.GetAddinHeader (ainfo), ainfo, ainfo.Enabled, ainfo.IsUserAddin);
154
tree.RestoreStatus (s);
158
void UpdateButtons ()
160
Addin sinfo = (Addin) tree.ActiveAddinData;
162
btnEnable.Sensitive = false;
163
btnDisable.Sensitive = false;
164
btnUninstall.Sensitive = false;
165
btnInfo.Sensitive = false;
167
btnEnable.Sensitive = !sinfo.Enabled;
168
btnDisable.Sensitive = sinfo.Enabled;
169
btnUninstall.Sensitive = true;
170
btnInfo.Sensitive = true;