From ff82c2ab4aaa4cb1bc7102cfad54d1046f6f76d6 Mon Sep 17 00:00:00 2001 From: Pedro Larouca Date: Wed, 21 Mar 2018 22:50:28 +0000 Subject: [PATCH] [Samples] applied fix proposal --- Source/Samples/Samples.csproj | 47 ------------------- .../Samples/Sections/Widgets/EntrySection.cs | 29 ++++++------ .../Sections/Widgets/ProgressBarSection.cs | 2 +- 3 files changed, 15 insertions(+), 63 deletions(-) diff --git a/Source/Samples/Samples.csproj b/Source/Samples/Samples.csproj index 79e9f4006..6d8640523 100644 --- a/Source/Samples/Samples.csproj +++ b/Source/Samples/Samples.csproj @@ -25,51 +25,4 @@ - - - GtkSharp.Samples.Category.cs - - - GtkSharp.Samples.ListSection.cs - - - GtkSharp.Samples.SectionAttribute.cs - - - GtkSharp.Samples.AboutDialogSection.cs - - - GtkSharp.Samples.ButtonSection.cs - - - GtkSharp.Samples.ColorButtonSection.cs - - - GtkSharp.Samples.EntrySection.cs - - - GtkSharp.Samples.LabelSection.cs - - - GtkSharp.Samples.LevelBarSection.cs - - - GtkSharp.Samples.LinkButtonSection.cs - - - GtkSharp.Samples.ProgressBarSection.cs - - - GtkSharp.Samples.SpinButtonSection.cs - - - GtkSharp.Samples.SpinnerSection.cs - - - GtkSharp.Samples.SwitchSection.cs - - - GtkSharp.Samples.ToggleButtonSection.cs - - diff --git a/Source/Samples/Sections/Widgets/EntrySection.cs b/Source/Samples/Sections/Widgets/EntrySection.cs index dbdcc7943..424f27b68 100644 --- a/Source/Samples/Sections/Widgets/EntrySection.cs +++ b/Source/Samples/Sections/Widgets/EntrySection.cs @@ -129,27 +129,26 @@ namespace Samples // lets override the default match function so we can use the contains mode // instead of the default startswith - completion.MatchFunc = EntryCompletionMatchFunc; + completion.MatchFunc = (EntryCompletion comp, string key, TreeIter iter) => + { + if (string.IsNullOrEmpty(key)) + return false; + + var o = comp.Model.GetValue(iter, 0); + var stringToSearch = o as string; + + if (!string.IsNullOrEmpty(stringToSearch)) + return stringToSearch.IndexOf(key, System.StringComparison.InvariantCultureIgnoreCase) >= 0; + + return false; + }; + completion.TextColumn = 0; return ("Completion Entry:",entry); } - private bool EntryCompletionMatchFunc(EntryCompletion completion, string key, TreeIter iter) - { - if (string.IsNullOrEmpty(key)) - return false; - - var o = completion.Model.GetValue(iter, 0); - var stringToSearch = o as string; - - if (!string.IsNullOrEmpty(stringToSearch)) - return stringToSearch.IndexOf(key, System.StringComparison.InvariantCultureIgnoreCase) >= 0; - - return false; - } - public (string, Widget) CreateInsensitiveEntry() { var entry = new Entry(); diff --git a/Source/Samples/Sections/Widgets/ProgressBarSection.cs b/Source/Samples/Sections/Widgets/ProgressBarSection.cs index 0d86e5b24..0508f38f4 100644 --- a/Source/Samples/Sections/Widgets/ProgressBarSection.cs +++ b/Source/Samples/Sections/Widgets/ProgressBarSection.cs @@ -68,7 +68,7 @@ namespace Samples public (string, Widget) CreatePulseProgressBar() { - // this is used when application cant report progress + // this is used when application can't report progress var pb = new ProgressBar();