Author: lluis
Date: 2007-01-12 10:18:04 -0500 (Fri, 12 Jan 2007)
New Revision: 70923
Modified:
trunk/stetic/ChangeLog
trunk/stetic/libstetic/wrapper/Container.cs
trunk/stetic/libsteticui/Application.cs
trunk/stetic/libsteticui/Project.cs
trunk/stetic/libsteticui/WidgetEditSession.cs
Log:
* libsteticui/WidgetEditSession.cs: When saving the designer session,
instead of deleting the old widget and adding the new one, update
the existing widget.
* libsteticui/Application.cs: Added some thread locking.
* libsteticui/Project.cs: When a widget name changed event is received,
update the corresponding component from the current thread, there
is no need to do it in the gui thread.
* libstetic/wrapper/Container.cs: Added null check for container child.
Modified: trunk/stetic/ChangeLog
===================================================================
--- trunk/stetic/ChangeLog 2007-01-12 15:06:20 UTC (rev 70922)
+++ trunk/stetic/ChangeLog 2007-01-12 15:18:04 UTC (rev 70923)
@@ -1,3 +1,14 @@
+2007-01-12 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * libsteticui/WidgetEditSession.cs: When saving the designer session,
+ instead of deleting the old widget and adding the new one, update
+ the existing widget.
+ * libsteticui/Application.cs: Added some thread locking.
+ * libsteticui/Project.cs: When a widget name changed event is received,
+ update the corresponding component from the current thread, there
+ is no need to do it in the gui thread.
+ * libstetic/wrapper/Container.cs: Added null check for container child.
+
2007-01-11 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* libsteticui/ActionGroupDesigner.cs, libsteticui/WidgetDesigner.cs,
Modified: trunk/stetic/libstetic/wrapper/Container.cs
===================================================================
--- trunk/stetic/libstetic/wrapper/Container.cs 2007-01-12 15:06:20 UTC (rev
70922)
+++ trunk/stetic/libstetic/wrapper/Container.cs 2007-01-12 15:18:04 UTC (rev
70923)
@@ -469,16 +469,23 @@
GenerateSetInternalChild (ctx, var, prop);
}
+
if (IsTopLevel && Wrapped is Gtk.Bin) {
- ctx.Statements.Add (
+ CodeExpression childExp = new
CodePropertyReferenceExpression (var, "Child");
+ CodeConditionStatement cond = new
CodeConditionStatement ();
+ cond.Condition =
+ new CodeBinaryOperatorExpression (
+ childExp,
+
CodeBinaryOperatorType.IdentityInequality,
+ new CodePrimitiveExpression
(null)
+ );
+ cond.TrueStatements.Add (
new CodeMethodInvokeExpression (
- new
CodePropertyReferenceExpression (
- var,
- "Child"
- ),
+ childExp,
"ShowAll"
)
);
+ ctx.Statements.Add (cond);
}
}
Modified: trunk/stetic/libsteticui/Application.cs
===================================================================
--- trunk/stetic/libsteticui/Application.cs 2007-01-12 15:06:20 UTC (rev
70922)
+++ trunk/stetic/libsteticui/Application.cs 2007-01-12 15:18:04 UTC (rev
70923)
@@ -139,11 +139,14 @@
UpdateWidgetLibraries (false, false);
types.Clear ();
- // All components should have been cleared by the
backend,
- // just make sure it did
- Component[] comps = new Component [components.Count];
- components.Values.CopyTo (comps, 0);
- components.Clear ();
+ Component[] comps;
+ lock (components) {
+ // All components should have been cleared by
the backend,
+ // just make sure it did
+ comps = new Component [components.Count];
+ components.Values.CopyTo (comps, 0);
+ components.Clear ();
+ }
foreach (Component c in comps) {
c.Dispose ();
@@ -357,31 +360,33 @@
internal Component GetComponent (object cbackend, string name,
string type)
{
try {
- Component c = (Component) components [cbackend];
- if (c != null)
- return c;
+ lock (components) {
+ Component c = (Component) components
[cbackend];
+ if (c != null)
+ return c;
- // If the remote object is already disposed,
don't try to create a
- // local component.
- if (cbackend is ObjectWrapper &&
((ObjectWrapper)cbackend).IsDisposed)
- return null;
-
- if (cbackend is Wrapper.Action) {
- c = new ActionComponent (this,
cbackend, name);
- ((ObjectWrapper)cbackend).Frontend = c;
- } else if (cbackend is Wrapper.ActionGroup) {
- c = new ActionGroupComponent (this,
cbackend, name);
-
((Wrapper.ActionGroup)cbackend).Frontend = c;
- } else if (cbackend is ObjectWrapper) {
- c = new WidgetComponent (this,
cbackend, name, type != null ? GetComponentType (type) : null);
- ((ObjectWrapper)cbackend).Frontend = c;
- } else if (cbackend == null)
- throw new System.ArgumentNullException
("cbackend");
- else
- throw new
System.InvalidOperationException ("Invalid component type: " + cbackend.GetType
());
+ // If the remote object is already
disposed, don't try to create a
+ // local component.
+ if (cbackend is ObjectWrapper &&
((ObjectWrapper)cbackend).IsDisposed)
+ return null;
+
+ if (cbackend is Wrapper.Action) {
+ c = new ActionComponent (this,
cbackend, name);
+
((ObjectWrapper)cbackend).Frontend = c;
+ } else if (cbackend is
Wrapper.ActionGroup) {
+ c = new ActionGroupComponent
(this, cbackend, name);
+
((Wrapper.ActionGroup)cbackend).Frontend = c;
+ } else if (cbackend is ObjectWrapper) {
+ c = new WidgetComponent (this,
cbackend, name, type != null ? GetComponentType (type) : null);
+
((ObjectWrapper)cbackend).Frontend = c;
+ } else if (cbackend == null)
+ throw new
System.ArgumentNullException ("cbackend");
+ else
+ throw new
System.InvalidOperationException ("Invalid component type: " + cbackend.GetType
());
- components [cbackend] = c;
- return c;
+ components [cbackend] = c;
+ return c;
+ }
}
catch (System.Runtime.Remoting.RemotingException)
{
@@ -395,7 +400,9 @@
internal void DisposeComponent (Component c)
{
- components.Remove (c.Backend);
+ lock (components) {
+ components.Remove (c.Backend);
+ }
}
}
Modified: trunk/stetic/libsteticui/Project.cs
===================================================================
--- trunk/stetic/libsteticui/Project.cs 2007-01-12 15:06:20 UTC (rev 70922)
+++ trunk/stetic/libsteticui/Project.cs 2007-01-12 15:18:04 UTC (rev 70923)
@@ -330,15 +330,14 @@
internal void NotifyWidgetNameChanged (object obj, string
oldName, string newName)
{
+ WidgetComponent c = (WidgetComponent) App.GetComponent
(obj, null, null);
+ if (c != null)
+ c.UpdateName (newName);
+
Gtk.Application.Invoke (
delegate {
- if (ComponentNameChanged != null) {
- WidgetComponent c =
(WidgetComponent) App.GetComponent (obj, null, null);
- if (c != null) {
- c.UpdateName (newName);
- ComponentNameChanged
(this, new ComponentNameEventArgs (this, c, oldName));
- }
- }
+ if (ComponentNameChanged != null && c
!= null)
+ ComponentNameChanged (this, new
ComponentNameEventArgs (this, c, oldName));
}
);
}
Modified: trunk/stetic/libsteticui/WidgetEditSession.cs
===================================================================
--- trunk/stetic/libsteticui/WidgetEditSession.cs 2007-01-12 15:06:20 UTC
(rev 70922)
+++ trunk/stetic/libsteticui/WidgetEditSession.cs 2007-01-12 15:18:04 UTC
(rev 70923)
@@ -167,13 +167,10 @@
XmlElement data =
Stetic.WidgetUtils.ExportWidget (rootWidget.Wrapped);
Wrapper.Widget sw =
sourceProject.GetTopLevelWrapper (sourceWidget, false);
- if (sw != null)
- sw.Delete ();
+ sw.Read (new ObjectReader (gproject,
FileFormat.Native), data);
- Gtk.Widget w = Stetic.WidgetUtils.ImportWidget
(sourceProject, data);
- sourceWidget = w.Name;
- sourceProject.AddWidget (w);
-
+ sourceWidget = ((Gtk.Widget)sw.Wrapped).Name;
+ sw.NotifyChanged ();
gproject.Modified = false;
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches