diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2011-08-02 09:19:46 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2011-08-02 09:20:45 +0400 |
commit | 567274d93cf075613418adf41994a017b5d44ee4 (patch) | |
tree | 1636f55c2180874331b10856219fa1c1a7c80ae9 /main | |
parent | 9263547137bcb5f65fec3a6ca25c1d047e6c25ec (diff) |
Fill value combo box values, if sheme has value definitions.
Diffstat (limited to 'main')
-rw-r--r-- | main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/CustomPropertiesWidget.cs | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/CustomPropertiesWidget.cs b/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/CustomPropertiesWidget.cs index 35ecf1ceed..cc070cc467 100644 --- a/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/CustomPropertiesWidget.cs +++ b/main/src/addins/MonoDevelop.MacDev/MonoDevelop.MacDev.PlistEditor/CustomPropertiesWidget.cs @@ -39,7 +39,7 @@ namespace MonoDevelop.MacDev.PlistEditor { TreeStore treeStore = new TreeStore (typeof(string), typeof (PObject)); Gtk.ListStore keyStore = new ListStore (typeof (string), typeof (PListScheme.Key)); - Gtk.ListStore valueStore = new ListStore (typeof (string), typeof (object)); + Gtk.ListStore valueStore = new ListStore (typeof (string), typeof (string)); Gtk.TreeView treeview1; PListScheme scheme; HashSet<PObject> expandedObjects = new HashSet<PObject> (); @@ -309,6 +309,20 @@ namespace MonoDevelop.MacDev.PlistEditor propRenderer.TextColumn = 0; propRenderer.EditingStarted += delegate(object o, EditingStartedArgs args) { valueStore.Clear (); + if (Scheme == null) + return; + TreeIter iter; + if (!treeStore.GetIterFromString (out iter, args.Path)) + return; + var pObject = (PObject)treeStore.GetValue (iter, 1); + if (pObject == null) + return; + var key = Parent != null? Scheme.GetKey (pObject.Parent.Key) : null; + if (key != null) { + foreach (var val in key.Values) { + valueStore.AppendValues (val.Description); + } + } }; propRenderer.Edited += delegate(object o, EditedArgs args) { @@ -316,7 +330,19 @@ namespace MonoDevelop.MacDev.PlistEditor if (!treeStore.GetIterFromString (out iter, args.Path)) return; var pObject = (PObject)treeStore.GetValue (iter, 1); - pObject.SetValue (args.NewText); + if (pObject == null) + return; + string newText = args.NewText; + var key = Parent != null? Scheme.GetKey (pObject.Parent.Key) : null; + if (key != null) { + foreach (var val in key.Values) { + if (newText == val.Description) { + newText = val.Identifier; + break; + } + } + } + pObject.SetValue (newText); }; /* propRenderer.EditingStarted += delegate(object o, EditingStartedArgs args) { |