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

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Stedfast <jeff@xamarin.com>2012-03-31 01:16:01 +0400
committerJeffrey Stedfast <jeff@xamarin.com>2012-03-31 01:16:01 +0400
commit03b759a57317b15749138de4cb050d0233da1b1a (patch)
tree54a25fa460c2deefad8d8bcdb2110020beb8c6ed
parent848a8a42d1c2fabeb1c18c262ea2bf5e591c348c (diff)
[Stetic] Fixed cecil property parsing and added support for [Localizable]
-rw-r--r--main/src/addins/MonoDevelop.GtkCore/libsteticui/LibraryCache.cs25
-rw-r--r--main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/ImageChooser.cs1
2 files changed, 19 insertions, 7 deletions
diff --git a/main/src/addins/MonoDevelop.GtkCore/libsteticui/LibraryCache.cs b/main/src/addins/MonoDevelop.GtkCore/libsteticui/LibraryCache.cs
index 77b31df77c..0dabd6bf86 100644
--- a/main/src/addins/MonoDevelop.GtkCore/libsteticui/LibraryCache.cs
+++ b/main/src/addins/MonoDevelop.GtkCore/libsteticui/LibraryCache.cs
@@ -411,7 +411,7 @@ namespace Stetic {
return group;
}
- void AddProperty (PropertyDefinition prop, string cat, XmlElement obj)
+ void AddProperty (PropertyDefinition prop, string cat, bool translatable, XmlElement obj)
{
XmlElement groups = obj ["itemgroups"];
if (groups == null) {
@@ -421,6 +421,8 @@ namespace Stetic {
XmlElement group = GetItemGroup (groups, cat, prop.DeclaringType.Name + " Properties");
XmlElement elem = group.OwnerDocument.CreateElement ("property");
+ if (translatable)
+ elem.SetAttribute ("translatable", "yes");
elem.SetAttribute ("name", prop.Name);
group.AppendChild (elem);
}
@@ -451,26 +453,36 @@ namespace Stetic {
foreach (PropertyDefinition prop in tdef.Properties) {
if (prop.GetMethod == null || !prop.GetMethod.IsPublic || prop.SetMethod == null || !prop.SetMethod.IsPublic)
continue;
+
else if (Array.IndexOf (supported_types, prop.PropertyType.FullName) < 0)
continue;
+
bool browsable = true;
+ bool translatable = false;
string category = String.Empty;
foreach (CustomAttribute attr in prop.CustomAttributes) {
switch (attr.Constructor.DeclaringType.FullName) {
case "System.ComponentModel.BrowsableAttribute":
if (attr.ConstructorArguments.Count > 0) {
- object param = attr.ConstructorArguments [0];
+ object param = attr.ConstructorArguments [0].Value;
if (param.GetType () == typeof (bool))
browsable = (bool) param;
}
break;
case "System.ComponentModel.CategoryAttribute":
if (attr.ConstructorArguments.Count > 0) {
- object param = attr.ConstructorArguments [0];
+ object param = attr.ConstructorArguments [0].Value;
if (param.GetType () == typeof (string))
category = (string) param;
}
break;
+ case "System.ComponentModel.LocalizableAttribute":
+ if (attr.ConstructorArguments.Count > 0) {
+ object param = attr.ConstructorArguments [0].Value;
+ if (param.GetType () == typeof (bool))
+ translatable = (bool) param;
+ }
+ break;
default:
continue;
}
@@ -478,7 +490,7 @@ namespace Stetic {
break;
}
if (browsable)
- AddProperty (prop, category, obj);
+ AddProperty (prop, category, translatable, obj);
}
}
@@ -498,7 +510,6 @@ namespace Stetic {
void AddEvents (TypeDefinition tdef, XmlElement obj)
{
-
foreach (EventDefinition ev in tdef.Events) {
if (ev.AddMethod == null || !ev.AddMethod.IsPublic)
continue;
@@ -508,14 +519,14 @@ namespace Stetic {
switch (attr.Constructor.DeclaringType.FullName) {
case "System.ComponentModel.BrowsableAttribute":
if (attr.ConstructorArguments.Count > 0) {
- object param = attr.ConstructorArguments [0];
+ object param = attr.ConstructorArguments [0].Value;
if (param.GetType () == typeof (bool))
browsable = (bool) param;
}
break;
case "System.ComponentModel.CategoryAttribute":
if (attr.ConstructorArguments.Count > 0) {
- object param = attr.ConstructorArguments [0];
+ object param = attr.ConstructorArguments [0].Value;
if (param.GetType () == typeof (string))
category = (string) param;
}
diff --git a/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/ImageChooser.cs b/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/ImageChooser.cs
index 8269a59f07..5a49e1f741 100644
--- a/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/ImageChooser.cs
+++ b/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/ImageChooser.cs
@@ -56,6 +56,7 @@ namespace MonoDevelop.MacDev.PlistEditor
new Gtk.TargetEntry ("text/uri-list", 0, 100u)
};
+ [Localizable (true)]
public string Description {
get { return description; }
set {