Index: libsteticui/ProjectBackend.cs
===================================================================
--- libsteticui/ProjectBackend.cs	(revision 17)
+++ libsteticui/ProjectBackend.cs	(working copy)
@@ -16,7 +16,7 @@
 		bool modified;
 		Gtk.Widget selection;
 		string id;
-		string fileName;
+		string folderName;
 		XmlDocument tempDoc;
 		bool loading;
 		IResourceProvider resourceProvider;
@@ -33,7 +33,9 @@
 		AssemblyResolver resolver;
 		string imagesRootPath;
 		string targetGtkVersion;
-		//version of stetic xml files
+		List<string> modifiedTopLevels;
+		//During project conversion flag is set
+		bool converting;
 		
 		// The action collection of the last selected widget
 		Stetic.Wrapper.ActionGroupCollection oldTopActionCollection;
@@ -49,8 +51,7 @@
 		public event SignalChangedEventHandler SignalChanged;
 		
 		public event Wrapper.WidgetEventHandler SelectionChanged;
-		public event EventHandler ModifiedChanged;
-		public event EventHandler Changed;
+		public event ProjectChangedEventHandler Changed;
 		
 		// Fired when the project has been reloaded, due for example to
 		// a change in the registry
@@ -70,6 +71,7 @@
 			iconFactory = new ProjectIconFactory ();
 			widgetLibraries = new ArrayList ();
 			internalLibs = new ArrayList ();
+			modifiedTopLevels = new List<string> ();
 		}
 		
 		public void Dispose ()
@@ -95,12 +97,18 @@
 			return null;
 		}
 		
+		
 		public string FileName {
-			get { return fileName; }
+			get { throw new Exception("FileName is obsolete"); }
+			set { throw new Exception("FileName is obsolete"); }
+		}
+			
+		public string FolderName {
+			get { return folderName; }
 			set {
-				this.fileName = value;
-				if (fileName != null)
-					Id = System.IO.Path.GetFileName (fileName);
+				this.folderName = value;
+				if (folderName != null )
+					Id = System.IO.Path.GetFullPath (folderName);
 				else
 					Id = null;
 			}
@@ -134,7 +142,7 @@
 		}
 		
 		public string TargetGtkVersion {
-			get { return targetGtkVersion != null ? targetGtkVersion : "2.4"; }
+			get { return targetGtkVersion ?? string.Empty; }
 			set {
 				if (TargetGtkVersion == value)
 					return;
@@ -149,16 +157,16 @@
 		public string ImagesRootPath {
 			get {
 				if (string.IsNullOrEmpty (imagesRootPath)) {
-					if (string.IsNullOrEmpty (fileName))
+					if (string.IsNullOrEmpty (folderName))
 						return ".";
 					else
-						return Path.GetDirectoryName (fileName);
+						return Path.GetFullPath (folderName);
 				}
 				else {
 					if (Path.IsPathRooted (imagesRootPath))
 						return imagesRootPath;
-					else if (!string.IsNullOrEmpty (fileName))
-						return Path.GetFullPath (Path.Combine (Path.GetDirectoryName (fileName), imagesRootPath));
+					else if (!string.IsNullOrEmpty (folderName))
+						return Path.GetFullPath (Path.Combine (folderName, imagesRootPath));
 					else
 						return imagesRootPath;
 				}
@@ -190,7 +198,7 @@
 			widgetLibraries.Remove (lib);
 			internalLibs.Remove (lib);
 		}
-		
+			
 		public ArrayList GetComponentTypes ()
 		{
 			ArrayList list = new ArrayList ();
@@ -257,20 +265,13 @@
 			set { iconFactory = value; }
 		}
 		
-		internal void SetFileName (string fileName)
-		{
-			this.fileName = fileName;
-		}
-		
 		internal void SetFrontend (Project project)
 		{
 			frontend = project;
 		}
 		
 		public void Close ()
-		{
-			fileName = null;
-			
+		{	
 			if (actionGroups != null && ownedGlobalActionGroups) {
 				foreach (Stetic.Wrapper.ActionGroup ag in actionGroups)
 					ag.Dispose ();
@@ -284,24 +285,35 @@
 
 			selection = null;
 			topLevels.Clear ();
-			widgetLibraries.Clear ();
+			//widgetLibraries.Clear ();
+			
 
 			iconFactory = new ProjectIconFactory ();
 		}
 		
-		public void Load (string fileName)
+		public void Load (string folderName)
 		{
-			Load (fileName, fileName);
+			this.folderName = folderName;
+			XmlDocument doc = new XmlDocument ();
+			doc.PreserveWhitespace = true;
+			XmlElement toplevel = doc.CreateElement ("stetic-interface");
+			doc.AppendChild (toplevel);
+			modifiedTopLevels.Clear ();
+			
+			ReadIconFactory (doc);
+			ReadActionGroups (doc);
+			ReadTopLevels (doc);
+			Read (doc);
+			
+			Id = System.IO.Path.GetFullPath (folderName);
 		}
 		
-		public void Load (string xmlFile, string fileName)
+		public void LoadOldVersion (string fileName)
 		{
-			this.fileName = fileName;
 			XmlDocument doc = new XmlDocument ();
 			doc.PreserveWhitespace = true;
-			doc.Load (xmlFile);
-			ReadIconFactory (doc);
-			ReadSplitFiles (doc);
+			doc.Load (fileName);
+			
 			Read (doc);
 			
 			Id = System.IO.Path.GetFileName (fileName);
@@ -313,7 +325,7 @@
 			if (node == null)
 				return;
 			
-			string basePath = fileName != null ? Path.GetDirectoryName (fileName) : null;
+			string basePath = folderName;
 			string xmlfile = Path.Combine(basePath, "IconFactory.gtkx");
 			
 			if (File.Exists (xmlfile)) {
@@ -331,8 +343,18 @@
 			}
 		}
 		
-		void ReadSplitFiles (XmlDocument doc)
+		void ReadActionGroups (XmlDocument doc)
 		{
+			ReadSplitFiles (doc, "action-group", "name");
+		}
+		
+		void ReadTopLevels (XmlDocument doc)
+		{
+			ReadSplitFiles (doc, "widget", "id");
+		}
+		
+		void ReadSplitFiles (XmlDocument doc, string splitElement, string idAttribute)
+		{
 			XmlNode node = doc.SelectSingleNode ("/stetic-interface");
 			if (node == null)
 				return;
@@ -349,88 +371,59 @@
 				
 						XmlNode wnode = wdoc.SelectSingleNode ("/stetic-interface");
 						
-						foreach (XmlNode toplevel in wnode.SelectNodes ("widget | action-group")) {
-							XmlNode imported = doc.ImportNode (toplevel, true);
-							node.AppendChild (imported);
+						foreach (XmlElement toplevel in wnode.SelectNodes (splitElement)) {
+							string id = toplevel.GetAttribute (idAttribute);
+							
+							if (frontend.DesignInfo.HasComponentFile (id)) {
+								XmlNode imported = doc.ImportNode (toplevel, true);
+								node.AppendChild (imported);
+							}
 						}
 					}
 				}
 			}
 		}
 		
+		void AddActionGroup (XmlElement groupElem)
+		{
+			ObjectReader reader = new ObjectReader (this, FileFormat.Native);
+			
+			Wrapper.ActionGroup actionGroup = new Wrapper.ActionGroup ();
+			actionGroup.Read (reader, groupElem);
+			actionGroups.Add (actionGroup);
+		}
+		
+		void AddWidget (XmlElement toplevel)
+		{
+			topLevels.Add (new WidgetData (toplevel.GetAttribute ("id"), toplevel, null));
+		}
+		
 		void Read (XmlDocument doc)
 		{
 			loading = true;
-			string basePath = fileName != null ? Path.GetDirectoryName (fileName) : null;
-			
+
 			try {
-				string fn = fileName;
 				Close ();
-				fileName = fn;
 				
 				XmlNode node = doc.SelectSingleNode ("/stetic-interface");
 				if (node == null)
 					throw new ApplicationException (Catalog.GetString ("Not a Stetic file according to node name."));
 				
-				// Load configuration options
-				foreach (XmlNode configNode in node.SelectNodes ("configuration/*")) {
-					XmlElement config = configNode as XmlElement;
-					if (config == null) continue;
-					
-					if (config.LocalName == "images-root-path")
-						imagesRootPath = config.InnerText;
-					else if (config.LocalName == "target-gtk-version")
-						targetGtkVersion = config.InnerText;
-				}
-				
 				// Load the assembly directories
 				resolver = new AssemblyResolver (app);
-				foreach (XmlElement libElem in node.SelectNodes ("import/assembly-directory")) {
-					string dir = libElem.GetAttribute ("path");
-					if (dir.Length > 0) {
-						if (basePath != null && !Path.IsPathRooted (dir)) {
-							dir = Path.Combine (basePath, dir);
-							if (Directory.Exists (dir))
-								dir = Path.GetFullPath (dir);
-						}
-						resolver.Directories.Add (dir);
-					}
-				}
-				
-				// Import the referenced libraries
-				foreach (XmlElement libElem in node.SelectNodes ("import/widget-library")) {
-					string libname = libElem.GetAttribute ("name");
-					if (libname.EndsWith (".dll") || libname.EndsWith (".exe")) {
-						if (basePath != null && !Path.IsPathRooted (libname)) {
-							libname = Path.Combine (basePath, libname);
-							if (File.Exists (libname))
-								libname = Path.GetFullPath (libname);
-						}
-					}
-					widgetLibraries.Add (libname);
-					if (libElem.GetAttribute ("internal") == "true")
-						internalLibs.Add (libname);
-				}
-				
 				app.LoadLibraries (resolver, widgetLibraries);
 				
-				ObjectReader reader = new ObjectReader (this, FileFormat.Native);
-				
 				if (ownedGlobalActionGroups) {
-					foreach (XmlElement groupElem in node.SelectNodes ("action-group")) {
-						Wrapper.ActionGroup actionGroup = new Wrapper.ActionGroup ();
-						actionGroup.Read (reader, groupElem);
-						actionGroups.Add (actionGroup);
-					}
+					foreach (XmlElement groupElem in node.SelectNodes ("action-group")) 
+						AddActionGroup (groupElem);
 				}
 				
 				XmlElement iconsElem = node.SelectSingleNode ("icon-factory") as XmlElement;
 				if (iconsElem != null)
 					iconFactory.Read (this, iconsElem);
 				
-				foreach (XmlElement toplevel in node.SelectNodes ("widget")) {
-					topLevels.Add (new WidgetData (toplevel.GetAttribute ("id"), toplevel, null));
-				}
+				foreach (XmlElement toplevel in node.SelectNodes ("widget"))
+					AddWidget (toplevel);
 				
 			} finally {
 				loading = false;
@@ -443,8 +436,9 @@
 				try {
 					loading = true;
 					ObjectReader reader = new ObjectReader (this, FileFormat.Native);
-					Wrapper.Container wrapper = Stetic.ObjectWrapper.ReadObject (reader, data.XmlData) as Wrapper.Container;
+					Wrapper.Container wrapper = Stetic.ObjectWrapper.ReadObject (reader, data.XmlData, null) as Wrapper.Container;
 					data.Widget = wrapper.Wrapped;
+					data.Widget.Destroyed += (s,e) => data.Widget = null;
 				} finally {
 					loading = false;
 				}
@@ -453,9 +447,62 @@
 			return data.Widget;
 		}
 		
-		public void Save (string fileName)
+		public bool ReloadTopLevel (string topLevelName)
 		{
-			this.fileName = fileName;
+			XmlElement topLevelElem = ReadDesignerFile (topLevelName, "widget");
+			if (topLevelName != null) {
+				WidgetData data = GetWidgetData (topLevelName);
+			
+				if (data != null) {
+					//Stetic.Wrapper.Widget ww = Stetic.Wrapper.Widget.Lookup (data.Widget);
+					data.SetXmlData (topLevelName, topLevelElem);
+					GetWidget (data);
+					return true;
+				}
+			}
+			return false;
+		}
+		
+		public void ReloadActionGroup (string groupName)
+		{
+			
+		}
+		
+		XmlElement ReadDesignerFile (string componentName, string elementName)
+		{
+			string gtkxFile = GetDesignerFileName (componentName);
+			if (gtkxFile != null) {
+				XmlDocument wdoc = new XmlDocument ();
+				wdoc.PreserveWhitespace = true;
+				wdoc.Load (gtkxFile);
+		
+				XmlNode wnode = wdoc.SelectSingleNode ("/stetic-interface");
+				foreach (XmlElement toplevel in wnode.SelectNodes (elementName)) {
+					return toplevel;
+				}
+				
+				string msg = string.Format (@"Cannot find /stetic-interface/{0} element in {1} file.", 
+				                             elementName, gtkxFile);
+				throw new InvalidOperationException (msg);
+			}
+			
+			return null;
+		}
+		
+		public void ConvertProject (string oldSteticFileName, string newGuiFolderName)
+		{
+			converting = true;
+			try {
+				LoadOldVersion (oldSteticFileName);
+				Save (newGuiFolderName);
+			} finally {
+				converting = false;
+			}
+		}
+		
+		public void Save (string folderName)
+		{
+			this.folderName = folderName;
 			XmlDocument doc = Write (false);
 			
 			XmlTextWriter writer = null;
@@ -463,15 +510,7 @@
 				WriteIconFactory (doc);
 				WriteActionGroups (doc);
 				WriteTopLevels (doc);
-				// Write to a temporary file first, just in case something fails
-				writer = new XmlTextWriter (fileName + "~", System.Text.Encoding.UTF8);
-				writer.Formatting = Formatting.Indented;
-				doc.Save (writer);
-				writer.Close ();
-				
-				File.Copy (fileName + "~", fileName, true);
-				File.Delete (fileName + "~");
-			
+
 			} finally {
 				if (writer != null)
 					writer.Close ();
@@ -497,7 +536,7 @@
 			XmlNode ifnode2 = doc2.ImportNode (ifnode, true);
 			node2.AppendChild (ifnode2);
 			
-			string basePath = this.fileName != null ? Path.GetDirectoryName (this.fileName) : null;
+			string basePath = this.folderName;
 			string xmlFile = Path.Combine (basePath, "IconFactory.gtkx");
 			WriteXmlFile (xmlFile, doc2);
 			
@@ -520,34 +559,35 @@
 			if (node == null)
 				return;
 			
-			List<XmlElement> toplevels = new List<XmlElement> ();
 			foreach (XmlElement toplevel in node.SelectNodes (splitElement)) {
 					
 					string id = toplevel.GetAttribute (idAttribute);
-					string basePath = frontend.DesignInfo.GetComponentFolder (id);
-					string xmlFile = Path.Combine (basePath, id + ".gtkx");
-					
-					XmlDocument doc2 = new XmlDocument ();
-					doc2.PreserveWhitespace = true;
-
-					XmlElement node2 = doc2.CreateElement ("stetic-interface");
-					doc2.AppendChild (node2);
-				
-					XmlNode wnode2 = doc2.ImportNode (toplevel, true);
-					node2.AppendChild (wnode2);
-				
-					//after saving component need to remove its xml element definition, 
-					//otherwise it would be saved in gui.stetic
-					toplevels.Add (toplevel);	
-				
-					WriteXmlFile (xmlFile, doc2);
+					if (modifiedTopLevels.Contains (id) || converting) {
+						string xmlFile = GetDesignerFileName (id);
+						if (xmlFile != null) {
+							XmlDocument doc2 = new XmlDocument ();
+							doc2.PreserveWhitespace = true;
+							                     
+							XmlElement node2 = doc2.CreateElement ("stetic-interface");
+							doc2.AppendChild (node2);
+						
+							XmlNode wnode2 = doc2.ImportNode (toplevel, true);
+							node2.AppendChild (wnode2);
+						
+							WriteXmlFile (xmlFile, doc2);
+							if (modifiedTopLevels.Contains (id))
+								modifiedTopLevels.Remove (id);
+						}
+					}
 			}	
-			
-			foreach (XmlElement toplevel in toplevels)
-				//now it is safe to remove
-				node.RemoveChild (toplevel);
 		}
 		
+		private string GetDesignerFileName (string componentName)
+		{
+			string componentFile = frontend.DesignInfo.GetComponentFile (componentName);			
+			return frontend.DesignInfo.GetGtkxFile (componentFile);
+		}
+		
 		void WriteXmlFile (string xmlFile, XmlDocument doc)
 		{
 			XmlTextWriter writer = null;
@@ -574,52 +614,6 @@
 			XmlElement toplevel = doc.CreateElement ("stetic-interface");
 			doc.AppendChild (toplevel);
 
-			XmlElement config = doc.CreateElement ("configuration");
-			if (!string.IsNullOrEmpty (imagesRootPath)) {
-				XmlElement iroot = doc.CreateElement ("images-root-path");
-				iroot.InnerText = imagesRootPath;
-				config.AppendChild (iroot);
-			}
-			if (!string.IsNullOrEmpty (targetGtkVersion)) {
-				XmlElement iroot = doc.CreateElement ("target-gtk-version");
-				iroot.InnerText = targetGtkVersion;
-				config.AppendChild (iroot);
-			}
-			
-			if (config.ChildNodes.Count > 0)
-				toplevel.AppendChild (config);
-			
-			if (widgetLibraries.Count > 0 || (resolver != null && resolver.Directories.Count > 0)) {
-				XmlElement importElem = doc.CreateElement ("import");
-				toplevel.AppendChild (importElem);
-				string basePath = Path.GetDirectoryName (fileName);
-				
-				if (resolver != null && resolver.Directories.Count > 0) {
-					foreach (string dir in resolver.Directories) {
-						XmlElement dirElem = doc.CreateElement ("assembly-directory");
-						if (basePath != null)
-							dirElem.SetAttribute ("path", AbsoluteToRelativePath (basePath, dir));
-						else
-							dirElem.SetAttribute ("path", dir);
-						toplevel.AppendChild (dirElem);
-					}
-				}
-				
-				foreach (string wlib in widgetLibraries) {
-					string libName = wlib;
-					XmlElement libElem = doc.CreateElement ("widget-library");
-					if (wlib.EndsWith (".dll") || wlib.EndsWith (".exe")) {
-						if (basePath != null)
-							libName = AbsoluteToRelativePath (basePath, wlib);
-					}
-
-					libElem.SetAttribute ("name", libName);
-					if (IsInternalLibrary (wlib))
-						libElem.SetAttribute ("internal", "true");
-					importElem.AppendChild (libElem);
-				}
-			}
-
 			ObjectWriter writer = new ObjectWriter (doc, FileFormat.Native);
 			writer.CreateUndoInfo = includeUndoInfo;
 			if (ownedGlobalActionGroups) {
@@ -670,9 +664,14 @@
 			}
 		}
 		
-		internal WidgetEditSession CreateWidgetDesignerSession (WidgetDesignerFrontend frontend, string windowName, Stetic.ProjectBackend editingBackend, bool autoCommitChanges)
+//		internal WidgetEditSession CreateWidgetDesignerSession (WidgetDesignerFrontend frontend, string windowName, Stetic.ProjectBackend editingBackend, bool autoCommitChanges)
+//		{
+//			return new WidgetEditSession (this, frontend, windowName, editingBackend, autoCommitChanges);
+//		}
+		
+		internal WidgetEditSession CreateWidgetDesignerSession (WidgetDesignerFrontend frontend, string windowName)
 		{
-			return new WidgetEditSession (this, frontend, windowName, editingBackend, autoCommitChanges);
+			return new WidgetEditSession (this, frontend, windowName);
 		}
 		
 		internal ActionGroupEditSession CreateGlobalActionGroupDesignerSession (ActionGroupDesignerFrontend frontend, string groupName, bool autoCommitChanges)
@@ -687,7 +686,7 @@
 		
 		public Wrapper.Container GetTopLevelWrapper (string name, bool throwIfNotFound)
 		{
-			Gtk.Widget w = GetTopLevel (name);
+			Gtk.Widget w = GetWidget (name);
 			if (w != null) {
 				Wrapper.Container ww = Wrapper.Container.Lookup (w);
 				if (ww != null)
@@ -698,6 +697,23 @@
 			return null;
 		}
 		
+		public object AddNewComponent (string fileName)
+		{
+			XmlDocument doc = new XmlDocument();
+			doc.PreserveWhitespace = true;
+			doc.Load (fileName);
+			
+			XmlElement toplevel = (XmlElement)doc.SelectSingleNode ("/stetic-interface/widget");
+			if (toplevel != null)
+				return AddNewWidgetFromTemplate (toplevel.OuterXml);
+			
+			XmlElement groupElem = (XmlElement)doc.SelectSingleNode ("/stetic-interface/action-group");
+			if (groupElem != null)
+				return AddNewActionGroupFromTemplate (groupElem.OuterXml);
+			
+			return null;
+		}
+		
 		public object AddNewWidget (string type, string name)
 		{
 			ClassDescriptor cls = Registry.LookupClassByName (type);
@@ -724,22 +740,9 @@
 			
 			if (frontend != null)
 				frontend.NotifyWidgetRemoved (data.Name);
-		
-			XmlElement elem;
-			if (data.Widget != null)
-				elem = Stetic.WidgetUtils.ExportWidget (data.Widget);
-			else
-				elem = (XmlElement) data.XmlData.Clone ();
-			XmlDocument doc = new XmlDocument ();
-			XmlNode node = doc.ImportNode (elem, true);
-			doc.AppendChild (node);
-			string dir = Path.Combine (Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "stetic"), "deleted-designs");
-			if (!Directory.Exists (dir))
-				Directory.CreateDirectory (dir);
-			doc.Save (Path.Combine (dir, name + ".xml"));
-			topLevels.Remove (data);
-			if (data.Widget != null)
-				data.Widget.Destroy ();
+			
+			if (modifiedTopLevels.Contains (name))
+				modifiedTopLevels.Remove (name);
 		}
 		
 		public Stetic.Wrapper.ActionGroup AddNewActionGroup (string name)
@@ -747,6 +750,7 @@
 			Stetic.Wrapper.ActionGroup group = new Stetic.Wrapper.ActionGroup ();
 			group.Name = name;
 			ActionGroups.Add (group);
+			this.modifiedTopLevels.Add (name);
 			return group;
 		}
 		
@@ -758,12 +762,16 @@
 			Stetic.Wrapper.ActionGroup group = new Stetic.Wrapper.ActionGroup ();
 			group.Read (or, doc.DocumentElement);
 			ActionGroups.Add (group);
+			this.modifiedTopLevels.Add (group.Name);
 			return group;
 		}
 		
 		public void RemoveActionGroup (Stetic.Wrapper.ActionGroup group)
 		{
 			ActionGroups.Remove (group);
+			string name = group.Name;
+			if (modifiedTopLevels.Contains (name))
+				modifiedTopLevels.Remove (name);
 		}
 		
 		public Wrapper.ActionGroup[] GetActionGroups ()
@@ -771,40 +779,7 @@
 			// Needed since ActionGroupCollection can't be made serializable
 			return ActionGroups.ToArray ();
 		}
-				
-		public void CopyWidgetToProject (string name, ProjectBackend other, string replacedName)
-		{
-			WidgetData wdata = GetWidgetData (name);
-			if (name == null)
-				throw new InvalidOperationException ("Component not found: " + name);
 			
-			XmlElement data;
-			if (wdata.Widget != null)
-				data = Stetic.WidgetUtils.ExportWidget (wdata.Widget);
-			else
-				data = (XmlElement) wdata.XmlData.Clone ();
-			
-			// If widget already exist, replace it
-			wdata = other.GetWidgetData (replacedName);
-			if (wdata == null) {
-				wdata = new WidgetData (name, data, null);
-				other.topLevels.Add (wdata);
-			} else {
-				if (wdata.Widget != null) {
-					// If a widget instance already exist, load the new data on it
-					Wrapper.Widget sw = Wrapper.Widget.Lookup (wdata.Widget);
-					sw.Read (new ObjectReader (other, FileFormat.Native), data);
-					sw.NotifyChanged ();
-					if (name != replacedName)
-						other.OnWidgetNameChanged (new Wrapper.WidgetNameChangedArgs (sw, replacedName, name), true);
-				} else {
-					wdata.SetXmlData (name, data);
-					if (name != replacedName)
-						other.OnWidgetNameChanged (new Wrapper.WidgetNameChangedArgs (null, replacedName, name), true);
-				}
-			}
-		}
-			
 		void CleanUndoData (XmlElement elem)
 		{
 			elem.RemoveAttribute ("undoId");
@@ -861,10 +836,19 @@
 			NotifyComponentTypesChanged ();
 		}
 		
+		bool preserveWidgetLibraries;
+		
 		public void Reload ()
 		{
-			OnRegistryChanging (null, null);
-			OnRegistryChanged (null, null);
+			try {
+				preserveWidgetLibraries = true;
+				OnRegistryChanging (null, null);
+				OnRegistryChanged (null, null);
+			}
+			finally
+			{
+				preserveWidgetLibraries = false;
+			}
 		}
 
 		public string Id {
@@ -872,18 +856,16 @@
 			set { id = value; }
 		}
 		
-		public bool Modified {
-			get { return modified; }
-			set {
-				if (modified != value) {
-					modified = value;
-					if (frontend != null)
-						frontend.NotifyModifiedChanged ();
-					OnModifiedChanged (EventArgs.Empty);
-				}
-			}
+		public bool WasModified (string topLevel)
+		{
+			return modifiedTopLevels.Contains (topLevel);
 		}
 		
+		public bool ComponentNeedsCodeGeneration (string topLevel)
+		{
+			return frontend.DesignInfo.ComponentNeedsCodeGeneration (topLevel);
+		}
+		
 		public AssemblyResolver Resolver {
 			get { return resolver; }
 		}
@@ -913,6 +895,7 @@
 			
 			if (!loading) {
 				Stetic.Wrapper.Widget ww = Stetic.Wrapper.Widget.Lookup (widget);
+				
 				if (ww == null)
 					throw new InvalidOperationException ("Widget not wrapped");
 				if (frontend != null)
@@ -925,7 +908,7 @@
 		{
 			if (loading)
 				return;
-			NotifyChanged ();
+			NotifyChanged (args.Wrapper.RootWrapperName);
 			if (ObjectChanged != null)
 				ObjectChanged (this, args);
 		}
@@ -934,7 +917,7 @@
 		{
 			if (loading)
 				return;
-			NotifyChanged ();
+			NotifyChanged (args.WidgetWrapper.RootWrapperName);
 			OnWidgetNameChanged (args, args.WidgetWrapper.IsTopLevel);
 		}
 		
@@ -1027,7 +1010,7 @@
 			}
 		}
 		
-		public Gtk.Widget GetTopLevel (string name)
+		public Gtk.Widget GetWidget (string name)
 		{
 			WidgetData w = GetWidgetData (name);
 			if (w != null)
@@ -1174,24 +1157,19 @@
 			OnComponentTypesChanged (null, null);
 		}
 		
-		void NotifyChanged ()
+		void NotifyChanged (string rootWidgetName)
 		{
-			Modified = true;
+			if (!modifiedTopLevels.Contains (rootWidgetName))
+				modifiedTopLevels.Add (rootWidgetName);
 			if (frontend != null)
-				frontend.NotifyChanged ();
+				frontend.NotifyChanged (rootWidgetName);
 			if (Changed != null)
-				Changed (this, EventArgs.Empty);
+				Changed (this, new ProjectChangedEventArgs (rootWidgetName));
 		}
 		
-		protected virtual void OnModifiedChanged (EventArgs args)
-		{
-			if (ModifiedChanged != null)
-				ModifiedChanged (this, args);
-		}
-		
 		protected virtual void OnWidgetAdded (Stetic.Wrapper.WidgetEventArgs args)
 		{
-			NotifyChanged ();
+			NotifyChanged (args.WidgetWrapper.RootWrapperName);
 			if (WidgetAdded != null)
 				WidgetAdded (this, args);
 		}
@@ -1226,4 +1204,16 @@
 			}
 		}
 	}
+	
+	public class ProjectChangedEventArgs : EventArgs
+	{
+		public string ChangedTopLevelName { get; private set; }
+		
+		public ProjectChangedEventArgs (string changedTopLevel)
+		{
+			ChangedTopLevelName = changedTopLevel;
+		}
+	}
+	
+	public delegate void ProjectChangedEventHandler (object sender, ProjectChangedEventArgs args);
 }
Index: libsteticui/IProjectDesignInfo.cs
===================================================================
--- libsteticui/IProjectDesignInfo.cs	(revision 17)
+++ libsteticui/IProjectDesignInfo.cs	(working copy)
@@ -2,14 +2,21 @@
 
 namespace Stetic
 {
-	//Provides access to informations menaged by ide
+	//Provides access to informations managed by ide
 	public interface IProjectDesignInfo
 	{
-		//Returns component source file folder
-		string GetComponentFolder(string componentName);
+		//Returns component source file for given component
+		string GetComponentFile (string componentName);
+		bool HasComponentFile (string componentFile);
 		
+		//Returns gtkx file name for given component file
+		string GetGtkxFile (string componentFile);
+
 		//Search for all components source file folders 
 		string[] GetComponentFolders ();
+		
+		// Checks if code generation for a component is needed
+		bool ComponentNeedsCodeGeneration (string componentName);
 	}
 }
 
Index: libsteticui/WidgetEditSession.cs
===================================================================
--- libsteticui/WidgetEditSession.cs	(revision 17)
+++ libsteticui/WidgetEditSession.cs	(working copy)
@@ -39,14 +39,12 @@
 	internal class WidgetEditSession: MarshalByRefObject, IDisposable
 	{
 		string sourceWidget;
-		Stetic.ProjectBackend sourceProject;
+		Stetic.ProjectBackend project;
 		
-		Stetic.ProjectBackend gproject;
 		Stetic.Wrapper.Container rootWidget;
 		Stetic.WidgetDesignerBackend widget;
 		Gtk.VBox designer;
 		Gtk.Plug plug;
-		bool autoCommitChanges;
 		WidgetActionBar toolbar;
 		WidgetDesignerFrontend frontend;
 		bool allowBinding;
@@ -55,61 +53,27 @@
 		ContainerUndoRedoManager undoManager;
 		UndoQueue undoQueue;
 		
-		public event EventHandler ModifiedChanged;
 		public event EventHandler RootWidgetChanged;
 		public event Stetic.Wrapper.WidgetEventHandler SelectionChanged;
 		
-		public WidgetEditSession (ProjectBackend sourceProject, WidgetDesignerFrontend frontend, string windowName, Stetic.ProjectBackend editingBackend, bool autoCommitChanges)
+		public WidgetEditSession (ProjectBackend sourceProject, WidgetDesignerFrontend frontend, string windowName)
 		{
 			this.frontend = frontend;
-			this.autoCommitChanges = autoCommitChanges;
 			undoManager = new ContainerUndoRedoManager ();
 			undoQueue = new UndoQueue ();
 			undoManager.UndoQueue = undoQueue;
 			
 			sourceWidget = windowName;
-			this.sourceProject = sourceProject;
-			
-			if (!autoCommitChanges) {
-				// Reuse the action groups and icon factory of the main project
-				gproject = editingBackend;
-				
-				// Attach will prevent the destruction of the action group list by gproject
-				gproject.AttachActionGroups (sourceProject.ActionGroups);
-				
-				gproject.IconFactory = sourceProject.IconFactory;
-				gproject.FileName = sourceProject.FileName;
-				gproject.ImagesRootPath = sourceProject.ImagesRootPath;
-				gproject.ResourceProvider = sourceProject.ResourceProvider;
-				gproject.WidgetLibraries = (ArrayList) sourceProject.WidgetLibraries.Clone ();
-				gproject.InternalWidgetLibraries = (ArrayList) sourceProject.InternalWidgetLibraries.Clone ();
-				gproject.TargetGtkVersion = sourceProject.TargetGtkVersion;
-				sourceProject.ComponentTypesChanged += OnSourceProjectLibsChanged;
-				sourceProject.ProjectReloaded += OnSourceProjectReloaded;
-				
-				rootWidget = editingBackend.GetTopLevelWrapper (sourceWidget, false);
-				if (rootWidget == null) {
-					// Copy the widget to edit from the source project
-					// When saving the file, this project will be merged with the main project.
-					sourceProject.CopyWidgetToProject (windowName, gproject, windowName);
-					rootWidget = gproject.GetTopLevelWrapper (windowName, true);
-				}
-				
-				gproject.Modified = false;
-			}
-			else {
-				rootWidget = sourceProject.GetTopLevelWrapper (windowName, true);
-				gproject = sourceProject;
-			}
-			
+			this.project = sourceProject;
+						
+			rootWidget = sourceProject.GetTopLevelWrapper (windowName, true);
 			rootWidget.Select ();
 			undoManager.RootObject = rootWidget;
 			
-			gproject.ModifiedChanged += new EventHandler (OnModifiedChanged);
-			gproject.Changed += new EventHandler (OnChanged);
-			gproject.ProjectReloaded += new EventHandler (OnProjectReloaded);
-			gproject.ProjectReloading += new EventHandler (OnProjectReloading);
-//			gproject.WidgetMemberNameChanged += new Stetic.Wrapper.WidgetNameChangedHandler (OnWidgetNameChanged);
+			this.project.Changed += new ProjectChangedEventHandler (OnChanged);
+			this.project.ProjectReloaded += new EventHandler (OnProjectReloaded);
+			this.project.ProjectReloading += new EventHandler (OnProjectReloading);
+//			this.project.WidgetMemberNameChanged += new Stetic.Wrapper.WidgetNameChangedHandler (OnWidgetNameChanged);
 		}
 		
 		public bool AllowWidgetBinding {
@@ -144,7 +108,8 @@
 					designer.BorderWidth = 3;
 					designer.PackStart (toolbar, false, false, 0);
 					designer.PackStart (widget, true, true, 3);
-					widget.DesignArea.SetSelection (gproject.Selection, gproject.Selection, false);
+					widget.DesignArea.SetSelection (project.Selection, project.Selection, false);
+					
 					widget.SelectionChanged += OnSelectionChanged;
 				
 				}
@@ -173,42 +138,24 @@
 		}
 		
 		public void Save ()
-		{
-			if (!autoCommitChanges) {
-				gproject.CopyWidgetToProject (rootWidget.Wrapped.Name, sourceProject, sourceWidget);
-				sourceWidget = rootWidget.Wrapped.Name;
-				gproject.Modified = false;
-			}
+		{		
 		}
 		
 		public ProjectBackend EditingBackend {
-			get { return gproject; }
+			get { return project; }
 		}
 		
 		public void Dispose ()
 		{
-			sourceProject.ComponentTypesChanged -= OnSourceProjectLibsChanged;
-			sourceProject.ProjectReloaded -= OnSourceProjectReloaded;
+			project.ComponentTypesChanged -= OnSourceProjectLibsChanged;
+			project.ProjectReloaded -= OnSourceProjectReloaded;
+			project.Changed -= new ProjectChangedEventHandler (OnChanged);
+			project.ProjectReloaded -= OnProjectReloaded;
+			project.ProjectReloading -= OnProjectReloading;
+//			project.WidgetMemberNameChanged -= new Stetic.Wrapper.WidgetNameChangedHandler (OnWidgetNameChanged);
 			
-			gproject.ModifiedChanged -= new EventHandler (OnModifiedChanged);
-			gproject.Changed -= new EventHandler (OnChanged);
-			gproject.ProjectReloaded -= OnProjectReloaded;
-			gproject.ProjectReloading -= OnProjectReloading;
-//			gproject.WidgetMemberNameChanged -= new Stetic.Wrapper.WidgetNameChangedHandler (OnWidgetNameChanged);
-			
-			if (!autoCommitChanges) {
-				// Don't dispose the project here! it will be disposed by the frontend
-				if (widget != null) {
-					widget.SelectionChanged -= OnSelectionChanged;
-					// Don't dispose the widget. It will be disposed when destroyed together
-					// with the container
-					widget = null;
-				}
-			}
-			
 			if (plug != null)
 				plug.Destroy ();
-			gproject = null;
 			rootWidget = null;
 			frontend = null;
 			System.Runtime.Remoting.RemotingServices.Disconnect (this);
@@ -231,7 +178,7 @@
 		}
 		
 		public bool Modified {
-			get { return gproject.Modified; }
+			get { return project.WasModified (RootWidget.Name); }
 		}
 		
 		public UndoQueue UndoQueue {
@@ -243,32 +190,22 @@
 			}
 		}
 		
-		void OnModifiedChanged (object s, EventArgs a)
+		void OnChanged (object s, ProjectChangedEventArgs a)
 		{
+			if (a.ChangedTopLevelName != RootWidget.Name)
+				return;
+			
 			if (frontend != null)
-				frontend.NotifyModifiedChanged ();
-		}
-		
-		void OnChanged (object s, EventArgs a)
-		{
-			if (frontend != null)
 				frontend.NotifyChanged ();
 		}
 		
 		void OnSourceProjectReloaded (object s, EventArgs a)
 		{
-			// Propagate gtk version change
-			if (sourceProject.TargetGtkVersion != gproject.TargetGtkVersion)
-				gproject.TargetGtkVersion = sourceProject.TargetGtkVersion;
+			
 		}
 		
 		void OnSourceProjectLibsChanged (object s, EventArgs a)
 		{
-			// If component types have changed in the source project, they must also change
-			// in this project.
-			gproject.WidgetLibraries = (ArrayList) sourceProject.WidgetLibraries.Clone ();
-			gproject.InternalWidgetLibraries = (ArrayList) sourceProject.InternalWidgetLibraries.Clone ();
-			gproject.NotifyComponentTypesChanged ();
 		}
 		
 		void OnProjectReloading (object s, EventArgs a)
@@ -279,16 +216,10 @@
 		
 		void OnProjectReloaded (object s, EventArgs a)
 		{
-			// Update the actions group list
-			if (!autoCommitChanges) {
-				gproject.AttachActionGroups (sourceProject.ActionGroups);
-				gproject.WidgetLibraries = (ArrayList) sourceProject.WidgetLibraries.Clone ();
-				gproject.InternalWidgetLibraries = (ArrayList) sourceProject.InternalWidgetLibraries.Clone ();
-			}
+			Gtk.Widget topWidget = project.GetWidget (sourceWidget);
 			
-			Gtk.Widget[] tops = gproject.Toplevels;
-			if (tops.Length > 0) {
-				rootWidget = Stetic.Wrapper.Container.Lookup (tops[0]);
+			if (topWidget != null) {
+				rootWidget = Stetic.Wrapper.Container.Lookup (topWidget);
 				undoManager.RootObject = rootWidget;
 				if (rootWidget != null) {
 					Gtk.Widget oldWidget = designer;
@@ -305,8 +236,8 @@
 							return false;
 						});
 					}
-						
-					gproject.NotifyComponentTypesChanged ();
+									
+					project.NotifyComponentTypesChanged ();
 					return;
 				}
 			}
@@ -375,7 +306,7 @@
 		public object SaveState ()
 		{
 			return new object[] {
-				gproject.SaveStatus (),
+				project.SaveStatus (),
 				undoQueue
 			};
 		}
@@ -383,7 +314,7 @@
 		public void RestoreState (object sessionData)
 		{
 			object[] status = (object[]) sessionData;
-			gproject.LoadStatus (status [0]);
+			project.LoadStatus (status [0]);
 			undoQueue = (UndoQueue) status [1];
 			foreach (UndoRedoChange ch in undoQueue.Changes) {
 				ObjectWrapperUndoRedoChange och = ch as ObjectWrapperUndoRedoChange;
Index: libsteticui/ChangeLog
===================================================================
--- libsteticui/ChangeLog	(revision 17)
+++ libsteticui/ChangeLog	(working copy)
@@ -1,3 +1,155 @@
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* CodeGenerator.cs:
+	* ProjectBackend.cs:
+	* WidgetEditSession.cs:
+	* CodeGeneratorPartialClass.cs: 
+
+2010-08-13  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* Project.cs: 
+	* Makefile.am:
+	* CodeGenerator.cs:
+	* libsteticui2.csproj:
+	* ActionGroupEditSession.cs: 
+	* CodeGeneratorPartialClass.cs:
+	* CodeGeneratorInternalClass.cs: Remove class
+
+2010-08-09  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* Project.cs: Add ComponentNeedsCodeGeneration method
+	* ProjectBackend.cs:
+	* IProjectDesignInfo.cs:
+	* CodeGeneratorPartialClass.cs: Only generate code for components that
+	have been changed
+
+2010-08-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Project.cs: Remove Modifies property
+	* ProjectBackend.cs: Add modifiedTopLevel list, handled on project loading, saving.
+	* libsteticui2.csproj:
+	* WidgetEditSession.cs: Use ProjectBackend.WasModified to determine if it was modified
+
+2010-08-05  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* WidgetDesigner.cs:
+	* ProjectBackend.cs: 
+
+2010-08-05  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+	Remove ModifiedChanged event, 
+	change Changed event to ProjectChangedEventHandler (pass name of changed widget)
+	* Project.cs: 
+	* WidgetDesigner.cs:
+	* ProjectBackend.cs:
+	* WidgetEditSession.cs: 
+
+2010-08-04  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* Project.cs: Pass root widget name in NotifyChanged
+	* Makefile.am:
+	* ProjectBackend.cs:
+	* libsteticui2.csproj: 
+
+2010-08-03  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Glade.cs:
+	* Makefile.am:
+	* ProjectBackend.cs: 
+
+2010-08-03  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Makefile.am:
+	* ProjectBackend.cs: Return empty string when GtktargetVersion
+						 is not initialized
+
+2010-07-27  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Project.cs: Remove autoCommit argument 
+	* Makefile.am:
+	* WidgetDesigner.cs: Remove temporary project
+	* ProjectBackend.cs: Do not clear libraries on Close
+	* WidgetEditSession.cs: Remove temporary project
+
+2010-07-27  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Project.cs:
+	* WidgetDesigner.cs:
+	* ProjectBackend.cs: 
+
+2010-07-06  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Project.cs: Add parameter to Convert method for passing
+				  a new gtk gui folder name.  
+	* ProjectBackend.cs: 
+
+2010-07-05  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Glade.cs:
+	* Project.cs: AddComponent method 
+	* Makefile.am:
+	* ProjectBackend.cs: 
+	* libsteticui2.csproj: 
+
+2010-06-28  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Project.cs: Find class name for given .gtkx file
+	* Makefile.am:
+	* ProjectBackend.cs:
+	* IProjectDesignInfo.cs: 
+
+2010-06-28  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Makefile.am:
+	* ProjectBackend.cs:
+	* libsteticui2.csproj: 
+
+2010-06-23  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Makefile.am:
+	* libsteticui2.csproj: 
+
+2010-06-23  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Makefile.am:
+	* libsteticui2.csproj: 
+
+2010-06-22  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Makefile.am: 
+
+2010-06-16  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Makefile.am: 
+
+2010-06-15  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Project.cs: Create backend for Convert
+
+2010-06-09  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Makefile.am:
+	* libsteticui2.csproj: 
+
+2010-06-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Project.cs: Transition from project file name to project folder.
+	* Makefile.am:
+	* Application.cs:
+	* ProjectBackend.cs:
+	* WidgetEditSession.cs: 
+
+2010-06-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Project.cs:
+	* Makefile.am:
+	* ProjectBackend.cs: 
+	* IProjectDesignInfo.cs: 
+
+2010-06-02  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Makefile.am:
+	* libsteticui2.csproj: 
+
 2010-04-16  Lluis Sanchez Gual  <lluis@novell.com>
 
 	* CecilSignalDescriptor.cs: Cecil uses '/' as separator for
Index: libsteticui/libsteticui2.csproj
===================================================================
--- libsteticui/libsteticui2.csproj	(revision 17)
+++ libsteticui/libsteticui2.csproj	(working copy)
@@ -60,17 +60,34 @@
       <SpecificVersion>False</SpecificVersion>
     </Reference>
     <Reference Include="System.Core" />
+    <Reference Include="NRefactory, Version=2.1.1.0, Culture=neutral, PublicKeyToken=efe927acf176eea2">
+      <Package>monodevelop</Package>
+    </Reference>
+    <Reference Include="Mono.TextEditor, Version=1.0.0.0, Culture=neutral">
+      <Package>monodevelop</Package>
+    </Reference>
+    <Reference Include="MonoDevelop.Core, Version=2.4.0.0, Culture=neutral">
+      <Package>monodevelop</Package>
+    </Reference>
+    <Reference Include="MonoDevelop.Ide, Version=2.4.0.0, Culture=neutral">
+      <Package>monodevelop</Package>
+    </Reference>
+    <Reference Include="Mono.Debugging, Version=0.0.0.0, Culture=neutral, PublicKeyToken=9307d64546e0580d">
+      <Package>monodevelop</Package>
+    </Reference>
+    <Reference Include="Mono.Cecil, Version=0.6.9.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
+      <Package>monodevelop</Package>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\libstetic\libstetic2.csproj">
+      <Project>{90CBA7FD-CB46-4711-97BB-2420DC01F016}</Project>
+      <Name>libstetic2</Name>
+    </ProjectReference>
     <ProjectReference Include="..\..\..\..\contrib\Mono.Cecil\Mono.Cecil.csproj">
       <Project>{3EC06433-F168-4C5B-A885-99CE4AB617E1}</Project>
       <Name>Mono.Cecil</Name>
-      <Private>False</Private>
     </ProjectReference>
-    <ProjectReference Include="..\libstetic\libstetic2.csproj">
-      <Project>{90CBA7FD-CB46-4711-97BB-2420DC01F016}</Project>
-      <Name>libstetic2</Name>
-    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="ActionComponent.cs" />
@@ -90,7 +107,6 @@
     <Compile Include="CecilWidgetLibrary.cs" />
     <Compile Include="CodeGenerationResult.cs" />
     <Compile Include="CodeGenerator.cs" />
-    <Compile Include="CodeGeneratorInternalClass.cs" />
     <Compile Include="CodeGeneratorPartialClass.cs" />
     <Compile Include="Component.cs" />
     <Compile Include="ComponentEventHandler.cs" />
Index: libsteticui/ActionGroupEditSession.cs
===================================================================
--- libsteticui/ActionGroupEditSession.cs	(revision 17)
+++ libsteticui/ActionGroupEditSession.cs	(working copy)
@@ -197,6 +197,9 @@
 			get { return modified; }
 			set { modified = value; frontend.NotifyModified (); }
 		}
+//		public bool Modified {
+//			get { return project.WasModified (); }
+//		}
 		
 		public string ActiveGroup {
 			get {
Index: libsteticui/CodeGenerator.cs
===================================================================
--- libsteticui/CodeGenerator.cs	(revision 17)
+++ libsteticui/CodeGenerator.cs	(working copy)
@@ -36,13 +36,13 @@
 			ArrayList warningList = new ArrayList ();
 			
 			List<SteticCompilationUnit> units = new List<SteticCompilationUnit> ();
-			SteticCompilationUnit globalUnit = new SteticCompilationUnit ("");
-			units.Add (globalUnit);
+//			SteticCompilationUnit globalUnit = new SteticCompilationUnit ("");
+//			units.Add (globalUnit);
 			
 			if (options == null)
 				options = new GenerationOptions ();
 			CodeNamespace globalNs = new CodeNamespace (options.GlobalNamespace);
-			globalUnit.Namespaces.Add (globalNs);
+//			globalUnit.Namespaces.Add (globalNs);
 			
 			// Global class
 			
@@ -73,11 +73,7 @@
 			warningList.AddRange (initContext.Warnings);
 					
 			// Generate the code
-			
-			if (options.UsePartialClasses)
-				CodeGeneratorPartialClass.GenerateProjectGuiCode (globalUnit, globalNs, globalType, options, units, projects, warningList);
-			else
-				CodeGeneratorInternalClass.GenerateProjectGuiCode (globalUnit, globalNs, globalType, options, units, projects, warningList);
+			CodeGeneratorPartialClass.GenerateProjectGuiCode (globalNs, globalType, options, units, projects, warningList);
 
 			GenerateProjectActionsCode (globalNs, options, projects);
 			
@@ -108,6 +104,19 @@
 			initMethod.Statements.Clear ();
 			initMethod.Statements.Add (initCondition);
 			
+			//create separate compilation unit for each type in the global namespace
+			//and insert them at the begining of the units list.
+			int index = 0;
+			foreach (CodeTypeDeclaration type in globalNs.Types)
+			{
+				SteticCompilationUnit unit = new SteticCompilationUnit (type.Name);
+				CodeNamespace ns = new CodeNamespace (globalNs.Name);
+				
+				ns.Types.Add (type);
+				unit.Namespaces.Add (ns);
+				units.Insert (index++, unit);
+			}
+			
 			return new CodeGenerationResult (units.ToArray (), (string[]) warningList.ToArray (typeof(string)));
 		}
 		
@@ -116,26 +125,11 @@
 			foreach (Signal signal in wrapper.Signals) {
 				SignalDescriptor descriptor = signal.SignalDescriptor;
 				
-				CodeExpression createDelegate;
+				CodeExpression createDelegate = new CodeDelegateCreateExpression (
+						new CodeTypeReference (descriptor.HandlerTypeName, CodeTypeReferenceOptions.GlobalReference),
+						new CodeThisReferenceExpression (),
+						signal.Handler);
 				
-				if (options.UsePartialClasses) {
-					createDelegate =
-						new CodeDelegateCreateExpression (
-							new CodeTypeReference (descriptor.HandlerTypeName, CodeTypeReferenceOptions.GlobalReference),
-							new CodeThisReferenceExpression (),
-							signal.Handler);
-				} else {
-					createDelegate =
-						new CodeMethodInvokeExpression (
-							new CodeTypeReferenceExpression (new CodeTypeReference (typeof(Delegate), CodeTypeReferenceOptions.GlobalReference)),
-							"CreateDelegate",
-							new CodeTypeOfExpression (descriptor.HandlerTypeName),
-							targetObjectVar,
-							new CodePrimitiveExpression (signal.Handler));
-					
-					createDelegate = new CodeCastExpression (descriptor.HandlerTypeName.ToGlobalTypeRef (), createDelegate);
-				}
-				
 				CodeAttachEventStatement cevent = new CodeAttachEventStatement (
 					new CodeEventReferenceExpression (
 						map.GetWidgetExp (wrapper),
@@ -374,7 +368,7 @@
 			if (memberName == null)
 				return base.GenerateInstanceExpression (wrapper, newObject);
 			
-			if (Options.UsePartialClasses) {
+//			if (Options.UsePartialClasses) {
 				// Don't generate fields for top level widgets and for widgets accessible
 				// through other widget's properties
 				Wrapper.Widget ww = wrapper as Wrapper.Widget;
@@ -399,19 +393,19 @@
 					return var;
 				} else 
 					return base.GenerateInstanceExpression (wrapper, newObject);
-			} else {
-				CodeExpression var = base.GenerateInstanceExpression (wrapper, newObject);
-				Statements.Add (
-					new CodeAssignStatement (
-						new CodeIndexerExpression (
-							new CodeVariableReferenceExpression ("bindings"),
-							new CodePrimitiveExpression (memberName)
-						),
-						var
-					)
-				);
-				return var;
-			}
+//			} else {
+//				CodeExpression var = base.GenerateInstanceExpression (wrapper, newObject);
+//				Statements.Add (
+//					new CodeAssignStatement (
+//						new CodeIndexerExpression (
+//							new CodeVariableReferenceExpression ("bindings"),
+//							new CodePrimitiveExpression (memberName)
+//						),
+//						var
+//					)
+//				);
+//				return var;
+//			}
 		}
 	}
 	
@@ -429,5 +423,10 @@
 			get { return name; }
 			internal set { name = value; }
 		}
+		
+		public CodeNamespace Namespace 
+		{
+			get { return (Namespaces.Count > 0) ? Namespaces [0] : null; }
+		}
 	}
 }
Index: libsteticui/CodeGeneratorPartialClass.cs
===================================================================
--- libsteticui/CodeGeneratorPartialClass.cs	(revision 17)
+++ libsteticui/CodeGeneratorPartialClass.cs	(working copy)
@@ -11,32 +11,47 @@
 {
 	internal static class CodeGeneratorPartialClass
 	{
-		public static void GenerateProjectGuiCode (SteticCompilationUnit globalUnit, CodeNamespace globalNs, CodeTypeDeclaration globalType, GenerationOptions options, List<SteticCompilationUnit> units, ProjectBackend[] projects, ArrayList warnings)
+		public static void GenerateProjectGuiCode (CodeNamespace globalNs, CodeTypeDeclaration globalType, GenerationOptions options, List<SteticCompilationUnit> units, ProjectBackend[] projects, ArrayList warnings)
 		{
 			// Generate code for each project
 			foreach (ProjectBackend gp in projects) {
 			
 				// Generate top levels
-				foreach (Gtk.Widget w in gp.Toplevels)
-					GenerateWidgetCode (globalUnit, globalNs, options, units, w, warnings);
+				foreach (Gtk.Widget w in gp.Toplevels) {
+					Stetic.Wrapper.Widget wwidget = Stetic.Wrapper.Widget.Lookup (w);
+					string topLevelName = wwidget.Name;
+					if (gp.ComponentNeedsCodeGeneration (topLevelName)) {
+						//designer file for widget could be changed beyond stetic process 
+						//and we nead update wrapper before code generation
+						//during reloading wrappered widget w could be changed;
+						Gtk.Widget currentw = w;
+						if (gp.ReloadTopLevel (topLevelName)) {
+							currentw = gp.GetWidget (topLevelName);
+						}
+						GenerateWidgetCode (globalNs, options, units, currentw, warnings);
+					}
+				}
 					
 				// Generate global action groups
-				foreach (Wrapper.ActionGroup agroup in gp.ActionGroups)
-					GenerateGlobalActionGroupCode (globalUnit, globalNs, options, units, agroup, warnings);
+				foreach (Wrapper.ActionGroup agroup in gp.ActionGroups) {
+					string groupName = agroup.Name;
+					if (gp.ComponentNeedsCodeGeneration (groupName)) {
+						//designer file for action group could be changed beyond stetic process 
+						//and we nead update wrapper
+						gp.ReloadActionGroup (groupName);
+						GenerateGlobalActionGroupCode (globalNs, options, units, agroup, warnings);
+					}
+				}
 			}
 		}
 		
-		static CodeTypeDeclaration CreatePartialClass (SteticCompilationUnit globalUnit, List<SteticCompilationUnit> units, GenerationOptions options, string name)
+		static CodeTypeDeclaration CreatePartialClass (List<SteticCompilationUnit> units, GenerationOptions options, string name)
 		{
 			SteticCompilationUnit unit;
-			
-			if (options.GenerateSingleFile)
-				unit = globalUnit;
-			else {
-				unit = new SteticCompilationUnit (name);
-				units.Add (unit);
-			}
-			
+	
+			unit = new SteticCompilationUnit (name);
+			units.Add (unit);
+					
 			string ns = "";
 			int i = name.LastIndexOf ('.');
 			if (i != -1) {
@@ -56,11 +71,11 @@
 		}
 		
 		
-		static void GenerateWidgetCode (SteticCompilationUnit globalUnit, CodeNamespace globalNs, GenerationOptions options, List<SteticCompilationUnit> units, Gtk.Widget w, ArrayList warnings)
+		static void GenerateWidgetCode (CodeNamespace globalNs, GenerationOptions options, List<SteticCompilationUnit> units, Gtk.Widget w, ArrayList warnings)
 		{
 			// Generate the build method
 			
-			CodeTypeDeclaration type = CreatePartialClass (globalUnit, units, options, w.Name);
+			CodeTypeDeclaration type = CreatePartialClass (units, options, w.Name);
 			CodeMemberMethod met = new CodeMemberMethod ();
 			met.Name = "Build";
 			type.Members.Add (met);
@@ -107,9 +122,9 @@
 		}
 
 		
-		static void GenerateGlobalActionGroupCode (SteticCompilationUnit globalUnit, CodeNamespace globalNs, GenerationOptions options, List<SteticCompilationUnit> units, Wrapper.ActionGroup agroup, ArrayList warnings)
+		static void GenerateGlobalActionGroupCode (CodeNamespace globalNs, GenerationOptions options, List<SteticCompilationUnit> units, Wrapper.ActionGroup agroup, ArrayList warnings)
 		{
-			CodeTypeDeclaration type = CreatePartialClass (globalUnit, units, options, agroup.Name);
+			CodeTypeDeclaration type = CreatePartialClass (units, options, agroup.Name);
 			
 			// Generate the build method
 			
Index: libsteticui/WidgetDesigner.cs
===================================================================
--- libsteticui/WidgetDesigner.cs	(revision 17)
+++ libsteticui/WidgetDesigner.cs	(working copy)
@@ -1,4 +1,3 @@
-
 using System;
 using System.Collections;
 
@@ -14,17 +13,14 @@
 		Component rootWidget;
 		
 		Project project;
-		Project editedProject;
 		int reloadCount;
 		
 		string componentName;
-		bool autoCommitChanges;
 		bool disposed;
 		
 		bool canCut, canCopy, canPaste, canDelete;
 		
 		public event EventHandler BindField;
-		public event EventHandler ModifiedChanged;
 		public event EventHandler Changed;
 		public event EventHandler SelectionChanged;
 		public event EventHandler RootComponentChanged;
@@ -34,26 +30,18 @@
 		public event ComponentNameEventHandler ComponentNameChanged;
 		public event EventHandler ComponentTypesChanged;
 		
-		internal WidgetDesigner (Project project, string componentName, bool autoCommitChanges): base (project.App)
+		internal WidgetDesigner (Project project, string componentName): base (project.App)
 		{
 			this.componentName = componentName;
-			this.autoCommitChanges = autoCommitChanges;
 			this.project = project;
 			frontend = new WidgetDesignerFrontend (this);
 			
-			if (autoCommitChanges)
-				editedProject = project;
-			else
-				editedProject = new Project (project.App, project.DesignInfo);
-			
-			editedProject.SignalAdded += OnSignalAdded;
-			editedProject.SignalRemoved += OnSignalRemoved;
-			editedProject.SignalChanged += OnSignalChanged;
-			editedProject.ComponentNameChanged += OnComponentNameChanged;
-			editedProject.ComponentTypesChanged += OnComponentTypesChanged;
-			
+			project.SignalAdded += OnSignalAdded;
+			project.SignalRemoved += OnSignalRemoved;
+			project.SignalChanged += OnSignalChanged;
+			project.ComponentNameChanged += OnComponentNameChanged;
+			project.ComponentTypesChanged += OnComponentTypesChanged;
 			project.BackendChanged += OnProjectBackendChanged;
-			editedProject.BackendChanged += OnProjectBackendChanged;
 			
 			CreateSession ();
 		}
@@ -70,8 +58,8 @@
 		{
 			if (!disposed) {
 				ArrayList types = new ArrayList ();
-				types.AddRange (editedProject.GetComponentTypes ());
-				
+				types.AddRange (project.GetComponentTypes ());
+		
 				// Add actions from the local action groups
 				
 				WidgetComponent c = rootWidget as WidgetComponent;
@@ -90,12 +78,14 @@
 		public void BeginComponentDrag (ComponentType type, Gtk.Widget source, Gdk.DragContext ctx)
 		{
 			Stetic.ObjectWrapper wrapper = type.Action != null ? (Stetic.ObjectWrapper) type.Action.Backend : null;
-			app.Backend.BeginComponentDrag (editedProject.ProjectBackend, type.Description, type.ClassName, wrapper, source, ctx, null);
+			app.Backend.BeginComponentDrag (project.ProjectBackend, type.Description, type.ClassName, wrapper, source, ctx, null);
+			
 		}
 		
 		public void BeginComponentDrag (string title, string className, Gtk.Widget source, Gdk.DragContext ctx, ComponentDropCallback callback)
 		{
-			app.Backend.BeginComponentDrag (editedProject.ProjectBackend, title, className, null, source, ctx, callback);
+			app.Backend.BeginComponentDrag (project.ProjectBackend, title, className, null, source, ctx, callback);
+			
 		}
 		
 		// Creates an action group designer for the widget being edited by this widget designer
@@ -103,7 +93,8 @@
 		{
 			if (disposed)
 				throw new ObjectDisposedException ("WidgetDesigner");
-			return new ActionGroupDesigner (editedProject, componentName, null, this, true);
+			return new ActionGroupDesigner (project, componentName, null, this, true);
+			
 		}
 		
 		public bool Modified {
@@ -113,7 +104,7 @@
 		internal override void SetActive ()
 		{
 			if (!disposed)
-				project.App.SetActiveDesignSession (editedProject, session);
+				project.App.SetActiveDesignSession (project, session);
 		}
 		
 		public bool AllowWidgetBinding {
@@ -125,8 +116,8 @@
 		}
 		
 		public ImportFileDelegate ImportFileCallback {
-			get { return editedProject.ImportFileCallback; }
-			set { editedProject.ImportFileCallback = value; }
+			get { return project.ImportFileCallback; }
+			set { project.ImportFileCallback = value; }
 		}
 		
 		public object SaveStatus ()
@@ -142,7 +133,7 @@
 		void CreateSession ()
 		{
 			try {
-				session = project.ProjectBackend.CreateWidgetDesignerSession (frontend, componentName, editedProject.ProjectBackend, autoCommitChanges);
+				session = project.ProjectBackend.CreateWidgetDesignerSession (frontend, componentName);
 				ResetCustomWidget ();
 				rootWidget = app.GetComponent (session.RootWidget, null, null);
 			} catch (Exception ex) {
@@ -232,27 +223,23 @@
 				if (disposed)
 					return;
 				
-				if (project.App.ActiveProject == editedProject)
+				if (project.App.ActiveProject == project)
 					project.App.ActiveProject = null;
 				
 				disposed = true;
 				frontend.disposed = true;
-				editedProject.SignalAdded -= OnSignalAdded;
-				editedProject.SignalRemoved -= OnSignalRemoved;
-				editedProject.SignalChanged -= OnSignalChanged;
-				editedProject.ComponentNameChanged -= OnComponentNameChanged;
-				editedProject.BackendChanged -= OnProjectBackendChanged;
-				editedProject.ComponentTypesChanged -= OnComponentTypesChanged;
+				project.SignalAdded -= OnSignalAdded;
+				project.SignalRemoved -= OnSignalRemoved;
+				project.SignalChanged -= OnSignalChanged;
+				project.ComponentNameChanged -= OnComponentNameChanged;
+				project.ComponentTypesChanged -= OnComponentTypesChanged;
 				project.BackendChanged -= OnProjectBackendChanged;
 				
 				if (session != null) {
 					session.Dispose ();
 					session = null;
 				}
-					
-				if (!autoCommitChanges)
-					editedProject.Dispose ();
-					
+						
 				System.Runtime.Remoting.RemotingServices.Disconnect (frontend);
 				frontend = null;
 				rootWidget = null;
@@ -309,10 +296,10 @@
 			if (++reloadCount == 2) {
 				object sessionData = null;
 				
-				if (oldBackend != null && !autoCommitChanges) {
-					sessionData = session.SaveState ();
-					session.DestroyWrapperWidgetPlug ();
-				}
+//				if (oldBackend != null && !autoCommitChanges) {
+//					sessionData = session.SaveState ();
+//					session.DestroyWrapperWidgetPlug ();
+//				}
 
 				// Don't dispose the session here, since it will dispose
 				// the underlying project, and we can't do it because
@@ -359,12 +346,6 @@
 				BindField (this, EventArgs.Empty);
 		}
 		
-		internal void NotifyModifiedChanged ()
-		{
-			if (ModifiedChanged != null)
-				ModifiedChanged (this, EventArgs.Empty);
-		}
-		
 		internal void NotifyChanged ()
 		{
 			if (Changed != null)
@@ -405,13 +386,6 @@
 			);
 		}
 		
-		public void NotifyModifiedChanged ()
-		{
-			GuiDispatch.InvokeSync (
-				delegate { if (!disposed) designer.NotifyModifiedChanged (); }
-			);
-		}
-		
 		public void NotifyChanged ()
 		{
 			GuiDispatch.InvokeSync (
Index: libsteticui/Makefile.am
===================================================================
--- libsteticui/Makefile.am	(revision 17)
+++ libsteticui/Makefile.am	(working copy)
@@ -21,7 +21,6 @@
 	CecilWidgetLibrary.cs \
 	CodeGenerationResult.cs \
 	CodeGenerator.cs \
-	CodeGeneratorInternalClass.cs \
 	CodeGeneratorPartialClass.cs \
 	Component.cs \
 	ComponentEventHandler.cs \
@@ -83,6 +82,7 @@
 	$(GLADE_SHARP_LIBS) \
 	$(GLIB_SHARP_LIBS) \
 	$(GTK_SHARP_LIBS) \
+	-pkg:monodevelop \
 	-r:Mono.Posix \
 	-r:System \
 	-r:System.Core \
Index: libsteticui/Project.cs
===================================================================
--- libsteticui/Project.cs	(revision 17)
+++ libsteticui/Project.cs	(working copy)
@@ -12,7 +12,8 @@
 	{
 		Application app;
 		ProjectBackend backend;
-		string fileName;
+		//string fileName;
+		string folderName;
 		IResourceProvider resourceProvider;
 		Component selection;
 		string tmpProjectFile;
@@ -72,8 +73,8 @@
 					backend.SetFrontend (this);
 					if (resourceProvider != null)
 						backend.ResourceProvider = resourceProvider;
-					if (fileName != null)
-						backend.Load (fileName);
+					if (folderName != null)
+						backend.Load (folderName);
 				}
 				return backend; 
 			}
@@ -114,9 +115,9 @@
 			return null;
 		}
 
-		public string FileName {
-			get { return fileName; }
-		}
+//		public string FileName {
+//			get { return fileName; }
+//		}
 		
 		public IResourceProvider ResourceProvider { 
 			get { return resourceProvider; }
@@ -161,41 +162,16 @@
 				backend.Close ();
 		}
 		
-		public void Load (string fileName)
+		public void Load (string folderName)
 		{
-			this.fileName = fileName;
+			this.folderName = folderName;
 			if (backend != null)
-				backend.Load (fileName);
+				backend.Load (folderName);
 			
-			using (StreamReader sr = new StreamReader (fileName)) {
-				XmlTextReader reader = new XmlTextReader (sr); 
+			foreach (string basePath in DesignInfo.GetComponentFolders ()) {
+				if (!Directory.Exists (basePath))
+					continue;
 				
-				reader.MoveToContent ();
-				if (reader.IsEmptyElement)
-					return;
-				
-				reader.ReadStartElement ("stetic-interface");
-				if (reader.IsEmptyElement)
-					return;
-				while (reader.NodeType != XmlNodeType.EndElement) {
-					if (reader.NodeType == XmlNodeType.Element) {
-						if (reader.LocalName == "widget")
-							ReadWidget (reader);
-						else if (reader.LocalName == "action-group")
-							ReadActionGroup (reader);
-						else
-							reader.Skip ();
-					}
-					else {
-						reader.Skip ();
-					}
-					reader.MoveToContent ();
-				}
-			}
-			
-//			string basePath = fileName != null ? Path.GetDirectoryName (fileName) : null;
-			
-			foreach (string basePath in DesignInfo.GetComponentFolders ()) {
 				DirectoryInfo dir = new DirectoryInfo (basePath);
 				
 				foreach (FileInfo file in dir.GetFiles ()) {
@@ -257,11 +233,21 @@
 			reader.Skip ();
 		}
 		
-		public void Save (string fileName)
+		public void ConvertProject (string oldSteticFileName, string newGuiFolderName)
 		{
-			this.fileName = fileName;
+			//ProjectBackend property when created invokes Load method which is not valid
+			//for old file layout
+			
+			ProjectBackend backend = app.Backend.CreateProject ();
+			backend.SetFrontend (this);
+			backend.ConvertProject (oldSteticFileName, newGuiFolderName);
+		}
+		
+		public void Save (string folderName)
+		{
+			this.folderName = folderName;
 			if (backend != null)
-				backend.Save (fileName);
+				backend.Save (folderName);
 		}
 		
 		public void ImportGlade (string fileName)
@@ -274,31 +260,6 @@
 			ProjectBackend.ExportGlade (fileName);
 		}
 		
-		public object SaveStatus ()
-		{
-			return ProjectBackend.SaveStatus ();
-		}
-		
-		public void LoadStatus (object status)
-		{
-			ProjectBackend.LoadStatus (status);
-		}
-		
-		public bool Modified {
-			get {
-				if (backend != null)
-					return backend.Modified; 
-				else
-					return modified;
-			}
-			set {
-				if (backend != null)
-					backend.Modified = value;	
-				else
-					modified = true;
-			}
-		}
-		
 		public IEnumerable<WidgetInfo> Widgets {
 			get { return widgets; }
 		}
@@ -323,9 +284,14 @@
 			return null;
 		}
 				
-		public WidgetDesigner CreateWidgetDesigner (WidgetInfo widgetInfo, bool autoCommitChanges)
+//		public WidgetDesigner CreateWidgetDesigner (WidgetInfo widgetInfo, bool autoCommitChanges)
+//		{
+//			return new WidgetDesigner (this, widgetInfo.Name, autoCommitChanges);
+//		}
+		
+		public WidgetDesigner CreateWidgetDesigner (WidgetInfo widgetInfo)
 		{
-			return new WidgetDesigner (this, widgetInfo.Name, autoCommitChanges);
+			return new WidgetDesigner (this, widgetInfo.Name);
 		}
 		
 		public ActionGroupDesigner CreateActionGroupDesigner (ActionGroupInfo actionGroup, bool autoCommitChanges)
@@ -341,7 +307,7 @@
 			if (wi == null) {
 				wi = new WidgetInfo (this, wc);
 				widgets.Add (wi);
-			}
+			} 
 			return wi;
 		}
 		
@@ -357,6 +323,36 @@
 			return wi;
 		}
 		
+		public object AddNewComponent (string fileName)
+		{
+			object ob = ProjectBackend.AddNewComponent (fileName);
+			object component = App.GetComponent (ob, null, null);
+			
+			if (component is WidgetComponent) {
+				var wc = (WidgetComponent) component;
+				WidgetInfo wi = GetWidget (wc.Name);
+				if (wi == null) {
+					wi = new WidgetInfo (this, wc);
+					widgets.Add (wi);
+				}
+				return wi;
+			}
+				
+			if (component is ActionGroupComponent) {
+				var ac = (ActionGroupComponent) component;
+				// 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 gi;
+			}
+			
+			return null;
+		}
+		
 		public ComponentType[] GetComponentTypes ()
 		{
 			ArrayList types = new ArrayList ();
@@ -574,7 +570,7 @@
 			);
 		}
 		
-		internal void NotifyChanged ()
+		internal void NotifyChanged (string rootWidgetName)
 		{
 			GuiDispatch.InvokeSync (
 				delegate {
@@ -582,10 +578,14 @@
 						Changed (this, EventArgs.Empty);
 				
 					// TODO: Optimize
-					foreach (ProjectItemInfo it in widgets)
-						it.NotifyChanged ();
-					foreach (ProjectItemInfo it in groups)
-						it.NotifyChanged ();
+					foreach (ProjectItemInfo it in widgets) {
+						if (it.Name == rootWidgetName)
+							it.NotifyChanged ();
+					}
+					foreach (ProjectItemInfo it in groups) {
+						if (it.Name == rootWidgetName)
+							it.NotifyChanged ();
+					}
 				}
 			);
 		}
@@ -732,11 +732,12 @@
 			backend.SetFrontend (this);
 
 			if (tmpProjectFile != null && File.Exists (tmpProjectFile)) {
-				backend.Load (tmpProjectFile, fileName);
+//				backend.Load (tmpProjectFile, fileName);
+				throw new NotImplementedException ("OnBackendChanged");
 				File.Delete (tmpProjectFile);
 				tmpProjectFile = null;
-			} else if (fileName != null) {
-				backend.Load (fileName);
+			} else if (folderName != null) {
+				backend.Load (folderName);
 			}
 
 			if (resourceProvider != null)
Index: libsteticui/Application.cs
===================================================================
--- libsteticui/Application.cs	(revision 17)
+++ libsteticui/Application.cs	(working copy)
@@ -308,14 +308,14 @@
 				UpdateWidgetLibraries (false, false);
 		}
 		
-		public Project LoadProject (string path, IProjectDesignInfo info)
-		{
-			Project p = new Project (this, info);
-			p.Load (path);
-			projects.Add (p);
-			p.Disposed += ProjectDisposed;
-			return p;
-		}
+//		public Project LoadProject (string path, IProjectDesignInfo info)
+//		{
+//			Project p = new Project (this, info);
+//			p.Load (path);
+//			projects.Add (p);
+//			p.Disposed += ProjectDisposed;
+//			return p;
+//		}
 		
 		public Project CreateProject (IProjectDesignInfo info)
 		{
Index: libsteticui/CodeGeneratorInternalClass.cs
===================================================================
--- libsteticui/CodeGeneratorInternalClass.cs	(revision 17)
+++ libsteticui/CodeGeneratorInternalClass.cs	(working copy)
@@ -1,319 +0,0 @@
-
-using System;
-using System.Reflection;
-using System.CodeDom;
-using System.CodeDom.Compiler;
-using System.Collections.Generic;
-using System.IO;
-using System.Xml.Serialization;
-using System.Collections;
-
-namespace Stetic
-{
-	internal static class CodeGeneratorInternalClass
-	{
-		static CodeExpression bindingFlags;
-		
-		static CodeGeneratorInternalClass ()
-		{
-			CodeTypeReferenceExpression flagsType = new CodeTypeReferenceExpression (new CodeTypeReference ("System.Reflection.BindingFlags", CodeTypeReferenceOptions.GlobalReference));
-			bindingFlags = new CodeBinaryOperatorExpression (
-				new CodeFieldReferenceExpression (flagsType, "Public"),
-				CodeBinaryOperatorType.BitwiseOr,
-				new CodeFieldReferenceExpression (flagsType, "NonPublic")
-			);
-			
-			bindingFlags = new CodeBinaryOperatorExpression (
-				bindingFlags,
-				CodeBinaryOperatorType.BitwiseOr,
-				new CodeFieldReferenceExpression (flagsType, "Instance")
-			);		
-		}
-		
-		public static void GenerateProjectGuiCode (SteticCompilationUnit globalUnit, CodeNamespace globalNs, CodeTypeDeclaration globalType, GenerationOptions options, List<SteticCompilationUnit> units, ProjectBackend[] projects, ArrayList warnings)
-		{
-			bool multiProject = projects.Length > 1;
-			
-			// Build method overload that takes a type as parameter.
-			
-			CodeMemberMethod met = new CodeMemberMethod ();
-			met.Name = "Build";
-			globalType.Members.Add (met);
-			met.Parameters.Add (new CodeParameterDeclarationExpression (typeof(object), "cobj"));
-			met.Parameters.Add (new CodeParameterDeclarationExpression (typeof(Type), "type"));
-			if (multiProject)
-				met.Parameters.Add (new CodeParameterDeclarationExpression (typeof(string), "file"));
-			met.ReturnType = new CodeTypeReference (typeof(void));
-			met.Attributes = MemberAttributes.Public | MemberAttributes.Static;
-			
-			CodeMethodInvokeExpression call = new CodeMethodInvokeExpression (
-					new CodeMethodReferenceExpression (
-						new CodeTypeReferenceExpression (new CodeTypeReference (globalNs.Name + ".Gui", CodeTypeReferenceOptions.GlobalReference)),
-						"Build"
-					),
-					new CodeArgumentReferenceExpression ("cobj"),
-					new CodePropertyReferenceExpression (
-						new CodeArgumentReferenceExpression ("type"),
-						"FullName"
-					)
-			);
-			if (multiProject)
-				call.Parameters.Add (new CodeArgumentReferenceExpression ("file"));
-
-			met.Statements.Add (call);
-			
-			// Generate the build method
-			
-			met = new CodeMemberMethod ();
-			met.Name = "Build";
-			globalType.Members.Add (met);
-			
-			met.Parameters.Add (new CodeParameterDeclarationExpression (typeof(object), "cobj"));
-			met.Parameters.Add (new CodeParameterDeclarationExpression (typeof(string), "id"));
-			if (multiProject)
-				met.Parameters.Add (new CodeParameterDeclarationExpression (typeof(string), "file"));
-			met.ReturnType = new CodeTypeReference (typeof(void));
-			met.Attributes = MemberAttributes.Public | MemberAttributes.Static;
-
-			if (options.GenerateEmptyBuildMethod)
-				return;
-			
-			CodeArgumentReferenceExpression cobj = new CodeArgumentReferenceExpression ("cobj");
-			CodeArgumentReferenceExpression cfile = new CodeArgumentReferenceExpression ("file");
-			CodeArgumentReferenceExpression cid = new CodeArgumentReferenceExpression ("id");
-			
-			CodeStatementCollection projectCol = met.Statements;
-			
-			CodeConditionStatement tcond = new CodeConditionStatement ();
-			tcond.Condition = new CodeMethodInvokeExpression (new CodeTypeOfExpression (typeof(Gtk.Widget)), "IsAssignableFrom", cobj);
-			
-			tcond.TrueStatements.Add (
-					new CodeMethodInvokeExpression (
-						new CodeTypeReferenceExpression (new CodeTypeReference (globalNs.Name + ".Gui", CodeTypeReferenceOptions.GlobalReference)),
-						"Initialize",
-			            cobj
-					)
-			);
-					
-			// Generate code for each project
-			
-			foreach (ProjectBackend gp in projects) {
-				
-				CodeStatementCollection widgetCol;
-				
-				if (multiProject) {
-					CodeConditionStatement pcond = new CodeConditionStatement ();
-					pcond.Condition = new CodeBinaryOperatorExpression (
-						cfile, 
-						CodeBinaryOperatorType.IdentityEquality,
-						new CodePrimitiveExpression (gp.Id)
-					);
-					projectCol.Add (pcond);
-					
-					widgetCol = pcond.TrueStatements;
-					projectCol = pcond.FalseStatements;
-				} else {
-					widgetCol = projectCol;
-				}
-				
-				// Generate top levels
-				
-				CodeIdentifiers ids = new CodeIdentifiers ();
-				
-				foreach (Gtk.Widget w in gp.Toplevels) {
-					CodeConditionStatement cond = new CodeConditionStatement ();
-					cond.Condition = new CodeBinaryOperatorExpression (
-						cid, 
-						CodeBinaryOperatorType.IdentityEquality,
-						new CodePrimitiveExpression (w.Name)
-					);
-					widgetCol.Add (cond);
-					
-					GenerateComponentCode (w, globalUnit, globalNs, cobj, cond.TrueStatements, globalType, options, units, ids, warnings);
-					
-					widgetCol = cond.FalseStatements;
-				}
-				
-				// Generate action groups
-				
-				foreach (Wrapper.ActionGroup agroup in gp.ActionGroups) {
-					CodeConditionStatement cond = new CodeConditionStatement ();
-					cond.Condition = new CodeBinaryOperatorExpression (
-						cid, 
-						CodeBinaryOperatorType.IdentityEquality,
-						new CodePrimitiveExpression (agroup.Name)
-					);
-					widgetCol.Add (cond);
-					
-					GenerateComponentCode (agroup, globalUnit, globalNs, cobj, cond.TrueStatements, globalType, options, units, ids, warnings);
-					
-					widgetCol = cond.FalseStatements;
-				}
-			}
-		}
-		
-		static CodeMemberMethod GetBuildMethod (string name, string internalClassName, string typeName, SteticCompilationUnit globalUnit, GenerationOptions options, List<SteticCompilationUnit> units)
-		{
-			SteticCompilationUnit unit;
-			
-			if (options.GenerateSingleFile)
-				unit = globalUnit;
-			else {
-				unit = new SteticCompilationUnit (name);
-				units.Add (unit);
-			}
-			
-			CodeTypeDeclaration type = new CodeTypeDeclaration (internalClassName);
-			type.Attributes = MemberAttributes.Private;
-			type.TypeAttributes = TypeAttributes.NestedAssembly;
-			
-			CodeNamespace cns = new CodeNamespace (options.GlobalNamespace + ".SteticGenerated");
-			cns.Types.Add (type);
-			unit.Namespaces.Add (cns);
-					
-			// Create the build method for the component
-			
-			CodeMemberMethod met = new CodeMemberMethod ();
-			met.Name = "Build";
-			type.Members.Add (met);
-			
-			met.Parameters.Add (new CodeParameterDeclarationExpression (new CodeTypeReference (typeName), "cobj"));
-			met.ReturnType = new CodeTypeReference (typeof(void));
-			met.Attributes = MemberAttributes.Public | MemberAttributes.Static;
-			
-			return met;
-		}
-		
-		static void GenerateComponentCode (object component, SteticCompilationUnit globalUnit, CodeNamespace globalNs, CodeExpression cobj, CodeStatementCollection statements, CodeTypeDeclaration globalType, GenerationOptions options, List<SteticCompilationUnit> units, CodeIdentifiers ids, ArrayList warnings)
-		{
-			Gtk.Widget widget = component as Gtk.Widget;
-			Wrapper.Widget wwidget = Stetic.Wrapper.Widget.Lookup (widget);
-			Wrapper.ActionGroup agroup = component as Wrapper.ActionGroup;
-			
-			string name = widget != null ? widget.Name : agroup.Name;
-			string internalClassName = ids.MakeUnique (CodeIdentifier.MakeValid (name));
-			
-			string typeName = widget != null ? wwidget.WrappedTypeName : "Gtk.ActionGroup";
-			// Create the build method for the top level
-			
-			CodeMemberMethod met;
-			met = GetBuildMethod (name, internalClassName, typeName, globalUnit, options, units);
-			
-			// Generate the build code
-			
-			CodeVariableDeclarationStatement varDecHash = new CodeVariableDeclarationStatement (typeof(System.Collections.Hashtable).ToGlobalTypeRef (), "bindings");
-			met.Statements.Add (varDecHash);
-			varDecHash.InitExpression = new CodeObjectCreateExpression (
-				typeof(System.Collections.Hashtable),
-				new CodeExpression [0]
-			);
-			
-			CodeVariableReferenceExpression targetObjectVar = new CodeVariableReferenceExpression ("cobj");
-			Stetic.WidgetMap map;
-			
-			if (widget != null) {
-				map = Stetic.CodeGenerator.GenerateCreationCode (globalNs, globalType, widget, targetObjectVar, met.Statements, options, warnings);
-				CodeGenerator.BindSignalHandlers (targetObjectVar, wwidget, map, met.Statements, options);
-			} else {
-				map = Stetic.CodeGenerator.GenerateCreationCode (globalNs, globalType, agroup, targetObjectVar, met.Statements, options, warnings);
-				foreach (Wrapper.Action ac in agroup.Actions)
-					CodeGenerator.BindSignalHandlers (targetObjectVar, ac, map, met.Statements, options);
-			}
-			
-			GenerateBindFieldCode (met.Statements, cobj);
-			
-			// Add a method call to the build method
-			
-			statements.Add (
-				new CodeMethodInvokeExpression (
-					new CodeTypeReferenceExpression (new CodeTypeReference (options.GlobalNamespace + ".SteticGenerated." + internalClassName, CodeTypeReferenceOptions.GlobalReference)),
-					"Build",
-					new CodeCastExpression (typeName.ToGlobalTypeRef (), cobj)
-				)
-			);
-		}
-		
-		static void GenerateBindFieldCode (CodeStatementCollection statements, CodeExpression cobj)
-		{
-			// Bind the fields
-			
-			CodeVariableDeclarationStatement varDecIndex = new CodeVariableDeclarationStatement (typeof(int), "n");
-			varDecIndex.InitExpression = new CodePrimitiveExpression (0);
-			CodeExpression varIndex = new CodeVariableReferenceExpression ("n");
-			
-			CodeVariableDeclarationStatement varDecArray = new CodeVariableDeclarationStatement (typeof(FieldInfo[]).ToGlobalTypeRef (), "fields");
-			varDecArray.InitExpression = new CodeMethodInvokeExpression (
-				new CodeMethodInvokeExpression (
-					cobj,
-					"GetType",
-					new CodeExpression [0]
-				),
-				"GetFields",
-				bindingFlags
-			);
-			statements.Add (varDecArray);
-			CodeVariableReferenceExpression varArray = new CodeVariableReferenceExpression ("fields");
-			
-			CodeIterationStatement iteration = new CodeIterationStatement ();
-			statements.Add (iteration);
-			
-			iteration.InitStatement = varDecIndex;
-			
-			iteration.TestExpression = new CodeBinaryOperatorExpression (
-				varIndex,
-				CodeBinaryOperatorType.LessThan,
-				new CodePropertyReferenceExpression (varArray, "Length")
-			);
-			iteration.IncrementStatement = new CodeAssignStatement (
-				varIndex,
-				new CodeBinaryOperatorExpression (
-					varIndex,
-					CodeBinaryOperatorType.Add,
-					new CodePrimitiveExpression (1)
-				)
-			);
-			
-			CodeVariableDeclarationStatement varDecField = new CodeVariableDeclarationStatement (typeof(FieldInfo).ToGlobalTypeRef (), "field");
-			varDecField.InitExpression = new CodeArrayIndexerExpression (varArray, new CodeExpression [] {varIndex});
-			CodeVariableReferenceExpression varField = new CodeVariableReferenceExpression ("field");
-			iteration.Statements.Add (varDecField);
-			
-			CodeVariableDeclarationStatement varDecWidget = new CodeVariableDeclarationStatement (typeof(object), "widget");
-			iteration.Statements.Add (varDecWidget);
-			varDecWidget.InitExpression = new CodeIndexerExpression (
-				new CodeVariableReferenceExpression ("bindings"),
-				new CodePropertyReferenceExpression (varField, "Name")
-			);
-			CodeVariableReferenceExpression varWidget = new CodeVariableReferenceExpression ("widget");
-			
-			// Make sure the type of the field matches the type of the widget
-			
-			CodeConditionStatement fcond = new CodeConditionStatement ();
-			iteration.Statements.Add (fcond);
-			fcond.Condition = new CodeBinaryOperatorExpression (
-				new CodeBinaryOperatorExpression (
-					varWidget,
-					CodeBinaryOperatorType.IdentityInequality,
-					new CodePrimitiveExpression (null)
-				),
-				CodeBinaryOperatorType.BooleanAnd,
-				new CodeMethodInvokeExpression (
-					new CodePropertyReferenceExpression (varField, "FieldType"),
-					"IsInstanceOfType",
-					varWidget
-				)
-			);
-			
-			// Set the variable value
-			
-			fcond.TrueStatements.Add (
-				new CodeMethodInvokeExpression (
-					varField,
-					"SetValue",
-					cobj,
-					varWidget
-				)
-			);
-		}
-	}
-}
Index: libsteticui/Glade.cs
===================================================================
--- libsteticui/Glade.cs	(revision 17)
+++ libsteticui/Glade.cs	(working copy)
@@ -17,7 +17,6 @@
 			doc.PreserveWhitespace = true;
 			doc.XmlResolver = null;
 			doc.Load (filename);
-			project.SetFileName (filename);
 			project.Id = System.IO.Path.GetFileName (filename);
 			doc = GladeUtils.XslImportTransform (doc);
 
@@ -27,7 +26,7 @@
 
 			ObjectReader reader = new ObjectReader (project, FileFormat.Glade);
 			foreach (XmlElement toplevel in node.SelectNodes ("widget")) {
-				Wrapper.Container wrapper = Stetic.ObjectWrapper.ReadObject (reader, toplevel) as Wrapper.Container;
+				Wrapper.Container wrapper = Stetic.ObjectWrapper.ReadObject (reader, toplevel, null) as Wrapper.Container;
 				if (wrapper != null)
 					project.AddWidget ((Gtk.Widget)wrapper.Wrapped);
 			}
Index: libstetic/IProject.cs
===================================================================
--- libstetic/IProject.cs	(revision 17)
+++ libstetic/IProject.cs	(working copy)
@@ -4,15 +4,16 @@
 {
 	public interface IProject 
 	{
-		string FileName { get; }
+		//string FileName { get; }
+		string FolderName { get; }
 		Gtk.Widget[] Toplevels { get; }
-		Gtk.Widget GetTopLevel (string name);
+		Gtk.Widget GetWidget (string name);
 		Gtk.Widget Selection { get; set; }
 		Wrapper.ActionGroupCollection ActionGroups { get; }
 		ProjectIconFactory IconFactory { get; }
 		string ImagesRootPath { get; }
 		string TargetGtkVersion { get; }
-		bool Modified { get; set; }
+//		bool Modified { get; set; }
 		IResourceProvider ResourceProvider { get; set; }
 
 		void PopupContextMenu (Stetic.Wrapper.Widget wrapper);
Index: libstetic/editor/ChangeLog
===================================================================
--- libstetic/editor/ChangeLog	(revision 0)
+++ libstetic/editor/ChangeLog	(revision 111)
@@ -0,0 +1,16 @@
+2010-08-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* SelectIconDialog.cs: Remove setting Project.Modified property
+	* EditIconFactoryDialog.cs: Remove setting Project.Modified property
+
+2010-08-03  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* ActionMenu.cs: Pass root wrapper as an argument for ObjectWrapper.Create
+	* ActionToolbar.cs:
+	* ActionMenuBar.cs:
+	* ActionGroupEditor.cs: 
+
+2010-06-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* SelectImageDialog.cs: 
+
Index: libstetic/editor/EditIconFactoryDialog.cs
===================================================================
--- libstetic/editor/EditIconFactoryDialog.cs	(revision 17)
+++ libstetic/editor/EditIconFactoryDialog.cs	(working copy)
@@ -53,7 +53,7 @@
 					iconFactory.Icons.Add (icon);
 					customIconList.Refresh ();
 					customIconList.Selection = icon.Name;
-					project.Modified = true;
+//					project.Modified = true;
 				}
 			}
 		}
@@ -69,7 +69,7 @@
 				if (md.Run () == (int) Gtk.ResponseType.Yes) {
 					iconFactory.Icons.Remove (icon);
 					customIconList.Refresh ();
-					project.Modified = true;
+//					project.Modified = true;
 				}
 				md.Destroy ();
 			}
@@ -86,7 +86,7 @@
 					if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
 						customIconList.Refresh ();
 						customIconList.Selection = icon.Name;
-						project.Modified = true;
+//						project.Modified = true;
 					}
 				}
 			}
Index: libstetic/editor/SelectIconDialog.cs
===================================================================
--- libstetic/editor/SelectIconDialog.cs	(revision 17)
+++ libstetic/editor/SelectIconDialog.cs	(working copy)
@@ -137,7 +137,7 @@
 					project.IconFactory.Icons.Add (icon);
 					customIconList.Refresh ();
 					customIconList.Selection = icon.Name;
-					project.Modified = true;
+//					project.Modified = true;
 				}
 			}
 		}
@@ -153,7 +153,7 @@
 				if (md.Run () == (int) Gtk.ResponseType.Yes) {
 					project.IconFactory.Icons.Remove (icon);
 					customIconList.Refresh ();
-					project.Modified = true;
+//					project.Modified = true;
 				}
 				md.Destroy ();
 			}
@@ -170,7 +170,7 @@
 					if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
 						customIconList.Refresh ();
 						customIconList.Selection = icon.Name;
-						project.Modified = true;
+//						project.Modified = true;
 					}
 				}
 			}
Index: libstetic/editor/ActionMenuBar.cs
===================================================================
--- libstetic/editor/ActionMenuBar.cs	(revision 17)
+++ libstetic/editor/ActionMenuBar.cs	(working copy)
@@ -258,7 +258,9 @@
 		{
 			Widget wrapper = Widget.Lookup (this);
 			using (wrapper.UndoManager.AtomicChange) {
-				Wrapper.Action ac = (Wrapper.Action) ObjectWrapper.Create (wrapper.Project, new Gtk.Action ("", "", null, null));
+				Wrapper.Action ac = (Wrapper.Action) ObjectWrapper.Create (wrapper.Project, 
+				                                                           new Gtk.Action ("", "", null, null),
+				                                                           wrapper);
 				ActionTreeNode node = new ActionTreeNode (Gtk.UIManagerItemType.Menu, "", ac);
 				actionTree.Children.Insert (pos, node);
 
Index: libstetic/editor/ActionMenu.cs
===================================================================
--- libstetic/editor/ActionMenu.cs	(revision 17)
+++ libstetic/editor/ActionMenu.cs	(working copy)
@@ -196,7 +196,9 @@
 		ActionTreeNode InsertAction (int pos)
 		{
 			using (wrapper.UndoManager.AtomicChange) {
-				Wrapper.Action ac = (Wrapper.Action) ObjectWrapper.Create (wrapper.Project, new Gtk.Action ("", "", null, null));
+				Wrapper.Action ac = (Wrapper.Action) ObjectWrapper.Create (wrapper.Project, 
+				                                                           new Gtk.Action ("", "", null, null),
+				                                                           wrapper);
 				ActionTreeNode newNode = new ActionTreeNode (Gtk.UIManagerItemType.Menuitem, null, ac);
 				nodes.Insert (pos, newNode);
 				ActionMenuItem item = FindMenuItem (newNode);
Index: libstetic/editor/SelectImageDialog.cs
===================================================================
--- libstetic/editor/SelectImageDialog.cs	(revision 17)
+++ libstetic/editor/SelectImageDialog.cs	(working copy)
@@ -80,7 +80,7 @@
 			FillResources ();
 			resourceList.Selection.Changed += OnResourceSelectionChanged;
 			
-			if (project.FileName != null)
+			if (project.FolderName != null)
 				fileChooser.SetCurrentFolder (project.ImagesRootPath);
 
 			fileChooser.SelectionChanged += delegate (object s, EventArgs a) {
Index: libstetic/editor/ActionToolbar.cs
===================================================================
--- libstetic/editor/ActionToolbar.cs	(revision 17)
+++ libstetic/editor/ActionToolbar.cs	(working copy)
@@ -237,7 +237,9 @@
 		{
 			Widget wrapper = Stetic.Wrapper.Widget.Lookup (this);
 			using (wrapper.UndoManager.AtomicChange) {
-				Wrapper.Action ac = (Wrapper.Action) ObjectWrapper.Create (wrapper.Project, new Gtk.Action ("", "", null, null));
+				Wrapper.Action ac = (Wrapper.Action) ObjectWrapper.Create (wrapper.Project, 
+				                                                           new Gtk.Action ("", "", null, null),
+				                                                           wrapper);
 				ActionTreeNode node = new ActionTreeNode (Gtk.UIManagerItemType.Toolitem, "", ac);
 				actionTree.Children.Insert (pos, node);
 
Index: libstetic/editor/ActionGroupEditor.cs
===================================================================
--- libstetic/editor/ActionGroupEditor.cs	(revision 17)
+++ libstetic/editor/ActionGroupEditor.cs	(working copy)
@@ -275,7 +275,9 @@
 		
 		void OnAddClicked (object s, Gtk.ButtonPressEventArgs args)
 		{
-			Wrapper.Action ac = (Wrapper.Action) ObjectWrapper.Create (project, new Gtk.Action ("", "", null, null));
+			Wrapper.Action ac = (Wrapper.Action) ObjectWrapper.Create (project,  
+			                                                           new Gtk.Action ("", "", null, null), 
+			                                                           ActionGroup);
 			ActionMenuItem item = InsertAction (ac, actionGroup.Actions.Count);
 			item.EditingDone += OnEditDone;
 			item.Select ();
Index: libstetic/ChangeLog
===================================================================
--- libstetic/ChangeLog	(revision 17)
+++ libstetic/ChangeLog	(working copy)
@@ -1,3 +1,40 @@
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* DND.cs:
+	* IProject.cs: 
+
+2010-08-13  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* GeneratorContext.cs: 
+
+2010-08-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* IProject.cs: Remove Modified property, add WasModified method which check state of a given top level
+
+2010-08-03  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* GladeUtils.cs: Set ObjectWrapper.RootWrapperName when reading from xml
+	* WidgetUtils.cs:
+	* ObjectReader.cs:
+	* ObjectWrapper.cs:
+	* wrapper/Frame.cs:
+	* wrapper/Window.cs:
+	* wrapper/MenuItem.cs:
+	* wrapper/Expander.cs:
+	* undo/UndoManager.cs:
+	* wrapper/Notebook.cs:
+	* wrapper/Container.cs:
+	* wrapper/OptionMenu.cs: 
+
+2010-08-03  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* ObjectWrapper.cs: Save a root wrapper name
+
+2010-06-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* IProject.cs:
+	* ErrorWidget.cs: 
+
 2010-04-30  Lluis Sanchez Gual  <lluis@novell.com>
 
 	* editor/ActionMenu.cs: Explicit destroy of children should
Index: libstetic/GeneratorContext.cs
===================================================================
--- libstetic/GeneratorContext.cs	(revision 17)
+++ libstetic/GeneratorContext.cs	(working copy)
@@ -522,11 +522,6 @@
 			set { gettextClass = value; }
 		}
 		
-		public bool UsePartialClasses {
-			get { return partialClasses; }
-			set { partialClasses = value; }
-		}
-		
 		public string Path {
 			get { return path; }
 			set { path = value; }
@@ -537,11 +532,6 @@
 			set { generateEmptyBuildMethod = value; }
 		}
 		
-		public bool GenerateSingleFile {
-			get { return generateSingleFile; }
-			set { generateSingleFile = value; }
-		}
-		
 		public string GlobalNamespace {
 			get { return globalNamespace; }
 			set { globalNamespace = value; }
Index: libstetic/DND.cs
===================================================================
--- libstetic/DND.cs	(revision 17)
+++ libstetic/DND.cs	(working copy)
@@ -181,7 +181,7 @@
 				
 				if (targetWrapper.IsDisposed) {
 					// The project has been reloaded. Find the wrapper again.
-					Gtk.Widget twidget = project.GetTopLevel (tname);
+					Gtk.Widget twidget = project.GetWidget (tname);
 					ObjectWrapper ow = ObjectWrapper.Lookup (twidget);
 					if (ow != null)
 						targetWrapper = ow.FindObjectByUndoId (uid);
Index: libstetic/ObjectReader.cs
===================================================================
--- libstetic/ObjectReader.cs	(revision 17)
+++ libstetic/ObjectReader.cs	(working copy)
@@ -25,14 +25,14 @@
 			get { return proj; }
 		}
 		
-		public virtual ObjectWrapper ReadObject (XmlElement elem)
+		public virtual ObjectWrapper ReadObject (XmlElement elem, ObjectWrapper root)
 		{
-			return Stetic.ObjectWrapper.ReadObject (this, elem);
+			return Stetic.ObjectWrapper.ReadObject (this, elem, root);
 		}
 		
-		public virtual void ReadObject (ObjectWrapper wrapper, XmlElement elem)
+		public virtual void ReadExistingObject (ObjectWrapper wrapper, XmlElement elem)
 		{
-			Stetic.ObjectWrapper.ReadObject (this, elem, wrapper);
+			Stetic.ObjectWrapper.ReadExistingObject (this, elem, wrapper);
 		}
 	}
 }
Index: libstetic/undo/UndoManager.cs
===================================================================
--- libstetic/undo/UndoManager.cs	(revision 17)
+++ libstetic/undo/UndoManager.cs	(working copy)
@@ -227,17 +227,17 @@
 			this.undoManager = undoManager;
 		}
 		
-		public override ObjectWrapper ReadObject (XmlElement elem)
+		public override ObjectWrapper ReadObject (XmlElement elem, ObjectWrapper root)
 		{
-			ObjectWrapper ww = base.ReadObject (elem);
+			ObjectWrapper ww = base.ReadObject (elem, root);
 			if (ww is Widget)
 				undoManager.RegisterObject ((Widget)ww, elem);
 			return ww;
 		}
 		
-		public override void ReadObject (ObjectWrapper wrapper, XmlElement elem)
+		public override void ReadExistingObject (ObjectWrapper wrapper, XmlElement elem)
 		{
-			base.ReadObject (wrapper, elem);
+			base.ReadExistingObject (wrapper, elem);
 			if (wrapper is Widget)
 				undoManager.RegisterObject ((Widget)wrapper, elem);
 		}
Index: libstetic/ObjectWrapper.cs
===================================================================
--- libstetic/ObjectWrapper.cs	(revision 17)
+++ libstetic/ObjectWrapper.cs	(working copy)
@@ -149,10 +149,13 @@
 			get { return disposed; }
 		}
 
-		public static ObjectWrapper Create (IProject proj, object wrapped)
+		public static ObjectWrapper Create (IProject proj, object wrapped, ObjectWrapper root)
 		{
 			ClassDescriptor klass = Registry.LookupClassByName (wrapped.GetType ().FullName);
 			ObjectWrapper wrapper = klass.CreateWrapper ();
+			if (root != null) {
+				wrapper.RootWrapperName = (root.RootWrapperName != null) ? root.RootWrapperName : root.Name;
+			}
 			wrapper.Loading = true;
 			wrapper.proj = proj;
 			wrapper.classDescriptor = klass;
@@ -180,7 +183,7 @@
 			throw new System.NotImplementedException ();
 		}
 
-		public static ObjectWrapper ReadObject (ObjectReader reader, XmlElement elem)
+		public static ObjectWrapper ReadObject (ObjectReader reader, XmlElement elem, ObjectWrapper root)
 		{
 			string className = elem.GetAttribute ("class");
 			ClassDescriptor klass;
@@ -191,24 +194,29 @@
 			
 			if (klass == null) {
 				ErrorWidget we = new ErrorWidget (className, elem.GetAttribute ("id"));
-				ErrorWidgetWrapper wrap = (ErrorWidgetWrapper) Create (reader.Project, we);
+				ErrorWidgetWrapper wrap = (ErrorWidgetWrapper) Create (reader.Project, we, null);
 				wrap.Read (reader, elem);
 				return wrap;
 			}
 			if (!klass.SupportsGtkVersion (reader.Project.TargetGtkVersion)) {
 				ErrorWidget we = new ErrorWidget (className, klass.TargetGtkVersion, reader.Project.TargetGtkVersion, elem.GetAttribute ("id"));
-				ErrorWidgetWrapper wrap = (ErrorWidgetWrapper) Create (reader.Project, we);
+				ErrorWidgetWrapper wrap = (ErrorWidgetWrapper) Create (reader.Project, we, null);
 				wrap.Read (reader, elem);
 				return wrap;
 			}
 
 			ObjectWrapper wrapper = klass.CreateWrapper ();
+			if (root != null) {
+				if (root.RootWrapperName != null) {
+					wrapper.RootWrapperName = root.RootWrapperName; 
+				} 
+			}
 			wrapper.classDescriptor = klass;
 			wrapper.proj = reader.Project;
-			return ReadObject (reader, elem, wrapper);
+			return ReadExistingObject (reader, elem, wrapper);
 		}
 
-		public static ObjectWrapper ReadObject (ObjectReader reader, XmlElement elem, ObjectWrapper wrapper)
+		public static ObjectWrapper ReadExistingObject (ObjectReader reader, XmlElement elem, ObjectWrapper wrapper)
 		{
 			try {
 				wrapper.OnBeginRead (reader.Format);
@@ -218,7 +226,7 @@
 			catch (Exception ex) {
 				Console.WriteLine (ex);
 				ErrorWidget we = new ErrorWidget (ex, elem.GetAttribute ("id"));
-				ErrorWidgetWrapper wrap = (ErrorWidgetWrapper) Create (reader.Project, we);
+				ErrorWidgetWrapper wrap = (ErrorWidgetWrapper) Create (reader.Project, we, null);
 				wrap.Read (reader, elem);
 				return wrap;
 			}
@@ -329,6 +337,10 @@
 			OnObjectChanged (new ObjectWrapperEventArgs (this));
 		}
 		
+		public abstract string Name { get; set; }
+		
+		public string RootWrapperName { get; protected set; }
+		
 		static object GetIndentityObject (object ob)
 		{
 			if (ob is Gtk.Container.ContainerChild) {
Index: libstetic/wrapper/ChangeLog
===================================================================
--- libstetic/wrapper/ChangeLog	(revision 0)
+++ libstetic/wrapper/ChangeLog	(revision 107)
@@ -0,0 +1,12 @@
+2010-08-03  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Frame.cs: Pass root wrapper as an argument for ObjectWrapper.Create
+	* Action.cs:
+	* Window.cs:
+	* Button.cs:
+	* Widget.cs:
+	* Expander.cs:
+	* Container.cs:
+	* ActionGroup.cs:
+	* ScrolledWindow.cs: 
+
Index: libstetic/wrapper/Button.cs
===================================================================
--- libstetic/wrapper/Button.cs	(revision 17)
+++ libstetic/wrapper/Button.cs	(working copy)
@@ -208,11 +208,12 @@
 			Gtk.Alignment alignment = new Gtk.Alignment (button.Xalign, button.Yalign, 0.0f, 0.0f);
 			alignment.Add (box);
 
-			Widget wrapper = (Widget)ObjectWrapper.Create (proj, labelWidget);
+			ObjectWrapper buttonWrapper = ObjectWrapper.Lookup (this);
+			Widget wrapper = (Widget)ObjectWrapper.Create (proj, labelWidget, buttonWrapper);
 			wrapper.Unselectable = true;
-			wrapper = (Widget)ObjectWrapper.Create (proj, box);
+			wrapper = (Widget)ObjectWrapper.Create (proj, box, buttonWrapper);
 			wrapper.Unselectable = true;
-			wrapper = (Widget)ObjectWrapper.Create (proj, alignment);
+			wrapper = (Widget)ObjectWrapper.Create (proj, alignment, buttonWrapper);
 			wrapper.Unselectable = true;
 
 			alignment.ShowAll ();
Index: libstetic/wrapper/Action.cs
===================================================================
--- libstetic/wrapper/Action.cs	(revision 17)
+++ libstetic/wrapper/Action.cs	(working copy)
@@ -43,7 +43,7 @@
 			get { return (Gtk.Action) Wrapped; }
 		}
 		
-		public string Name {
+		public override string Name {
 			get {
 				if (name == null || name.Length == 0) {
 					name = nameRoot = oldDefaultName = GetDefaultName ();
@@ -250,7 +250,7 @@
 		
 		public Action Clone ()
 		{
-			Action a = (Action) ObjectWrapper.Create (Project, new Gtk.Action ("", ""));
+			Action a = (Action) ObjectWrapper.Create (Project, new Gtk.Action ("", ""), this);
 			a.CopyFrom (this);
 			return a;
 		}
Index: libstetic/wrapper/Container.cs
===================================================================
--- libstetic/wrapper/Container.cs	(revision 17)
+++ libstetic/wrapper/Container.cs	(working copy)
@@ -41,7 +41,7 @@
 				Gtk.Widget child = prop.GetValue (container) as Gtk.Widget;
 				if (child == null)
 					continue;
-				Widget wrapper = ObjectWrapper.Create (proj, child) as Stetic.Wrapper.Widget;
+				Widget wrapper = ObjectWrapper.Create (proj, child, this) as Stetic.Wrapper.Widget;
 				wrapper.InternalChildProperty = prop;
 				if (child.Name == ((GLib.GType)child.GetType ()).ToString ())
 					child.Name = container.Name + "_" + prop.Name;
@@ -361,7 +361,7 @@
 
 		protected virtual ObjectWrapper ReadChild (ObjectReader reader, XmlElement child_elem)
 		{
-			ObjectWrapper wrapper = reader.ReadObject (child_elem["widget"]);
+			ObjectWrapper wrapper = reader.ReadObject (child_elem["widget"], this);
 			Container.ContainerChild childwrapper = null;
 			
 			try {
@@ -414,7 +414,7 @@
 				Gtk.Widget child = prop.GetValue (container) as Gtk.Widget;
 				Widget wrapper = Widget.Lookup (child);
 				if (wrapper != null) {
-					reader.ReadObject (wrapper, child_elem["widget"]);
+					reader.ReadExistingObject (wrapper, child_elem["widget"]);
 					if (reader.Format == FileFormat.Glade)
 						GladeUtils.SetPacking (ChildWrapper (wrapper), child_elem);
 					else
@@ -770,7 +770,7 @@
 			if (cwrap != null)
 				return cwrap;
 			else
-				return Stetic.ObjectWrapper.Create (parentWrapper.proj, cc) as ContainerChild;
+				return Stetic.ObjectWrapper.Create (parentWrapper.proj, cc, parentWrapper) as ContainerChild;
 		}
 
 		protected Gtk.Container.ContainerChild ContextChildProps (Gtk.Widget context)
@@ -1449,6 +1449,8 @@
 					EmitNotify ("AutoSize");
 				}
 			}
+			
+			public override string Name { get; set; }
 		}
 	}
 }
Index: libstetic/wrapper/Widget.cs
===================================================================
--- libstetic/wrapper/Widget.cs	(revision 17)
+++ libstetic/wrapper/Widget.cs	(working copy)
@@ -241,7 +241,7 @@
 			Wrapped.Name = name;
 		}
 		
-		public string Name {
+		public override string Name {
 			get { return Wrapped.Name; }
 			set { Wrapped.Name = value; EmitNotify ("Name"); }
 		}
@@ -806,7 +806,7 @@
 					Gtk.ScrolledWindow scw = new Gtk.ScrolledWindow ();
 					scw.HscrollbarPolicy = scw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
 					scw.ShadowType = Gtk.ShadowType.In;
-					ScrolledWindow wrapper = (ScrolledWindow) ObjectWrapper.Create (Project, scw);
+					ScrolledWindow wrapper = (ScrolledWindow) ObjectWrapper.Create (Project, scw, ParentWrapper);
 					ParentWrapper.ReplaceChild (Wrapped, scw, false);
 					if (Wrapped.SetScrollAdjustments (null, null))
 						scw.Add (Wrapped);
Index: libstetic/wrapper/Frame.cs
===================================================================
--- libstetic/wrapper/Frame.cs	(revision 17)
+++ libstetic/wrapper/Frame.cs	(working copy)
@@ -17,21 +17,21 @@
 				if (AllowPlaceholders) {
 					Gtk.Alignment align = new Gtk.Alignment (0, 0, 1, 1);
 					align.LeftPadding = 12;
-					Container align_wrapper = (Container)ObjectWrapper.Create (proj, align);
+					Container align_wrapper = (Container)ObjectWrapper.Create (proj, align, this);
 					align_wrapper.AddPlaceholder ();
 					ReplaceChild (frame.Child, (Gtk.Widget)align_wrapper.Wrapped, true);
 				}
 			}
 
 			if (frame.LabelWidget != null)
-				ObjectWrapper.Create (proj, frame.LabelWidget);
+				ObjectWrapper.Create (proj, frame.LabelWidget, this);
 			frame.AddNotification ("label-widget", LabelWidgetChanged);
 		}
 
 		void LabelWidgetChanged (object obj, GLib.NotifyArgs args)
 		{
 			if (!IsDisposed && frame.LabelWidget != null && !(frame.LabelWidget is Stetic.Placeholder))
-				ObjectWrapper.Create (proj, frame.LabelWidget);
+				ObjectWrapper.Create (proj, frame.LabelWidget, this);
 		}
 
 		Gtk.Frame frame {
@@ -43,7 +43,7 @@
 		protected override ObjectWrapper ReadChild (ObjectReader reader, XmlElement child_elem)
 		{
 			if ((string)GladeUtils.GetChildProperty (child_elem, "type", "") == "label_item") {
-				ObjectWrapper wrapper = reader.ReadObject (child_elem["widget"]);
+				ObjectWrapper wrapper = reader.ReadObject (child_elem["widget"], this);
 				frame.LabelWidget = (Gtk.Widget)wrapper.Wrapped;
 				return wrapper;
 			} else
Index: libstetic/wrapper/ActionGroup.cs
===================================================================
--- libstetic/wrapper/ActionGroup.cs	(revision 17)
+++ libstetic/wrapper/ActionGroup.cs	(working copy)
@@ -39,7 +39,7 @@
 			get { return actions; }
 		}
 		
-		public string Name {
+		public override string Name {
 			get { return name; }
 			set { 
 				name = value;
Index: libstetic/wrapper/OptionMenu.cs
===================================================================
--- libstetic/wrapper/OptionMenu.cs	(revision 17)
+++ libstetic/wrapper/OptionMenu.cs	(working copy)
@@ -50,7 +50,7 @@
 		protected override ObjectWrapper ReadChild (ObjectReader reader, XmlElement child_elem)
 		{
 			Widget wrapper = Stetic.Wrapper.Widget.Lookup (optionmenu.Menu);
-			reader.ReadObject (wrapper, child_elem["widget"]);
+			reader.ReadExistingObject (wrapper, child_elem["widget"]);
 			return wrapper;
 		}
 
Index: libstetic/wrapper/ScrolledWindow.cs
===================================================================
--- libstetic/wrapper/ScrolledWindow.cs	(revision 17)
+++ libstetic/wrapper/ScrolledWindow.cs	(working copy)
@@ -55,7 +55,7 @@
 		internal void AddWithViewport (Gtk.Widget child)
 		{
 			Gtk.Viewport viewport = new Gtk.Viewport (scrolled.Hadjustment, scrolled.Vadjustment);
-			ObjectWrapper.Create (proj, viewport);
+			ObjectWrapper.Create (proj, viewport, this);
 			viewport.ShadowType = Gtk.ShadowType.None;
 			viewport.Add (child);
 			viewport.Show ();
Index: libstetic/wrapper/Window.cs
===================================================================
--- libstetic/wrapper/Window.cs	(revision 17)
+++ libstetic/wrapper/Window.cs	(working copy)
@@ -10,7 +10,9 @@
 		public override void Wrap (object obj, bool initialized)
 		{
 			TopLevelWindow window = (TopLevelWindow) obj;
+			RootWrapperName = window.Name;
 
+			//during Wrap RootWrapperName will be set in the children widgets
 			base.Wrap (obj, initialized);
 
 			if (!initialized) {
Index: libstetic/wrapper/Notebook.cs
===================================================================
--- libstetic/wrapper/Notebook.cs	(revision 17)
+++ libstetic/wrapper/Notebook.cs	(working copy)
@@ -31,7 +31,7 @@
 		protected override ObjectWrapper ReadChild (ObjectReader reader, XmlElement child_elem)
 		{
 			if ((string)GladeUtils.GetChildProperty (child_elem, "type", "") == "tab") {
-				ObjectWrapper wrapper = reader.ReadObject (child_elem["widget"]);
+				ObjectWrapper wrapper = reader.ReadObject (child_elem["widget"], this);
 				Gtk.Widget widget = (Gtk.Widget)wrapper.Wrapped;
 				notebook.SetTabLabel (notebook.GetNthPage (notebook.NPages - 1), widget);
 				tabs.Add (widget);
Index: libstetic/wrapper/MenuItem.cs
===================================================================
--- libstetic/wrapper/MenuItem.cs	(revision 17)
+++ libstetic/wrapper/MenuItem.cs	(working copy)
@@ -18,7 +18,7 @@
 
 		protected override ObjectWrapper ReadChild (ObjectReader reader, XmlElement child_elem)
 		{
-			ObjectWrapper wrapper = reader.ReadObject (child_elem["widget"]);
+			ObjectWrapper wrapper = reader.ReadObject (child_elem["widget"], this);
 			menuitem.Submenu = (Gtk.Menu)wrapper.Wrapped;
 			return wrapper;
 		}
Index: libstetic/wrapper/objects.xml
===================================================================
--- libstetic/wrapper/objects.xml	(revision 17)
+++ libstetic/wrapper/objects.xml	(working copy)
@@ -104,17 +104,17 @@
 	    <!-- "events" property has extra spaces around "|"s -->
 	    <import>
 		<xsl:template match="widget/property[@name='events']/text()">
-		    <xsl:call-template name="GtkWidget_fixevents">
+		    <xsl:call-template name="GtkWidget_fixevents2">
 			<xsl:with-param name="string" select="." />
 		    </xsl:call-template>
 		</xsl:template>
-		<xsl:template name="GtkWidget_fixevents">
+		<xsl:template name="GtkWidget_fixevents2">
 		    <xsl:param name="string"/>
 		    <xsl:choose>
 			<xsl:when test="contains($string, ' | ')">
 			    <xsl:value-of select="substring-before($string, ' | ')"/>
 			    <xsl:text>|</xsl:text>
-			    <xsl:call-template name="GtkWidget_fixevents">
+			    <xsl:call-template name="GtkWidget_fixevents2">
 				<xsl:with-param name="string" select="substring-after($string, ' | ')"/>
 			    </xsl:call-template>
 			</xsl:when>
@@ -126,17 +126,17 @@
 	    </import>
 	    <export>
 		<xsl:template match="widget/property[@name='events']/text()">
-		    <xsl:call-template name="GtkWidget_breakevents">
+		    <xsl:call-template name="GtkWidget_breakevents2">
 			<xsl:with-param name="string" select="." />
 		    </xsl:call-template>
 		</xsl:template>
-		<xsl:template name="GtkWidget_breakevents">
+		<xsl:template name="GtkWidget_breakevents2">
 		    <xsl:param name="string"/>
 		    <xsl:choose>
 			<xsl:when test="contains($string, '|')">
 			    <xsl:value-of select="substring-before($string, '|')"/>
 			    <xsl:text> | </xsl:text>
-			    <xsl:call-template name="GtkWidget_breakevents">
+			    <xsl:call-template name="GtkWidget_breakevents2">
 				<xsl:with-param name="string" select="substring-after($string, '|')"/>
 			    </xsl:call-template>
 			</xsl:when>
@@ -1316,19 +1316,19 @@
 	    <!-- Child packing options are non-standard ("expand" instead of "GTK_EXPAND") -->
 	    <import>
 		<xsl:template match="widget[@class='GtkTable']/child/packing/property[@name='x_options' or @name='y_options']/text()">
-		    <xsl:call-template name="GtkTable_fixoptions">
+		    <xsl:call-template name="GtkTable_fixoptions2">
 			<xsl:with-param name="string" select="." />
 		    </xsl:call-template>
 		</xsl:template>
-		<xsl:template name="GtkTable_fixoptions">
+		<xsl:template name="GtkTable_fixoptions2">
 		    <xsl:param name="string"/>
 		    <xsl:choose>
 			<xsl:when test="contains($string, '|')">
-			    <xsl:call-template name="GtkTable_fixoptions">
+			    <xsl:call-template name="GtkTable_fixoptions2">
 				<xsl:with-param name="string" select="substring-before($string, '|')"/>
 			    </xsl:call-template>
 			    <xsl:text>|</xsl:text>
-			    <xsl:call-template name="GtkTable_fixoptions">
+			    <xsl:call-template name="GtkTable_fixoptions2">
 				<xsl:with-param name="string" select="substring-after($string, '|')"/>
 			    </xsl:call-template>
 			</xsl:when>
@@ -1341,19 +1341,19 @@
 	    </import>
 	    <export>
 		<xsl:template match="widget[@class='GtkTable']/child/packing/property[@name='x_options' or @name='y_options']/text()">
-		    <xsl:call-template name="GtkTable_breakoptions">
+		    <xsl:call-template name="GtkTable_breakoptions2">
 			<xsl:with-param name="options" select="." />
 		    </xsl:call-template>
 		</xsl:template>
-		<xsl:template name="GtkTable_breakoptions">
+		<xsl:template name="GtkTable_breakoptions2">
 		    <xsl:param name="string"/>
 		    <xsl:choose>
 			<xsl:when test="contains($string, '|')">
-			    <xsl:call-template name="GtkTable_breakoptions">
+			    <xsl:call-template name="GtkTable_breakoptions2">
 				<xsl:with-param name="string" select="substring-before($string, '|')"/>
 			    </xsl:call-template>
 			    <xsl:text>|</xsl:text>
-			    <xsl:call-template name="GtkTable_breakoptions">
+			    <xsl:call-template name="GtkTable_breakoptions2">
 				<xsl:with-param name="string" select="substring-after($string, '|')"/>
 			    </xsl:call-template>
 			</xsl:when>
Index: libstetic/wrapper/Expander.cs
===================================================================
--- libstetic/wrapper/Expander.cs	(revision 17)
+++ libstetic/wrapper/Expander.cs	(working copy)
@@ -21,13 +21,13 @@
 					AddPlaceholder ();
 			}
 			if (expander.LabelWidget != null)
-				ObjectWrapper.Create (proj, expander.LabelWidget);
+				ObjectWrapper.Create (proj, expander.LabelWidget, this);
 		}
 
 		protected override ObjectWrapper ReadChild (ObjectReader reader, XmlElement child_elem)
 		{
 			if ((string)GladeUtils.GetChildProperty (child_elem, "type", "") == "label_item") {
-				ObjectWrapper wrapper = reader.ReadObject (child_elem["widget"]);
+				ObjectWrapper wrapper = reader.ReadObject (child_elem["widget"], this);
 				expander.LabelWidget = (Gtk.Widget)wrapper.Wrapped;
 				return wrapper;
 			} else
Index: libstetic/GladeUtils.cs
===================================================================
--- libstetic/GladeUtils.cs	(revision 17)
+++ libstetic/GladeUtils.cs	(working copy)
@@ -104,31 +104,31 @@
 			return doc;
 		}
 
-		public static Stetic.Wrapper.Widget Import (IProject project, XmlDocument doc)
-		{
-			try {
-				doc = XslImportTransform (doc);
-			} catch {
-				return null;
-			}
-
-			ObjectReader reader = new ObjectReader (project, FileFormat.Glade);
-			
-			XmlElement elem = (XmlElement)doc.SelectSingleNode ("glade-interface/widget");
-			if (elem.GetAttribute ("class") != "GtkWindow" ||
-			    elem.GetAttribute ("id") != "glade-dummy-container") {
-				// Creating a new toplevel
-				Stetic.Wrapper.Widget toplevel = (Stetic.Wrapper.Widget)
-					Stetic.ObjectWrapper.ReadObject (reader, elem);
-				if (toplevel != null) {
-					project.AddWindow ((Gtk.Window)toplevel.Wrapped);
-				}
-				return toplevel;
-			}
-
-			return (Stetic.Wrapper.Widget)
-				Stetic.ObjectWrapper.ReadObject (reader, (XmlElement)elem.SelectSingleNode ("child/widget"));
-		}
+//		public static Stetic.Wrapper.Widget Import (IProject project, XmlDocument doc)
+//		{
+//			try {
+//				doc = XslImportTransform (doc);
+//			} catch {
+//				return null;
+//			}
+//
+//			ObjectReader reader = new ObjectReader (project, FileFormat.Glade);
+//			
+//			XmlElement elem = (XmlElement)doc.SelectSingleNode ("glade-interface/widget");
+//			if (elem.GetAttribute ("class") != "GtkWindow" ||
+//			    elem.GetAttribute ("id") != "glade-dummy-container") {
+//				// Creating a new toplevel
+//				Stetic.Wrapper.Widget toplevel = (Stetic.Wrapper.Widget)
+//					Stetic.ObjectWrapper.ReadObject (reader, elem);
+//				if (toplevel != null) {
+//					project.AddWindow ((Gtk.Window)toplevel.Wrapped);
+//				}
+//				return toplevel;
+//			}
+//
+//			return (Stetic.Wrapper.Widget)
+//				Stetic.ObjectWrapper.ReadObject (reader, (XmlElement)elem.SelectSingleNode ("child/widget"));
+//		}
 		
 		public static void Copy (Gtk.Widget widget, Gtk.SelectionData seldata, bool copyAsText)
 		{
@@ -142,23 +142,23 @@
 				seldata.Set (ApplicationXGladeAtom, 8, System.Text.Encoding.UTF8.GetBytes (doc.OuterXml));
 		}
 
-		public static Stetic.Wrapper.Widget Paste (IProject project, Gtk.SelectionData seldata)
-		{
-			if (seldata.Type != ApplicationXGladeAtom)
-				return null;
-			string data = System.Text.Encoding.UTF8.GetString (seldata.Data);
+//		public static Stetic.Wrapper.Widget Paste (IProject project, Gtk.SelectionData seldata)
+//		{
+//			if (seldata.Type != ApplicationXGladeAtom)
+//				return null;
+//			string data = System.Text.Encoding.UTF8.GetString (seldata.Data);
+//
+//			XmlDocument doc = new XmlDocument ();
+//			doc.PreserveWhitespace = true;
+//			try {
+//				doc.LoadXml (data);
+//			} catch {
+//				return null;
+//			}
+//			
+//			return Import (project, doc);
+//		}
 
-			XmlDocument doc = new XmlDocument ();
-			doc.PreserveWhitespace = true;
-			try {
-				doc.LoadXml (data);
-			} catch {
-				return null;
-			}
-			
-			return Import (project, doc);
-		}
-
 		static object GetProperty (XmlElement elem, string selector, object defaultValue, bool extract)
 		{
 			XmlElement prop = (XmlElement)elem.SelectSingleNode (selector);
Index: libstetic/ErrorWidget.cs
===================================================================
--- libstetic/ErrorWidget.cs	(revision 17)
+++ libstetic/ErrorWidget.cs	(working copy)
@@ -96,9 +96,9 @@
 			ErrorWidget ew = (ErrorWidget) Wrapped;
 			string msg;
 			if (ew.Exception != null)
-				msg = Project.FileName + ": Could not generate code for an invalid widget. The widget failed to load: " + ew.Exception.Message + ". The generated code may be invalid.";
+				msg = Project.FolderName + ": Could not generate code for an invalid widget. The widget failed to load: " + ew.Exception.Message + ". The generated code may be invalid.";
 			else
-				msg = Project.FileName + ": Could not generate code for widgets of type: " + ew.ClassName + ". The widget could not be found in any referenced library. The generated code may be invalid.";
+				msg = Project.FolderName + ": Could not generate code for widgets of type: " + ew.ClassName + ". The widget could not be found in any referenced library. The generated code may be invalid.";
 			
 			if (ctx.Options.FailForUnknownWidgets) {
 				throw new InvalidOperationException (msg);
Index: libstetic/WidgetUtils.cs
===================================================================
--- libstetic/WidgetUtils.cs	(revision 17)
+++ libstetic/WidgetUtils.cs	(working copy)
@@ -37,7 +37,7 @@
 		public static Gtk.Widget ImportWidget (IProject project, XmlElement element)
 		{
 			ObjectReader reader = new ObjectReader (project, FileFormat.Native);
-			ObjectWrapper wrapper = Stetic.ObjectWrapper.ReadObject (reader, element);
+			ObjectWrapper wrapper = Stetic.ObjectWrapper.ReadObject (reader, element, null);
 			return wrapper.Wrapped as Gtk.Widget;
 		}
 		
@@ -126,11 +126,14 @@
 			Gtk.Widget widget = (Gtk.Widget) wrapper.Wrapped;
 			if (widget == null) {
 				widget = (Gtk.Widget) klass.CreateInstance (wrapper.Project);
+				//set name before binding to ensure 
+				//that ObjectWrapper.RootWrapperName will be valid
+				widget.Name = elem.GetAttribute ("id");
 				ObjectWrapper.Bind (wrapper.Project, klass, wrapper, widget, true);
+			} else {
+				widget.Name = elem.GetAttribute ("id");
 			}
 			
-			widget.Name = elem.GetAttribute ("id");
-			
 			ReadMembers (klass, wrapper, widget, elem);
 			
 			if (!(widget is Gtk.Window))
Index: MonoDevelop.GtkCore.Commands/GladeCommands.cs
===================================================================
--- MonoDevelop.GtkCore.Commands/GladeCommands.cs	(revision 17)
+++ MonoDevelop.GtkCore.Commands/GladeCommands.cs	(working copy)
@@ -36,6 +36,7 @@
 		AddNewActionGroup,
 		ImportGladeFile,
 		EditIcons,
-		GtkSettings
+		GtkSettings,
+		GenerateCode
 	}
 }
Index: MonoDevelop.GtkCore.Commands/ChangeLog
===================================================================
--- MonoDevelop.GtkCore.Commands/ChangeLog	(revision 0)
+++ MonoDevelop.GtkCore.Commands/ChangeLog	(revision 124)
@@ -0,0 +1,4 @@
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* GladeCommands.cs: 
+
Index: MonoDevelop.GtkCore/GtkDesignInfo.cs
===================================================================
--- MonoDevelop.GtkCore/GtkDesignInfo.cs	(revision 17)
+++ MonoDevelop.GtkCore/GtkDesignInfo.cs	(working copy)
@@ -29,6 +29,8 @@
 
 using System;
 using System.IO;
+using System.CodeDom;
+using System.CodeDom.Compiler;
 using System.Collections.Generic;
 using System.Collections.Specialized;
 
@@ -51,13 +53,23 @@
 		IDotNetLanguageBinding binding;
 		ProjectResourceProvider resourceProvider;
 		ReferenceManager referenceManager;
+		string langExtension;
 		
-		[ItemProperty (DefaultValue=true)]
+		[ItemProperty (DefaultValue = true)]
 		bool generateGettext = true;
 		
-		[ItemProperty (DefaultValue="Mono.Unix.Catalog")]
+		[ItemProperty (DefaultValue = "Mono.Unix.Catalog")]
 		string gettextClass = "Mono.Unix.Catalog";
 		
+		[ItemProperty (DefaultValue = "Stetic")]
+		string steticFolderName = "Stetic";
+		
+		[ItemProperty (DefaultValue = false)]
+		bool wasConverted;
+		
+		[ItemProperty (DefaultValue = true)]
+		bool hideGtkxFiles = true;
+		
 		GtkDesignInfo ()
 		{
 		}
@@ -85,8 +97,15 @@
 					referenceManager = null;
 				}
 				project = value;
+				
 				if (project != null) {
 					binding = LanguageBindingService.GetBindingPerLanguageName (project.LanguageName) as IDotNetLanguageBinding;
+					
+					CodeDomProvider provider = binding.GetCodeDomProvider ();
+					if (provider == null)
+						throw new UserException ("Code generation not supported for language: " + project.LanguageName);
+					langExtension = "." + provider.FileExtension;
+					
 					project.FileAddedToProject += OnFileEvent;
 					project.FileChangedInProject += OnFileEvent;
 					project.FileRemovedFromProject += OnFileEvent;
@@ -120,11 +139,7 @@
 			get {
 				if (builderProject == null) {
 					if (SupportsDesigner (project)) {
-						if (!File.Exists (SteticFile)) {
-							UpdateGtkFolder ();
-							ProjectNodeBuilder.OnSupportChanged (project);
-						}
-						builderProject = new GuiBuilderProject (project, SteticFile);
+						builderProject = new GuiBuilderProject (project, SteticFolder.FullPath.FullPath);
 					} else
 						builderProject = new GuiBuilderProject (project, null);
 				}
@@ -156,20 +171,27 @@
 			}
 		}
 		
+		public bool OldVersion {
+			get { return project.IsFileInProject (SteticFile); }
+		}
+		
 		FilePath ObjectsFile {
-			get { return GtkGuiFolder.Combine ("objects.xml"); }
+			get { return SteticFolder.Combine ("objects.xml"); }
 		}
 		
+		[Obsolete]
 		public FilePath SteticGeneratedFile {
-			get { return GtkGuiFolder.Combine (binding.GetFileName ("generated")); }
+			get { return SteticFolder.Combine (binding.GetFileName ("generated")); }
 		}
 		
+		[Obsolete]
 		public FilePath SteticFile {
-			get { return GtkGuiFolder.Combine ("gui.stetic"); }
+			get { return SteticFolder.Combine ("gui.stetic"); }
 		}
 		
-		public FilePath GtkGuiFolder {
-			get { return project.BaseDirectory.Combine ("gtk-gui"); }
+		public FilePath SteticFolder {
+//			get { return project.BaseDirectory.Combine ("gtk-gui"); }
+			get { return project.BaseDirectory.Combine (!wasConverted ? "gtk-gui" : steticFolderName); }
 		}
 		
 		public bool GenerateGettext {
@@ -187,13 +209,22 @@
 			set { gettextClass = value; }
 		}
 		
+		public string SteticFolderName {
+			get { return steticFolderName; }
+			set { steticFolderName = value; }
+		}
+		
+		public bool HideGtkxFiles { 
+			get { return hideGtkxFiles; }
+			set { hideGtkxFiles = value; }
+		}
+		
 		public static bool HasDesignedObjects (Project project)
 		{
 			if (project == null)
 				return false;
 
-			string stetic_file = Path.Combine (Path.Combine (project.BaseDirectory, "gtk-gui"), "gui.stetic");
-			return SupportsDesigner (project) && File.Exists (stetic_file);
+			return SupportsDesigner (project);
 		}
 
 		public static bool SupportsDesigner (Project project)
@@ -250,7 +281,7 @@
 			bool projectModified = false;
 
 			// Remove all project files which are not in the generated list
-			foreach (ProjectFile pf in project.Files.GetFilesInPath (GtkGuiFolder)) {
+			foreach (ProjectFile pf in project.Files.GetFilesInPath (SteticFolder)) {
 				if (remaining_files.Contains (pf.FilePath))
 					continue;
 
@@ -260,68 +291,218 @@
 			}
 
 			if (remaining_files.Count == 0)
-				FileService.DeleteDirectory (GtkGuiFolder);
+				FileService.DeleteDirectory (SteticFolder);
 
 			return projectModified;
 		}
 
+		public void ConvertGtkFolder (string guiFolderName, bool makeBackup)
+		{	
+			foreach (ProjectFile pf in project.Files.GetFilesInPath (SteticFolder)) {
+				FilePath path = pf.FilePath;
+				
+				if (path != SteticGeneratedFile) {
+					project.Files.Remove (path);
+					
+					if (path != SteticFile)
+						FileService.DeleteFile (path.FullPath);
+				}
+			}
+			
+			string oldGuiFolder = SteticFolder.FullPath;
+			string oldSteticFile = SteticFile;
+			string oldGeneratedFile = SteticGeneratedFile;
+			SteticFolderName = guiFolderName;
+			wasConverted = true;
+			
+			if (!Directory.Exists (SteticFolder))
+				FileService.CreateDirectory (SteticFolder);
+			
+			if (makeBackup && File.Exists (oldSteticFile)) {
+				string backupFile = SteticFolder.Combine ("old.stetic");
+				FileService.MoveFile (oldSteticFile, backupFile);
+			}
+			
+			if (File.Exists (oldGeneratedFile))
+				FileService.DeleteFile (oldGeneratedFile);
+				
+			FileService.DeleteDirectory (oldGuiFolder);
+		}
+		
 		public bool UpdateGtkFolder ()
 		{
 			if (!SupportsDesigner (project))
 				return false;
-
+			
 			// This method synchronizes the current gtk project configuration info
 			// with the needed support files in the gtk-gui folder.
 
-			FileService.CreateDirectory (GtkGuiFolder);
+			FileService.CreateDirectory (SteticFolder);
 			bool projectModified = false;
-			bool initialGeneration = false;
 			
-			if (!File.Exists (SteticFile)) {
-				initialGeneration = true;
-				StreamWriter sw = new StreamWriter (SteticFile);
-				sw.WriteLine ("<stetic-interface />");
-				sw.Close ();
-				FileService.NotifyFileChanged (SteticFile);
-			}
+			foreach (string filename in GetComponentsFiles ()) {
+				ProjectFile pf = project.AddFile (filename, BuildAction.EmbeddedResource);
+				pf.ResourceId = Path.GetFileName (filename);
+	
+				string componentFile = GetComponentFileFromGtkx (filename);
 				
-			if (!project.IsFileInProject (SteticFile)) {
-				ProjectFile pf = project.AddFile (SteticFile, BuildAction.EmbeddedResource);
-				pf.ResourceId = "gui.stetic";
+				if (componentFile != null && File.Exists (componentFile)) { 
+					pf.DependsOn = componentFile;	
+				
+					string buildFile = GetBuildFileFromGtkx (filename);
+					if (buildFile != null && File.Exists (buildFile)) {
+						ProjectFile pf2 = project.AddFile (buildFile, BuildAction.Compile);
+						pf2.ResourceId = Path.GetFileName (buildFile);
+						pf2.DependsOn = componentFile;
+					}
+				}
+				
 				projectModified = true;
 			}
-
-			StringCollection files = GuiBuilderProject.GenerateFiles (GtkGuiFolder);
-			DateTime generatedTime = File.GetLastWriteTime (SteticFile).Subtract (TimeSpan.FromSeconds (2));
-
+			
+			StringCollection files = GuiBuilderProject.GenerateFiles (SteticFolder);
 			foreach (string filename in files) {
-				if (initialGeneration) {
-					// Ensure that the generation date of this file is < the date of the .stetic file
-					// In this way the code will be properly regenerated when building the project.
-					File.SetLastWriteTime (filename, generatedTime);
-				}
 				if (!project.IsFileInProject (filename)) {
 					project.AddFile (filename, BuildAction.Compile);
 					projectModified = true;
 				}
+				
 			}
-
+			
 			UpdateObjectsFile ();
-			files.Add (ObjectsFile);
-			files.Add (SteticFile);
-
-			if (CleanGtkFolder (files))
-				projectModified = true;
-
+			
 			return ReferenceManager.Update () || projectModified;
 		}
 		
+//		public bool UpdateGtkFolder ()
+//		{
+//			if (!SupportsDesigner (project))
+//				return false;
+//
+//			// This method synchronizes the current gtk project configuration info
+//			// with the needed support files in the gtk-gui folder.
+//
+//			FileService.CreateDirectory (GtkGuiFolder);
+//			bool projectModified = false;
+//			bool initialGeneration = false;
+//			
+//			if (!File.Exists (SteticFile)) {
+//				initialGeneration = true;
+//				StreamWriter sw = new StreamWriter (SteticFile);
+//				sw.WriteLine ("<stetic-interface />");
+//				sw.Close ();
+//				FileService.NotifyFileChanged (SteticFile);
+//			}
+//				
+//			if (!project.IsFileInProject (SteticFile)) {
+//				ProjectFile pf = project.AddFile (SteticFile, BuildAction.EmbeddedResource);
+//				pf.ResourceId = "gui.stetic";
+//				projectModified = true;
+//			}
+//
+//			StringCollection files = GuiBuilderProject.GenerateFiles (GtkGuiFolder);
+//			DateTime generatedTime = File.GetLastWriteTime (SteticFile).Subtract (TimeSpan.FromSeconds (2));
+//
+//			foreach (string filename in files) {
+//				if (initialGeneration) {
+//					// Ensure that the generation date of this file is < the date of the .stetic file
+//					// In this way the code will be properly regenerated when building the project.
+//					File.SetLastWriteTime (filename, generatedTime);
+//				}
+//				if (!project.IsFileInProject (filename)) {
+//					project.AddFile (filename, BuildAction.Compile);
+//					projectModified = true;
+//				}
+//			}
+//
+//			UpdateObjectsFile ();
+//			files.Add (ObjectsFile);
+//			files.Add (SteticFile);
+//
+//			if (CleanGtkFolder (files))
+//				projectModified = true;
+//
+//			return ReferenceManager.Update () || projectModified;
+//			return true;
+//		}
+		
+	
+		public string GetComponentFile (string componentName)
+		{
+			IType type = GuiBuilderProject.FindClass (componentName);
+			
+			if (type != null) {
+				
+				foreach (IType part in type.Parts) {
+					string componentFile = part.CompilationUnit.FileName.FullPath.ToString ();
+//					if (!componentFile.Contains (".generated"))
+//						return componentFile;
+					if (componentFile.Contains (".generated"))
+						componentFile = componentFile.Replace (".generated", string.Empty);
+					
+					return componentFile;
+				}
+			}
+			
+			return null;
+		}
+		
+		public string GetBuildFile (string componentFile)
+		{	
+			if (componentFile != null) {
+				string buildFile = componentFile.Replace 
+					(Path.GetExtension (SteticGeneratedFile), ".generated" + langExtension);
+				return buildFile;
+			}
+			
+			return null;
+		}
+		
+		public string GetBuildFileInSteticFolder (string componentName)
+		{
+			string name = string.Format ("{0}.generated{1}", componentName, langExtension);
+			string buildFile = Path.Combine (SteticFolder, name);
+			
+			return buildFile;
+		}
+		
+		public string GetGtkxFile (string componentFile)
+		{
+			if (componentFile != null) {
+				string gtkxFile = componentFile.Replace (langExtension, ".gtkx");
+				return gtkxFile;
+			}
+			
+			return null;
+		}
+		
+		public string GetComponentFileFromGtkx (string gtkxFile)
+		{
+			if (gtkxFile != null) { 
+				string componentFile = gtkxFile.Replace (".gtkx", langExtension);
+				return componentFile;
+			}
+			
+			return null;
+		}
+		
+		public string GetBuildFileFromGtkx (string gtkxFile)
+		{
+			string buildFile = gtkxFile.Replace (".gtkx", ".generated" + langExtension);
+			return buildFile;
+		}
+		
+		
 		public string GetComponentFolder (string componentName)
 		{
 			IType type = GuiBuilderProject.FindClass (componentName);
-			FilePath folder = type.CompilationUnit.FileName.ParentDirectory;
 			
-			return folder.FullPath.ToString ();
+			if (type != null) {
+				FilePath folder = type.CompilationUnit.FileName.ParentDirectory;
+				return folder.FullPath.ToString ();
+			}
+			
+			return null;
 		}
 		
 		public string[] GetComponentFolders ()
@@ -329,17 +510,54 @@
 			List<string> folders = new List<string> ();
 			ProjectDom ctx = GuiBuilderProject.GetParserContext ();
 			
-			foreach (IType type in ctx.Types) {
-				FilePath folder = type.CompilationUnit.FileName.ParentDirectory;
-				string folderName = folder.FullPath.ToString ();
+			foreach (IType type in ctx.Types)
+				foreach (IType part in type.Parts) {
+					FilePath folder = part.CompilationUnit.FileName.ParentDirectory;
+					string folderName = folder.FullPath.ToString ();
 				
-				if (!folders.Contains (folderName))
-					folders.Add (folder);
+					if (!folders.Contains (folderName))
+						folders.Add (folder);
 			}
 			
 			return folders.ToArray ();
 		}
+		
+		public string[] GetComponentsFiles ()
+		{
+			List<string> files = new List<string> ();
+			
+			foreach (string folder in GetComponentFolders ()) {
+				DirectoryInfo dir = new DirectoryInfo (folder);
+				
+				foreach (FileInfo file in dir.GetFiles ()) 
+					if (file.Extension == ".gtkx") 
+						files.Add (file.ToString ());
+			}
+			
+			return files.ToArray ();
+		}
 
+		public bool HasComponentFile (string componentName)
+		{
+			return (GetComponentFile (componentName) != null);
+		}
+		
+		public bool ComponentNeedsCodeGeneration (string componentName)
+		{
+			string componentFile = GetComponentFile (componentName);
+			string gtkxFile = GetGtkxFile (componentFile);
+			string buildFile = GetBuildFile (componentFile);
+			FileInfo gtkxFileInfo = File.Exists (gtkxFile) ? new FileInfo (gtkxFile) : null;
+			FileInfo buildFileInfo = File.Exists (buildFile) ? new FileInfo (buildFile) : null;
+			Console.WriteLine(gtkxFile);
+			if (gtkxFileInfo == null)
+				return false;
+			if (buildFileInfo == null)
+			//file does not exist
+				return true;
+			return gtkxFileInfo.LastWriteTime > buildFileInfo.LastWriteTime;
+		}
+
 		void UpdateObjectsFile ()
 		{
 			if (!File.Exists (ObjectsFile))
Index: MonoDevelop.GtkCore/ChangeLog
===================================================================
--- MonoDevelop.GtkCore/ChangeLog	(revision 0)
+++ MonoDevelop.GtkCore/ChangeLog	(revision 125)
@@ -0,0 +1,36 @@
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* WidgetFileDescriptionTemplate.cs: 
+
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* GtkDesignInfo.cs: 
+
+2010-08-13  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* GtkDesignInfo.cs: 
+
+2010-08-09  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* GtkDesignInfo.cs:  Add ComponentNeedsCodeGeneration method,
+
+2010-08-04  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* WidgetFileDescriptionTemplate.cs: Bump Api
+
+2010-07-06  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* GtkDesignInfo.cs: Remove gtk-gui folder after project conversion
+
+2010-06-23  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* GtkDesignInfo.cs: 
+
+2010-06-16  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* GtkDesignInfo.cs: 
+
+2010-06-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* GtkDesignInfo.cs:  Transition from project file name to project folder.
+
Index: MonoDevelop.GtkCore/WidgetFileDescriptionTemplate.cs
===================================================================
--- MonoDevelop.GtkCore/WidgetFileDescriptionTemplate.cs	(revision 17)
+++ MonoDevelop.GtkCore/WidgetFileDescriptionTemplate.cs	(working copy)
@@ -91,7 +91,7 @@
 			string fileName = fileTemplate.GetFileName (policyParent, project, language, directory, name);
 			fileTemplate.AddToProject (policyParent, project, language, directory, name);
 
-			ProjectDomService.Parse (project, fileName, null);
+			ProjectDomService.Parse (project, fileName);
 			
 			DotNetProject netProject = project as DotNetProject;
 			string ns = netProject != null ? netProject.GetDefaultNamespace (fileName) : "";
@@ -125,7 +125,8 @@
 				XmlDocument doc = new XmlDocument ();
 				doc.LoadXml (content);
 				
-				gproject.SteticProject.AddNewActionGroup (doc.DocumentElement);
+				Stetic.Project sproject = gproject.SteticProject;
+				sproject.AddNewActionGroup (doc.DocumentElement);
 				gproject.Save (false);
 				IdeApp.ProjectOperations.Save (project);
 				return true;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 17)
+++ ChangeLog	(working copy)
@@ -1,3 +1,117 @@
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* MonoDevelop.GtkCore.addin.xml: 
+
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* Makefile.am:
+	* MonoDevelop.GtkCore2.csproj:
+	* MonoDevelop.GtkCore.addin.xml: 
+
+2010-08-09  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* Makefile.am:
+	* MonoDevelop.GtkCore2.csproj:
+	* MonoDevelop.GtkCore.addin.xml: Add GuiFolderBuilderNode extension
+
+2010-08-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* MonoDevelop.GtkCore2.csproj: 
+
+2010-08-04  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* MonoDevelop.GtkCore2.csproj: 
+
+2010-07-27  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs: 
+	Remove autoCommit argument 
+
+2010-07-05  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Makefile.am:
+	* MonoDevelop.GtkCore2.csproj:
+	* MonoDevelop.GtkCore.addin.xml: 
+
+2010-06-28  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* MonoDevelop.GtkCore/GtkDesignInfo.cs: 
+	* MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs:
+	* MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs:
+	* MonoDevelop.GtkCore.NodeBuilders/ProjectNodeBuilder.cs:
+	* MonoDevelop.GtkCore.NodeBuilders/ProjectFileExtension.cs:
+	* MonoDevelop.GtkCore.NodeBuilders/ProjectFileNodeBuilderExtension.cs:
+	Fixes fo better file grouping in the project pad
+
+
+2010-06-28  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* MonoDevelop.GtkCore2.csproj: 
+
+2010-06-23  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+	Draw action group icon
+	* gtk-gui/gui.stetic:
+	* MonoDevelop.GtkCore2.csproj:
+	* MonoDevelop.GtkCore/GtkDesignInfo.cs:
+	* MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs:
+	* MonoDevelop.GtkCore.NodeBuilders/ProjectNodeBuilder.cs:
+	* MonoDevelop.GtkCore.NodeBuilders/ProjectFileExtension.cs:
+	* MonoDevelop.GtkCore.NodeBuilders/ProjectFileNodeBuilderExtension.cs:
+
+2010-06-23  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Makefile.am:
+	* MonoDevelop.GtkCore2.csproj: 
+
+2010-06-22  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Makefile.am:
+	* MonoDevelop.GtkCore2.csproj:
+	* MonoDevelop.GtkCore.addin.xml:
+	* MonoDevelop.GtkCore/GtkDesignInfo.cs:
+	* MonoDevelop.GtkCore.NodeBuilders/ProjectNodeBuilder.cs:
+	* MonoDevelop.GtkCore.NodeBuilders/ProjectFileExtension.cs:
+	* MonoDevelop.GtkCore.NodeBuilders/ProjectFileNodeBuilderExtension.cs:
+	* MonoDevelop.GtkCore.NodeBuilders/ProjectFolderNodeBuilderExtension.cs:
+
+
+2010-06-16  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* MonoDevelop.GtkCore.addin.xml: 
+
+2010-06-15  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+	 Changes in the project pad for displaying grouped component files
+
+	* Makefile.am:
+	* MonoDevelop.GtkCore2.csproj:
+	* MonoDevelop.GtkCore.addin.xml:
+	* MonoDevelop.GtkCore/GtkDesignInfo.cs:
+	* MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs:
+	* MonoDevelop.GtkCore.NodeBuilders/WindowsFolderNodeBuilder.cs:
+	* MonoDevelop.GtkCore.NodeBuilders/ProjectFileNodeBuilderExtension.cs:
+
+
+2010-06-09  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* gtk-gui/gui.stetic:
+	* MonoDevelop.GtkCore2.csproj:
+	* MonoDevelop.GtkCore/GtkDesignInfo.cs: Add gtkx files to project
+	* MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs: 
+
+2010-06-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* gtk-gui/gui.stetic:
+	* MonoDevelop.GtkCore/GtkDesignInfo.cs:
+	* MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs: 
+
+2010-06-02  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* Makefile.am:
+	* MonoDevelop.GtkCore2.csproj:
+	* MonoDevelop.GtkCore/GtkDesignInfo.cs:
+	* MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs: 
+		Move generated partial class for components from gtk-gui.
+
 2010-04-29  Michael Hutchinson  <mhutchinson@novell.com>
 
 	* MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs: Track
Index: MonoDevelop.GtkCore.addin.xml
===================================================================
--- MonoDevelop.GtkCore.addin.xml	(revision 17)
+++ MonoDevelop.GtkCore.addin.xml	(working copy)
@@ -1,6 +1,6 @@
 <Addin id = "GtkCore2"
        namespace = "MonoDevelop"
-       name	= "GTK# Visual Designer 2"
+       name	= "GTK# Visual Designer (experimental)"
        author	 = "Lluis Sanchez Gual, Krzysztof Marecki"
        copyright = "X11"
        url       = ""
@@ -20,6 +20,7 @@
 		<Addin id="Core" version="2.4"/>
 		<Addin id="Ide" version="2.4"/>
 		<Addin id="DesignerSupport" version="2.4"/>
+		<Addin id="XmlEditor" version="2.4"/>
 	</Dependencies>
 	
 	<ExtensionPoint path = "/MonoDevelop/GtkCore/ContextMenu/ProjectPad.ActionGroup">
@@ -43,12 +44,13 @@
 	</Extension>
 	
 	<Extension path = "/MonoDevelop/Ide/Pads/ProjectPad">
+		<NodeBuilder class = "MonoDevelop.GtkCore.NodeBuilders.GuiProjectFolderNodeBuilder"/>
 		<NodeBuilder class = "MonoDevelop.GtkCore.NodeBuilders.ProjectFolderNodeBuilderExtension"/>
+		<NodeBuilder class = "MonoDevelop.GtkCore.NodeBuilders.ProjectFileNodeBuilderExtension"/>
 		<NodeBuilder class = "MonoDevelop.GtkCore.NodeBuilders.ProjectNodeBuilder"/>
-		<NodeBuilder class = "MonoDevelop.GtkCore.NodeBuilders.WidgetNodeBuilder"/>
 		<NodeBuilder class = "MonoDevelop.GtkCore.NodeBuilders.WindowsFolderNodeBuilder"/>
-		<NodeBuilder class = "MonoDevelop.GtkCore.NodeBuilders.ActionGroupNodeBuilder"/>
 		<NodeBuilder class = "MonoDevelop.GtkCore.NodeBuilders.StockIconsNodeBuilder"/>
+		<NodeBuilder class = "MonoDevelop.GtkCore.NodeBuilders.ProjectFileNodeBuilderExtension" />
 	</Extension>
 	
 	<Extension path = "/MonoDevelop/Ide/FileTemplates">
@@ -87,9 +89,13 @@
 		<Command id = "MonoDevelop.GtkCore.GtkCommands.ImportGladeFile"
 				_label = "Import Glade file..." />
 		<Command id = "MonoDevelop.GtkCore.GtkCommands.EditIcons"
+				 icon = "md-gtkcore-iconfactory"
 				_label = "Edit Project Icons..." />
 		<Command id = "MonoDevelop.GtkCore.GtkCommands.GtkSettings"
-				_label = "GTK# support settings..." />
+				_label = "GTK# support settings..." 
+				 icon = "md-gtkcore-gtk-logo"/>
+		<Command id = "MonoDevelop.GtkCore.GtkCommands.GenerateCode"
+				_label = "Generate code..."/>
 		</Category>
 	</Extension>
 	
@@ -103,16 +109,16 @@
 		</Condition>
 	</Extension>
 	
-	<Extension path = "/MonoDevelop/GtkCore/ContextMenu/ProjectPad.UserInterfaceFolder">
-		<CommandItem id = "MonoDevelop.GtkCore.GtkCommands.AddNewDialog" />
-		<CommandItem id = "MonoDevelop.GtkCore.GtkCommands.AddNewWindow" />
-		<CommandItem id = "MonoDevelop.GtkCore.GtkCommands.AddNewWidget" />
-		<CommandItem id = "MonoDevelop.GtkCore.GtkCommands.AddNewActionGroup" />
-		<SeparatorItem />
-		<CommandItem id = "MonoDevelop.GtkCore.GtkCommands.EditIcons" />
-		<CommandItem id = "MonoDevelop.GtkCore.GtkCommands.ImportGladeFile" />
-		<SeparatorItem />
-		<CommandItem id = "MonoDevelop.GtkCore.GtkCommands.GtkSettings" />
+	<Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad">
+		<Condition id="ItemType" value="Project|MonoDevelop.GtkCore.NodeBuilders.GuiProjectFolder">
+			<CommandItem id = "MonoDevelop.GtkCore.GtkCommands.EditIcons" insertafter="BuildSectionEnd"/>
+			<CommandItem id = "MonoDevelop.GtkCore.GtkCommands.ImportGladeFile" />
+			<SeparatorItem/>
+			<CommandItem id = "MonoDevelop.GtkCore.GtkCommands.GtkSettings" />
+		</Condition>
+		<Condition id="ItemType" value="ProjectFile">
+			<CommandItem id = "MonoDevelop.GtkCore.GtkCommands.GenerateCode" insertafter="BuildSectionEnd"/>
+		</Condition>
 	</Extension>
 	
 	<Extension path = "/MonoDevelop/GtkCore/ContextMenu/ProjectPad.Component">
@@ -145,7 +151,8 @@
 			<Section id = "SteticOptionsPanel"
 			             _label = "GTK# Settings"
 			             fill="true"
-			             class = "MonoDevelop.GtkCore.Dialogs.WidgetBuilderOptionPanel"/>
+			             class = "MonoDevelop.GtkCore.Dialogs.WidgetBuilderOptionPanel"
+			             icon = "md-gtkcore-gtk-logo"/>
 		</Condition>
 	</Extension>
 	
@@ -158,8 +165,17 @@
 		<StockIcon stockid = "md-gtkcore-dialog" resource = "dialog.png" />
 		<StockIcon stockid = "md-gtkcore-widget" resource = "widget.png" />
 		<StockIcon stockid = "md-gtkcore-actiongroup" resource = "actiongroup.png" />
+		<StockIcon stockid = "md-gtkcore-iconfactory" resource = "image-x-generic.png" />
+		<StockIcon stockid = "md-gtkcore-gtkx" resource = "gtkx.png" />
+		<StockIcon stockid = "md-gtkcore-gtk-logo" resource = "gtk-logo.png"/>
 	</Extension>
 	
+	<Extension path = "/MonoDevelop/Core/MimeTypes">
+		<MimeType id="text/x-gtkx" _description="Gtk# designer file" icon="gtk-page-setup" isText="true">
+			<File pattern="*.gtkx" />
+		</MimeType>
+	</Extension>
+	
 	<Extension path = "/MonoDevelop/ProjectModel/ProjectServiceExtensions">
 		<Class class = "MonoDevelop.GtkCore.GuiBuilder.GtkProjectServiceExtension"  insertafter="MidStep"/>
 	</Extension>
@@ -181,6 +197,10 @@
 	</Extension>
 
 	<Extension path = "/MonoDevelop/Ide/GlobalOptionsDialog/Preferences/Style">
-		<Panel _label = "GTK# Designer" class = "MonoDevelop.GtkCore.Dialogs.GtkDesignerOptionPanel" />
+		<Panel _label = "GTK# Designer" class = "MonoDevelop.GtkCore.Dialogs.GtkDesignerOptionPanel"  />
 	</Extension>
+	
+	<Extension path = "/MonoDevelop/XmlEditor/XmlFileExtensions">
+		 <XmlFileExtension extension = ".gtkx"/>
+	</Extension>
 </Addin>
Index: MonoDevelop.GtkCore.NodeBuilders/ProjectFolderNodeBuilderExtension.cs
===================================================================
--- MonoDevelop.GtkCore.NodeBuilders/ProjectFolderNodeBuilderExtension.cs	(revision 17)
+++ MonoDevelop.GtkCore.NodeBuilders/ProjectFolderNodeBuilderExtension.cs	(working copy)
@@ -25,15 +25,15 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
-
 using System;
 using MonoDevelop.Projects;
 using MonoDevelop.Ide.Gui.Pads.ProjectPad;
 using MonoDevelop.Components.Commands;
 using MonoDevelop.GtkCore.GuiBuilder;
+using MonoDevelop.Ide.Gui;
 using MonoDevelop.Ide.Gui.Components;
 using MonoDevelop.Ide;
+using MonoDevelop.Ide.Commands;
 
 namespace MonoDevelop.GtkCore.NodeBuilders
 {
@@ -41,8 +41,9 @@
 	{
 		public override bool CanBuildNode (Type dataType)
 		{
-			return typeof(ProjectFolder).IsAssignableFrom (dataType) ||
-			       typeof(DotNetProject).IsAssignableFrom (dataType);
+			return typeof(ProjectFolder).IsAssignableFrom (dataType) && !(dataType is GuiProjectFolder);
+//			       typeof(DotNetProject).IsAssignableFrom (dataType);
+			return false;
 		}
 		
 		public override Type CommandHandlerType {
@@ -51,13 +52,13 @@
 		
 		public override void GetNodeAttributes (ITreeNavigator treeNavigator, object dataObject, ref NodeAttributes attributes)
 		{
-			if (treeNavigator.Options ["ShowAllFiles"])
+			if (dataObject is GuiProjectFolder)
 				return;
-
+			
 			ProjectFolder folder = dataObject as ProjectFolder;
 			if (folder != null && folder.Project is DotNetProject) {
 				GtkDesignInfo info = GtkDesignInfo.FromProject (folder.Project);
-				if (info.GtkGuiFolder == folder.Path)
+				if (info.SteticFolder == folder.Path)
 					attributes |= NodeAttributes.Hidden;
 			}
 		}
@@ -74,7 +75,7 @@
 		[CommandUpdateHandler (MonoDevelop.GtkCore.GtkCommands.AddNewDialog)]
 		public void UpdateAddNewDialogToProject (CommandInfo cinfo)
 		{
-			cinfo.Visible = CanAddWindow ();
+			cinfo.Visible = CanAddWindow () && !(CurrentNode.DataItem is GuiProjectFolder);
 		}
 		
 		[CommandHandler (MonoDevelop.GtkCore.GtkCommands.AddNewWindow)]
@@ -86,7 +87,7 @@
 		[CommandUpdateHandler (MonoDevelop.GtkCore.GtkCommands.AddNewWindow)]
 		public void UpdateAddNewWindowToProject (CommandInfo cinfo)
 		{
-			cinfo.Visible = CanAddWindow ();
+			cinfo.Visible = CanAddWindow () && !(CurrentNode.DataItem is GuiProjectFolder);
 		}
 		
 		[CommandHandler (MonoDevelop.GtkCore.GtkCommands.AddNewWidget)]
@@ -98,8 +99,8 @@
 		[CommandUpdateHandler (MonoDevelop.GtkCore.GtkCommands.AddNewWidget)]
 		public void UpdateAddNewWidgetToProject (CommandInfo cinfo)
 		{
-			cinfo.Visible = CanAddWindow ();
-		}
+			cinfo.Visible = CanAddWindow () && !(CurrentNode.DataItem is GuiProjectFolder);
+		} 
 		
 		[CommandHandler (MonoDevelop.GtkCore.GtkCommands.AddNewActionGroup)]
 		public void AddNewActionGroupToProject()
@@ -110,51 +111,20 @@
 		[CommandUpdateHandler (MonoDevelop.GtkCore.GtkCommands.AddNewActionGroup)]
 		public void UpdateAddNewActionGroupToProject(CommandInfo cinfo)
 		{
-			cinfo.Visible = CanAddWindow ();
+			cinfo.Visible = CanAddWindow () && !(CurrentNode.DataItem is GuiProjectFolder);
 		}
 		
-		[CommandHandler (GtkCommands.ImportGladeFile)]
-		protected void OnImportGladeFile ()
+		public override bool CanDropMultipleNodes (object[] dataObjects, DragOperation operation, DropPosition position)
 		{
-			Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;
-			GuiBuilderService.ImportGladeFile (project);
+			return false;
+			
+			foreach (object dataObject in dataObjects) 
+				if (dataObjects is GuiProjectFolder)
+					return false;
+			
+			return base.CanDropMultipleNodes (dataObjects, operation, position);
 		}
-		
-		[CommandUpdateHandler (GtkCommands.ImportGladeFile)]
-		protected void UpdateImportGladeFile (CommandInfo cinfo)
-		{
-			cinfo.Visible = CanAddWindow ();
-		}
-		
-		[CommandHandler (GtkCommands.EditIcons)]
-		protected void OnEditIcons ()
-		{
-			Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;
-			GuiBuilderProject gp = GtkDesignInfo.FromProject (project).GuiBuilderProject;
-			Stetic.Project sp = gp.SteticProject;
-			sp.EditIcons ();
-			gp.Save (true);
-		}
-		
-		[CommandUpdateHandler (GtkCommands.EditIcons)]
-		protected void UpdateEditIcons (CommandInfo cinfo)
-		{
-			cinfo.Visible = CanAddWindow ();
-		}
-		
-		[CommandHandler (GtkCommands.GtkSettings)]
-		protected void OnGtkSettings ()
-		{
-			Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;
-			IdeApp.ProjectOperations.ShowOptions (project, "SteticOptionsPanel");
-		}
-		
-		[CommandUpdateHandler (GtkCommands.EditIcons)]
-		protected void UpdateGtkSettings (CommandInfo cinfo)
-		{
-			cinfo.Visible = CanAddWindow ();
-		}
-		
+			
 		bool CanAddWindow ()
 		{
 			DotNetProject project = CurrentNode.GetParentDataItem (typeof(Project), true) as DotNetProject;
Index: MonoDevelop.GtkCore.NodeBuilders/StockIconsNodeBuilder.cs
===================================================================
--- MonoDevelop.GtkCore.NodeBuilders/StockIconsNodeBuilder.cs	(revision 17)
+++ MonoDevelop.GtkCore.NodeBuilders/StockIconsNodeBuilder.cs	(working copy)
@@ -70,7 +70,7 @@
 			GtkDesignInfo info = GtkDesignInfo.FromProject (node.Project);
 			GuiBuilderProject gp = info.GuiBuilderProject;
 			Stetic.Project sp = gp.SteticProject;
-			sp.ImagesRootPath = FileService.AbsoluteToRelativePath (info.GtkGuiFolder, gp.Project.BaseDirectory);
+			sp.ImagesRootPath = FileService.AbsoluteToRelativePath (info.SteticFolder, gp.Project.BaseDirectory);
 			sp.ImportFileCallback = delegate (string file) {
 				return GuiBuilderService.ImportFile (gp.Project, file);
 			};
Index: MonoDevelop.GtkCore.NodeBuilders/ProjectFileNodeBuilderExtension.cs
===================================================================
--- MonoDevelop.GtkCore.NodeBuilders/ProjectFileNodeBuilderExtension.cs	(revision 0)
+++ MonoDevelop.GtkCore.NodeBuilders/ProjectFileNodeBuilderExtension.cs	(revision 124)
@@ -0,0 +1,144 @@
+using System;
+
+using MonoDevelop.Components.Commands;
+using MonoDevelop.GtkCore.GuiBuilder;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Commands;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Ide.Gui.Components;
+using MonoDevelop.Ide.Gui.Pads.ProjectPad;
+using MonoDevelop.Projects;
+using MonoDevelop.Projects.Dom;
+
+namespace MonoDevelop.GtkCore.NodeBuilders
+{
+	public class ProjectFileBuilder : ProjectFileNodeBuilder 
+	{
+	
+	}
+	
+	public class ProjectFileNodeBuilderExtension : NodeBuilderExtension
+	{
+		public override bool CanBuildNode (Type dataType)
+		{
+			return typeof(ProjectFile).IsAssignableFrom (dataType);
+		}
+		
+		public override Type CommandHandlerType {
+			get { return typeof (ComponentCommandHandler); }
+		}
+		
+		public override void GetNodeAttributes (ITreeNavigator treeNavigator, object dataObject, ref NodeAttributes attributes)
+		{
+			if (treeNavigator.Options ["ShowAllFiles"])
+				return;
+			
+			ProjectFile pf = (ProjectFile) dataObject;
+			GtkDesignInfo info = GtkDesignInfo.FromProject (pf.Project);
+			if (info.HideGtkxFiles && pf.FilePath.Extension == ".gtkx")
+				attributes |= NodeAttributes.Hidden;
+		}
+		
+		
+		public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
+		{	
+			ProjectFile pf = (ProjectFile) dataObject;
+			
+			//do not show custom icon for generated source files
+			if (pf.DependsOn == null) {
+				GtkComponentType type = pf.GetComponentType ();
+				
+				switch (type) {
+				case GtkComponentType.Dialog : 
+					icon = ImageService.GetPixbuf ("md-gtkcore-dialog", Gtk.IconSize.Menu);
+					break;
+				case GtkComponentType.Widget :
+					icon = ImageService.GetPixbuf ("md-gtkcore-widget", Gtk.IconSize.Menu);
+					break;
+				case GtkComponentType.ActionGroup :
+					icon = ImageService.GetPixbuf ("md-gtkcore-actiongroup", Gtk.IconSize.Menu);
+					break;
+				case GtkComponentType.IconFactory :
+					icon = ImageService.GetPixbuf ("md-gtkcore-iconfactory", Gtk.IconSize.Menu);
+					label = "Stock icons";
+					break;
+				}	
+			}
+		}
+		
+		//override 
+		public override bool HasChildNodes (ITreeBuilder builder, object dataObject)
+		{
+			return base.HasChildNodes (builder, dataObject);
+		}
+	}
+	
+	public class ComponentCommandHandler : NodeCommandHandler
+	{
+		/*public override void ActivateItem ()
+		{
+			ProjectFile pf = (ProjectFile) CurrentNode.DataItem;
+			
+			if (pf.IsComponentFile ()) {
+				Document doc = IdeApp.Workbench.OpenDocument (pf.FilePath, true);
+				
+				if (doc != null) {
+					GuiBuilderView view = doc.GetContent<GuiBuilderView> ();
+					if (view != null) {
+						GtkComponentType type = pf.GetComponentType ();
+				
+						switch (type) {
+						case GtkComponentType.Dialog : 
+						case GtkComponentType.Widget :
+							view.ShowDesignerView ();
+							break;
+						case GtkComponentType.ActionGroup :
+							view.ShowActionDesignerView (((Stetic.ActionGroupInfo) CurrentNode.DataItem).Name);
+							break;
+						}
+					}
+				}
+				return;	
+			}
+			base.ActivateItem ();
+		}
+		*/
+		
+		[CommandHandler (GtkCommands.GenerateCode)]
+		protected void OnGenerateCode ()
+		{
+			ProjectFile pf = CurrentNode.DataItem as ProjectFile;
+			Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;
+			GtkDesignInfo info = GtkDesignInfo.FromProject (project);
+			GuiBuilderProject gproject = info.GuiBuilderProject;
+			
+			gproject.GenerateCode (pf.FilePath);
+		}
+		
+		[CommandUpdateHandler (GtkCommands.GenerateCode)]
+		protected void UpdateGenerateCode (CommandInfo cinfo)
+		{
+			ProjectFile pf = CurrentNode.DataItem as ProjectFile;
+			
+			if (pf.DependsOn == null && pf.HasChildren)
+				cinfo.Visible = pf.IsComponentFile ();
+			else
+				cinfo.Visible = false;
+		}	
+		
+		[CommandUpdateHandler (EditCommands.Copy)]
+		[CommandUpdateHandler (EditCommands.Delete)]
+		[CommandUpdateHandler (EditCommands.Rename)]
+		protected void UpdateDisabledCommands (CommandInfo cinfo)
+		{
+			//disable operations for generated files in designer folder
+			cinfo.Visible = false;//(CurrentNode.GetParentDataItem (typeof (GuiProjectFolder), true) == null);
+		}
+		
+		public override DragOperation CanDragNode ()
+		{
+			return DragOperation.None;
+		}
+		
+	}
+}
\ No newline at end of file
Index: MonoDevelop.GtkCore.NodeBuilders/ChangeLog
===================================================================
--- MonoDevelop.GtkCore.NodeBuilders/ChangeLog	(revision 0)
+++ MonoDevelop.GtkCore.NodeBuilders/ChangeLog	(revision 125)
@@ -0,0 +1,58 @@
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* ProjectNodeBuilder.cs:
+	* GuiProjectFolderNodeBuilder.cs: 
+
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* ProjectFileExtension.cs:
+	* GuiProjectFolderNodeBuilder.cs:
+	* ProjectFileNodeBuilderExtension.cs:
+	* ProjectFolderNodeBuilderExtension.cs: 
+
+2010-08-13  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* ProjectNodeBuilder.cs:
+	* StockIconsNodeBuilder.cs:
+	* ProjectFileNodeBuilderExtension.cs:
+	* ProjectFolderNodeBuilderExtension.cs: 
+
+2010-08-09  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* GuiProjectFolder.cs: Put gui project folder directly below References
+	in the project pad
+	* ProjectNodeBuilder.cs:
+	* GuiProjectFolderNodeBuilder.cs:
+	* ProjectFolderNodeBuilderExtension.cs: 
+
+2010-07-06  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* ProjectFileExtension.cs: Move cursor in entryFolder to the end.
+
+2010-07-05  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* ProjectFileExtension.cs: Better approach for obtaining GtkComponentType
+	* ProjectFileNodeBuilderExtension.cs:
+	* ProjectFolderNodeBuilderExtension.cs: 
+
+2010-06-28  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* ProjectNodeBuilder.cs:
+	* ProjectFileNodeBuilderExtension.cs:
+	* ProjectFolderNodeBuilderExtension.cs: 
+
+2010-06-23  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* ProjectNodeBuilder.cs:
+	* ProjectFileNodeBuilderExtension.cs: Show ProjectConversionDialog before
+	conversion
+
+2010-06-21  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* ProjectNodeBuilder.cs: Convert a project file layout on open	
+	* ProjectFileNodeBuilderExtension.cs: Group components files
+
+2010-06-16  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* ProjectFileNodeBuilderExtension.cs: 
+
Index: MonoDevelop.GtkCore.NodeBuilders/ProjectNodeBuilder.cs
===================================================================
--- MonoDevelop.GtkCore.NodeBuilders/ProjectNodeBuilder.cs	(revision 17)
+++ MonoDevelop.GtkCore.NodeBuilders/ProjectNodeBuilder.cs	(working copy)
@@ -28,14 +28,19 @@
 
 using System;
 using System.Collections;
+using System.IO;
 
+using Gtk;
+
 using MonoDevelop.Projects;
 using MonoDevelop.Core;
 using MonoDevelop.Ide.Gui.Pads;
 using MonoDevelop.Ide.Gui;
 using MonoDevelop.Ide.Gui.Components;
-
+using MonoDevelop.Ide.Gui.Pads.ProjectPad;
+using MonoDevelop.GtkCore.Dialogs;
 using MonoDevelop.GtkCore.GuiBuilder;
+using MonoDevelop.Ide;
 
 namespace MonoDevelop.GtkCore.NodeBuilders
 {
@@ -48,6 +53,12 @@
 			return typeof(DotNetProject).IsAssignableFrom (dataType);
 		}
 		
+		public override Type CommandHandlerType {
+			get {
+				return typeof (GuiProjectFolderCommandHandler);
+			}
+		}
+		
 		protected override void Initialize ()
 		{
 			lock (typeof (ProjectNodeBuilder))
@@ -60,10 +71,62 @@
 				instance = null;
 		}
 		
+		public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
+		{
+			Project project = dataObject as Project;
+			
+			if (project is DotNetProject) {
+				GtkDesignInfo info = GtkDesignInfo.FromProject (project);
+				
+				if (info.OldVersion) {
+					ProjectConversionDialog dialog = new ProjectConversionDialog (project, info.SteticFolderName);
+					
+					try
+					{
+						if (dialog.Run () == (int)ResponseType.Yes) {
+							info.GuiBuilderProject.Convert (dialog.GuiFolderName, dialog.MakeBackup);
+							IdeApp.ProjectOperations.Save (project);
+						}
+					} finally {
+						dialog.Destroy ();
+					}
+				}
+				
+				project.FileAddedToProject += HandleProjectFileAddedToProject;
+			}
+		}
+		
+		void HandleProjectFileAddedToProject (object sender, ProjectFileEventArgs e)
+		{
+			Project project = e.Project;
+			ProjectFile pf = e.ProjectFile;
+			string fileName = pf.FilePath.FullPath.ToString ();
+			GtkDesignInfo info = GtkDesignInfo.FromProject (project);
+			
+			string buildFile = info.GetBuildFile (fileName);
+			if (!project.IsFileInProject(buildFile) && File.Exists (buildFile)) {
+				ProjectFile pf2 = project.AddFile (buildFile, BuildAction.Compile);
+				pf2.DependsOn = pf.FilePath.FileName;
+			}
+			
+			string gtkxFile = info.GetGtkxFile (fileName);
+			if (!project.IsFileInProject(gtkxFile) && File.Exists (gtkxFile)) {
+				ProjectFile pf3 = project.AddFile (gtkxFile, BuildAction.EmbeddedResource);
+				pf3.DependsOn = pf.FilePath.FileName;
+			}
+		}
+		
 		public override void BuildChildNodes (ITreeBuilder builder, object dataObject)
 		{
-			if (GtkDesignInfo.HasDesignedObjects ((Project)dataObject))
-				builder.AddChild (new WindowsFolder ((Project)dataObject));
+			Project project = (Project)dataObject;
+			GtkDesignInfo info = GtkDesignInfo.FromProject (project);
+			
+			if (GtkDesignInfo.HasDesignedObjects (project)) {
+				GuiProjectFolder folder = new GuiProjectFolder(info.SteticFolder.FullPath, project, null);
+				
+				builder.AddChild (new WindowsFolder (project));
+				builder.AddChild (folder);
+			}
 		}
 		
 		public static void OnSupportChanged (Project p)
Index: MonoDevelop.GtkCore.NodeBuilders/ProjectFileExtension.cs
===================================================================
--- MonoDevelop.GtkCore.NodeBuilders/ProjectFileExtension.cs	(revision 0)
+++ MonoDevelop.GtkCore.NodeBuilders/ProjectFileExtension.cs	(revision 124)
@@ -0,0 +1,52 @@
+using System;
+using MonoDevelop.GtkCore.GuiBuilder;
+using MonoDevelop.Projects;
+using MonoDevelop.Projects.Dom;
+using MonoDevelop.Projects.Dom.Parser;
+
+namespace MonoDevelop.GtkCore.NodeBuilders
+{
+	public enum GtkComponentType 
+	{
+		Dialog,
+		Widget,
+		ActionGroup,
+		IconFactory,
+		None
+	}
+	
+	public static class ProjectFileExtension
+	{
+		public static bool IsComponentFile (this ProjectFile pf)
+		{
+			return pf.GetComponentType () != GtkComponentType.None;
+		}
+		
+		public static GtkComponentType GetComponentType (this ProjectFile pf)
+		{
+			GtkDesignInfo info = GtkDesignInfo.FromProject (pf.Project);
+			ParsedDocument doc = ProjectDomService.GetParsedDocument (ProjectDomService.GetProjectDom (pf.Project), pf.Name);
+			//ParsedDocument doc = ProjectDomService.ParseFile (ProjectDomService.GetProjectDom (pf.Project), pf.FilePath.ToString ());
+			if (doc != null && doc.CompilationUnit != null) {
+				foreach (IType t in doc.CompilationUnit.Types) {
+					string className = t.FullName;
+					if (className != null) {
+						GuiBuilderWindow win = info.GuiBuilderProject.GetWindowForClass (className);
+						if (win != null) 
+								return win.RootWidget.IsWindow ? GtkComponentType.Dialog : GtkComponentType.Widget;
+									
+						Stetic.ActionGroupInfo action =	info.GuiBuilderProject.GetActionGroup (className);
+						if (action != null)
+							return GtkComponentType.ActionGroup;
+						
+					}
+				}
+			}
+			if (pf.Name.Contains ("IconFactory.gtkx"))
+				return GtkComponentType.IconFactory;
+			
+			return GtkComponentType.None;
+		}
+	}
+}
+
Index: MonoDevelop.GtkCore.NodeBuilders/GuiProjectFolderNodeBuilder.cs
===================================================================
--- MonoDevelop.GtkCore.NodeBuilders/GuiProjectFolderNodeBuilder.cs	(revision 0)
+++ MonoDevelop.GtkCore.NodeBuilders/GuiProjectFolderNodeBuilder.cs	(revision 125)
@@ -0,0 +1,176 @@
+//  
+//  GuiProjectFolderNodeBuilder.cs
+//  
+//  Author:
+//       Krzysztof Marecki <marecki.krzysztof@gmail.com>
+// 
+//  Copyright (c) 2010 KrzysztofMarecki
+// 
+//  Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+using System;
+using MonoDevelop.Components.Commands;
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Commands;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Gui;
+using MonoDevelop.Ide.Gui.Components;
+using MonoDevelop.Ide.Gui.Pads.ProjectPad;
+using MonoDevelop.Projects;
+
+using MonoDevelop.GtkCore.GuiBuilder;
+
+namespace MonoDevelop.GtkCore.NodeBuilders
+{
+	public class GuiProjectFolderNodeBuilder : ProjectFolderNodeBuilder
+	{
+		public override Type NodeDataType {
+			get { return typeof(GuiProjectFolder); }
+		}
+		
+		public override Type CommandHandlerType {
+			get { return typeof(GuiProjectFolderCommandHandler); }
+		}
+		
+		public override string GetNodeName (ITreeNavigator thisNode, object dataObject)
+		{
+			//nodes are sorted alphabetically and we want to have gui folder on the top
+			return string.Empty;
+		}
+		
+		
+		public override void BuildNode (ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
+		{
+			GuiProjectFolder folder = (GuiProjectFolder) dataObject;
+			
+			icon = Context.GetIcon (Stock.OpenResourceFolder);
+			closedIcon = Context.GetIcon (Stock.ClosedResourceFolder);
+			label = folder.Name;	
+		}
+	}
+	
+	public class GuiProjectFolderCommandHandler : ProjectFolderCommandHandler
+	{
+		[CommandHandler (GtkCommands.ImportGladeFile)]
+		protected void OnImportGladeFile ()
+		{
+			Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;
+			GuiBuilderService.ImportGladeFile (project);
+		}
+		
+		[CommandUpdateHandler (GtkCommands.ImportGladeFile)]
+		protected void UpdateImportGladeFile (CommandInfo cinfo)
+		{
+			cinfo.Visible = CanAddWindow ();
+		}
+		
+		[CommandHandler (GtkCommands.EditIcons)]
+		protected void OnEditIcons ()
+		{
+			Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;
+			GuiBuilderProject gp = GtkDesignInfo.FromProject (project).GuiBuilderProject;
+			Stetic.Project sp = gp.SteticProject;
+			sp.EditIcons ();
+			gp.Save (true);
+		}
+		
+		[CommandUpdateHandler (GtkCommands.EditIcons)]
+		protected void UpdateEditIcons (CommandInfo cinfo)
+		{
+			cinfo.Visible = CanAddWindow ();
+		}
+		
+		[CommandHandler (GtkCommands.GtkSettings)]
+		protected void OnGtkSettings ()
+		{
+			Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;
+			IdeApp.ProjectOperations.ShowOptions (project, "SteticOptionsPanel");
+		}
+		
+		[CommandUpdateHandler (GtkCommands.EditIcons)]
+		protected void UpdateGtkSettings (CommandInfo cinfo)
+		{
+			//cinfo.Visible = CanAddWindow ();
+		}
+		
+		[CommandUpdateHandler (EditCommands.Delete)]
+		[CommandUpdateHandler (EditCommands.Rename)]
+		[CommandUpdateHandler (ProjectCommands.AddNewFiles)]
+		[CommandUpdateHandler (ProjectCommands.AddFiles)]
+		[CommandUpdateHandler (ProjectCommands.AddSolutionFolder)]
+		[CommandUpdateHandler (ProjectCommands.AddItem)]
+		[CommandUpdateHandler (ProjectCommands.NewFolder)]
+		protected void UpdateDisabledCommands (CommandInfo cinfo)
+		{
+			cinfo.Visible = false;
+			cinfo.Enabled = false;
+		}
+		
+		bool CanAddWindow ()
+		{
+			DotNetProject project = CurrentNode.GetParentDataItem (typeof(Project), true) as DotNetProject;
+			return GtkDesignInfo.SupportsDesigner (project);
+		}
+		
+		public override DragOperation CanDragNode ()
+		{
+			return DragOperation.None;
+		}
+		
+		public override bool CanDeleteItem ()
+		{
+			return false;
+		}
+		
+		public override bool CanDropMultipleNodes (object[] dataObjects, DragOperation operation)
+		{
+			return false;
+		}
+		
+		public override bool CanDropMultipleNodes (object[] dataObjects, DragOperation operation, DropPosition position)
+		{
+			return false;
+		}
+		
+		public override bool CanDeleteMultipleItems ()
+		{
+			return false;
+		}
+		
+		public override bool CanDropNode (object dataObject, DragOperation operation)
+		{
+			return false;
+		}
+		
+		public override bool CanDropNode (object dataObject, DragOperation operation, DropPosition position)
+		{
+			return false;
+		}
+		
+		public override void RenameItem (string newName)
+		{		
+			Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;
+			GtkDesignInfo info = GtkDesignInfo.FromProject (project);
+			info.SteticFolderName = newName;
+			
+			base.RenameItem (newName);
+		} 
+	}
+}
+
Index: MonoDevelop.GtkCore.NodeBuilders/GuiProjectFolder.cs
===================================================================
--- MonoDevelop.GtkCore.NodeBuilders/GuiProjectFolder.cs	(revision 0)
+++ MonoDevelop.GtkCore.NodeBuilders/GuiProjectFolder.cs	(revision 112)
@@ -0,0 +1,42 @@
+//  
+//  GuiProjectFolder.cs
+//  
+//  Author:
+//       Krzysztof Marecki <marecki.krzysztof@gmail.com>
+// 
+//  Copyright (c) 2010 KrzysztofMarecki
+// 
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Gui.Pads.ProjectPad;
+using MonoDevelop.Projects;
+using MonoDevelop.Projects.Dom;
+
+namespace MonoDevelop.GtkCore.NodeBuilders
+{
+	public class GuiProjectFolder : ProjectFolder
+	{
+		public GuiProjectFolder (FilePath absolutePath, IWorkspaceObject parentWorkspaceObject, object parent)
+			: base (absolutePath, parentWorkspaceObject, parent)
+		{
+		}
+	}
+}
+
Index: MonoDevelop.GtkCore.NodeBuilders/WindowsFolderNodeBuilder.cs
===================================================================
--- MonoDevelop.GtkCore.NodeBuilders/WindowsFolderNodeBuilder.cs	(revision 17)
+++ MonoDevelop.GtkCore.NodeBuilders/WindowsFolderNodeBuilder.cs	(working copy)
@@ -82,10 +82,10 @@
 			GtkDesignInfo info = GtkDesignInfo.FromProject (p);
 			if (!info.GuiBuilderProject.HasError) {
 				builder.AddChild (new StockIconsNode (p));
-				foreach (GuiBuilderWindow fi in info.GuiBuilderProject.Windows)
-					builder.AddChild (fi);
-				foreach (Stetic.ActionGroupInfo group in info.GuiBuilderProject.SteticProject.ActionGroups)
-					builder.AddChild (group);
+//				foreach (GuiBuilderWindow fi in info.GuiBuilderProject.Windows)
+//					builder.AddChild (fi);
+//				foreach (Stetic.ActionGroupInfo group in info.GuiBuilderProject.SteticProject.ActionGroups)
+//					builder.AddChild (group);
 			}
 		}
 
Index: MonoDevelop.GtkCore.Dialogs/ProjectConversionDialog.cs
===================================================================
--- MonoDevelop.GtkCore.Dialogs/ProjectConversionDialog.cs	(revision 0)
+++ MonoDevelop.GtkCore.Dialogs/ProjectConversionDialog.cs	(revision 124)
@@ -0,0 +1,40 @@
+using System;
+using Gtk;
+
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.GtkCore.Dialogs
+{
+	public partial class ProjectConversionDialog : Gtk.Dialog
+	{		
+		public ProjectConversionDialog (IntPtr raw)
+			: base (raw)
+		{
+		}
+		
+		public string GuiFolderName { get; private set; }
+		
+		public bool MakeBackup { get; private set; }
+		
+		
+		public ProjectConversionDialog (Project project, string guiFolderName)
+		{
+			this.Build ();
+			
+			entryFolder.Text = guiFolderName;
+			Title = project.Name;
+			entryFolder.Position = -1;
+			
+			buttonConvert.Clicked += HandleButtonConvertClicked;
+		}
+
+		void HandleButtonConvertClicked (object sender, EventArgs e)
+		{
+			GuiFolderName = entryFolder.Text;
+			MakeBackup = checkBackup.Active;
+				
+			Respond (ResponseType.Yes);
+		}
+	}
+}
+
Index: MonoDevelop.GtkCore.Dialogs/ChangeLog
===================================================================
--- MonoDevelop.GtkCore.Dialogs/ChangeLog	(revision 0)
+++ MonoDevelop.GtkCore.Dialogs/ChangeLog	(revision 124)
@@ -0,0 +1,18 @@
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* ProjectConversionDialog.cs: 
+
+2010-08-13  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* ProjectConversionDialog.cs:
+	* WidgetBuilderOptionPanel.cs: 
+
+2010-07-06  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* ProjectConversionDialog.cs: 
+
+2010-06-23  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* ProjectConversionDialog.cs: Initial commit
+	* WidgetBuilderOptionPanel.cs: 
+
Index: MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs
===================================================================
--- MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs	(revision 17)
+++ MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs	(working copy)
@@ -43,6 +43,8 @@
 			Gtk.CheckButton checkGettext;
 			Gtk.Entry entryGettext;
 			Gtk.ComboBox comboVersions;
+			Gtk.Entry entryFolderName;
+			Gtk.CheckButton checkHideFiles;
 			
 			DotNetProject project;
 			
@@ -84,11 +86,23 @@
 				box.ShowAll ();
 				PackStart (box, false, false, 0);
 				
-				checkGettext.Clicked += delegate {
-					box.Sensitive = checkGettext.Active;
-					if (checkGettext.Active)
-						entryGettext.Text = "Mono.Unix.Catalog";
-				};
+				sep= new HSeparator ();
+				sep.Show ();
+				PackStart (sep, false, false, 0);
+				
+				box = new Gtk.HBox (false, 3);
+				box.PackStart (new Label (GettextCatalog.GetString ("Stetic folder name :")), false, false, 0);
+				entryFolderName = new Gtk.Entry ();
+				entryFolderName.Text = designInfo.SteticFolderName;
+				entryFolderName.Sensitive = false;
+				box.PackStart (entryFolderName, false, false, 0);
+				box.ShowAll ();
+				PackStart (box, false, false, 0);
+				
+				checkHideFiles = new CheckButton (GettextCatalog.GetString ("Hide designer files"));
+				checkHideFiles.Active = designInfo.HideGtkxFiles;
+				checkHideFiles.Show ();
+				PackStart (checkHideFiles, false, false, 0);
 			}
 			
 			public void Store ()
@@ -101,6 +115,8 @@
 					info.GenerateGettext = checkGettext.Active;
 					info.GettextClass = entryGettext.Text;
 					info.GuiBuilderProject.SteticProject.TargetGtkVersion = comboVersions.ActiveText;
+					info.SteticFolderName = entryFolderName.Text;
+					info.HideGtkxFiles = checkHideFiles.Active;
 					info.GuiBuilderProject.Save (false);
 				}
 				refmgr.Dispose ();
Index: MonoDevelop.GtkCore2.csproj
===================================================================
--- MonoDevelop.GtkCore2.csproj	(revision 17)
+++ MonoDevelop.GtkCore2.csproj	(working copy)
@@ -59,12 +59,21 @@
     <Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
       <SpecificVersion>False</SpecificVersion>
     </Reference>
+    <Reference Include="System.Core" />
+    <Reference Include="Mono.Cecil, Version=0.6.9.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756">
+      <Package>monodevelop</Package>
+    </Reference>
+    <Reference Include="NRefactory, Version=2.1.1.0, Culture=neutral, PublicKeyToken=efe927acf176eea2">
+      <Package>monodevelop</Package>
+    </Reference>
+    <Reference Include="Mono.Debugging, Version=0.0.0.0, Culture=neutral, PublicKeyToken=9307d64546e0580d">
+      <Package>monodevelop</Package>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\core\MonoDevelop.Core\MonoDevelop.Core.csproj">
       <Project>{7525BB88-6142-4A26-93B9-A30C6983390A}</Project>
       <Name>MonoDevelop.Core</Name>
-      <Private>False</Private>
     </ProjectReference>
     <ProjectReference Include="..\..\core\MonoDevelop.Ide\MonoDevelop.Ide.csproj">
       <Project>{27096E7F-C91C-4AC6-B289-6897A701DF21}</Project>
@@ -76,11 +85,6 @@
       <Name>MonoDevelop.DesignerSupport</Name>
       <Private>False</Private>
     </ProjectReference>
-    <ProjectReference Include="..\..\..\contrib\Mono.Cecil\Mono.Cecil.csproj">
-      <Project>{3EC06433-F168-4C5B-A885-99CE4AB617E1}</Project>
-      <Name>Mono.Cecil</Name>
-      <Private>False</Private>
-    </ProjectReference>
     <ProjectReference Include="..\Deployment\MonoDevelop.Deployment\MonoDevelop.Deployment.csproj">
       <Project>{9BC670A8-1851-40EC-9685-279F4C98433D}</Project>
       <Name>MonoDevelop.Deployment</Name>
@@ -151,6 +155,12 @@
     <EmbeddedResource Include="gtk-gui\gui.stetic">
       <LogicalName>gui.stetic</LogicalName>
     </EmbeddedResource>
+    <EmbeddedResource Include="icons\gtkx.png">
+      <LogicalName>gtkx.png</LogicalName>
+    </EmbeddedResource>
+    <EmbeddedResource Include="icons\gtk-logo.png">
+      <LogicalName>gtk-logo.png</LogicalName>
+    </EmbeddedResource>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="MonoDevelop.GtkCore.Commands\GladeCommands.cs" />
@@ -166,7 +176,6 @@
     <Compile Include="MonoDevelop.GtkCore\GtkCoreService.cs" />
     <Compile Include="MonoDevelop.GtkCore.Dialogs\WidgetBuilderOptionPanel.cs" />
     <Compile Include="MonoDevelop.GtkCore.NodeBuilders\ProjectNodeBuilder.cs" />
-    <Compile Include="MonoDevelop.GtkCore.NodeBuilders\WidgetNodeBuilder.cs" />
     <Compile Include="MonoDevelop.GtkCore.NodeBuilders\ProjectFolderNodeBuilderExtension.cs" />
     <Compile Include="MonoDevelop.GtkCore.NodeBuilders\WindowsFolderNodeBuilder.cs" />
     <Compile Include="MonoDevelop.GtkCore.NodeBuilders\WindowsFolder.cs" />
@@ -176,7 +185,6 @@
     <Compile Include="MonoDevelop.GtkCore.Dialogs\ConfirmWindowDeleteDialog.cs" />
     <Compile Include="MonoDevelop.GtkCore\ProjectResourceProvider.cs" />
     <Compile Include="MonoDevelop.GtkCore.GuiBuilder\ActionGroupView.cs" />
-    <Compile Include="MonoDevelop.GtkCore.NodeBuilders\ActionGroupNodeBuilder.cs" />
     <Compile Include="MonoDevelop.GtkCore.GuiBuilder\ActionGroupDisplayBinding.cs" />
     <Compile Include="MonoDevelop.GtkCore.GuiBuilder\CombinedDesignView.cs" />
     <Compile Include="MonoDevelop.GtkCore.GuiBuilder\CodeBinder.cs" />
@@ -193,8 +201,15 @@
     <Compile Include="MonoDevelop.GtkCore.Dialogs\GtkDesignerOptionsPanelWidget.cs" />
     <Compile Include="gtk-gui\MonoDevelop.GtkCore.Dialogs.GtkDesignerOptionsPanelWidget.cs" />
     <Compile Include="MonoDevelop.GtkCore\Counters.cs" />
+    <Compile Include="MonoDevelop.GtkCore.NodeBuilders\ProjectFileNodeBuilderExtension.cs" />
+    <Compile Include="MonoDevelop.GtkCore.NodeBuilders\ProjectFileExtension.cs" />
+    <Compile Include="MonoDevelop.GtkCore.Dialogs\ProjectConversionDialog.cs" />
+    <Compile Include="MonoDevelop.GtkCore.NodeBuilders\GuiProjectFolder.cs" />
+    <Compile Include="MonoDevelop.GtkCore.NodeBuilders\GuiProjectFolderNodeBuilder.cs" />
+    <Compile Include="gtk-gui\MonoDevelop.GtkCore.Dialogs.ProjectConversionDialog.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <Import Project="$(MSBuildExtensionsPath)\Mono.Addins.targets" />
   <ProjectExtensions>
     <MonoDevelop>
       <Properties>
Index: gtk-gui/MonoDevelop.GtkCore.Dialogs.ProjectConversionDialog.cs
===================================================================
--- gtk-gui/MonoDevelop.GtkCore.Dialogs.ProjectConversionDialog.cs	(revision 0)
+++ gtk-gui/MonoDevelop.GtkCore.Dialogs.ProjectConversionDialog.cs	(revision 124)
@@ -0,0 +1,183 @@
+// ------------------------------------------------------------------------------
+//  <autogenerated>
+//      This code was generated by a tool.
+//      Mono Runtime Version: 2.0.50727.1433
+// 
+//      Changes to this file may cause incorrect behavior and will be lost if 
+//      the code is regenerated.
+//  </autogenerated>
+// ------------------------------------------------------------------------------
+
+
+// This file has been generated by the GUI designer. Do not modify.
+namespace MonoDevelop.GtkCore.Dialogs
+{
+	public partial class ProjectConversionDialog
+	{
+		private global::Gtk.HBox hbox;
+
+		private global::Gtk.Alignment alignmentLogo;
+
+		private global::Gtk.Image imageLogo;
+
+		private global::Gtk.VBox vbox2;
+
+		private global::Gtk.Label labelProject;
+
+		private global::Gtk.Label labelInfo;
+
+		private global::Gtk.HSeparator hseparator1;
+
+		private global::Gtk.HBox hbox1;
+
+		private global::Gtk.Label labelFolder;
+
+		private global::Gtk.Entry entryFolder;
+
+		private global::Gtk.CheckButton checkBackup;
+
+		private global::Gtk.Button buttonConvert;
+
+		protected virtual void Build ()
+		{
+			global::Stetic.Gui.Initialize (this);
+			// Widget MonoDevelop.GtkCore.Dialogs.ProjectConversionDialog
+			this.Name = "MonoDevelop.GtkCore.Dialogs.ProjectConversionDialog";
+			this.Title = global::Mono.Unix.Catalog.GetString ("Project Name");
+			this.WindowPosition = ((global::Gtk.WindowPosition)(4));
+			this.Modal = true;
+			this.SkipTaskbarHint = true;
+			// Internal child MonoDevelop.GtkCore.Dialogs.ProjectConversionDialog.VBox
+			global::Gtk.VBox w1 = this.VBox;
+			w1.Name = "dialog1_VBox";
+			w1.BorderWidth = ((uint)(2));
+			// Container child dialog1_VBox.Gtk.Box+BoxChild
+			this.hbox = new global::Gtk.HBox ();
+			this.hbox.Name = "hbox";
+			this.hbox.Spacing = 6;
+			// Container child hbox.Gtk.Box+BoxChild
+			this.alignmentLogo = new global::Gtk.Alignment (1f, 0.15f, 1f, 0f);
+			this.alignmentLogo.Name = "alignmentLogo";
+			// Container child alignmentLogo.Gtk.Container+ContainerChild
+			this.imageLogo = new global::Gtk.Image ();
+			this.imageLogo.WidthRequest = 180;
+			this.imageLogo.Name = "imageLogo";
+			this.imageLogo.Yalign = 0f;
+			this.imageLogo.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("gtk-logo.png");
+			this.alignmentLogo.Add (this.imageLogo);
+			this.hbox.Add (this.alignmentLogo);
+			global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox[this.alignmentLogo]));
+			w3.Position = 0;
+			w3.Expand = false;
+			w3.Fill = false;
+			// Container child hbox.Gtk.Box+BoxChild
+			this.vbox2 = new global::Gtk.VBox ();
+			this.vbox2.Name = "vbox2";
+			this.vbox2.Spacing = 6;
+			// Container child vbox2.Gtk.Box+BoxChild
+			this.labelProject = new global::Gtk.Label ();
+			this.labelProject.Name = "labelProject";
+			this.labelProject.LabelProp = global::Mono.Unix.Catalog.GetString ("<b><big>GTK# Project Conversion</big></b>");
+			this.labelProject.UseMarkup = true;
+			this.vbox2.Add (this.labelProject);
+			global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.labelProject]));
+			w4.Position = 0;
+			w4.Expand = false;
+			w4.Fill = false;
+			// Container child vbox2.Gtk.Box+BoxChild
+			this.labelInfo = new global::Gtk.Label ();
+			this.labelInfo.Name = "labelInfo";
+			this.labelInfo.Xalign = 0f;
+			this.labelInfo.Yalign = 0f;
+			this.labelInfo.LabelProp = global::Mono.Unix.Catalog.GetString ("This project has been created in the previous\nversion of GTK# addin and must be converted. \n\n<b>Following changes will be made :</b>\n\t- split gui.stetic into separate .gtkx files\n\t- split generated.cs into separate helper classes\n\t- remove gtk-gui folder.\n\t- create a designer folder for stock icons\n\t  and generated helper classes. ");
+			this.labelInfo.UseMarkup = true;
+			this.labelInfo.Wrap = true;
+			this.vbox2.Add (this.labelInfo);
+			global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.labelInfo]));
+			w5.Position = 1;
+			w5.Expand = false;
+			w5.Fill = false;
+			// Container child vbox2.Gtk.Box+BoxChild
+			this.hseparator1 = new global::Gtk.HSeparator ();
+			this.hseparator1.Name = "hseparator1";
+			this.vbox2.Add (this.hseparator1);
+			global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.hseparator1]));
+			w6.Position = 2;
+			w6.Expand = false;
+			w6.Fill = false;
+			// Container child vbox2.Gtk.Box+BoxChild
+			this.hbox1 = new global::Gtk.HBox ();
+			this.hbox1.Name = "hbox1";
+			this.hbox1.Spacing = 6;
+			// Container child hbox1.Gtk.Box+BoxChild
+			this.labelFolder = new global::Gtk.Label ();
+			this.labelFolder.Name = "labelFolder";
+			this.labelFolder.LabelProp = global::Mono.Unix.Catalog.GetString ("Designer folder name:");
+			this.hbox1.Add (this.labelFolder);
+			global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.labelFolder]));
+			w7.Position = 0;
+			w7.Expand = false;
+			w7.Fill = false;
+			// Container child hbox1.Gtk.Box+BoxChild
+			this.entryFolder = new global::Gtk.Entry ();
+			this.entryFolder.CanFocus = true;
+			this.entryFolder.Name = "entryFolder";
+			this.entryFolder.IsEditable = true;
+			this.entryFolder.InvisibleChar = '●';
+			this.hbox1.Add (this.entryFolder);
+			global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.entryFolder]));
+			w8.Position = 1;
+			this.vbox2.Add (this.hbox1);
+			global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.hbox1]));
+			w9.Position = 3;
+			w9.Expand = false;
+			w9.Fill = false;
+			// Container child vbox2.Gtk.Box+BoxChild
+			this.checkBackup = new global::Gtk.CheckButton ();
+			this.checkBackup.CanFocus = true;
+			this.checkBackup.Name = "checkBackup";
+			this.checkBackup.Label = global::Mono.Unix.Catalog.GetString ("Make a backup before converting");
+			this.checkBackup.Active = true;
+			this.checkBackup.DrawIndicator = true;
+			this.checkBackup.UseUnderline = true;
+			this.vbox2.Add (this.checkBackup);
+			global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.checkBackup]));
+			w10.Position = 4;
+			w10.Expand = false;
+			w10.Fill = false;
+			this.hbox.Add (this.vbox2);
+			global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hbox[this.vbox2]));
+			w11.Position = 1;
+			w11.Expand = false;
+			w11.Fill = false;
+			w1.Add (this.hbox);
+			global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(w1[this.hbox]));
+			w12.Position = 0;
+			w12.Expand = false;
+			w12.Fill = false;
+			// Internal child MonoDevelop.GtkCore.Dialogs.ProjectConversionDialog.ActionArea
+			global::Gtk.HButtonBox w13 = this.ActionArea;
+			w13.Name = "dialog1_ActionArea";
+			w13.Spacing = 10;
+			w13.BorderWidth = ((uint)(5));
+			w13.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
+			// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
+			this.buttonConvert = new global::Gtk.Button ();
+			this.buttonConvert.CanDefault = true;
+			this.buttonConvert.CanFocus = true;
+			this.buttonConvert.Name = "buttonConvert";
+			this.buttonConvert.UseUnderline = true;
+			this.buttonConvert.Label = global::Mono.Unix.Catalog.GetString ("_Convert");
+			this.AddActionWidget (this.buttonConvert, -5);
+			global::Gtk.ButtonBox.ButtonBoxChild w14 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w13[this.buttonConvert]));
+			w14.Expand = false;
+			w14.Fill = false;
+			if ((this.Child != null)) {
+				this.Child.ShowAll ();
+			}
+			this.DefaultWidth = 532;
+			this.DefaultHeight = 292;
+			this.Show ();
+		}
+	}
+}
Index: gtk-gui/ChangeLog
===================================================================
--- gtk-gui/ChangeLog	(revision 0)
+++ gtk-gui/ChangeLog	(revision 124)
@@ -0,0 +1,46 @@
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* gui.stetic:
+	* MonoDevelop.GtkCore.Dialogs.ProjectConversionDialog.cs: 
+
+2010-08-13  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* gui.stetic: 
+
+2010-08-09  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* gui.stetic: 
+
+2010-08-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* gui.stetic: 
+
+2010-08-05  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* gui.stetic: 
+
+2010-08-04  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* gui.stetic: 
+
+2010-08-03  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* gui.stetic: 
+
+2010-07-05  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* gui.stetic: 
+
+2010-06-23  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* gui.stetic:
+	* MonoDevelop.GtkCore.Dialogs.ProjectConversionDialog.cs: 
+
+2010-06-16  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* gui.stetic: 
+
+2010-06-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* gui.stetic: 
+
Index: gtk-gui/gui.stetic
===================================================================
--- gtk-gui/gui.stetic	(revision 17)
+++ gtk-gui/gui.stetic	(working copy)
@@ -8,10 +8,11 @@
     <widget-library name="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
     <widget-library name="../../../../build/bin/MonoDevelop.Ide.dll" />
     <widget-library name="../../../../build/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll" />
-    <widget-library name="../../../../build/AddIns/MonoDevelop.Deployment/MonoDevelop.Deployment.dll" />
     <widget-library name="../../../../build/bin/Mono.TextEditor.dll" />
     <widget-library name="../../../../build/AddIns/MonoDevelop.GtkCore2/libsteticui2.dll" />
     <widget-library name="../../../../build/AddIns/MonoDevelop.GtkCore2/libstetic2.dll" />
+    <widget-library name="MonoDevelop.Ide, Version=2.4.0.0, Culture=neutral" />
+    <widget-library name="Mono.TextEditor, Version=1.0.0.0, Culture=neutral" />
     <widget-library name="../../../../build/AddIns/MonoDevelop.GtkCore2/MonoDevelop.GtkCore2.dll" internal="true" />
   </import>
   <widget class="Gtk.Bin" id="MonoDevelop.GtkCore.Dialogs.GtkDesignerOptionsPanelWidget" design-size="503 22">
@@ -40,4 +41,190 @@
       </widget>
     </child>
   </widget>
+  <widget class="Gtk.Dialog" id="MonoDevelop.GtkCore.Dialogs.ProjectConversionDialog" design-size="532 308">
+    <property name="MemberName" />
+    <property name="Title" translatable="yes">Project Name</property>
+    <property name="WindowPosition">CenterOnParent</property>
+    <property name="Modal">True</property>
+    <property name="SkipTaskbarHint">True</property>
+    <property name="Buttons">1</property>
+    <property name="HelpButton">False</property>
+    <child internal-child="VBox">
+      <widget class="Gtk.VBox" id="dialog1_VBox">
+        <property name="MemberName" />
+        <property name="BorderWidth">2</property>
+        <child>
+          <widget class="Gtk.HBox" id="hbox">
+            <property name="MemberName" />
+            <property name="Spacing">6</property>
+            <child>
+              <widget class="Gtk.Alignment" id="alignmentLogo">
+                <property name="MemberName" />
+                <property name="Yscale">0</property>
+                <property name="Xalign">1</property>
+                <property name="Yalign">0.15</property>
+                <child>
+                  <widget class="Gtk.Image" id="imageLogo">
+                    <property name="MemberName" />
+                    <property name="WidthRequest">180</property>
+                    <property name="Yalign">0</property>
+                    <property name="Pixbuf">resource:gtk-logo.png</property>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="Position">0</property>
+                <property name="AutoSize">True</property>
+                <property name="Expand">False</property>
+                <property name="Fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="Gtk.VBox" id="vbox2">
+                <property name="MemberName" />
+                <property name="Spacing">6</property>
+                <child>
+                  <widget class="Gtk.Label" id="labelProject">
+                    <property name="MemberName" />
+                    <property name="LabelProp" translatable="yes">&lt;b&gt;&lt;big&gt;GTK# Project Conversion&lt;/big&gt;&lt;/b&gt;</property>
+                    <property name="UseMarkup">True</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">0</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.Label" id="labelInfo">
+                    <property name="MemberName" />
+                    <property name="Xalign">0</property>
+                    <property name="Yalign">0</property>
+                    <property name="LabelProp" translatable="yes">This project has been created in the previous
+version of GTK# addin and must be converted. 
+
+&lt;b&gt;Following changes will be made :&lt;/b&gt;
+	- split gui.stetic into separate .gtkx files
+	- split generated.cs into separate helper classes
+	- remove gtk-gui folder.
+	- create a designer folder for stock icons
+	  and generated helper classes.</property>
+                    <property name="UseMarkup">True</property>
+                    <property name="Wrap">True</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">1</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.HSeparator" id="hseparator1">
+                    <property name="MemberName" />
+                  </widget>
+                  <packing>
+                    <property name="Position">2</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.HBox" id="hbox1">
+                    <property name="MemberName" />
+                    <property name="Spacing">6</property>
+                    <child>
+                      <widget class="Gtk.Label" id="labelFolder">
+                        <property name="MemberName" />
+                        <property name="LabelProp" translatable="yes">Designer folder name:</property>
+                      </widget>
+                      <packing>
+                        <property name="Position">0</property>
+                        <property name="AutoSize">True</property>
+                        <property name="Expand">False</property>
+                        <property name="Fill">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="Gtk.Entry" id="entryFolder">
+                        <property name="MemberName" />
+                        <property name="CanFocus">True</property>
+                        <property name="IsEditable">True</property>
+                        <property name="InvisibleChar">●</property>
+                      </widget>
+                      <packing>
+                        <property name="Position">1</property>
+                        <property name="AutoSize">True</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="Position">3</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="Gtk.CheckButton" id="checkBackup">
+                    <property name="MemberName" />
+                    <property name="CanFocus">True</property>
+                    <property name="Label" translatable="yes">Make a backup before converting</property>
+                    <property name="Active">True</property>
+                    <property name="DrawIndicator">True</property>
+                    <property name="HasLabel">True</property>
+                    <property name="UseUnderline">True</property>
+                  </widget>
+                  <packing>
+                    <property name="Position">4</property>
+                    <property name="AutoSize">True</property>
+                    <property name="Expand">False</property>
+                    <property name="Fill">False</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="Position">1</property>
+                <property name="AutoSize">True</property>
+                <property name="Expand">False</property>
+                <property name="Fill">False</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="Position">0</property>
+            <property name="AutoSize">True</property>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+    <child internal-child="ActionArea">
+      <widget class="Gtk.HButtonBox" id="dialog1_ActionArea">
+        <property name="MemberName" />
+        <property name="Spacing">10</property>
+        <property name="BorderWidth">5</property>
+        <property name="Size">1</property>
+        <property name="LayoutStyle">End</property>
+        <child>
+          <widget class="Gtk.Button" id="buttonConvert">
+            <property name="MemberName" />
+            <property name="CanDefault">True</property>
+            <property name="CanFocus">True</property>
+            <property name="Type">TextOnly</property>
+            <property name="Label" translatable="yes">_Convert</property>
+            <property name="UseUnderline">True</property>
+            <property name="ResponseId">-5</property>
+          </widget>
+          <packing>
+            <property name="Expand">False</property>
+            <property name="Fill">False</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </stetic-interface>
\ No newline at end of file
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 17)
+++ Makefile.am	(working copy)
@@ -1,14 +1,13 @@
 SUBDIRS = libstetic libsteticui
 
-ADDIN_BUILD = $(top_builddir)/build/AddIns/MonoDevelop.GtkCore
-ASSEMBLY = $(ADDIN_BUILD)/MonoDevelop.GtkCore.dll
+ADDIN_BUILD = $(top_builddir)/build/AddIns/MonoDevelop.GtkCore2
+ASSEMBLY = $(ADDIN_BUILD)/MonoDevelop.GtkCore2.dll
 
 DEPS =  \
 	$(top_builddir)/build/AddIns/MonoDevelop.Deployment/MonoDevelop.Deployment.dll \
 	$(top_builddir)/build/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll \
 	$(top_builddir)/build/AddIns/MonoDevelop.GtkCore2/libstetic2.dll \
 	$(top_builddir)/build/AddIns/MonoDevelop.GtkCore2/libsteticui2.dll \
-	$(top_builddir)/build/bin/Mono.Cecil.dll \
 	$(top_builddir)/build/bin/Mono.TextEditor.dll \
 	$(top_builddir)/build/bin/MonoDevelop.Core.dll \
 	$(top_builddir)/build/bin/MonoDevelop.Ide.dll
@@ -18,19 +17,23 @@
 	$(GLIB_SHARP_LIBS) \
 	$(GTK_SHARP_LIBS) \
 	$(MONO_ADDINS_LIBS) \
+	-pkg:monodevelop \
 	-r:Mono.Posix \
 	-r:System \
+	-r:System.Core \
 	-r:System.Xml
 
 FILES =  \
 	AssemblyInfo.cs \
 	gtk-gui/generated.cs \
 	gtk-gui/MonoDevelop.GtkCore.Dialogs.GtkDesignerOptionsPanelWidget.cs \
+	gtk-gui/MonoDevelop.GtkCore.Dialogs.ProjectConversionDialog.cs \
 	MonoDevelop.GtkCore.Commands/GladeCommands.cs \
 	MonoDevelop.GtkCore.Dialogs/BindDesignDialog.cs \
 	MonoDevelop.GtkCore.Dialogs/ConfirmWindowDeleteDialog.cs \
 	MonoDevelop.GtkCore.Dialogs/GtkDesignerOptionsPanelWidget.cs \
 	MonoDevelop.GtkCore.Dialogs/GtkFeatureWidget.cs \
+	MonoDevelop.GtkCore.Dialogs/ProjectConversionDialog.cs \
 	MonoDevelop.GtkCore.Dialogs/SelectRenamedClassDialog.cs \
 	MonoDevelop.GtkCore.Dialogs/WidgetBuilderOptionPanel.cs \
 	MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs \
@@ -48,11 +51,13 @@
 	MonoDevelop.GtkCore.GuiBuilder/PropertiesWidget.cs \
 	MonoDevelop.GtkCore.GuiBuilder/ToolboxLoader.cs \
 	MonoDevelop.GtkCore.GuiBuilder/ToolboxProvider.cs \
-	MonoDevelop.GtkCore.NodeBuilders/ActionGroupNodeBuilder.cs \
+	MonoDevelop.GtkCore.NodeBuilders/GuiProjectFolder.cs \
+	MonoDevelop.GtkCore.NodeBuilders/GuiProjectFolderNodeBuilder.cs \
+	MonoDevelop.GtkCore.NodeBuilders/ProjectFileExtension.cs \
+	MonoDevelop.GtkCore.NodeBuilders/ProjectFileNodeBuilderExtension.cs \
 	MonoDevelop.GtkCore.NodeBuilders/ProjectFolderNodeBuilderExtension.cs \
 	MonoDevelop.GtkCore.NodeBuilders/ProjectNodeBuilder.cs \
 	MonoDevelop.GtkCore.NodeBuilders/StockIconsNodeBuilder.cs \
-	MonoDevelop.GtkCore.NodeBuilders/WidgetNodeBuilder.cs \
 	MonoDevelop.GtkCore.NodeBuilders/WindowsFolder.cs \
 	MonoDevelop.GtkCore.NodeBuilders/WindowsFolderNodeBuilder.cs \
 	MonoDevelop.GtkCore/Counters.cs \
@@ -68,6 +73,8 @@
 	gtk-gui/gui.stetic \
 	gui.glade \
 	icons/actiongroup.png \
+	icons/gtk-logo.png \
+	icons/gtkx.png \
 	icons/image-x-generic.png \
 	icons/widget.png \
 	MonoDevelop.GtkCore.addin.xml \
@@ -99,7 +106,7 @@
 	$(CSC) $(CSC_FLAGS) -debug -out:$@ -target:library \
 	$(build_resources:%=/resource:%) $(build_sources) $(REFS) $(build_deps)
 
-assemblydir = $(MD_ADDIN_DIR)/MonoDevelop.GtkCore
+assemblydir = $(MD_ADDIN_DIR)/MonoDevelop.GtkCore2
 assembly_DATA = $(ASSEMBLY) $(ASSEMBLY).mdb
 
 CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb
Index: icons/gtkx.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: icons/gtkx.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: icons/gtk-logo.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: icons/gtk-logo.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: icons/ChangeLog
===================================================================
--- icons/ChangeLog	(revision 0)
+++ icons/ChangeLog	(revision 124)
@@ -0,0 +1,5 @@
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* gtkx.png:
+	* gtk-logo.png: 
+
Index: MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs
===================================================================
--- MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs	(revision 17)
+++ MonoDevelop.GtkCore.GuiBuilder/ActionGroupDisplayBinding.cs	(working copy)
@@ -53,12 +53,17 @@
 		{
 			if (excludeThis)
 				return false;
+			
+			if (fileName.Contains ("generated"))
+				return false;
+			
 			if (!IdeApp.Workspace.IsOpen)
 				return false;
 			
 			if (GetActionGroup (fileName) == null)
 				return false;
 			
+			
 			excludeThis = true;
 			var db = DisplayBindingService.GetDefaultBindingForUri (fileName);
 			excludeThis = false;
@@ -171,7 +176,7 @@
 			IdeApp.ProjectOperations.Save (project);
 			
 			// Make sure the database is up-to-date
-			ProjectDomService.Parse (project, cls.CompilationUnit.FileName, null);
+			ProjectDomService.Parse (project, cls.CompilationUnit.FileName);
 			return cls;
 		}
 		
Index: MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs
===================================================================
--- MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs	(revision 17)
+++ MonoDevelop.GtkCore.GuiBuilder/GuiBuilderService.cs	(working copy)
@@ -34,6 +34,7 @@
 
 using MonoDevelop.Ide.Gui;
 using MonoDevelop.Projects;
+using MonoDevelop.Projects.Dom;
 using MonoDevelop.Projects.Dom.Parser;
 using MonoDevelop.Projects.Text;
 using MonoDevelop.Core;
@@ -257,12 +258,21 @@
 		
 		public static string GetBuildCodeFileName (Project project, string componentName)
 		{
+			return GetBuildCodeFileName (project, componentName, string.Empty);
+		}
+		
+		public static string GetBuildCodeFileName (Project project, string componentName, string nameSpace)
+		{
 			GtkDesignInfo info = GtkDesignInfo.FromProject (project);
-//			var type=info.GuiBuilderProject.FindClass(componentName);
-			var folder = info.GtkGuiFolder;
+			string componentFile = info.GetComponentFile (componentName);
 			
-//			folder=type.CompilationUnit.FileName.ParentDirectory;
-			return Path.Combine (folder, componentName + Path.GetExtension (info.SteticGeneratedFile));
+			if (componentFile == null) {
+				if (nameSpace == "Stetic") {
+					return info.GetBuildFileInSteticFolder (componentName);
+				} else
+					throw new UserException ("Cannot find component file for " + componentName);
+			} else
+				return info.GetBuildFile (componentFile);
 		}
 		
 		public static string GenerateSteticCodeStructure (DotNetProject project, Stetic.ProjectItemInfo item, bool saveToFile, bool overwrite)
@@ -351,13 +361,12 @@
 					FileService.NotifyFileChanged (fileName);
 				}
 				else
-					ProjectDomService.Parse (project, fileName, "", ((StringWriter)fileStream).ToString ());
+					ProjectDomService.Parse (project, fileName, ((StringWriter)fileStream).ToString ());
 			}
 
 			return fileName;
 		}
 		
-		
 		public static Stetic.CodeGenerationResult GenerateSteticCode (IProgressMonitor monitor, DotNetProject project, ConfigurationSelector configuration)
 		{
 			if (generating || !GtkDesignInfo.HasDesignedObjects (project))
@@ -382,8 +391,8 @@
 			}
 
 			// Check if generated code is already up to date.
-			if (!ref_changed && last_gen_time >= File.GetLastWriteTime (info.SteticFile))
-				return null;
+//			if (!ref_changed && last_gen_time >= File.GetLastWriteTime (info.SteticFile))
+//				return null;
 			
 			if (info.GuiBuilderProject.HasError) {
 				monitor.ReportError (GettextCatalog.GetString ("GUI code generation failed for project '{0}'. The file '{1}' could not be loaded.", project.Name, info.SteticFile), null);
@@ -402,8 +411,8 @@
 			
 			info.GuiBuilderProject.UpdateLibraries ();
 			
-			ArrayList projects = new ArrayList ();
-			projects.Add (info.GuiBuilderProject.File);
+			ArrayList projectFolders = new ArrayList ();
+			projectFolders.Add (info.SteticFolder.FullPath);
 			
 			generating = true;
 			Stetic.CodeGenerationResult generationResult = null;
@@ -418,7 +427,7 @@
 						// Generate the code in another process if stetic is not isolated
 						CodeGeneratorProcess cob = (CodeGeneratorProcess) Runtime.ProcessService.CreateExternalProcessObject (typeof (CodeGeneratorProcess), false);
 						using (cob) {
-							generationResult = cob.GenerateCode (projects, info.GenerateGettext, info.GettextClass, project.UsePartialTypes, info);
+							generationResult = cob.GenerateCode (projectFolders, info.GenerateGettext, info.GettextClass, project.UsePartialTypes, info);
 						}
 					} catch (Exception ex) {
 						generatedException = ex;
@@ -438,8 +447,6 @@
 					Stetic.GenerationOptions options = new Stetic.GenerationOptions ();
 					options.UseGettext = info.GenerateGettext;
 					options.GettextClass = info.GettextClass;
-					options.UsePartialClasses = project.UsePartialTypes;
-					options.GenerateSingleFile = false;
 					generationResult = SteticApp.GenerateProjectCode (options, info.GuiBuilderProject.SteticProject);
 				} catch (Exception ex) {
 					generatedException = ex;
@@ -448,8 +455,23 @@
 			}
 			
 			if (generatedException != null) {
-				LoggingService.LogError ("GUI code generation failed", generatedException);
-				throw new UserException ("GUI code generation failed: " + generatedException.Message);
+				string msg = string.Empty;
+				
+				if (generatedException.InnerException != null) {
+					msg = string.Format("{0}\n{1}\nInner Exception {2}\n{3}",
+				                        generatedException.Message,
+				                        generatedException.StackTrace,
+					                    generatedException.InnerException.Message,
+					                    generatedException.InnerException.StackTrace);
+				} else {
+					msg = string.Format("{0}\n{1}",
+				                        generatedException.Message,
+				                        generatedException.StackTrace);
+				}
+				                           
+//				LoggingService.LogError ("GUI code generation failed", generatedException);
+				LoggingService.LogError ("GUI code generation failed: " + msg);
+				throw new UserException ("GUI code generation failed: " + msg);
 			}
 			
 			if (generationResult == null)
@@ -459,15 +481,15 @@
 			if (provider == null)
 				throw new UserException ("Code generation not supported for language: " + project.LanguageName);
 			
-			string basePath = Path.GetDirectoryName (info.SteticGeneratedFile);
-			string ext = Path.GetExtension (info.SteticGeneratedFile);
-			
 			foreach (Stetic.SteticCompilationUnit unit in generationResult.Units) {
 				string fname;
 				if (unit.Name.Length == 0)
 					fname = info.SteticGeneratedFile;
 				else
-					fname = Path.Combine (basePath, unit.Name) + ext;
+					fname = GetBuildCodeFileName (project, 
+					                              unit.Name, 
+					                              (unit.Namespace != null) ? unit.Namespace.Name : string.Empty);
+				
 				StringWriter sw = new StringWriter ();
 				try {
 					foreach (CodeNamespace ns in unit.Namespaces)
@@ -476,6 +498,12 @@
 					string content = sw.ToString ();
 					content = FormatGeneratedFile (fname, content, provider);
 					File.WriteAllText (fname, content);
+//					if (File.Exists (fname)) {
+//					FileInfo file = new FileInfo (fname);
+//					DateTime now = DateTime.Now;
+//					file.LastWriteTime = now;
+//					file.LastWriteTimeUtc = now;
+//					}
 				} finally {
 					FileService.NotifyFileChanged (fname);
 				}
@@ -580,23 +608,21 @@
 	 
 	public class CodeGeneratorProcess: RemoteProcessObject
 	{
-		public Stetic.CodeGenerationResult GenerateCode (ArrayList projectFiles, bool useGettext, string gettextClass, bool usePartialClasses, GtkDesignInfo info)
+		public Stetic.CodeGenerationResult GenerateCode (ArrayList projectFolders, bool useGettext, string gettextClass, bool usePartialClasses, GtkDesignInfo info)
 		{
 			Gtk.Application.Init ();
 			
 			Stetic.Application app = Stetic.ApplicationFactory.CreateApplication (Stetic.IsolationMode.None);
 			
-			Stetic.Project[] projects = new Stetic.Project [projectFiles.Count];
-			for (int n=0; n < projectFiles.Count; n++) {
+			Stetic.Project[] projects = new Stetic.Project [projectFolders.Count];
+			for (int n=0; n < projectFolders.Count; n++) {
 				projects [n] = app.CreateProject (info);
-				projects [n].Load ((string) projectFiles [n]);
+				projects [n].Load ((string) projectFolders [n]);
 			}
 			
 			Stetic.GenerationOptions options = new Stetic.GenerationOptions ();
 			options.UseGettext = useGettext;
 			options.GettextClass = gettextClass;
-			options.UsePartialClasses = usePartialClasses;
-			options.GenerateSingleFile = false;
 			
 			return app.GenerateProjectCode (options, projects);
 		}
Index: MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs
===================================================================
--- MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs	(revision 17)
+++ MonoDevelop.GtkCore.GuiBuilder/GuiBuilderDisplayBinding.cs	(working copy)
@@ -46,6 +46,9 @@
 		{
 			if (excludeThis) return false;
 			
+			if (fileName.Contains ("generated"))
+				return false;
+			
 			if (GetWindow (fileName) == null)
 				return false;
 			
@@ -81,7 +84,7 @@
 				return null;
 
 			GtkDesignInfo info = GtkDesignInfo.FromProject (project);
-			if (file.StartsWith (info.GtkGuiFolder))
+			if (file.StartsWith (info.SteticFolder))
 				return null;
 
 			ParsedDocument doc = ProjectDomService.GetParsedDocument (null, file);
Index: MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs
===================================================================
--- MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs	(revision 17)
+++ MonoDevelop.GtkCore.GuiBuilder/GuiBuilderProject.cs	(working copy)
@@ -44,12 +44,15 @@
 {
 	public class GuiBuilderProject
 	{
+		//to save temporarily GuiBuilderWindow while files are being moved between projects
+		static List<GuiBuilderWindow> formInfosRemoved;
+		
 		internal object MemoryProbe = Counters.GuiProjectsInMemory.CreateMemoryProbe ();
 		
 		List<GuiBuilderWindow> formInfos;
 		Stetic.Project gproject;
 		DotNetProject project;
-		string fileName;
+		string folderName;
 		bool hasError;
 		bool needsUpdate = true;
 		
@@ -64,38 +67,87 @@
 		public event EventHandler Reloaded;
 		public event EventHandler Unloaded;
 		public event EventHandler Changed;
+		
+		static GuiBuilderProject ()
+		{
+			formInfosRemoved = new List<GuiBuilderWindow> ();
+		}
 
-		public GuiBuilderProject (DotNetProject project, string fileName)
+		public GuiBuilderProject (DotNetProject project, string folderName)
 		{
-			this.fileName = fileName;
+			this.folderName = folderName;
 			this.project = project;
 			Counters.GuiProjectsLoaded++;
 		}
 		
+		public void Convert (string guiFolderName, bool makeBackup)
+		{
+			GtkDesignInfo info = GtkDesignInfo.FromProject (project); 
+			Stetic.Project gproject = GuiBuilderService.SteticApp.CreateProject (info);
+			//Stetic.Project does not implement IDisposable
+			try {
+				string newGuiFolderName = project.BaseDirectory.Combine (guiFolderName);
+				gproject.ConvertProject (info.SteticFile, newGuiFolderName);
+				info.ConvertGtkFolder (guiFolderName, makeBackup);
+				info.UpdateGtkFolder ();
+				folderName = newGuiFolderName;
+				IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetBuildProgressMonitor ();
+				try {
+					ConfigurationSelector configuration = IdeApp.Workspace.ActiveConfiguration;
+					Generator generator = new Generator ();
+					generator.Run (monitor, project, configuration);
+					monitor.ReportSuccess ("Converting was succesfull");
+				} finally {
+					monitor.Dispose ();
+				}
+			} finally {
+				gproject.Dispose ();
+			}
+		}
+		
+		public void GenerateCode (string componentFile)
+		{
+			GtkDesignInfo info = GtkDesignInfo.FromProject (project);
+			string gtkxFile = info.GetGtkxFile (componentFile);
+			if (gtkxFile != null && File.Exists (gtkxFile)) {
+				
+				Save (false);
+				FileInfo fi = new FileInfo (gtkxFile);
+				fi.LastWriteTime = DateTime.Now;
+				
+				IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetBuildProgressMonitor ();
+				try {
+					ConfigurationSelector configuration = IdeApp.Workspace.ActiveConfiguration;
+					Generator generator = new Generator ();
+					generator.Run (monitor, project, configuration);
+				} finally {
+					monitor.Dispose ();
+				}
+			}
+		}
+		
 		void Load ()
 		{
-			if (gproject != null || disposed || fileName == null)
+			if (gproject != null || disposed || folderName == null)
 				return;
 			
 			GtkDesignInfo info = GtkDesignInfo.FromProject (project); 
 			gproject = GuiBuilderService.SteticApp.CreateProject (info);
 			formInfos = new List<GuiBuilderWindow> ();
-		
-			if (!System.IO.File.Exists (fileName)) {
-				// Regenerate the gtk-gui folder if the stetic project
-				// doesn't exist.
-				info.UpdateGtkFolder ();
-			}
+			
+//			TODO : when expanding project, UpdateGtkFolder causes in throwing exception by gtk
+//			info.UpdateGtkFolder ();
 
 			try {
-				gproject.Load (fileName);
+				gproject.Load (folderName);
 			} catch (Exception ex) {
-				MessageService.ShowException (ex, GettextCatalog.GetString ("The GUI designer project file '{0}' could not be loaded.", fileName));
+				MessageService.ShowException (ex, GettextCatalog.GetString ("The GUI designer project folder '{0}' could not be loaded.", folderName));
 				hasError = true;
 			}
 
 			Counters.SteticProjectsLoaded++;
 			gproject.ResourceProvider = GtkDesignInfo.FromProject (project).ResourceProvider;
+//			gproject.DesignInfo = info;
 			gproject.WidgetAdded += OnAddWidget;
 			gproject.WidgetRemoved += OnRemoveWidget;
 			gproject.ActionGroupsChanged += OnGroupsChanged;
@@ -108,14 +160,14 @@
 				RegisterWindow (ob, false);
 				
 			// Monitor changes in the file
-			lastSaveTime = System.IO.File.GetLastWriteTime (fileName);
-			watcher = new FileSystemWatcher ();
-			if (System.IO.File.Exists (fileName)) {
-				watcher.Path = Path.GetDirectoryName (fileName);
-				watcher.Filter = Path.GetFileName (fileName);
-				watcher.Changed += (FileSystemEventHandler) DispatchService.GuiDispatch (new FileSystemEventHandler (OnSteticFileChanged));
-				watcher.EnableRaisingEvents = true;
-			}
+//			lastSaveTime = System.IO.File.GetLastWriteTime (fileName);
+//			watcher = new FileSystemWatcher ();
+//			if (System.IO.File.Exists (fileName)) {
+//				watcher.Path = Path.GetDirectoryName (fileName);
+//				watcher.Filter = Path.GetFileName (fileName);
+//				watcher.Changed += (FileSystemEventHandler) DispatchService.GuiDispatch (new FileSystemEventHandler (OnSteticFileChanged));
+//				watcher.EnableRaisingEvents = true;
+//			}
 		}	
 	
 		void Unload ()
@@ -158,7 +210,7 @@
 		void OnSteticFileChanged (object s, FileSystemEventArgs args)
 		{
 			lock (fileSaveLock) {
-				if (lastSaveTime == System.IO.File.GetLastWriteTime (fileName))
+				if (lastSaveTime == System.IO.File.GetLastWriteTime (folderName))
 					return;
 			}
 			
@@ -198,8 +250,8 @@
 
 			if (gproject != null && !hasError) {
 				lock (fileSaveLock) {
-					gproject.Save (fileName);
-					lastSaveTime = System.IO.File.GetLastWriteTime (fileName);
+					gproject.Save (folderName);
+					lastSaveTime = System.IO.File.GetLastWriteTime (folderName);
 				}
 			}
 				
@@ -207,14 +259,11 @@
 				IdeApp.ProjectOperations.Save (project);
 		}
 		
-		public string File {
-			get { return fileName; }
-		}
-		
 		public Stetic.Project SteticProject {
 			get {
 				Load ();
 				return gproject;
+			
 			}
 		}
 		
@@ -256,6 +305,16 @@
 			RegisterWindow (c, true);
 			return c;
 		}
+		
+		public void AddNewComponent (string fileName)
+		{
+			object ob = SteticProject.AddNewComponent (fileName);
+			
+			if (ob is Stetic.WidgetInfo) {
+				var c = (Stetic.WidgetInfo) ob;
+				RegisterWindow (c, true);
+			}
+		}
 	
 		void RegisterWindow (Stetic.WidgetInfo widget, bool notify)
 		{
@@ -266,6 +325,16 @@
 			
 				GuiBuilderWindow win = new GuiBuilderWindow (this, gproject, widget);
 				formInfos.Add (win);
+				
+				GuiBuilderWindow winToRemove = null;
+				foreach (GuiBuilderWindow form in formInfosRemoved)
+					if (form.RootWidget == widget) {
+						winToRemove = form;
+						break;
+					}
+				
+				if (winToRemove != null)
+					formInfosRemoved.Remove (winToRemove);
 			
 				if (notify) {
 					if (WindowAdded != null)
@@ -281,6 +350,7 @@
 				return;
 
 			formInfos.Remove (win);
+			formInfosRemoved.Add (win);
 
 			if (WindowRemoved != null)
 				WindowRemoved (this, new WindowEventArgs (win));
@@ -319,30 +389,18 @@
 		}
 		
 		void OnFileAdded (object sender, ProjectFileEventArgs args)
-		{
+		{	
+			FilePath path = args.ProjectFile.FilePath;
 			
-			ParsedDocument doc = ProjectDomService.GetParsedDocument (ProjectDomService.GetProjectDom (args.Project), args.ProjectFile.Name);
-			if (doc == null || doc.CompilationUnit == null)
-				return;
-
-			string dir = Path.Combine (Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), "stetic"), "deleted-designs");
-			if (!Directory.Exists (dir) || Directory.GetFiles (dir).Length == 0)
-				return;
-
-			foreach (IType t in doc.CompilationUnit.Types) {
-				string path = Path.Combine (dir, t.FullName + ".xml");
-				if (!System.IO.File.Exists (path))
-					continue;
-				XmlDocument xmldoc = new XmlDocument ();
-				xmldoc.Load (path);
-				AddNewComponent (xmldoc.DocumentElement);
-				System.IO.File.Delete (path);
+			if (path.Extension == ".gtkx") { 
+					AddNewComponent (path);
 			}
 		}
 
 		void OnFileRemoved (object sender, ProjectFileEventArgs args)
 		{
 			ArrayList toDelete = new ArrayList ();
+			ArrayList toDeleteGroups = new ArrayList ();
 
 			ParsedDocument doc = ProjectDomService.GetParsedDocument (ProjectDomService.GetProjectDom (args.Project), args.ProjectFile.Name);
 			if (doc == null || doc.CompilationUnit == null)
@@ -350,12 +408,22 @@
 
 			foreach (IType t in doc.CompilationUnit.Types) {
 				GuiBuilderWindow win = GetWindowForClass (t.FullName);
-				if (win != null)
+				if (win != null) {
 					toDelete.Add (win);
+					continue;
+				}
+				
+				Stetic.ActionGroupInfo group = GetActionGroup (t.FullName);
+				if (group != null) {
+					toDeleteGroups.Add (group);
+				}
 			}
-			
+	
 			foreach (GuiBuilderWindow win in toDelete)
 				Remove (win);
+			
+			foreach (Stetic.ActionGroupInfo group in toDeleteGroups)
+				RemoveActionGroup (group);
 		}
 
 		void OnGroupsChanged (object s, EventArgs a)
@@ -424,6 +492,13 @@
 						return form;
 				}
 			}
+			
+			if (formInfosRemoved != null) {
+				foreach (GuiBuilderWindow form in formInfosRemoved) {
+					if (CodeBinder.GetObjectName (form.RootWidget) == className)
+						return form;
+				}
+			}
 			return null;
 		}
 
@@ -460,7 +535,7 @@
 		
 		public Stetic.ActionGroupInfo GetActionGroup (string name)
 		{
-			return SteticProject.GetActionGroup (name);
+			return (SteticProject != null) ? SteticProject.GetActionGroup (name) : null;
 		}
 
 		public FilePath GetSourceCodeFile (Stetic.ProjectItemInfo obj)
@@ -489,8 +564,9 @@
 		
 		public IType FindClass (string className, bool getUserClass)
 		{
-			FilePath gui_folder = GtkDesignInfo.FromProject (project).GtkGuiFolder;
+			FilePath gui_folder = GtkDesignInfo.FromProject (project).SteticFolder;
 			ProjectDom ctx = GetParserContext ();
+
 			if (ctx == null)
 				return null;
 			IEnumerable<IType> classes = ctx.Types;
@@ -502,7 +578,9 @@
 						// Return this class only if it is declared outside the gtk-gui
 						// folder. Generated partial classes will be ignored.
 						foreach (IType part in cls.Parts) {
-							if (part.CompilationUnit != null && !part.CompilationUnit.FileName.IsNullOrEmpty && !part.CompilationUnit.FileName.IsChildPathOf (gui_folder)) {
+							if (part.CompilationUnit.FileName.FullPath.IsChildPathOf (gui_folder))
+								continue;
+							if (part.CompilationUnit != null && !part.CompilationUnit.FileName.IsNullOrEmpty && !part.CompilationUnit.FileName.FileName.Contains ("generated")) {
 								return part;
 							}
 						}
@@ -557,8 +635,10 @@
 			
 			// Make sure the target gtk version is properly set
 			if (gproject.TargetGtkVersion != target_version) {
+				if (gproject.TargetGtkVersion != string.Empty) {
+					needsSave = true;
+				}
 				gproject.TargetGtkVersion = target_version;
-				needsSave = true;
 			}
 
 			string outLib = project.GetOutputFileName (IdeApp.Workspace.ActiveConfiguration);
@@ -571,8 +651,11 @@
 			
 			// See if something has changed
 			if (LibrariesChanged (oldLibs, internalLibs, newLibs)) {
+			// If oldLibs is empty, gproject was uninitialized, so there are no changes to save
+				if (oldLibs.Length > 0) {
+					needsSave = true;
+				}
 				gproject.SetWidgetLibraries (newLibs, internalLibs);
-				needsSave = true;
 			} else {
 				GuiBuilderService.SteticApp.UpdateWidgetLibraries (false);
 			}
@@ -611,24 +694,30 @@
 				return files;
 
 			IDotNetLanguageBinding binding = LanguageBindingService.GetBindingPerLanguageName (project.LanguageName) as IDotNetLanguageBinding;
-			string path = Path.Combine (guiFolder, binding.GetFileName ("generated"));
-			if (!System.IO.File.Exists (path)) {
-				// Generate an empty build class
-				CodeDomProvider provider = binding.GetCodeDomProvider ();
-				if (provider == null)
-					throw new UserException ("Code generation not supported for language: " + project.LanguageName);
-				GuiBuilderService.SteticApp.GenerateProjectCode (path, "Stetic", provider, null);
+			CodeDomProvider provider = binding.GetCodeDomProvider ();
+				
+			if (provider == null)
+				throw new UserException ("Code generation not supported for language: " + project.LanguageName);
+//			string path = Path.Combine (guiFolder, binding.GetFileName ("generated"));
+//			if (!System.IO.File.Exists (path)) {
+//				GuiBuilderService.SteticApp.GenerateProjectCode (path, "Stetic", provider, null);
+//			}
+//			files.Add (path);
+//
+//			if (Windows != null) {
+//				foreach (GuiBuilderWindow win in Windows)
+//					files.Add (GuiBuilderService.GenerateSteticCodeStructure (project, win.RootWidget, true, false));
+//			}
+//					
+//			foreach (Stetic.ActionGroupInfo ag in SteticProject.ActionGroups)
+//				files.Add (GuiBuilderService.GenerateSteticCodeStructure (project, ag, true, false));
+			
+			string extension = "generated." + provider.FileExtension;
+			foreach (string file in Directory.GetFiles (guiFolder)) {
+				if (file.Contains (extension))
+					files.Add (file);		
 			}
-			files.Add (path);
 
-			if (Windows != null) {
-				foreach (GuiBuilderWindow win in Windows)
-					files.Add (GuiBuilderService.GenerateSteticCodeStructure (project, win.RootWidget, true, false));
-			}
-					
-			foreach (Stetic.ActionGroupInfo ag in SteticProject.ActionGroups)
-				files.Add (GuiBuilderService.GenerateSteticCodeStructure (project, ag, true, false));
-
 			return files;
 		}
 	}
Index: MonoDevelop.GtkCore.GuiBuilder/ChangeLog
===================================================================
--- MonoDevelop.GtkCore.GuiBuilder/ChangeLog	(revision 0)
+++ MonoDevelop.GtkCore.GuiBuilder/ChangeLog	(revision 125)
@@ -0,0 +1,75 @@
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* GuiBuilderProject.cs: 
+
+2010-08-15  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* GuiBuilderProject.cs:
+	* GuiBuilderService.cs: 
+
+2010-08-13  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* GuiBuilderView.cs:
+	* GuiBuilderProject.cs:
+	* GuiBuilderService.cs:
+	* GuiBuilderDisplayBinding.cs:
+	* ActionGroupDisplayBinding.cs: 
+
+2010-08-09  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* GuiBuilderProject.cs: Generate stetic code after a project converting
+	* GuiBuilderService.cs:
+	* GuiBuilderDisplayBinding.cs: Don't use component display binding for
+	generated partial files
+
+2010-08-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* GuiBuilderView.cs: Raise OnDirtyChanged after saving.
+	* CombinedDesignView.cs: Track Api Changes.
+
+2010-08-05  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* GuiBuilderView.cs: Remove ModifiedChanged handler
+
+2010-08-04  Krzysztof Marecki  <freefirma@gmail.com>
+
+	* CodeBinder.cs: Bump Api
+	* GuiBuilderWindow.cs:
+	* GuiBuilderService.cs:
+	* CombinedDesignView.cs:
+	* ActionGroupDisplayBinding.cs: 
+
+2010-08-03  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* GuiBuilderProject.cs: When Updatinglibraries don't save 
+							if Stetic.Project was uninitialized
+
+2010-07-27  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* GuiBuilderView.cs:
+	* CombinedDesignView.cs: 
+
+2010-07-06  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* GuiBuilderProject.cs:
+	* GuiBuilderService.cs: 
+
+2010-07-05  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* GuiBuilderProject.cs:
+	* CombinedDesignView.cs: 
+
+2010-06-23  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* GuiBuilderProject.cs: 
+
+2010-06-21  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* GuiBuilderProject.cs: Add Convert method
+
+2010-06-07  Krzysztof Marecki  <marecki.krzysztof@gmail.com>
+
+	* GuiBuilderProject.cs:
+	* GuiBuilderService.cs:
+	* GtkProjectServiceExtension.cs: 
+
Index: MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs
===================================================================
--- MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs	(revision 17)
+++ MonoDevelop.GtkCore.GuiBuilder/GuiBuilderWindow.cs	(working copy)
@@ -203,7 +203,7 @@
 			IdeApp.ProjectOperations.Save (Project.Project);
 			
 			// Make sure the database is up-to-date
-			ProjectDomService.Parse (Project.Project, cls.CompilationUnit.FileName, null);
+			ProjectDomService.Parse (Project.Project, cls.CompilationUnit.FileName);
 		}
 		
 		void AddSignalsRec (CodeTypeDeclaration type, Stetic.Component comp)
Index: MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs
===================================================================
--- MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs	(revision 17)
+++ MonoDevelop.GtkCore.GuiBuilder/GuiBuilderView.cs	(working copy)
@@ -79,7 +79,7 @@
 		{
 			gproject = window.Project;
 			GtkDesignInfo info = GtkDesignInfo.FromProject (gproject.Project);
-			gproject.SteticProject.ImagesRootPath = FileService.AbsoluteToRelativePath (info.GtkGuiFolder, gproject.Project.BaseDirectory);
+			gproject.SteticProject.ImagesRootPath = FileService.AbsoluteToRelativePath (info.SteticFolder, gproject.Project.BaseDirectory);
 			gproject.UpdateLibraries ();
 			LoadDesigner ();
 		}
@@ -121,7 +121,7 @@
 			
 			gproject.Unloaded += OnDisposeProject;
 			
-			designer = gproject.SteticProject.CreateWidgetDesigner (window.RootWidget, false);
+			designer = gproject.SteticProject.CreateWidgetDesigner (window.RootWidget);
 			
 			// Designer page
 			designerPage.ClearChild ();
@@ -138,7 +138,7 @@
 			codeBinder = new CodeBinder (gproject.Project, new OpenDocumentFileProvider (), designer.RootComponent);
 			
 			designer.BindField += OnBindWidgetField;
-			designer.ModifiedChanged += OnWindowModifiedChanged;
+			designer.Changed += OnChanged;
 			designer.SignalAdded += OnSignalAdded;
 			designer.SignalRemoved += OnSignalRemoved;
 			designer.SignalChanged += OnSignalChanged;
@@ -194,7 +194,7 @@
 			
 			gproject.Unloaded -= OnDisposeProject;
 			designer.BindField -= OnBindWidgetField;
-			designer.ModifiedChanged -= OnWindowModifiedChanged;
+			designer.Changed -= OnChanged;
 			designer.SignalAdded -= OnSignalAdded;
 			designer.SignalRemoved -= OnSignalRemoved;
 			designer.SignalChanged -= OnSignalChanged;
@@ -292,7 +292,7 @@
 				AddButton (GettextCatalog.GetString ("Actions"), actionsPage);
 		}
 		
-		void OnWindowModifiedChanged (object s, EventArgs args)
+		void OnChanged (object s, EventArgs args)
 		{
 			if (IsDirty)
 				OnContentChanged (args);
@@ -351,6 +351,7 @@
 			}
 			
 			gproject.Save (true);
+			OnDirtyChanged (EventArgs.Empty);
 		}
 		
 		public override bool IsDirty {
Index: MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs
===================================================================
--- MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs	(revision 17)
+++ MonoDevelop.GtkCore.GuiBuilder/CodeBinder.cs	(working copy)
@@ -89,7 +89,7 @@
 			if (targetObject == null)
 				return;
 			
-			ParsedDocument doc = ProjectDomService.Parse (project, fileName, null);
+			ParsedDocument doc = ProjectDomService.Parse (project, fileName);
 			classFile = fileName;
 			
 			if (doc != null && doc.CompilationUnit != null) {
@@ -266,7 +266,7 @@
 			ArrayList matches = new ArrayList ();
 			ICompilationUnit unit = null;
 			ProjectDom ctx = gproject.GetParserContext ();
-			ParsedDocument doc = ProjectDomService.Parse (project, classFile, null);
+			ParsedDocument doc = ProjectDomService.Parse (project, classFile);
 			if (doc != null && doc.CompilationUnit != null) {
 				unit = doc.CompilationUnit;
 				foreach (IType fcls in unit.Types) {
Index: MonoDevelop.GtkCore.GuiBuilder/CombinedDesignView.cs
===================================================================
--- MonoDevelop.GtkCore.GuiBuilder/CombinedDesignView.cs	(revision 17)
+++ MonoDevelop.GtkCore.GuiBuilder/CombinedDesignView.cs	(working copy)
@@ -200,6 +200,7 @@
 		
 		public override void Load (string fileName)
 		{
+			ShowPage (1);
 			ContentName = fileName;
 			content.Load (fileName);
 		}
@@ -257,7 +258,9 @@
 		{
 		}
 		
-		public override object GetContent (Type type)
+//		public override object GetContent (Type type)
+//		public override T GetContent<T> ()
+		public override T GetContent<T> ()
 		{
 //			if (type == typeof(IEditableTextBuffer)) {
 //				// Intercept the IPositionable interface, since we need to
@@ -268,18 +271,12 @@
 //					return null;
 //			}
 //			
-			object ob = base.GetContent (type);
-			if (ob != null)
-				return ob;
-			else if (content != null)
-				return content.GetContent (type);
-			else
-				return null;
+			return  base.GetContent<T> () ?? content.GetContent<T> ();
 		}
 
 		public void JumpTo (int line, int column)
 		{
-			IEditableTextBuffer ip = (IEditableTextBuffer) content.GetContent (typeof(IEditableTextBuffer));
+			IEditableTextBuffer ip = (IEditableTextBuffer) content.GetContent<IEditableTextBuffer> ();
 			if (ip != null) {
 				ShowPage (0);
 				ip.SetCaretTo (line, column);
Index: MonoDevelop.GtkCore.GuiBuilder/GtkProjectServiceExtension.cs
===================================================================
--- MonoDevelop.GtkCore.GuiBuilder/GtkProjectServiceExtension.cs	(revision 17)
+++ MonoDevelop.GtkCore.GuiBuilder/GtkProjectServiceExtension.cs	(working copy)
@@ -35,7 +35,9 @@
 
 			if (gen.Messages != null) {
 				foreach (string s in gen.Messages)
-					res.AddWarning (info.GuiBuilderProject.File, 0, 0, null, s);
+//					res.AddWarning (info.GuiBuilderProject.File, 0, 0, null, s);
+// TODO:	Add gtkx file name in the Generator 
+					res.AddWarning ("", 0, 0, null, s);
 						
 				if (gen.Messages.Length > 0)
 					info.ForceCodeGenerationOnBuild ();
