2
// CommonAssemblySigningPreferences.cs
5
// Mike Krüger <mkrueger@novell.com>
7
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
9
// Permission is hereby granted, free of charge, to any person obtaining
10
// a copy of this software and associated documentation files (the
11
// "Software"), to deal in the Software without restriction, including
12
// without limitation the rights to use, copy, modify, merge, publish,
13
// distribute, sublicense, and/or sell copies of the Software, and to
14
// permit persons to whom the Software is furnished to do so, subject to
15
// the following conditions:
17
// The above copyright notice and this permission notice shall be
18
// included in all copies or substantial portions of the Software.
20
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
using System.Collections.Generic;
31
using MonoDevelop.Ide.Gui.Dialogs;
32
using MonoDevelop.Projects;
33
using MonoDevelop.Core;
35
namespace MonoDevelop.Ide.Projects.OptionPanels
37
internal partial class CommonAssemblySigningPreferences : Gtk.Bin
39
ItemConfiguration[] configurations;
42
public CommonAssemblySigningPreferences ()
47
public void LoadPanelContents (Project project, ItemConfiguration[] configurations)
49
this.configurations = configurations;
54
foreach (DotNetProjectConfiguration c in configurations) {
55
int r = c.SignAssembly ? 1 : 0;
58
else if (signAsm != r)
61
keyFile = c.AssemblyKeyFile;
62
else if (keyFile != c.AssemblyKeyFile)
67
signAssemblyCheckbutton.Inconsistent = true;
69
signAssemblyCheckbutton.Inconsistent = false;
70
signAssemblyCheckbutton.Active = signAsm == 1;
73
if (keyFile == null || keyFile == "?")
74
this.strongNameFileEntry.Path = string.Empty;
76
this.strongNameFileEntry.Path = keyFile;
78
this.strongNameFileEntry.DefaultPath = project.BaseDirectory;
79
this.strongNameFileLabel.Sensitive = this.strongNameFileEntry.Sensitive = signAsm != 0;
80
this.signAssemblyCheckbutton.Toggled += new EventHandler (SignAssemblyCheckbuttonActivated);
83
void SignAssemblyCheckbuttonActivated (object sender, EventArgs e)
85
signAssemblyCheckbutton.Inconsistent = false;
86
this.strongNameFileLabel.Sensitive = this.strongNameFileEntry.Sensitive = this.signAssemblyCheckbutton.Active;
89
public void StorePanelContents ()
91
foreach (DotNetProjectConfiguration c in configurations) {
92
if (!signAssemblyCheckbutton.Inconsistent)
93
c.SignAssembly = this.signAssemblyCheckbutton.Active;
94
if (strongNameFileEntry.Path.Length > 0 || keyFile != "?")
95
c.AssemblyKeyFile = this.strongNameFileEntry.Path;
100
class CommonAssemblySigningPreferencesPanel: MultiConfigItemOptionsPanel
102
CommonAssemblySigningPreferences widget;
104
public override bool IsVisible ()
106
return ConfiguredProject is DotNetProject;
110
public override Gtk.Widget CreatePanelWidget ()
112
AllowMixedConfigurations = true;
113
return (widget = new CommonAssemblySigningPreferences ());
116
protected override bool ConfigurationsAreEqual (IEnumerable<ItemConfiguration> configs)
118
DotNetProjectConfiguration cref = null;
119
foreach (DotNetProjectConfiguration c in configs) {
123
if (c.SignAssembly != cref.SignAssembly)
125
if (c.AssemblyKeyFile != cref.AssemblyKeyFile)
132
public override void LoadConfigData ()
134
widget.LoadPanelContents (ConfiguredProject, CurrentConfigurations);
137
public override void ApplyChanges ()
139
widget.StorePanelContents ();