Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-addins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez Gual <lluis@novell.com>2011-04-12 22:46:34 +0400
committerLluis Sanchez Gual <lluis@novell.com>2011-04-12 22:46:34 +0400
commit7c29d40836322b1b8ef6a788cb35da5e250c9b29 (patch)
treed9267052ba2d1743fee633f00943b3bafcedced7 /Mono.Addins.Gui
parent2cdc12417d6518463a3a4d1005c42808c19409ba (diff)
Allow uninstalling several add-ins at once.
Diffstat (limited to 'Mono.Addins.Gui')
-rw-r--r--Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs21
1 files changed, 14 insertions, 7 deletions
diff --git a/Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs b/Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs
index 28eec25..a48b6c0 100644
--- a/Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs
+++ b/Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs
@@ -29,6 +29,8 @@ using Mono.Addins.Description;
using System.Text;
using Mono.Unix;
using System.Threading;
+using System.Linq;
+using System.Collections.Generic;
namespace Mono.Addins.Gui
{
@@ -39,7 +41,7 @@ namespace Mono.Addins.Gui
PackageCollection packagesToInstall;
SetupService service;
Gtk.ResponseType response = Gtk.ResponseType.None;
- string uninstallId;
+ IEnumerable<string> uninstallIds;
InstallMonitor installMonitor;
bool installing;
const int MaxHeight = 350;
@@ -71,19 +73,24 @@ namespace Mono.Addins.Gui
public void InitForUninstall (Addin[] info)
{
- this.uninstallId = info[0].Id;
+ this.uninstallIds = info.Select (a => a.Id);
buttonOk.Label = Catalog.GetString ("Uninstall");
+ HashSet<Addin> sinfos = new HashSet<Addin> ();
+
StringBuilder sb = new StringBuilder ();
sb.Append ("<b>").Append (Catalog.GetString ("The following packages will be uninstalled:")).Append ("</b>\n\n");
- sb.Append (info[0].Name + "\n\n");
+ foreach (var a in info) {
+ sb.Append (a.Name + "\n\n");
+ sinfos.UnionWith (service.GetDependentAddins (a.Id, true));
+ }
- Addin[] sinfos = service.GetDependentAddins (uninstallId, true);
- if (sinfos.Length > 0) {
+ if (sinfos.Count > 0) {
sb.Append ("<b>").Append (Catalog.GetString ("There are other add-ins that depend on the previous ones which will also be uninstalled:")).Append ("</b>\n\n");
foreach (Addin si in sinfos)
sb.Append (si.Description.Name + "\n");
}
+
ShowMessage (sb.ToString ());
Services.PlaceDialog (this, TransientFor);
}
@@ -198,7 +205,7 @@ namespace Mono.Addins.Gui
ThreadStart oper;
- if (uninstallId == null) {
+ if (uninstallIds == null) {
installMonitor = new InstallMonitor (globalProgressLabel, mainProgressBar, Catalog.GetString ("Installing Add-ins"));
oper = new ThreadStart (RunInstall);
errmessage = Catalog.GetString ("The installation failed!");
@@ -260,7 +267,7 @@ namespace Mono.Addins.Gui
void RunUninstall ()
{
try {
- service.Uninstall (installMonitor, uninstallId);
+ service.Uninstall (installMonitor, uninstallIds);
} catch (Exception ex) {
installMonitor.Errors.Add (ex.Message);
} finally {