diff --git a/src/Greenshot.Addon.ExternalCommand/ExternalCommandAddonModule.cs b/src/Greenshot.Addon.ExternalCommand/ExternalCommandAddonModule.cs index 8fbea7253..f163d1f64 100644 --- a/src/Greenshot.Addon.ExternalCommand/ExternalCommandAddonModule.cs +++ b/src/Greenshot.Addon.ExternalCommand/ExternalCommandAddonModule.cs @@ -49,10 +49,20 @@ namespace Greenshot.Addon.ExternalCommand .AsSelf() .SingleInstance(); - IniConfig.Current.AfterLoad(externalCommandConfiguration => externalCommandConfiguration.AfterLoad()); + builder.RegisterType() + .As() + .SingleInstance(); base.Load(builder); } + /// + private class SetupConfig : IStartable + { + public void Start() + { + IniConfig.Current.AfterLoad(externalCommandConfiguration => externalCommandConfiguration.AfterLoad()); + } + } } } diff --git a/src/Greenshot.Addon.LegacyEditor/ViewModels/EditorConfigViewModel.cs b/src/Greenshot.Addon.LegacyEditor/ViewModels/EditorConfigViewModel.cs index 4389c6ce5..69b2b0de4 100644 --- a/src/Greenshot.Addon.LegacyEditor/ViewModels/EditorConfigViewModel.cs +++ b/src/Greenshot.Addon.LegacyEditor/ViewModels/EditorConfigViewModel.cs @@ -54,7 +54,7 @@ namespace Greenshot.Addon.LegacyEditor.ViewModels _disposables = new CompositeDisposable(); // Place this under the Ui parent - ParentId = nameof(ConfigIds.Destinations); + ParentId = nameof(ConfigIds.InternalDestinations); // Make sure Commit/Rollback is called on the IUiConfiguration config.Register(EditorConfiguration); diff --git a/src/Greenshot.Addons/AddonsModule.cs b/src/Greenshot.Addons/AddonsModule.cs index fbbf485d6..acd86778b 100644 --- a/src/Greenshot.Addons/AddonsModule.cs +++ b/src/Greenshot.Addons/AddonsModule.cs @@ -46,10 +46,22 @@ namespace Greenshot.Addons builder .RegisterType() .AsSelf(); - - // REgister the after load, so it's called when the configuration is created - IniConfig.Current.AfterLoad(coreConfiguration => coreConfiguration.AfterLoad()); + + builder.RegisterType() + .As() + .SingleInstance(); + base.Load(builder); } + + /// + private class SetupConfig : IStartable + { + public void Start() + { + // Register the after load, so it's called when the configuration is created + IniConfig.Current.AfterLoad(coreConfiguration => coreConfiguration.AfterLoad()); + } + } } } diff --git a/src/Greenshot.Addons/Core/ConfigIds.cs b/src/Greenshot.Addons/Core/ConfigIds.cs index f2af34332..0627fd490 100644 --- a/src/Greenshot.Addons/Core/ConfigIds.cs +++ b/src/Greenshot.Addons/Core/ConfigIds.cs @@ -27,6 +27,7 @@ namespace Greenshot.Addons.Core { Ui, Capture, - Destinations + Destinations, + InternalDestinations } } diff --git a/src/Greenshot/Greenshot.csproj b/src/Greenshot/Greenshot.csproj index 97e79fa4e..f6607026b 100644 --- a/src/Greenshot/Greenshot.csproj +++ b/src/Greenshot/Greenshot.csproj @@ -266,14 +266,15 @@ + - - + + diff --git a/src/Greenshot/Languages/language-en-US.xml b/src/Greenshot/Languages/language-en-US.xml index 431416b13..f5d49e97f 100644 --- a/src/Greenshot/Languages/language-en-US.xml +++ b/src/Greenshot/Languages/language-en-US.xml @@ -7,7 +7,7 @@ Greenshot is hosted by GitHub at Icons from Yusuke Kamiyamane's Fugue icon set (Creative Commons Attribution 3.0 license) - Copyright (C) 2007-201( Thomas Braun, Jens Klingen, Robin Krom + Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom Greenshot comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. Details about the GNU General Public License: diff --git a/src/Greenshot/Languages/language-es-ES.xml b/src/Greenshot/Languages/language-es-ES.xml index 17ba9e47a..060065ca4 100644 --- a/src/Greenshot/Languages/language-es-ES.xml +++ b/src/Greenshot/Languages/language-es-ES.xml @@ -7,7 +7,7 @@ Greenshot está alojado en GitHub en Iconos del conjunto de iconos Fugue de Yusuke Kamiyamane(Creative Commons Attribution 3.0 license) - Copyright (C) 2007-201( Thomas Braun, Jens Klingen, Robin Krom + Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom Greenshot viene ABSOLUTAMENTE SIN GARANTIA. Este es software gratuito, y eres bienvenido a redistribuirlo bajo ciertas condiciones. Detalles acerca de la Licencia General Publica GNU: diff --git a/src/Greenshot/Ui/Configuration/ViewModels/DestinationsConfigNodeViewModel.cs b/src/Greenshot/Ui/Configuration/AddonDestinationsConfigNode.cs similarity index 86% rename from src/Greenshot/Ui/Configuration/ViewModels/DestinationsConfigNodeViewModel.cs rename to src/Greenshot/Ui/Configuration/AddonDestinationsConfigNode.cs index bbe3048c0..b9c7302d8 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/DestinationsConfigNodeViewModel.cs +++ b/src/Greenshot/Ui/Configuration/AddonDestinationsConfigNode.cs @@ -26,16 +26,16 @@ using Dapplo.CaliburnMicro.Extensions; using Greenshot.Addons; using Greenshot.Addons.Core; -namespace Greenshot.Ui.Configuration.ViewModels +namespace Greenshot.Ui.Configuration { /// /// This represents a node in the config /// - public sealed class DestinationsConfigNodeViewModel : ConfigNode + public sealed class AddonDestinationsConfigNode : ConfigNode { public IGreenshotLanguage GreenshotLanguage { get; } - public DestinationsConfigNodeViewModel(IGreenshotLanguage greenshotLanguage) + public AddonDestinationsConfigNode(IGreenshotLanguage greenshotLanguage) { GreenshotLanguage = greenshotLanguage; diff --git a/src/Greenshot/Ui/Configuration/ViewModels/CaptureConfigNodeViewModel.cs b/src/Greenshot/Ui/Configuration/CaptureConfigNode.cs similarity index 87% rename from src/Greenshot/Ui/Configuration/ViewModels/CaptureConfigNodeViewModel.cs rename to src/Greenshot/Ui/Configuration/CaptureConfigNode.cs index e8279d5c6..2b1e51e2b 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/CaptureConfigNodeViewModel.cs +++ b/src/Greenshot/Ui/Configuration/CaptureConfigNode.cs @@ -26,16 +26,16 @@ using Dapplo.CaliburnMicro.Extensions; using Greenshot.Addons; using Greenshot.Addons.Core; -namespace Greenshot.Ui.Configuration.ViewModels +namespace Greenshot.Ui.Configuration { /// /// This represents a node in the config /// - public sealed class CaptureConfigNodeViewModel : ConfigNode + public sealed class CaptureConfigNode : ConfigNode { public IGreenshotLanguage GreenshotLanguage { get; } - public CaptureConfigNodeViewModel(IGreenshotLanguage greenshotLanguage) + public CaptureConfigNode(IGreenshotLanguage greenshotLanguage) { GreenshotLanguage = greenshotLanguage; diff --git a/src/Greenshot/Ui/Configuration/InternalDestinationsConfigNode.cs b/src/Greenshot/Ui/Configuration/InternalDestinationsConfigNode.cs new file mode 100644 index 000000000..570db5723 --- /dev/null +++ b/src/Greenshot/Ui/Configuration/InternalDestinationsConfigNode.cs @@ -0,0 +1,50 @@ +#region Greenshot GNU General Public License + +// Greenshot - a free and open source screenshot tool +// Copyright (C) 2007-2018 Thomas Braun, Jens Klingen, Robin Krom +// +// For more information see: http://getgreenshot.org/ +// The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 1 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#endregion + +using Dapplo.CaliburnMicro.Configuration; +using Dapplo.CaliburnMicro.Extensions; +using Greenshot.Addons; +using Greenshot.Addons.Core; + +namespace Greenshot.Ui.Configuration +{ + /// + /// This represents a node in the config + /// + public sealed class InternalDestinationsConfigNode : ConfigNode + { + public IGreenshotLanguage GreenshotLanguage { get; } + + public InternalDestinationsConfigNode(IGreenshotLanguage greenshotLanguage) + { + GreenshotLanguage = greenshotLanguage; + + // automatically update the DisplayName + GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsDestination)); + + // automatically update the DisplayName + CanActivate = false; + Id = nameof(ConfigIds.InternalDestinations); + } + } +} diff --git a/src/Greenshot/Ui/Configuration/ViewModels/ClipboardDestinationConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/ClipboardDestinationConfigViewModel.cs index b36b24e9b..690ef116b 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/ClipboardDestinationConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/ClipboardDestinationConfigViewModel.cs @@ -30,7 +30,9 @@ using Dapplo.CaliburnMicro.Extensions; using Greenshot.Addons; using Greenshot.Addons.Core; using Greenshot.Addons.Core.Enums; +using Greenshot.Addons.Extensions; using Greenshot.Configuration; +using Greenshot.Destinations; namespace Greenshot.Ui.Configuration.ViewModels { @@ -65,7 +67,7 @@ namespace Greenshot.Ui.Configuration.ViewModels _disposables?.Dispose(); // Place this under the Ui parent - ParentId = nameof(ConfigIds.Destinations); + ParentId = nameof(ConfigIds.InternalDestinations); // Make sure Commit/Rollback is called on the IUiConfiguration config.Register(CoreConfiguration); @@ -75,6 +77,7 @@ namespace Greenshot.Ui.Configuration.ViewModels { GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsDestinationClipboard)) }; + DisplayName = typeof(ClipboardDestination).GetDesignation(); UsedDestinations.Clear(); diff --git a/src/Greenshot/Ui/Configuration/ViewModels/DestinationPickerConfigViewModel.cs b/src/Greenshot/Ui/Configuration/ViewModels/DestinationPickerConfigViewModel.cs index 46b198791..a92bfd5cd 100644 --- a/src/Greenshot/Ui/Configuration/ViewModels/DestinationPickerConfigViewModel.cs +++ b/src/Greenshot/Ui/Configuration/ViewModels/DestinationPickerConfigViewModel.cs @@ -68,7 +68,7 @@ namespace Greenshot.Ui.Configuration.ViewModels _disposables?.Dispose(); // Place this under the Ui parent - ParentId = nameof(ConfigIds.Destinations); + ParentId = nameof(ConfigIds.InternalDestinations); // Make sure Commit/Rollback is called on the IUiConfiguration config.Register(CoreConfiguration);