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-13 13:00:29 +0400
committerLluis Sanchez Gual <lluis@novell.com>2011-04-13 13:00:29 +0400
commit640b9fec1915a553b57eb49cc1db4866f6e5d818 (patch)
tree97000a30510574cf1f3eadc8a28ebff5d7d105e6 /Mono.Addins.Gui
parent7c29d40836322b1b8ef6a788cb35da5e250c9b29 (diff)
Run the install operation in the GUI thread
Mono.Addins is not thread safe.
Diffstat (limited to 'Mono.Addins.Gui')
-rw-r--r--Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs5
-rw-r--r--Mono.Addins.Gui/Mono.Addins.Gui/InstallMonitor.cs11
2 files changed, 10 insertions, 6 deletions
diff --git a/Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs b/Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs
index a48b6c0..6c87f17 100644
--- a/Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs
+++ b/Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs
@@ -217,11 +217,8 @@ namespace Mono.Addins.Gui
warnmessage = Catalog.GetString ("The uninstallation has completed with warnings.");
}
- Thread t = new Thread (oper);
- t.Start ();
-
installing = true;
- installMonitor.WaitForCompleted ();
+ oper ();
installing = false;
buttonCancel.Visible = false;
diff --git a/Mono.Addins.Gui/Mono.Addins.Gui/InstallMonitor.cs b/Mono.Addins.Gui/Mono.Addins.Gui/InstallMonitor.cs
index 38d7de1..60f5949 100644
--- a/Mono.Addins.Gui/Mono.Addins.Gui/InstallMonitor.cs
+++ b/Mono.Addins.Gui/Mono.Addins.Gui/InstallMonitor.cs
@@ -61,12 +61,14 @@ namespace Mono.Addins.Gui
{
if (progressLabel != null)
progressLabel.Markup = "<b>" + GLib.Markup.EscapeText (mainOperation) + "</b>\n" + GLib.Markup.EscapeText (msg);
+ RunPendingEvents ();
}
public void SetProgress (double progress)
{
if (progressBar != null)
progressBar.Fraction = progress;
+ RunPendingEvents ();
}
public void Log (string msg)
@@ -113,8 +115,7 @@ namespace Mono.Addins.Gui
public void WaitForCompleted ()
{
while (!done) {
- while (Gtk.Application.EventsPending ())
- Gtk.Application.RunIteration ();
+ RunPendingEvents ();
Thread.Sleep (50);
}
}
@@ -122,5 +123,11 @@ namespace Mono.Addins.Gui
public bool Success {
get { return errors.Count == 0; }
}
+
+ void RunPendingEvents ()
+ {
+ while (Gtk.Application.EventsPending ())
+ Gtk.Application.RunIteration ();
+ }
}
}