Branch: refs/heads/master
Home:
https://github.com/mono/monodevelop
Compare:
https://github.com/mono/monodevelop/compare/848a8a4...03b759a
Commit: 03b759a57317b15749138de4cb050d0233da1b1a
Author: Jeffrey Stedfast <
je...@xamarin.com> (jstedfast)
Date: 2012-03-30 21:16:01 GMT
URL:
https://github.com/mono/monodevelop/commit/03b759a57317b15749138de4cb050d0233da1b1a
[Stetic] Fixed cecil property parsing and added support for [Localizable]
Changed paths:
M main/src/addins/MonoDevelop.GtkCore/libsteticui/LibraryCache.cs
M main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/ImageChooser.cs
Modified: main/src/addins/MonoDevelop.GtkCore/libsteticui/LibraryCache.cs
===================================================================
@@ -411,7 +411,7 @@ XmlElement GetItemGroup (XmlElement groups, string cat, string default_label)
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 @@ void AddProperty (PropertyDefinition prop, string cat, XmlElement obj)
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 @@ void AddProperties (TypeDefinition tdef, XmlElement obj)
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 @@ void AddProperties (TypeDefinition tdef, XmlElement obj)
break;
}
if (browsable)
- AddProperty (prop, category, obj);
+ AddProperty (prop, category, translatable, obj);
}
}
@@ -498,7 +510,6 @@ void AddEvent (EventDefinition ev, string cat, XmlElement obj)
void AddEvents (TypeDefinition tdef, XmlElement obj)
{
-
foreach (EventDefinition ev in tdef.Events) {
if (ev.AddMethod == null || !ev.AddMethod.IsPublic)
continue;
@@ -508,14 +519,14 @@ void AddEvents (TypeDefinition tdef, XmlElement obj)
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;
}
Modified: main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/ImageChooser.cs
===================================================================
@@ -56,6 +56,7 @@ public class ImageChooser : Button
new Gtk.TargetEntry ("text/uri-list", 0, 100u)
};
+ [Localizable (true)]
public string Description {
get { return description; }
set {