Permalink
Browse files

2008-06-18 Mike Kestner <mkestner@novell.com>

	* libstetic/WidgetLibrary.cs: refactor class addition logic from Load
	into a protected AddClass method which subclasses can use to add
	classes marked with [ToolboxItem].

svn path=/trunk/stetic/; revision=106114
  • Loading branch information...
1 parent 06649d3 commit d341500a74747393fcd8bfd37dd92c18a5c1e725 @mkestner mkestner committed Jun 18, 2008
Showing with 17 additions and 7 deletions.
  1. +6 −0 ChangeLog
  2. +11 −7 libstetic/WidgetLibrary.cs
View
@@ -1,5 +1,11 @@
2008-06-18 Mike Kestner <mkestner@novell.com>
+ * libstetic/WidgetLibrary.cs: refactor class addition logic from Load
+ into a protected AddClass method which subclasses can use to add
+ classes marked with [ToolboxItem].
+
+2008-06-18 Mike Kestner <mkestner@novell.com>
+
* libsteticui/CecilWidgetLibrary.cs: remove timestamp code and reuse
cache currency logic. flatten out an unnecessary if branch in Load.
@@ -75,13 +75,8 @@ protected virtual void Load (XmlDocument objects)
enums[enm.Name] = enm;
}
- foreach (XmlElement element in objects.SelectNodes ("/objects/object")) {
- ClassDescriptor klass = LoadClassDescriptor (element);
- if (klass == null) continue;
- klass.SetLibrary (this);
- classes_by_cname[klass.CName] = klass;
- classes_by_csname[klass.WrappedTypeName] = klass;
- }
+ foreach (XmlElement element in objects.SelectNodes ("/objects/object"))
+ AddClass (LoadClassDescriptor (element));
XmlNamespaceManager nsm = new XmlNamespaceManager (objects.NameTable);
nsm.AddNamespace ("xsl", "http://www.w3.org/1999/XSL/Transform");
@@ -97,6 +92,15 @@ protected virtual void Load (XmlDocument objects)
exportElems [n] = (XmlElement) nodes[n];
}
+ protected void AddClass (ClassDescriptor klass)
+ {
+ if (klass == null)
+ return;
+ klass.SetLibrary (this);
+ classes_by_cname[klass.CName] = klass;
+ classes_by_csname[klass.WrappedTypeName] = klass;
+ }
+
public virtual void Dispose ()
{
}

0 comments on commit d341500

Please sign in to comment.