[Monodevelop-patches-list] r984 - in trunk/MonoDevelop: data/resources/glade src/Main/Base/Gui/Dialogs/OptionPanels/ProjectOptions

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sun Feb 22 01:21:58 EST 2004


Author: dkor
Date: 2004-02-22 01:21:58 -0500 (Sun, 22 Feb 2004)
New Revision: 984

Modified:
   trunk/MonoDevelop/data/resources/glade/Base.glade
   trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/ProjectOptions/DeployFileOptions.cs
Log:
Ported and Gladed DeployFileOptionsPanel

Modified: trunk/MonoDevelop/data/resources/glade/Base.glade
===================================================================
--- trunk/MonoDevelop/data/resources/glade/Base.glade	2004-02-22 05:46:13 UTC (rev 983)
+++ trunk/MonoDevelop/data/resources/glade/Base.glade	2004-02-22 06:21:58 UTC (rev 984)
@@ -3570,16 +3570,16 @@
 		  <property name="spacing">6</property>
 
 		  <child>
-		    <widget class="GtkVBox" id="vbox52">
+		    <widget class="GtkVBox" id="deployScriptBox">
 		      <property name="visible">True</property>
 		      <property name="homogeneous">False</property>
 		      <property name="spacing">6</property>
 
 		      <child>
-			<widget class="GtkRadioButton" id="ProjectFiles">
+			<widget class="GtkRadioButton" id="scriptFileRadioButton">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">_Project Files</property>
+			  <property name="label" translatable="yes">With _scriptfile</property>
 			  <property name="use_underline">True</property>
 			  <property name="relief">GTK_RELIEF_NORMAL</property>
 			  <property name="active">False</property>
@@ -3594,13 +3594,13 @@
 		      </child>
 
 		      <child>
-			<widget class="GtkHBox" id="hbox35">
+			<widget class="GtkHBox" id="hbox34">
 			  <property name="visible">True</property>
 			  <property name="homogeneous">False</property>
 			  <property name="spacing">6</property>
 
 			  <child>
-			    <widget class="GtkLabel" id="label64">
+			    <widget class="GtkLabel" id="label63">
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes">    </property>
 			      <property name="use_underline">False</property>
@@ -3621,24 +3621,44 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkScrolledWindow" id="scrolledwindow7">
+			    <widget class="GtkHBox" id="hbox32">
 			      <property name="visible">True</property>
-			      <property name="can_focus">True</property>
-			      <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-			      <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-			      <property name="shadow_type">GTK_SHADOW_IN</property>
-			      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+			      <property name="homogeneous">False</property>
+			      <property name="spacing">6</property>
 
 			      <child>
-				<widget class="GtkTreeView" id="includeTreeView">
+				<widget class="GtkEntry" id="deployScriptEntry">
 				  <property name="visible">True</property>
 				  <property name="can_focus">True</property>
-				  <property name="headers_visible">False</property>
-				  <property name="rules_hint">False</property>
-				  <property name="reorderable">False</property>
-				  <property name="enable_search">True</property>
+				  <property name="editable">True</property>
+				  <property name="visibility">True</property>
+				  <property name="max_length">0</property>
+				  <property name="text" translatable="yes"></property>
+				  <property name="has_frame">True</property>
+				  <property name="invisible_char" translatable="yes">*</property>
+				  <property name="activates_default">False</property>
 				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">True</property>
+				  <property name="fill">True</property>
+				</packing>
 			      </child>
+
+			      <child>
+				<widget class="GtkButton" id="selectScriptFileButton">
+				  <property name="visible">True</property>
+				  <property name="can_focus">True</property>
+				  <property name="label" translatable="yes">...</property>
+				  <property name="use_underline">True</property>
+				  <property name="relief">GTK_RELIEF_NORMAL</property>
+				</widget>
+				<packing>
+				  <property name="padding">0</property>
+				  <property name="expand">False</property>
+				  <property name="fill">False</property>
+				</packing>
+			      </child>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
@@ -3649,20 +3669,20 @@
 			</widget>
 			<packing>
 			  <property name="padding">0</property>
-			  <property name="expand">True</property>
-			  <property name="fill">True</property>
+			  <property name="expand">False</property>
+			  <property name="fill">False</property>
 			</packing>
 		      </child>
 		    </widget>
 		    <packing>
 		      <property name="padding">0</property>
-		      <property name="expand">True</property>
-		      <property name="fill">True</property>
+		      <property name="expand">False</property>
+		      <property name="fill">False</property>
 		    </packing>
 		  </child>
 
 		  <child>
-		    <widget class="GtkRadioButton" id="radiobutton2">
+		    <widget class="GtkRadioButton" id="compiledAssemblyRadioButton">
 		      <property name="visible">True</property>
 		      <property name="can_focus">True</property>
 		      <property name="label" translatable="yes">Compilation _target</property>
@@ -3671,7 +3691,7 @@
 		      <property name="active">False</property>
 		      <property name="inconsistent">False</property>
 		      <property name="draw_indicator">True</property>
-		      <property name="group">ProjectFiles</property>
+		      <property name="group">scriptFileRadioButton</property>
 		    </widget>
 		    <packing>
 		      <property name="padding">0</property>
@@ -3681,22 +3701,22 @@
 		  </child>
 
 		  <child>
-		    <widget class="GtkVBox" id="vbox53">
+		    <widget class="GtkVBox" id="vbox52">
 		      <property name="visible">True</property>
 		      <property name="homogeneous">False</property>
 		      <property name="spacing">6</property>
 
 		      <child>
-			<widget class="GtkRadioButton" id="radiobutton3">
+			<widget class="GtkRadioButton" id="projectFileRadioButton">
 			  <property name="visible">True</property>
 			  <property name="can_focus">True</property>
-			  <property name="label" translatable="yes">With _scriptfile</property>
+			  <property name="label" translatable="yes">_Project Files</property>
 			  <property name="use_underline">True</property>
 			  <property name="relief">GTK_RELIEF_NORMAL</property>
 			  <property name="active">False</property>
 			  <property name="inconsistent">False</property>
 			  <property name="draw_indicator">True</property>
-			  <property name="group">ProjectFiles</property>
+			  <property name="group">scriptFileRadioButton</property>
 			</widget>
 			<packing>
 			  <property name="padding">0</property>
@@ -3706,13 +3726,13 @@
 		      </child>
 
 		      <child>
-			<widget class="GtkHBox" id="hbox34">
+			<widget class="GtkHBox" id="hbox35">
 			  <property name="visible">True</property>
 			  <property name="homogeneous">False</property>
 			  <property name="spacing">6</property>
 
 			  <child>
-			    <widget class="GtkLabel" id="label63">
+			    <widget class="GtkLabel" id="label64">
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes">    </property>
 			      <property name="use_underline">False</property>
@@ -3733,56 +3753,118 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkHBox" id="hbox32">
+			    <widget class="GtkScrolledWindow" id="scrolledwindow7">
 			      <property name="visible">True</property>
-			      <property name="homogeneous">False</property>
-			      <property name="spacing">6</property>
+			      <property name="can_focus">True</property>
+			      <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+			      <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+			      <property name="shadow_type">GTK_SHADOW_IN</property>
+			      <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
 
 			      <child>
-				<widget class="GtkEntry" id="entry1">
+				<widget class="GtkTreeView" id="includeTreeView">
 				  <property name="visible">True</property>
 				  <property name="can_focus">True</property>
-				  <property name="editable">True</property>
-				  <property name="visibility">True</property>
-				  <property name="max_length">0</property>
-				  <property name="text" translatable="yes"></property>
-				  <property name="has_frame">True</property>
-				  <property name="invisible_char" translatable="yes">*</property>
-				  <property name="activates_default">False</property>
+				  <property name="headers_visible">False</property>
+				  <property name="rules_hint">False</property>
+				  <property name="reorderable">False</property>
+				  <property name="enable_search">True</property>
 				</widget>
-				<packing>
-				  <property name="padding">0</property>
-				  <property name="expand">True</property>
-				  <property name="fill">True</property>
-				</packing>
 			      </child>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">True</property>
+			      <property name="fill">True</property>
+			    </packing>
+			  </child>
+			</widget>
+			<packing>
+			  <property name="padding">0</property>
+			  <property name="expand">True</property>
+			  <property name="fill">True</property>
+			</packing>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="padding">0</property>
+		      <property name="expand">True</property>
+		      <property name="fill">True</property>
+		    </packing>
+		  </child>
 
-			      <child>
-				<widget class="GtkButton" id="button2">
-				  <property name="visible">True</property>
-				  <property name="can_focus">True</property>
-				  <property name="label" translatable="yes">...</property>
-				  <property name="use_underline">True</property>
-				  <property name="relief">GTK_RELIEF_NORMAL</property>
-				</widget>
-				<packing>
-				  <property name="padding">0</property>
-				  <property name="expand">False</property>
-				  <property name="fill">False</property>
-				</packing>
-			      </child>
+		  <child>
+		    <widget class="GtkVBox" id="deployTargetBox">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">0</property>
+
+		      <child>
+			<widget class="GtkHBox" id="hbox33">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">6</property>
+
+			  <child>
+			    <widget class="GtkLabel" id="label62">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">_Deploy target:</property>
+			      <property name="use_underline">True</property>
+			      <property name="use_markup">False</property>
+			      <property name="justify">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap">False</property>
+			      <property name="selectable">False</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			      <property name="mnemonic_widget">deployTargetEntry</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkEntry" id="deployTargetEntry">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="editable">True</property>
+			      <property name="visibility">True</property>
+			      <property name="max_length">0</property>
+			      <property name="text" translatable="yes"></property>
+			      <property name="has_frame">True</property>
+			      <property name="invisible_char" translatable="yes">*</property>
+			      <property name="activates_default">False</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
 			      <property name="expand">True</property>
 			      <property name="fill">True</property>
 			    </packing>
 			  </child>
+
+			  <child>
+			    <widget class="GtkButton" id="selectTargetButton">
+			      <property name="visible">True</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">...</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
 			</widget>
 			<packing>
 			  <property name="padding">0</property>
-			  <property name="expand">False</property>
-			  <property name="fill">False</property>
+			  <property name="expand">True</property>
+			  <property name="fill">True</property>
 			</packing>
 		      </child>
 		    </widget>
@@ -3813,88 +3895,6 @@
 	  <property name="fill">True</property>
 	</packing>
       </child>
-
-      <child>
-	<widget class="GtkVBox" id="vbox54">
-	  <property name="visible">True</property>
-	  <property name="homogeneous">False</property>
-	  <property name="spacing">0</property>
-
-	  <child>
-	    <widget class="GtkHBox" id="hbox33">
-	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">6</property>
-
-	      <child>
-		<widget class="GtkLabel" id="label62">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">_Deploy target:</property>
-		  <property name="use_underline">True</property>
-		  <property name="use_markup">False</property>
-		  <property name="justify">GTK_JUSTIFY_LEFT</property>
-		  <property name="wrap">False</property>
-		  <property name="selectable">False</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xpad">0</property>
-		  <property name="ypad">0</property>
-		  <property name="mnemonic_widget">entry2</property>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkEntry" id="entry2">
-		  <property name="visible">True</property>
-		  <property name="can_focus">True</property>
-		  <property name="editable">True</property>
-		  <property name="visibility">True</property>
-		  <property name="max_length">0</property>
-		  <property name="text" translatable="yes"></property>
-		  <property name="has_frame">True</property>
-		  <property name="invisible_char" translatable="yes">*</property>
-		  <property name="activates_default">False</property>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">True</property>
-		  <property name="fill">True</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkButton" id="button1">
-		  <property name="visible">True</property>
-		  <property name="can_focus">True</property>
-		  <property name="label" translatable="yes">...</property>
-		  <property name="use_underline">True</property>
-		  <property name="relief">GTK_RELIEF_NORMAL</property>
-		</widget>
-		<packing>
-		  <property name="padding">0</property>
-		  <property name="expand">False</property>
-		  <property name="fill">False</property>
-		</packing>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">True</property>
-	      <property name="fill">True</property>
-	    </packing>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">False</property>
-	</packing>
-      </child>
     </widget>
   </child>
 </widget>

Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/ProjectOptions/DeployFileOptions.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/ProjectOptions/DeployFileOptions.cs	2004-02-22 05:46:13 UTC (rev 983)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/OptionPanels/ProjectOptions/DeployFileOptions.cs	2004-02-22 06:21:58 UTC (rev 984)
@@ -13,116 +13,205 @@
 
 using ICSharpCode.SharpDevelop.Internal.Project;
 using ICSharpCode.Core.Properties;
-
 using ICSharpCode.Core.Services;
 using ICSharpCode.Core.AddIns.Codons;
+using ICSharpCode.SharpDevelop.Gui.Components;
 
+using Gtk;
+using MonoDevelop.Gui.Widgets;
+
 namespace ICSharpCode.SharpDevelop.Gui.Dialogs.OptionPanels
-{/*
+{
 	/// <summary>
 	/// Summary description for Form3.
 	/// </summary>
 	public class DeployFileProjectOptions : AbstractOptionPanel
 	{
-		IProject project;
-		ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
-		static FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
-		
-		public override void LoadPanelContents()
+
+		// FIXME 
+		// - internationalize 
+		// 	   SetupFromXml(Path.Combine(PropertyService.DataDirectory, 
+		// 			                          @"resources\panels\DeployFileOptions.xfrm"));
+
+		class DeployFileOptionsWidget : GladeWidgetExtract 
 		{
-			SetupFromXml(Path.Combine(PropertyService.DataDirectory, 
-			                          @"resources\panels\DeployFileOptions.xfrm"));
+		        // Gtk Controls
+ 			[Glade.Widget] RadioButton projectFileRadioButton;
+ 			[Glade.Widget] RadioButton compiledAssemblyRadioButton;
+ 			[Glade.Widget] RadioButton scriptFileRadioButton;
+ 			[Glade.Widget] Button selectScriptFileButton;
+ 			[Glade.Widget] Button selectTargetButton;
+ 			[Glade.Widget] Entry deployTargetEntry;
+ 			[Glade.Widget] Entry deployScriptEntry;
+			[Glade.Widget] VBox deployScriptBox;
+			[Glade.Widget] VBox deployTargetBox;
+			[Glade.Widget] Gtk.TreeView includeTreeView;
+			public ListStore store;
+
+			// Services
+			IProject project;
+			static FileUtilityService fileUtilityService = (FileUtilityService) ServiceManager.Services.GetService(typeof(FileUtilityService));
+			StringParserService StringParserService = (StringParserService)ServiceManager.Services.GetService (typeof (StringParserService));
+			public DeployFileOptionsWidget (IProperties CustomizationObject) : 
+				base ("Base.glade", "DeployFileOptionsPanel")
+			{
+				this.project = (IProject)((IProperties)CustomizationObject).GetProperty("Project");
+
+  				projectFileRadioButton.Clicked += new EventHandler(RadioButtonClicked);
+  				compiledAssemblyRadioButton.Clicked += new EventHandler(RadioButtonClicked);
+  				scriptFileRadioButton.Clicked += new EventHandler(RadioButtonClicked);
+				selectScriptFileButton.Clicked += new EventHandler(SelectScriptFileEvent);
+				selectTargetButton.Clicked += new EventHandler(SelectTargetFolderEvent);
+
+				store = new ListStore (typeof(bool), typeof(string));
+				includeTreeView.Selection.Mode = SelectionMode.None;
+				includeTreeView.Model = store;
+				CellRendererToggle rendererToggle = new CellRendererToggle ();
+				rendererToggle.Activatable = true;
+				rendererToggle.Toggled += new ToggledHandler (ItemToggled);
+				includeTreeView.AppendColumn ("Choosen", rendererToggle, "active", 0);
+				includeTreeView.AppendColumn ("Name", new CellRendererText (), "text", 1);
+				TreeIter iter = new TreeIter ();
+				
+				foreach (ProjectFile info in project.ProjectFiles) {
+					if (info.BuildAction != BuildAction.Exclude) {
+						string name = fileUtilityService.AbsoluteToRelativePath(project.BaseDirectory, info.Name);
+						iter = store.AppendValues (
+							project.DeployInformation.IsFileExcluded(info.Name) ? true : false, name);
+					}
+				}
+
+				deployTargetEntry.Text = project.DeployInformation.DeployTarget;
+				deployScriptEntry.Text = project.DeployInformation.DeployScript;
 			
-			((RadioButton)ControlDictionary["projectFileRadioButton"]).CheckedChanged += new EventHandler(RadioButtonCheckedChange);
-			((RadioButton)ControlDictionary["compiledAssemblyRadioButton"]).CheckedChanged += new EventHandler(RadioButtonCheckedChange);
-			((RadioButton)ControlDictionary["scriptFileRadioButton"]).CheckedChanged += new EventHandler(RadioButtonCheckedChange);
-			
-			(ControlDictionary["selectScriptFileButton"]).Click += new EventHandler(SelectScriptFileEvent);
-			(ControlDictionary["selectTargetButton"]).Click += new EventHandler(SelectTargetFolderEvent);
-			
-			this.project = (IProject)((IProperties)CustomizationObject).GetProperty("Project");
-			FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
-			foreach (ProjectFile info in project.ProjectFiles) {
-				if (info.BuildAction != BuildAction.Exclude) {
-					string name = fileUtilityService.AbsoluteToRelativePath(project.BaseDirectory, info.Name);
-					((CheckedListBox)ControlDictionary["projectFilesCheckedListBox"]).Items.Add(name, project.DeployInformation.IsFileExcluded(info.Name) ? CheckState.Unchecked : CheckState.Checked);
-			    }
+				projectFileRadioButton.Active = project.DeployInformation.DeploymentStrategy == DeploymentStrategy.File;
+				compiledAssemblyRadioButton.Active = project.DeployInformation.DeploymentStrategy == DeploymentStrategy.Assembly;
+				scriptFileRadioButton.Active = project.DeployInformation.DeploymentStrategy == DeploymentStrategy.Script;
+				
+				RadioButtonClicked(null, null);
 			}
-			
-			ControlDictionary["deployTargetTextBox"].Text = project.DeployInformation.DeployTarget;
-			ControlDictionary["deployScriptTextBox"].Text = project.DeployInformation.DeployScript;
-			
-			((RadioButton)ControlDictionary["projectFileRadioButton"]).Checked = project.DeployInformation.DeploymentStrategy == DeploymentStrategy.File;
-			((RadioButton)ControlDictionary["compiledAssemblyRadioButton"]).Checked = project.DeployInformation.DeploymentStrategy == DeploymentStrategy.Assembly;
-			((RadioButton)ControlDictionary["scriptFileRadioButton"]).Checked = project.DeployInformation.DeploymentStrategy == DeploymentStrategy.Script;
-			
-			RadioButtonCheckedChange(null, null);
-		}
-		
-		public override bool StorePanelContents()
-		{
-			if (ControlDictionary["deployTargetTextBox"].Text.Length > 0) {
-				if (!FileUtilityService.IsValidFileName(ControlDictionary["deployTargetTextBox"].Text)) {
-					MessageService.ShowError("Invalid deploy target specified");
-					return false;
+
+			//FIXME : Finish details in this dialog.
+			void SelectScriptFileEvent(object sender, EventArgs e)
+			{
+				FileSelection fs = new FileSelection ("Select your File"); // Put correct title 
+				fs.Complete("*.txt");
+//				 fs.Complete(StringParserService.Parse("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe;*.com;*.pif;*.bat;*.cmd|${res:SharpDevelop.FileFilter.AllFiles}|*.*"));
+// 				fdiag.Filter = StringParserService.Parse("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe;*.com;*.pif;*.bat;*.cmd|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
+				if ( fs.Run () == (int) ResponseType.Ok) {
+ 					deployScriptEntry.Text = fs.SelectionEntry.Text;
 				}
+				fs.Hide (); 
 			}
 			
-			if (ControlDictionary["deployScriptTextBox"].Text.Length > 0) {
-				if (!FileUtilityService.IsValidFileName(ControlDictionary["deployScriptTextBox"].Text)) {
-					MessageService.ShowError("Invalid deploy script specified");
-					return false;
+			void SelectTargetFolderEvent(object sender, EventArgs e)
+			{
+				FileSelection fs = new FileSelection ("${res:Dialog.Options.PrjOptions.DeployFile.FolderDialogDescription}"); 
+				if ( fs.Run () == (int) ResponseType.Ok) {
+					deployTargetEntry.Text = fs.SelectionEntry.Text;
 				}
-				if (!File.Exists(ControlDictionary["deployScriptTextBox"].Text)) {
-					MessageService.ShowError("Deploy script doesn't exists");
-					return false;
-				}
+				fs.Hide (); 
 			}
 			
-			project.DeployInformation.DeployTarget = ControlDictionary["deployTargetTextBox"].Text;
-			project.DeployInformation.DeployScript = ControlDictionary["deployScriptTextBox"].Text;
+			void RadioButtonClicked(object sender, EventArgs e)
+			{
+ 				deployTargetBox.Sensitive = compiledAssemblyRadioButton.Active || projectFileRadioButton.Active;
+  				deployScriptEntry.Sensitive = scriptFileRadioButton.Active;
+  				selectScriptFileButton.Sensitive = scriptFileRadioButton.Active;
+			}
 			
-			if (((RadioButton)ControlDictionary["projectFileRadioButton"]).Checked) {
-				project.DeployInformation.DeploymentStrategy = DeploymentStrategy.File;
-			} else if (((RadioButton)ControlDictionary["compiledAssemblyRadioButton"]).Checked) {
-				project.DeployInformation.DeploymentStrategy = DeploymentStrategy.Assembly;
-			} else {
-				project.DeployInformation.DeploymentStrategy = DeploymentStrategy.Script;
+			private void ItemToggled (object o, ToggledArgs args)
+			{
+ 				const int column = 0;
+ 				Gtk.TreeIter iter;
+				
+				if (store.GetIterFromString(out iter, args.Path)) {
+ 					bool val = (bool) store.GetValue(iter, column);
+ 					store.SetValue(iter, column, !val);
+ 				}
 			}
 			
-			project.DeployInformation.ClearExcludedFiles();
-			for (int i = 0; i < ((CheckedListBox)ControlDictionary["projectFilesCheckedListBox"]).Items.Count; ++i) {
-				if (!((CheckedListBox)ControlDictionary["projectFilesCheckedListBox"]).GetItemChecked(i)) {
-					project.DeployInformation.AddExcludedFile(fileUtilityService.RelativeToAbsolutePath(project.BaseDirectory, ((CheckedListBox)ControlDictionary["projectFilesCheckedListBox"]).Items[i].ToString()));
+			public bool Store () 
+			{
+				if (deployTargetEntry.Text.Length > 0) {
+					if (!fileUtilityService.IsValidFileName(deployTargetEntry.Text)) {
+						MessageDialog dialog = new MessageDialog ((Window) WorkbenchSingleton.Workbench, 
+								DialogFlags.DestroyWithParent,
+								MessageType.Error, 
+								ButtonsType.Close, 
+								"Invalid deploy target specified");
+						dialog.Run ();
+						dialog.Hide ();
+						dialog.Dispose ();
+						return false;
+					}
 				}
-			}
-			return true;
-		}
-		
-		void SelectScriptFileEvent(object sender, EventArgs e)
-		{
-			using (OpenFileDialog fdiag  = new OpenFileDialog()) {
-				fdiag.CheckFileExists = true;
-				fdiag.Filter = StringParserService.Parse("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe;*.com;*.pif;*.bat;*.cmd|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
 				
-				if (fdiag.ShowDialog() == DialogResult.OK) {
-					ControlDictionary["deployScriptTextBox"].Text = fdiag.FileName;
+				if (deployScriptEntry.Text.Length > 0) {
+					if (!fileUtilityService.IsValidFileName(deployScriptEntry.Text)) {
+						MessageDialog dialog = new MessageDialog ((Window) WorkbenchSingleton.Workbench, 
+								DialogFlags.DestroyWithParent,
+								MessageType.Error, 
+								ButtonsType.Close, 
+								"Invalid deploy script specified");
+						dialog.Run ();
+						dialog.Hide ();
+						dialog.Dispose ();
+						return false;				
+					}
 				}
+				
+				if (!File.Exists(deployScriptEntry.Text)) {
+					MessageDialog dialog = new MessageDialog ((Window) WorkbenchSingleton.Workbench, 
+							DialogFlags.DestroyWithParent,
+							MessageType.Error, 
+							ButtonsType.Close, 
+							"Deploy script doesn't exists");
+					dialog.Run ();
+					dialog.Hide ();
+					dialog.Dispose ();
+					return false;
+ 				}
+			
+ 			project.DeployInformation.DeployTarget = deployTargetEntry.Text;
+ 			project.DeployInformation.DeployScript = deployScriptEntry.Text;
+			
+ 			if (projectFileRadioButton.Active) {
+ 				project.DeployInformation.DeploymentStrategy = DeploymentStrategy.File;
+ 			} else if (compiledAssemblyRadioButton.Active) {
+ 				project.DeployInformation.DeploymentStrategy = DeploymentStrategy.Assembly;
+ 			} else {
+ 				project.DeployInformation.DeploymentStrategy = DeploymentStrategy.Script;
+ 			}
+
+			TreeIter first;	
+			store.GetIterFirst(out first);
+			TreeIter current = first;
+ 			project.DeployInformation.ClearExcludedFiles();
+			for (int i = 0; i < store.IterNChildren() ; ++i) {
+				if ( (bool) store.GetValue(current, 0)){
+					project.DeployInformation.AddExcludedFile(fileUtilityService.RelativeToAbsolutePath(
+											  project.BaseDirectory, 
+											  (string) store.GetValue(current, 1)));
+							}
+				store.IterNext(out current);
 			}
+			return true;
+			}
 		}
 		
-		void SelectTargetFolderEvent(object sender, EventArgs e)
+		DeployFileOptionsWidget widget;
+		ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
+		
+		public override void LoadPanelContents()
 		{
-			FolderDialog fdiag = new  FolderDialog();
-			if (fdiag.DisplayDialog("${res:Dialog.Options.PrjOptions.DeployFile.FolderDialogDescription}") == DialogResult.OK) {
-				ControlDictionary["deployTargetTextBox"].Text = fdiag.Path;
-			}
+			Add (widget = new  DeployFileOptionsWidget ((IProperties) CustomizationObject));
 		}
 		
-		void RadioButtonCheckedChange(object sender, EventArgs e)
+		public override bool StorePanelContents()
 		{
-			ControlDictionary["deployTargetTextBox"].Enabled = ControlDictionary["selectTargetButton"].Enabled = ((RadioButton)ControlDictionary["projectFileRadioButton"]).Checked || ((RadioButton)ControlDictionary["compiledAssemblyRadioButton"]).Checked;
-			ControlDictionary["deployScriptTextBox"].Enabled = ControlDictionary["selectScriptFileButton"].Enabled = ((RadioButton)ControlDictionary["scriptFileRadioButton"]).Checked;
+			bool success = widget.Store();
+ 			return success;
 		}
-	}*/
+	}
 }




More information about the Monodevelop-patches-list mailing list