[longomatch/gameunits] WIP



commit 5e38f2c1191ad1b16922aeee6b69b33df389e294
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Mon Dec 5 22:05:46 2011 +0100

    WIP

 LongoMatch.Core/Common/Enums.cs                    |    5 +
 LongoMatch.Core/Handlers/Multimedia.cs             |  105 ++++++++
 .../{IPlaylistWidget.cs => GUI/ICapturer.cs}       |   27 ++-
 LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs      |   66 +++++
 LongoMatch.Core/Interfaces/GUI/IMainWindow.cs      |   85 ++++++
 LongoMatch.Core/Interfaces/GUI/IPlayer.cs          |   73 ++++++
 .../Interfaces/{ => GUI}/IPlaylistWidget.cs        |    2 +-
 .../IRenderingStateBar.cs}                         |   17 +-
 .../Interfaces/IRenderingJobsManager.cs            |    2 +-
 LongoMatch.Core/Interfaces/ITemplates.cs           |    8 +
 LongoMatch.Core/Interfaces/ITemplatesService.cs    |    8 +-
 .../IMultimediaToolkit.cs}                         |   11 +-
 .../Interfaces/Multimedia}/IVideoEditor.cs         |    4 +-
 LongoMatch.Core/LongoMatch.Core.mdp                |   14 +-
 LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs       |   10 +-
 LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs         |   15 +-
 LongoMatch.GUI.Multimedia/Gui/VolumeWindow.cs      |    1 +
 LongoMatch.GUI/Gui/Component/PlayListWidget.cs     |    1 +
 .../Gui/Component/ProjectDetailsWidget.cs          |    4 +-
 LongoMatch.GUI/Gui/Component/RenderingStateBar.cs  |    4 +-
 .../Gui/Dialog/FramesCaptureProgressDialog.cs      |    2 +
 LongoMatch.GUI/Gui/Dialog/RenderingJobsDialog.cs   |    5 +-
 LongoMatch.GUI/Gui/GUIToolkit.cs                   |  274 ++++++++++++++++++++
 LongoMatch.GUI/Gui/MainWindow.cs                   |   21 +-
 LongoMatch.GUI/LongoMatch.GUI.mdp                  |    2 +
 .../gtk-gui/LongoMatch.Gui.MainWindow.cs           |    6 +-
 LongoMatch.GUI/gtk-gui/objects.xml                 |   60 +++---
 LongoMatch.Multimedia/Capturer/FakeCapturer.cs     |    1 +
 .../Capturer/GstCameraCapturer.cs                  |    1 +
 LongoMatch.Multimedia/Capturer/LiveSourceTimer.cs  |    1 +
 LongoMatch.Multimedia/Common/Enum.cs               |    4 -
 LongoMatch.Multimedia/Editor/GstVideoSplitter.cs   |    5 +-
 LongoMatch.Multimedia/Interfaces/ICapturer.cs      |    1 +
 LongoMatch.Multimedia/Interfaces/IPlayer.cs        |    2 +-
 LongoMatch.Multimedia/LongoMatch.Multimedia.mdp    |    4 +-
 LongoMatch.Multimedia/MultimediaFactory.cs         |   21 +-
 LongoMatch.Multimedia/Player/GstPlayer.cs          |    1 +
 LongoMatch.Multimedia/Utils/FramesCapturer.cs      |    4 +-
 LongoMatch.Multimedia/Utils/PreviewMediaFile.cs    |    4 +-
 LongoMatch.Services/LongoMatch.Services.mdp        |    8 +-
 LongoMatch.Services/Services/Core.cs               |   29 ++-
 LongoMatch.Services/Services/DataBase.cs           |    2 +-
 LongoMatch.Services/Services/EventsManager.cs      |   89 ++-----
 LongoMatch.Services/Services/GameUnitsManager.cs   |    8 +-
 LongoMatch.Services/Services/HotKeysManager.cs     |    6 +-
 LongoMatch.Services/Services/PlaylistManager.cs    |   69 ++---
 LongoMatch.Services/Services/ProjectsManager.cs    |  241 +++++-------------
 .../Services/RenderingJobsManager.cs               |   55 +---
 LongoMatch.Services/Services/TemplatesService.cs   |   21 +-
 .../Services/VideoDrawingsManager.cs               |   10 +-
 LongoMatch/Main.cs                                 |    5 +-
 51 files changed, 931 insertions(+), 493 deletions(-)
---
diff --git a/LongoMatch.Core/Common/Enums.cs b/LongoMatch.Core/Common/Enums.cs
index afaa61a..a45fe72 100644
--- a/LongoMatch.Core/Common/Enums.cs
+++ b/LongoMatch.Core/Common/Enums.cs
@@ -29,6 +29,11 @@ namespace LongoMatch.Common
 		EditProject,
 		None,
 	}
+	
+	public enum CapturerType {
+		Fake,
+		Live,
+	}
 
 	public enum EndCaptureResponse {
 		Return = 234,
diff --git a/LongoMatch.Core/Handlers/Multimedia.cs b/LongoMatch.Core/Handlers/Multimedia.cs
new file mode 100644
index 0000000..935cc66
--- /dev/null
+++ b/LongoMatch.Core/Handlers/Multimedia.cs
@@ -0,0 +1,105 @@
+//
+//  Copyright (C) 2010 Andoni Morales Alastruey
+//
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+
+using System;
+using Gdk;
+
+namespace LongoMatch.Handlers
+{
+	public delegate void PlayListSegmentDoneHandler();
+	public delegate void SegmentClosedHandler();
+	public delegate void SegmentDoneHandler();
+	public delegate void SeekEventHandler(long pos);
+	public delegate void VolumeChangedHandler(double level);
+	public delegate void NextButtonClickedHandler();
+	public delegate void PrevButtonClickedHandler();
+	public delegate void ProgressHandler(float progress);
+	public delegate void FramesProgressHandler(int actual, int total, Pixbuf frame);
+	public delegate void DrawFrameHandler(int time);
+	public delegate void EllpasedTimeHandler(int ellapsedTime);
+
+
+	public delegate void ErrorHandler(object o, ErrorArgs args);
+	public delegate void PercentCompletedHandler(object o, PercentCompletedArgs args);
+	public delegate void StateChangeHandler(object o, StateChangeArgs args);
+	public delegate void TickHandler(object o, TickArgs args);
+	public delegate void DeviceChangeHandler(object o, DeviceChangeArgs args);
+
+
+
+	public class ErrorArgs : GLib.SignalArgs {
+		public string Message {
+			get {
+				return (string) Args[0];
+			}
+		}
+
+	}
+
+	public class PercentCompletedArgs : GLib.SignalArgs {
+		public float Percent {
+			get {
+				return (float) Args[0];
+			}
+		}
+
+	}
+
+	public class StateChangeArgs : GLib.SignalArgs {
+		public bool Playing {
+			get {
+				return (bool) Args[0];
+			}
+		}
+	}
+
+	public class TickArgs : GLib.SignalArgs {
+		public long CurrentTime {
+			get {
+				return (long) Args[0];
+			}
+		}
+
+		public long StreamLength {
+			get {
+				return (long) Args[1];
+			}
+		}
+
+		public float CurrentPosition {
+			get {
+				return (float) Args[2];
+			}
+		}
+
+		public bool Seekable {
+			get {
+				return (bool) Args[3];
+			}
+		}
+	}
+
+	public class DeviceChangeArgs : GLib.SignalArgs {
+		public int DeviceChange {
+			get {
+				return (int) Args[0];
+			}
+		}
+
+	}
+}
diff --git a/LongoMatch.Core/Interfaces/IPlaylistWidget.cs b/LongoMatch.Core/Interfaces/GUI/ICapturer.cs
similarity index 63%
copy from LongoMatch.Core/Interfaces/IPlaylistWidget.cs
copy to LongoMatch.Core/Interfaces/GUI/ICapturer.cs
index 5a4051e..bc441ab 100644
--- a/LongoMatch.Core/Interfaces/IPlaylistWidget.cs
+++ b/LongoMatch.Core/Interfaces/GUI/ICapturer.cs
@@ -16,17 +16,30 @@
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 // 
 using System;
+using Gdk;
 
-using LongoMatch.Interfaces;
-using LongoMatch.Store;
+using LongoMatch.Common;
+using LongoMatch.Handlers;
 
-namespace LongoMatch.Interfaces
+namespace LongoMatch.Interfaces.GUI
 {
-	public interface IPlaylistWidget
+	public interface ICapturer
 	{
-		void Load(IPlayList playlist);
-		void Add(PlayListPlay playlistPlay);
-		void SetActivePlay (PlayListPlay playlistplay, int index);
+		event EventHandler CaptureFinished;
+		event ErrorHandler Error;
+		
+		CapturerType Type {set;}
+		string Logo {set;}
+		int CurrentTime {get;}
+		bool Capturing {get;}
+		CaptureSettings CaptureProperties {set;}
+		Pixbuf CurrentMiniatureFrame {get;}
+
+		void Start();
+		void TogglePause();
+		void Stop();
+		void Run();
+		void Close();
 	}
 }
 
diff --git a/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs b/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
new file mode 100644
index 0000000..19751b3
--- /dev/null
+++ b/LongoMatch.Core/Interfaces/GUI/IGUIToolkit.cs
@@ -0,0 +1,66 @@
+// 
+//  Copyright (C) 2011 Andoni Morales Alastruey
+// 
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//  GNU General Public License for more details.
+//  
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+// 
+using System;
+using System.Collections.Generic;
+using Gdk;
+
+using LongoMatch.Interfaces;
+using LongoMatch.Common;
+using LongoMatch.Store;
+using LongoMatch.Store.Templates;
+
+namespace LongoMatch.Interfaces.GUI
+{
+	public interface IGUIToolkit
+	{
+		IMainWindow MainWindow {get;}
+	
+		/* Messages */
+		void InfoMessage(string message);
+		void WarningMessage(string message);
+		void ErrorMessage(string message);
+		bool QuestionMessage(string message, string title);
+		
+		/* Files/Folders IO */
+		string SaveFile(string title, string defaultName, string defaultFolder,
+			string filterName, string extensionFilter);
+		string OpenFile(string title, string defaultName, string defaultFolder,
+			string filterName, string extensionFilter);
+		string SelectFolder(string title, string defaultName, string defaultFolder,
+			string filterName, string extensionFilter);
+			
+		Job ConfigureRenderingJob (IPlayList playlist);
+		void ExportFrameSeries(Project openenedProject, Play play, string snapshotDir);
+		
+		
+		ProjectDescription SelectProject(List<ProjectDescription> projects);
+		ProjectType SelectNewProjectType();
+		Project NewProject(IDatabase db, Project project, ProjectType type,
+			ITemplatesService tps, List<LongoMatch.Common.Device> devices);
+		
+		void OpenProjectsManager(Project openedProject, IDatabase db, ITemplatesService ts);
+		void OpenCategoriesTemplatesManager(ICategoriesTemplatesProvider tp);
+		void OpenTeamsTemplatesManager(ITeamTemplatesProvider tp);
+		
+		void ManageJobs(IRenderingJobsManager manager);
+		
+		void TagPlay(Play play, TeamTemplate local, TeamTemplate visitor);
+		void DrawingTool(Pixbuf pixbuf, Play play, int stopTime);
+	}
+}
+
diff --git a/LongoMatch.Core/Interfaces/GUI/IMainWindow.cs b/LongoMatch.Core/Interfaces/GUI/IMainWindow.cs
new file mode 100644
index 0000000..1ea84c9
--- /dev/null
+++ b/LongoMatch.Core/Interfaces/GUI/IMainWindow.cs
@@ -0,0 +1,85 @@
+// 
+//  Copyright (C) 2011 Andoni Morales Alastruey
+// 
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//  GNU General Public License for more details.
+//  
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+// 
+using System;
+using System.Collections.Generic;
+
+using LongoMatch.Handlers;
+using LongoMatch.Store;
+using LongoMatch.Store.Templates;
+
+namespace LongoMatch.Interfaces.GUI
+{
+	public interface IMainWindow
+	{	
+		/* Tags */
+		event NewTagHandler NewTagEvent;
+		event NewTagStartHandler NewTagStartEvent;
+		event NewTagStopHandler NewTagStopEvent;
+		event PlaySelectedHandler PlaySelectedEvent;
+		event NewTagAtFrameHandler NewTagAtFrameEvent;
+		event TagPlayHandler TagPlayEvent;
+		event PlaysDeletedHandler PlaysDeletedEvent;
+		event TimeNodeChangedHandler TimeNodeChanged;
+		
+		/* Playlist */
+		event RenderPlaylistHandler RenderPlaylistEvent;
+		event PlayListNodeAddedHandler PlayListNodeAddedEvent;
+		event PlayListNodeSelectedHandler PlayListNodeSelectedEvent;
+		event OpenPlaylistHandler OpenPlaylistEvent;
+		event NewPlaylistHandler NewPlaylistEvent;
+		event SavePlaylistHandler SavePlaylistEvent; 
+		
+		/* Snapshots */
+		event SnapshotSeriesHandler SnapshotSeriesEvent;
+		
+		/* Projects */
+		event SaveProjectHandler SaveProjectEvent;
+		event NewProjectHandler NewProjectEvent;
+		event OpenProjectHandler OpenProjectEvent;
+		event CloseOpenendProjectHandler CloseOpenedProjectEvent;
+		event ImportProjectHandler ImportProjectEvent;
+		event ExportProjectHandler ExportProjectEvent;
+		
+		/* Managers */
+		event ManageJobsHandler ManageJobsEvent; 
+		event ManageTeamsHandler ManageTeamsEvent;
+		event ManageCategoriesHandler ManageCategoriesEvent;
+		event ManageProjects ManageProjectsEvent;
+		event ApplyCurrentRateHandler ApplyRateEvent;
+		
+		/* Game Units events */
+		event GameUnitHandler GameUnitEvent;
+		event UnitChangedHandler UnitChanged;
+		event UnitSelectedHandler UnitSelected;
+		event UnitsDeletedHandler UnitDeleted;
+		event UnitAddedHandler UnitAdded;
+		
+		void AddPlay(Play play);
+		void UpdateSelectedPlay (Play play);
+		void UpdateCategories (Categories categories);
+		void DeletePlays (List<Play> plays);
+		void UpdateGameUnits (GameUnitsList gameUnits);
+		
+		IRenderingStateBar RenderingStateBar{get;}
+		IPlayer Player{get;}
+		ICapturer Capturer{get;}
+		IPlaylistWidget Playlist{get;}
+		
+	}
+}
+
diff --git a/LongoMatch.Core/Interfaces/GUI/IPlayer.cs b/LongoMatch.Core/Interfaces/GUI/IPlayer.cs
new file mode 100644
index 0000000..7807f56
--- /dev/null
+++ b/LongoMatch.Core/Interfaces/GUI/IPlayer.cs
@@ -0,0 +1,73 @@
+// 
+//  Copyright (C) 2011 Andoni Morales Alastruey
+// 
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//  GNU General Public License for more details.
+//  
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+// 
+using System;
+using Gdk;
+using LongoMatch.Handlers;
+
+namespace LongoMatch.Interfaces.GUI
+{
+	public interface IPlayer
+	{
+		event SegmentClosedHandler SegmentClosedEvent;
+		event TickHandler Tick;
+		event ErrorHandler Error;
+		event StateChangeHandler PlayStateChanged;
+		event NextButtonClickedHandler Next;
+		event PrevButtonClickedHandler Prev;
+		event DrawFrameHandler DrawFrame;
+		event SeekEventHandler SeekEvent;
+		
+		long AccurateCurrentTime {get;}
+		long CurrentTime {get;}
+		long StreamLength {get;}
+		Pixbuf CurrentMiniatureFrame {get;}
+		Pixbuf CurrentFrame {get;}
+		Pixbuf LogoPixbuf {set;}
+		Pixbuf DrawingPixbuf {set;}
+		bool DrawingMode {set;}
+		bool LogoMode {set;}
+		bool ExpandLogo {set; get;}
+		bool Opened {get;}
+		bool FullScreen {set;}
+		float Rate {get;set;}
+
+		void Open(string mrl);
+		void Play();
+		void Pause();
+		void TogglePlay();
+		void SetLogo(string filename);
+		void ResetGui();
+		void SetPlayListElement(string fileName,long start, long stop, float rate, bool hasNext);
+		void Close();
+		void SeekTo(long time, bool accurate);
+		void SeekInSegment(long pos);
+		void SeekToNextFrame(bool in_segment);
+		void SeekToPreviousFrame(bool in_segment);
+		void StepForward();
+		void StepBackward();
+		void FramerateUp();
+		void FramerateDown();
+		void UpdateSegmentStartTime(long start);
+		void UpdateSegmentStopTime(long stop);
+		void SetStartStop(long start, long stop);
+		void CloseActualSegment();
+		void SetSensitive();
+		void UnSensitive();
+	}
+}
+
diff --git a/LongoMatch.Core/Interfaces/IPlaylistWidget.cs b/LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs
similarity index 96%
copy from LongoMatch.Core/Interfaces/IPlaylistWidget.cs
copy to LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs
index 5a4051e..b6bb4fc 100644
--- a/LongoMatch.Core/Interfaces/IPlaylistWidget.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IPlaylistWidget.cs
@@ -20,7 +20,7 @@ using System;
 using LongoMatch.Interfaces;
 using LongoMatch.Store;
 
-namespace LongoMatch.Interfaces
+namespace LongoMatch.Interfaces.GUI
 {
 	public interface IPlaylistWidget
 	{
diff --git a/LongoMatch.Core/Interfaces/IPlaylistWidget.cs b/LongoMatch.Core/Interfaces/GUI/IRenderingStateBar.cs
similarity index 76%
copy from LongoMatch.Core/Interfaces/IPlaylistWidget.cs
copy to LongoMatch.Core/Interfaces/GUI/IRenderingStateBar.cs
index 5a4051e..23dcec3 100644
--- a/LongoMatch.Core/Interfaces/IPlaylistWidget.cs
+++ b/LongoMatch.Core/Interfaces/GUI/IRenderingStateBar.cs
@@ -17,16 +17,17 @@
 // 
 using System;
 
-using LongoMatch.Interfaces;
-using LongoMatch.Store;
-
-namespace LongoMatch.Interfaces
+namespace LongoMatch.Interfaces.GUI
 {
-	public interface IPlaylistWidget
+	public interface IRenderingStateBar
 	{
-		void Load(IPlayList playlist);
-		void Add(PlayListPlay playlistPlay);
-		void SetActivePlay (PlayListPlay playlistplay, int index);
+		event EventHandler Cancel;
+		event EventHandler ManageJobs;
+		
+		bool JobRunning {set;}
+		string Text {set;}
+		string ProgressText {set;}
+		double Fraction {set; get;}
 	}
 }
 
diff --git a/LongoMatch.Core/Interfaces/IRenderingJobsManager.cs b/LongoMatch.Core/Interfaces/IRenderingJobsManager.cs
index a365cbc..af3274b 100644
--- a/LongoMatch.Core/Interfaces/IRenderingJobsManager.cs
+++ b/LongoMatch.Core/Interfaces/IRenderingJobsManager.cs
@@ -32,7 +32,7 @@ namespace LongoMatch.Interfaces
 		void CancelJob(Job job);
 		void CancelAllJobs();
 		void AddJob(Job job);
-		TreeStore Model {get;}
+		List<Job> Jobs {get;}
 	}
 }
 
diff --git a/LongoMatch.Core/Interfaces/ITemplates.cs b/LongoMatch.Core/Interfaces/ITemplates.cs
index bf3524b..3f0780d 100644
--- a/LongoMatch.Core/Interfaces/ITemplates.cs
+++ b/LongoMatch.Core/Interfaces/ITemplates.cs
@@ -18,6 +18,7 @@
 using System;
 using System.Collections.Generic;
 using LongoMatch.Store;
+using LongoMatch.Store.Templates;
 	
 namespace LongoMatch.Interfaces
 {
@@ -56,5 +57,12 @@ namespace LongoMatch.Interfaces
 		bool CanExport {get; set;}
 		Project Project {get; set;}
 	}
+	
+	public interface ICategoriesTemplatesProvider: ITemplateProvider<Categories, Category> {}
+	public interface ITeamTemplatesProvider: ITemplateProvider<TeamTemplate, Player> {}
+	public interface ISubcategoriesTemplatesProvider: ITemplateProvider<SubCategoryTemplate, string> {} 
+	
+	public interface ICategoriesTemplatesEditor: ITemplateWidget<Categories, Category> {}
+	public interface ITeamTemplatesEditor: ITemplateWidget<TeamTemplate, Player> {}
 }
 
diff --git a/LongoMatch.Core/Interfaces/ITemplatesService.cs b/LongoMatch.Core/Interfaces/ITemplatesService.cs
index aa1d61a..0dbf170 100644
--- a/LongoMatch.Core/Interfaces/ITemplatesService.cs
+++ b/LongoMatch.Core/Interfaces/ITemplatesService.cs
@@ -26,13 +26,11 @@ namespace LongoMatch.Interfaces
 	{
 		ITemplateProvider<T, U> GetTemplateProvider<T, U>() where T: ITemplate<U>;
 		
-		ITemplateWidget<T, U> GetTemplateEditor<T, U>() where T: ITemplate<U>;
+		ISubcategoriesTemplatesProvider SubCategoriesTemplateProvider {get;}
 		
-		ITemplateProvider<SubCategoryTemplate, string> SubCategoriesTemplateProvider {get;}
+		ITeamTemplatesProvider TeamTemplateProvider {get;}
 		
-		ITemplateProvider<TeamTemplate, Player> TeamTemplateProvider {get;}
-
-		ITemplateProvider<Categories, Category> CategoriesTemplateProvider {get;}
+		ICategoriesTemplatesProvider CategoriesTemplateProvider {get;}
 		
 		List<PlayerSubCategory> PlayerSubcategories {get;}
 		
diff --git a/LongoMatch.Core/Interfaces/IPlaylistWidget.cs b/LongoMatch.Core/Interfaces/Multimedia/IMultimediaToolkit.cs
similarity index 78%
rename from LongoMatch.Core/Interfaces/IPlaylistWidget.cs
rename to LongoMatch.Core/Interfaces/Multimedia/IMultimediaToolkit.cs
index 5a4051e..b42ec50 100644
--- a/LongoMatch.Core/Interfaces/IPlaylistWidget.cs
+++ b/LongoMatch.Core/Interfaces/Multimedia/IMultimediaToolkit.cs
@@ -17,16 +17,15 @@
 // 
 using System;
 
-using LongoMatch.Interfaces;
 using LongoMatch.Store;
 
-namespace LongoMatch.Interfaces
+namespace LongoMatch.Interfaces.Multimedia
 {
-	public interface IPlaylistWidget
+	public interface IMultimediaToolkit
 	{
-		void Load(IPlayList playlist);
-		void Add(PlayListPlay playlistPlay);
-		void SetActivePlay (PlayListPlay playlistplay, int index);
+		IVideoEditor GetVideoEditor();
+		
+		MediaFile DiscoverFile(string path);
 	}
 }
 
diff --git a/LongoMatch.Multimedia/Interfaces/IVideoEditor.cs b/LongoMatch.Core/Interfaces/Multimedia/IVideoEditor.cs
similarity index 94%
rename from LongoMatch.Multimedia/Interfaces/IVideoEditor.cs
rename to LongoMatch.Core/Interfaces/Multimedia/IVideoEditor.cs
index dc0e5f3..f57f507 100644
--- a/LongoMatch.Multimedia/Interfaces/IVideoEditor.cs
+++ b/LongoMatch.Core/Interfaces/Multimedia/IVideoEditor.cs
@@ -21,9 +21,9 @@
 using System;
 using System.Collections.Generic;
 using LongoMatch.Common;
-using LongoMatch.Video.Common;
+using LongoMatch.Handlers;
 
-namespace LongoMatch.Multimedia.Interfaces
+namespace LongoMatch.Interfaces.Multimedia
 {
 
 	public interface IVideoEditor
diff --git a/LongoMatch.Core/LongoMatch.Core.mdp b/LongoMatch.Core/LongoMatch.Core.mdp
index 6536d9c..4bd0158 100644
--- a/LongoMatch.Core/LongoMatch.Core.mdp
+++ b/LongoMatch.Core/LongoMatch.Core.mdp
@@ -69,11 +69,23 @@
     <File subtype="Code" buildaction="Compile" name="Config.cs" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/ITemplatesService.cs" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/IDatabase.cs" />
-    <File subtype="Code" buildaction="Compile" name="Interfaces/IPlaylistWidget.cs" />
     <File subtype="Code" buildaction="Compile" name="Store/GameUnit.cs" />
     <File subtype="Code" buildaction="Compile" name="Store/GameUnitsList.cs" />
     <File subtype="Code" buildaction="Compile" name="Store/TimelineNode.cs" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/ITimelineNode.cs" />
+    <File subtype="Directory" buildaction="Compile" name="Interfaces/GUI" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IRenderingStateBar.cs" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IPlayer.cs" />
+    <File subtype="Code" buildaction="Compile" name="Handlers/Multimedia.cs" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IMainWindow.cs" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/ICapturer.cs" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IPlaylistWidget.cs" />
+    <File subtype="Directory" buildaction="Compile" name="Interfaces" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/GUI/IGUIToolkit.cs" />
+    <File subtype="Directory" buildaction="Compile" name="Interfaces/Multimedia" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/Multimedia/IMultimediaToolkit.cs" />
+    <File subtype="Code" buildaction="Compile" name="Interfaces/Multimedia/IVideoEditor.cs" />
+    <File subtype="Directory" buildaction="Compile" name="Interfaces" />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
diff --git a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
index 7db84e3..f96d188 100644
--- a/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/CapturerBin.cs
@@ -21,8 +21,10 @@
 using System;
 using Gtk;
 using Gdk;
+
 using LongoMatch.Common;
-using LongoMatch.Multimedia.Interfaces;
+using LongoMatch.Handlers;
+using LongoMatch.Interfaces.GUI;
 using LongoMatch.Video;
 using LongoMatch.Video.Common;
 using LongoMatch.Video.Capturer;
@@ -35,7 +37,7 @@ namespace LongoMatch.Gui
 
 	[System.ComponentModel.Category("CesarPlayer")]
 	[System.ComponentModel.ToolboxItem(true)]
-	public partial class CapturerBin : Gtk.Bin
+	public partial class CapturerBin : Gtk.Bin, ICapturer
 	{
 		public event EventHandler CaptureFinished;
 		public event ErrorHandler Error;
@@ -47,7 +49,7 @@ namespace LongoMatch.Gui
 		private bool capturing;
 		private const int THUMBNAIL_MAX_WIDTH = 100;
 
-		ICapturer capturer;
+		LongoMatch.Multimedia.Interfaces.ICapturer capturer;
 
 		public CapturerBin()
 		{
@@ -62,7 +64,7 @@ namespace LongoMatch.Gui
 				Close();
 
 				MultimediaFactory factory = new MultimediaFactory();
-				capturer = factory.getCapturer(value);
+				capturer = factory.GetCapturer(value);
 				capturer.EllapsedTime += OnTick;
 				if(value != CapturerType.Fake) {
 					capturer.Error += OnError;
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index 7f98fbe..9bc2176 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -22,6 +22,9 @@ using Gtk;
 using Gdk;
 using Mono.Unix;
 using System.Runtime.InteropServices;
+
+using LongoMatch.Handlers;
+using LongoMatch.Interfaces.GUI;
 using LongoMatch.Multimedia.Interfaces;
 using LongoMatch.Video;
 using LongoMatch.Video.Common;
@@ -33,7 +36,7 @@ namespace LongoMatch.Gui
 	[System.ComponentModel.Category("LongoMatch")]
 	[System.ComponentModel.ToolboxItem(true)]
 
-	public partial class PlayerBin : Gtk.Bin
+	public partial class PlayerBin : Gtk.Bin, LongoMatch.Interfaces.GUI.IPlayer
 	{
 
 		public event SegmentClosedHandler SegmentClosedEvent;
@@ -47,7 +50,7 @@ namespace LongoMatch.Gui
 
 		private const int THUMBNAIL_MAX_WIDTH = 100;
 		private TickHandler tickHandler;
-		private IPlayer player;
+		private LongoMatch.Multimedia.Interfaces.IPlayer player;
 		private long length=0;
 		private string slength;
 		private long segmentStartTime;
@@ -91,12 +94,6 @@ namespace LongoMatch.Gui
 
 		#region Properties
 
-		public IPlayer Player {
-			get {
-				return player;
-			}
-		}
-
 		public long AccurateCurrentTime {
 			get {
 				return player.AccurateCurrentTime;
@@ -385,7 +382,7 @@ namespace LongoMatch.Gui
 			Widget playerWidget;
 
 			factory= new MultimediaFactory();
-			player = factory.getPlayer(320,280);
+			player = factory.GetPlayer(320,280);
 
 			tickHandler = new TickHandler(OnTick);
 			player.Tick += tickHandler;
diff --git a/LongoMatch.GUI.Multimedia/Gui/VolumeWindow.cs b/LongoMatch.GUI.Multimedia/Gui/VolumeWindow.cs
index c2bbe4e..6f83f90 100644
--- a/LongoMatch.GUI.Multimedia/Gui/VolumeWindow.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/VolumeWindow.cs
@@ -19,6 +19,7 @@
 //
 using System;
 using LongoMatch.Video.Common;
+using LongoMatch.Handlers;
 
 namespace LongoMatch.Gui
 {
diff --git a/LongoMatch.GUI/Gui/Component/PlayListWidget.cs b/LongoMatch.GUI/Gui/Component/PlayListWidget.cs
index 1e48f75..0c1cf3a 100644
--- a/LongoMatch.GUI/Gui/Component/PlayListWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/PlayListWidget.cs
@@ -24,6 +24,7 @@ using LongoMatch.Common;
 using LongoMatch.Handlers;
 using LongoMatch.Store;
 using LongoMatch.Interfaces;
+using LongoMatch.Interfaces.GUI;
 
 
 namespace LongoMatch.Gui.Component
diff --git a/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs b/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
index 696a146..d510b24 100644
--- a/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
+++ b/LongoMatch.GUI/Gui/Component/ProjectDetailsWidget.cs
@@ -81,8 +81,8 @@ namespace LongoMatch.Gui.Component
 			set {
 				tpc = value.CategoriesTemplateProvider;
 				tpt = value.TeamTemplateProvider;
-				twc = value.GetTemplateEditor<Categories, Category> ();
-				twt = value.GetTemplateEditor<TeamTemplate, Player>();
+				twc = new CategoriesTemplateEditorWidget(tpc);
+				twt = new TeamTemplateEditorWidget(tpt);
 				FillCategories();
 				FillTeamsTemplate();
 			}
diff --git a/LongoMatch.GUI/Gui/Component/RenderingStateBar.cs b/LongoMatch.GUI/Gui/Component/RenderingStateBar.cs
index 06db51d..7ba426a 100644
--- a/LongoMatch.GUI/Gui/Component/RenderingStateBar.cs
+++ b/LongoMatch.GUI/Gui/Component/RenderingStateBar.cs
@@ -16,10 +16,12 @@
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 // 
 using System;
+using LongoMatch.Interfaces.GUI;
+
 namespace LongoMatch.Gui.Component
 {
 	[System.ComponentModel.ToolboxItem(true)]
-	public partial class RenderingStateBar : Gtk.Bin
+	public partial class RenderingStateBar : Gtk.Bin, IRenderingStateBar
 	{
 		public event EventHandler Cancel;
 		public event EventHandler ManageJobs;
diff --git a/LongoMatch.GUI/Gui/Dialog/FramesCaptureProgressDialog.cs b/LongoMatch.GUI/Gui/Dialog/FramesCaptureProgressDialog.cs
index 6a630a2..8fb573a 100644
--- a/LongoMatch.GUI/Gui/Dialog/FramesCaptureProgressDialog.cs
+++ b/LongoMatch.GUI/Gui/Dialog/FramesCaptureProgressDialog.cs
@@ -22,6 +22,8 @@ using System;
 using Gtk;
 using Gdk;
 using Mono.Unix;
+
+using LongoMatch.Handlers;
 using LongoMatch.Video.Utils;
 using LongoMatch.Video.Common;
 
diff --git a/LongoMatch.GUI/Gui/Dialog/RenderingJobsDialog.cs b/LongoMatch.GUI/Gui/Dialog/RenderingJobsDialog.cs
index 8b9eb33..f081ee0 100644
--- a/LongoMatch.GUI/Gui/Dialog/RenderingJobsDialog.cs
+++ b/LongoMatch.GUI/Gui/Dialog/RenderingJobsDialog.cs
@@ -42,7 +42,10 @@ namespace LongoMatch.Gui.Dialog
 		}
 		
 		private void UpdateModel() {
-			model = manager.Model;
+			TreeStore model = new TreeStore(typeof(Job));
+			
+			foreach (Job job in manager.Jobs)
+				model.AppendValues(job);
 			renderingjobstreeview2.Model = model;
 			QueueDraw();
 		}
diff --git a/LongoMatch.GUI/Gui/GUIToolkit.cs b/LongoMatch.GUI/Gui/GUIToolkit.cs
new file mode 100644
index 0000000..ee7dc9c
--- /dev/null
+++ b/LongoMatch.GUI/Gui/GUIToolkit.cs
@@ -0,0 +1,274 @@
+// 
+//  Copyright (C) 2011 Andoni Morales Alastruey
+// 
+//  This program is free software; you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation; either version 2 of the License, or
+//  (at your option) any later version.
+// 
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+//  GNU General Public License for more details.
+//  
+//  You should have received a copy of the GNU General Public License
+//  along with this program; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+// 
+using System;
+using System.Collections.Generic;
+using Gtk;
+using Gdk;
+using Mono.Unix;
+
+using LongoMatch.Common;
+using LongoMatch.Interfaces;
+using LongoMatch.Interfaces.GUI;
+using LongoMatch.Gui.Component;
+using LongoMatch.Gui.Dialog;
+using LongoMatch.Gui.Popup;
+using LongoMatch.Store;
+using LongoMatch.Store.Templates;
+using LongoMatch.Video.Utils;
+
+namespace LongoMatch.Gui
+{
+	public class GUIToolkit: IGUIToolkit
+	{
+		IMainWindow mainWindow;
+		
+		public GUIToolkit ()
+		{
+			mainWindow = new MainWindow();
+		}
+		
+		public IMainWindow MainWindow{
+			get {
+				return mainWindow;
+			}
+		}
+		
+		public void InfoMessage(string message) {
+			MessagePopup.PopupMessage(mainWindow as Gtk.Widget, Gtk.MessageType.Info, message);
+		}
+		
+		public void ErrorMessage(string message) {
+			MessagePopup.PopupMessage(mainWindow as Gtk.Widget, Gtk.MessageType.Error, message);
+		}
+		
+		public void WarningMessage(string message) {
+			MessagePopup.PopupMessage(mainWindow as Gtk.Widget, Gtk.MessageType.Warning, message);
+		}
+		
+		public bool QuestionMessage(string question, string title) {
+			MessageDialog md = new MessageDialog(mainWindow as Gtk.Window, DialogFlags.Modal,
+				MessageType.Question, Gtk.ButtonsType.YesNo, question);
+			md.Icon = Gtk.IconTheme.Default.LoadIcon("longomatch", 48, 0);
+			var res = md.Run();
+			md.Destroy();
+			return (res == (int)ResponseType.Yes);
+		}
+		
+		public string SaveFile(string title, string defaultName, string defaultFolder,
+			string filterName, string extensionFilter)
+		{
+			return FileChooser(title, defaultName, defaultFolder, filterName,
+				extensionFilter, FileChooserAction.Save);
+		}
+		
+		public string SelectFolder(string title, string defaultName, string defaultFolder,
+			string filterName, string extensionFilter)
+		{
+			return FileChooser(title, defaultName, defaultFolder, filterName,
+				extensionFilter, FileChooserAction.SelectFolder);
+		}
+		
+		public string OpenFile(string title, string defaultName, string defaultFolder,
+			string filterName, string extensionFilter)
+		{
+			return FileChooser(title, defaultName, defaultFolder, filterName,
+				extensionFilter, FileChooserAction.Open);
+		}
+		
+		public Job ConfigureRenderingJob (IPlayList playlist)
+		{
+			VideoEditionProperties vep;
+			Job job = null;
+			int response;
+
+			vep = new VideoEditionProperties();
+			vep.TransientFor = mainWindow as Gtk.Window;
+			response = vep.Run();
+			while(response == (int)ResponseType.Ok && vep.EncodingSettings.OutputFile == "") {
+				WarningMessage(Catalog.GetString("Please, select a video file."));
+				response=vep.Run();
+			}
+			if(response ==(int)ResponseType.Ok)
+				job = new Job(playlist, vep.EncodingSettings, vep.EnableAudio, vep.TitleOverlay);
+			vep.Destroy();
+			return job;
+		}
+		
+		public void ExportFrameSeries(Project openedProject, Play play, string snapshotsDir) {
+			SnapshotsDialog sd;
+			uint interval;
+			string seriesName;
+			string outDir;
+
+
+			sd= new SnapshotsDialog();
+			sd.TransientFor= mainWindow as Gtk.Window;
+			sd.Play = play.Name;
+
+			if(sd.Run() == (int)ResponseType.Ok) {
+				sd.Destroy();
+				interval = sd.Interval;
+				seriesName = sd.SeriesName;
+				outDir = System.IO.Path.Combine(snapshotsDir, seriesName);
+				var fsc = new FramesSeriesCapturer(openedProject.Description.File.FilePath,
+				                               play.Start.MSeconds, play.Stop.MSeconds,
+				                               interval, outDir);
+				var fcpd = new FramesCaptureProgressDialog(fsc);
+				fcpd.TransientFor = mainWindow as Gtk.Window;
+				fcpd.Run();
+				fcpd.Destroy();
+			}
+			else
+				sd.Destroy();
+		}
+		
+		public void TagPlay (Play play, TeamTemplate local, TeamTemplate visitor) {
+			TaggerDialog tg = new TaggerDialog(play.Category, play.Tags, play.Players, play.Teams,
+			                                   local, visitor);
+			tg.TransientFor = mainWindow as Gtk.Window;
+			tg.Run();
+			tg.Destroy();
+		}
+
+		public void DrawingTool (Pixbuf pixbuf, Play play, int stopTime) {
+			DrawingTool dialog = new DrawingTool();
+
+			dialog.Image = pixbuf;
+			if (play != null)
+				dialog.SetPlay(play, stopTime);
+			dialog.TransientFor = mainWindow as Gtk.Window;
+			pixbuf.Dispose();
+			dialog.Run();
+			dialog.Destroy();	
+		}
+		
+		public ProjectDescription SelectProject(List<ProjectDescription> projects) {
+			ProjectDescription project = null;
+			OpenProjectDialog opd = new OpenProjectDialog();
+			
+			opd.Fill(projects);	
+			opd.TransientFor = mainWindow as Gtk.Window;
+			if(opd.Run() == (int)ResponseType.Ok)
+				project = opd.SelectedProject;
+			opd.Destroy();
+			return project;
+		}
+		
+		public void OpenCategoriesTemplatesManager(ICategoriesTemplatesProvider tp)
+		{
+			var tManager = new TemplatesManager<Categories, Category> (tp, new CategoriesTemplateEditorWidget (tp));
+			tManager.TransientFor = mainWindow as Gtk.Window;
+			tManager.Show();
+		}
+
+		public void OpenTeamsTemplatesManager(ITeamTemplatesProvider tp)
+		{
+			var tManager = new TemplatesManager<TeamTemplate, Player>(tp, new TeamTemplateEditorWidget (tp));
+			tManager.TransientFor = mainWindow as Gtk.Window;
+			tManager.Show();
+		}
+		
+		public void OpenProjectsManager(Project openedProject, IDatabase db, ITemplatesService ts)
+		{
+			Gui.Dialog.ProjectsManager pm = new Gui.Dialog.ProjectsManager(openedProject, db, ts);
+			pm.TransientFor = mainWindow as Gtk.Window;
+			pm.Show();
+		}
+		
+		public void ManageJobs(IRenderingJobsManager manager) {
+			RenderingJobsDialog dialog = new RenderingJobsDialog(manager);
+			dialog.TransientFor = mainWindow as Gtk.Window;
+			dialog.Run();
+			dialog.Destroy();
+		}
+		
+		public ProjectType SelectNewProjectType () {
+			ProjectType projectType = ProjectType.None;
+			ProjectSelectionDialog psd;
+			int response;
+
+			psd = new ProjectSelectionDialog();
+			psd.TransientFor = mainWindow;
+			response = psd.Run();
+			psd.Destroy();
+			if(response != (int)ResponseType.Ok)
+				return;
+			return psd.ProjectType;
+		}
+		
+		public Project NewProject(IDatabase db, Project project, ProjectType type,
+			ITemplatesService tps, List<Device> devices)
+		{
+			NewProjectDialog npd = new NewProjectDialog();
+			
+			npd.TransientFor = mainWindow as Gtk.Window;
+			npd.Use = type;
+			npd.Project = project;
+			if(projectType == ProjectType.CaptureProject)
+				npd.Devices = devices;
+			npd.TemplatesService = tps;
+			int response = npd.Run();
+			while(true) {
+				if(response != (int)ResponseType.Ok) {
+					break;
+				} else if(npd.Project == null) {
+					InfoMessage(Catalog.GetString("Please, select a video file."));
+					response=npd.Run();
+				} else {
+					project = npd.Project;
+					break;
+				}
+			}	
+			npd.Destroy();
+			return project;
+		}
+		
+		private string  FileChooser(string title, string defaultName,
+			string defaultFolder, string filterName, string extensionFilter,
+			FileChooserAction action)
+		{
+			FileChooserDialog fChooser;
+			FileFilter filter;
+			string button, path;
+			
+			if (action == FileChooserAction.Save)
+				button = "gtk-save";
+			else
+				button = "gtk-open";
+			
+			fChooser = new FileChooserDialog(title, mainWindow as Gtk.Window, action,
+			                                 "gtk-cancel",ResponseType.Cancel,
+			                                 button,ResponseType.Accept);
+			fChooser.SetCurrentFolder(defaultFolder);
+			fChooser.SetFilename(defaultName);
+			filter = new FileFilter();
+			filter.Name = filterName;
+			filter.AddPattern(extensionFilter);
+			fChooser.AddFilter(filter);	
+			
+			if (fChooser.Run() != (int)ResponseType.Accept) 
+				path = null;
+			else
+				path = fChooser.Filename;
+			
+			fChooser.Destroy();
+			return path;
+		}
+	}
+}
+
diff --git a/LongoMatch.GUI/Gui/MainWindow.cs b/LongoMatch.GUI/Gui/MainWindow.cs
index 05665ea..2d8a3bf 100644
--- a/LongoMatch.GUI/Gui/MainWindow.cs
+++ b/LongoMatch.GUI/Gui/MainWindow.cs
@@ -24,25 +24,24 @@ using System.IO;
 using Gdk;
 using GLib;
 using Gtk;
+using Mono.Unix;
+
 using LongoMatch.Common;
 using LongoMatch.Gui.Dialog;
 using LongoMatch.Handlers;
 using LongoMatch.Interfaces;
+using LongoMatch.Interfaces.GUI;
 using LongoMatch.Store;
 using LongoMatch.Store.Templates;
 using LongoMatch.Video.Common;
-
-using Mono.Unix;
 using LongoMatch.Gui.Component;
-using LongoMatch.Multimedia.Interfaces;
-
 
 
 namespace LongoMatch.Gui
 {
 	[System.ComponentModel.Category("LongoMatch")]
 	[System.ComponentModel.ToolboxItem(false)]
-	public partial class MainWindow : Gtk.Window
+	public partial class MainWindow : Gtk.Window, IMainWindow
 	{
 	
 		/* Tags */
@@ -154,25 +153,25 @@ namespace LongoMatch.Gui
 			timeline.QueueDraw();
 		}
 		
-		public RenderingStateBar RenderingStateBar{
+		public IRenderingStateBar RenderingStateBar{
 			get {
 				return renderingstatebar1;
 			}
 		}
 		
-		public PlayerBin Player{
+		public IPlayer Player{
 			get {
 				return player;
 			}
 		}
 		
-		public CapturerBin Capturer{
+		public ICapturer Capturer{
 			get {
 				return capturer;
 			}
 		}
 		
-		public PlayListWidget Playlist{
+		public IPlaylistWidget Playlist{
 			get {
 				return playlist;
 			}
@@ -535,7 +534,7 @@ namespace LongoMatch.Gui
 		}
 		#endregion
 
-		protected virtual void OnPlayerbin1Error(object o, LongoMatch.Video.Common.ErrorArgs args)
+		protected virtual void OnPlayerbin1Error(object o, ErrorArgs args)
 		{
 			MessagePopup.PopupMessage(this, MessageType.Info,
 			                          Catalog.GetString("The actual project will be closed due to an error in the media player:")+"\n" +args.Message);
@@ -632,7 +631,7 @@ namespace LongoMatch.Gui
 			return true;
 		}
 
-		protected virtual void OnCapturerBinError(object o, LongoMatch.Video.Common.ErrorArgs args)
+		protected virtual void OnCapturerBinError(object o, ErrorArgs args)
 		{
 			MessagePopup.PopupMessage(this, MessageType.Info,
 			                          Catalog.GetString("An error occured in the video capturer and the current project will be closed:")+"\n" +args.Message);
diff --git a/LongoMatch.GUI/LongoMatch.GUI.mdp b/LongoMatch.GUI/LongoMatch.GUI.mdp
index d1bdea3..86d3e0c 100644
--- a/LongoMatch.GUI/LongoMatch.GUI.mdp
+++ b/LongoMatch.GUI/LongoMatch.GUI.mdp
@@ -148,6 +148,8 @@
     <File subtype="Code" buildaction="Compile" name="Gui/Base/TimelineWidgetBase.cs" />
     <File subtype="Code" buildaction="Compile" name="gtk-gui/LongoMatch.Gui.Base.TimelineWidgetBase.cs" />
     <File subtype="Code" buildaction="Compile" name="Gui/Component/GameUnitsTimelineWidget.cs" />
+    <File subtype="Code" buildaction="Compile" name="Gui/GUIToolkit.cs" />
+    <File subtype="Directory" buildaction="Compile" name="." />
   </Contents>
   <References>
     <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
diff --git a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs
index d0a68c2..9a3a604 100644
--- a/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs
+++ b/LongoMatch.GUI/gtk-gui/LongoMatch.Gui.MainWindow.cs
@@ -387,9 +387,9 @@ namespace LongoMatch.Gui
 			this.ManualTaggingViewAction.Toggled += new global::System.EventHandler (this.OnViewToggled);
 			this.GameUnitsViewAction.Toggled += new global::System.EventHandler (this.OnViewToggled);
 			this.playsList.TimeNodeSelected += new global::LongoMatch.Handlers.PlaySelectedHandler (this.OnTimeNodeSelected);
-			this.player.Error += new global::LongoMatch.Video.Common.ErrorHandler (this.OnPlayerbin1Error);
-			this.player.SegmentClosedEvent += new global::LongoMatch.Video.Common.SegmentClosedHandler (this.OnSegmentClosedEvent);
-			this.capturer.Error += new global::LongoMatch.Video.Common.ErrorHandler (this.OnCapturerBinError);
+			this.player.Error += new global::LongoMatch.Handlers.ErrorHandler (this.OnPlayerbin1Error);
+			this.player.SegmentClosedEvent += new global::LongoMatch.Handlers.SegmentClosedHandler (this.OnSegmentClosedEvent);
+			this.capturer.Error += new global::LongoMatch.Handlers.ErrorHandler (this.OnCapturerBinError);
 		}
 	}
 }
diff --git a/LongoMatch.GUI/gtk-gui/objects.xml b/LongoMatch.GUI/gtk-gui/objects.xml
index 0f73630..34addeb 100644
--- a/LongoMatch.GUI/gtk-gui/objects.xml
+++ b/LongoMatch.GUI/gtk-gui/objects.xml
@@ -139,19 +139,6 @@
     <itemgroups />
     <signals />
   </object>
-  <object type="LongoMatch.Gui.Component.RenderingStateBar" palette-category="General" allow-children="false" base-type="Gtk.Bin">
-    <itemgroups>
-      <itemgroup label="RenderingStateBar Properties">
-        <property name="Fraction" />
-      </itemgroup>
-    </itemgroups>
-    <signals>
-      <itemgroup label="RenderingStateBar Signals">
-        <signal name="Cancel" />
-        <signal name="ManageJobs" />
-      </itemgroup>
-    </signals>
-  </object>
   <object type="LongoMatch.Gui.Component.CategoryProperties" palette-category="LongoMatch" allow-children="false" base-type="Gtk.Bin">
     <itemgroups />
     <signals>
@@ -195,23 +182,6 @@
       </itemgroup>
     </signals>
   </object>
-  <object type="LongoMatch.Gui.Component.ProjectDetailsWidget" palette-category="LongoMatch" allow-children="false" base-type="Gtk.Bin">
-    <itemgroups>
-      <itemgroup label="ProjectDetailsWidget Properties">
-        <property name="Edited" />
-        <property name="Season" />
-        <property name="Competition" />
-        <property name="LocalGoals" />
-        <property name="VisitorGoals" />
-        <property name="Date" />
-      </itemgroup>
-    </itemgroups>
-    <signals>
-      <itemgroup label="ProjectDetailsWidget Signals">
-        <signal name="EditedEvent" />
-      </itemgroup>
-    </signals>
-  </object>
   <object type="LongoMatch.Gui.Component.GameUnitsEditor" palette-category="General" allow-children="false" base-type="Gtk.Bin">
     <itemgroups />
     <signals />
@@ -344,4 +314,34 @@
       </itemgroup>
     </signals>
   </object>
+  <object type="LongoMatch.Gui.Component.RenderingStateBar" palette-category="General" allow-children="false" base-type="Gtk.Bin">
+    <itemgroups>
+      <itemgroup label="RenderingStateBar Properties">
+        <property name="Fraction" />
+      </itemgroup>
+    </itemgroups>
+    <signals>
+      <itemgroup label="RenderingStateBar Signals">
+        <signal name="Cancel" />
+        <signal name="ManageJobs" />
+      </itemgroup>
+    </signals>
+  </object>
+  <object type="LongoMatch.Gui.Component.ProjectDetailsWidget" palette-category="LongoMatch" allow-children="false" base-type="Gtk.Bin">
+    <itemgroups>
+      <itemgroup label="ProjectDetailsWidget Properties">
+        <property name="Edited" />
+        <property name="Season" />
+        <property name="Competition" />
+        <property name="LocalGoals" />
+        <property name="VisitorGoals" />
+        <property name="Date" />
+      </itemgroup>
+    </itemgroups>
+    <signals>
+      <itemgroup label="ProjectDetailsWidget Signals">
+        <signal name="EditedEvent" />
+      </itemgroup>
+    </signals>
+  </object>
 </objects>
\ No newline at end of file
diff --git a/LongoMatch.Multimedia/Capturer/FakeCapturer.cs b/LongoMatch.Multimedia/Capturer/FakeCapturer.cs
index 8ad8563..0fbf432 100644
--- a/LongoMatch.Multimedia/Capturer/FakeCapturer.cs
+++ b/LongoMatch.Multimedia/Capturer/FakeCapturer.cs
@@ -19,6 +19,7 @@
 using System;
 using Mono.Unix;
 using GLib;
+using LongoMatch.Handlers;
 using LongoMatch.Common;
 using LongoMatch.Multimedia.Interfaces;
 using LongoMatch.Video.Common;
diff --git a/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs b/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs
index 2e29521..fb68fbd 100644
--- a/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs
+++ b/LongoMatch.Multimedia/Capturer/GstCameraCapturer.cs
@@ -24,6 +24,7 @@ namespace LongoMatch.Video.Capturer {
 	using System.Runtime.InteropServices;
 	using Mono.Unix;
 	
+	using LongoMatch.Handlers;
 	using LongoMatch.Common;
 	using LongoMatch.Multimedia.Interfaces;
 	using LongoMatch.Video.Common;
diff --git a/LongoMatch.Multimedia/Capturer/LiveSourceTimer.cs b/LongoMatch.Multimedia/Capturer/LiveSourceTimer.cs
index 3ff3ac2..5feced0 100644
--- a/LongoMatch.Multimedia/Capturer/LiveSourceTimer.cs
+++ b/LongoMatch.Multimedia/Capturer/LiveSourceTimer.cs
@@ -17,6 +17,7 @@
 //
 
 using System;
+using LongoMatch.Handlers;
 using LongoMatch.Video.Common;
 
 
diff --git a/LongoMatch.Multimedia/Common/Enum.cs b/LongoMatch.Multimedia/Common/Enum.cs
index 8e86481..a4ab87f 100644
--- a/LongoMatch.Multimedia/Common/Enum.cs
+++ b/LongoMatch.Multimedia/Common/Enum.cs
@@ -47,10 +47,6 @@ namespace LongoMatch.Video.Common
 		EmptyFile,
 	}
 
-	public enum CapturerType {
-		Fake,
-		Live,
-	}
 
 	public enum VideoQuality {
 		Low = 1000,
diff --git a/LongoMatch.Multimedia/Editor/GstVideoSplitter.cs b/LongoMatch.Multimedia/Editor/GstVideoSplitter.cs
index 1be6ac1..147445f 100644
--- a/LongoMatch.Multimedia/Editor/GstVideoSplitter.cs
+++ b/LongoMatch.Multimedia/Editor/GstVideoSplitter.cs
@@ -23,8 +23,11 @@ namespace LongoMatch.Video.Editor {
 	using System;
 	using System.Collections;
 	using System.Runtime.InteropServices;
+	
+	using LongoMatch.Interfaces;
+	using LongoMatch.Handlers;
 	using LongoMatch.Common;
-	using LongoMatch.Multimedia.Interfaces;
+	using LongoMatch.Interfaces.Multimedia;
 	using LongoMatch.Video.Common;
 
 
diff --git a/LongoMatch.Multimedia/Interfaces/ICapturer.cs b/LongoMatch.Multimedia/Interfaces/ICapturer.cs
index 62b4a9f..e0ee01f 100644
--- a/LongoMatch.Multimedia/Interfaces/ICapturer.cs
+++ b/LongoMatch.Multimedia/Interfaces/ICapturer.cs
@@ -19,6 +19,7 @@
 //
 
 using System;
+using LongoMatch.Handlers;
 using LongoMatch.Common;
 using LongoMatch.Video.Common;
 using Gdk;
diff --git a/LongoMatch.Multimedia/Interfaces/IPlayer.cs b/LongoMatch.Multimedia/Interfaces/IPlayer.cs
index 43b2ab6..a99969c 100644
--- a/LongoMatch.Multimedia/Interfaces/IPlayer.cs
+++ b/LongoMatch.Multimedia/Interfaces/IPlayer.cs
@@ -21,7 +21,7 @@
 using System;
 using Gtk;
 using Gdk;
-using LongoMatch.Video.Common;
+using LongoMatch.Handlers;
 
 
 namespace LongoMatch.Multimedia.Interfaces
diff --git a/LongoMatch.Multimedia/LongoMatch.Multimedia.mdp b/LongoMatch.Multimedia/LongoMatch.Multimedia.mdp
index e7708e0..616bab7 100644
--- a/LongoMatch.Multimedia/LongoMatch.Multimedia.mdp
+++ b/LongoMatch.Multimedia/LongoMatch.Multimedia.mdp
@@ -21,7 +21,6 @@
     <File subtype="Code" buildaction="Compile" name="Editor/VideoSegment.cs" />
     <File subtype="Code" buildaction="Compile" name="Common/Constants.cs" />
     <File subtype="Code" buildaction="Compile" name="Common/Enum.cs" />
-    <File subtype="Code" buildaction="Compile" name="Common/Handlers.cs" />
     <File subtype="Directory" buildaction="Compile" name="Capturer" />
     <File subtype="Code" buildaction="Compile" name="Capturer/ObjectManager.cs" />
     <File subtype="Code" buildaction="Compile" name="Capturer/FakeCapturer.cs" />
@@ -52,9 +51,10 @@
     <File subtype="Code" buildaction="Compile" name="Interfaces/ICapturer.cs" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/IFramesCapturer.cs" />
     <File subtype="Code" buildaction="Compile" name="Interfaces/IPlayer.cs" />
-    <File subtype="Code" buildaction="Compile" name="Interfaces/IVideoEditor.cs" />
     <File subtype="Code" buildaction="Compile" name="Utils/VideoDevice.cs" />
     <File subtype="Code" buildaction="Compile" name="Utils/GStreamer.cs" />
+    <File subtype="Directory" buildaction="Compile" name="Interfaces" />
+    <File subtype="Directory" buildaction="Compile" name="Interfaces" />
   </Contents>
   <References>
     <ProjectReference type="Project" localcopy="True" refto="libcesarplayer" />
diff --git a/LongoMatch.Multimedia/MultimediaFactory.cs b/LongoMatch.Multimedia/MultimediaFactory.cs
index 9b34c69..1705e59 100644
--- a/LongoMatch.Multimedia/MultimediaFactory.cs
+++ b/LongoMatch.Multimedia/MultimediaFactory.cs
@@ -21,7 +21,10 @@
 using System;
 using System.Runtime.InteropServices;
 
+using LongoMatch.Common;
+using LongoMatch.Interfaces.Multimedia;
 using LongoMatch.Multimedia.Interfaces;
+using LongoMatch.Store;
 using LongoMatch.Video.Capturer;
 using LongoMatch.Video.Player;
 using LongoMatch.Video.Editor;
@@ -32,7 +35,7 @@ namespace LongoMatch.Video
 {
 
 
-	public class MultimediaFactory
+	public class MultimediaFactory: IMultimediaToolkit
 	{
 
 		OperatingSystem oS;
@@ -42,7 +45,7 @@ namespace LongoMatch.Video
 			oS = Environment.OSVersion;
 		}
 
-		public IPlayer getPlayer(int width, int height) {
+		public IPlayer GetPlayer(int width, int height) {
 			switch(oS.Platform) {
 			case PlatformID.Unix:
 				return new GstPlayer(width,height,PlayerUseType.Video);
@@ -55,7 +58,7 @@ namespace LongoMatch.Video
 			}
 		}
 
-		public IMetadataReader getMetadataReader() {
+		public IMetadataReader GetMetadataReader() {
 
 			switch(oS.Platform) {
 			case PlatformID.Unix:
@@ -69,7 +72,7 @@ namespace LongoMatch.Video
 			}
 		}
 
-		public IFramesCapturer getFramesCapturer() {
+		public IFramesCapturer GetFramesCapturer() {
 			switch(oS.Platform) {
 			case PlatformID.Unix:
 				return new GstPlayer(1,1,PlayerUseType.Capture);
@@ -82,7 +85,7 @@ namespace LongoMatch.Video
 			}
 		}
 
-		public IVideoEditor getVideoEditor() {
+		public IVideoEditor GetVideoEditor() {
 			switch(oS.Platform) {
 			case PlatformID.Unix:
 				return new GstVideoSplitter();
@@ -95,7 +98,7 @@ namespace LongoMatch.Video
 			}
 		}
 
-		public ICapturer getCapturer(CapturerType type) {
+		public ICapturer GetCapturer(CapturerType type) {
 			switch(type) {
 			case CapturerType.Fake:
 				return new FakeCapturer();
@@ -107,7 +110,11 @@ namespace LongoMatch.Video
 				return new FakeCapturer();
 			}
 		}
-
+		
+		public MediaFile DiscoverFile (string file) {
+			return PreviewMediaFile.DiscoverFile(file);
+		}	
+		
 		[DllImport("libcesarplayer.dll")]
 		static extern void gst_init (int argc, string argv);
 		public static void InitBackend() {
diff --git a/LongoMatch.Multimedia/Player/GstPlayer.cs b/LongoMatch.Multimedia/Player/GstPlayer.cs
index 2774461..9abe14e 100644
--- a/LongoMatch.Multimedia/Player/GstPlayer.cs
+++ b/LongoMatch.Multimedia/Player/GstPlayer.cs
@@ -22,6 +22,7 @@ namespace LongoMatch.Video.Player {
 	using System.Collections;
 	using System.Runtime.InteropServices;
 	using LongoMatch.Multimedia.Interfaces;
+	using LongoMatch.Handlers;
 	using LongoMatch.Video.Common;
 	using LongoMatch.Video.Utils;
 
diff --git a/LongoMatch.Multimedia/Utils/FramesCapturer.cs b/LongoMatch.Multimedia/Utils/FramesCapturer.cs
index 47018b4..5962d6f 100644
--- a/LongoMatch.Multimedia/Utils/FramesCapturer.cs
+++ b/LongoMatch.Multimedia/Utils/FramesCapturer.cs
@@ -24,6 +24,8 @@ using LongoMatch.Video;
 using Gdk;
 using Gtk;
 using System.Threading;
+
+using LongoMatch.Handlers;
 using LongoMatch.Multimedia.Interfaces;
 using LongoMatch.Video.Common;
 
@@ -49,7 +51,7 @@ namespace LongoMatch.Video.Utils
 		public FramesSeriesCapturer(string videoFile,long start, long stop, uint interval, string outputDir)
 		{
 			MultimediaFactory mf= new MultimediaFactory();
-			this.capturer=mf.getFramesCapturer();
+			this.capturer=mf.GetFramesCapturer();
 			this.capturer.Open(videoFile);
 			this.start= start;
 			this.stop = stop;
diff --git a/LongoMatch.Multimedia/Utils/PreviewMediaFile.cs b/LongoMatch.Multimedia/Utils/PreviewMediaFile.cs
index 6015449..63cc362 100644
--- a/LongoMatch.Multimedia/Utils/PreviewMediaFile.cs
+++ b/LongoMatch.Multimedia/Utils/PreviewMediaFile.cs
@@ -51,7 +51,7 @@ namespace LongoMatch.Video.Utils
 
 			try {
 				factory =  new MultimediaFactory();
-				reader = factory.getMetadataReader();
+				reader = factory.GetMetadataReader();
 				reader.Open(filePath);
 				hasVideo = (bool) reader.GetMetadata(MetadataType.HasVideo);
 				hasAudio = (bool) reader.GetMetadata(MetadataType.HasAudio);
@@ -61,7 +61,7 @@ namespace LongoMatch.Video.Utils
 				if(hasVideo) {
 					VideoEncoderType = (string) reader.GetMetadata(MetadataType.VideoEncoderType);
 					fps = (int) reader.GetMetadata(MetadataType.Fps);
-					thumbnailer = factory.getFramesCapturer();
+					thumbnailer = factory.GetFramesCapturer();
 					thumbnailer.Open(filePath);
 					thumbnailer.SeekTime(1000,false);
 					preview = thumbnailer.GetCurrentFrame(THUMBNAIL_MAX_WIDTH,THUMBNAIL_MAX_HEIGHT);
diff --git a/LongoMatch.Services/LongoMatch.Services.mdp b/LongoMatch.Services/LongoMatch.Services.mdp
index dd92d8c..2e678bb 100644
--- a/LongoMatch.Services/LongoMatch.Services.mdp
+++ b/LongoMatch.Services/LongoMatch.Services.mdp
@@ -29,14 +29,10 @@
     <File subtype="Directory" buildaction="Compile" name="." />
   </Contents>
   <References>
-    <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
-    <ProjectReference type="Project" localcopy="True" refto="LongoMatch.GUI" />
-    <ProjectReference type="Gac" localcopy="True" refto="Db4objects.Db4o, Version=7.4.121.14026, Culture=neutral, PublicKeyToken=6199cd4f203aa8eb" />
-    <ProjectReference type="Project" localcopy="True" refto="LongoMatch.Multimedia" />
-    <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
-    <ProjectReference type="Project" localcopy="True" refto="LongoMatch.GUI.Multimedia" />
     <ProjectReference type="Gac" localcopy="True" refto="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
     <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
     <ProjectReference type="Project" localcopy="True" refto="LongoMatch.Core" />
+    <ProjectReference type="Gac" localcopy="True" refto="Db4objects.Db4o, Version=8.0.184.15484, Culture=neutral, PublicKeyToken=6199cd4f203aa8eb" />
+    <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
   </References>
 </Project>
\ No newline at end of file
diff --git a/LongoMatch.Services/Services/Core.cs b/LongoMatch.Services/Services/Core.cs
index e93b4de..a4b0741 100644
--- a/LongoMatch.Services/Services/Core.cs
+++ b/LongoMatch.Services/Services/Core.cs
@@ -17,10 +17,9 @@
 // 
 using System;
 using System.IO;
-using Gtk;
 using Mono.Unix;
 
-using LongoMatch.Gui;
+using LongoMatch.Interfaces.GUI;
 using LongoMatch.DB;
 using LongoMatch.Common;
 using LongoMatch.Store;
@@ -34,7 +33,8 @@ namespace LongoMatch.Services
 		static EventsManager eManager;
 		static HotKeysManager hkManager;
 		static GameUnitsManager guManager;
-		static MainWindow mainWindow;
+		static IMainWindow mainWindow;
+		static IGUIToolkit guiToolkit;
 
 		public static void Init()
 		{
@@ -53,13 +53,14 @@ namespace LongoMatch.Services
 			CheckDirs();
 		}
 
-		public static void Start(MainWindow mainWindow) {
-			Core.mainWindow = mainWindow;
-			StartServices(mainWindow);
-			BindEvents(mainWindow);
+		public static void Start(IGUIToolkit guiToolkit) {
+			Core.guiToolkit = guiToolkit;
+			Core.mainWindow = guiToolkit.MainWindow;
+			StartServices(Core.mainWindow);
+			BindEvents(Core.mainWindow);
 		}
 		
-		public static void StartServices(MainWindow mainWindow){
+		public static void StartServices(IMainWindow mainWindow){
 			RenderingJobsManager videoRenderer;
 			ProjectsManager projectsManager;
 				
@@ -70,7 +71,7 @@ namespace LongoMatch.Services
 			db = new DataBase(Path.Combine(Config.DBDir(),Constants.DB_FILE));
 			
 			/* Start the events manager */
-			eManager = new EventsManager(mainWindow);
+			eManager = new EventsManager(guiToolkit);
 
 			/* Start the hotkeys manager */
 			hkManager = new HotKeysManager();
@@ -84,11 +85,11 @@ namespace LongoMatch.Services
 			/* Start Game Units manager */
 			guManager = new GameUnitsManager(mainWindow, mainWindow.Player);
 			
-			projectsManager = new ProjectsManager(mainWindow);
+			projectsManager = new ProjectsManager(guiToolkit);
 			projectsManager.OpenedProjectChanged += OnOpenedProjectChanged;
 		}
 		
-		public static void BindEvents(MainWindow mainWindow) {
+		public static void BindEvents(IMainWindow mainWindow) {
 			/* Connect player events */
 			/* FIXME:
 			player.Prev += OnPrev;
@@ -127,6 +128,12 @@ namespace LongoMatch.Services
 			}
 		}
 		
+		public static IGUIToolkit GUIToolkit {
+			get {
+				return guiToolkit;
+			}
+		}
+		
 		private static void OnOpenedProjectChanged (Project project, ProjectType projectType) {
 			if (project != null) {
 				hkManager.Categories=project.Categories;
diff --git a/LongoMatch.Services/Services/DataBase.cs b/LongoMatch.Services/Services/DataBase.cs
index 1f6445f..2c6d0c4 100644
--- a/LongoMatch.Services/Services/DataBase.cs
+++ b/LongoMatch.Services/Services/DataBase.cs
@@ -23,7 +23,7 @@ using System.Collections.Generic;
 using System.IO;
 using Db4objects.Db4o;
 using Db4objects.Db4o.Query;
-using Gtk;
+
 using LongoMatch.Common;
 using LongoMatch.Interfaces;
 using LongoMatch.Store;
diff --git a/LongoMatch.Services/Services/EventsManager.cs b/LongoMatch.Services/Services/EventsManager.cs
index ba09be7..fcb72a2 100644
--- a/LongoMatch.Services/Services/EventsManager.cs
+++ b/LongoMatch.Services/Services/EventsManager.cs
@@ -20,20 +20,13 @@
 
 using System;
 using System.Collections.Generic;
-using Gdk;
-using Gtk;
 using LongoMatch.Common;
-using LongoMatch.Gui;
-using LongoMatch.Gui.Component;
-using LongoMatch.Gui.Dialog;
 using LongoMatch.Handlers;
 using LongoMatch.Interfaces;
+using LongoMatch.Interfaces.GUI;
 using LongoMatch.Store;
-using LongoMatch.Video.Common;
-using LongoMatch.Video.Editor;
-using LongoMatch.Video.Utils;
-using LongoMatch.Multimedia.Interfaces;
 using Mono.Unix;
+using Gdk;
 
 namespace LongoMatch.Services
 {
@@ -42,8 +35,6 @@ namespace LongoMatch.Services
 	public class EventsManager
 	{
 
-		private FramesSeriesCapturer fsc;
-		private FramesCaptureProgressDialog fcpd;
 		private VideoDrawingsManager drawingManager;
 
 		/* Current play loaded. null if no play is loaded */
@@ -53,16 +44,18 @@ namespace LongoMatch.Services
 		ProjectType projectType;
 		Time startTime;
 		
-		MainWindow mainWindow;
-		PlayerBin player;
-		CapturerBin capturer;
+		IGUIToolkit guiToolkit;
+		IMainWindow mainWindow;
+		IPlayer player;
+		ICapturer capturer;
 
-		public EventsManager(MainWindow mainWindow)
+		public EventsManager(IGUIToolkit guiToolkit)
 		{
-			this.mainWindow = mainWindow;
-			this.player = mainWindow.Player;
-			this.capturer = mainWindow.Capturer;
-			this.drawingManager = new VideoDrawingsManager(player);
+			this.guiToolkit = guiToolkit;
+			mainWindow = guiToolkit.MainWindow;
+			player = mainWindow.Player;
+			capturer = mainWindow.Capturer;
+			drawingManager = new VideoDrawingsManager(player);
 			ConnectSignals();
 		}
 
@@ -136,9 +129,8 @@ namespace LongoMatch.Services
 			/* Get the current frame and get a thumbnail from it */
 			if(projectType == ProjectType.CaptureProject) {
 				if(!capturer.Capturing) {
-					MessagePopup.PopupMessage(capturer, MessageType.Info,
-					                          Catalog.GetString("You can't create a new play if the capturer "+
-					                                            "is not recording."));
+					guiToolkit.InfoMessage(Catalog.GetString("You can't create a new play if the capturer "+
+						"is not recording."));
 					return;
 				}
 				miniature = capturer.CurrentMiniatureFrame;
@@ -187,9 +179,8 @@ namespace LongoMatch.Services
 			diff = stopTime.MSeconds - startTime.MSeconds;
 
 			if(diff < 0) {
-				MessagePopup.PopupMessage(mainWindow, MessageType.Warning,
-				                          Catalog.GetString("The stop time is smaller than the start time. "+
-				                                            "The play will not be added."));
+				guiToolkit.WarningMessage(Catalog.GetString("The stop time is smaller than the start time. "+
+					"The play will not be added."));
 				return;
 			}
 			if(diff < 500) {
@@ -203,11 +194,7 @@ namespace LongoMatch.Services
 		}
 
 		private void LaunchPlayTagger(Play play) {
-			TaggerDialog tg = new TaggerDialog(play.Category, play.Tags, play.Players, play.Teams,
-			                                   openedProject.LocalTeamTemplate, openedProject.VisitorTeamTemplate);
-			tg.TransientFor = mainWindow as Gtk.Window;
-			tg.Run();
-			tg.Destroy();
+			guiToolkit.TagPlay(play, openedProject.LocalTeamTemplate, openedProject.VisitorTeamTemplate);
 		}
 
 		protected virtual void OnPlaySelected(Play play)
@@ -255,33 +242,9 @@ namespace LongoMatch.Services
 			selectedTimeNode = null;
 		}
 
-		protected virtual void OnSnapshotSeries(Play tNode) {
-			SnapshotsDialog sd;
-			uint interval;
-			string seriesName;
-			string outDir;
-
+		protected virtual void OnSnapshotSeries(Play play) {
 			player.Pause();
-
-			sd= new SnapshotsDialog();
-			sd.TransientFor= mainWindow as Gtk.Window;
-			sd.Play = tNode.Name;
-
-			if(sd.Run() == (int)ResponseType.Ok) {
-				sd.Destroy();
-				interval = sd.Interval;
-				seriesName = sd.SeriesName;
-				outDir = System.IO.Path.Combine(Config.SnapshotsDir(),seriesName);
-				fsc = new FramesSeriesCapturer(openedProject.Description.File.FilePath,
-				                               tNode.Start.MSeconds,tNode.Stop.MSeconds,
-				                               interval,outDir);
-				fcpd = new FramesCaptureProgressDialog(fsc);
-				fcpd.TransientFor = mainWindow as Gtk.Window;
-				fcpd.Run();
-				fcpd.Destroy();
-			}
-			else
-				sd.Destroy();
+			guiToolkit.ExportFrameSeries(openedProject, play, Config.SnapshotsDir());
 		}
 		
 		protected virtual void OnPrev()
@@ -298,20 +261,10 @@ namespace LongoMatch.Services
 		}
 
 		protected virtual void OnDrawFrame(int time) {
-			Pixbuf pixbuf=null;
-			DrawingTool dialog = new DrawingTool();
-
+			Pixbuf pixbuf = null;
 			player.Pause();
 			pixbuf = player.CurrentFrame;
-
-			dialog.Image = pixbuf;
-			dialog.TransientFor = (Gtk.Window)player.Toplevel;
-			if(selectedTimeNode != null)
-				dialog.SetPlay((selectedTimeNode as Play),
-				               time);
-			pixbuf.Dispose();
-			dialog.Run();
-			dialog.Destroy();
+			guiToolkit.DrawingTool(pixbuf, selectedTimeNode as Play, time);
 		}
 
 		protected virtual void OnTagPlay(Play play) {
diff --git a/LongoMatch.Services/Services/GameUnitsManager.cs b/LongoMatch.Services/Services/GameUnitsManager.cs
index ee2b56b..694fd21 100644
--- a/LongoMatch.Services/Services/GameUnitsManager.cs
+++ b/LongoMatch.Services/Services/GameUnitsManager.cs
@@ -19,21 +19,21 @@ using System;
 using System.Collections.Generic;
 
 using LongoMatch.Common;
-using LongoMatch.Gui;
+using LongoMatch.Interfaces.GUI;
 using LongoMatch.Store;
 
 namespace LongoMatch.Services
 {
 	public class GameUnitsManager
 	{
-		MainWindow mainWindow;
-		PlayerBin player;
+		IMainWindow mainWindow;
+		IPlayer player;
 		Project openedProject;
 		Dictionary<GameUnit, Time> gameUnitsStarted;
 		ushort fps;
 		
 		
-		public GameUnitsManager (MainWindow mainWindow, PlayerBin player)
+		public GameUnitsManager (IMainWindow mainWindow, IPlayer player)
 		{
 			this.mainWindow = mainWindow;
 			this.player = player;
diff --git a/LongoMatch.Services/Services/HotKeysManager.cs b/LongoMatch.Services/Services/HotKeysManager.cs
index 7d6228a..bdf0392 100644
--- a/LongoMatch.Services/Services/HotKeysManager.cs
+++ b/LongoMatch.Services/Services/HotKeysManager.cs
@@ -19,8 +19,6 @@
 //
 //
 using System.Collections.Generic;
-using Gdk;
-using Gtk;
 using LongoMatch.Store;
 using LongoMatch.Store.Templates;
 using LongoMatch.Handlers;
@@ -55,7 +53,7 @@ namespace LongoMatch.Services
 
 		// Listen to key press events and fire a newMarkEvent event if the key combination
 		// is associated to a Category
-		public void KeyListener(object sender, KeyPressEventArgs args) {
+	/*	public void KeyListener(object sender, KeyPressEventArgs args) {
 			Category cat = null;
 			HotKey hotkey = new HotKey();
 
@@ -66,6 +64,6 @@ namespace LongoMatch.Services
 					newMarkEvent(cat);
 				}
 			}
-		}
+		}*/
 	}
 }
diff --git a/LongoMatch.Services/Services/PlaylistManager.cs b/LongoMatch.Services/Services/PlaylistManager.cs
index f86c5fe..424a4a3 100644
--- a/LongoMatch.Services/Services/PlaylistManager.cs
+++ b/LongoMatch.Services/Services/PlaylistManager.cs
@@ -16,11 +16,9 @@
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 // 
 using System;
-using Gtk;
 
-using LongoMatch.Gui.Component;
-using LongoMatch.Gui;
 using LongoMatch.Interfaces;
+using LongoMatch.Interfaces.GUI;
 using LongoMatch.Store;
 using LongoMatch.Common;
 using Mono.Unix;
@@ -30,9 +28,10 @@ namespace LongoMatch.Services
 {
 	public class PlaylistManager
 	{
+		IGUIToolkit guiToolkit;
 		IPlaylistWidget playlistWidget;
 		IPlayList playlist;
-		PlayerBin player;
+		IPlayer player;
 		/* FIXME */
 		Project openedProject;
 		TimeNode selectedTimeNode;
@@ -40,11 +39,12 @@ namespace LongoMatch.Services
 		bool clockStarted;
 		uint timeout;
 		
-		public PlaylistManager (MainWindow mainWindow)
+		public PlaylistManager (IGUIToolkit guiToolkit)
 		{
-			playlistWidget = mainWindow.Playlist;
-			player = mainWindow.Player;
-			BindEvents(mainWindow, mainWindow.Player);
+			this.guiToolkit = guiToolkit;
+			playlistWidget = guiToolkit.MainWindow.Playlist;
+			player = guiToolkit.MainWindow.Player;
+			BindEvents(guiToolkit.MainWindow, guiToolkit.MainWindow.Player);
 		}
 		
 		public void Stop() {
@@ -57,12 +57,12 @@ namespace LongoMatch.Services
 				playlistWidget.Load(playlist);
 			} catch (Exception e){
 				Log.Exception (e);
-				MessagePopup.PopupMessage(playlistWidget as Gtk.Widget ,MessageType.Error, 
-				                          Catalog.GetString("The file you are trying to load is not a playlist or it's not compatible with the current version"));
+				guiToolkit.ErrorMessage(Catalog.GetString("The file you are trying to load " +
+					"is not a playlist or it's not compatible with the current version"));
 			}
 		}
 		
-		private void BindEvents(MainWindow mainWindow, PlayerBin player) {
+		private void BindEvents(IMainWindow mainWindow, IPlayer player) {
 			/* Track loaded element */
 			mainWindow.PlaySelectedEvent += (p) => {selectedTimeNode = p;};
 			player.SegmentClosedEvent += () => {selectedTimeNode = null;};
@@ -100,8 +100,7 @@ namespace LongoMatch.Services
 		
 		private bool Next() {
 			if(openedProject != null) {
-				MessagePopup.PopupMessage(playlistWidget as Gtk.Widget, MessageType.Error,
-				                          Catalog.GetString("Please, close the opened project to play the playlist."));
+				guiToolkit.ErrorMessage(Catalog.GetString("Please, close the opened project to play the playlist."));
 				Stop();
 				return false;
 			}
@@ -157,15 +156,6 @@ namespace LongoMatch.Services
 			return true;
 		}
 		
-		private FileFilter FileFilter {
-			get {
-				FileFilter filter = new FileFilter();
-				filter.Name = Catalog.GetString("LongoMatch playlist");
-				filter.AddPattern("*" + Constants.PLAYLIST_EXT);
-				return filter;
-			}
-		}
-		
 		protected virtual void OnPlayListNodeAdded(Play play)
 		{
 			Add(new PlayListPlay {
@@ -187,32 +177,25 @@ namespace LongoMatch.Services
 
 		protected virtual void OnOpenPlaylist()
 		{
-			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Open playlist"),
-			                (Gtk.Window)(playlistWidget as Gtk.Widget).Toplevel,
-			                FileChooserAction.Open,
-			                "gtk-cancel",ResponseType.Cancel,
-			                "gtk-open",ResponseType.Accept);
-			fChooser.SetCurrentFolder(Config.PlayListDir());
-			fChooser.AddFilter(FileFilter);
-			fChooser.DoOverwriteConfirmation = true;
-			if(fChooser.Run() == (int)ResponseType.Accept)
-				Load(fChooser.Filename);
-			fChooser.Destroy();
+			string filename;
+			
+			filename = guiToolkit.OpenFile(Catalog.GetString("Open playlist"), null, Config.PlayListDir(),
+				Constants.PROJECT_NAME + Catalog.GetString("playlists"),
+				"*" + Constants.PLAYLIST_EXT);
+			if (filename != null)
+				Load(filename);
 		}
 
 		protected virtual void OnNewPlaylist()
 		{
-			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("New playlist"),
-			                (Gtk.Window)(playlistWidget as Gtk.Widget).Toplevel,
-			                FileChooserAction.Save,
-			                "gtk-cancel",ResponseType.Cancel,
-			                "gtk-save",ResponseType.Accept);
-			fChooser.SetCurrentFolder(Config.PlayListDir());
-			fChooser.AddFilter(FileFilter);
+			string filename;
+			
+			filename = guiToolkit.SaveFile(Catalog.GetString("New playlist"), null, Config.PlayListDir(),
+				Constants.PROJECT_NAME + Catalog.GetString("playlists"),
+				"*" + Constants.PLAYLIST_EXT);
 
-			if(fChooser.Run() == (int)ResponseType.Accept)
-				Load(fChooser.Filename);
-			fChooser.Destroy();
+			if (filename != null)
+				Load(filename);
 		}
 	}
 }
diff --git a/LongoMatch.Services/Services/ProjectsManager.cs b/LongoMatch.Services/Services/ProjectsManager.cs
index 97e8662..64c47ac 100644
--- a/LongoMatch.Services/Services/ProjectsManager.cs
+++ b/LongoMatch.Services/Services/ProjectsManager.cs
@@ -19,20 +19,14 @@
 using System;
 using System.Collections.Generic;
 using System.IO;
-using Gtk;
 using Mono.Unix;
 
 using LongoMatch.Common;
-using LongoMatch.Gui;
-using LongoMatch.Gui.Dialog;
 using LongoMatch.Handlers;
+using LongoMatch.Interfaces.GUI;
+using LongoMatch.Interfaces.Multimedia;
 using LongoMatch.Store;
 using LongoMatch.Store.Templates;
-using LongoMatch.Video;
-using LongoMatch.Video.Utils;
-using LongoMatch.Video.Common;
-using LongoMatch.Multimedia.Utils;
-using LongoMatch.Multimedia.Interfaces;
 
 namespace LongoMatch.Services
 {
@@ -42,10 +36,14 @@ namespace LongoMatch.Services
 	{
 		public event OpenedProjectChangedHandler OpenedProjectChanged;
 
-		MainWindow mainWindow;
+		IGUIToolkit guiToolkit;
+		IMultimediaToolkit multimediaToolkit;
+		IMainWindow mainWindow;
 		
-		public ProjectsManager(MainWindow mainWindow) {
-			this.mainWindow = mainWindow;
+		public ProjectsManager(IGUIToolkit guiToolkit, IMultimediaToolkit multimediaToolkit) {
+			this.multimediaToolkit = multimediaToolkit;
+			this.guiToolkit = guiToolkit;
+			mainWindow = guiToolkit.MainWindow;
 			Player = mainWindow.Player;
 			Capturer = mainWindow.Capturer;
 			ConnectSignals();
@@ -73,12 +71,12 @@ namespace LongoMatch.Services
 			get;
 		}
 		
-		public CapturerBin Capturer {
+		public ICapturer Capturer {
 			set;
 			get;
 		}
 		
-		public PlayerBin Player {
+		public IPlayer Player {
 			get;
 			set;
 		}
@@ -89,19 +87,17 @@ namespace LongoMatch.Services
 		}
 		
 		private void SaveCaptureProject(Project project) {
-			MessageDialog md;
 			string filePath = project.Description.File.FilePath;
 
 			Log.Debug ("Saving capture project: " + project);
-			md = new MessageDialog(mainWindow as Gtk.Window, DialogFlags.Modal,
-			                       MessageType.Info, ButtonsType.None,
-			                       Catalog.GetString("Loading newly created project..."));
-			md.Show();
+			
+			/* FIXME: Show message */
+			//guiToolkit.InfoMessage(Catalog.GetString("Loading newly created project..."));
 
 			/* scan the new file to build a new PreviewMediaFile with all the metadata */
 			try {
 				Log.Debug("Reloading saved file: " + filePath);
-				project.Description.File = PreviewMediaFile.DiscoverFile(filePath);
+				project.Description.File = multimediaToolkit.DiscoverFile(filePath);
 				Core.DB.AddProject(project);
 			} catch(Exception ex) {
 				Log.Exception(ex);
@@ -109,81 +105,45 @@ namespace LongoMatch.Services
 				string projectFile = filePath + "-" + DateTime.Now;
 				projectFile = projectFile.Replace("-", "_").Replace(" ", "_").Replace(":", "_");
 				Project.Export(OpenedProject, projectFile);
-				MessagePopup.PopupMessage(mainWindow, MessageType.Error,
-				                          Catalog.GetString("An error occured saving the project:\n")+ex.Message+ "\n\n"+
-				                          Catalog.GetString("The video file and a backup of the project has been "+
-				                                            "saved. Try to import it later:\n")+
-				                          filePath+"\n"+projectFile);
+				guiToolkit.ErrorMessage(Catalog.GetString("An error occured saving the project:\n")+ex.Message+ "\n\n"+
+					Catalog.GetString("The video file and a backup of the project has been "+
+					"saved. Try to import it later:\n")+
+					filePath+"\n"+projectFile);
 			}
 			/* we need to set the opened project to null to avoid calling again CloseOpendProject() */
 			/* FIXME: */
 			//project = null;
 			SetProject(project, ProjectType.FileProject, new CaptureSettings());
-			md.Destroy();
 		}
 	
 		private void SaveFakeLiveProject(Project project) {
 			int response;
-			MessageDialog md;
-			FileFilter filter;
-			FileChooserDialog fChooser;
 			
 			Log.Debug("Saving fake live project " + project);
-			md = new MessageDialog(mainWindow, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok,
-			                       Catalog.GetString("The project will be saved to a file. " +
-			                                         "You can insert it later into the database using the "+
-			                                         "\"Import project\" function once you copied the video file " +
-			                                         "to your computer"));
-			response = md.Run();
-			md.Destroy();
-			if(response == (int)ResponseType.Cancel)
-				return;
-
-			fChooser = new FileChooserDialog(Catalog.GetString("Save Project"),
-			                                 mainWindow, FileChooserAction.Save,
-			                                 "gtk-cancel",ResponseType.Cancel,
-			                                 "gtk-save",ResponseType.Accept);
-			fChooser.SetCurrentFolder(Config.HomeDir());
-			filter = new FileFilter();
-			filter.Name = Constants.PROJECT_NAME;
-			filter.AddPattern("*.lpr");
-			fChooser.AddFilter(filter);
-			if(fChooser.Run() == (int)ResponseType.Accept) {
-				Project.Export(project, fChooser.Filename);
-				MessagePopup.PopupMessage(mainWindow, MessageType.Info,
-				                          Catalog.GetString("Project saved successfully."));
+			guiToolkit.InfoMessage(Catalog.GetString("The project will be saved to a file. " +
+				"You can insert it later into the database using the "+
+				"\"Import project\" function once you copied the video file " +
+				"to your computer"));
+
+			var filename = guiToolkit.SaveFile(Catalog.GetString("Save Project"), null, Config.HomeDir(),
+				Constants.PROJECT_NAME, "*.lpr");
+			if(filename != null) {
+				Project.Export(project, filename);
+				guiToolkit.InfoMessage(Catalog.GetString("Project saved successfully."));
 			}
-			fChooser.Destroy();
 		}
 
 		private void ImportProject() {
 			Project project;
 			bool isFake, exists;
-			int res;
 			string fileName;
-			FileFilter filter;
-			NewProjectDialog npd;
-			FileChooserDialog fChooser;
 
 			Log.Debug("Importing project");
 			/* Show a file chooser dialog to select the file to import */
-			fChooser = new FileChooserDialog(Catalog.GetString("Import Project"),
-			                                 mainWindow,
-			                                 FileChooserAction.Open,
-			                                 "gtk-cancel",ResponseType.Cancel,
-			                                 "gtk-open",ResponseType.Accept);
-			fChooser.SetCurrentFolder(Config.HomeDir());
-			filter = new FileFilter();
-			filter.Name = Constants.PROJECT_NAME;
-			filter.AddPattern("*.lpr");
-			fChooser.AddFilter(filter);
-
-
-			res = fChooser.Run();
-			fileName = fChooser.Filename;
-			fChooser.Destroy();
-			/* return if the user cancelled */
-			if(res != (int)ResponseType.Accept)
+			fileName = guiToolkit.OpenFile(Catalog.GetString("Import Project"), null,
+				Config.HomeDir(), Constants.PROJECT_NAME, "*lpr");
+				
+			if(fileName == null)
 				return;
 
 			/* try to import the project and show a message error is the file
@@ -192,9 +152,8 @@ namespace LongoMatch.Services
 				project = Project.Import(fileName);
 			}
 			catch(Exception ex) {
-				MessagePopup.PopupMessage(mainWindow, MessageType.Error,
-				                          Catalog.GetString("Error importing project:")+
-				                          "\n"+ex.Message);
+				guiToolkit.ErrorMessage(Catalog.GetString("Error importing project:") +
+					"\n"+ex.Message);
 				Log.Exception(ex);
 				return;
 			}
@@ -206,40 +165,16 @@ namespace LongoMatch.Services
 			if(isFake) {
 				Log.Debug ("Importing fake live project");
 				project.Description.File = null;
-				npd = new NewProjectDialog();
-				npd.TransientFor = mainWindow;
-				npd.Use = ProjectType.EditProject;
-				npd.Project = project;
-				int response = npd.Run();
-				while(true) {
-					if(response != (int)ResponseType.Ok) {
-						npd.Destroy();
-						return;
-					} else if(npd.Project == null) {
-						MessagePopup.PopupMessage(mainWindow, MessageType.Info,
-						                          Catalog.GetString("Please, select a video file."));
-						response=npd.Run();
-					} else {
-						project = npd.Project;
-						npd.Destroy();
-						break;
-					}
-				}
+				project = guiToolkit.NewProject(Core.DB, project, ProjectType.EditProject,
+					Core.TemplatesService, new List<Device>());
 			}
 
 			/* If the project exists ask if we want to overwrite it */
 			if(Core.DB.Exists(project)) {
-				MessageDialog md = new MessageDialog(mainWindow,
-				                                     DialogFlags.Modal,
-				                                     MessageType.Question,
-				                                     Gtk.ButtonsType.YesNo,
-				                                     Catalog.GetString("A project already exists for the file:")+
-				                                     project.Description.File.FilePath+ "\n" +
-				                                     Catalog.GetString("Do you want to overwrite it?"));
-				md.Icon = Gtk.IconTheme.Default.LoadIcon("longomatch", 48, 0);
-				res = md.Run();
-				md.Destroy();
-				if(res != (int)ResponseType.Yes)
+				var res = guiToolkit.QuestionMessage(Catalog.GetString("A project already exists for the file:") +
+					project.Description.File.FilePath+ "\n" +
+					Catalog.GetString("Do you want to overwrite it?"), null);
+				if(!res)
 					return;
 				exists = true;
 			} else
@@ -252,15 +187,11 @@ namespace LongoMatch.Services
 			else
 				Core.DB.AddProject(project);
 
-
-			MessagePopup.PopupMessage(mainWindow, MessageType.Info,
-			                          Catalog.GetString("Project successfully imported."));
+			guiToolkit.InfoMessage(Catalog.GetString("Project successfully imported."));
 		}
 
 		private void CreateNewProject(out Project project, out ProjectType projectType,
 		                             out CaptureSettings captureSettings) {
-			ProjectSelectionDialog psd;
-			NewProjectDialog npd;
 			List<Device> devices = null;
 			int response;
 
@@ -271,62 +202,23 @@ namespace LongoMatch.Services
 			captureSettings = new CaptureSettings();
 
 			/* Show the project selection dialog */
-			psd = new ProjectSelectionDialog();
-			psd.TransientFor = mainWindow;
-			response = psd.Run();
-			psd.Destroy();
-			if(response != (int)ResponseType.Ok)
-				return;
-			projectType = psd.ProjectType;
+			projectType = guiToolkit.SelectNewProjectType();
 			
 			if(projectType == ProjectType.CaptureProject) {
-				devices = VideoDevice.ListVideoDevices();
+				devices = multimediaToolkit.ListVideoDevices();
 				if(devices.Count == 0) {
-					MessagePopup.PopupMessage(mainWindow, MessageType.Error,
-					                          Catalog.GetString("No capture devices were found."));
+					guiToolkit.ErrorMessage(Catalog.GetString("No capture devices were found."));
 					return;
 				}
 			}
 
 			/* Show the new project dialog and wait to get a valid project
 			 * or quit if the user cancel it.*/
-			npd = new NewProjectDialog();
-			npd.TransientFor = mainWindow;
-			npd.Use = projectType;
-			npd.TemplatesService = Core.TemplatesService;
+			guiToolkit.NewProject(Core.DB, null, projectType, Core.TemplatesService, devices);
+
 			if(projectType == ProjectType.CaptureProject)
-				npd.Devices = devices;
-			response = npd.Run();
-			
-			while(true) {
-				/* User cancelled: quit */
-				if(response != (int)ResponseType.Ok) {
-					npd.Destroy();
-					return;
-				}
-				/* No file chosen: display the dialog again */
-				if(npd.Project == null)
-					MessagePopup.PopupMessage(mainWindow, MessageType.Info,
-					                          Catalog.GetString("Please, select a video file."));
-				/* If a project with the same file path exists show a warning */
-				else if(Core.DB.Exists(npd.Project))
-					MessagePopup.PopupMessage(mainWindow, MessageType.Error,
-					                          Catalog.GetString("This file is already used in another Project.")+"\n"+
-					                          Catalog.GetString("Select a different one to continue."));
-
-				else {
-					/* We are now ready to create the new project */
-					project = npd.Project;
-					if(projectType == ProjectType.CaptureProject)
-						captureSettings = npd.CaptureSettings;
-					npd.Destroy();
-					break;
-				}
-				response = npd.Run();
-			}
-			if(projectType == ProjectType.FileProject)
-				/* We can safelly add the project since we already checked if
-				 * it can can added */
+				captureSettings = npd.CaptureSettings;
+			if(projectType == ProjectType.FileProject) 
 				Core.DB.AddProject(project);
 		}
 		
@@ -338,18 +230,16 @@ namespace LongoMatch.Services
 			if(projectType == ProjectType.FileProject) {
 				// Check if the file associated to the project exists
 				if(!File.Exists(project.Description.File.FilePath)) {
-					MessagePopup.PopupMessage(mainWindow, MessageType.Warning,
-					                          Catalog.GetString("The file associated to this project doesn't exist.") + "\n"
-					                          + Catalog.GetString("If the location of the file has changed try to edit it with the database manager."));
+					guiToolkit.WarningMessage(Catalog.GetString("The file associated to this project doesn't exist.") + "\n"
+						+ Catalog.GetString("If the location of the file has changed try to edit it with the database manager."));
 					CloseOpenedProject(true);
 					return false;
 				}
 				try {
 					Player.Open(project.Description.File.FilePath);
 				}
-				catch(GLib.GException ex) {
-					MessagePopup.PopupMessage(mainWindow, MessageType.Error,
-					                          Catalog.GetString("An error occurred opening this project:") + "\n" + ex.Message);
+				catch(Exception ex) {
+					guiToolkit.ErrorMessage(Catalog.GetString("An error occurred opening this project:") + "\n" + ex.Message);
 					CloseOpenedProject(true);
 					return false;
 				}
@@ -360,7 +250,7 @@ namespace LongoMatch.Services
 					try {
 						Capturer.Type = CapturerType.Live;
 					} catch(Exception ex) {
-						MessagePopup.PopupMessage(mainWindow, MessageType.Error, ex.Message);
+						guiToolkit.ErrorMessage(ex.Message);
 						CloseOpenedProject(false);
 						return false;
 					}
@@ -479,14 +369,9 @@ namespace LongoMatch.Services
 		}
 		
 		protected void OpenProject() {
-			ProjectDescription project=null;
-			OpenProjectDialog opd = new OpenProjectDialog();
+			ProjectDescription project = null;
 			
-			opd.Fill(Core.DB.GetAllProjects());	
-			opd.TransientFor = mainWindow;
-			if(opd.Run() == (int)ResponseType.Ok)
-				project = opd.SelectedProject;
-			opd.Destroy();
+			project = guiToolkit.SelectProject(Core.DB.GetAllProjects());
 			if(project != null)
 				SetProject(Core.DB.GetProject(project.UUID), ProjectType.FileProject, new CaptureSettings());
 		}
@@ -499,25 +384,17 @@ namespace LongoMatch.Services
 		
 		protected void OpenCategoriesTemplatesManager()
 		{
-			var tManager = new TemplatesManager<Categories, Category>(Core.TemplatesService.CategoriesTemplateProvider,
-			                                                          Core.TemplatesService.GetTemplateEditor<Categories, Category>());
-			tManager.TransientFor = mainWindow;
-			tManager.Show();
+			guiToolkit.OpenCategoriesTemplatesManager (Core.TemplatesService.CategoriesTemplateProvider);
 		}
 
 		protected void OpenTeamsTemplatesManager()
 		{
-			var tManager = new TemplatesManager<TeamTemplate, Player>(Core.TemplatesService.TeamTemplateProvider,
-			                                                          Core.TemplatesService.GetTemplateEditor<TeamTemplate, Player>());
-			tManager.TransientFor = mainWindow;
-			tManager.Show();
+			guiToolkit.OpenTeamsTemplatesManager (Core.TemplatesService.TeamTemplateProvider);
 		}
 		
 		protected void OpenProjectsManager()
 		{
-			Gui.Dialog.ProjectsManager pm = new Gui.Dialog.ProjectsManager(OpenedProject, Core.DB, Core.TemplatesService);
-			pm.TransientFor = mainWindow;
-			pm.Show();
+			guiToolkit.OpenProjectsManager(OpenedProject, Core.DB, Core.TemplatesService);
 		}
 
 	}
diff --git a/LongoMatch.Services/Services/RenderingJobsManager.cs b/LongoMatch.Services/Services/RenderingJobsManager.cs
index 044d227..0ce518f 100644
--- a/LongoMatch.Services/Services/RenderingJobsManager.cs
+++ b/LongoMatch.Services/Services/RenderingJobsManager.cs
@@ -17,18 +17,13 @@
 // 
 using System;
 using System.Collections.Generic;
-using Gtk;
 using Mono.Unix;
 
 using LongoMatch.Common;
 using LongoMatch.Interfaces;
-using LongoMatch.Gui.Component;
-using LongoMatch.Multimedia.Interfaces;
-using LongoMatch.Video;
+using LongoMatch.Interfaces.GUI;
+using LongoMatch.Interfaces.Multimedia;
 using LongoMatch.Store;
-using LongoMatch.Video.Editor;
-using LongoMatch.Gui;
-using LongoMatch.Gui.Dialog;
 
 namespace LongoMatch.Services
 {
@@ -37,26 +32,25 @@ namespace LongoMatch.Services
 		/* List of pending jobs */
 		List<Job> jobs, pendingJobs;
 		IVideoEditor videoEditor;
-		MultimediaFactory factory;
 		Job currentJob;
-		RenderingStateBar stateBar;
+		IRenderingStateBar stateBar;
+		IMultimediaToolkit multimediaToolkit;
+		IGUIToolkit guiToolkit;
 		
-		public RenderingJobsManager (RenderingStateBar stateBar)
+		public RenderingJobsManager (IMultimediaToolkit multimediaToolkit, IGUIToolkit guiToolkit)
 		{
+			this.guiToolkit = guiToolkit;
+			this.multimediaToolkit = multimediaToolkit; 
+			this.stateBar = guiToolkit.MainWindow.RenderingStateBar;
 			jobs = new List<Job>();
 			pendingJobs = new List<Job>();
-			factory = new MultimediaFactory();
-			this.stateBar = stateBar;
 			stateBar.Cancel += (sender, e) => CancelCurrentJob();
 			stateBar.ManageJobs += (sender, e) => ManageJobs();
 		}
 		
-		public TreeStore Model {
+		public List<Job> Jobs {
 			get {
-				TreeStore model = new TreeStore(typeof(Job));
-				foreach (Job job in jobs)
-					model.AppendValues(job);
-				return model;
+				return jobs;
 			}
 		}
 		
@@ -127,30 +121,7 @@ namespace LongoMatch.Services
 		}
 		
 		protected void ManageJobs() {
-			RenderingJobsDialog dialog = new RenderingJobsDialog(this);
-			dialog.TransientFor = (stateBar.Toplevel as Gtk.Window);
-			dialog.Run();
-			dialog.Destroy();
-		}
-		
-		public static Job ConfigureRenderingJob (IPlayList playlist, Gtk.Widget parent)
-		{
-			VideoEditionProperties vep;
-			Job job = null;
-			int response;
-
-			vep = new VideoEditionProperties();
-			vep.TransientFor = (Gtk.Window)parent.Toplevel;
-			response = vep.Run();
-			while(response == (int)ResponseType.Ok && vep.EncodingSettings.OutputFile == "") {
-				MessagePopup.PopupMessage(parent, MessageType.Warning,
-				                          Catalog.GetString("Please, select a video file."));
-				response=vep.Run();
-			}
-			if(response ==(int)ResponseType.Ok)
-				job = new Job(playlist, vep.EncodingSettings, vep.EnableAudio, vep.TitleOverlay);
-			vep.Destroy();
-			return job;
+			guiToolkit.ManageJobs(this);
 		}
 		
 		private void LoadJob(Job job) {
@@ -182,7 +153,7 @@ namespace LongoMatch.Services
 				return;
 			}
 			
-			videoEditor = factory.getVideoEditor();
+			videoEditor = multimediaToolkit.GetVideoEditor();
 			videoEditor.Progress += OnProgress;
 			currentJob = pendingJobs[0];
 			LoadJob(currentJob);
diff --git a/LongoMatch.Services/Services/TemplatesService.cs b/LongoMatch.Services/Services/TemplatesService.cs
index 34e21a5..c20d76f 100644
--- a/LongoMatch.Services/Services/TemplatesService.cs
+++ b/LongoMatch.Services/Services/TemplatesService.cs
@@ -22,7 +22,6 @@ using System.Reflection;
 using Mono.Unix;
 
 using LongoMatch.Common;
-using LongoMatch.Gui.Component;
 using LongoMatch.Interfaces;
 using LongoMatch.Store;
 using LongoMatch.Store.Templates;
@@ -95,29 +94,21 @@ namespace LongoMatch.Services
 			return null;
 		}
 		
-		public ITemplateWidget<T, U> GetTemplateEditor<T, U>() where T: ITemplate<U>{
-			if (typeof(T) == typeof(Categories))
-				return (ITemplateWidget<T, U>) new CategoriesTemplateEditorWidget (CategoriesTemplateProvider);
-			if (typeof(T) == typeof(TeamTemplate))
-				return (ITemplateWidget<T, U>) new TeamTemplateEditorWidget(TeamTemplateProvider);
-			return null;
-		}
-		
-		public ITemplateProvider<SubCategoryTemplate, string> SubCategoriesTemplateProvider {
+		public ISubcategoriesTemplatesProvider SubCategoriesTemplateProvider {
 			get {
-				return (ITemplateProvider<SubCategoryTemplate, string>) dict[typeof(SubCategoryTemplate)]; 
+				return (ISubcategoriesTemplatesProvider) dict[typeof(SubCategoryTemplate)]; 
 			}
 		}
 		
-		public ITemplateProvider<TeamTemplate, Player> TeamTemplateProvider {
+		public ITeamTemplatesProvider TeamTemplateProvider {
 			get {
-				return (ITemplateProvider<TeamTemplate, Player>) dict[typeof(TeamTemplate)]; 
+				return (ITeamTemplatesProvider) dict[typeof(TeamTemplate)]; 
 			}
 		}
 
-		public ITemplateProvider<Categories, Category> CategoriesTemplateProvider {
+		public ICategoriesTemplatesProvider CategoriesTemplateProvider {
 			get {
-				return (ITemplateProvider<Categories, Category>) dict[typeof(Categories)]; 
+				return (ICategoriesTemplatesProvider) dict[typeof(Categories)]; 
 			}
 		}
 		
diff --git a/LongoMatch.Services/Services/VideoDrawingsManager.cs b/LongoMatch.Services/Services/VideoDrawingsManager.cs
index 87da99b..f7c7fbe 100644
--- a/LongoMatch.Services/Services/VideoDrawingsManager.cs
+++ b/LongoMatch.Services/Services/VideoDrawingsManager.cs
@@ -19,10 +19,10 @@
 using System;
 using System.Collections.Generic;
 using Gdk;
+
+using LongoMatch.Handlers;
+using LongoMatch.Interfaces.GUI;
 using LongoMatch.Store;
-using LongoMatch.Gui;
-using LongoMatch.Video.Common;
-using LongoMatch.Multimedia.Interfaces;
 
 namespace LongoMatch.Services
 {
@@ -30,13 +30,13 @@ namespace LongoMatch.Services
 
 	public class VideoDrawingsManager
 	{
-		PlayerBin player;
+		IPlayer player;
 		uint timeout;
 		bool inKeyFrame;
 		bool canStop;
 		Play loadedPlay;
 
-		public VideoDrawingsManager(PlayerBin player)
+		public VideoDrawingsManager(IPlayer player)
 		{
 			this.player = player;
 			timeout = 0;
diff --git a/LongoMatch/Main.cs b/LongoMatch/Main.cs
index 47fa170..a63f4c0 100644
--- a/LongoMatch/Main.cs
+++ b/LongoMatch/Main.cs
@@ -45,9 +45,10 @@ namespace LongoMatch
 				return;
 
 			//try {
-				Core.Init();
-				MainWindow win = new MainWindow();
+			    GUIToolkit guiToolkit = new GUIToolkit();
+				IMainWindow win = guiToolkit.MainWindow;
 				win.Show();
+				Core.Init();
 				Core.Start(win);
 				Application.Run();
 			//} catch(Exception ex) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]