[Monodevelop-patches-list] r1809 - in trunk/MonoDevelop/src/Main/Base: . Commands Gui/Dialogs
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Wed Jun 23 02:33:55 EDT 2004
Author: tberman
Date: 2004-06-23 02:33:54 -0400 (Wed, 23 Jun 2004)
New Revision: 1809
Modified:
trunk/MonoDevelop/src/Main/Base/ChangeLog
trunk/MonoDevelop/src/Main/Base/Commands/FileCommands.cs
trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/NewFileDialog.cs
Log:
cleanup some code, convert to using the DispatchService, and poof, no more ugly gui locking issues.
Modified: trunk/MonoDevelop/src/Main/Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/src/Main/Base/ChangeLog 2004-06-23 04:47:32 UTC (rev 1808)
+++ trunk/MonoDevelop/src/Main/Base/ChangeLog 2004-06-23 06:33:54 UTC (rev 1809)
@@ -1,5 +1,13 @@
2004-06-23 Todd Berman <tberman at off.net>
+ * Commands/FileCommands.cs: Cleanup a bit, move some code around.
+ * Gui/Dialogs/NewFileDialog.cs: Convert to using DispatchService.
+ This also tests the BackgroundDispatch method, which seems to be
+ working fine. Now New File will no longer lock up the GUI at all.
+ Also cleanup misc code, and unused pieces.
+
+2004-06-23 Todd Berman <tberman at off.net>
+
* Gui/Pads/ClassScout/ClassScout.cs: use DispatchService instead of
IdleWork stuff.
* Services/DispatchService/DispatchService.cs: new service, used to
Modified: trunk/MonoDevelop/src/Main/Base/Commands/FileCommands.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Commands/FileCommands.cs 2004-06-23 04:47:32 UTC (rev 1808)
+++ trunk/MonoDevelop/src/Main/Base/Commands/FileCommands.cs 2004-06-23 06:33:54 UTC (rev 1809)
@@ -37,14 +37,7 @@
{
public override void Run()
{
- using (NewFileDialog nfd = new NewFileDialog()) {
- nfd.Run ();
- nfd.Hide ();
- if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null)
- {
- WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.SelectWindow();
- }
- }
+ NewFileDialog nfd = new NewFileDialog ();
}
}
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/NewFileDialog.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/NewFileDialog.cs 2004-06-23 04:47:32 UTC (rev 1808)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/NewFileDialog.cs 2004-06-23 06:33:54 UTC (rev 1809)
@@ -43,8 +43,8 @@
Button cancelButton;
Label infoLabel;
- //IconService iconService = (IconService)ServiceManager.Services.GetService (typeof(IconService));
ResourceService iconService = (ResourceService)ServiceManager.Services.GetService (typeof(IResourceService));
+ DispatchService dispatcher = (DispatchService)ServiceManager.Services.GetService (typeof (DispatchService));
public NewFileDialog () : base ()
{
@@ -52,16 +52,7 @@
this.BorderWidth = 6;
this.HasSeparator = false;
- try {
- InitializeComponents();
- InitializeTemplates();
- InitializeView();
-
- //((TreeView)ControlDictionary["categoryTreeView"]).Select();
- } catch (Exception e) {
- Console.WriteLine(e.ToString());
- }
- ShowAll ();
+ dispatcher.BackgroundDispatch (new MessageHandler (InitializeTemplates), null);
}
void InitializeView()
@@ -86,22 +77,16 @@
}
icons = tmp;
- foreach (TemplateItem item in alltemplates) {
- if (item.Template.Icon == null) {
- //item.ImageIndex = 0;
- } else {
- //item.ImageIndex = (int)icons[item.Template.Icon];
- }
- }
InsertCategories(TreeIter.Zero, categories);
- PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
+ //PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
/*for (int j = 0; j < categories.Count; ++j) {
if (((Category)categories[j]).Name == propertyService.GetProperty("Dialogs.NewFileDialog.LastSelectedCategory", "C#")) {
((TreeView)ControlDictionary["categoryTreeView"]).SelectedNode = (TreeNode)((TreeView)ControlDictionary["categoryTreeView"]).Nodes[j];
break;
}
}*/
+ ShowAll ();
}
void InsertCategories(TreeIter node, ArrayList catarray)
@@ -129,7 +114,7 @@
return newcategory;
}
- void InitializeTemplates()
+ void InitializeTemplates(object blank)
{
foreach (FileTemplate template in FileTemplate.FileTemplates) {
TemplateItem titem = new TemplateItem(template);
@@ -150,21 +135,15 @@
}
alltemplates.Add(titem);
}
+ dispatcher.GuiDispatch (new MessageHandler (InitializeComponents), null);
}
- bool FixCatIcons (TreeModel mdl, TreePath path, TreeIter iter) {
- ((TreeStore)mdl).SetValue (iter, 3, cat_imglist[1]);
- return false;
- }
-
// tree view event handlers
void CategoryChange(object sender, EventArgs e)
{
TreeModel mdl;
TreeIter iter;
if (catView.Selection.GetSelected (out mdl, out iter)) {
- ((TreeStore)mdl).Foreach (new TreeModelForeachFunc (FixCatIcons));
- ((TreeStore)mdl).SetValue (iter, 3, cat_imglist[0]);
//templateStore.Clear ();
TemplateView.Clear ();
foreach (TemplateItem item in (ArrayList)((Gtk.TreeStore)mdl).GetValue (iter, 2)) {
@@ -193,12 +172,6 @@
}
okButton.Sensitive = true;
}
-// if (templateView.Selection.GetSelected (out mdl, out iter)) {
-// StringParserService sps = (StringParserService)ServiceManager.Services.GetService (typeof(StringParserService));
-// string text = sps.Parse (((FileTemplate)((Gtk.TreeStore)mdl).GetValue (iter, 1)).Description);
-// infoLabel.Text = text;
-// okButton.Sensitive = true;
-// }
}
// button events
@@ -232,13 +205,12 @@
//if (templateView.Selection.GetSelected (out mdl, out iter)) {
if (TemplateView.CurrentlySelected != null) {
FileTemplate item = (FileTemplate)TemplateView.CurrentlySelected;
- //FileTemplate item = (FileTemplate)((Gtk.TreeStore)mdl).GetValue (iter, 1);
if (item.WizardPath != null) {
- IProperties customizer = new DefaultProperties();
- customizer.SetProperty("Template", item);
- customizer.SetProperty("Creator", this);
- WizardDialog wizard = new WizardDialog("File Wizard", customizer, item.WizardPath);
+ //IProperties customizer = new DefaultProperties();
+ //customizer.SetProperty("Template", item);
+ //customizer.SetProperty("Creator", this);
+ //WizardDialog wizard = new WizardDialog("File Wizard", customizer, item.WizardPath);
//if (wizard.ShowDialog() == DialogResult.OK) {
//DialogResult = DialogResult.OK;
//}
@@ -248,11 +220,13 @@
}
}
- Respond ((int)Gtk.ResponseType.Ok);
- Hide ();
+ Destroy ();
+ if (WorkbenchSingleton.Workbench.ActiveWorkbenchWindow != null) {
+ WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.SelectWindow();
+ }
}
}
-
+
/// <summary>
/// Represents a category
/// </summary>
@@ -315,10 +289,10 @@
}
void cancelClicked (object o, EventArgs e) {
- Hide ();
+ Destroy ();
}
-
- void InitializeComponents()
+
+ void InitializeComponents(object blank)
{
catStore = new Gtk.TreeStore (typeof(string), typeof(ArrayList), typeof(ArrayList), typeof(Gdk.Pixbuf));
@@ -362,14 +336,9 @@
Frame infoLabelFrame = new Frame();
infoLabelFrame.Add(infoLabel);
- //VBox mainbox = new VBox (false, 5);
- //mainbox.BorderWidth = 5;
- //mainbox.Spacing = 5;
-
HBox viewbox = new HBox (false, 6);
swindow1.Add(catView);
viewbox.PackStart (swindow1,false,true,0);
- //viewbox.PackStart (templateView);
viewbox.PackStart(TemplateView, true, true,0);
this.AddActionWidget (cancelButton, (int)Gtk.ResponseType.Cancel);
@@ -381,12 +350,10 @@
cat_imglist = new PixbufList();
cat_imglist.Add(iconService.GetBitmap("Icons.16x16.OpenFolderBitmap"));
cat_imglist.Add(iconService.GetBitmap("Icons.16x16.ClosedFolderBitmap"));
-
catView.Selection.Changed += new EventHandler (CategoryChange);
TemplateView.IconSelected += new EventHandler(SelectedIndexChange);
TemplateView.IconDoubleClicked += new EventHandler(OpenEvent);
-
- PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
+ InitializeView ();
}
}
}
More information about the Monodevelop-patches-list
mailing list