[mono/monodevelop] [2 commits] a6a718e8: Cleanup ChangeLogAddIn

"Ungureanu Marius ([email protected])" <[email protected]> Mon, 4 Nov 2013 15:48:48 +0000
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <0000014223cd559a-fba6c208-43f0-4f60-b41f-38f51d8df1cc-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/07b3ba554ed5...2e9a17e32533

   Commit: a6a718e8ee3f94ddd40b8b30941b97e233f99289
   Author: Ungureanu Marius <[email protected]> (Therzok)
     Date: 2013-11-02 11:21:51 GMT
      URL: https://github.com/mono/monodevelop/commit/a6a718e8ee3f94ddd40b8b30941b97e233f99289

Cleanup ChangeLogAddIn

Changed paths:
  M main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs
  M main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs
  M main/src/addins/ChangeLogAddIn/ChangeLogService.cs
  M main/src/addins/ChangeLogAddIn/CommitDialogExtensionWidget.cs
  M main/src/addins/ChangeLogAddIn/OldChangeLogData.cs
  M main/src/addins/ChangeLogAddIn/ProjectOptionPanel.cs
  M main/src/addins/ChangeLogAddIn/ProjectOptionPanelWidget.cs

Modified: main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs
===================================================================
@@ -33,12 +33,12 @@
 
 namespace MonoDevelop.ChangeLogAddIn
 {
-	internal partial class AddLogEntryDialog : Gtk.Dialog
+	partial class AddLogEntryDialog : Dialog
 	{
-		ListStore store;
-		Dictionary<ChangeLogEntry,string> changes = new Dictionary<ChangeLogEntry,string> ();
-		TextMark editMark;
-		TextTag oldTextTag;
+		readonly ListStore store;
+		readonly Dictionary<ChangeLogEntry, string> changes = new Dictionary<ChangeLogEntry, string> ();
+		readonly TextMark editMark;
+		readonly TextTag oldTextTag;
 		bool loading;
 		
 		public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries)
@@ -52,8 +52,8 @@ public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries)
 			Pango.TabArray tabs = new Pango.TabArray (1, true);
 			tabs.SetTab (0, Pango.TabAlign.Left, GetStringWidth (" ") * 4);
 			textview.Tabs = tabs;
-			textview.SizeRequested += delegate (object o, SizeRequestedArgs args) {
-				textview.WidthRequest = GetStringWidth (string.Empty.PadRight (80));
+			textview.SizeRequested += delegate {
+				textview.WidthRequest = GetStringWidth (String.Empty.PadRight (80));
 			};
 			font.Dispose ();
 			
@@ -66,9 +66,9 @@ public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries)
 			foreach (ChangeLogEntry ce in entries.Values) {
 				Gdk.Pixbuf pic;
 				if (ce.CantGenerate)
-					pic = ImageService.GetPixbuf (Gtk.Stock.DialogWarning, Gtk.IconSize.Menu);
+					pic = ImageService.GetPixbuf (Stock.DialogWarning, IconSize.Menu);
 				else if (ce.IsNew)
-					pic = ImageService.GetPixbuf (Gtk.Stock.New, Gtk.IconSize.Menu);
+					pic = ImageService.GetPixbuf (Stock.New, IconSize.Menu);
 				else
 					pic = null;
 				store.AppendValues (ce, pic, ce.File);
@@ -78,7 +78,7 @@ public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries)
 			TreeIter it;
 			
 			editMark = textview.Buffer.CreateMark (null, textview.Buffer.EndIter, false);
-			oldTextTag = new Gtk.TextTag ("readonly");
+			oldTextTag = new TextTag ("readonly");
 			oldTextTag.Foreground = "gray";
 			oldTextTag.Editable = false;
 			textview.Buffer.TagTable.Add (oldTextTag);
@@ -87,10 +87,10 @@ public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries)
 				fileList.Selection.SelectIter (it);
 		}
 		
-		private int GetStringWidth (string str)
+		int GetStringWidth (string str)
 		{
 			int width, height;
-			Pango.Layout layout = new Pango.Layout (textview.PangoContext);
+			var layout = new Pango.Layout (textview.PangoContext);
 			layout.SetText (str);
 			layout.GetPixelSize (out width, out height);
 			layout.Dispose ();
@@ -105,7 +105,7 @@ public void OnSelectionChanged (object s, EventArgs a)
 				textview.Sensitive = false;
 			} else {
 				textview.Sensitive = true;
-				ChangeLogEntry ce = (ChangeLogEntry) store.GetValue (it, 0);
+				var ce = (ChangeLogEntry) store.GetValue (it, 0);
 				boxNewFile.Visible = ce.IsNew && !ce.CantGenerate;
 				boxNoFile.Visible = ce.CantGenerate;
 				loading = true;
@@ -132,7 +132,7 @@ public void OnTextChanged (object s, EventArgs a)
 			TreeIter it;
 			if (!fileList.Selection.GetSelected (out it))
 				return;
-			ChangeLogEntry ce = (ChangeLogEntry) store.GetValue (it, 0);
+			var ce = (ChangeLogEntry) store.GetValue (it, 0);
 			changes [ce] = textview.Buffer.GetText (textview.Buffer.StartIter, textview.Buffer.GetIterAtMark (editMark), true);
 		}
 		

Modified: main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs
===================================================================
@@ -64,23 +64,21 @@ protected override void Update(CommandInfo info)
 				info.Enabled = false;
 		}
 
-		private string GetSelectedFile()
+		static string GetSelectedFile()
 		{
 			if (IdeApp.Workbench.ActiveDocument != null) {
 				string fn = IdeApp.Workbench.ActiveDocument.FileName;
 				if (fn != null && Path.GetFileName (fn) != "ChangeLog")
 					return fn;
 			}
-			ProjectFile file = IdeApp.ProjectOperations.CurrentSelectedItem as ProjectFile;
+			var file = IdeApp.ProjectOperations.CurrentSelectedItem as ProjectFile;
 			if (file != null)
 				return file.FilePath;
-			SystemFile sf = IdeApp.ProjectOperations.CurrentSelectedItem as SystemFile;
-			if (sf != null)
-				return sf.Path;
-			return null;
+			var sf = IdeApp.ProjectOperations.CurrentSelectedItem as SystemFile;
+			return sf != null ? sf.Path : null;
 		}
 		
-		private void InsertEntry(Document document)
+		static void InsertEntry(Document document)
 		{
 			IEditableTextBuffer textBuffer = document.GetContent<IEditableTextBuffer>();					
 			if (textBuffer == null) return;
@@ -92,7 +90,7 @@ private void InsertEntry(Document document)
 			string eol = document.Editor != null ? document.Editor.EolMarker : Environment.NewLine;
 			
 			int pos = GetHeaderEndPosition (document);
-			if (pos > 0 && selectedFileNameDirectory.StartsWith(changeLogFileNameDirectory)) {
+			if (pos > 0 && selectedFileNameDirectory.StartsWith (changeLogFileNameDirectory, StringComparison.Ordinal)) {
 				string text = "\t* " 
 					+ selectedFileName.Substring(changeLogFileNameDirectory.Length + 1) + ": "
 					+ eol + eol;
@@ -107,7 +105,7 @@ private void InsertEntry(Document document)
 			}
 		}
 		
-		private bool InsertHeader (Document document)
+		static bool InsertHeader (Document document)
 		{
 			IEditableTextBuffer textBuffer = document.GetContent<IEditableTextBuffer>();					
 			if (textBuffer == null) return false;
@@ -133,7 +131,7 @@ private bool InsertHeader (Document document)
 			return true;
 		}
         
-		private int GetHeaderEndPosition(Document document)
+		static int GetHeaderEndPosition(Document document)
 		{
 			IEditableTextBuffer textBuffer = document.GetContent<IEditableTextBuffer>();					
 			if (textBuffer == null) return 0;
@@ -143,10 +141,10 @@ private int GetHeaderEndPosition(Document document)
 			string text = textBuffer.GetText (0, Math.Min (textBuffer.Length, 1023));
 			string eol = document.Editor != null ? document.Editor.EolMarker : Environment.NewLine;
 			
-			return text.IndexOf (eol + eol);
+			return text.IndexOf (eol + eol, StringComparison.Ordinal);
 		}
         
-		private Document GetActiveChangeLogDocument()
+		static Document GetActiveChangeLogDocument()
 		{
 			string file = GetSelectedFile ();
 			if (file == null)

Modified: main/src/addins/ChangeLogAddIn/ChangeLogService.cs
===================================================================
@@ -115,11 +115,7 @@ public static string GetChangeLogForFile (string baseCommitPath, string file)
 		
 		public static CommitMessageStyle GetMessageStyle (SolutionItem item)
 		{
-			ChangeLogPolicy policy;
-			if (item != null)
-				policy = GetPolicy (item);
-			else
-				policy = new ChangeLogPolicy ();
+			ChangeLogPolicy policy = item != null ? GetPolicy (item) : new ChangeLogPolicy ();
 			return policy.MessageStyle;
 		}
 		

Modified: main/src/addins/ChangeLogAddIn/CommitDialogExtensionWidget.cs
===================================================================
@@ -32,7 +32,6 @@
 using MonoDevelop.VersionControl;
 using MonoDevelop.Core;
 using MonoDevelop.Projects.Text;
-using MonoDevelop.Ide.Gui;
 using MonoDevelop.Ide;
 using MonoDevelop.Projects;
 
@@ -40,10 +39,10 @@ namespace MonoDevelop.ChangeLogAddIn
 {
 	public class CommitDialogExtensionWidget: CommitDialogExtension
 	{
-		HBox box = new HBox ();
-		VBox vbox = new VBox ();
-		Button logButton;
-		Button optionsButton;
+		readonly HBox box = new HBox ();
+		readonly VBox vbox = new VBox ();
+		readonly Button logButton;
+		readonly Button optionsButton;
 		ChangeSet cset;
 		Label msgLabel;
 		Label pathLabel;
@@ -65,18 +64,18 @@ public CommitDialogExtensionWidget()
 			optionsButton = new Button (GettextCatalog.GetString ("Options..."));
 			optionsButton.Clicked += OnClickOptions;
 			
-			VBox aux = new VBox ();
+			var aux = new VBox ();
 			box.PackStart (aux, false, false, 3);
-			HBox haux = new HBox ();
+			var haux = new HBox ();
 			haux.Spacing = 6;
 			aux.PackStart (haux, false, false, 0);
 			haux.PackStart (logButton, false, false, 0);
 			haux.PackStart (optionsButton, false, false, 0);
 		}
 		
-		public override bool Initialize (ChangeSet cset)
+		public override bool Initialize (ChangeSet changeSet)
 		{	
-			this.cset = cset;
+			cset = changeSet;
 			msgLabel = new Label ();
 			pathLabel = new Label ();
 			msgLabel.Xalign = 0;
@@ -227,7 +226,7 @@ void GenerateLogEntries ()
 			requireComment = false;
 			
 			foreach (ChangeSetItem item in cset.Items) {
-				MonoDevelop.Projects.SolutionItem parentItem;
+				SolutionItem parentItem;
 				ChangeLogPolicy policy;
 				string logf = ChangeLogService.GetChangeLogForFile (cset.BaseLocalPath, item.LocalPath,
 				                                                    out parentItem, out policy);
@@ -246,8 +245,7 @@ void GenerateLogEntries ()
 				
 				if (string.IsNullOrEmpty (item.Comment) && !item.IsDirectory) {
 					uncommentedCount++;
-					if (policy != null && policy.VcsIntegration == VcsIntegration.RequireEntry)
-						requireComment = true;
+					requireComment |= policy != null && policy.VcsIntegration == VcsIntegration.RequireEntry;
 				}
 				
 				ChangeLogEntry entry;
@@ -260,15 +258,14 @@ void GenerateLogEntries ()
 					if (cantGenerate)
 						unknownFileCount++;
 				
-					if (!File.Exists (logf))
-						entry.IsNew = true;
+					entry.IsNew |= !File.Exists (logf);
 				
 					entries [logf] = entry;
 				}
 				entry.Items.Add (item);
 			}
 			
-			CommitMessageFormat format = new CommitMessageFormat ();
+			var format = new CommitMessageFormat ();
 			format.TabsAsSpaces = false;
 			format.TabWidth = 8;
 			format.MaxColumns = 70;
@@ -283,19 +280,19 @@ void GenerateLogEntries ()
 		void OnClickButton (object s, EventArgs args)
 		{
 			if (notConfigured) {
-				IdeApp.Workbench.ShowGlobalPreferencesDialog (Toplevel as Gtk.Window, "GeneralAuthorInfo");
+				IdeApp.Workbench.ShowGlobalPreferencesDialog (Toplevel as Window, "GeneralAuthorInfo");
 				UpdateStatus ();
 				GenerateLogEntries ();
 				return;
 			}
 			
 			var dlg = new AddLogEntryDialog (entries);
-			MessageService.ShowCustomDialog (dlg, (Gtk.Window) Toplevel);
+			MessageService.ShowCustomDialog (dlg, (Window) Toplevel);
 		}
 		
 		void OnClickOptions (object s, EventArgs args)
 		{
-			IdeApp.Workbench.ShowGlobalPreferencesDialog (Toplevel as Gtk.Window, "GeneralAuthorInfo");
+			IdeApp.Workbench.ShowGlobalPreferencesDialog (Toplevel as Window, "GeneralAuthorInfo");
 			UpdateStatus ();
 			GenerateLogEntries ();
 		}

Modified: main/src/addins/ChangeLogAddIn/OldChangeLogData.cs
===================================================================
@@ -35,7 +35,7 @@ namespace MonoDevelop.ChangeLogAddIn
 	class OldChangeLogData
 	{
 		[ItemProperty]
-		ChangeLogPolicyEnum policy = ChangeLogPolicyEnum.UseParentPolicy;
+		readonly ChangeLogPolicyEnum policy = ChangeLogPolicyEnum.UseParentPolicy;
 		
 		OldChangeLogData ()
 		{
@@ -55,7 +55,7 @@ public static void Migrate (SolutionItem entry)
 			if (entry.ParentFolder != null)
 				Migrate (entry.ParentFolder);
 			
-			OldChangeLogData data = entry.ExtendedProperties ["MonoDevelop.ChangeLogAddIn.ChangeLogInfo"] as OldChangeLogData;
+			var data = entry.ExtendedProperties ["MonoDevelop.ChangeLogAddIn.ChangeLogInfo"] as OldChangeLogData;
 			if (data == null)
 				return;
 			

Modified: main/src/addins/ChangeLogAddIn/ProjectOptionPanel.cs
===================================================================
@@ -43,11 +43,14 @@ public override Widget CreatePanelWidget ()
 		
 		public override void Initialize (OptionsDialog dialog, object dataObject)
 		{
-			if (dataObject is SolutionItem)
-				OldChangeLogData.Migrate ((SolutionItem)dataObject);
-			else if (dataObject is Solution)
-				OldChangeLogData.Migrate (((Solution)dataObject).RootFolder);
-			
+			var solutionItem = dataObject as SolutionItem;
+			if (solutionItem != null)
+				OldChangeLogData.Migrate (solutionItem);
+			else {
+				var solution = dataObject as Solution;
+				if (solution != null)
+					OldChangeLogData.Migrate (solution.RootFolder);
+			}
 			base.Initialize (dialog, dataObject);
 		}
 		

Modified: main/src/addins/ChangeLogAddIn/ProjectOptionPanelWidget.cs
===================================================================
@@ -25,16 +25,14 @@
 //
 //
 
-using System;
 using MonoDevelop.Projects;
 using MonoDevelop.VersionControl;
-using MonoDevelop.Ide;
 
 namespace MonoDevelop.ChangeLogAddIn
 {	
 	partial class ProjectOptionPanelWidget : Gtk.Bin
 	{
-		ProjectOptionPanel parent;
+		readonly ProjectOptionPanel parent;
 		CommitMessageStyle style;
 		
 		public ProjectOptionPanelWidget (ProjectOptionPanel parent)
@@ -60,13 +58,13 @@ public void LoadFrom (ChangeLogPolicy policy)
 				break;
 			}
 			
-			this.checkVersionControl.Active = policy.VcsIntegration != VcsIntegration.None;
-			this.checkRequireOnCommit.Active = policy.VcsIntegration == VcsIntegration.RequireEntry;
+			checkVersionControl.Active = policy.VcsIntegration != VcsIntegration.None;
+			checkRequireOnCommit.Active = policy.VcsIntegration == VcsIntegration.RequireEntry;
 			
 			style = new CommitMessageStyle ();
 			style.CopyFrom (policy.MessageStyle);
 			
-			CommitMessageFormat format = new CommitMessageFormat ();
+			var format = new CommitMessageFormat ();
 			format.MaxColumns = 70;
 			format.Style = style;
 			

   Commit: 2e9a17e32533e9795673ed065c73b39a508324c0
   Author: Ungureanu Marius <[email protected]> (Therzok)
     Date: 2013-11-04 15:46:07 GMT
      URL: https://github.com/mono/monodevelop/commit/2e9a17e32533e9795673ed065c73b39a508324c0

Merge pull request #427 from mono/cleanupChangelog

Cleanup ChangeLogAddIn

Changed paths:
  M main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs
  M main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs
  M main/src/addins/ChangeLogAddIn/ChangeLogService.cs
  M main/src/addins/ChangeLogAddIn/CommitDialogExtensionWidget.cs
  M main/src/addins/ChangeLogAddIn/OldChangeLogData.cs
  M main/src/addins/ChangeLogAddIn/ProjectOptionPanel.cs
  M main/src/addins/ChangeLogAddIn/ProjectOptionPanelWidget.cs

Modified: main/src/addins/ChangeLogAddIn/AddLogEntryDialog.cs
===================================================================
@@ -33,12 +33,12 @@
 
 namespace MonoDevelop.ChangeLogAddIn
 {
-	internal partial class AddLogEntryDialog : Gtk.Dialog
+	partial class AddLogEntryDialog : Dialog
 	{
-		ListStore store;
-		Dictionary<ChangeLogEntry,string> changes = new Dictionary<ChangeLogEntry,string> ();
-		TextMark editMark;
-		TextTag oldTextTag;
+		readonly ListStore store;
+		readonly Dictionary<ChangeLogEntry, string> changes = new Dictionary<ChangeLogEntry, string> ();
+		readonly TextMark editMark;
+		readonly TextTag oldTextTag;
 		bool loading;
 		
 		public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries)
@@ -52,8 +52,8 @@ public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries)
 			Pango.TabArray tabs = new Pango.TabArray (1, true);
 			tabs.SetTab (0, Pango.TabAlign.Left, GetStringWidth (" ") * 4);
 			textview.Tabs = tabs;
-			textview.SizeRequested += delegate (object o, SizeRequestedArgs args) {
-				textview.WidthRequest = GetStringWidth (string.Empty.PadRight (80));
+			textview.SizeRequested += delegate {
+				textview.WidthRequest = GetStringWidth (String.Empty.PadRight (80));
 			};
 			font.Dispose ();
 			
@@ -66,9 +66,9 @@ public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries)
 			foreach (ChangeLogEntry ce in entries.Values) {
 				Gdk.Pixbuf pic;
 				if (ce.CantGenerate)
-					pic = ImageService.GetPixbuf (Gtk.Stock.DialogWarning, Gtk.IconSize.Menu);
+					pic = ImageService.GetPixbuf (Stock.DialogWarning, IconSize.Menu);
 				else if (ce.IsNew)
-					pic = ImageService.GetPixbuf (Gtk.Stock.New, Gtk.IconSize.Menu);
+					pic = ImageService.GetPixbuf (Stock.New, IconSize.Menu);
 				else
 					pic = null;
 				store.AppendValues (ce, pic, ce.File);
@@ -78,7 +78,7 @@ public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries)
 			TreeIter it;
 			
 			editMark = textview.Buffer.CreateMark (null, textview.Buffer.EndIter, false);
-			oldTextTag = new Gtk.TextTag ("readonly");
+			oldTextTag = new TextTag ("readonly");
 			oldTextTag.Foreground = "gray";
 			oldTextTag.Editable = false;
 			textview.Buffer.TagTable.Add (oldTextTag);
@@ -87,10 +87,10 @@ public AddLogEntryDialog (Dictionary<string,ChangeLogEntry> entries)
 				fileList.Selection.SelectIter (it);
 		}
 		
-		private int GetStringWidth (string str)
+		int GetStringWidth (string str)
 		{
 			int width, height;
-			Pango.Layout layout = new Pango.Layout (textview.PangoContext);
+			var layout = new Pango.Layout (textview.PangoContext);
 			layout.SetText (str);
 			layout.GetPixelSize (out width, out height);
 			layout.Dispose ();
@@ -105,7 +105,7 @@ public void OnSelectionChanged (object s, EventArgs a)
 				textview.Sensitive = false;
 			} else {
 				textview.Sensitive = true;
-				ChangeLogEntry ce = (ChangeLogEntry) store.GetValue (it, 0);
+				var ce = (ChangeLogEntry) store.GetValue (it, 0);
 				boxNewFile.Visible = ce.IsNew && !ce.CantGenerate;
 				boxNoFile.Visible = ce.CantGenerate;
 				loading = true;
@@ -132,7 +132,7 @@ public void OnTextChanged (object s, EventArgs a)
 			TreeIter it;
 			if (!fileList.Selection.GetSelected (out it))
 				return;
-			ChangeLogEntry ce = (ChangeLogEntry) store.GetValue (it, 0);
+			var ce = (ChangeLogEntry) store.GetValue (it, 0);
 			changes [ce] = textview.Buffer.GetText (textview.Buffer.StartIter, textview.Buffer.GetIterAtMark (editMark), true);
 		}
 		

Modified: main/src/addins/ChangeLogAddIn/ChangeLogAddIn.cs
===================================================================
@@ -64,23 +64,21 @@ protected override void Update(CommandInfo info)
 				info.Enabled = false;
 		}
 
-		private string GetSelectedFile()
+		static string GetSelectedFile()
 		{
 			if (IdeApp.Workbench.ActiveDocument != null) {
 				string fn = IdeApp.Workbench.ActiveDocument.FileName;
 				if (fn != null && Path.GetFileName (fn) != "ChangeLog")
 					return fn;
 			}
-			ProjectFile file = IdeApp.ProjectOperations.CurrentSelectedItem as ProjectFile;
+			var file = IdeApp.ProjectOperations.CurrentSelectedItem as ProjectFile;
 			if (file != null)
 				return file.FilePath;
-			SystemFile sf = IdeApp.ProjectOperations.CurrentSelectedItem as SystemFile;
-			if (sf != null)
-				return sf.Path;
-			return null;
+			var sf = IdeApp.ProjectOperations.CurrentSelectedItem as SystemFile;
+			return sf != null ? sf.Path : null;
 		}
 		
-		private void InsertEntry(Document document)
+		static void InsertEntry(Document document)
 		{
 			IEditableTextBuffer textBuffer = document.GetContent<IEditableTextBuffer>();					
 			if (textBuffer == null) return;
@@ -92,7 +90,7 @@ private void InsertEntry(Document document)
 			string eol = document.Editor != null ? document.Editor.EolMarker : Environment.NewLine;
 			
 			int pos = GetHeaderEndPosition (document);
-			if (pos > 0 && selectedFileNameDirectory.StartsWith(changeLogFileNameDirectory)) {
+			if (pos > 0 && selectedFileNameDirectory.StartsWith (changeLogFileNameDirectory, StringComparison.Ordinal)) {
 				string text = "\t* " 
 					+ selectedFileName.Substring(changeLogFileNameDirectory.Length + 1) + ": "
 					+ eol + eol;
@@ -107,7 +105,7 @@ private void InsertEntry(Document document)
 			}
 		}
 		
-		private bool InsertHeader (Document document)
+		static bool InsertHeader (Document document)
 		{
 			IEditableTextBuffer textBuffer = document.GetContent<IEditableTextBuffer>();					
 			if (textBuffer == null) return false;
@@ -133,7 +131,7 @@ private bool InsertHeader (Document document)
 			return true;
 		}
         
-		private int GetHeaderEndPosition(Document document)
+		static int GetHeaderEndPosition(Document document)
 		{
 			IEditableTextBuffer textBuffer = document.GetContent<IEditableTextBuffer>();					
 			if (textBuffer == null) return 0;
@@ -143,10 +141,10 @@ private int GetHeaderEndPosition(Document document)
 			string text = textBuffer.GetText (0, Math.Min (textBuffer.Length, 1023));
 			string eol = document.Editor != null ? document.Editor.EolMarker : Environment.NewLine;
 			
-			return text.IndexOf (eol + eol);
+			return text.IndexOf (eol + eol, StringComparison.Ordinal);
 		}
         
-		private Document GetActiveChangeLogDocument()
+		static Document GetActiveChangeLogDocument()
 		{
 			string file = GetSelectedFile ();
 			if (file == null)

Modified: main/src/addins/ChangeLogAddIn/ChangeLogService.cs
===================================================================
@@ -115,11 +115,7 @@ public static string GetChangeLogForFile (string baseCommitPath, string file)
 		
 		public static CommitMessageStyle GetMessageStyle (SolutionItem item)
 		{
-			ChangeLogPolicy policy;
-			if (item != null)
-				policy = GetPolicy (item);
-			else
-				policy = new ChangeLogPolicy ();
+			ChangeLogPolicy policy = item != null ? GetPolicy (item) : new ChangeLogPolicy ();
 			return policy.MessageStyle;
 		}
 		

Modified: main/src/addins/ChangeLogAddIn/CommitDialogExtensionWidget.cs
===================================================================
@@ -32,7 +32,6 @@
 using MonoDevelop.VersionControl;
 using MonoDevelop.Core;
 using MonoDevelop.Projects.Text;
-using MonoDevelop.Ide.Gui;
 using MonoDevelop.Ide;
 using MonoDevelop.Projects;
 
@@ -40,10 +39,10 @@ namespace MonoDevelop.ChangeLogAddIn
 {
 	public class CommitDialogExtensionWidget: CommitDialogExtension
 	{
-		HBox box = new HBox ();
-		VBox vbox = new VBox ();
-		Button logButton;
-		Button optionsButton;
+		readonly HBox box = new HBox ();
+		readonly VBox vbox = new VBox ();
+		readonly Button logButton;
+		readonly Button optionsButton;
 		ChangeSet cset;
 		Label msgLabel;
 		Label pathLabel;
@@ -65,18 +64,18 @@ public CommitDialogExtensionWidget()
 			optionsButton = new Button (GettextCatalog.GetString ("Options..."));
 			optionsButton.Clicked += OnClickOptions;
 			
-			VBox aux = new VBox ();
+			var aux = new VBox ();
 			box.PackStart (aux, false, false, 3);
-			HBox haux = new HBox ();
+			var haux = new HBox ();
 			haux.Spacing = 6;
 			aux.PackStart (haux, false, false, 0);
 			haux.PackStart (logButton, false, false, 0);
 			haux.PackStart (optionsButton, false, false, 0);
 		}
 		
-		public override bool Initialize (ChangeSet cset)
+		public override bool Initialize (ChangeSet changeSet)
 		{	
-			this.cset = cset;
+			cset = changeSet;
 			msgLabel = new Label ();
 			pathLabel = new Label ();
 			msgLabel.Xalign = 0;
@@ -227,7 +226,7 @@ void GenerateLogEntries ()
 			requireComment = false;
 			
 			foreach (ChangeSetItem item in cset.Items) {
-				MonoDevelop.Projects.SolutionItem parentItem;
+				SolutionItem parentItem;
 				ChangeLogPolicy policy;
 				string logf = ChangeLogService.GetChangeLogForFile (cset.BaseLocalPath, item.LocalPath,
 				                                                    out parentItem, out policy);
@@ -246,8 +245,7 @@ void GenerateLogEntries ()
 				
 				if (string.IsNullOrEmpty (item.Comment) && !item.IsDirectory) {
 					uncommentedCount++;
-					if (policy != null && policy.VcsIntegration == VcsIntegration.RequireEntry)
-						requireComment = true;
+					requireComment |= policy != null && policy.VcsIntegration == VcsIntegration.RequireEntry;
 				}
 				
 				ChangeLogEntry entry;
@@ -260,15 +258,14 @@ void GenerateLogEntries ()
 					if (cantGenerate)
 						unknownFileCount++;
 				
-					if (!File.Exists (logf))
-						entry.IsNew = true;
+					entry.IsNew |= !File.Exists (logf);
 				
 					entries [logf] = entry;
 				}
 				entry.Items.Add (item);
 			}
 			
-			CommitMessageFormat format = new CommitMessageFormat ();
+			var format = new CommitMessageFormat ();
 			format.TabsAsSpaces = false;
 			format.TabWidth = 8;
 			format.MaxColumns = 70;
@@ -283,19 +280,19 @@ void GenerateLogEntries ()
 		void OnClickButton (object s, EventArgs args)
 		{
 			if (notConfigured) {
-				IdeApp.Workbench.ShowGlobalPreferencesDialog (Toplevel as Gtk.Window, "GeneralAuthorInfo");
+				IdeApp.Workbench.ShowGlobalPreferencesDialog (Toplevel as Window, "GeneralAuthorInfo");
 				UpdateStatus ();
 				GenerateLogEntries ();
 				return;
 			}
 			
 			var dlg = new AddLogEntryDialog (entries);
-			MessageService.ShowCustomDialog (dlg, (Gtk.Window) Toplevel);
+			MessageService.ShowCustomDialog (dlg, (Window) Toplevel);
 		}
 		
 		void OnClickOptions (object s, EventArgs args)
 		{
-			IdeApp.Workbench.ShowGlobalPreferencesDialog (Toplevel as Gtk.Window, "GeneralAuthorInfo");
+			IdeApp.Workbench.ShowGlobalPreferencesDialog (Toplevel as Window, "GeneralAuthorInfo");
 			UpdateStatus ();
 			GenerateLogEntries ();
 		}

Modified: main/src/addins/ChangeLogAddIn/OldChangeLogData.cs
===================================================================
@@ -35,7 +35,7 @@ namespace MonoDevelop.ChangeLogAddIn
 	class OldChangeLogData
 	{
 		[ItemProperty]
-		ChangeLogPolicyEnum policy = ChangeLogPolicyEnum.UseParentPolicy;
+		readonly ChangeLogPolicyEnum policy = ChangeLogPolicyEnum.UseParentPolicy;
 		
 		OldChangeLogData ()
 		{
@@ -55,7 +55,7 @@ public static void Migrate (SolutionItem entry)
 			if (entry.ParentFolder != null)
 				Migrate (entry.ParentFolder);
 			
-			OldChangeLogData data = entry.ExtendedProperties ["MonoDevelop.ChangeLogAddIn.ChangeLogInfo"] as OldChangeLogData;
+			var data = entry.ExtendedProperties ["MonoDevelop.ChangeLogAddIn.ChangeLogInfo"] as OldChangeLogData;
 			if (data == null)
 				return;
 			

Modified: main/src/addins/ChangeLogAddIn/ProjectOptionPanel.cs
===================================================================
@@ -43,11 +43,14 @@ public override Widget CreatePanelWidget ()
 		
 		public override void Initialize (OptionsDialog dialog, object dataObject)
 		{
-			if (dataObject is SolutionItem)
-				OldChangeLogData.Migrate ((SolutionItem)dataObject);
-			else if (dataObject is Solution)
-				OldChangeLogData.Migrate (((Solution)dataObject).RootFolder);
-			
+			var solutionItem = dataObject as SolutionItem;
+			if (solutionItem != null)
+				OldChangeLogData.Migrate (solutionItem);
+			else {
+				var solution = dataObject as Solution;
+				if (solution != null)
+					OldChangeLogData.Migrate (solution.RootFolder);
+			}
 			base.Initialize (dialog, dataObject);
 		}
 		

Modified: main/src/addins/ChangeLogAddIn/ProjectOptionPanelWidget.cs
===================================================================
@@ -25,16 +25,14 @@
 //
 //
 
-using System;
 using MonoDevelop.Projects;
 using MonoDevelop.VersionControl;
-using MonoDevelop.Ide;
 
 namespace MonoDevelop.ChangeLogAddIn
 {	
 	partial class ProjectOptionPanelWidget : Gtk.Bin
 	{
-		ProjectOptionPanel parent;
+		readonly ProjectOptionPanel parent;
 		CommitMessageStyle style;
 		
 		public ProjectOptionPanelWidget (ProjectOptionPanel parent)
@@ -60,13 +58,13 @@ public void LoadFrom (ChangeLogPolicy policy)
 				break;
 			}
 			
-			this.checkVersionControl.Active = policy.VcsIntegration != VcsIntegration.None;
-			this.checkRequireOnCommit.Active = policy.VcsIntegration == VcsIntegration.RequireEntry;
+			checkVersionControl.Active = policy.VcsIntegration != VcsIntegration.None;
+			checkRequireOnCommit.Active = policy.VcsIntegration == VcsIntegration.RequireEntry;
 			
 			style = new CommitMessageStyle ();
 			style.CopyFrom (policy.MessageStyle);
 			
-			CommitMessageFormat format = new CommitMessageFormat ();
+			var format = new CommitMessageFormat ();
 			format.MaxColumns = 70;
 			format.Style = style;
 			


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches