Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-addins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@novell.com>2010-03-26 14:31:42 +0300
committerLluis Sanchez <lluis@novell.com>2010-03-26 14:31:42 +0300
commit33b4c6c34440b774909576b9fee4b9eead4ef800 (patch)
treed71e9277b740704e26790c460ee5533b88d762f3
parent3f228350d81c69eba39585882854f68e7464c96e (diff)
* Makefile.am:
* Mono.Addins.csproj: * Mono.Addins/AddinAttribute.cs: * Mono.Addins/AddinAuthorAttribute.cs: * Mono.Addins.Database/AddinScanner.cs: * Mono.Addins/AddinCategoryAttribute.cs: * Mono.Addins/AddinLocalizerGettextAttribute.cs: Allow specifying some add-in properties using attribtues. svn path=/trunk/mono-addins/; revision=154257
-rw-r--r--Mono.Addins/ChangeLog11
-rw-r--r--Mono.Addins/Makefile.am3
-rw-r--r--Mono.Addins/Mono.Addins.Database/AddinScanner.cs42
-rw-r--r--Mono.Addins/Mono.Addins.csproj3
-rw-r--r--Mono.Addins/Mono.Addins/AddinAttribute.cs13
-rw-r--r--Mono.Addins/Mono.Addins/AddinAuthorAttribute.cs42
-rw-r--r--Mono.Addins/Mono.Addins/AddinCategoryAttribute.cs47
-rw-r--r--Mono.Addins/Mono.Addins/AddinLocalizerGettextAttribute.cs64
8 files changed, 225 insertions, 0 deletions
diff --git a/Mono.Addins/ChangeLog b/Mono.Addins/ChangeLog
index 3fae781..53101e1 100644
--- a/Mono.Addins/ChangeLog
+++ b/Mono.Addins/ChangeLog
@@ -1,5 +1,16 @@
2010-03-26 Lluis Sanchez Gual <lluis@novell.com>
+ * Makefile.am:
+ * Mono.Addins.csproj:
+ * Mono.Addins/AddinAttribute.cs:
+ * Mono.Addins/AddinAuthorAttribute.cs:
+ * Mono.Addins.Database/AddinScanner.cs:
+ * Mono.Addins/AddinCategoryAttribute.cs:
+ * Mono.Addins/AddinLocalizerGettextAttribute.cs: Allow
+ specifying some add-in properties using attribtues.
+
+2010-03-26 Lluis Sanchez Gual <lluis@novell.com>
+
* Mono.Addins.Database/AddinScanner.cs:
* Mono.Addins.Description/AddinDescription.cs: Added support
for multiple .addin.xml files in a single assembly.
diff --git a/Mono.Addins/Makefile.am b/Mono.Addins/Makefile.am
index 22d8c17..57f4272 100644
--- a/Mono.Addins/Makefile.am
+++ b/Mono.Addins/Makefile.am
@@ -68,11 +68,14 @@ FILES = \
Mono.Addins.Serialization/IBinaryXmlElement.cs \
Mono.Addins/Addin.cs \
Mono.Addins/AddinAttribute.cs \
+ Mono.Addins/AddinAuthorAttribute.cs \
+ Mono.Addins/AddinCategoryAttribute.cs \
Mono.Addins/AddinDependencyAttribute.cs \
Mono.Addins/AddinErrorEventArgs.cs \
Mono.Addins/AddinEventArgs.cs \
Mono.Addins/AddinInfo.cs \
Mono.Addins/AddinLocalizer.cs \
+ Mono.Addins/AddinLocalizerGettextAttribute.cs \
Mono.Addins/AddinManager.cs \
Mono.Addins/AddinRegistry.cs \
Mono.Addins/AddinRootAttribute.cs \
diff --git a/Mono.Addins/Mono.Addins.Database/AddinScanner.cs b/Mono.Addins/Mono.Addins.Database/AddinScanner.cs
index dd63408..b10ee5b 100644
--- a/Mono.Addins/Mono.Addins.Database/AddinScanner.cs
+++ b/Mono.Addins/Mono.Addins.Database/AddinScanner.cs
@@ -705,6 +705,48 @@ namespace Mono.Addins.Database
if (att.Category.Length > 0)
config.Category = att.Category;
config.IsRoot = att is AddinRootAttribute;
+ config.EnabledByDefault = att.EnabledByDefault;
+ config.Flags = att.Flags;
+ }
+
+ // Category
+
+ object catt = reflector.GetCustomAttribute (asm, typeof(AddinCategoryAttribute), false);
+ if (catt != null && config.Category.Length == 0)
+ config.Category = ((AddinCategoryAttribute)catt).Name;
+
+ // Author attributes
+
+ object[] atts = reflector.GetCustomAttributes (asm, typeof(AddinAuthorAttribute), false);
+ foreach (AddinAuthorAttribute author in atts) {
+ if (config.Author.Length == 0)
+ config.Author = author.Name;
+ else
+ config.Author += ", " + author.Name;
+ }
+
+ // Description
+
+ catt = reflector.GetCustomAttribute (asm, typeof(AssemblyDescriptionAttribute), false);
+ if (catt != null && config.Description.Length == 0)
+ config.Description = ((AssemblyDescriptionAttribute)catt).Description;
+
+ // Copyright
+
+ catt = reflector.GetCustomAttribute (asm, typeof(AssemblyCopyrightAttribute), false);
+ if (catt != null && config.Copyright.Length == 0)
+ config.Copyright = ((AssemblyCopyrightAttribute)catt).Copyright;
+
+ // Localizer
+
+ AddinLocalizerGettextAttribute locat = (AddinLocalizerGettextAttribute) reflector.GetCustomAttribute (asm, typeof(AddinLocalizerGettextAttribute), false);
+ if (locat != null) {
+ ExtensionNodeDescription node = new ExtensionNodeDescription ();
+ if (!string.IsNullOrEmpty (locat.Catalog))
+ node.SetAttribute ("catalog", locat.Catalog);
+ if (!string.IsNullOrEmpty (locat.Location))
+ node.SetAttribute ("location", locat.Catalog);
+ config.Localizer = node;
}
}
diff --git a/Mono.Addins/Mono.Addins.csproj b/Mono.Addins/Mono.Addins.csproj
index ef1631a..a9469e1 100644
--- a/Mono.Addins/Mono.Addins.csproj
+++ b/Mono.Addins/Mono.Addins.csproj
@@ -115,6 +115,9 @@
<Compile Include="Mono.Addins.Database\ISetupHandler.cs" />
<Compile Include="Mono.Addins\ExtensionAttributeAttribute.cs" />
<Compile Include="Mono.Addins\CustomExtensionAttribute.cs" />
+ <Compile Include="Mono.Addins\AddinAuthorAttribute.cs" />
+ <Compile Include="Mono.Addins\AddinLocalizerGettextAttribute.cs" />
+ <Compile Include="Mono.Addins\AddinCategoryAttribute.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Mono.Addins.dll.config">
diff --git a/Mono.Addins/Mono.Addins/AddinAttribute.cs b/Mono.Addins/Mono.Addins/AddinAttribute.cs
index 17f075c..047d080 100644
--- a/Mono.Addins/Mono.Addins/AddinAttribute.cs
+++ b/Mono.Addins/Mono.Addins/AddinAttribute.cs
@@ -28,6 +28,7 @@
using System;
+using Mono.Addins.Description;
namespace Mono.Addins
{
@@ -38,6 +39,8 @@ namespace Mono.Addins
string version;
string ns;
string category;
+ bool enabledByDefault = true;
+ AddinFlags flags;
public AddinAttribute ()
{
@@ -73,5 +76,15 @@ namespace Mono.Addins
get { return category != null ? category : string.Empty; }
set { category = value; }
}
+
+ public bool EnabledByDefault {
+ get { return this.enabledByDefault; }
+ set { this.enabledByDefault = value; }
+ }
+
+ public AddinFlags Flags {
+ get { return this.flags; }
+ set { this.flags = value; }
+ }
}
}
diff --git a/Mono.Addins/Mono.Addins/AddinAuthorAttribute.cs b/Mono.Addins/Mono.Addins/AddinAuthorAttribute.cs
new file mode 100644
index 0000000..42dd29e
--- /dev/null
+++ b/Mono.Addins/Mono.Addins/AddinAuthorAttribute.cs
@@ -0,0 +1,42 @@
+//
+// AddinAuthorAttribute.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+namespace Mono.Addins
+{
+ [AttributeUsage (AttributeTargets.Assembly, AllowMultiple=true)]
+ public class AddinAuthorAttribute: Attribute
+ {
+ public AddinAuthorAttribute (string name)
+ {
+ Name = name;
+ }
+
+ public string Name { get; set; }
+ }
+}
+
diff --git a/Mono.Addins/Mono.Addins/AddinCategoryAttribute.cs b/Mono.Addins/Mono.Addins/AddinCategoryAttribute.cs
new file mode 100644
index 0000000..adb36b8
--- /dev/null
+++ b/Mono.Addins/Mono.Addins/AddinCategoryAttribute.cs
@@ -0,0 +1,47 @@
+//
+// AddinCategoryAttribute.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+namespace Mono.Addins
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public class AddinCategoryAttribute: Attribute
+ {
+ string name;
+
+ public AddinCategoryAttribute (string name)
+ {
+ this.name = name;
+ }
+
+ public string Name {
+ get { return this.name; }
+ set { this.name = value; }
+ }
+ }
+}
+
diff --git a/Mono.Addins/Mono.Addins/AddinLocalizerGettextAttribute.cs b/Mono.Addins/Mono.Addins/AddinLocalizerGettextAttribute.cs
new file mode 100644
index 0000000..fcc1bc5
--- /dev/null
+++ b/Mono.Addins/Mono.Addins/AddinLocalizerGettextAttribute.cs
@@ -0,0 +1,64 @@
+//
+// AddinLocalizerAttribute.cs
+//
+// Author:
+// Lluis Sanchez Gual <lluis@novell.com>
+//
+// Copyright (c) 2010 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+
+namespace Mono.Addins
+{
+ [AttributeUsage (AttributeTargets.Assembly)]
+ public class AddinLocalizerGettextAttribute: Attribute
+ {
+ string catalog;
+ string location;
+
+ public AddinLocalizerGettextAttribute ()
+ {
+ }
+
+ public AddinLocalizerGettextAttribute (string catalog)
+ {
+ this.catalog = catalog;
+ }
+
+ public AddinLocalizerGettextAttribute (string catalog, string location)
+ {
+ this.catalog = catalog;
+ this.location = location;
+ }
+
+ public string Catalog {
+ get { return this.catalog; }
+ set { this.catalog = value; }
+ }
+
+ public string Location {
+ get { return this.location; }
+ set { this.location = value; }
+ }
+
+ }
+}
+