From 7c9efe3fe61b9cf797b55c34be07202711441b6c Mon Sep 17 00:00:00 2001 From: cra0zy Date: Sat, 27 Jan 2018 21:47:02 +0100 Subject: [PATCH] [Samples] Update section name handling --- Source/Samples/MainWindow.cs | 4 ++-- Source/Samples/Sections/Dialogs/AboutDialogSection.cs | 2 +- Source/Samples/Sections/SectionAttribute.cs | 2 +- Source/Samples/Sections/Widgets/ButtonSection.cs | 2 +- Source/Samples/Sections/Widgets/ColorButtonSection.cs | 2 +- Source/Samples/Sections/Widgets/EntrySection.cs | 2 +- Source/Samples/Sections/Widgets/LinkButtonSection.cs | 2 +- Source/Samples/Sections/Widgets/SpinButtonSection.cs | 2 +- .../Widgets/{SwitchButtonSection.cs => SwitchSection.cs} | 6 +++--- Source/Samples/Sections/Widgets/ToggleButtonSection.cs | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) rename Source/Samples/Sections/Widgets/{SwitchButtonSection.cs => SwitchSection.cs} (77%) diff --git a/Source/Samples/MainWindow.cs b/Source/Samples/MainWindow.cs index 5826984ac..6dad94535 100644 --- a/Source/Samples/MainWindow.cs +++ b/Source/Samples/MainWindow.cs @@ -134,8 +134,8 @@ namespace Samples { if (attribute is SectionAttribute a) { - _store.AppendValues(dict[a.Category], a.Name); - _items[a.Name] = (type, null); + _store.AppendValues(dict[a.Category], a.ContentType.Name); + _items[a.ContentType.Name] = (type, null); } } } diff --git a/Source/Samples/Sections/Dialogs/AboutDialogSection.cs b/Source/Samples/Sections/Dialogs/AboutDialogSection.cs index 1a2d1f77d..ba7568b1d 100644 --- a/Source/Samples/Sections/Dialogs/AboutDialogSection.cs +++ b/Source/Samples/Sections/Dialogs/AboutDialogSection.cs @@ -6,7 +6,7 @@ using Gtk; namespace Samples { - [Section(Name = "AboutDialog", Category = Category.Dialogs)] + [Section(ContentType = typeof(AboutDialog), Category = Category.Dialogs)] class AboutDialogSection : Box { public AboutDialogSection() : base(Orientation.Vertical, 0) diff --git a/Source/Samples/Sections/SectionAttribute.cs b/Source/Samples/Sections/SectionAttribute.cs index 409e8ef8b..3869b15a0 100644 --- a/Source/Samples/Sections/SectionAttribute.cs +++ b/Source/Samples/Sections/SectionAttribute.cs @@ -7,7 +7,7 @@ namespace Samples { class SectionAttribute : Attribute { - public string Name { get; set; } + public Type ContentType { get; set; } public Category Category { get; set; } } diff --git a/Source/Samples/Sections/Widgets/ButtonSection.cs b/Source/Samples/Sections/Widgets/ButtonSection.cs index d5f4d09e1..80ec2513f 100644 --- a/Source/Samples/Sections/Widgets/ButtonSection.cs +++ b/Source/Samples/Sections/Widgets/ButtonSection.cs @@ -5,7 +5,7 @@ using Gtk; namespace Samples { - [Section(Name = "Button", Category = Category.Widgets)] + [Section(ContentType = typeof(Button), Category = Category.Widgets)] class ButtonSection : ListSection { public ButtonSection() diff --git a/Source/Samples/Sections/Widgets/ColorButtonSection.cs b/Source/Samples/Sections/Widgets/ColorButtonSection.cs index 89499750c..9797ae2bb 100644 --- a/Source/Samples/Sections/Widgets/ColorButtonSection.cs +++ b/Source/Samples/Sections/Widgets/ColorButtonSection.cs @@ -5,7 +5,7 @@ using Gtk; namespace Samples { - [Section(Name = "Color Button", Category = Category.Widgets)] + [Section(ContentType = typeof(ColorButton), Category = Category.Widgets)] class ColorButtonSection : ListSection { public ColorButtonSection() diff --git a/Source/Samples/Sections/Widgets/EntrySection.cs b/Source/Samples/Sections/Widgets/EntrySection.cs index a2dc39a95..e9adcd39f 100644 --- a/Source/Samples/Sections/Widgets/EntrySection.cs +++ b/Source/Samples/Sections/Widgets/EntrySection.cs @@ -5,7 +5,7 @@ using Gtk; namespace Samples { - [Section(Name= "Entry", Category = Category.Widgets)] + [Section(ContentType = typeof(Entry), Category = Category.Widgets)] class EntrySection : ListSection { public EntrySection() diff --git a/Source/Samples/Sections/Widgets/LinkButtonSection.cs b/Source/Samples/Sections/Widgets/LinkButtonSection.cs index ed898361e..7856b0ad7 100644 --- a/Source/Samples/Sections/Widgets/LinkButtonSection.cs +++ b/Source/Samples/Sections/Widgets/LinkButtonSection.cs @@ -6,7 +6,7 @@ using Gtk; namespace Samples { - [Section(Name = "Link Button", Category = Category.Widgets)] + [Section(ContentType = typeof(LinkButton), Category = Category.Widgets)] class LinkButtonSection : ListSection { public LinkButtonSection() diff --git a/Source/Samples/Sections/Widgets/SpinButtonSection.cs b/Source/Samples/Sections/Widgets/SpinButtonSection.cs index 3b611c065..04e5453e9 100644 --- a/Source/Samples/Sections/Widgets/SpinButtonSection.cs +++ b/Source/Samples/Sections/Widgets/SpinButtonSection.cs @@ -5,7 +5,7 @@ using Gtk; namespace Samples { - [Section(Name = "Spin Button", Category = Category.Widgets)] + [Section(ContentType = typeof(SpinButton), Category = Category.Widgets)] class SpinButtonSection : ListSection { public SpinButtonSection() diff --git a/Source/Samples/Sections/Widgets/SwitchButtonSection.cs b/Source/Samples/Sections/Widgets/SwitchSection.cs similarity index 77% rename from Source/Samples/Sections/Widgets/SwitchButtonSection.cs rename to Source/Samples/Sections/Widgets/SwitchSection.cs index 9d76b6090..3fa745076 100644 --- a/Source/Samples/Sections/Widgets/SwitchButtonSection.cs +++ b/Source/Samples/Sections/Widgets/SwitchSection.cs @@ -5,10 +5,10 @@ using Gtk; namespace Samples { - [Section(Name = "Switch Button", Category = Category.Widgets)] - class SwitchButtonSection : ListSection + [Section(ContentType = typeof(Switch), Category = Category.Widgets)] + class SwitchSection : ListSection { - public SwitchButtonSection() + public SwitchSection() { AddItem(CreateSwitchButton()); } diff --git a/Source/Samples/Sections/Widgets/ToggleButtonSection.cs b/Source/Samples/Sections/Widgets/ToggleButtonSection.cs index db2fc52cf..795041d70 100644 --- a/Source/Samples/Sections/Widgets/ToggleButtonSection.cs +++ b/Source/Samples/Sections/Widgets/ToggleButtonSection.cs @@ -5,7 +5,7 @@ using Gtk; namespace Samples { - [Section(Name = "Toggle Button", Category = Category.Widgets)] + [Section(ContentType = typeof(ToggleButton), Category = Category.Widgets)] class ToggleButtonSection : ListSection { public ToggleButtonSection()