Author: lluis
Date: 2007-07-16 14:14:36 -0400 (Mon, 16 Jul 2007)
New Revision: 82053
Modified:
trunk/stetic/ChangeLog
trunk/stetic/libsteticui/Project.cs
Log:
* libsteticui/Project.cs: Fixes on ActionGroup management.
Modified: trunk/stetic/ChangeLog
===================================================================
--- trunk/stetic/ChangeLog 2007-07-16 18:07:00 UTC (rev 82052)
+++ trunk/stetic/ChangeLog 2007-07-16 18:14:36 UTC (rev 82053)
@@ -1,5 +1,9 @@
2007-07-16 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+ * libsteticui/Project.cs: Fixes on ActionGroup management.
+
+2007-07-16 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
* libsteticui/ActionGroupToolbar.cs: Notify group changes to the
frontend.
* libsteticui/ActionGroupEditSession.cs: Don't delay the creation of
Modified: trunk/stetic/libsteticui/Project.cs
===================================================================
--- trunk/stetic/libsteticui/Project.cs 2007-07-16 18:07:00 UTC (rev 82052)
+++ trunk/stetic/libsteticui/Project.cs 2007-07-16 18:14:36 UTC (rev 82053)
@@ -345,13 +345,31 @@
public ActionGroupComponent AddNewActionGroup (string id)
{
object ob = ProjectBackend.AddNewActionGroup (id);
- return (ActionGroupComponent) App.GetComponent (ob, id,
null);
+ ActionGroupComponent ac = (ActionGroupComponent)
App.GetComponent (ob, id, null);
+
+ // Don't wait for the group added event to come to
update the groups list since
+ // it may be too late.
+ ActionGroupInfo gi = GetActionGroup (ac.Name);
+ if (gi == null) {
+ gi = new ActionGroupInfo (this, ac.Name);
+ groups.Add (gi);
+ }
+ return ac;
}
public ActionGroupComponent AddNewActionGroup (XmlElement
template)
{
object ob =
ProjectBackend.AddNewActionGroupFromTemplate (template.OuterXml);
- return (ActionGroupComponent) App.GetComponent (ob,
null, null);
+ ActionGroupComponent ac = (ActionGroupComponent)
App.GetComponent (ob, null, null);
+
+ // Don't wait for the group added event to come to
update the groups list since
+ // it may be too late.
+ ActionGroupInfo gi = GetActionGroup (ac.Name);
+ if (gi == null) {
+ gi = new ActionGroupInfo (this, ac.Name);
+ groups.Add (gi);
+ }
+ return ac;
}
public void RemoveActionGroup (ActionGroupInfo group)
@@ -545,6 +563,11 @@
internal void NotifyActionGroupAdded (string group)
{
Gtk.Application.Invoke (delegate {
+ ActionGroupInfo gi = GetActionGroup (group);
+ if (gi == null) {
+ gi = new ActionGroupInfo (this, group);
+ groups.Add (gi);
+ }
if (ActionGroupsChanged != null)
ActionGroupsChanged (this,
EventArgs.Empty);
});
@@ -553,8 +576,12 @@
internal void NotifyActionGroupRemoved (string group)
{
Gtk.Application.Invoke (delegate {
- if (ActionGroupsChanged != null)
- ActionGroupsChanged (this,
EventArgs.Empty);
+ ActionGroupInfo gi = GetActionGroup (group);
+ if (gi != null) {
+ groups.Remove (gi);
+ if (ActionGroupsChanged != null)
+ ActionGroupsChanged (this,
EventArgs.Empty);
+ }
});
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches