[longomatch] Prompt before quiting if we have pending rendering jobs
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Prompt before quiting if we have pending rendering jobs
- Date: Tue, 28 Oct 2014 09:55:58 +0000 (UTC)
commit dc5b5890d14de3daa923d98492ffd550e5294b01
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Oct 27 16:51:32 2014 +0100
Prompt before quiting if we have pending rendering jobs
.../Interfaces/IRenderingJobsManager.cs | 1 +
LongoMatch.Services/Services/CoreServices.cs | 13 ++++++++++++-
.../Services/RenderingJobsManager.cs | 6 ++++++
3 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/LongoMatch.Core/Interfaces/IRenderingJobsManager.cs
b/LongoMatch.Core/Interfaces/IRenderingJobsManager.cs
index 829f2b4..8a2bae5 100644
--- a/LongoMatch.Core/Interfaces/IRenderingJobsManager.cs
+++ b/LongoMatch.Core/Interfaces/IRenderingJobsManager.cs
@@ -32,6 +32,7 @@ namespace LongoMatch.Core.Interfaces
void CancelAllJobs();
void AddJob(Job job);
List<Job> Jobs {get;}
+ List<Job> PendingJobs {get;}
}
}
diff --git a/LongoMatch.Services/Services/CoreServices.cs b/LongoMatch.Services/Services/CoreServices.cs
index 79c6902..d8efd1a 100644
--- a/LongoMatch.Services/Services/CoreServices.cs
+++ b/LongoMatch.Services/Services/CoreServices.cs
@@ -78,7 +78,7 @@ namespace LongoMatch.Services
{
Config.MultimediaToolkit = multimediaToolkit;
Config.GUIToolkit = guiToolkit;
- Config.EventsBroker.QuitApplicationEvent += () => Config.GUIToolkit.Quit ();
+ Config.EventsBroker.QuitApplicationEvent += HandleQuitApplicationEvent;
StartServices (guiToolkit, multimediaToolkit);
}
@@ -183,5 +183,16 @@ namespace LongoMatch.Services
{
return !String.IsNullOrEmpty (Environment.GetEnvironmentVariable (env));
}
+
+ static void HandleQuitApplicationEvent ()
+ {
+ if (videoRenderer.PendingJobs.Count > 0) {
+ string msg = Catalog.GetString ("A rendering job is running in the
background. Do you really want to quit?");
+ if (!Config.GUIToolkit.QuestionMessage (msg, null)) {
+ return;
+ }
+ }
+ Config.GUIToolkit.Quit ();
+ }
}
}
diff --git a/LongoMatch.Services/Services/RenderingJobsManager.cs
b/LongoMatch.Services/Services/RenderingJobsManager.cs
index 686a724..a29ac63 100644
--- a/LongoMatch.Services/Services/RenderingJobsManager.cs
+++ b/LongoMatch.Services/Services/RenderingJobsManager.cs
@@ -62,6 +62,12 @@ namespace LongoMatch.Services
}
}
+ public List<Job> PendingJobs {
+ get {
+ return pendingJobs;
+ }
+ }
+
public void AddJob (Job job)
{
if (job == null)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]