[longomatch] Include name and description in plugins
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Include name and description in plugins
- Date: Wed, 24 Sep 2014 20:33:34 +0000 (UTC)
commit 1a2710187980a8ac522dffa19bbe10fd26a45b6b
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Wed Sep 24 21:29:25 2014 +0200
Include name and description in plugins
Also bump the Addins dependency to 1.1 due the API change
LongoMatch.Addins/AddinsManager.cs | 43 +++++++++++--------
.../ExtensionPoints/IConfigModifier.cs | 8 +---
.../ExtensionPoints/IExportProject.cs | 12 +++---
.../ExtensionPoints/IImportProject.cs | 16 ++++----
.../ExtensionPoints/ILongoMatchPlugin.cs | 26 ++++++++++++
.../ExtensionPoints/IMultimediaBackend.cs | 10 ++---
LongoMatch.Addins/LongoMatch.Addins.csproj | 1 +
LongoMatch.Plugins/Assembly.cs | 4 +-
LongoMatch.Plugins/CSVExporter.cs | 12 +++++
9 files changed, 87 insertions(+), 45 deletions(-)
---
diff --git a/LongoMatch.Addins/AddinsManager.cs b/LongoMatch.Addins/AddinsManager.cs
index fb48b12..8120bed 100644
--- a/LongoMatch.Addins/AddinsManager.cs
+++ b/LongoMatch.Addins/AddinsManager.cs
@@ -24,54 +24,61 @@ using LongoMatch.Core.Interfaces.Multimedia;
using LongoMatch.Core.Store;
using Mono.Addins;
-[assembly:AddinRoot ("LongoMatch", "1.0")]
-
+[assembly:AddinRoot ("LongoMatch", "1.1")]
namespace LongoMatch.Addins
{
- public class AddinsManager {
+ public class AddinsManager
+ {
public AddinsManager (string configPath, string searchPath)
{
- Log.Information("Initializing addins at path: " + searchPath);
+ Log.Information ("Initializing addins at path: " + searchPath);
AddinManager.Initialize (configPath, searchPath);
- AddinManager.Registry.Update();
+ AddinManager.Registry.Update ();
}
-
- public void LoadConfigModifierAddins() {
+
+ public void LoadConfigModifierAddins ()
+ {
foreach (IConfigModifier configModifier in
AddinManager.GetExtensionObjects<IConfigModifier> ()) {
try {
- configModifier.ModifyConfig();
+ configModifier.ModifyConfig ();
} catch (Exception ex) {
Log.Error ("Error loading config modifier");
Log.Exception (ex);
}
}
}
-
- public void LoadExportProjectAddins(IMainController mainWindow) {
+
+ public void LoadExportProjectAddins (IMainController mainWindow)
+ {
foreach (IExportProject exportProject in
AddinManager.GetExtensionObjects<IExportProject> ()) {
try {
- mainWindow.AddExportEntry(exportProject.GetMenuEntryName(),
exportProject.GetMenuEntryShortName(),
- new Action<Project,
IGUIToolkit>(exportProject.ExportProject));
+ Log.Information ("Adding export entry from plugin: " +
exportProject.Name);
+ mainWindow.AddExportEntry (exportProject.GetMenuEntryName (),
exportProject.GetMenuEntryShortName (),
+ new Action<Project, IGUIToolkit>
(exportProject.ExportProject));
} catch (Exception ex) {
Log.Error ("Error adding export entry");
Log.Exception (ex);
}
}
}
-
- public void LoadImportProjectAddins(IProjectsImporter importer) {
+
+ public void LoadImportProjectAddins (IProjectsImporter importer)
+ {
foreach (IImportProject importProject in
AddinManager.GetExtensionObjects<IImportProject> ()) {
+ Log.Information ("Adding import entry from plugin: " + importProject.Name);
importer.RegisterImporter (new Func<string, Project>
(importProject.ImportProject),
importProject.FilterName,
importProject.FilterExtensions,
importProject.NeedsEdition);
}
}
-
- public void LoadMultimediaBackendsAddins(IMultimediaToolkit mtoolkit) {
+
+ public void LoadMultimediaBackendsAddins (IMultimediaToolkit mtoolkit)
+ {
foreach (IMultimediaBackend backend in
AddinManager.GetExtensionObjects<IMultimediaBackend> ()) {
- try{
+ try {
+ Log.Information ("Adding multimedia backend from plugin: " +
backend.Name);
backend.RegisterElements (mtoolkit);
} catch (Exception ex) {
Log.Error ("Error registering multimedia backend");
@@ -79,7 +86,7 @@ namespace LongoMatch.Addins
}
}
}
-
+
public void ShutdownMultimediaBackends ()
{
foreach (IMultimediaBackend backend in
AddinManager.GetExtensionObjects<IMultimediaBackend> ()) {
diff --git a/LongoMatch.Addins/ExtensionPoints/IConfigModifier.cs
b/LongoMatch.Addins/ExtensionPoints/IConfigModifier.cs
index 649e312..8942f6e 100644
--- a/LongoMatch.Addins/ExtensionPoints/IConfigModifier.cs
+++ b/LongoMatch.Addins/ExtensionPoints/IConfigModifier.cs
@@ -15,17 +15,13 @@
// 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 Mono.Addins;
-using LongoMatch;
-using LongoMatch.Core.Store;
-
namespace LongoMatch.Addins.ExtensionPoints
{
[TypeExtensionPoint]
- public interface IConfigModifier
+ public interface IConfigModifier: ILongoMatchPlugin
{
- void ModifyConfig();
+ void ModifyConfig ();
}
}
\ No newline at end of file
diff --git a/LongoMatch.Addins/ExtensionPoints/IExportProject.cs
b/LongoMatch.Addins/ExtensionPoints/IExportProject.cs
index b3aeb46..60e5eba 100644
--- a/LongoMatch.Addins/ExtensionPoints/IExportProject.cs
+++ b/LongoMatch.Addins/ExtensionPoints/IExportProject.cs
@@ -15,20 +15,20 @@
// 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 Mono.Addins;
-
using LongoMatch.Core.Store;
using LongoMatch.Core.Interfaces.GUI;
namespace LongoMatch.Addins.ExtensionPoints
{
[TypeExtensionPoint]
- public interface IExportProject
+ public interface IExportProject: ILongoMatchPlugin
{
- string GetMenuEntryName();
- string GetMenuEntryShortName();
- void ExportProject(Project project, IGUIToolkit guiToolkit);
+ string GetMenuEntryName ();
+
+ string GetMenuEntryShortName ();
+
+ void ExportProject (Project project, IGUIToolkit guiToolkit);
}
}
diff --git a/LongoMatch.Addins/ExtensionPoints/IImportProject.cs
b/LongoMatch.Addins/ExtensionPoints/IImportProject.cs
index 0d25ab2..9e9a6a3 100644
--- a/LongoMatch.Addins/ExtensionPoints/IImportProject.cs
+++ b/LongoMatch.Addins/ExtensionPoints/IImportProject.cs
@@ -15,21 +15,21 @@
// 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 Mono.Addins;
-
using LongoMatch.Core.Store;
-using LongoMatch.Core.Interfaces.GUI;
namespace LongoMatch.Addins.ExtensionPoints
{
[TypeExtensionPoint]
- public interface IImportProject
+ public interface IImportProject: ILongoMatchPlugin
{
- string FilterName {get;}
- string[] FilterExtensions {get;}
- bool NeedsEdition {get;}
- Project ImportProject(string filename);
+ string FilterName { get; }
+
+ string[] FilterExtensions { get; }
+
+ bool NeedsEdition { get; }
+
+ Project ImportProject (string filename);
}
}
diff --git a/LongoMatch.Addins/ExtensionPoints/ILongoMatchPlugin.cs
b/LongoMatch.Addins/ExtensionPoints/ILongoMatchPlugin.cs
new file mode 100644
index 0000000..47e16f9
--- /dev/null
+++ b/LongoMatch.Addins/ExtensionPoints/ILongoMatchPlugin.cs
@@ -0,0 +1,26 @@
+//
+// Copyright (C) 2014 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.
+//
+namespace LongoMatch.Addins.ExtensionPoints
+{
+ public interface ILongoMatchPlugin
+ {
+ string Name { get; }
+
+ string Description { get; }
+ }
+}
diff --git a/LongoMatch.Addins/ExtensionPoints/IMultimediaBackend.cs
b/LongoMatch.Addins/ExtensionPoints/IMultimediaBackend.cs
index f5f194a..656cc55 100644
--- a/LongoMatch.Addins/ExtensionPoints/IMultimediaBackend.cs
+++ b/LongoMatch.Addins/ExtensionPoints/IMultimediaBackend.cs
@@ -17,18 +17,16 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
//
//
-
-using System;
using Mono.Addins;
using LongoMatch.Core.Interfaces.Multimedia;
-
-namespace LongoMatch.Addins.ExtensionPoints
+namespace LongoMatch.Addins.ExtensionPoints
{
- [TypeExtensionPoint]
- public interface IMultimediaBackend
+ [TypeExtensionPoint]
+ public interface IMultimediaBackend: ILongoMatchPlugin
{
void RegisterElements (IMultimediaToolkit mtoolkit);
+
void Shutdown ();
}
}
diff --git a/LongoMatch.Addins/LongoMatch.Addins.csproj b/LongoMatch.Addins/LongoMatch.Addins.csproj
index 4c4f50f..d9220f2 100644
--- a/LongoMatch.Addins/LongoMatch.Addins.csproj
+++ b/LongoMatch.Addins/LongoMatch.Addins.csproj
@@ -32,6 +32,7 @@
<Compile Include="AddinsManager.cs" />
<Compile Include="ExtensionPoints\IImportProject.cs" />
<Compile Include="ExtensionPoints\IMultimediaBackend.cs" />
+ <Compile Include="ExtensionPoints\ILongoMatchPlugin.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="Mono.Addins, Version=0.6.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
diff --git a/LongoMatch.Plugins/Assembly.cs b/LongoMatch.Plugins/Assembly.cs
index ac8d02e..2523872 100644
--- a/LongoMatch.Plugins/Assembly.cs
+++ b/LongoMatch.Plugins/Assembly.cs
@@ -19,4 +19,6 @@ using System;
using Mono.Addins;
[assembly:Addin]
-[assembly:AddinDependency ("LongoMatch", "1.0")]
\ No newline at end of file
+[assembly:AddinAuthor ("LongoMatch Project")]
+[assembly:AddinName ("LongoMatch plugins")]
+[assembly:AddinDependency ("LongoMatch", "1.1")]
\ No newline at end of file
diff --git a/LongoMatch.Plugins/CSVExporter.cs b/LongoMatch.Plugins/CSVExporter.cs
index 0b3057b..c26500c 100644
--- a/LongoMatch.Plugins/CSVExporter.cs
+++ b/LongoMatch.Plugins/CSVExporter.cs
@@ -31,6 +31,18 @@ namespace LongoMatch.Plugins
[Extension]
public class CSVExporter:IExportProject
{
+ public string Name {
+ get {
+ return Catalog.GetString ("CSV export plugin");
+ }
+ }
+
+ public string Description {
+ get {
+ return Catalog.GetString ("Export project into CSV format");
+ }
+ }
+
public string GetMenuEntryName ()
{
Log.Information ("Registering new export entry");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]