[longomatch] Handle projects deletion from the UI
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Handle projects deletion from the UI
- Date: Sun, 18 Dec 2011 21:39:14 +0000 (UTC)
commit fe656c92b3de7e00dd5444d4fa424c5e59675b6d
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Sat Nov 5 17:24:53 2011 +0100
Handle projects deletion from the UI
LongoMatch.Core/Handlers/Handlers.cs | 1 +
LongoMatch.GUI/Gui/MainWindow.cs | 37 +++++++++-------------
LongoMatch.Services/Services/ProjectsManager.cs | 1 +
3 files changed, 17 insertions(+), 22 deletions(-)
---
diff --git a/LongoMatch.Core/Handlers/Handlers.cs b/LongoMatch.Core/Handlers/Handlers.cs
index 6f1b0f4..8122c55 100644
--- a/LongoMatch.Core/Handlers/Handlers.cs
+++ b/LongoMatch.Core/Handlers/Handlers.cs
@@ -49,6 +49,7 @@ namespace LongoMatch.Handlers
public delegate void SaveProjectHandler(Project project, ProjectType projectType);
public delegate void OpenedProjectChangedHandler(Project project, ProjectType projectType);
public delegate void OpenProjectHandler();
+ public delegate void CloseOpenendProjectHandler(bool save);
public delegate void NewProjectHandler();
public delegate void ImportProjectHandler();
public delegate void ExportProjectHandler();
diff --git a/LongoMatch.GUI/Gui/MainWindow.cs b/LongoMatch.GUI/Gui/MainWindow.cs
index 8ecd6f8..9a89fc5 100644
--- a/LongoMatch.GUI/Gui/MainWindow.cs
+++ b/LongoMatch.GUI/Gui/MainWindow.cs
@@ -70,6 +70,7 @@ namespace LongoMatch.Gui
public event SaveProjectHandler SaveProjectEvent;
public event NewProjectHandler NewProjectEvent;
public event OpenProjectHandler OpenProjectEvent;
+ public event CloseOpenendProjectHandler CloseOpenedProjectEvent;
public event ImportProjectHandler ImportProjectEvent;
public event ExportProjectHandler ExportProjectEvent;
@@ -300,26 +301,10 @@ namespace LongoMatch.Gui
capturer.Visible = false;;
EmitSaveProject();
} else if(projectType == ProjectType.FakeCaptureProject) {
- CloseOpenedProject(true);
+ EmitCloseOpenedProject(true);
}
}
- private void CloseOpenedProject(bool save) {
- /* FIXME
- * EmitCloseOpenedProject(save);
- */
- if(projectType != ProjectType.FileProject)
- capturer.Close();
- else
- player.Close();
-
- if(openedProject != null)
- openedProject.Clear();
- openedProject = null;
- projectType = ProjectType.None;
- ResetGUI();
- }
-
private void ResetGUI() {
bool playlistVisible = playlist.Visible;
Title = Constants.SOFTWARE_NAME;
@@ -384,7 +369,7 @@ namespace LongoMatch.Gui
res = md.Run();
md.Destroy();
if(res == (int)ResponseType.Ok) {
- CloseOpenedProject(true);
+ EmitCloseOpenedProject(true);
return true;
}
return false;
@@ -398,11 +383,11 @@ namespace LongoMatch.Gui
/* Close project wihtout saving */
if(res == (int)EndCaptureResponse.Quit) {
- CloseOpenedProject(false);
+ EmitCloseOpenedProject(false);
return true;
} else if(res == (int)EndCaptureResponse.Save) {
/* Close and save project */
- CloseOpenedProject(true);
+ EmitCloseOpenedProject(true);
return true;
} else
/* Continue with the current project */
@@ -507,7 +492,7 @@ namespace LongoMatch.Gui
{
MessagePopup.PopupMessage(this, MessageType.Info,
Catalog.GetString("The actual project will be closed due to an error in the media player:")+"\n" +args.Message);
- CloseOpenedProject(true);
+ EmitCloseOpenedProject(true);
}
protected override bool OnKeyPressEvent(EventKey evnt)
@@ -603,7 +588,7 @@ namespace LongoMatch.Gui
{
MessagePopup.PopupMessage(this, MessageType.Info,
Catalog.GetString("An error occured in the video capturer and the current project will be closed:")+"\n" +args.Message);
- CloseOpenedProject(true);
+ EmitCloseOpenedProject(true);
}
#endregion
@@ -687,6 +672,14 @@ namespace LongoMatch.Gui
if (NewProjectEvent != null)
NewProjectEvent();
}
+
+ private void EmitCloseOpenedProject(bool save) {
+ if (CloseOpenedProjectEvent != null)
+ CloseOpenedProjectEvent(save);
+ openedProject = null;
+ projectType = ProjectType.None;
+ ResetGUI();
+ }
private void EmitImportProject() {
if (ImportProjectEvent != null)
diff --git a/LongoMatch.Services/Services/ProjectsManager.cs b/LongoMatch.Services/Services/ProjectsManager.cs
index e8f0fa3..97e8662 100644
--- a/LongoMatch.Services/Services/ProjectsManager.cs
+++ b/LongoMatch.Services/Services/ProjectsManager.cs
@@ -54,6 +54,7 @@ namespace LongoMatch.Services
public void ConnectSignals() {
mainWindow.NewProjectEvent += NewProject;
mainWindow.OpenProjectEvent += OpenProject;
+ mainWindow.CloseOpenedProjectEvent += CloseOpenedProject;
mainWindow.SaveProjectEvent += SaveProject;
mainWindow.ImportProjectEvent += ImportProject;
mainWindow.ExportProjectEvent += ExportProject;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]