add mono addins source

This commit is contained in:
UbitUmarov
2019-11-17 21:53:13 +00:00
parent 75841dfa9f
commit b0d1967e71
887 changed files with 185511 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
Lluis Sanchez Gual <slluis.dev@gmail.com>
+22
View File
@@ -0,0 +1,22 @@
The MIT License
Copyright (C) 2007 Novell, Inc (http://www.novell.com)
Copyright (C) 2012 Xamarin Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
@@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("Mono.Addins.CecilReflector")]
[assembly: AssemblyCopyright("Copyright (C) 2007 Novell, Inc (http://www.novell.com)")]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.3.7.0")]
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<Import Project="..\Version.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{42D1CE65-A14B-4218-B787-58AD7AA68513}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>Mono.Addins.CecilReflector</AssemblyName>
<RootNamespace>Mono.Addins.CecilReflector</RootNamespace>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\mono-addins.snk</AssemblyOriginatorKeyFile>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<PackageId>Mono.Addins.CecilReflector</PackageId>
<Authors>Lluis Sanchez</Authors>
<PackageLicenseUrl>https://github.com/mono/mono-addins/blob/master/COPYING</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/mono/mono-addins</PackageProjectUrl>
<Description>Mono.Addins is a framework for creating extensible applications, and for creating add-ins which extend applications. Mono.Addins.Setup provides an API for managing add-ins, creating add-in packages and publishing add-ins in on-line repositories.</Description>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin</OutputPath>
<DefineConstants>READ_ONLY</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<ConsolePause>False</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>True</Optimize>
<OutputPath>..\bin</OutputPath>
<DefineConstants>READ_ONLY</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<ConsolePause>False</ConsolePause>
<DebugSymbols>true</DebugSymbols>
<PackOnBuild>True</PackOnBuild>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Core" />
<PackageReference Include="Mono.Cecil" Version="0.10.0-beta6" />
<PackageReference Include="NuGet.Build.Packaging" Version="0.2.0" />
<ProjectReference Include="..\Mono.Addins\Mono.Addins.csproj">
<Project>{91DD5A2D-9FE3-4C3C-9253-876141874DAD}</Project>
<Name>Mono.Addins</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="Mono.Addins.CecilReflector\Reflector.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
@@ -0,0 +1,610 @@
// Reflector.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//
//#define ASSEMBLY_LOAD_STATS
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using Mono.Addins;
using Mono.Addins.Database;
using Mono.Cecil;
using CustomAttribute = Mono.Cecil.CustomAttribute;
using MA = Mono.Addins.Database;
using System.Linq;
namespace Mono.Addins.CecilReflector
{
public class Reflector: IAssemblyReflector, IDisposable
{
IAssemblyLocator locator;
Dictionary<string, AssemblyDefinition> cachedAssemblies = new Dictionary<string, AssemblyDefinition> ();
DefaultAssemblyResolver defaultAssemblyResolver;
public void Initialize (IAssemblyLocator locator)
{
this.locator = locator;
defaultAssemblyResolver = new DefaultAssemblyResolver ();
defaultAssemblyResolver.ResolveFailure += delegate (object sender, AssemblyNameReference reference) {
var file = locator.GetAssemblyLocation (reference.FullName);
if (file != null)
return LoadAssembly (file, true);
else
return null;
};
}
public object[] GetCustomAttributes (object obj, Type type, bool inherit)
{
Mono.Cecil.ICustomAttributeProvider aprov = obj as Mono.Cecil.ICustomAttributeProvider;
if (aprov == null)
return new object [0];
ArrayList atts = new ArrayList ();
foreach (CustomAttribute att in aprov.CustomAttributes) {
object catt = ConvertAttribute (att, type);
if (catt != null)
atts.Add (catt);
}
if (inherit && (obj is TypeDefinition)) {
TypeDefinition td = (TypeDefinition) obj;
if (td.BaseType != null && td.BaseType.FullName != "System.Object") {
// The base type may be in an assembly that doesn't reference Mono.Addins, even though it may reference
// other assemblies that do reference Mono.Addins. So the Mono.Addins filter can't be applied here.
TypeDefinition bt = FindTypeDefinition (td.Module.Assembly, td.BaseType, assembliesReferencingMonoAddinsOnly: false);
if (bt != null)
atts.AddRange (GetCustomAttributes (bt, type, true));
}
}
return atts.ToArray ();
}
object ConvertAttribute (CustomAttribute att, Type expectedType)
{
Type attype = typeof(IAssemblyReflector).Assembly.GetType (att.Constructor.DeclaringType.FullName);
if (attype == null || !expectedType.IsAssignableFrom (attype))
return null;
object ob;
if (att.ConstructorArguments.Count > 0) {
object[] cargs = new object [att.ConstructorArguments.Count];
ArrayList typeParameters = null;
// Constructor parameters of type System.Type can't be set because types from the assembly
// can't be loaded. The parameter value will be set later using a type name property.
for (int n=0; n<cargs.Length; n++) {
var atype = Type.GetType (att.Constructor.Parameters[n].ParameterType.FullName);
if (atype == null)
atype = typeof(IAssemblyReflector).Assembly.GetType (att.Constructor.Parameters[n].ParameterType.FullName);
if (atype.IsEnum)
cargs [n] = Enum.ToObject (atype, att.ConstructorArguments [n].Value);
else
cargs [n] = att.ConstructorArguments [n].Value;
if (typeof(System.Type).IsAssignableFrom (atype)) {
if (typeParameters == null)
typeParameters = new ArrayList ();
cargs [n] = typeof(object);
typeParameters.Add (n);
}
}
ob = Activator.CreateInstance (attype, cargs);
// If there are arguments of type System.Type, set them using the property
if (typeParameters != null) {
Type[] ptypes = new Type [cargs.Length];
for (int n=0; n<cargs.Length; n++) {
ptypes [n] = cargs [n].GetType ();
}
ConstructorInfo ci = attype.GetConstructor (ptypes);
ParameterInfo[] ciParams = ci.GetParameters ();
for (int n=0; n<typeParameters.Count; n++) {
int ip = (int) typeParameters [n];
string propName = ciParams[ip].Name;
propName = char.ToUpper (propName [0]) + propName.Substring (1) + "Name";
PropertyInfo pi = attype.GetProperty (propName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (pi == null)
throw new InvalidOperationException ("Property '" + propName + "' not found in type '" + attype + "'.");
pi.SetValue (ob, ((TypeReference) att.ConstructorArguments [ip].Value).FullName, null);
}
}
} else {
ob = Activator.CreateInstance (attype);
}
foreach (Mono.Cecil.CustomAttributeNamedArgument namedArgument in att.Properties) {
string pname = namedArgument.Name;
PropertyInfo prop = attype.GetProperty (pname);
if (prop != null) {
if (prop.PropertyType == typeof(System.Type)) {
// We can't load the type. We have to use the typeName property instead.
pname += "Name";
prop = attype.GetProperty (pname, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (prop == null)
throw new InvalidOperationException ("Property '" + pname + "' not found in type '" + attype + "'.");
prop.SetValue (ob, ((TypeReference) namedArgument.Argument.Value).FullName, null);
} else
prop.SetValue (ob, namedArgument.Argument.Value, null);
}
}
return ob;
}
public List<MA.CustomAttribute> GetRawCustomAttributes (object obj, Type type, bool inherit)
{
List<MA.CustomAttribute> atts = new List<MA.CustomAttribute> ();
Mono.Cecil.ICustomAttributeProvider aprov = obj as Mono.Cecil.ICustomAttributeProvider;
if (aprov == null)
return atts;
foreach (CustomAttribute att in aprov.CustomAttributes) {
// The class of the attribute is always a subclass of a Mono.Addins class
MA.CustomAttribute catt = ConvertToRawAttribute (att, type.FullName, baseIsMonoAddinsType: true);
if (catt != null)
atts.Add (catt);
}
if (inherit && (obj is TypeDefinition)) {
TypeDefinition td = (TypeDefinition) obj;
if (td.BaseType != null && td.BaseType.FullName != "System.Object") {
// The base type may be in an assembly that doesn't reference Mono.Addins, even though it may reference
// other assemblies that do reference Mono.Addins. So the Mono.Addins filter can't be applied here.
TypeDefinition bt = FindTypeDefinition (td.Module.Assembly, td.BaseType, assembliesReferencingMonoAddinsOnly: false);
if (bt != null)
atts.AddRange (GetRawCustomAttributes (bt, type, true));
}
}
return atts;
}
MA.CustomAttribute ConvertToRawAttribute (CustomAttribute att, string expectedType, bool baseIsMonoAddinsType)
{
// If the class of the attribute is a subclass of a Mono.Addins class, then the assembly where this
// custom attribute type is defined must reference Mono.Addins.
TypeDefinition attType = FindTypeDefinition (att.Constructor.DeclaringType.Module.Assembly, att.Constructor.DeclaringType, assembliesReferencingMonoAddinsOnly: baseIsMonoAddinsType);
if (attType == null || !TypeIsAssignableFrom (expectedType, attType, baseIsMonoAddinsType))
return null;
MA.CustomAttribute mat = new MA.CustomAttribute ();
mat.TypeName = att.Constructor.DeclaringType.FullName;
if (att.ConstructorArguments.Count > 0) {
var arguments = att.ConstructorArguments;
MethodReference constructor = FindConstructor (att, attType);
if (constructor == null)
throw new InvalidOperationException ("Custom attribute constructor not found");
for (int n=0; n<arguments.Count; n++) {
ParameterDefinition par = constructor.Parameters[n];
object val = arguments [n].Value;
if (val != null) {
string name = par.Name;
NodeAttributeAttribute bat = (NodeAttributeAttribute) GetCustomAttribute (par, typeof(NodeAttributeAttribute), false);
if (bat != null)
name = bat.Name;
mat.Add (name, Convert.ToString (val, System.Globalization.CultureInfo.InvariantCulture));
}
}
}
List<TypeDefinition> inheritanceChain = null;
foreach (Mono.Cecil.CustomAttributeNamedArgument namedArgument in att.Properties) {
string pname = namedArgument.Name;
object val = namedArgument.Argument.Value;
if (val == null)
continue;
if (inheritanceChain == null)
inheritanceChain = GetInheritanceChain (attType, baseIsMonoAddinsType).ToList ();
foreach (TypeDefinition td in inheritanceChain) {
PropertyDefinition prop = GetMember (td.Properties, pname);
if (prop == null)
continue;
NodeAttributeAttribute bat = (NodeAttributeAttribute) GetCustomAttribute (prop, typeof(NodeAttributeAttribute), false);
if (bat != null) {
string name = string.IsNullOrEmpty (bat.Name) ? prop.Name : bat.Name;
mat.Add (name, Convert.ToString (val, System.Globalization.CultureInfo.InvariantCulture));
}
}
}
foreach (Mono.Cecil.CustomAttributeNamedArgument namedArgument in att.Fields) {
string pname = namedArgument.Name;
object val = namedArgument.Argument.Value;
if (val == null)
continue;
if (inheritanceChain == null)
inheritanceChain = GetInheritanceChain (attType, baseIsMonoAddinsType).ToList ();
foreach (TypeDefinition td in inheritanceChain) {
FieldDefinition field = GetMember (td.Fields, pname);
if (field != null) {
NodeAttributeAttribute bat = (NodeAttributeAttribute) GetCustomAttribute (field, typeof(NodeAttributeAttribute), false);
if (bat != null) {
string name = string.IsNullOrEmpty (bat.Name) ? field.Name : bat.Name;
mat.Add (name, Convert.ToString (val, System.Globalization.CultureInfo.InvariantCulture));
}
}
}
}
return mat;
}
static TMember GetMember<TMember> (ICollection<TMember> members, string name) where TMember : class, IMemberDefinition
{
foreach (var member in members)
if (member.Name == name)
return member;
return null;
}
IEnumerable<TypeDefinition> GetInheritanceChain (TypeDefinition td, bool baseIsMonoAddinsType)
{
yield return td;
while (td != null && td.BaseType != null && td.BaseType.FullName != "System.Object") {
// If the class we are looking for is a subclass of a Mono.Addins class, then the assembly where this
// class is defined must reference Mono.Addins.
td = FindTypeDefinition (td.Module.Assembly, td.BaseType, assembliesReferencingMonoAddinsOnly: baseIsMonoAddinsType);
if (td != null)
yield return td;
}
}
MethodReference FindConstructor (CustomAttribute att, TypeDefinition atd)
{
// The constructor provided by CustomAttribute.Constructor is lacking some information, such as the parameter
// name and custom attributes. Since we need the full info, we have to look it up in the declaring type.
foreach (MethodReference met in atd.Methods) {
if (met.Name != ".ctor")
continue;
if (met.Parameters.Count == att.Constructor.Parameters.Count) {
for (int n = met.Parameters.Count - 1; n >= 0; n--) {
if (met.Parameters[n].ParameterType.FullName != att.Constructor.Parameters[n].ParameterType.FullName)
break;
if (n == 0)
return met;
}
}
}
return null;
}
public object LoadAssembly (string file)
{
return LoadAssembly (file, true);
}
public AssemblyDefinition LoadAssembly (string file, bool cache)
{
AssemblyDefinition adef;
if (cachedAssemblies.TryGetValue (file, out adef))
return adef;
var rp = new ReaderParameters (ReadingMode.Deferred);
rp.AssemblyResolver = defaultAssemblyResolver;
adef = AssemblyDefinition.ReadAssembly (file, rp);
if (adef != null) {
if (cache)
cachedAssemblies [file] = adef;
// Since the assembly is loaded, we can quickly check now if it references Mono.Addins.
// This information may be useful later on.
if (adef.Name.Name != "Mono.Addins" && !adef.MainModule.AssemblyReferences.Any (r => r.Name == "Mono.Addins"))
assembliesNotReferencingMonoAddins.Add (adef.FullName);
}
#if ASSEMBLY_LOAD_STATS
loadCounter.TryGetValue (file, out int num);
loadCounter [file] = num + 1;
#endif
return adef;
}
#if ASSEMBLY_LOAD_STATS
static Dictionary<string, int> loadCounter = new Dictionary<string, int> ();
#endif
public void UnloadAssembly (object assembly)
{
var adef = (AssemblyDefinition)assembly;
cachedAssemblies.Remove (adef.MainModule.FileName);
adef.Dispose ();
}
bool FoundToNotReferenceMonoAddins (AssemblyNameReference aref)
{
// Quick check to find out if an assembly references Mono.Addins, based only on cached information.
return assembliesNotReferencingMonoAddins.Contains (aref.FullName);
}
bool CheckHasMonoAddinsReference (AssemblyDefinition adef)
{
// Maybe the assembly is already in the blacklist
if (assembliesNotReferencingMonoAddins.Contains (adef.FullName))
return false;
if (adef.Name.Name != "Mono.Addins" && !adef.MainModule.AssemblyReferences.Any (r => r.Name == "Mono.Addins")) {
assembliesNotReferencingMonoAddins.Add (adef.FullName);
return false;
}
return true;
}
HashSet<string> assembliesNotReferencingMonoAddins = new HashSet<string> (StringComparer.Ordinal);
public string [] GetResourceNames (object asm)
{
AssemblyDefinition adef = (AssemblyDefinition)asm;
List<string> names = new List<string> (adef.MainModule.Resources.Count);
foreach (Resource res in adef.MainModule.Resources) {
if (res is EmbeddedResource)
names.Add (res.Name);
}
return names.ToArray ();
}
public System.IO.Stream GetResourceStream (object asm, string resourceName)
{
AssemblyDefinition adef = (AssemblyDefinition) asm;
foreach (Resource res in adef.MainModule.Resources) {
EmbeddedResource r = res as EmbeddedResource;
if (r != null && r.Name == resourceName)
return r.GetResourceStream ();
}
throw new InvalidOperationException ("Resource not found: " + resourceName);
}
public object LoadAssemblyFromReference (object asmReference)
{
// The scanner only uses this method when looking for an extension node type, which is
// a subclass of a Mono.Addins type, so it must be defined in an assembly that references Mono.Addins.
return LoadAssemblyFromReference ((AssemblyNameReference)asmReference, assembliesReferencingMonoAddinsOnly: true);
}
AssemblyDefinition LoadAssemblyFromReference (AssemblyNameReference aref, bool assembliesReferencingMonoAddinsOnly)
{
// Fast check for Mono.Addins reference that sometimes will avoid loading the assembly
if (assembliesReferencingMonoAddinsOnly && FoundToNotReferenceMonoAddins (aref))
return null;
string loc = locator.GetAssemblyLocation (aref.FullName);
if (loc == null)
return null;
AssemblyDefinition asm = LoadAssembly (loc, true);
// Check for Mono.Addins references first, that will update the cache.
if (!CheckHasMonoAddinsReference (asm) && assembliesReferencingMonoAddinsOnly) {
// We loaded an assembly we are not interested in, so we could unload it now.
// We already cached the information about whether it has a Mono.Addins reference
// or not, so the next we try to load the reference, the check can be done
// without loading. However, empirical tests should that the cache size doesn't
// increase much, while redundant assembly loads are significanly reduced.
//UnloadAssembly (asm);
return null;
}
return asm;
}
public System.Collections.IEnumerable GetAssemblyTypes (object asm)
{
return ((AssemblyDefinition)asm).MainModule.Types;
}
public System.Collections.IEnumerable GetAssemblyReferences (object asm)
{
return ((AssemblyDefinition)asm).MainModule.AssemblyReferences;
}
public object GetType (object asm, string typeName)
{
if (typeName.IndexOf ('`') != -1) {
foreach (TypeDefinition td in ((AssemblyDefinition)asm).MainModule.Types) {
if (td.FullName == typeName) {
return td;
}
}
}
TypeDefinition t = ((AssemblyDefinition)asm).MainModule.GetType (typeName);
if (t != null) {
return t;
} else {
return null;
}
}
public object GetCustomAttribute (object obj, Type type, bool inherit)
{
foreach (object att in GetCustomAttributes (obj, type, inherit))
if (type.IsInstanceOfType (att))
return att;
return null;
}
public string GetTypeName (object type)
{
return ((TypeDefinition)type).Name;
}
public string GetTypeFullName (object type)
{
return ((TypeDefinition)type).FullName;
}
public string GetTypeAssemblyQualifiedName (object type)
{
AssemblyDefinition asm = GetAssemblyDefinition ((TypeDefinition)type);
return ((TypeDefinition)type).FullName + ", " + asm.Name.FullName;
}
AssemblyDefinition GetAssemblyDefinition (TypeDefinition t)
{
return t.Module.Assembly;
}
public System.Collections.IEnumerable GetBaseTypeFullNameList (object type)
{
// The base type can be any type, so we can apply the Mono.Addins optimization in this case.
return GetBaseTypeFullNameList ((TypeDefinition)type, baseIsMonoAddinsType: false, includeInterfaces: true);
}
public System.Collections.IEnumerable GetBaseTypeFullNameList (TypeDefinition type, bool baseIsMonoAddinsType, bool includeInterfaces)
{
AssemblyDefinition asm = GetAssemblyDefinition (type);
ArrayList list = new ArrayList ();
Hashtable visited = new Hashtable ();
GetBaseTypeFullNameList (visited, list, asm, type, baseIsMonoAddinsType, includeInterfaces);
list.Remove (type.FullName);
return list;
}
void GetBaseTypeFullNameList (Hashtable visited, ArrayList list, AssemblyDefinition asm, TypeReference tr, bool baseIsMonoAddinsType, bool includeInterfaces)
{
if (tr.FullName == "System.Object" || visited.Contains (tr.FullName))
return;
visited [tr.FullName] = tr;
list.Add (tr.FullName);
TypeDefinition type = FindTypeDefinition (asm, tr, assembliesReferencingMonoAddinsOnly: baseIsMonoAddinsType);
if (type == null)
return;
asm = GetAssemblyDefinition (type);
if (type.BaseType != null)
GetBaseTypeFullNameList (visited, list, asm, type.BaseType, baseIsMonoAddinsType, includeInterfaces);
if (includeInterfaces) {
foreach (InterfaceImplementation ii in type.Interfaces) {
TypeReference interf = ii.InterfaceType;
GetBaseTypeFullNameList (visited, list, asm, interf, baseIsMonoAddinsType, includeInterfaces);
}
}
}
TypeDefinition FindTypeDefinition (AssemblyDefinition referencer, TypeReference rt, bool assembliesReferencingMonoAddinsOnly)
{
if (rt is TypeDefinition)
return (TypeDefinition)rt;
string name = rt.FullName;
TypeDefinition td = GetType (referencer, name) as TypeDefinition;
if (td != null)
return td;
int i = name.IndexOf ('<');
if (i != -1) {
name = name.Substring (0, i);
td = GetType (referencer, name) as TypeDefinition;
if (td != null)
return td;
}
foreach (AssemblyNameReference aref in referencer.MainModule.AssemblyReferences) {
try {
AssemblyDefinition asm = LoadAssemblyFromReference (aref, assembliesReferencingMonoAddinsOnly);
if (asm == null)
continue;
td = GetType (asm, name) as TypeDefinition;
if (td != null)
return td;
} catch {
Console.WriteLine ("Could not scan dependency '{0}'. Ignoring for now.", aref.FullName);
}
}
return null;
}
public bool TypeIsAssignableFrom (object baseType, object type)
{
string baseName = ((TypeDefinition)baseType).FullName;
foreach (string bt in GetBaseTypeFullNameList (type))
if (bt == baseName)
return true;
return false;
}
public bool TypeIsAssignableFrom (string baseTypeName, object type, bool baseIsMonoAddinsClass)
{
// If the base is a Mono.Addins class then there is no need to include interfaces when getting
// the base type list (since we are looking for a class, not for an interface).
foreach (string bt in GetBaseTypeFullNameList ((TypeDefinition)type, baseIsMonoAddinsClass, !baseIsMonoAddinsClass))
if (bt == baseTypeName)
return true;
return false;
}
public IEnumerable GetFields (object type)
{
return ((TypeDefinition)type).Fields;
}
public string GetFieldName (object field)
{
return ((FieldDefinition)field).Name;
}
public string GetFieldTypeFullName (object field)
{
return ((FieldDefinition)field).FieldType.FullName;
}
public void Dispose ()
{
foreach (AssemblyDefinition asm in cachedAssemblies.Values)
asm.Dispose ();
#if ASSEMBLY_LOAD_STATS
Console.WriteLine ("Total assemblies: " + loadCounter.Count);
Console.WriteLine ("Assembly cache size: {0} ({1}%)", cachedAssemblies.Count, (cachedAssemblies.Count * 100) / loadCounter.Count);
Console.WriteLine ("Total assembly loads: " + loadCounter.Values.Sum ());
var redundant = loadCounter.Where (c => c.Value > 1).Select (c => c.Value - 1).Sum ();
Console.WriteLine ("Redundant loads: {0} ({1}%)", redundant, ((redundant * 100) / loadCounter.Count));
#endif
}
}
}
@@ -0,0 +1 @@
35e0fe8e07ee88ca3f686eaab0c228bcbfb9a913
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">D:\opensim\MonoAddins\mono-addins\Mono.Addins.CecilReflector\obj\project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\ld\.nuget\packages\</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">4.9.3</NuGetToolVersion>
</PropertyGroup>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)nuget.build.packaging\0.2.0\build\NuGet.Build.Packaging.props" Condition="Exists('$(NuGetPackageRoot)nuget.build.packaging\0.2.0\build\NuGet.Build.Packaging.props')" />
</ImportGroup>
</Project>
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)nuget.build.packaging\0.2.0\build\NuGet.Build.Packaging.targets" Condition="Exists('$(NuGetPackageRoot)nuget.build.packaging\0.2.0\build\NuGet.Build.Packaging.targets')" />
</ImportGroup>
</Project>
@@ -0,0 +1,286 @@
{
"version": 3,
"targets": {
".NETFramework,Version=v4.6": {
"Mono.Cecil/0.10.0-beta6": {
"type": "package",
"compile": {
"lib/net40/Mono.Cecil.Mdb.dll": {},
"lib/net40/Mono.Cecil.Pdb.dll": {},
"lib/net40/Mono.Cecil.Rocks.dll": {},
"lib/net40/Mono.Cecil.dll": {}
},
"runtime": {
"lib/net40/Mono.Cecil.Mdb.dll": {},
"lib/net40/Mono.Cecil.Pdb.dll": {},
"lib/net40/Mono.Cecil.Rocks.dll": {},
"lib/net40/Mono.Cecil.dll": {}
}
},
"NuGet.Build.Packaging/0.2.0": {
"type": "package",
"build": {
"build/NuGet.Build.Packaging.props": {},
"build/NuGet.Build.Packaging.targets": {}
}
},
"Mono.Addins/1.3.7": {
"type": "project",
"framework": ".NETFramework,Version=v4.6",
"dependencies": {
"NuGet.Build.Packaging": "0.2.0"
},
"compile": {
"bin/placeholder/Mono.Addins.dll": {}
},
"runtime": {
"bin/placeholder/Mono.Addins.dll": {}
}
}
},
".NETFramework,Version=v4.6/win": {
"Mono.Cecil/0.10.0-beta6": {
"type": "package",
"compile": {
"lib/net40/Mono.Cecil.Mdb.dll": {},
"lib/net40/Mono.Cecil.Pdb.dll": {},
"lib/net40/Mono.Cecil.Rocks.dll": {},
"lib/net40/Mono.Cecil.dll": {}
},
"runtime": {
"lib/net40/Mono.Cecil.Mdb.dll": {},
"lib/net40/Mono.Cecil.Pdb.dll": {},
"lib/net40/Mono.Cecil.Rocks.dll": {},
"lib/net40/Mono.Cecil.dll": {}
}
},
"NuGet.Build.Packaging/0.2.0": {
"type": "package",
"build": {
"build/NuGet.Build.Packaging.props": {},
"build/NuGet.Build.Packaging.targets": {}
}
},
"Mono.Addins/1.3.7": {
"type": "project",
"framework": ".NETFramework,Version=v4.6",
"dependencies": {
"NuGet.Build.Packaging": "0.2.0"
},
"compile": {
"bin/placeholder/Mono.Addins.dll": {}
},
"runtime": {
"bin/placeholder/Mono.Addins.dll": {}
}
}
},
".NETFramework,Version=v4.6/win-x64": {
"Mono.Cecil/0.10.0-beta6": {
"type": "package",
"compile": {
"lib/net40/Mono.Cecil.Mdb.dll": {},
"lib/net40/Mono.Cecil.Pdb.dll": {},
"lib/net40/Mono.Cecil.Rocks.dll": {},
"lib/net40/Mono.Cecil.dll": {}
},
"runtime": {
"lib/net40/Mono.Cecil.Mdb.dll": {},
"lib/net40/Mono.Cecil.Pdb.dll": {},
"lib/net40/Mono.Cecil.Rocks.dll": {},
"lib/net40/Mono.Cecil.dll": {}
}
},
"NuGet.Build.Packaging/0.2.0": {
"type": "package",
"build": {
"build/NuGet.Build.Packaging.props": {},
"build/NuGet.Build.Packaging.targets": {}
}
},
"Mono.Addins/1.3.7": {
"type": "project",
"framework": ".NETFramework,Version=v4.6",
"dependencies": {
"NuGet.Build.Packaging": "0.2.0"
},
"compile": {
"bin/placeholder/Mono.Addins.dll": {}
},
"runtime": {
"bin/placeholder/Mono.Addins.dll": {}
}
}
},
".NETFramework,Version=v4.6/win-x86": {
"Mono.Cecil/0.10.0-beta6": {
"type": "package",
"compile": {
"lib/net40/Mono.Cecil.Mdb.dll": {},
"lib/net40/Mono.Cecil.Pdb.dll": {},
"lib/net40/Mono.Cecil.Rocks.dll": {},
"lib/net40/Mono.Cecil.dll": {}
},
"runtime": {
"lib/net40/Mono.Cecil.Mdb.dll": {},
"lib/net40/Mono.Cecil.Pdb.dll": {},
"lib/net40/Mono.Cecil.Rocks.dll": {},
"lib/net40/Mono.Cecil.dll": {}
}
},
"NuGet.Build.Packaging/0.2.0": {
"type": "package",
"build": {
"build/NuGet.Build.Packaging.props": {},
"build/NuGet.Build.Packaging.targets": {}
}
},
"Mono.Addins/1.3.7": {
"type": "project",
"framework": ".NETFramework,Version=v4.6",
"dependencies": {
"NuGet.Build.Packaging": "0.2.0"
},
"compile": {
"bin/placeholder/Mono.Addins.dll": {}
},
"runtime": {
"bin/placeholder/Mono.Addins.dll": {}
}
}
}
},
"libraries": {
"Mono.Cecil/0.10.0-beta6": {
"sha512": "AGOyahYE6CGh3dLz/mz6cnj8hABoJm2KcMRHSHMrW75WHgU5YB+5PSQTVWsmQk9RFC4HAGr5ZzLMFFXsbmTi1w==",
"type": "package",
"path": "mono.cecil/0.10.0-beta6",
"files": [
"lib/net35/Mono.Cecil.Mdb.dll",
"lib/net35/Mono.Cecil.Pdb.dll",
"lib/net35/Mono.Cecil.Rocks.dll",
"lib/net35/Mono.Cecil.dll",
"lib/net40/Mono.Cecil.Mdb.dll",
"lib/net40/Mono.Cecil.Pdb.dll",
"lib/net40/Mono.Cecil.Rocks.dll",
"lib/net40/Mono.Cecil.dll",
"lib/netstandard1.3/Mono.Cecil.Mdb.dll",
"lib/netstandard1.3/Mono.Cecil.Pdb.dll",
"lib/netstandard1.3/Mono.Cecil.Rocks.dll",
"lib/netstandard1.3/Mono.Cecil.dll",
"mono.cecil.0.10.0-beta6.nupkg.sha512",
"mono.cecil.nuspec"
]
},
"NuGet.Build.Packaging/0.2.0": {
"sha512": "iqo7f9c+oA12IcelLjD232BMxdGR2Dzrqk00C8w7NiB1sbXa8YHsZGCJkt6CEQKR5XYqZ/8f3z0kHTBJ0Gua3Q==",
"type": "package",
"path": "nuget.build.packaging/0.2.0",
"files": [
"build/ApiIntersect.exe",
"build/ApiIntersect.exe.config",
"build/GenerateReferenceAssembly.csproj",
"build/ICSharpCode.Decompiler.dll",
"build/ICSharpCode.NRefactory.CSharp.dll",
"build/ICSharpCode.NRefactory.Cecil.dll",
"build/ICSharpCode.NRefactory.Xml.dll",
"build/ICSharpCode.NRefactory.dll",
"build/Mono.Cecil.Mdb.dll",
"build/Mono.Cecil.Pdb.dll",
"build/Mono.Cecil.Rocks.dll",
"build/Mono.Cecil.dll",
"build/Mono.Options.dll",
"build/NuGet.Build.Packaging.Authoring.props",
"build/NuGet.Build.Packaging.Authoring.targets",
"build/NuGet.Build.Packaging.Compatibility.props",
"build/NuGet.Build.Packaging.CrossTargeting.targets",
"build/NuGet.Build.Packaging.Inference.targets",
"build/NuGet.Build.Packaging.Legacy.props",
"build/NuGet.Build.Packaging.Legacy.targets",
"build/NuGet.Build.Packaging.ReferenceAssembly.targets",
"build/NuGet.Build.Packaging.Tasks.dll",
"build/NuGet.Build.Packaging.Tasks.pdb",
"build/NuGet.Build.Packaging.Version.props",
"build/NuGet.Build.Packaging.props",
"build/NuGet.Build.Packaging.targets",
"nuget.build.packaging.0.2.0.nupkg.sha512",
"nuget.build.packaging.nuspec"
]
},
"Mono.Addins/1.3.7": {
"type": "project",
"path": "../Mono.Addins/Mono.Addins.csproj",
"msbuildProject": "../Mono.Addins/Mono.Addins.csproj"
}
},
"projectFileDependencyGroups": {
".NETFramework,Version=v4.6": [
"Mono.Addins >= 1.3.7",
"Mono.Cecil >= 0.10.0-beta6",
"NuGet.Build.Packaging >= 0.2.0"
]
},
"packageFolders": {
"C:\\Users\\ld\\.nuget\\packages\\": {}
},
"project": {
"version": "1.3.7",
"restore": {
"projectUniqueName": "D:\\opensim\\MonoAddins\\mono-addins\\Mono.Addins.CecilReflector\\Mono.Addins.CecilReflector.csproj",
"projectName": "Mono.Addins.CecilReflector",
"projectPath": "D:\\opensim\\MonoAddins\\mono-addins\\Mono.Addins.CecilReflector\\Mono.Addins.CecilReflector.csproj",
"packagesPath": "C:\\Users\\ld\\.nuget\\packages\\",
"outputPath": "D:\\opensim\\MonoAddins\\mono-addins\\Mono.Addins.CecilReflector\\obj\\",
"projectStyle": "PackageReference",
"skipContentFileWrite": true,
"configFilePaths": [
"C:\\Users\\ld\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net46"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Users\\ld\\AppData\\Local\\Xenko\\NugetDev": {},
"D:\\xenko\\xenko\\bin\\packages": {},
"https://api.nuget.org/v3/index.json": {},
"https://packages.xenko.com/nuget": {}
},
"frameworks": {
"net46": {
"projectReferences": {
"D:\\opensim\\MonoAddins\\mono-addins\\Mono.Addins\\Mono.Addins.csproj": {
"projectPath": "D:\\opensim\\MonoAddins\\mono-addins\\Mono.Addins\\Mono.Addins.csproj"
}
}
}
}
},
"frameworks": {
"net46": {
"dependencies": {
"Mono.Cecil": {
"target": "Package",
"version": "[0.10.0-beta6, )"
},
"NuGet.Build.Packaging": {
"target": "Package",
"version": "[0.2.0, )"
}
}
}
},
"runtimes": {
"win": {
"#import": []
},
"win-x64": {
"#import": []
},
"win-x86": {
"#import": []
}
}
}
}
@@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("Mono.Addins.Gui")]
[assembly: AssemblyCopyright("Copyright (C) 2007 Novell, Inc (http://www.novell.com)")]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.3.7.0")]
@@ -0,0 +1,270 @@
// This file has been generated by the GUI designer. Do not modify.
namespace Mono.Addins.Gui
{
internal partial class AddinInfoView
{
private global::Gtk.EventBox ebox;
private global::Gtk.VBox vbox6;
private global::Gtk.EventBox boxHeader;
private global::Gtk.HBox hbox2;
private global::Gtk.Image imageHeader;
private global::Gtk.Label labelHeader;
private global::Gtk.VBox vbox3;
private global::Gtk.HBox headerBox;
private global::Gtk.HBox boxTitle;
private global::Gtk.VBox vbox4;
private global::Gtk.Label labelName;
private global::Gtk.Label labelVersion;
private global::Gtk.ScrolledWindow scrolledwindow;
private global::Gtk.EventBox ebox2;
private global::Gtk.VBox vboxDesc;
private global::Gtk.Label labelDesc;
private global::Gtk.HBox hbox3;
private global::Gtk.Button urlButton;
private global::Gtk.EventBox eboxButs;
private global::Gtk.HBox hbox1;
private global::Gtk.Button btnInstall;
private global::Gtk.Button btnUpdate;
private global::Gtk.Button btnDisable;
private global::Gtk.Button btnUninstall;
protected virtual void Build ()
{
Gui.Initialize (this);
// Widget Mono.Addins.Gui.AddinInfoView
BinContainer.Attach (this);
this.Name = "Mono.Addins.Gui.AddinInfoView";
// Container child Mono.Addins.Gui.AddinInfoView.Gtk.Container+ContainerChild
this.ebox = new global::Gtk.EventBox ();
this.ebox.Name = "ebox";
// Container child ebox.Gtk.Container+ContainerChild
this.vbox6 = new global::Gtk.VBox ();
this.vbox6.Name = "vbox6";
// Container child vbox6.Gtk.Box+BoxChild
this.boxHeader = new global::Gtk.EventBox ();
this.boxHeader.Name = "boxHeader";
// Container child boxHeader.Gtk.Container+ContainerChild
this.hbox2 = new global::Gtk.HBox ();
this.hbox2.Name = "hbox2";
this.hbox2.Spacing = 6;
// Container child hbox2.Gtk.Box+BoxChild
this.imageHeader = new global::Gtk.Image ();
this.imageHeader.Name = "imageHeader";
this.imageHeader.Pixbuf = IconLoader.LoadIcon (this, "gtk-dialog-warning", global::Gtk.IconSize.Menu);
this.hbox2.Add (this.imageHeader);
global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.imageHeader]));
w1.Position = 0;
w1.Expand = false;
w1.Fill = false;
// Container child hbox2.Gtk.Box+BoxChild
this.labelHeader = new global::Gtk.Label ();
this.labelHeader.WidthRequest = 250;
this.labelHeader.Name = "labelHeader";
this.labelHeader.Xalign = 0F;
this.labelHeader.LabelProp = global::Mono.Unix.Catalog.GetString ("label1");
this.labelHeader.Wrap = true;
this.hbox2.Add (this.labelHeader);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.labelHeader]));
w2.Position = 1;
w2.Expand = false;
w2.Fill = false;
this.boxHeader.Add (this.hbox2);
this.vbox6.Add (this.boxHeader);
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox6 [this.boxHeader]));
w4.Position = 0;
w4.Expand = false;
w4.Fill = false;
// Container child vbox6.Gtk.Box+BoxChild
this.vbox3 = new global::Gtk.VBox ();
this.vbox3.Name = "vbox3";
this.vbox3.Spacing = 6;
this.vbox3.BorderWidth = ((uint)(12));
// Container child vbox3.Gtk.Box+BoxChild
this.headerBox = new global::Gtk.HBox ();
this.headerBox.Name = "headerBox";
this.headerBox.Spacing = 6;
// Container child headerBox.Gtk.Box+BoxChild
this.boxTitle = new global::Gtk.HBox ();
this.boxTitle.Name = "boxTitle";
this.boxTitle.Spacing = 6;
// Container child boxTitle.Gtk.Box+BoxChild
this.vbox4 = new global::Gtk.VBox ();
this.vbox4.Name = "vbox4";
this.vbox4.Spacing = 3;
// Container child vbox4.Gtk.Box+BoxChild
this.labelName = new global::Gtk.Label ();
this.labelName.WidthRequest = 280;
this.labelName.Name = "labelName";
this.labelName.Xalign = 0F;
this.labelName.LabelProp = global::Mono.Unix.Catalog.GetString ("<b><big>Some Addin</big></b>");
this.labelName.UseMarkup = true;
this.labelName.Wrap = true;
this.vbox4.Add (this.labelName);
global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.labelName]));
w5.Position = 0;
w5.Expand = false;
w5.Fill = false;
// Container child vbox4.Gtk.Box+BoxChild
this.labelVersion = new global::Gtk.Label ();
this.labelVersion.WidthRequest = 280;
this.labelVersion.Name = "labelVersion";
this.labelVersion.Xalign = 0F;
this.labelVersion.LabelProp = global::Mono.Unix.Catalog.GetString ("Version 2.6");
this.labelVersion.Wrap = true;
this.vbox4.Add (this.labelVersion);
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.labelVersion]));
w6.Position = 1;
w6.Expand = false;
w6.Fill = false;
this.boxTitle.Add (this.vbox4);
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.boxTitle [this.vbox4]));
w7.Position = 0;
w7.Expand = false;
w7.Fill = false;
this.headerBox.Add (this.boxTitle);
global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.headerBox [this.boxTitle]));
w8.Position = 0;
this.vbox3.Add (this.headerBox);
global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.headerBox]));
w9.Position = 0;
w9.Expand = false;
w9.Fill = false;
// Container child vbox3.Gtk.Box+BoxChild
this.scrolledwindow = new global::Gtk.ScrolledWindow ();
this.scrolledwindow.CanFocus = true;
this.scrolledwindow.Name = "scrolledwindow";
this.scrolledwindow.HscrollbarPolicy = ((global::Gtk.PolicyType)(2));
// Container child scrolledwindow.Gtk.Container+ContainerChild
global::Gtk.Viewport w10 = new global::Gtk.Viewport ();
w10.ShadowType = ((global::Gtk.ShadowType)(0));
// Container child GtkViewport.Gtk.Container+ContainerChild
this.ebox2 = new global::Gtk.EventBox ();
this.ebox2.Name = "ebox2";
// Container child ebox2.Gtk.Container+ContainerChild
this.vboxDesc = new global::Gtk.VBox ();
this.vboxDesc.Name = "vboxDesc";
this.vboxDesc.Spacing = 6;
// Container child vboxDesc.Gtk.Box+BoxChild
this.labelDesc = new global::Gtk.Label ();
this.labelDesc.WidthRequest = 250;
this.labelDesc.Name = "labelDesc";
this.labelDesc.Xalign = 0F;
this.labelDesc.LabelProp = global::Mono.Unix.Catalog.GetString ("Long description of the extension. Long description of the extension. Long description of the extension. Long description of the extension. Long description of the extension. Long description of the extension. ");
this.labelDesc.Wrap = true;
this.vboxDesc.Add (this.labelDesc);
global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.vboxDesc [this.labelDesc]));
w11.Position = 0;
w11.Expand = false;
w11.Fill = false;
// Container child vboxDesc.Gtk.Box+BoxChild
this.hbox3 = new global::Gtk.HBox ();
this.hbox3.Name = "hbox3";
this.hbox3.Spacing = 6;
// Container child hbox3.Gtk.Box+BoxChild
this.urlButton = new global::Gtk.Button ();
this.urlButton.CanFocus = true;
this.urlButton.Name = "urlButton";
this.urlButton.UseUnderline = true;
this.urlButton.Relief = ((global::Gtk.ReliefStyle)(2));
this.urlButton.Label = global::Mono.Unix.Catalog.GetString ("More information");
global::Gtk.Image w12 = new global::Gtk.Image ();
w12.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("web-search-16.png");
this.urlButton.Image = w12;
this.hbox3.Add (this.urlButton);
global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.urlButton]));
w13.Position = 0;
w13.Expand = false;
w13.Fill = false;
this.vboxDesc.Add (this.hbox3);
global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.vboxDesc [this.hbox3]));
w14.PackType = ((global::Gtk.PackType)(1));
w14.Position = 2;
w14.Expand = false;
w14.Fill = false;
this.ebox2.Add (this.vboxDesc);
w10.Add (this.ebox2);
this.scrolledwindow.Add (w10);
this.vbox3.Add (this.scrolledwindow);
global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.scrolledwindow]));
w18.Position = 1;
this.vbox6.Add (this.vbox3);
global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.vbox6 [this.vbox3]));
w19.Position = 1;
// Container child vbox6.Gtk.Box+BoxChild
this.eboxButs = new global::Gtk.EventBox ();
this.eboxButs.Name = "eboxButs";
// Container child eboxButs.Gtk.Container+ContainerChild
this.hbox1 = new global::Gtk.HBox ();
this.hbox1.Name = "hbox1";
this.hbox1.Spacing = 6;
// Container child hbox1.Gtk.Box+BoxChild
this.btnInstall = new global::Gtk.Button ();
this.btnInstall.CanFocus = true;
this.btnInstall.Name = "btnInstall";
this.btnInstall.UseUnderline = true;
this.btnInstall.Label = global::Mono.Unix.Catalog.GetString ("Install...");
global::Gtk.Image w20 = new global::Gtk.Image ();
w20.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("download-16.png");
this.btnInstall.Image = w20;
this.hbox1.Add (this.btnInstall);
global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.btnInstall]));
w21.Position = 0;
w21.Expand = false;
w21.Fill = false;
// Container child hbox1.Gtk.Box+BoxChild
this.btnUpdate = new global::Gtk.Button ();
this.btnUpdate.CanFocus = true;
this.btnUpdate.Name = "btnUpdate";
this.btnUpdate.UseUnderline = true;
this.btnUpdate.Label = global::Mono.Unix.Catalog.GetString ("Update");
global::Gtk.Image w22 = new global::Gtk.Image ();
w22.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("download-16.png");
this.btnUpdate.Image = w22;
this.hbox1.Add (this.btnUpdate);
global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.btnUpdate]));
w23.Position = 1;
w23.Expand = false;
w23.Fill = false;
// Container child hbox1.Gtk.Box+BoxChild
this.btnDisable = new global::Gtk.Button ();
this.btnDisable.CanFocus = true;
this.btnDisable.Name = "btnDisable";
this.btnDisable.UseUnderline = true;
this.btnDisable.Label = global::Mono.Unix.Catalog.GetString ("Disable");
this.hbox1.Add (this.btnDisable);
global::Gtk.Box.BoxChild w24 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.btnDisable]));
w24.Position = 2;
w24.Expand = false;
w24.Fill = false;
// Container child hbox1.Gtk.Box+BoxChild
this.btnUninstall = new global::Gtk.Button ();
this.btnUninstall.CanFocus = true;
this.btnUninstall.Name = "btnUninstall";
this.btnUninstall.UseUnderline = true;
this.btnUninstall.Label = global::Mono.Unix.Catalog.GetString ("_Uninstall...");
this.hbox1.Add (this.btnUninstall);
global::Gtk.Box.BoxChild w25 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.btnUninstall]));
w25.Position = 3;
w25.Expand = false;
w25.Fill = false;
this.eboxButs.Add (this.hbox1);
this.vbox6.Add (this.eboxButs);
global::Gtk.Box.BoxChild w27 = ((global::Gtk.Box.BoxChild)(this.vbox6 [this.eboxButs]));
w27.Position = 2;
w27.Expand = false;
w27.Fill = false;
this.ebox.Add (this.vbox6);
this.Add (this.ebox);
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.Hide ();
this.urlButton.Clicked += new global::System.EventHandler (this.OnUrlButtonClicked);
this.btnInstall.Clicked += new global::System.EventHandler (this.OnBtnInstallClicked);
this.btnUpdate.Clicked += new global::System.EventHandler (this.OnBtnUpdateClicked);
this.btnDisable.Clicked += new global::System.EventHandler (this.OnBtnDisableClicked);
this.btnUninstall.Clicked += new global::System.EventHandler (this.OnBtnUninstallClicked);
}
}
}
@@ -0,0 +1,128 @@
// This file has been generated by the GUI designer. Do not modify.
namespace Mono.Addins.Gui
{
internal partial class AddinInstallerDialog
{
private global::Gtk.VBox vbox2;
private global::Gtk.Label label1;
private global::Gtk.Label label2;
private global::Gtk.ScrolledWindow scrolledwindow1;
private global::Gtk.Label addinList;
private global::Gtk.ProgressBar progressBar;
private global::Gtk.Button buttonCancel;
private global::Gtk.Button buttonOk;
protected virtual void Build ()
{
Gui.Initialize (this);
// Widget Mono.Addins.Gui.AddinInstallerDialog
this.Name = "Mono.Addins.Gui.AddinInstallerDialog";
this.Title = global::Mono.Unix.Catalog.GetString ("Extension Manager");
this.WindowPosition = ((global::Gtk.WindowPosition)(4));
this.BorderWidth = ((uint)(6));
// Internal child Mono.Addins.Gui.AddinInstallerDialog.VBox
global::Gtk.VBox w1 = this.VBox;
w1.Name = "dialog1_VBox";
w1.Spacing = 6;
w1.BorderWidth = ((uint)(2));
// Container child dialog1_VBox.Gtk.Box+BoxChild
this.vbox2 = new global::Gtk.VBox ();
this.vbox2.Name = "vbox2";
this.vbox2.Spacing = 6;
this.vbox2.BorderWidth = ((uint)(6));
// Container child vbox2.Gtk.Box+BoxChild
this.label1 = new global::Gtk.Label ();
this.label1.Name = "label1";
this.label1.Xalign = 0F;
this.label1.LabelProp = global::Mono.Unix.Catalog.GetString ("Additional extension packages are required to perform this operation.");
this.vbox2.Add (this.label1);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.label1]));
w2.Position = 0;
w2.Expand = false;
w2.Fill = false;
// Container child vbox2.Gtk.Box+BoxChild
this.label2 = new global::Gtk.Label ();
this.label2.Name = "label2";
this.label2.Xalign = 0F;
this.label2.LabelProp = global::Mono.Unix.Catalog.GetString ("The following extension packages will be installed:");
this.vbox2.Add (this.label2);
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.label2]));
w3.Position = 1;
w3.Expand = false;
w3.Fill = false;
// Container child vbox2.Gtk.Box+BoxChild
this.scrolledwindow1 = new global::Gtk.ScrolledWindow ();
this.scrolledwindow1.CanFocus = true;
this.scrolledwindow1.Name = "scrolledwindow1";
this.scrolledwindow1.ShadowType = ((global::Gtk.ShadowType)(1));
// Container child scrolledwindow1.Gtk.Container+ContainerChild
global::Gtk.Viewport w4 = new global::Gtk.Viewport ();
w4.ShadowType = ((global::Gtk.ShadowType)(0));
// Container child GtkViewport.Gtk.Container+ContainerChild
this.addinList = new global::Gtk.Label ();
this.addinList.Name = "addinList";
this.addinList.Xpad = 6;
this.addinList.Ypad = 6;
this.addinList.Xalign = 0F;
this.addinList.Yalign = 0F;
this.addinList.LabelProp = "label3";
w4.Add (this.addinList);
this.scrolledwindow1.Add (w4);
this.vbox2.Add (this.scrolledwindow1);
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.scrolledwindow1]));
w7.Position = 2;
// Container child vbox2.Gtk.Box+BoxChild
this.progressBar = new global::Gtk.ProgressBar ();
this.progressBar.Name = "progressBar";
this.progressBar.Text = "";
this.vbox2.Add (this.progressBar);
global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.progressBar]));
w8.Position = 3;
w8.Expand = false;
w8.Fill = false;
w1.Add (this.vbox2);
global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox2]));
w9.Position = 0;
// Internal child Mono.Addins.Gui.AddinInstallerDialog.ActionArea
global::Gtk.HButtonBox w10 = this.ActionArea;
w10.Name = "dialog1_ActionArea";
w10.Spacing = 10;
w10.BorderWidth = ((uint)(6));
w10.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.buttonCancel = new global::Gtk.Button ();
this.buttonCancel.CanDefault = true;
this.buttonCancel.CanFocus = true;
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.UseStock = true;
this.buttonCancel.UseUnderline = true;
this.buttonCancel.Label = "gtk-cancel";
this.AddActionWidget (this.buttonCancel, -6);
global::Gtk.ButtonBox.ButtonBoxChild w11 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w10 [this.buttonCancel]));
w11.Expand = false;
w11.Fill = false;
// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.buttonOk = new global::Gtk.Button ();
this.buttonOk.CanDefault = true;
this.buttonOk.CanFocus = true;
this.buttonOk.Name = "buttonOk";
this.buttonOk.UseStock = true;
this.buttonOk.UseUnderline = true;
this.buttonOk.Label = "gtk-ok";
w10.Add (this.buttonOk);
global::Gtk.ButtonBox.ButtonBoxChild w12 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w10 [this.buttonOk]));
w12.Position = 1;
w12.Expand = false;
w12.Fill = false;
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.DefaultWidth = 593;
this.DefaultHeight = 433;
this.progressBar.Hide ();
this.Show ();
this.buttonOk.Clicked += new global::System.EventHandler (this.OnButtonOkClicked);
}
}
}
@@ -0,0 +1,381 @@
// This file has been generated by the GUI designer. Do not modify.
namespace Mono.Addins.Gui
{
internal partial class AddinManagerDialog
{
private global::Gtk.VBox vbox93;
private global::Gtk.HBox hbox65;
private global::Gtk.HBox hbox72;
private global::Gtk.Notebook notebook;
private global::Gtk.HBox hbox2;
private global::Gtk.VBox vbox6;
private global::Gtk.ScrolledWindow scrolledwindow13;
private global::Gtk.TreeView addinTree;
private global::Gtk.EventBox eventbox2;
private global::Mono.Addins.Gui.AddinInfoView addininfoInstalled;
private global::Gtk.Label label7;
private global::Gtk.HBox boxUpdates;
private global::Gtk.VBox vboxUpdates;
private global::Gtk.EventBox eboxRepoUpdates;
private global::Gtk.HBox hbox67;
private global::Gtk.Label labelUpdates;
private global::Gtk.Button buttonRefreshUpdates;
private global::Gtk.Button buttonUpdateAll;
private global::Gtk.ScrolledWindow scrolledUpdates;
private global::Gtk.TreeView updatesTreeView;
private global::Gtk.EventBox eventbox3;
private global::Mono.Addins.Gui.AddinInfoView addininfoUpdates;
private global::Gtk.Label label4;
private global::Gtk.HBox hbox8;
private global::Gtk.VBox vboxGallery;
private global::Gtk.EventBox eboxRepo;
private global::Gtk.HBox hbox66;
private global::Gtk.Label label112;
private global::Gtk.ComboBox repoCombo;
private global::Gtk.Button buttonRefresh;
private global::Gtk.ScrolledWindow scrolledGallery;
private global::Gtk.TreeView galleryTreeView;
private global::Gtk.EventBox eventbox1;
private global::Mono.Addins.Gui.AddinInfoView addininfoGallery;
private global::Gtk.Label label8;
private global::Gtk.Button buttonInstallFromFile;
private global::Gtk.Button btnClose;
protected virtual void Build ()
{
Gui.Initialize (this);
// Widget Mono.Addins.Gui.AddinManagerDialog
this.Name = "Mono.Addins.Gui.AddinManagerDialog";
this.Title = global::Mono.Unix.Catalog.GetString ("Extension Manager");
this.TypeHint = ((global::Gdk.WindowTypeHint)(1));
this.BorderWidth = ((uint)(6));
this.DefaultWidth = 700;
this.DefaultHeight = 550;
// Internal child Mono.Addins.Gui.AddinManagerDialog.VBox
global::Gtk.VBox w1 = this.VBox;
w1.Name = "dialog-vbox8";
w1.Spacing = 3;
w1.BorderWidth = ((uint)(2));
// Container child dialog-vbox8.Gtk.Box+BoxChild
this.vbox93 = new global::Gtk.VBox ();
this.vbox93.Name = "vbox93";
this.vbox93.Spacing = 6;
this.vbox93.BorderWidth = ((uint)(6));
// Container child vbox93.Gtk.Box+BoxChild
this.hbox65 = new global::Gtk.HBox ();
this.hbox65.Name = "hbox65";
this.hbox65.Spacing = 12;
// Container child hbox65.Gtk.Box+BoxChild
this.hbox72 = new global::Gtk.HBox ();
this.hbox72.Name = "hbox72";
this.hbox72.Spacing = 12;
// Container child hbox72.Gtk.Box+BoxChild
this.notebook = new global::Gtk.Notebook ();
this.notebook.CanFocus = true;
this.notebook.Name = "notebook";
this.notebook.CurrentPage = 0;
this.notebook.ShowBorder = false;
// Container child notebook.Gtk.Notebook+NotebookChild
this.hbox2 = new global::Gtk.HBox ();
this.hbox2.Name = "hbox2";
this.hbox2.Spacing = 9;
this.hbox2.BorderWidth = ((uint)(9));
// Container child hbox2.Gtk.Box+BoxChild
this.vbox6 = new global::Gtk.VBox ();
this.vbox6.Name = "vbox6";
this.vbox6.Spacing = 6;
// Container child vbox6.Gtk.Box+BoxChild
this.scrolledwindow13 = new global::Gtk.ScrolledWindow ();
this.scrolledwindow13.CanFocus = true;
this.scrolledwindow13.Name = "scrolledwindow13";
this.scrolledwindow13.ShadowType = ((global::Gtk.ShadowType)(1));
// Container child scrolledwindow13.Gtk.Container+ContainerChild
this.addinTree = new global::Gtk.TreeView ();
this.addinTree.CanFocus = true;
this.addinTree.Name = "addinTree";
this.scrolledwindow13.Add (this.addinTree);
this.vbox6.Add (this.scrolledwindow13);
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox6 [this.scrolledwindow13]));
w3.Position = 0;
this.hbox2.Add (this.vbox6);
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.vbox6]));
w4.Position = 0;
// Container child hbox2.Gtk.Box+BoxChild
this.eventbox2 = new global::Gtk.EventBox ();
this.eventbox2.Name = "eventbox2";
// Container child eventbox2.Gtk.Container+ContainerChild
this.addininfoInstalled = new global::Mono.Addins.Gui.AddinInfoView ();
this.addininfoInstalled.Events = ((global::Gdk.EventMask)(256));
this.addininfoInstalled.Name = "addininfoInstalled";
this.addininfoInstalled.AllowInstall = false;
this.eventbox2.Add (this.addininfoInstalled);
this.hbox2.Add (this.eventbox2);
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.eventbox2]));
w6.Position = 1;
w6.Expand = false;
w6.Fill = false;
this.notebook.Add (this.hbox2);
// Notebook tab
this.label7 = new global::Gtk.Label ();
this.label7.Name = "label7";
this.label7.LabelProp = global::Mono.Unix.Catalog.GetString ("Installed");
this.notebook.SetTabLabel (this.hbox2, this.label7);
this.label7.ShowAll ();
// Container child notebook.Gtk.Notebook+NotebookChild
this.boxUpdates = new global::Gtk.HBox ();
this.boxUpdates.Name = "boxUpdates";
this.boxUpdates.Spacing = 9;
this.boxUpdates.BorderWidth = ((uint)(9));
// Container child boxUpdates.Gtk.Box+BoxChild
this.vboxUpdates = new global::Gtk.VBox ();
this.vboxUpdates.Name = "vboxUpdates";
// Container child vboxUpdates.Gtk.Box+BoxChild
this.eboxRepoUpdates = new global::Gtk.EventBox ();
this.eboxRepoUpdates.Name = "eboxRepoUpdates";
// Container child eboxRepoUpdates.Gtk.Container+ContainerChild
this.hbox67 = new global::Gtk.HBox ();
this.hbox67.Name = "hbox67";
this.hbox67.Spacing = 6;
// Container child hbox67.Gtk.Box+BoxChild
this.labelUpdates = new global::Gtk.Label ();
this.labelUpdates.Name = "labelUpdates";
this.labelUpdates.LabelProp = global::Mono.Unix.Catalog.GetString ("No updates found");
this.hbox67.Add (this.labelUpdates);
global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.hbox67 [this.labelUpdates]));
w8.Position = 0;
w8.Expand = false;
w8.Fill = false;
// Container child hbox67.Gtk.Box+BoxChild
this.buttonRefreshUpdates = new global::Gtk.Button ();
this.buttonRefreshUpdates.CanFocus = true;
this.buttonRefreshUpdates.Name = "buttonRefreshUpdates";
this.buttonRefreshUpdates.UseUnderline = true;
this.buttonRefreshUpdates.Relief = ((global::Gtk.ReliefStyle)(2));
this.buttonRefreshUpdates.Label = global::Mono.Unix.Catalog.GetString ("Refresh");
global::Gtk.Image w9 = new global::Gtk.Image ();
w9.Pixbuf = IconLoader.LoadIcon (this, "gtk-refresh", global::Gtk.IconSize.Menu);
this.buttonRefreshUpdates.Image = w9;
this.hbox67.Add (this.buttonRefreshUpdates);
global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox67 [this.buttonRefreshUpdates]));
w10.PackType = ((global::Gtk.PackType)(1));
w10.Position = 1;
w10.Expand = false;
w10.Fill = false;
// Container child hbox67.Gtk.Box+BoxChild
this.buttonUpdateAll = new global::Gtk.Button ();
this.buttonUpdateAll.CanFocus = true;
this.buttonUpdateAll.Name = "buttonUpdateAll";
this.buttonUpdateAll.UseUnderline = true;
this.buttonUpdateAll.Relief = ((global::Gtk.ReliefStyle)(2));
this.buttonUpdateAll.Label = global::Mono.Unix.Catalog.GetString ("Update All");
global::Gtk.Image w11 = new global::Gtk.Image ();
w11.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("download-16.png");
this.buttonUpdateAll.Image = w11;
this.hbox67.Add (this.buttonUpdateAll);
global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.hbox67 [this.buttonUpdateAll]));
w12.PackType = ((global::Gtk.PackType)(1));
w12.Position = 2;
w12.Expand = false;
w12.Fill = false;
this.eboxRepoUpdates.Add (this.hbox67);
this.vboxUpdates.Add (this.eboxRepoUpdates);
global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.vboxUpdates [this.eboxRepoUpdates]));
w14.Position = 0;
w14.Expand = false;
w14.Fill = false;
// Container child vboxUpdates.Gtk.Box+BoxChild
this.scrolledUpdates = new global::Gtk.ScrolledWindow ();
this.scrolledUpdates.CanFocus = true;
this.scrolledUpdates.Name = "scrolledUpdates";
this.scrolledUpdates.ShadowType = ((global::Gtk.ShadowType)(1));
// Container child scrolledUpdates.Gtk.Container+ContainerChild
this.updatesTreeView = new global::Gtk.TreeView ();
this.updatesTreeView.CanFocus = true;
this.updatesTreeView.Name = "updatesTreeView";
this.scrolledUpdates.Add (this.updatesTreeView);
this.vboxUpdates.Add (this.scrolledUpdates);
global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.vboxUpdates [this.scrolledUpdates]));
w16.Position = 1;
this.boxUpdates.Add (this.vboxUpdates);
global::Gtk.Box.BoxChild w17 = ((global::Gtk.Box.BoxChild)(this.boxUpdates [this.vboxUpdates]));
w17.Position = 0;
// Container child boxUpdates.Gtk.Box+BoxChild
this.eventbox3 = new global::Gtk.EventBox ();
this.eventbox3.Name = "eventbox3";
// Container child eventbox3.Gtk.Container+ContainerChild
this.addininfoUpdates = new global::Mono.Addins.Gui.AddinInfoView ();
this.addininfoUpdates.Events = ((global::Gdk.EventMask)(256));
this.addininfoUpdates.Name = "addininfoUpdates";
this.addininfoUpdates.AllowInstall = false;
this.eventbox3.Add (this.addininfoUpdates);
this.boxUpdates.Add (this.eventbox3);
global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.boxUpdates [this.eventbox3]));
w19.Position = 1;
w19.Expand = false;
w19.Fill = false;
this.notebook.Add (this.boxUpdates);
global::Gtk.Notebook.NotebookChild w20 = ((global::Gtk.Notebook.NotebookChild)(this.notebook [this.boxUpdates]));
w20.Position = 1;
// Notebook tab
this.label4 = new global::Gtk.Label ();
this.label4.Name = "label4";
this.label4.LabelProp = global::Mono.Unix.Catalog.GetString ("Updates");
this.notebook.SetTabLabel (this.boxUpdates, this.label4);
this.label4.ShowAll ();
// Container child notebook.Gtk.Notebook+NotebookChild
this.hbox8 = new global::Gtk.HBox ();
this.hbox8.Name = "hbox8";
this.hbox8.Spacing = 9;
this.hbox8.BorderWidth = ((uint)(9));
// Container child hbox8.Gtk.Box+BoxChild
this.vboxGallery = new global::Gtk.VBox ();
this.vboxGallery.Name = "vboxGallery";
// Container child vboxGallery.Gtk.Box+BoxChild
this.eboxRepo = new global::Gtk.EventBox ();
this.eboxRepo.Name = "eboxRepo";
// Container child eboxRepo.Gtk.Container+ContainerChild
this.hbox66 = new global::Gtk.HBox ();
this.hbox66.Name = "hbox66";
this.hbox66.Spacing = 6;
// Container child hbox66.Gtk.Box+BoxChild
this.label112 = new global::Gtk.Label ();
this.label112.Name = "label112";
this.label112.LabelProp = global::Mono.Unix.Catalog.GetString ("Repository:");
this.hbox66.Add (this.label112);
global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.hbox66 [this.label112]));
w21.Position = 0;
w21.Expand = false;
w21.Fill = false;
// Container child hbox66.Gtk.Box+BoxChild
this.repoCombo = new global::Gtk.ComboBox ();
this.repoCombo.Name = "repoCombo";
this.hbox66.Add (this.repoCombo);
global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.hbox66 [this.repoCombo]));
w22.Position = 1;
// Container child hbox66.Gtk.Box+BoxChild
this.buttonRefresh = new global::Gtk.Button ();
this.buttonRefresh.CanFocus = true;
this.buttonRefresh.Name = "buttonRefresh";
this.buttonRefresh.UseUnderline = true;
this.buttonRefresh.Relief = ((global::Gtk.ReliefStyle)(2));
this.buttonRefresh.Label = global::Mono.Unix.Catalog.GetString ("Refresh");
global::Gtk.Image w23 = new global::Gtk.Image ();
w23.Pixbuf = IconLoader.LoadIcon (this, "gtk-refresh", global::Gtk.IconSize.Menu);
this.buttonRefresh.Image = w23;
this.hbox66.Add (this.buttonRefresh);
global::Gtk.Box.BoxChild w24 = ((global::Gtk.Box.BoxChild)(this.hbox66 [this.buttonRefresh]));
w24.Position = 2;
w24.Expand = false;
w24.Fill = false;
this.eboxRepo.Add (this.hbox66);
this.vboxGallery.Add (this.eboxRepo);
global::Gtk.Box.BoxChild w26 = ((global::Gtk.Box.BoxChild)(this.vboxGallery [this.eboxRepo]));
w26.Position = 0;
w26.Expand = false;
w26.Fill = false;
// Container child vboxGallery.Gtk.Box+BoxChild
this.scrolledGallery = new global::Gtk.ScrolledWindow ();
this.scrolledGallery.CanFocus = true;
this.scrolledGallery.Name = "scrolledGallery";
this.scrolledGallery.ShadowType = ((global::Gtk.ShadowType)(1));
// Container child scrolledGallery.Gtk.Container+ContainerChild
this.galleryTreeView = new global::Gtk.TreeView ();
this.galleryTreeView.CanFocus = true;
this.galleryTreeView.Name = "galleryTreeView";
this.scrolledGallery.Add (this.galleryTreeView);
this.vboxGallery.Add (this.scrolledGallery);
global::Gtk.Box.BoxChild w28 = ((global::Gtk.Box.BoxChild)(this.vboxGallery [this.scrolledGallery]));
w28.Position = 1;
this.hbox8.Add (this.vboxGallery);
global::Gtk.Box.BoxChild w29 = ((global::Gtk.Box.BoxChild)(this.hbox8 [this.vboxGallery]));
w29.Position = 0;
// Container child hbox8.Gtk.Box+BoxChild
this.eventbox1 = new global::Gtk.EventBox ();
this.eventbox1.Name = "eventbox1";
// Container child eventbox1.Gtk.Container+ContainerChild
this.addininfoGallery = new global::Mono.Addins.Gui.AddinInfoView ();
this.addininfoGallery.Events = ((global::Gdk.EventMask)(256));
this.addininfoGallery.Name = "addininfoGallery";
this.addininfoGallery.AllowInstall = false;
this.eventbox1.Add (this.addininfoGallery);
this.hbox8.Add (this.eventbox1);
global::Gtk.Box.BoxChild w31 = ((global::Gtk.Box.BoxChild)(this.hbox8 [this.eventbox1]));
w31.Position = 1;
w31.Expand = false;
w31.Fill = false;
this.notebook.Add (this.hbox8);
global::Gtk.Notebook.NotebookChild w32 = ((global::Gtk.Notebook.NotebookChild)(this.notebook [this.hbox8]));
w32.Position = 2;
// Notebook tab
this.label8 = new global::Gtk.Label ();
this.label8.Name = "label8";
this.label8.LabelProp = global::Mono.Unix.Catalog.GetString ("Gallery");
this.notebook.SetTabLabel (this.hbox8, this.label8);
this.label8.ShowAll ();
this.hbox72.Add (this.notebook);
global::Gtk.Box.BoxChild w33 = ((global::Gtk.Box.BoxChild)(this.hbox72 [this.notebook]));
w33.Position = 0;
this.hbox65.Add (this.hbox72);
global::Gtk.Box.BoxChild w34 = ((global::Gtk.Box.BoxChild)(this.hbox65 [this.hbox72]));
w34.Position = 0;
this.vbox93.Add (this.hbox65);
global::Gtk.Box.BoxChild w35 = ((global::Gtk.Box.BoxChild)(this.vbox93 [this.hbox65]));
w35.Position = 0;
w1.Add (this.vbox93);
global::Gtk.Box.BoxChild w36 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox93]));
w36.Position = 0;
// Internal child Mono.Addins.Gui.AddinManagerDialog.ActionArea
global::Gtk.HButtonBox w37 = this.ActionArea;
w37.Name = "dialog-action_area8";
w37.Spacing = 6;
w37.BorderWidth = ((uint)(5));
w37.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(2));
// Container child dialog-action_area8.Gtk.ButtonBox+ButtonBoxChild
this.buttonInstallFromFile = new global::Gtk.Button ();
this.buttonInstallFromFile.CanFocus = true;
this.buttonInstallFromFile.Name = "buttonInstallFromFile";
this.buttonInstallFromFile.UseUnderline = true;
this.buttonInstallFromFile.Label = global::Mono.Unix.Catalog.GetString ("Install from file...");
w37.Add (this.buttonInstallFromFile);
global::Gtk.ButtonBox.ButtonBoxChild w38 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w37 [this.buttonInstallFromFile]));
w38.Expand = false;
w38.Fill = false;
// Container child dialog-action_area8.Gtk.ButtonBox+ButtonBoxChild
this.btnClose = new global::Gtk.Button ();
this.btnClose.CanDefault = true;
this.btnClose.CanFocus = true;
this.btnClose.Name = "btnClose";
this.btnClose.UseStock = true;
this.btnClose.UseUnderline = true;
this.btnClose.Label = "gtk-close";
this.AddActionWidget (this.btnClose, -7);
global::Gtk.ButtonBox.ButtonBoxChild w39 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w37 [this.btnClose]));
w39.Position = 1;
w39.Expand = false;
w39.Fill = false;
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.Hide ();
this.notebook.SwitchPage += new global::Gtk.SwitchPageHandler (this.OnNotebookSwitchPage);
this.addininfoInstalled.InstallClicked += new global::System.EventHandler (this.OnInstallClicked);
this.addininfoInstalled.UninstallClicked += new global::System.EventHandler (this.OnUninstallClicked);
this.addininfoInstalled.UpdateClicked += new global::System.EventHandler (this.OnUpdateClicked);
this.addininfoInstalled.EnableDisableClicked += new global::System.EventHandler (this.OnEnableDisableClicked);
this.buttonUpdateAll.Clicked += new global::System.EventHandler (this.OnUpdateAll);
this.buttonRefreshUpdates.Clicked += new global::System.EventHandler (this.OnButtonRefreshClicked);
this.addininfoUpdates.InstallClicked += new global::System.EventHandler (this.OnInstallClicked);
this.addininfoUpdates.UninstallClicked += new global::System.EventHandler (this.OnUninstallClicked);
this.addininfoUpdates.UpdateClicked += new global::System.EventHandler (this.OnUpdateClicked);
this.addininfoUpdates.EnableDisableClicked += new global::System.EventHandler (this.OnEnableDisableClicked);
this.repoCombo.Changed += new global::System.EventHandler (this.OnRepoComboChanged);
this.buttonRefresh.Clicked += new global::System.EventHandler (this.OnButtonRefreshClicked);
this.addininfoGallery.InstallClicked += new global::System.EventHandler (this.OnInstallClicked);
this.addininfoGallery.UninstallClicked += new global::System.EventHandler (this.OnUninstallClicked);
this.addininfoGallery.UpdateClicked += new global::System.EventHandler (this.OnUpdateClicked);
this.addininfoGallery.EnableDisableClicked += new global::System.EventHandler (this.OnEnableDisableClicked);
this.buttonInstallFromFile.Clicked += new global::System.EventHandler (this.OnButtonInstallFromFileClicked);
}
}
}
@@ -0,0 +1,129 @@
// This file has been generated by the GUI designer. Do not modify.
namespace Mono.Addins.Gui
{
internal partial class ErrorDialog
{
private global::Gtk.HBox hbox59;
private global::Gtk.VBox vbox72;
private global::Gtk.Image icon;
private global::Gtk.VBox vbox73;
private global::Gtk.Label descriptionLabel;
private global::Gtk.Expander expander;
private global::Gtk.ScrolledWindow scrolledwindow10;
private global::Gtk.TextView detailsTextView;
private global::Gtk.Label label102;
private global::Gtk.Button okButton;
protected virtual void Build ()
{
Gui.Initialize (this);
// Widget Mono.Addins.Gui.ErrorDialog
this.Name = "Mono.Addins.Gui.ErrorDialog";
this.Title = global::Mono.Unix.Catalog.GetString ("Error");
this.TypeHint = ((global::Gdk.WindowTypeHint)(1));
this.BorderWidth = ((uint)(6));
// Internal child Mono.Addins.Gui.ErrorDialog.VBox
global::Gtk.VBox w1 = this.VBox;
w1.Name = "dialog-vbox5";
w1.Spacing = 6;
// Container child dialog-vbox5.Gtk.Box+BoxChild
this.hbox59 = new global::Gtk.HBox ();
this.hbox59.Name = "hbox59";
this.hbox59.Spacing = 6;
this.hbox59.BorderWidth = ((uint)(6));
// Container child hbox59.Gtk.Box+BoxChild
this.vbox72 = new global::Gtk.VBox ();
this.vbox72.Name = "vbox72";
// Container child vbox72.Gtk.Box+BoxChild
this.icon = new global::Gtk.Image ();
this.icon.Name = "icon";
this.icon.Pixbuf = IconLoader.LoadIcon (this, "gtk-dialog-error", global::Gtk.IconSize.Dialog);
this.vbox72.Add (this.icon);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox72 [this.icon]));
w2.Position = 0;
w2.Expand = false;
w2.Fill = false;
this.hbox59.Add (this.vbox72);
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox59 [this.vbox72]));
w3.Position = 0;
w3.Expand = false;
w3.Fill = false;
// Container child hbox59.Gtk.Box+BoxChild
this.vbox73 = new global::Gtk.VBox ();
this.vbox73.Name = "vbox73";
this.vbox73.Spacing = 12;
// Container child vbox73.Gtk.Box+BoxChild
this.descriptionLabel = new global::Gtk.Label ();
this.descriptionLabel.WidthRequest = 540;
this.descriptionLabel.CanFocus = true;
this.descriptionLabel.Name = "descriptionLabel";
this.descriptionLabel.Xalign = 0F;
this.descriptionLabel.LabelProp = "An exception has been thrown 1 2 3 4 5 6 7 8 9 10 11 12 13 14";
this.descriptionLabel.Wrap = true;
this.descriptionLabel.Selectable = true;
this.vbox73.Add (this.descriptionLabel);
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox73 [this.descriptionLabel]));
w4.Position = 0;
w4.Expand = false;
w4.Fill = false;
// Container child vbox73.Gtk.Box+BoxChild
this.expander = new global::Gtk.Expander (null);
this.expander.CanFocus = true;
this.expander.Name = "expander";
// Container child expander.Gtk.Container+ContainerChild
this.scrolledwindow10 = new global::Gtk.ScrolledWindow ();
this.scrolledwindow10.CanFocus = true;
this.scrolledwindow10.Name = "scrolledwindow10";
this.scrolledwindow10.ShadowType = ((global::Gtk.ShadowType)(1));
// Container child scrolledwindow10.Gtk.Container+ContainerChild
this.detailsTextView = new global::Gtk.TextView ();
this.detailsTextView.HeightRequest = 250;
this.detailsTextView.CanFocus = true;
this.detailsTextView.Name = "detailsTextView";
this.detailsTextView.PixelsAboveLines = 2;
this.detailsTextView.PixelsBelowLines = 2;
this.detailsTextView.LeftMargin = 6;
this.detailsTextView.RightMargin = 6;
this.scrolledwindow10.Add (this.detailsTextView);
this.expander.Add (this.scrolledwindow10);
this.label102 = new global::Gtk.Label ();
this.label102.Name = "label102";
this.label102.LabelProp = global::Mono.Unix.Catalog.GetString ("Details");
this.expander.LabelWidget = this.label102;
this.vbox73.Add (this.expander);
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox73 [this.expander]));
w7.Position = 1;
this.hbox59.Add (this.vbox73);
global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.hbox59 [this.vbox73]));
w8.Position = 1;
w1.Add (this.hbox59);
global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(w1 [this.hbox59]));
w9.Position = 0;
// Internal child Mono.Addins.Gui.ErrorDialog.ActionArea
global::Gtk.HButtonBox w10 = this.ActionArea;
w10.Name = "dialog-action_area5";
w10.Spacing = 10;
w10.BorderWidth = ((uint)(5));
w10.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
// Container child dialog-action_area5.Gtk.ButtonBox+ButtonBoxChild
this.okButton = new global::Gtk.Button ();
this.okButton.CanDefault = true;
this.okButton.CanFocus = true;
this.okButton.Name = "okButton";
this.okButton.UseStock = true;
this.okButton.UseUnderline = true;
this.okButton.Label = "gtk-ok";
this.AddActionWidget (this.okButton, -5);
global::Gtk.ButtonBox.ButtonBoxChild w11 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w10 [this.okButton]));
w11.Expand = false;
w11.Fill = false;
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.DefaultWidth = 632;
this.DefaultHeight = 155;
this.Show ();
}
}
}
@@ -0,0 +1,143 @@
// This file has been generated by the GUI designer. Do not modify.
namespace Mono.Addins.Gui
{
internal partial class InstallDialog
{
private global::Gtk.VBox vbox3;
private global::Gtk.ScrolledWindow scrolledwindow1;
private global::Gtk.VBox vbox4;
private global::Gtk.Label labelInfo;
private global::Gtk.HSeparator insSeparator;
private global::Gtk.VBox boxProgress;
private global::Gtk.Label globalProgressLabel;
private global::Gtk.ProgressBar mainProgressBar;
private global::Gtk.Button buttonCancel;
private global::Gtk.Button buttonOk;
protected virtual void Build ()
{
Gui.Initialize (this);
// Widget Mono.Addins.Gui.InstallDialog
this.Name = "Mono.Addins.Gui.InstallDialog";
this.WindowPosition = ((global::Gtk.WindowPosition)(4));
// Internal child Mono.Addins.Gui.InstallDialog.VBox
global::Gtk.VBox w1 = this.VBox;
w1.Name = "dialog1_VBox";
w1.BorderWidth = ((uint)(2));
// Container child dialog1_VBox.Gtk.Box+BoxChild
this.vbox3 = new global::Gtk.VBox ();
this.vbox3.Name = "vbox3";
this.vbox3.Spacing = 9;
this.vbox3.BorderWidth = ((uint)(9));
// Container child vbox3.Gtk.Box+BoxChild
this.scrolledwindow1 = new global::Gtk.ScrolledWindow ();
this.scrolledwindow1.CanFocus = true;
this.scrolledwindow1.Name = "scrolledwindow1";
this.scrolledwindow1.VscrollbarPolicy = ((global::Gtk.PolicyType)(2));
this.scrolledwindow1.HscrollbarPolicy = ((global::Gtk.PolicyType)(2));
// Container child scrolledwindow1.Gtk.Container+ContainerChild
global::Gtk.Viewport w2 = new global::Gtk.Viewport ();
w2.ShadowType = ((global::Gtk.ShadowType)(0));
// Container child GtkViewport.Gtk.Container+ContainerChild
this.vbox4 = new global::Gtk.VBox ();
this.vbox4.Name = "vbox4";
this.vbox4.Spacing = 6;
// Container child vbox4.Gtk.Box+BoxChild
this.labelInfo = new global::Gtk.Label ();
this.labelInfo.WidthRequest = 400;
this.labelInfo.Name = "labelInfo";
this.labelInfo.Xalign = 0F;
this.labelInfo.Yalign = 0F;
this.labelInfo.LabelProp = global::Mono.Unix.Catalog.GetString ("label3");
this.labelInfo.Wrap = true;
this.vbox4.Add (this.labelInfo);
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.labelInfo]));
w3.Position = 0;
w3.Expand = false;
w3.Fill = false;
w2.Add (this.vbox4);
this.scrolledwindow1.Add (w2);
this.vbox3.Add (this.scrolledwindow1);
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.scrolledwindow1]));
w6.Position = 0;
// Container child vbox3.Gtk.Box+BoxChild
this.insSeparator = new global::Gtk.HSeparator ();
this.insSeparator.Name = "insSeparator";
this.vbox3.Add (this.insSeparator);
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.insSeparator]));
w7.Position = 1;
w7.Expand = false;
w7.Fill = false;
// Container child vbox3.Gtk.Box+BoxChild
this.boxProgress = new global::Gtk.VBox ();
this.boxProgress.Name = "boxProgress";
this.boxProgress.Spacing = 6;
// Container child boxProgress.Gtk.Box+BoxChild
this.globalProgressLabel = new global::Gtk.Label ();
this.globalProgressLabel.Name = "globalProgressLabel";
this.globalProgressLabel.Xalign = 0F;
this.globalProgressLabel.Ellipsize = ((global::Pango.EllipsizeMode)(3));
this.boxProgress.Add (this.globalProgressLabel);
global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.boxProgress [this.globalProgressLabel]));
w8.Position = 0;
w8.Expand = false;
w8.Fill = false;
// Container child boxProgress.Gtk.Box+BoxChild
this.mainProgressBar = new global::Gtk.ProgressBar ();
this.mainProgressBar.Name = "mainProgressBar";
this.boxProgress.Add (this.mainProgressBar);
global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.boxProgress [this.mainProgressBar]));
w9.Position = 1;
w9.Expand = false;
w9.Fill = false;
this.vbox3.Add (this.boxProgress);
global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.boxProgress]));
w10.Position = 2;
w10.Expand = false;
w10.Fill = false;
w1.Add (this.vbox3);
global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox3]));
w11.Position = 0;
// Internal child Mono.Addins.Gui.InstallDialog.ActionArea
global::Gtk.HButtonBox w12 = this.ActionArea;
w12.Name = "dialog1_ActionArea";
w12.Spacing = 10;
w12.BorderWidth = ((uint)(5));
w12.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.buttonCancel = new global::Gtk.Button ();
this.buttonCancel.CanDefault = true;
this.buttonCancel.CanFocus = true;
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.UseStock = true;
this.buttonCancel.UseUnderline = true;
this.buttonCancel.Label = "gtk-cancel";
w12.Add (this.buttonCancel);
global::Gtk.ButtonBox.ButtonBoxChild w13 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w12 [this.buttonCancel]));
w13.Expand = false;
w13.Fill = false;
// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.buttonOk = new global::Gtk.Button ();
this.buttonOk.CanDefault = true;
this.buttonOk.CanFocus = true;
this.buttonOk.Name = "buttonOk";
this.buttonOk.UseUnderline = true;
this.buttonOk.Label = global::Mono.Unix.Catalog.GetString ("Install");
w12.Add (this.buttonOk);
global::Gtk.ButtonBox.ButtonBoxChild w14 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w12 [this.buttonOk]));
w14.Position = 1;
w14.Expand = false;
w14.Fill = false;
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.DefaultWidth = 494;
this.DefaultHeight = 239;
this.insSeparator.Hide ();
this.Hide ();
this.buttonCancel.Clicked += new global::System.EventHandler (this.OnButtonCancelClicked);
this.buttonOk.Clicked += new global::System.EventHandler (this.OnButtonOkClicked);
}
}
}
@@ -0,0 +1,110 @@
// This file has been generated by the GUI designer. Do not modify.
namespace Mono.Addins.Gui
{
internal partial class ManageSitesDialog
{
private global::Gtk.HBox hbox67;
private global::Gtk.ScrolledWindow scrolledwindow17;
private global::Gtk.TreeView repoTree;
private global::Gtk.VBox vbox88;
private global::Gtk.Button btnAdd;
private global::Gtk.Button btnRemove;
private global::Gtk.Button closebutton2;
protected virtual void Build ()
{
Gui.Initialize (this);
// Widget Mono.Addins.Gui.ManageSitesDialog
this.Name = "Mono.Addins.Gui.ManageSitesDialog";
this.Title = global::Mono.Unix.Catalog.GetString ("Extension Repository Management");
this.TypeHint = ((global::Gdk.WindowTypeHint)(1));
this.BorderWidth = ((uint)(6));
this.DefaultWidth = 600;
this.DefaultHeight = 300;
// Internal child Mono.Addins.Gui.ManageSitesDialog.VBox
global::Gtk.VBox w1 = this.VBox;
w1.Name = "dialog-vbox10";
w1.Spacing = 6;
// Container child dialog-vbox10.Gtk.Box+BoxChild
this.hbox67 = new global::Gtk.HBox ();
this.hbox67.Name = "hbox67";
this.hbox67.Spacing = 12;
this.hbox67.BorderWidth = ((uint)(6));
// Container child hbox67.Gtk.Box+BoxChild
this.scrolledwindow17 = new global::Gtk.ScrolledWindow ();
this.scrolledwindow17.CanFocus = true;
this.scrolledwindow17.Name = "scrolledwindow17";
this.scrolledwindow17.ShadowType = ((global::Gtk.ShadowType)(1));
// Container child scrolledwindow17.Gtk.Container+ContainerChild
this.repoTree = new global::Gtk.TreeView ();
this.repoTree.CanFocus = true;
this.repoTree.Name = "repoTree";
this.repoTree.HeadersVisible = false;
this.scrolledwindow17.Add (this.repoTree);
this.hbox67.Add (this.scrolledwindow17);
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox67 [this.scrolledwindow17]));
w3.Position = 0;
// Container child hbox67.Gtk.Box+BoxChild
this.vbox88 = new global::Gtk.VBox ();
this.vbox88.Name = "vbox88";
this.vbox88.Spacing = 6;
// Container child vbox88.Gtk.Box+BoxChild
this.btnAdd = new global::Gtk.Button ();
this.btnAdd.CanFocus = true;
this.btnAdd.Name = "btnAdd";
this.btnAdd.UseStock = true;
this.btnAdd.UseUnderline = true;
this.btnAdd.Label = "gtk-add";
this.vbox88.Add (this.btnAdd);
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox88 [this.btnAdd]));
w4.Position = 0;
w4.Expand = false;
w4.Fill = false;
// Container child vbox88.Gtk.Box+BoxChild
this.btnRemove = new global::Gtk.Button ();
this.btnRemove.CanFocus = true;
this.btnRemove.Name = "btnRemove";
this.btnRemove.UseStock = true;
this.btnRemove.UseUnderline = true;
this.btnRemove.Label = "gtk-delete";
this.vbox88.Add (this.btnRemove);
global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox88 [this.btnRemove]));
w5.Position = 1;
w5.Expand = false;
w5.Fill = false;
this.hbox67.Add (this.vbox88);
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.hbox67 [this.vbox88]));
w6.Position = 1;
w6.Expand = false;
w6.Fill = false;
w1.Add (this.hbox67);
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(w1 [this.hbox67]));
w7.Position = 0;
// Internal child Mono.Addins.Gui.ManageSitesDialog.ActionArea
global::Gtk.HButtonBox w8 = this.ActionArea;
w8.Name = "dialog-action_area10";
w8.Spacing = 10;
w8.BorderWidth = ((uint)(6));
w8.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
// Container child dialog-action_area10.Gtk.ButtonBox+ButtonBoxChild
this.closebutton2 = new global::Gtk.Button ();
this.closebutton2.CanDefault = true;
this.closebutton2.CanFocus = true;
this.closebutton2.Name = "closebutton2";
this.closebutton2.UseStock = true;
this.closebutton2.UseUnderline = true;
this.closebutton2.Label = "gtk-close";
this.AddActionWidget (this.closebutton2, -7);
global::Gtk.ButtonBox.ButtonBoxChild w9 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w8 [this.closebutton2]));
w9.Expand = false;
w9.Fill = false;
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.Hide ();
this.btnAdd.Clicked += new global::System.EventHandler (this.OnAdd);
this.btnRemove.Clicked += new global::System.EventHandler (this.OnRemove);
}
}
}
@@ -0,0 +1,214 @@
// This file has been generated by the GUI designer. Do not modify.
namespace Mono.Addins.Gui
{
internal partial class NewSiteDialog
{
private global::Gtk.VBox vbox89;
private global::Gtk.Label label121;
private global::Gtk.RadioButton btnOnlineRep;
private global::Gtk.HBox hbox68;
private global::Gtk.Label label122;
private global::Gtk.Label label119;
private global::Gtk.Entry urlText;
private global::Gtk.RadioButton btnLocalRep;
private global::Gtk.HBox hbox69;
private global::Gtk.Label label123;
private global::Gtk.Label label120;
private global::Gtk.HBox hbox1;
private global::Gtk.Entry pathEntry;
private global::Gtk.Button buttonBrowse;
private global::Gtk.Button cancelbutton1;
private global::Gtk.Button btnOk;
protected virtual void Build ()
{
Gui.Initialize (this);
// Widget Mono.Addins.Gui.NewSiteDialog
this.Name = "Mono.Addins.Gui.NewSiteDialog";
this.Title = global::Mono.Unix.Catalog.GetString ("Add New Repository");
this.TypeHint = ((global::Gdk.WindowTypeHint)(1));
this.BorderWidth = ((uint)(6));
this.DefaultWidth = 550;
// Internal child Mono.Addins.Gui.NewSiteDialog.VBox
global::Gtk.VBox w1 = this.VBox;
w1.Name = "dialog-vbox11";
w1.Spacing = 6;
w1.BorderWidth = ((uint)(2));
// Container child dialog-vbox11.Gtk.Box+BoxChild
this.vbox89 = new global::Gtk.VBox ();
this.vbox89.Name = "vbox89";
this.vbox89.Spacing = 6;
this.vbox89.BorderWidth = ((uint)(6));
// Container child vbox89.Gtk.Box+BoxChild
this.label121 = new global::Gtk.Label ();
this.label121.Name = "label121";
this.label121.Xalign = 0F;
this.label121.LabelProp = global::Mono.Unix.Catalog.GetString ("Select the location of the repository you want to register:");
this.vbox89.Add (this.label121);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox89 [this.label121]));
w2.Position = 0;
w2.Expand = false;
w2.Fill = false;
// Container child vbox89.Gtk.Box+BoxChild
this.btnOnlineRep = new global::Gtk.RadioButton (global::Mono.Unix.Catalog.GetString ("Register an on-line repository"));
this.btnOnlineRep.CanFocus = true;
this.btnOnlineRep.Name = "btnOnlineRep";
this.btnOnlineRep.Active = true;
this.btnOnlineRep.DrawIndicator = true;
this.btnOnlineRep.UseUnderline = true;
this.btnOnlineRep.Group = new global::GLib.SList (global::System.IntPtr.Zero);
this.vbox89.Add (this.btnOnlineRep);
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox89 [this.btnOnlineRep]));
w3.Position = 1;
w3.Expand = false;
w3.Fill = false;
// Container child vbox89.Gtk.Box+BoxChild
this.hbox68 = new global::Gtk.HBox ();
this.hbox68.Name = "hbox68";
this.hbox68.Spacing = 6;
// Container child hbox68.Gtk.Box+BoxChild
this.label122 = new global::Gtk.Label ();
this.label122.WidthRequest = 32;
this.label122.Name = "label122";
this.hbox68.Add (this.label122);
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox68 [this.label122]));
w4.Position = 0;
w4.Expand = false;
w4.Fill = false;
// Container child hbox68.Gtk.Box+BoxChild
this.label119 = new global::Gtk.Label ();
this.label119.Name = "label119";
this.label119.LabelProp = global::Mono.Unix.Catalog.GetString ("Url:");
this.hbox68.Add (this.label119);
global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.hbox68 [this.label119]));
w5.Position = 1;
w5.Expand = false;
w5.Fill = false;
// Container child hbox68.Gtk.Box+BoxChild
this.urlText = new global::Gtk.Entry ();
this.urlText.CanFocus = true;
this.urlText.Name = "urlText";
this.urlText.IsEditable = true;
this.urlText.InvisibleChar = '●';
this.hbox68.Add (this.urlText);
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.hbox68 [this.urlText]));
w6.Position = 2;
this.vbox89.Add (this.hbox68);
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox89 [this.hbox68]));
w7.Position = 2;
w7.Expand = false;
w7.Fill = false;
// Container child vbox89.Gtk.Box+BoxChild
this.btnLocalRep = new global::Gtk.RadioButton (global::Mono.Unix.Catalog.GetString ("Register a local repository"));
this.btnLocalRep.CanFocus = true;
this.btnLocalRep.Name = "btnLocalRep";
this.btnLocalRep.DrawIndicator = true;
this.btnLocalRep.UseUnderline = true;
this.btnLocalRep.Group = this.btnOnlineRep.Group;
this.vbox89.Add (this.btnLocalRep);
global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox89 [this.btnLocalRep]));
w8.Position = 3;
w8.Expand = false;
w8.Fill = false;
// Container child vbox89.Gtk.Box+BoxChild
this.hbox69 = new global::Gtk.HBox ();
this.hbox69.Name = "hbox69";
this.hbox69.Spacing = 6;
// Container child hbox69.Gtk.Box+BoxChild
this.label123 = new global::Gtk.Label ();
this.label123.WidthRequest = 32;
this.label123.Name = "label123";
this.hbox69.Add (this.label123);
global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.hbox69 [this.label123]));
w9.Position = 0;
w9.Expand = false;
w9.Fill = false;
// Container child hbox69.Gtk.Box+BoxChild
this.label120 = new global::Gtk.Label ();
this.label120.Name = "label120";
this.label120.LabelProp = global::Mono.Unix.Catalog.GetString ("Path:");
this.hbox69.Add (this.label120);
global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox69 [this.label120]));
w10.Position = 1;
w10.Expand = false;
w10.Fill = false;
// Container child hbox69.Gtk.Box+BoxChild
this.hbox1 = new global::Gtk.HBox ();
this.hbox1.Name = "hbox1";
this.hbox1.Spacing = 6;
// Container child hbox1.Gtk.Box+BoxChild
this.pathEntry = new global::Gtk.Entry ();
this.pathEntry.CanFocus = true;
this.pathEntry.Name = "pathEntry";
this.pathEntry.IsEditable = true;
this.pathEntry.InvisibleChar = '●';
this.hbox1.Add (this.pathEntry);
global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.pathEntry]));
w11.Position = 0;
// Container child hbox1.Gtk.Box+BoxChild
this.buttonBrowse = new global::Gtk.Button ();
this.buttonBrowse.CanFocus = true;
this.buttonBrowse.Name = "buttonBrowse";
this.buttonBrowse.UseUnderline = true;
this.buttonBrowse.Label = global::Mono.Unix.Catalog.GetString ("Browse...");
this.hbox1.Add (this.buttonBrowse);
global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.buttonBrowse]));
w12.Position = 1;
w12.Expand = false;
w12.Fill = false;
this.hbox69.Add (this.hbox1);
global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.hbox69 [this.hbox1]));
w13.Position = 2;
this.vbox89.Add (this.hbox69);
global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.vbox89 [this.hbox69]));
w14.Position = 4;
w14.Expand = false;
w14.Fill = false;
w1.Add (this.vbox89);
global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox89]));
w15.Position = 0;
// Internal child Mono.Addins.Gui.NewSiteDialog.ActionArea
global::Gtk.HButtonBox w16 = this.ActionArea;
w16.Name = "dialog-action_area11";
w16.Spacing = 10;
w16.BorderWidth = ((uint)(5));
w16.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
// Container child dialog-action_area11.Gtk.ButtonBox+ButtonBoxChild
this.cancelbutton1 = new global::Gtk.Button ();
this.cancelbutton1.CanDefault = true;
this.cancelbutton1.CanFocus = true;
this.cancelbutton1.Name = "cancelbutton1";
this.cancelbutton1.UseStock = true;
this.cancelbutton1.UseUnderline = true;
this.cancelbutton1.Label = "gtk-cancel";
this.AddActionWidget (this.cancelbutton1, -6);
global::Gtk.ButtonBox.ButtonBoxChild w17 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w16 [this.cancelbutton1]));
w17.Expand = false;
w17.Fill = false;
// Container child dialog-action_area11.Gtk.ButtonBox+ButtonBoxChild
this.btnOk = new global::Gtk.Button ();
this.btnOk.CanDefault = true;
this.btnOk.CanFocus = true;
this.btnOk.Name = "btnOk";
this.btnOk.UseStock = true;
this.btnOk.UseUnderline = true;
this.btnOk.Label = "gtk-ok";
this.AddActionWidget (this.btnOk, -5);
global::Gtk.ButtonBox.ButtonBoxChild w18 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w16 [this.btnOk]));
w18.Position = 1;
w18.Expand = false;
w18.Fill = false;
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.DefaultHeight = 249;
this.Hide ();
this.btnOnlineRep.Clicked += new global::System.EventHandler (this.OnOptionClicked);
this.urlText.Changed += new global::System.EventHandler (this.OnUrlTextChanged);
this.btnLocalRep.Clicked += new global::System.EventHandler (this.OnOptionClicked);
this.pathEntry.Changed += new global::System.EventHandler (this.OnPathEntryChanged);
this.buttonBrowse.Clicked += new global::System.EventHandler (this.OnButtonBrowseClicked);
}
}
}
@@ -0,0 +1,102 @@
// This file has been generated by the GUI designer. Do not modify.
namespace Mono.Addins.Gui
{
internal partial class ProgressDialog
{
private global::Gtk.VBox vbox2;
private global::Gtk.Label labelMessage;
private global::Gtk.ProgressBar progressbar;
private global::Gtk.Expander expander1;
private global::Gtk.ScrolledWindow GtkScrolledWindow;
private global::Gtk.TextView textview;
private global::Gtk.Label GtkLabel1;
private global::Gtk.Button buttonCancel;
protected virtual void Build ()
{
Gui.Initialize (this);
// Widget Mono.Addins.Gui.ProgressDialog
this.Name = "Mono.Addins.Gui.ProgressDialog";
this.Title = global::Mono.Unix.Catalog.GetString ("Progress");
this.WindowPosition = ((global::Gtk.WindowPosition)(4));
this.Modal = true;
// Internal child Mono.Addins.Gui.ProgressDialog.VBox
global::Gtk.VBox w1 = this.VBox;
w1.Name = "dialog1_VBox";
w1.BorderWidth = ((uint)(2));
// Container child dialog1_VBox.Gtk.Box+BoxChild
this.vbox2 = new global::Gtk.VBox ();
this.vbox2.Name = "vbox2";
this.vbox2.Spacing = 6;
this.vbox2.BorderWidth = ((uint)(9));
// Container child vbox2.Gtk.Box+BoxChild
this.labelMessage = new global::Gtk.Label ();
this.labelMessage.Name = "labelMessage";
this.labelMessage.Xalign = 0F;
this.vbox2.Add (this.labelMessage);
global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.labelMessage]));
w2.Position = 0;
w2.Expand = false;
w2.Fill = false;
// Container child vbox2.Gtk.Box+BoxChild
this.progressbar = new global::Gtk.ProgressBar ();
this.progressbar.Name = "progressbar";
this.vbox2.Add (this.progressbar);
global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.progressbar]));
w3.Position = 1;
w3.Expand = false;
w3.Fill = false;
// Container child vbox2.Gtk.Box+BoxChild
this.expander1 = new global::Gtk.Expander (null);
this.expander1.CanFocus = true;
this.expander1.Name = "expander1";
// Container child expander1.Gtk.Container+ContainerChild
this.GtkScrolledWindow = new global::Gtk.ScrolledWindow ();
this.GtkScrolledWindow.Name = "GtkScrolledWindow";
this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1));
// Container child GtkScrolledWindow.Gtk.Container+ContainerChild
this.textview = new global::Gtk.TextView ();
this.textview.CanFocus = true;
this.textview.Name = "textview";
this.GtkScrolledWindow.Add (this.textview);
this.expander1.Add (this.GtkScrolledWindow);
this.GtkLabel1 = new global::Gtk.Label ();
this.GtkLabel1.Name = "GtkLabel1";
this.GtkLabel1.LabelProp = global::Mono.Unix.Catalog.GetString ("Details");
this.GtkLabel1.UseUnderline = true;
this.expander1.LabelWidget = this.GtkLabel1;
this.vbox2.Add (this.expander1);
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.expander1]));
w6.Position = 2;
w1.Add (this.vbox2);
global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox2]));
w7.Position = 0;
// Internal child Mono.Addins.Gui.ProgressDialog.ActionArea
global::Gtk.HButtonBox w8 = this.ActionArea;
w8.Name = "dialog1_ActionArea";
w8.Spacing = 6;
w8.BorderWidth = ((uint)(5));
w8.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4));
// Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
this.buttonCancel = new global::Gtk.Button ();
this.buttonCancel.CanDefault = true;
this.buttonCancel.CanFocus = true;
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.UseStock = true;
this.buttonCancel.UseUnderline = true;
this.buttonCancel.Label = "gtk-cancel";
this.AddActionWidget (this.buttonCancel, -6);
global::Gtk.ButtonBox.ButtonBoxChild w9 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w8 [this.buttonCancel]));
w9.Expand = false;
w9.Fill = false;
if ((this.Child != null)) {
this.Child.ShowAll ();
}
this.DefaultWidth = 513;
this.DefaultHeight = 156;
this.Hide ();
this.buttonCancel.Clicked += new global::System.EventHandler (this.OnButtonCancelClicked);
}
}
}
@@ -0,0 +1,135 @@
// This file has been generated by the GUI designer. Do not modify.
namespace Mono.Addins.Gui
{
internal class Gui
{
private static bool initialized;
internal static void Initialize(Gtk.Widget iconRenderer)
{
if ((initialized == false))
{
initialized = true;
}
}
}
internal class IconLoader
{
public static Gdk.Pixbuf LoadIcon(Gtk.Widget widget, string name, Gtk.IconSize size)
{
Gdk.Pixbuf res = widget.RenderIcon(name, size, null);
if ((res != null))
{
return res;
}
else
{
int sz;
int sy;
global::Gtk.Icon.SizeLookup(size, out sz, out sy);
try
{
return Gtk.IconTheme.Default.LoadIcon(name, sz, 0);
}
catch (System.Exception)
{
if ((name != "gtk-missing-image"))
{
return IconLoader.LoadIcon(widget, "gtk-missing-image", size);
}
else
{
Gdk.Pixmap pmap = new Gdk.Pixmap(Gdk.Screen.Default.RootWindow, sz, sz);
Gdk.GC gc = new Gdk.GC(pmap);
gc.RgbFgColor = new Gdk.Color(255, 255, 255);
pmap.DrawRectangle(gc, true, 0, 0, sz, sz);
gc.RgbFgColor = new Gdk.Color(0, 0, 0);
pmap.DrawRectangle(gc, false, 0, 0, (sz - 1), (sz - 1));
gc.SetLineAttributes(3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round);
gc.RgbFgColor = new Gdk.Color(255, 0, 0);
pmap.DrawLine(gc, (sz / 4), (sz / 4), ((sz - 1)
- (sz / 4)), ((sz - 1)
- (sz / 4)));
pmap.DrawLine(gc, ((sz - 1)
- (sz / 4)), (sz / 4), (sz / 4), ((sz - 1)
- (sz / 4)));
return Gdk.Pixbuf.FromDrawable(pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz);
}
}
}
}
}
internal class BinContainer
{
private Gtk.Widget child;
private Gtk.UIManager uimanager;
public static BinContainer Attach(Gtk.Bin bin)
{
BinContainer bc = new BinContainer();
bin.SizeRequested += new Gtk.SizeRequestedHandler(bc.OnSizeRequested);
bin.SizeAllocated += new Gtk.SizeAllocatedHandler(bc.OnSizeAllocated);
bin.Added += new Gtk.AddedHandler(bc.OnAdded);
return bc;
}
private void OnSizeRequested(object sender, Gtk.SizeRequestedArgs args)
{
if ((this.child != null))
{
args.Requisition = this.child.SizeRequest();
}
}
private void OnSizeAllocated(object sender, Gtk.SizeAllocatedArgs args)
{
if ((this.child != null))
{
this.child.Allocation = args.Allocation;
}
}
private void OnAdded(object sender, Gtk.AddedArgs args)
{
this.child = args.Widget;
}
public void SetUiManager(Gtk.UIManager uim)
{
this.uimanager = uim;
this.child.Realized += new System.EventHandler(this.OnRealized);
}
private void OnRealized(object sender, System.EventArgs args)
{
if ((this.uimanager != null))
{
Gtk.Widget w;
w = this.child.Toplevel;
if (((w != null)
&& typeof(Gtk.Window).IsInstanceOfType(w)))
{
((Gtk.Window)(w)).AddAccelGroup(this.uimanager.AccelGroup);
this.uimanager = null;
}
}
}
}
internal class ActionGroups
{
public static Gtk.ActionGroup GetActionGroup(System.Type type)
{
return ActionGroups.GetActionGroup(type.FullName);
}
public static Gtk.ActionGroup GetActionGroup(string name)
{
return null;
}
}
}
@@ -0,0 +1,393 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<ProjectGuid>{FEC19BDA-4904-4005-8C09-68E82E8BEF6A}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>Mono.Addins.Gui</AssemblyName>
<SchemaVersion>2.0</SchemaVersion>
<RootNamespace>Mono.Addins.Gui</RootNamespace>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\mono-addins.snk</AssemblyOriginatorKeyFile>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<ConsolePause>False</ConsolePause>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>True</Optimize>
<OutputPath>..\bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<ConsolePause>False</ConsolePause>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" />
<Reference Include="Mono.Posix" />
<Reference Include="Mono.Cairo" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Mono.Addins\Mono.Addins.csproj">
<Project>{91DD5A2D-9FE3-4C3C-9253-876141874DAD}</Project>
<Name>Mono.Addins</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\Mono.Addins.Setup\Mono.Addins.Setup.csproj">
<Project>{A85C9721-C054-4BD8-A1F3-0227615F0A36}</Project>
<Name>Mono.Addins.Setup</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Mono.Addins.Gui\AddinManagerDialog.cs" />
<Compile Include="Mono.Addins.Gui\AddinTreeWidget.cs" />
<Compile Include="Mono.Addins.Gui\ManageSitesDialog.cs" />
<Compile Include="Mono.Addins.Gui\NewSiteDialog.cs" />
<Compile Include="Mono.Addins.Gui\Services.cs" />
<Compile Include="Mono.Addins.Gui\ErrorDialog.cs" />
<Compile Include="Mono.Addins.Gui\AddinManagerWindow.cs" />
<Compile Include="Mono.Addins.Gui\AddinInstaller.cs" />
<Compile Include="Mono.Addins.Gui\AddinInstallerDialog.cs" />
<Compile Include="Mono.Addins.Gui\ProgressDialog.cs" />
<Compile Include="Mono.Addins.Gui\InstallDialog.cs" />
<Compile Include="Mono.Addins.Gui\AddinInfoView.cs" />
<Compile Include="Mono.Addins.Gui\HeaderBox.cs" />
<Compile Include="Mono.Addins.Gui\HslColor.cs" />
<Compile Include="Mono.Addins.Gui\SearchEntry.cs" />
<Compile Include="Mono.Addins.Gui\HoverImageButton.cs" />
<Compile Include="Mono.Addins.Gui\InstallMonitor.cs" />
<Compile Include="Gui\generated.cs" />
<Compile Include="Gui\Mono.Addins.Gui.AddinInfoView.cs" />
<Compile Include="Gui\Mono.Addins.Gui.AddinInstallerDialog.cs" />
<Compile Include="Gui\Mono.Addins.Gui.AddinManagerDialog.cs" />
<Compile Include="Gui\Mono.Addins.Gui.ErrorDialog.cs" />
<Compile Include="Gui\Mono.Addins.Gui.InstallDialog.cs" />
<Compile Include="Gui\Mono.Addins.Gui.ManageSitesDialog.cs" />
<Compile Include="Gui\Mono.Addins.Gui.NewSiteDialog.cs" />
<Compile Include="Gui\Mono.Addins.Gui.ProgressDialog.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="icons\package-x-generic.png">
<LogicalName>package-x-generic.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\package-x-generic_16.png">
<LogicalName>package-x-generic_16.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\package-x-generic_22.png">
<LogicalName>package-x-generic_22.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-avail-16.png">
<LogicalName>plugin-avail-16.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-avail-16%402x.png">
<LogicalName>plugin-avail-16@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-avail-16~dark.png">
<LogicalName>plugin-avail-16~dark.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-avail-16~dark%402x.png">
<LogicalName>plugin-avail-16~dark@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-avail-16~sel.png">
<LogicalName>plugin-avail-16~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-avail-16~sel%402x.png">
<LogicalName>plugin-avail-16~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-avail-16~dark~sel.png">
<LogicalName>plugin-avail-16~dark~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-avail-16~dark~sel%402x.png">
<LogicalName>plugin-avail-16~dark~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-16.png">
<LogicalName>plugin-update-16.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-16%402x.png">
<LogicalName>plugin-update-16@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-16~dark.png">
<LogicalName>plugin-update-16~dark.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-16~dark%402x.png">
<LogicalName>plugin-update-16~dark@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-16~sel.png">
<LogicalName>plugin-update-16~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-16~sel%402x.png">
<LogicalName>plugin-update-16~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-16~dark~sel.png">
<LogicalName>plugin-update-16~dark~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-16~dark~sel%402x.png">
<LogicalName>plugin-update-16~dark~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-16.png">
<LogicalName>plugin-16.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-16%402x.png">
<LogicalName>plugin-16@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-16~dark.png">
<LogicalName>plugin-16~dark.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-16~dark%402x.png">
<LogicalName>plugin-16~dark@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-16~sel.png">
<LogicalName>plugin-16~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-16~sel%402x.png">
<LogicalName>plugin-16~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-16~dark~sel.png">
<LogicalName>plugin-16~dark~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-16~dark~sel%402x.png">
<LogicalName>plugin-16~dark~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-32.png">
<LogicalName>plugin-32.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-32%402x.png">
<LogicalName>plugin-32@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-32~dark.png">
<LogicalName>plugin-32~dark.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-32~dark%402x.png">
<LogicalName>plugin-32~dark@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-32~sel.png">
<LogicalName>plugin-32~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-32~sel%402x.png">
<LogicalName>plugin-32~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-32~dark~sel.png">
<LogicalName>plugin-32~dark~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-32~dark~sel%402x.png">
<LogicalName>plugin-32~dark~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-avail-32.png">
<LogicalName>plugin-avail-32.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-32.png">
<LogicalName>plugin-update-32.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-32%402x.png">
<LogicalName>plugin-update-32@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-32~dark.png">
<LogicalName>plugin-update-32~dark.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-32~dark%402x.png">
<LogicalName>plugin-update-32~dark@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-32~sel.png">
<LogicalName>plugin-update-32~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-32~sel%402x.png">
<LogicalName>plugin-update-32~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-32~dark~sel.png">
<LogicalName>plugin-update-32~dark~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-32~dark~sel%402x.png">
<LogicalName>plugin-update-32~dark~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-disabled-32.png">
<LogicalName>plugin-disabled-32.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-disabled-32%402x.png">
<LogicalName>plugin-disabled-32@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-disabled-32~dark.png">
<LogicalName>plugin-disabled-32~dark.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-disabled-32~dark%402x.png">
<LogicalName>plugin-disabled-32~dark@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-disabled-32~sel%402x.png">
<LogicalName>plugin-disabled-32~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-disabled-32~sel.png">
<LogicalName>plugin-disabled-32~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-disabled-32~dark~sel%402x.png">
<LogicalName>plugin-disabled-32~dark~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-disabled-32~dark~sel.png">
<LogicalName>plugin-disabled-32~dark~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\download-16.png">
<LogicalName>download-16.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\download-16%402x.png">
<LogicalName>download-16@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\download-16~dark.png">
<LogicalName>download-16~dark.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\download-16~dark%402x.png">
<LogicalName>download-16~dark@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-22.png">
<LogicalName>plugin-22.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-22%402x.png">
<LogicalName>plugin-22@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-22~dark.png">
<LogicalName>plugin-22~dark.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-22~dark%402x.png">
<LogicalName>plugin-22~dark@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-22~sel.png">
<LogicalName>plugin-22~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-22~sel%402x.png">
<LogicalName>plugin-22~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-22~dark~sel.png">
<LogicalName>plugin-22~dark~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-22~dark~sel%402x.png">
<LogicalName>plugin-22~dark~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-22.png">
<LogicalName>plugin-update-22.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-22%402x.png">
<LogicalName>plugin-update-22@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-22~dark.png">
<LogicalName>plugin-update-22~dark.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-22~dark%402x.png">
<LogicalName>plugin-update-22~dark@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-22~sel.png">
<LogicalName>plugin-update-22~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-22~sel%402x.png">
<LogicalName>plugin-update-22~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-22~dark~sel.png">
<LogicalName>plugin-update-22~dark~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\plugin-update-22~dark~sel%402x.png">
<LogicalName>plugin-update-22~dark~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\update-available-overlay-16.png">
<LogicalName>update-available-overlay-16.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\update-available-overlay-16%402x.png">
<LogicalName>update-available-overlay-16@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\update-available-overlay-16~dark.png">
<LogicalName>update-available-overlay-16~dark.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\update-available-overlay-16~dark%402x.png">
<LogicalName>update-available-overlay-16~dark@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\update-available-overlay-16~sel.png">
<LogicalName>update-available-overlay-16~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\update-available-overlay-16~sel%402x.png">
<LogicalName>update-available-overlay-16~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\update-available-overlay-16~dark~sel.png">
<LogicalName>update-available-overlay-16~dark~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\update-available-overlay-16~dark~sel%402x.png">
<LogicalName>update-available-overlay-16~dark~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\update-16.png">
<LogicalName>update-16.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\update-16%402x.png">
<LogicalName>update-16@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\update-16~dark.png">
<LogicalName>update-16~dark.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\update-16~dark%402x.png">
<LogicalName>update-16~dark@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\installed-overlay-16.png">
<LogicalName>installed-overlay-16.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\installed-overlay-16%402x.png">
<LogicalName>installed-overlay-16@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\installed-overlay-16~dark.png">
<LogicalName>installed-overlay-16~dark.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\installed-overlay-16~dark%402x.png">
<LogicalName>installed-overlay-16~dark@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\installed-overlay-16~sel.png">
<LogicalName>installed-overlay-16~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\installed-overlay-16~sel%402x.png">
<LogicalName>installed-overlay-16~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\installed-overlay-16~dark~sel.png">
<LogicalName>installed-overlay-16~dark~sel.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\installed-overlay-16~dark~sel%402x.png">
<LogicalName>installed-overlay-16~dark~sel@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\web-search-16.png">
<LogicalName>web-search-16.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\web-search-16%402x.png">
<LogicalName>web-search-16@2x.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\web-search-16~dark.png">
<LogicalName>web-search-16~dark.png</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="icons\web-search-16~dark%402x.png">
<LogicalName>web-search-16~dark@2x.png</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
@@ -0,0 +1,449 @@
//
// AddinInfoView.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.IO;
using System.Collections.Generic;
using Mono.Addins.Setup;
using System.Text;
using Mono.Unix;
using System.Linq;
namespace Mono.Addins.Gui
{
[System.ComponentModel.ToolboxItem(true)]
partial class AddinInfoView : Gtk.Bin
{
List<AddinRepositoryEntry> selectedEntry = new List<AddinRepositoryEntry> ();
List<Addin> selectedAddin = new List<Addin> ();
SetupService service;
HeaderBox topHeaderBox;
List<Gtk.Widget> previewImages = new List<Gtk.Widget> ();
ImageContainer titleIcon;
int titleWidth;
string infoUrl;
public event EventHandler InstallClicked;
public event EventHandler UninstallClicked;
public event EventHandler UpdateClicked;
public event EventHandler EnableDisableClicked;
public AddinInfoView ()
{
this.Build ();
AllowInstall = true;
titleWidth = labelName.SizeRequest ().Width;
HeaderBox hb = new HeaderBox (1,1,1,1);
hb.Show ();
hb.Replace (this);
hb = new HeaderBox (1,0,0,0);
hb.SetPadding (6,6,6,6);
hb.Show ();
hb.GradientBackround = true;
hb.Replace (eboxButs);
hb = new HeaderBox (0,1,0,0);
hb.SetPadding (6,6,6,6);
hb.Show ();
hb.GradientBackround = true;
hb.Replace (boxHeader);
topHeaderBox = hb;
}
public void Init (SetupService service)
{
this.service = service;
}
public bool AllowInstall { get; set; }
public List<AddinRepositoryEntry> SelectedEntries {
get {
return this.selectedEntry;
}
}
public List<Addin> SelectedAddins {
get {
return this.selectedAddin;
}
}
public void ShowAddins (object[] data)
{
selectedEntry.Clear ();
selectedAddin.Clear ();
eboxButs.Visible = true;
topHeaderBox.Hide ();
urlButton.Hide ();
if (titleIcon != null) {
boxTitle.Remove (titleIcon);
titleIcon.Destroy ();
titleIcon = null;
}
foreach (var img in previewImages) {
((Gtk.Container)img.Parent).Remove (img);
img.Destroy ();
}
previewImages.Clear ();
if (data.Length == 1) {
headerBox.Show ();
ShowAddin (data[0]);
}
else if (data.Length > 1) {
headerBox.Hide ();
StringBuilder sb = new StringBuilder ();
sb.Append (Catalog.GetString ("Multiple selection:\n\n"));
bool allowUpdate = AllowInstall;
bool allowInstall = true;
bool allowUninstall = AllowInstall;
bool allowEnable = true;
bool allowDisable = true;
foreach (object o in data) {
Addin installed;
if (o is Addin) {
Addin a = (Addin)o;
installed = a;
selectedAddin.Add (a);
sb.Append (a.Name);
}
else {
AddinRepositoryEntry entry = (AddinRepositoryEntry) o;
selectedEntry.Add (entry);
sb.Append (entry.Addin.Name);
installed = AddinManager.Registry.GetAddin (Addin.GetIdName (entry.Addin.Id));
}
if (installed != null) {
if (GetUpdate (installed) == null)
allowUpdate = false;
allowInstall = false;
if (installed.Enabled)
allowEnable = false;
else
allowDisable = false;
} else
allowEnable = allowDisable = allowUninstall = allowUpdate = false;
sb.Append ('\n');
labelDesc.Text = sb.ToString ();
if (allowEnable) {
btnDisable.Visible = true;
btnDisable.Label = Catalog.GetString ("Enable");
} else if (allowDisable) {
btnDisable.Visible = true;
btnDisable.Label = Catalog.GetString ("Disable");
} else
btnDisable.Visible = false;
btnInstall.Visible = allowInstall;
btnUninstall.Visible = allowUninstall;
btnUpdate.Visible = allowUpdate;
}
}
else {
headerBox.Hide ();
btnDisable.Visible = false;
btnInstall.Visible = false;
btnUninstall.Visible = false;
btnUpdate.Visible = false;
eboxButs.Visible = false;
labelDesc.Text = Catalog.GetString ("No selection");
}
}
void ShowAddin (object data)
{
AddinHeader sinfo = null;
Addin installed = null;
AddinHeader updateInfo = null;
string repo = "";
string downloadSize = null;
topHeaderBox.Hide ();
if (data is Addin) {
installed = (Addin) data;
sinfo = SetupService.GetAddinHeader (installed);
var entry = GetUpdate (installed);
if (entry != null) {
updateInfo = entry.Addin;
selectedEntry.Add (entry);
}
foreach (var prop in sinfo.Properties) {
if (prop.Name.StartsWith ("PreviewImage"))
previewImages.Add (new ImageContainer (installed, prop.Value));
}
string icon32 = sinfo.Properties.GetPropertyValue ("Icon32");
if (icon32.Length > 0)
titleIcon = new ImageContainer (installed, icon32);
}
else if (data is AddinRepositoryEntry) {
AddinRepositoryEntry entry = (AddinRepositoryEntry) data;
sinfo = entry.Addin;
installed = AddinManager.Registry.GetAddin (Addin.GetIdName (sinfo.Id));
if (installed != null && Addin.CompareVersions (installed.Version, sinfo.Version) > 0)
updateInfo = sinfo;
selectedEntry.Add (entry);
string rname = !string.IsNullOrEmpty (entry.RepositoryName) ? entry.RepositoryName : entry.RepositoryUrl;
repo = "<small><b>" + Catalog.GetString ("Available in repository:") + "</b>\n" + GLib.Markup.EscapeText (rname) + "\n\n</small>";
foreach (var prop in sinfo.Properties) {
if (prop.Name.StartsWith ("PreviewImage"))
previewImages.Add (new ImageContainer (entry, prop.Value));
}
string icon32 = sinfo.Properties.GetPropertyValue ("Icon32");
if (icon32.Length > 0)
titleIcon = new ImageContainer (entry, icon32);
int size;
if (int.TryParse (sinfo.Properties.GetPropertyValue ("DownloadSize"), out size)) {
float fs = ((float)size) / 1048576f;
downloadSize = fs.ToString ("0.00 MB");
}
} else
selectedEntry.Clear ();
if (installed != null)
selectedAddin.Add (installed);
string missingDepsTxt = null;
if (sinfo == null) {
btnDisable.Visible = false;
btnUninstall.Visible = false;
btnUpdate.Visible = false;
} else {
string version;
string newVersion = null;
if (installed != null) {
btnInstall.Visible = false;
btnUpdate.Visible = updateInfo != null && AllowInstall;
btnDisable.Visible = true;
btnDisable.Label = installed.Enabled ? Catalog.GetString ("Disable") : Catalog.GetString ("Enable");
btnDisable.Visible = installed.Description.CanDisable;
btnUninstall.Visible = installed.Description.CanUninstall;
version = installed.Version;
var missingDeps = Services.GetMissingDependencies (installed);
if (updateInfo != null) {
newVersion = updateInfo.Version;
labelHeader.Markup = "<b><span color='black'>" + Catalog.GetString ("Update available") + "</span></b>";
// topHeaderBox.BackgroundColor = new Gdk.Color (0, 132, 208);
imageHeader.Pixbuf = Gdk.Pixbuf.LoadFromResource ("update-16.png");
topHeaderBox.BackgroundColor = new Gdk.Color (255, 176, 0);
topHeaderBox.Show ();
}
else if (missingDeps.Any ()) {
labelHeader.Markup = "<b><span color='black'>" + Catalog.GetString ("This extension package can't be loaded due to missing dependencies") + "</span></b>";
topHeaderBox.BackgroundColor = new Gdk.Color (255, 176, 0);
imageHeader.SetFromStock (Gtk.Stock.DialogWarning, Gtk.IconSize.Menu);
topHeaderBox.Show ();
missingDepsTxt = "";
foreach (var mdep in missingDeps) {
if (mdep.Found != null)
missingDepsTxt += "\n" + string.Format (Catalog.GetString ("Required: {0} v{1}, found v{2}"), mdep.Addin, mdep.Required, mdep.Found);
else
missingDepsTxt += "\n" + string.Format (Catalog.GetString ("Missing: {0} v{1}"), mdep.Addin, mdep.Required);
}
}
} else {
btnInstall.Visible = AllowInstall;
btnUpdate.Visible = false;
btnDisable.Visible = false;
btnUninstall.Visible = false;
version = sinfo.Version;
}
labelName.Markup = "<b><big>" + GLib.Markup.EscapeText(sinfo.Name) + "</big></b>";
string ver;
if (newVersion != null) {
ver = "<small><b>" + Catalog.GetString ("Installed version") + ":</b> " + version + "</small>\n";
ver += "<small><b>" + Catalog.GetString ("Repository version") + ":</b> " + newVersion + "</small>";
}
else
ver = "<small><b>" + Catalog.GetString ("Version") + " " + version + "</b></small>";
if (downloadSize != null)
ver += "\n<small><b>" + Catalog.GetString ("Download size") + ":</b> " + downloadSize + "</small>";
if (missingDepsTxt != null)
ver += "\n\n" + GLib.Markup.EscapeText (Catalog.GetString ("The following dependencies required by this extension package are not available:")) + missingDepsTxt;
labelVersion.Markup = ver;
string desc = GLib.Markup.EscapeText (sinfo.Description);
labelDesc.Markup = repo + GLib.Markup.EscapeText (desc);
foreach (var img in previewImages)
vboxDesc.PackStart (img, false, false, 0);
urlButton.Visible = !string.IsNullOrEmpty (sinfo.Url);
infoUrl = sinfo.Url;
if (titleIcon != null) {
boxTitle.PackEnd (titleIcon, false, false, 0);
labelName.WidthRequest = titleWidth - 32;
labelVersion.WidthRequest = titleWidth - 32;
} else {
labelName.WidthRequest = titleWidth;
labelVersion.WidthRequest = titleWidth;
}
if (IsRealized)
SetComponentsBg ();
}
}
public AddinRepositoryEntry GetUpdate (Addin a)
{
AddinRepositoryEntry[] updates = service.Repositories.GetAvailableAddinUpdates (Addin.GetIdName (a.Id));
AddinRepositoryEntry best = null;
string bestVersion = a.Version;
foreach (AddinRepositoryEntry e in updates) {
if (Addin.CompareVersions (bestVersion, e.Addin.Version) > 0) {
best = e;
bestVersion = e.Addin.Version;
}
}
return best;
}
protected virtual void OnBtnInstallClicked (object sender, System.EventArgs e)
{
if (InstallClicked != null)
InstallClicked (this, e);
}
protected virtual void OnBtnDisableClicked (object sender, System.EventArgs e)
{
if (EnableDisableClicked != null)
EnableDisableClicked (this, e);
}
protected virtual void OnBtnUpdateClicked (object sender, System.EventArgs e)
{
if (UpdateClicked != null)
UpdateClicked (this, e);
}
protected virtual void OnBtnUninstallClicked (object sender, System.EventArgs e)
{
if (UninstallClicked != null)
UninstallClicked (this, e);
}
protected override void OnRealized ()
{
base.OnRealized ();
HslColor gcol = ebox.Style.Background (Gtk.StateType.Normal);
gcol.L -= 0.03;
ebox.ModifyBg (Gtk.StateType.Normal, gcol);
ebox2.ModifyBg (Gtk.StateType.Normal, gcol);
scrolledwindow.ModifyBg (Gtk.StateType.Normal, gcol);
SetComponentsBg ();
}
void SetComponentsBg ()
{
HslColor gcol = ebox.Style.Background (Gtk.StateType.Normal);
//gcol.L -= 0.03;
if (titleIcon != null)
titleIcon.ModifyBg (Gtk.StateType.Normal, gcol);
foreach (var i in previewImages)
i.ModifyBg (Gtk.StateType.Normal, gcol);
}
protected virtual void OnUrlButtonClicked (object sender, System.EventArgs e)
{
System.Diagnostics.Process.Start (infoUrl);
}
}
class ImageContainer: Gtk.EventBox
{
AddinRepositoryEntry aentry;
IAsyncResult aresult;
Gtk.Image image;
bool destroyed;
ImageContainer ()
{
image = new Gtk.Image ();
Add (image);
image.SetAlignment (0.5f, 0f);
Show ();
}
public ImageContainer (AddinRepositoryEntry aentry, string fileName): this ()
{
this.aentry = aentry;
aresult = aentry.BeginDownloadSupportFile (fileName, ImageDownloaded, null);
}
public ImageContainer (Addin addin, string fileName): this ()
{
string path = System.IO.Path.Combine (addin.Description.BasePath, fileName);
LoadImage (File.OpenRead (path));
}
void ImageDownloaded (object state)
{
Gtk.Application.Invoke ((o, args) => {
if (destroyed)
return;
try {
LoadImage (aentry.EndDownloadSupportFile (aresult));
} catch {
// ignore
}
});
}
void LoadImage (Stream s)
{
using (s) {
Gdk.PixbufLoader loader = new Gdk.PixbufLoader (s);
Gdk.Pixbuf pix = image.Pixbuf = loader.Pixbuf;
loader.Dispose ();
if (pix.Width > 250) {
Gdk.Pixbuf spix = pix.ScaleSimple (250, (250 * pix.Height) / pix.Width, Gdk.InterpType.Hyper);
pix.Dispose ();
pix = spix;
}
image.Pixbuf = pix;
image.Show ();
}
}
protected override void OnDestroyed ()
{
destroyed = true;
base.OnDestroyed ();
}
}
}
@@ -0,0 +1,25 @@
using System;
using Mono.Addins.Setup;
using Mono.Unix;
namespace Mono.Addins.Gui
{
public class AddinInstaller: IAddinInstaller
{
public void InstallAddins (AddinRegistry reg, string message, string[] addinIds)
{
AddinInstallerDialog dlg = new AddinInstallerDialog (reg, message, addinIds);
try {
if (dlg.Run () == (int) Gtk.ResponseType.Cancel)
throw new InstallException (Catalog.GetString ("Installation cancelled"));
else if (dlg.ErrMessage != null)
throw new InstallException (dlg.ErrMessage);
}
finally {
dlg.Destroy ();
}
}
}
}
@@ -0,0 +1,178 @@
//
// AddinInstallerDialog.cs
//
// Author:
// Lluis Sanchez Gual
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Threading;
using System.Collections;
using Mono.Addins.Setup;
using Mono.Addins.Description;
using Mono.Unix;
namespace Mono.Addins.Gui
{
internal partial class AddinInstallerDialog : Gtk.Dialog, IProgressStatus
{
PackageCollection entries = new PackageCollection ();
string[] addinIds;
bool addinsNotFound;
string errMessage;
SetupService setup;
public AddinInstallerDialog (AddinRegistry reg, string message, string[] addinIds)
{
this.Build();
this.addinIds = addinIds;
setup = new SetupService (reg);
if (!CheckAddins (true))
UpdateRepos ();
}
bool CheckAddins (bool updating)
{
string txt = "";
entries.Clear ();
bool addinsNotFound = false;
foreach (string id in addinIds) {
string name = Addin.GetIdName (id);
string version = Addin.GetIdVersion (id);
AddinRepositoryEntry[] ares = setup.Repositories.GetAvailableAddin (name, version);
if (ares.Length == 0) {
addinsNotFound = true;
if (updating)
txt += "<span foreground='grey'><b>" + name + " " + version + "</b> (searching extension packages)</span>\n";
else
txt += "<span foreground='red'><b>" + name + " " + version + "</b> (not found)</span>\n";
} else {
entries.Add (Package.FromRepository (ares[0]));
txt += "<b>" + ares[0].Addin.Name + " " + ares[0].Addin.Version + "</b>\n";
}
}
PackageCollection toUninstall;
DependencyCollection unresolved;
if (!setup.ResolveDependencies (this, entries, out toUninstall, out unresolved)) {
foreach (Dependency dep in unresolved) {
txt += "<span foreground='red'><b>" + dep.Name + "</b> (not found)</span>\n";
}
addinsNotFound = true;
}
addinList.Markup = txt;
return !addinsNotFound;
}
void UpdateRepos ()
{
progressBar.Show ();
setup.Repositories.UpdateAllRepositories (this);
progressBar.Hide ();
addinsNotFound = CheckAddins (false);
if (errMessage != null) {
Services.ShowError (null, errMessage, this, true);
errMessage = null;
}
}
public int LogLevel {
get {
return 1;
}
}
public bool IsCanceled {
get {
return false;
}
}
public bool AddinsNotFound {
get {
return addinsNotFound;
}
}
public string ErrMessage {
get {
return errMessage;
}
}
public void SetMessage (string msg)
{
progressBar.Text = msg;
while (Gtk.Application.EventsPending ())
Gtk.Application.RunIteration ();
}
public void SetProgress (double progress)
{
progressBar.Fraction = progress;
while (Gtk.Application.EventsPending ())
Gtk.Application.RunIteration ();
}
public void Log (string msg)
{
}
public void ReportWarning (string message)
{
}
public void ReportError (string message, System.Exception exception)
{
errMessage = message;
}
public void Cancel ()
{
}
protected virtual void OnButtonOkClicked (object sender, System.EventArgs e)
{
if (addinsNotFound) {
errMessage = Catalog.GetString ("Some of the required extension packages were not found");
Respond (Gtk.ResponseType.Ok);
}
else {
errMessage = null;
progressBar.Show ();
progressBar.Fraction = 0;
progressBar.Text = "";
bool res = setup.Install (this, entries);
if (!res) {
buttonCancel.Sensitive = buttonOk.Sensitive = false;
if (errMessage == null)
errMessage = Catalog.GetString ("Installation failed");
Services.ShowError (null, errMessage, this, true);
}
}
Respond (Gtk.ResponseType.Ok);
}
}
}
@@ -0,0 +1,580 @@
//
// AddinManagerDialog.cs
//
// Author:
// Lluis Sanchez Gual
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Gtk;
using Mono.Addins.Setup;
using Mono.Addins;
using Mono.Unix;
using System.Threading;
using System.Text;
using System.Collections.Generic;
using System.Linq;
namespace Mono.Addins.Gui
{
partial class AddinManagerDialog : Dialog, IDisposable
{
AddinTreeWidget tree;
AddinTreeWidget galleryTree;
AddinTreeWidget updatesTree;
SetupService service = new SetupService ();
ListStore repoStore;
int lastRepoActive;
SearchEntry filterEntry;
Label installedTabLabel;
Label updatesTabLabel;
Label galleryTabLabel;
static bool firstLoad = true;
const string AllRepoMarker = "__ALL";
const string ManageRepoMarker = "__MANAGE";
internal bool AllowInstall
{
set {
addininfoInstalled.AllowInstall = value;
addininfoGallery.AllowInstall = value;
addininfoUpdates.AllowInstall = value;
}
}
public AddinManagerDialog (Window parent)
{
Build ();
TransientFor = parent;
HasSeparator = false;
Services.PlaceDialog (this, parent);
addininfoInstalled.Init (service);
addininfoGallery.Init (service);
addinTree.Selection.Mode = SelectionMode.Multiple;
tree = new AddinTreeWidget (addinTree);
addinTree.Selection.Changed += OnSelectionChanged;
tree.VersionVisible = false;
galleryTreeView.Selection.Mode = SelectionMode.Multiple;
galleryTree = new AddinTreeWidget (galleryTreeView);
galleryTree.VersionVisible = false;
galleryTree.ShowInstalledMarkers = true;
galleryTreeView.Selection.Changed += OnGallerySelectionChanged;
updatesTreeView.Selection.Mode = SelectionMode.Multiple;
updatesTree = new AddinTreeWidget (updatesTreeView);
updatesTree.VersionVisible = false;
updatesTree.ShowCategories = false;
updatesTree.ShowInstalledMarkers = true;
updatesTreeView.Selection.Changed += OnGallerySelectionChanged;
repoStore = new ListStore (typeof(string), typeof(string));
repoCombo.Model = repoStore;
CellRendererText crt = new CellRendererText ();
repoCombo.PackStart (crt, true);
repoCombo.AddAttribute (crt, "text", 0);
repoCombo.RowSeparatorFunc = delegate(TreeModel model, TreeIter iter) {
string val = (string) model.GetValue (iter, 0);
return val == "---";
};
// Make sure the tree has the focus when switching tabs
vboxUpdates.FocusChain = new Widget [] { scrolledUpdates, eboxRepoUpdates };
vboxGallery.FocusChain = new Widget [] { scrolledGallery, eboxRepo };
// Improve the look of the headers
HBox tab = new HBox (false, 3);
tab.PackStart (new Image (Gdk.Pixbuf.LoadFromResource ("plugin-22.png")), false, false, 0);
installedTabLabel = new Label (Catalog.GetString ("Installed"));
tab.PackStart (installedTabLabel, true, true, 0);
tab.BorderWidth = 3;
tab.ShowAll ();
notebook.SetTabLabel (notebook.GetNthPage (0), tab);
tab = new HBox (false, 3);
tab.PackStart (new Image (Gdk.Pixbuf.LoadFromResource ("plugin-update-22.png")), false, false, 0);
updatesTabLabel = new Label (Catalog.GetString ("Updates"));
tab.PackStart (updatesTabLabel, true, true, 0);
tab.BorderWidth = 3;
tab.ShowAll ();
notebook.SetTabLabel (notebook.GetNthPage (1), tab);
tab = new HBox (false, 3);
tab.PackStart (new Image (Gdk.Pixbuf.LoadFromResource ("update-16.png")), false, false, 0);
galleryTabLabel = new Label (Catalog.GetString ("Gallery"));
tab.PackStart (galleryTabLabel, true, true, 0);
tab.BorderWidth = 3;
tab.ShowAll ();
notebook.SetTabLabel (notebook.GetNthPage (2), tab);
// Gradient header for the updates and gallery tabs
HeaderBox hb = new HeaderBox (1, 0, 1, 1);
hb.SetPadding (6,6,6,6);
hb.GradientBackround = true;
hb.Show ();
hb.Replace (eboxRepo);
hb = new HeaderBox (1, 0, 1, 1);
hb.SetPadding (6,6,6,6);
hb.GradientBackround = true;
hb.Show ();
hb.Replace (eboxRepoUpdates);
InsertFilterEntry ();
FillRepos ();
repoCombo.Active = 0;
LoadAll ();
}
void InsertFilterEntry ()
{
filterEntry = new SearchEntry ();
filterEntry.Entry.SetSizeRequest (200, filterEntry.Entry.SizeRequest ().Height);
filterEntry.SizeAllocated += (o, args) => {
RepositionFilter ();
};
ActionArea.PackEnd (filterEntry);
var btnCloseBoxChild = ((Box.BoxChild)(ActionArea [btnClose]));
btnCloseBoxChild.Position = 2;
filterEntry.Show ();
notebook.SizeAllocated += delegate {
RepositionFilter ();
};
filterEntry.TextChanged += delegate {
tree.SetFilter (filterEntry.Text);
galleryTree.SetFilter (filterEntry.Text);
updatesTree.SetFilter (filterEntry.Text);
LoadAll ();
addinTree.ExpandAll ();
galleryTreeView.ExpandAll ();
};
RepositionFilter ();
}
protected override void OnShown ()
{
base.OnShown ();
filterEntry.Parent = notebook;
}
void RepositionFilter ()
{
int w = filterEntry.SizeRequest ().Width;
int h = filterEntry.SizeRequest ().Height;
var alloc = notebook.Allocation;
filterEntry.Allocation = new Gdk.Rectangle (alloc.Left + alloc.Width - 1 - w, alloc.Y, w, h);
}
public override void Dispose ()
{
base.Dispose ();
Destroy ();
}
internal void OnSelectionChanged (object sender, EventArgs args)
{
UpdateAddinInfo ();
}
internal void OnManageRepos (object sender, EventArgs e)
{
ManageSitesDialog dlg = new ManageSitesDialog (this, service);
try {
dlg.Run ();
} finally {
dlg.Destroy ();
}
}
void LoadAll ()
{
LoadInstalled ();
LoadGallery ();
LoadUpdates ();
UpdateAddinInfo ();
}
void UpdateAddinInfo ()
{
addininfoInstalled.ShowAddins (tree.ActiveAddinsData);
addininfoGallery.ShowAddins (galleryTree.ActiveAddinsData);
addininfoUpdates.ShowAddins (updatesTree.ActiveAddinsData);
}
void LoadInstalled ()
{
object s = tree.SaveStatus ();
int count = 0;
tree.Clear ();
foreach (Addin ainfo in AddinManager.Registry.GetModules (AddinSearchFlags.IncludeAddins | AddinSearchFlags.LatestVersionsOnly)) {
if (Services.InApplicationNamespace (service, ainfo.Id) && !ainfo.Description.IsHidden) {
AddinHeader ah = SetupService.GetAddinHeader (ainfo);
if (IsFiltered (ah))
continue;
AddinStatus st = AddinStatus.Installed;
if (!ainfo.Enabled || Services.GetMissingDependencies (ainfo).Any())
st |= AddinStatus.Disabled;
if (addininfoInstalled.GetUpdate (ainfo) != null)
st |= AddinStatus.HasUpdate;
tree.AddAddin (ah, ainfo, st);
count++;
}
}
if (count > 0)
tree.RestoreStatus (s);
else
tree.ShowEmptyMessage ();
UpdateAddinInfo ();
installedTabLabel.Text = Catalog.GetString ("Installed");
if (filterEntry.Text.Length != 0 && count > 0)
installedTabLabel.Text += " (" + count + ")";
}
void FillRepos ()
{
int i = repoCombo.Active;
repoStore.Clear ();
repoStore.AppendValues (Catalog.GetString ("All repositories"), AllRepoMarker);
foreach (AddinRepository rep in service.Repositories.GetRepositories ()) {
if (rep.Enabled)
repoStore.AppendValues (rep.Title, rep.Url);
}
repoStore.AppendValues ("---", "");
repoStore.AppendValues (Catalog.GetString ("Manage Repositories..."), ManageRepoMarker);
repoCombo.Active = i;
}
string GetRepoSelection ()
{
Gtk.TreeIter iter;
if (!repoCombo.GetActiveIter (out iter))
return null;
return (string) repoStore.GetValue (iter, 1);
}
void LoadGallery ()
{
object s = galleryTree.SaveStatus ();
galleryTree.Clear ();
string rep = GetRepoSelection ();
AddinRepositoryEntry[] reps;
if (rep == AllRepoMarker)
reps = service.Repositories.GetAvailableAddins (RepositorySearchFlags.LatestVersionsOnly);
else
reps = service.Repositories.GetAvailableAddins (rep, RepositorySearchFlags.LatestVersionsOnly);
int count = 0;
foreach (AddinRepositoryEntry arep in reps)
{
if (!Services.InApplicationNamespace (service, arep.Addin.Id))
continue;
if (IsFiltered (arep.Addin))
continue;
AddinStatus status = AddinStatus.NotInstalled;
// Find whatever version is installed
Addin sinfo = AddinManager.Registry.GetAddin (Addin.GetIdName (arep.Addin.Id));
if (sinfo != null) {
status |= AddinStatus.Installed;
if (!sinfo.Enabled || Services.GetMissingDependencies (sinfo).Any())
status |= AddinStatus.Disabled;
if (Addin.CompareVersions (sinfo.Version, arep.Addin.Version) > 0)
status |= AddinStatus.HasUpdate;
}
galleryTree.AddAddin (arep.Addin, arep, status);
count++;
}
if (count > 0)
galleryTree.RestoreStatus (s);
else
galleryTree.ShowEmptyMessage ();
galleryTabLabel.Text = Catalog.GetString ("Gallery");
if (filterEntry.Text.Length != 0 && count > 0)
galleryTabLabel.Text += " (" + count + ")";
}
void LoadUpdates ()
{
object s = updatesTree.SaveStatus ();
updatesTree.Clear ();
AddinRepositoryEntry[] reps;
reps = service.Repositories.GetAvailableAddins (RepositorySearchFlags.LatestVersionsOnly);
int count = 0;
foreach (AddinRepositoryEntry arep in reps)
{
if (!Services.InApplicationNamespace (service, arep.Addin.Id))
continue;
// Find whatever version is installed
Addin sinfo = AddinManager.Registry.GetAddin (Addin.GetIdName (arep.Addin.Id));
if (sinfo == null || !sinfo.Enabled || Addin.CompareVersions (sinfo.Version, arep.Addin.Version) <= 0)
continue;
if (IsFiltered (arep.Addin))
continue;
AddinStatus status = AddinStatus.Installed;
if (!sinfo.Enabled || Services.GetMissingDependencies (sinfo).Any())
status |= AddinStatus.Disabled;
updatesTree.AddAddin (arep.Addin, arep, status | AddinStatus.HasUpdate);
count++;
}
labelUpdates.Text = string.Format (Catalog.GetPluralString ("{0} update available", "{0} updates available", count), count);
updatesTabLabel.Text = Catalog.GetString ("Updates");
if (count > 0)
updatesTabLabel.Text += " (" + count + ")";
buttonUpdateAll.Visible = count > 0;
if (count > 0)
updatesTree.RestoreStatus (s);
else
updatesTree.ShowEmptyMessage ();
}
bool IsFiltered (AddinHeader ah)
{
if (filterEntry.Text.Length == 0)
return false;
if (ah.Name.IndexOf (filterEntry.Text, StringComparison.CurrentCultureIgnoreCase) != -1)
return false;
if (ah.Description.IndexOf (filterEntry.Text, StringComparison.CurrentCultureIgnoreCase) != -1)
return false;
if (ah.Id.IndexOf (filterEntry.Text, StringComparison.CurrentCultureIgnoreCase) != -1)
return false;
return true;
}
void ManageSites ()
{
ManageSitesDialog dlg = new ManageSitesDialog (this, service);
try {
dlg.Run ();
repoCombo.Active = lastRepoActive;
FillRepos ();
} finally {
dlg.Destroy ();
}
}
protected virtual void OnRepoComboChanged (object sender, System.EventArgs e)
{
if (GetRepoSelection () == ManageRepoMarker)
ManageSites ();
else
LoadGallery ();
lastRepoActive = repoCombo.Active;
}
protected virtual void OnGallerySelectionChanged (object sender, System.EventArgs e)
{
UpdateAddinInfo ();
}
void UpdateRepositories ()
{
ProgressDialog pdlg = new ProgressDialog (this);
if (!firstLoad)
pdlg.Show ();
pdlg.SetMessage (AddinManager.CurrentLocalizer.GetString ("Updating repository"));
bool updateDone = buttonRefresh.Sensitive = false;
Thread t = new Thread (delegate () {
try {
service.Repositories.UpdateAllRepositories (pdlg);
} finally {
updateDone = true;
}
});
t.Start ();
while (!updateDone) {
while (Gtk.Application.EventsPending ())
Gtk.Application.RunIteration ();
Thread.Sleep (50);
}
buttonRefresh.Sensitive = true;
pdlg.Destroy ();
}
protected virtual void OnButtonRefreshClicked (object sender, System.EventArgs e)
{
UpdateRepositories ();
LoadGallery ();
LoadUpdates ();
}
protected virtual void OnInstallClicked (object sender, System.EventArgs e)
{
InstallDialog dlg = new InstallDialog (this, service);
try {
List<AddinRepositoryEntry> selectedEntry = ((AddinInfoView)sender).SelectedEntries;
dlg.InitForInstall (selectedEntry.ToArray ());
if (dlg.Run () == (int) Gtk.ResponseType.Ok)
LoadAll ();
} finally {
dlg.Destroy ();
}
}
protected virtual void OnUninstallClicked (object sender, System.EventArgs e)
{
List<Addin> selectedAddin = ((AddinInfoView)sender).SelectedAddins;
InstallDialog dlg = new InstallDialog (this, service);
try {
dlg.InitForUninstall (selectedAddin.ToArray ());
if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
LoadAll ();
}
} finally {
dlg.Destroy ();
}
}
protected virtual void OnUpdateClicked (object sender, System.EventArgs e)
{
List<AddinRepositoryEntry> selectedEntry = ((AddinInfoView)sender).SelectedEntries;
InstallDialog dlg = new InstallDialog (this, service);
try {
dlg.InitForInstall (selectedEntry.ToArray ());
if (dlg.Run () == (int) Gtk.ResponseType.Ok)
LoadAll ();
} finally {
dlg.Destroy ();
}
}
protected virtual void OnEnableDisableClicked (object sender, System.EventArgs e)
{
try {
foreach (Addin a in ((AddinInfoView)sender).SelectedAddins) {
a.Enabled = !a.Enabled;
}
LoadAll ();
}
catch (Exception ex) {
Services.ShowError (ex, null, this, true);
}
}
protected virtual void OnUpdateAll (object sender, System.EventArgs e)
{
object[] data = updatesTree.AddinsData;
AddinRepositoryEntry[] entries = new AddinRepositoryEntry [data.Length];
Array.Copy (data, entries, data.Length);
InstallDialog dlg = new InstallDialog (this, service);
try {
dlg.InitForInstall (entries);
if (dlg.Run () == (int) Gtk.ResponseType.Ok)
LoadAll ();
} finally {
dlg.Destroy ();
}
}
static string lastFolder;
protected virtual void OnButtonInstallFromFileClicked (object sender, System.EventArgs e)
{
string[] files;
Gtk.FileChooserDialog dlg = new Gtk.FileChooserDialog (Catalog.GetString ("Install Extension Package"), this, FileChooserAction.Open);
try {
if (lastFolder != null)
dlg.SetCurrentFolder (lastFolder);
else
dlg.SetCurrentFolder (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
dlg.SelectMultiple = true;
Gtk.FileFilter f = new Gtk.FileFilter ();
f.AddPattern ("*.mpack");
f.Name = Catalog.GetString ("Extension packages");
dlg.AddFilter (f);
f = new Gtk.FileFilter ();
f.AddPattern ("*");
f.Name = Catalog.GetString ("All files");
dlg.AddFilter (f);
dlg.AddButton (Gtk.Stock.Cancel, ResponseType.Cancel);
dlg.AddButton (Gtk.Stock.Open, ResponseType.Ok);
if (dlg.Run () != (int) Gtk.ResponseType.Ok)
return;
files = dlg.Filenames;
lastFolder = dlg.CurrentFolder;
} finally {
dlg.Destroy ();
}
InstallDialog idlg = new InstallDialog (this, service);
try {
idlg.InitForInstall (files);
if (idlg.Run () == (int) Gtk.ResponseType.Ok)
LoadAll ();
} finally {
idlg.Destroy ();
}
}
protected void OnNotebookSwitchPage (object o, SwitchPageArgs args)
{
if (args.PageNum == 2 && firstLoad) {
UpdateRepositories ();
firstLoad = false;
}
}
}
}
@@ -0,0 +1,83 @@
//
// AddinManagerWindow.cs
//
// Author:
// Lluis Sanchez Gual
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace Mono.Addins.Gui
{
public class AddinManagerWindow
{
private static bool mAllowInstall = true;
public static bool AllowInstall
{
get { return mAllowInstall; }
set { mAllowInstall = value; }
}
private AddinManagerWindow()
{
}
private static void InitDialog (AddinManagerDialog dlg)
{
dlg.AllowInstall = AllowInstall;
}
public static Gtk.Window Show (Gtk.Window parent)
{
AddinManagerDialog dlg = new AddinManagerDialog (parent);
InitDialog (dlg);
dlg.Show ();
return dlg;
}
public static void Run (Gtk.Window parent)
{
AddinManagerDialog dlg = new AddinManagerDialog (parent);
try {
InitDialog (dlg);
dlg.Run ();
} finally {
dlg.Destroy ();
}
}
public static int RunToInstallFile (Gtk.Window parent, Setup.SetupService service, string file)
{
var dlg = new InstallDialog (parent, service);
try {
dlg.InitForInstall (new [] { file });
return dlg.Run ();
} finally {
dlg.Destroy ();
}
}
}
}
@@ -0,0 +1,572 @@
//
// AddinTreeWidget.cs
//
// Author:
// Lluis Sanchez Gual
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using Gtk;
using Gdk;
using Mono.Addins;
using Mono.Addins.Setup;
using Mono.Unix;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace Mono.Addins.Gui
{
public class AddinTreeWidget
{
protected Gtk.TreeView treeView;
protected Gtk.TreeStore treeStore;
bool allowSelection;
ArrayList selected = new ArrayList ();
Hashtable addinData = new Hashtable ();
TreeViewColumn versionColumn;
string filter;
Dictionary<string,Gdk.Pixbuf> cachedIcons = new Dictionary<string, Gdk.Pixbuf> ();
bool disposed;
Gdk.Pixbuf iconInstalled;
Gdk.Pixbuf updateOverlay;
Gdk.Pixbuf installedOverlay;
public event EventHandler SelectionChanged;
const int ColAddin = 0;
const int ColData = 1;
const int ColName = 2;
const int ColVersion = 3;
const int ColAllowSelection = 4;
const int ColSelected = 5;
const int ColImage = 6;
const int ColShowImage = 7;
public AddinTreeWidget (Gtk.TreeView treeView)
{
iconInstalled = Gdk.Pixbuf.LoadFromResource ("plugin-32.png");
updateOverlay = Gdk.Pixbuf.LoadFromResource ("update-available-overlay-16.png");
installedOverlay = Gdk.Pixbuf.LoadFromResource ("installed-overlay-16.png");
this.treeView = treeView;
ArrayList list = new ArrayList ();
AddStoreTypes (list);
Type[] types = (Type[]) list.ToArray (typeof(Type));
treeStore = new Gtk.TreeStore (types);
treeView.Model = treeStore;
CreateColumns ();
ShowCategories = true;
treeView.Destroyed += HandleTreeViewDestroyed;
}
void HandleTreeViewDestroyed (object sender, EventArgs e)
{
disposed = true;
foreach (var px in cachedIcons.Values)
if (px != null) px.Dispose ();
}
internal void SetFilter (string text)
{
this.filter = text;
}
internal void ShowEmptyMessage ()
{
treeStore.AppendValues (null, null, Catalog.GetString ("No extension packages found"), "", false, false, null, false);
}
protected virtual void AddStoreTypes (ArrayList list)
{
list.Add (typeof(object));
list.Add (typeof(object));
list.Add (typeof(string));
list.Add (typeof(string));
list.Add (typeof(bool));
list.Add (typeof(bool));
list.Add (typeof (Pixbuf));
list.Add (typeof(bool));
}
protected virtual void CreateColumns ()
{
TreeViewColumn col = new TreeViewColumn ();
col.Title = Catalog.GetString ("Extension Package");
CellRendererToggle crtog = new CellRendererToggle ();
crtog.Activatable = true;
crtog.Toggled += new ToggledHandler (OnAddinToggled);
col.PackStart (crtog, false);
CellRendererPixbuf pr = new CellRendererPixbuf ();
col.PackStart (pr, false);
col.AddAttribute (pr, "pixbuf", ColImage);
col.AddAttribute (pr, "visible", ColShowImage);
CellRendererText crt = new CellRendererText ();
crt.Ellipsize = Pango.EllipsizeMode.End;
col.PackStart (crt, true);
col.AddAttribute (crt, "markup", ColName);
col.AddAttribute (crtog, "visible", ColAllowSelection);
col.AddAttribute (crtog, "active", ColSelected);
col.Expand = true;
treeView.AppendColumn (col);
col = new TreeViewColumn ();
col.Title = Catalog.GetString ("Version");
col.PackStart (crt, true);
col.AddAttribute (crt, "markup", ColVersion);
versionColumn = col;
treeView.AppendColumn (col);
}
public bool AllowSelection {
get { return allowSelection; }
set { allowSelection = value; }
}
public bool VersionVisible {
get {
return versionColumn.Visible;
}
set {
versionColumn.Visible = value;
treeView.HeadersVisible = value;
}
}
public bool ShowCategories { get; set; }
void OnAddinToggled (object o, ToggledArgs args)
{
TreeIter it;
if (treeStore.GetIter (out it, new TreePath (args.Path))) {
bool sel = !(bool) treeStore.GetValue (it, 5);
treeStore.SetValue (it, 5, sel);
AddinHeader info = (AddinHeader) treeStore.GetValue (it, 0);
if (sel)
selected.Add (info);
else
selected.Remove (info);
OnSelectionChanged (EventArgs.Empty);
}
}
protected virtual void OnSelectionChanged (EventArgs e)
{
if (SelectionChanged != null)
SelectionChanged (this, e);
}
public void Clear ()
{
addinData.Clear ();
selected.Clear ();
treeStore.Clear ();
}
public TreeIter AddAddin (AddinHeader info, object dataItem, bool enabled)
{
return AddAddin (info, dataItem, enabled, true);
}
public TreeIter AddAddin (AddinHeader info, object dataItem, bool enabled, bool userDir)
{
return AddAddin (info, dataItem, enabled ? AddinStatus.Installed : AddinStatus.Disabled | AddinStatus.Installed);
}
public TreeIter AddAddin (AddinHeader info, object dataItem, AddinStatus status)
{
addinData [info] = dataItem;
TreeIter iter;
if (ShowCategories) {
TreeIter piter = TreeIter.Zero;
if (info.Category == "") {
string otherCat = Catalog.GetString ("Other");
piter = FindCategory (otherCat);
} else {
piter = FindCategory (info.Category);
}
iter = treeStore.AppendNode (piter);
} else {
iter = treeStore.AppendNode ();
}
UpdateRow (iter, info, dataItem, status);
return iter;
}
protected virtual void UpdateRow (TreeIter iter, AddinHeader info, object dataItem, AddinStatus status)
{
bool sel = selected.Contains (info);
treeStore.SetValue (iter, ColAddin, info);
treeStore.SetValue (iter, ColData, dataItem);
string name = EscapeWithFilterMarker (info.Name);
if (!string.IsNullOrEmpty (info.Description)) {
string desc = info.Description;
int i = desc.IndexOf ('\n');
if (i != -1)
desc = desc.Substring (0, i);
name += "\n<small><span foreground=\"darkgrey\">" + EscapeWithFilterMarker (desc) + "</span></small>";
}
if (status != AddinStatus.Disabled) {
treeStore.SetValue (iter, ColName, name);
treeStore.SetValue (iter, ColVersion, info.Version);
treeStore.SetValue (iter, ColAllowSelection, allowSelection);
}
else {
treeStore.SetValue (iter, ColName, "<span foreground=\"grey\">" + name + "</span>");
treeStore.SetValue (iter, ColVersion, "<span foreground=\"grey\">" + info.Version + "</span>");
treeStore.SetValue (iter, ColAllowSelection, false);
}
treeStore.SetValue (iter, ColShowImage, true);
treeStore.SetValue (iter, ColSelected, sel);
SetRowIcon (iter, info, dataItem, status);
}
void SetRowIcon (TreeIter it, AddinHeader info, object dataItem, AddinStatus status)
{
string customIcom = info.Properties.GetPropertyValue ("Icon32");
string iconId = info.Id + " " + info.Version + " " + customIcom;
Gdk.Pixbuf customPix;
if (customIcom.Length == 0) {
customPix = null;
iconId = "__";
}
else if (!cachedIcons.TryGetValue (iconId, out customPix)) {
if (dataItem is Addin) {
string file = Path.Combine (((Addin)dataItem).Description.BasePath, customIcom);
if (File.Exists (file)) {
try {
customPix = new Gdk.Pixbuf (file);
} catch (Exception ex) {
Console.WriteLine (ex);
}
}
cachedIcons [iconId] = customPix;
}
else if (dataItem is AddinRepositoryEntry) {
AddinRepositoryEntry arep = (AddinRepositoryEntry) dataItem;
string tmpId = iconId;
arep.BeginDownloadSupportFile (customIcom, delegate (IAsyncResult res) {
Gtk.Application.Invoke ((o, args) => {
LoadRemoteIcon (it, tmpId, arep, res, info, dataItem, status);
});
}, null);
iconId = "__";
}
}
StoreIcon (it, iconId, customPix, status);
}
Gdk.Pixbuf GetCachedIcon (string id, string effect, Func<Gdk.Pixbuf> pixbufGenerator)
{
Gdk.Pixbuf pix;
if (!cachedIcons.TryGetValue (id + "_" + effect, out pix))
cachedIcons [id + "_" + effect] = pix = pixbufGenerator ();
return pix;
}
internal bool ShowInstalledMarkers = false;
void StoreIcon (TreeIter it, string iconId, Gdk.Pixbuf customPix, AddinStatus status)
{
if (customPix == null)
customPix = iconInstalled;
if ((status & AddinStatus.Installed) == 0) {
treeStore.SetValue (it, ColImage, customPix);
return;
} else if (ShowInstalledMarkers && (status & AddinStatus.HasUpdate) == 0) {
customPix = GetCachedIcon (iconId, "InstalledOverlay", delegate { return Services.AddIconOverlay (customPix, installedOverlay); });
iconId = iconId + "_Installed";
}
if ((status & AddinStatus.Disabled) != 0) {
customPix = GetCachedIcon (iconId, "Desaturate", delegate { return Services.DesaturateIcon (customPix); });
iconId = iconId + "_Desaturate";
}
if ((status & AddinStatus.HasUpdate) != 0)
customPix = GetCachedIcon (iconId, "UpdateOverlay", delegate { return Services.AddIconOverlay (customPix, updateOverlay); });
treeStore.SetValue (it, ColImage, customPix);
}
void LoadRemoteIcon (TreeIter it, string iconId, AddinRepositoryEntry arep, IAsyncResult res, AddinHeader info, object dataItem, AddinStatus status)
{
if (!disposed && treeStore.IterIsValid (it)) {
Gdk.Pixbuf customPix = null;
try {
Gdk.PixbufLoader loader = new Gdk.PixbufLoader (arep.EndDownloadSupportFile (res));
customPix = loader.Pixbuf;
} catch (Exception ex) {
Console.WriteLine (ex);
}
cachedIcons [iconId] = customPix;
StoreIcon (it, iconId, customPix, status);
}
}
string EscapeWithFilterMarker (string txt)
{
if (string.IsNullOrEmpty (filter))
return GLib.Markup.EscapeText (txt);
StringBuilder sb = new StringBuilder ();
int last = 0;
int i = txt.IndexOf (filter, StringComparison.CurrentCultureIgnoreCase);
while (i != -1) {
sb.Append (GLib.Markup.EscapeText (txt.Substring (last, i - last)));
sb.Append ("<span color='blue'>").Append (txt, i, filter.Length).Append ("</span>");
last = i + filter.Length;
i = txt.IndexOf (filter, last, StringComparison.CurrentCultureIgnoreCase);
}
if (last < txt.Length)
sb.Append (GLib.Markup.EscapeText (txt.Substring (last, txt.Length - last)));
return sb.ToString ();
}
public object GetAddinData (AddinHeader info)
{
return addinData [info];
}
public AddinHeader[] GetSelectedAddins ()
{
return (AddinHeader[]) selected.ToArray (typeof(AddinHeader));
}
TreeIter FindCategory (string namePath)
{
TreeIter iter = TreeIter.Zero;
string[] paths = namePath.Split ('/');
foreach (string name in paths) {
TreeIter child;
if (!FindCategory (iter, name, out child)) {
if (iter.Equals (TreeIter.Zero))
iter = treeStore.AppendValues (null, null, name, "", false, false, null, false);
else
iter = treeStore.AppendValues (iter, null, null, name, "", false, false, null, false);
}
else
iter = child;
}
return iter;
}
bool FindCategory (TreeIter piter, string name, out TreeIter child)
{
if (piter.Equals (TreeIter.Zero)) {
if (!treeStore.GetIterFirst (out child))
return false;
}
else if (!treeStore.IterChildren (out child, piter))
return false;
do {
if (((string) treeStore.GetValue (child, ColName)) == name) {
return true;
}
} while (treeStore.IterNext (ref child));
return false;
}
public AddinHeader ActiveAddin {
get {
AddinHeader[] sel = ActiveAddins;
if (sel.Length > 0)
return sel[0];
else
return null;
}
}
public AddinHeader[] ActiveAddins {
get {
List<AddinHeader> list = new List<AddinHeader> ();
foreach (TreePath p in treeView.Selection.GetSelectedRows ()) {
TreeIter iter;
treeStore.GetIter (out iter, p);
AddinHeader ah = (AddinHeader) treeStore.GetValue (iter, 0);
if (ah != null)
list.Add (ah);
}
return list.ToArray ();
}
}
public object ActiveAddinData {
get {
AddinHeader ai = ActiveAddin;
return ai != null ? GetAddinData (ai) : null;
}
}
public object[] ActiveAddinsData {
get {
List<object> res = new List<object> ();
foreach (AddinHeader ai in ActiveAddins) {
res.Add (GetAddinData (ai));
}
return res.ToArray ();
}
}
public object[] AddinsData {
get {
object[] data = new object [addinData.Count];
addinData.Values.CopyTo (data, 0);
return data;
}
}
public object SaveStatus ()
{
TreeIter iter;
ArrayList list = new ArrayList ();
// Save the current selection
list.Add (treeView.Selection.GetSelectedRows ());
if (!treeStore.GetIterFirst (out iter))
return null;
// Save the expand state
do {
SaveStatus (list, iter);
} while (treeStore.IterNext (ref iter));
return list;
}
void SaveStatus (ArrayList list, TreeIter iter)
{
Gtk.TreePath path = treeStore.GetPath (iter);
if (treeView.GetRowExpanded (path))
list.Add (path);
if (treeStore.IterChildren (out iter, iter)) {
do {
SaveStatus (list, iter);
} while (treeStore.IterNext (ref iter));
}
}
public void RestoreStatus (object ob)
{
if (ob == null)
return;
// The first element is the selection
ArrayList list = (ArrayList) ob;
TreePath[] selpaths = (TreePath[]) list [0];
list.RemoveAt (0);
foreach (TreePath path in list)
treeView.ExpandRow (path, false);
foreach (TreePath p in selpaths)
treeView.Selection.SelectPath (p);
}
public void SelectAll ()
{
TreeIter iter;
if (!treeStore.GetIterFirst (out iter))
return;
do {
SelectAll (iter);
} while (treeStore.IterNext (ref iter));
OnSelectionChanged (EventArgs.Empty);
}
void SelectAll (TreeIter iter)
{
AddinHeader info = (AddinHeader) treeStore.GetValue (iter, ColAddin);
if (info != null) {
treeStore.SetValue (iter, ColSelected, true);
if (!selected.Contains (info))
selected.Add (info);
treeView.ExpandToPath (treeStore.GetPath (iter));
} else {
if (treeStore.IterChildren (out iter, iter)) {
do {
SelectAll (iter);
} while (treeStore.IterNext (ref iter));
}
}
}
public void UnselectAll ()
{
TreeIter iter;
if (!treeStore.GetIterFirst (out iter))
return;
do {
UnselectAll (iter);
} while (treeStore.IterNext (ref iter));
OnSelectionChanged (EventArgs.Empty);
}
void UnselectAll (TreeIter iter)
{
AddinHeader info = (AddinHeader) treeStore.GetValue (iter, ColAddin);
if (info != null) {
treeStore.SetValue (iter, ColSelected, false);
selected.Remove (info);
} else {
if (treeStore.IterChildren (out iter, iter)) {
do {
UnselectAll (iter);
} while (treeStore.IterNext (ref iter));
}
}
}
}
[Flags]
public enum AddinStatus
{
NotInstalled = 0,
Installed = 1,
Disabled = 2,
HasUpdate = 4
}
}
@@ -0,0 +1,97 @@
//
// ErrorDialog.cs
//
// Author:
// Lluis Sanchez Gual
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Gtk;
namespace Mono.Addins.Gui
{
partial class ErrorDialog : Dialog
{
TextTag tagNoWrap;
TextTag tagWrap;
public ErrorDialog (Window parent)
{
Build ();
TransientFor = parent;
okButton.Clicked += new EventHandler (OnClose);
expander.Activated += new EventHandler (OnExpanded);
descriptionLabel.ModifyBg (StateType.Normal, new Gdk.Color (255,0,0));
tagNoWrap = new TextTag ("nowrap");
tagNoWrap.WrapMode = WrapMode.None;
detailsTextView.Buffer.TagTable.Add (tagNoWrap);
tagWrap = new TextTag ("wrap");
tagWrap.WrapMode = WrapMode.Word;
detailsTextView.Buffer.TagTable.Add (tagWrap);
expander.Visible = false;
}
public string Message {
get { return descriptionLabel.Text; }
set {
string message = value;
while (message.EndsWith ("\r") || message.EndsWith ("\n"))
message = message.Substring (0, message.Length - 1);
if (!message.EndsWith (".")) message += ".";
descriptionLabel.Text = message;
}
}
public void AddDetails (string text, bool wrapped)
{
TextIter it = detailsTextView.Buffer.EndIter;
if (wrapped)
detailsTextView.Buffer.InsertWithTags (ref it, text, tagWrap);
else
detailsTextView.Buffer.InsertWithTags (ref it, text, tagNoWrap);
expander.Visible = true;
}
void OnClose (object sender, EventArgs args)
{
Destroy ();
}
void OnExpanded (object sender, EventArgs args)
{
GLib.Timeout.Add (100, new GLib.TimeoutHandler (UpdateSize));
}
bool UpdateSize ()
{
int w, h;
GetSize (out w, out h);
Resize (w, 1);
return false;
}
}
}
@@ -0,0 +1,175 @@
//
// HeaderBox.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using Gtk;
namespace Mono.Addins.Gui
{
class HeaderBox: Bin
{
Gtk.Widget child;
int topMargin;
int bottomMargin;
int leftMargin;
int rightMargin;
int topPadding;
int bottomPadding;
int leftPadding;
int rightPadding;
bool useCustomColor;
Gdk.Color customColor;
public HeaderBox ()
{
}
public HeaderBox (int topMargin, int bottomMargin, int leftMargin, int rightMargin)
{
SetMargins (topMargin, bottomMargin, leftMargin, rightMargin);
}
public void Replace (Gtk.Bin parent)
{
Gtk.Widget c = parent.Child;
parent.Remove (c);
Add (c);
parent.Add (this);
}
public void SetMargins (int topMargin, int bottomMargin, int leftMargin, int rightMargin)
{
this.topMargin = topMargin;
this.bottomMargin = bottomMargin;
this.leftMargin = leftMargin;
this.rightMargin = rightMargin;
}
public void SetPadding (int topPadding, int bottomPadding, int leftPadding, int rightPadding)
{
this.topPadding = topPadding;
this.bottomPadding = bottomPadding;
this.leftPadding = leftPadding;
this.rightPadding = rightPadding;
}
public bool GradientBackround { get; set; }
public Gdk.Color BackgroundColor {
get { return customColor; }
set { customColor = value; useCustomColor = true; }
}
public void ResetBackgroundColor ()
{
useCustomColor = false;
}
protected override void OnAdded (Widget widget)
{
base.OnAdded (widget);
child = widget;
}
protected override void OnSizeRequested (ref Requisition requisition)
{
if (child != null) {
requisition = child.SizeRequest ();
requisition.Width += leftMargin + rightMargin + leftPadding + rightPadding;
requisition.Height += topMargin + bottomMargin + topPadding + bottomPadding;
} else {
requisition.Width = 0;
requisition.Height = 0;
}
}
protected override void OnSizeAllocated (Gdk.Rectangle allocation)
{
base.OnSizeAllocated (allocation);
if (allocation.Width > leftMargin + rightMargin + leftPadding + rightPadding) {
allocation.X += leftMargin + leftPadding;
allocation.Width -= leftMargin + rightMargin + leftPadding + rightPadding;
}
if (allocation.Height > topMargin + bottomMargin + topPadding + bottomPadding) {
allocation.Y += topMargin + topPadding;
allocation.Height -= topMargin + bottomMargin + topPadding + bottomPadding;
}
if (child != null)
child.SizeAllocate (allocation);
}
protected override bool OnExposeEvent (Gdk.EventExpose evnt)
{
Gdk.Rectangle rect;
if (GradientBackround) {
rect = new Gdk.Rectangle (Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height);
HslColor gcol = useCustomColor ? customColor : Parent.Style.Background (Gtk.StateType.Normal);
using (Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow)) {
cr.NewPath ();
cr.MoveTo (rect.X, rect.Y);
cr.RelLineTo (rect.Width, 0);
cr.RelLineTo (0, rect.Height);
cr.RelLineTo (-rect.Width, 0);
cr.RelLineTo (0, -rect.Height);
cr.ClosePath ();
using (Cairo.Gradient pat = new Cairo.LinearGradient (rect.X, rect.Y, rect.X, rect.Y + rect.Height - 1)) {
Cairo.Color color1 = gcol;
pat.AddColorStop (0, color1);
gcol.L -= 0.1;
if (gcol.L < 0)
gcol.L = 0;
pat.AddColorStop (1, gcol);
cr.Pattern = pat;
cr.FillPreserve ();
}
}
}
bool res = base.OnExposeEvent (evnt);
Gdk.GC borderColor = Parent.Style.DarkGC (Gtk.StateType.Normal);
rect = Allocation;
for (int n=0; n<topMargin; n++)
GdkWindow.DrawLine (borderColor, rect.X, rect.Y + n, rect.Left + rect.Width - 1, rect.Y + n);
for (int n=0; n<bottomMargin; n++)
GdkWindow.DrawLine (borderColor, rect.X, rect.Top + rect.Height - 1 - n, rect.Left + rect.Width - 1, rect.Top + rect.Height - 1 - n);
for (int n=0; n<leftMargin; n++)
GdkWindow.DrawLine (borderColor, rect.X + n, rect.Y, rect.X + n, rect.Top + rect.Height - 1);
for (int n=0; n<rightMargin; n++)
GdkWindow.DrawLine (borderColor, rect.Left + rect.Width - 1 - n, rect.Y, rect.Left + rect.Width - 1 - n, rect.Top + rect.Height - 1);
return res;
}
}
}
@@ -0,0 +1,267 @@
/***************************************************************************
* HoverImageButton.cs
*
* Copyright (C) 2007 Novell, Inc.
* Written by Aaron Bockover <abockover@novell.com>
****************************************************************************/
/* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW:
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
using System;
using Gtk;
namespace Mono.Addins.Gui
{
class HoverImageButton : EventBox
{
private static Gdk.Cursor hand_cursor = new Gdk.Cursor(Gdk.CursorType.Hand1);
private IconSize icon_size = IconSize.Menu;
private string [] icon_names = { "image-missing", Stock.MissingImage };
private Gdk.Pixbuf normal_pixbuf;
private Gdk.Pixbuf active_pixbuf;
private Image image;
private bool is_hovering;
private bool is_pressed;
private bool draw_focus = true;
private event EventHandler clicked;
public event EventHandler Clicked {
add { clicked += value; }
remove { clicked -= value; }
}
public HoverImageButton()
{
CanFocus = true;
image = new Image();
image.Show();
Add(image);
}
public HoverImageButton(IconSize size, string icon_name) : this(size, new string [] { icon_name })
{
}
public HoverImageButton(IconSize size, string [] icon_names) : this()
{
this.icon_size = size;
this.icon_names = icon_names;
}
public new void Activate()
{
EventHandler handler = clicked;
if(handler != null) {
handler(this, EventArgs.Empty);
}
}
private bool changing_style = false;
protected override void OnStyleSet(Style previous_style)
{
if(changing_style) {
return;
}
changing_style = true;
if (normal_pixbuf == null)
LoadPixbufs();
changing_style = false;
}
protected override bool OnEnterNotifyEvent(Gdk.EventCrossing evnt)
{
image.GdkWindow.Cursor = hand_cursor;
is_hovering = true;
UpdateImage();
return base.OnEnterNotifyEvent(evnt);
}
protected override bool OnLeaveNotifyEvent(Gdk.EventCrossing evnt)
{
is_hovering = false;
UpdateImage();
return base.OnLeaveNotifyEvent(evnt);
}
protected override bool OnFocusInEvent(Gdk.EventFocus evnt)
{
bool ret = base.OnFocusInEvent(evnt);
UpdateImage();
return ret;
}
protected override bool OnFocusOutEvent(Gdk.EventFocus evnt)
{
bool ret = base.OnFocusOutEvent(evnt);
UpdateImage();
return ret;
}
protected override bool OnButtonPressEvent(Gdk.EventButton evnt)
{
if(evnt.Button != 1) {
return base.OnButtonPressEvent(evnt);
}
HasFocus = true;
is_pressed = true;
QueueDraw();
return base.OnButtonPressEvent(evnt);
}
protected override bool OnButtonReleaseEvent(Gdk.EventButton evnt)
{
if(evnt.Button != 1) {
return base.OnButtonReleaseEvent(evnt);
}
is_pressed = false;
QueueDraw();
Activate();
return base.OnButtonReleaseEvent(evnt);
}
protected override bool OnExposeEvent(Gdk.EventExpose evnt)
{
base.OnExposeEvent(evnt);
PropagateExpose(Child, evnt);
if(HasFocus && draw_focus) {
Style.PaintFocus(Style, GdkWindow, StateType.Normal, evnt.Area, this, "button",
0, 0, Allocation.Width, Allocation.Height);
}
return true;
}
private void UpdateImage()
{
image.Pixbuf = is_hovering || is_pressed || HasFocus
? active_pixbuf : normal_pixbuf;
}
private void LoadPixbufs()
{
int width, height;
Icon.SizeLookup(icon_size, out width, out height);
IconTheme theme = IconTheme.GetForScreen(Screen);
if(normal_pixbuf != null) {
normal_pixbuf.Dispose();
normal_pixbuf = null;
}
if(active_pixbuf != null) {
active_pixbuf.Dispose();
active_pixbuf = null;
}
for(int i = 0; i < icon_names.Length; i++) {
try {
normal_pixbuf = RenderIcon(icon_names[i], icon_size, null)
?? theme.LoadIcon(icon_names[i], width, 0);
active_pixbuf = ColorShiftPixbuf(normal_pixbuf, 30);
break;
} catch {
}
}
UpdateImage();
}
public Gdk.Pixbuf Pixbuf {
get { return this.normal_pixbuf; }
set {
this.normal_pixbuf = value;
active_pixbuf = ColorShiftPixbuf(normal_pixbuf, 30);
UpdateImage();
}
}
private static byte PixelClamp(int val)
{
return (byte)System.Math.Max(0, System.Math.Min(255, val));
}
private unsafe Gdk.Pixbuf ColorShiftPixbuf(Gdk.Pixbuf src, byte shift)
{
Gdk.Pixbuf dest = new Gdk.Pixbuf(src.Colorspace, src.HasAlpha, src.BitsPerSample, src.Width, src.Height);
byte *src_pixels_orig = (byte *)src.Pixels;
byte *dest_pixels_orig = (byte *)dest.Pixels;
for(int i = 0; i < src.Height; i++) {
byte *src_pixels = src_pixels_orig + i * src.Rowstride;
byte *dest_pixels = dest_pixels_orig + i * dest.Rowstride;
for(int j = 0; j < src.Width; j++) {
*(dest_pixels++) = PixelClamp(*(src_pixels++) + shift);
*(dest_pixels++) = PixelClamp(*(src_pixels++) + shift);
*(dest_pixels++) = PixelClamp(*(src_pixels++) + shift);
if(src.HasAlpha) {
*(dest_pixels++) = *(src_pixels++);
}
}
}
return dest;
}
public string [] IconNames {
get { return icon_names; }
set {
icon_names = value;
LoadPixbufs();
}
}
public IconSize IconSize {
get { return icon_size; }
set {
icon_size = value;
LoadPixbufs();
}
}
public Image Image {
get { return image; }
}
public bool DrawFocus {
get { return draw_focus; }
set {
draw_focus = value;
QueueDraw();
}
}
}
}
@@ -0,0 +1,164 @@
//
// HslColor.cs
//
// Author:
// Mike Krüger <mkrueger@novell.com>
//
// Copyright (c) 2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using Gdk;
namespace Mono.Addins.Gui
{
struct HslColor
{
public double H {
get;
set;
}
public double S {
get;
set;
}
public double L {
get;
set;
}
static Gdk.Color black = new Gdk.Color (0, 0, 0);
public static implicit operator Color (HslColor hsl)
{
if (hsl.L > 1) hsl.L = 1;
if (hsl.L < 0) hsl.L = 0;
if (hsl.H > 1) hsl.H = 1;
if (hsl.H < 0) hsl.H = 0;
if (hsl.S > 1) hsl.S = 1;
if (hsl.S < 0) hsl.S = 0;
double r = 0, g = 0, b = 0;
if (hsl.L == 0)
return black;
if (hsl.S == 0) {
r = g = b = hsl.L;
} else {
double temp2 = hsl.L <= 0.5 ? hsl.L * (1.0 + hsl.S) : hsl.L + hsl.S -(hsl.L * hsl.S);
double temp1 = 2.0 * hsl.L - temp2;
double[] t3 = new double[] { hsl.H + 1.0 / 3.0, hsl.H, hsl.H - 1.0 / 3.0};
double[] clr= new double[] { 0, 0, 0};
for (int i = 0; i < 3; i++) {
if (t3[i] < 0)
t3[i] += 1.0;
if (t3[i] > 1)
t3[i]-=1.0;
if (6.0 * t3[i] < 1.0)
clr[i] = temp1 + (temp2 - temp1) * t3[i] * 6.0;
else if (2.0 * t3[i] < 1.0)
clr[i] = temp2;
else if (3.0 * t3[i] < 2.0)
clr[i] = (temp1 + (temp2 - temp1) * ((2.0 / 3.0) - t3[i]) * 6.0);
else
clr[i] = temp1;
}
r = clr[0];
g = clr[1];
b = clr[2];
}
return new Color ((byte)(255 * r),
(byte)(255 * g),
(byte)(255 * b));
}
public static Cairo.Color ToCairoColor (Gdk.Color color)
{
return new Cairo.Color ((double)color.Red / ushort.MaxValue,
(double)color.Green / ushort.MaxValue,
(double)color.Blue / ushort.MaxValue);
}
public static implicit operator Cairo.Color (HslColor hsl)
{
return ToCairoColor ((Gdk.Color)hsl);
}
public static implicit operator HslColor (Color color)
{
return new HslColor (color);
}
public HslColor (Color color) : this ()
{
double r = color.Red / (double)ushort.MaxValue;
double g = color.Green / (double)ushort.MaxValue;
double b = color.Blue / (double)ushort.MaxValue;
double v = System.Math.Max (r, g);
v = System.Math.Max (v, b);
double m = System.Math.Min (r, g);
m = System.Math.Min (m, b);
this.L = (m + v) / 2.0;
if (this.L <= 0.0)
return;
double vm = v - m;
this.S = vm;
if (this.S > 0.0) {
this.S /= (this.L <= 0.5) ? (v + m) : (2.0 - v - m);
} else {
return;
}
double r2 = (v - r) / vm;
double g2 = (v - g) / vm;
double b2 = (v - b) / vm;
if (r == v) {
this.H = (g == m ? 5.0 + b2 : 1.0 - g2);
} else if (g == v) {
this.H = (b == m ? 1.0 + r2 : 3.0 - b2);
} else {
this.H = (r == m ? 3.0 + g2 : 5.0 - r2);
}
this.H /= 6.0;
}
public static double Brightness (Gdk.Color c)
{
double r = c.Red / (double)ushort.MaxValue;
double g = c.Green / (double)ushort.MaxValue;
double b = c.Blue / (double)ushort.MaxValue;
return System.Math.Sqrt (r * .241 + g * .691 + b * .068);
}
public override string ToString ()
{
return string.Format ("[HslColor: H={0}, S={1}, L={2}]", H, S, L);
}
}
}
@@ -0,0 +1,276 @@
//
// InstallDialog.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using Mono.Addins.Setup;
using Mono.Addins.Description;
using System.Text;
using Mono.Unix;
using System.Threading;
using System.Linq;
using System.Collections.Generic;
namespace Mono.Addins.Gui
{
internal partial class InstallDialog : Gtk.Dialog
{
string[] filesToInstall;
AddinRepositoryEntry[] addinsToInstall;
PackageCollection packagesToInstall;
SetupService service;
Gtk.ResponseType response = Gtk.ResponseType.None;
IEnumerable<string> uninstallIds;
InstallMonitor installMonitor;
bool installing;
const int MaxHeight = 350;
public InstallDialog (Gtk.Window parent, SetupService service)
{
this.Build ();
this.service = service;
TransientFor = parent;
WindowPosition = Gtk.WindowPosition.CenterOnParent;
Services.PlaceDialog (this, parent);
boxProgress.Visible = false;
Resizable = false;
}
public void InitForInstall (AddinRepositoryEntry[] addinsToInstall)
{
this.addinsToInstall = addinsToInstall;
FillSummaryPage ();
Services.PlaceDialog (this, TransientFor);
}
public void InitForInstall (string[] filesToInstall)
{
this.filesToInstall = filesToInstall;
FillSummaryPage ();
Services.PlaceDialog (this, TransientFor);
}
public void InitForUninstall (Addin[] info)
{
this.uninstallIds = info.Select (a => a.Id);
buttonOk.Label = Catalog.GetString ("Uninstall");
HashSet<Addin> sinfos = new HashSet<Addin> ();
StringBuilder sb = new StringBuilder ();
sb.Append ("<b>").Append (Catalog.GetString ("The following packages will be uninstalled:")).Append ("</b>\n\n");
foreach (var a in info) {
sb.Append (a.Name + "\n\n");
sinfos.UnionWith (service.GetDependentAddins (a.Id, true));
}
if (sinfos.Count > 0) {
sb.Append ("<b>").Append (Catalog.GetString ("There are other extension packages that depend on the previous ones which will also be uninstalled:")).Append ("</b>\n\n");
foreach (Addin si in sinfos)
sb.Append (si.Description.Name + "\n");
}
ShowMessage (sb.ToString ());
Services.PlaceDialog (this, TransientFor);
}
void FillSummaryPage ()
{
PackageCollection packs = new PackageCollection ();
if (filesToInstall != null) {
foreach (string file in filesToInstall) {
packs.Add (Package.FromFile (file));
}
}
else {
foreach (AddinRepositoryEntry arep in addinsToInstall) {
packs.Add (Package.FromRepository (arep));
}
}
packagesToInstall = new PackageCollection (packs);
PackageCollection toUninstall;
DependencyCollection unresolved;
bool res;
InstallMonitor m = new InstallMonitor ();
res = service.ResolveDependencies (m, packs, out toUninstall, out unresolved);
StringBuilder sb = new StringBuilder ();
if (!res) {
sb.Append ("<b><span foreground=\"red\">").Append (Catalog.GetString ("The selected extension packages can't be installed because there are dependency conflicts.")).Append ("</span></b>\n");
foreach (string s in m.Errors) {
sb.Append ("<b><span foreground=\"red\">" + s + "</span></b>\n");
}
sb.Append ("\n");
}
if (m.Warnings.Count != 0) {
foreach (string w in m.Warnings) {
sb.Append ("<b><span foreground=\"red\">" + w + "</span></b>\n");
}
sb.Append ("\n");
}
sb.Append ("<b>").Append (Catalog.GetString ("The following packages will be installed:")).Append ("</b>\n\n");
foreach (Package p in packs) {
sb.Append (p.Name);
if (!p.SharedInstall)
sb.Append (Catalog.GetString (" (in user directory)"));
sb.Append ("\n");
}
sb.Append ("\n");
if (toUninstall.Count > 0) {
sb.Append ("<b>").Append (Catalog.GetString ("The following packages need to be uninstalled:")).Append ("</b>\n\n");
foreach (Package p in toUninstall) {
sb.Append (p.Name + "\n");
}
sb.Append ("\n");
}
if (unresolved.Count > 0) {
sb.Append ("<b>").Append (Catalog.GetString ("The following dependencies could not be resolved:")).Append ("</b>\n\n");
foreach (Dependency p in unresolved) {
sb.Append (p.Name + "\n");
}
sb.Append ("\n");
}
buttonOk.Sensitive = res;
ShowMessage (sb.ToString ());
}
void ShowMessage (string txt)
{
labelInfo.Markup = txt.TrimEnd ('\n','\t',' ');
if (labelInfo.SizeRequest ().Height > MaxHeight) {
scrolledwindow1.VscrollbarPolicy = Gtk.PolicyType.Automatic;
scrolledwindow1.HeightRequest = MaxHeight;
}
else {
scrolledwindow1.HeightRequest = labelInfo.SizeRequest ().Height;
}
}
protected virtual void OnButtonOkClicked (object sender, System.EventArgs e)
{
if (response != Gtk.ResponseType.None) {
Respond (response);
return;
}
Install ();
}
protected virtual void OnButtonCancelClicked (object sender, System.EventArgs e)
{
if (installing) {
if (Services.AskQuestion (Catalog.GetString ("Are you sure you want to cancel the installation?")))
installMonitor.Cancel ();
} else
Respond (Gtk.ResponseType.Cancel);
}
void Install ()
{
insSeparator.Visible = true;
boxProgress.Visible = true;
buttonOk.Sensitive = false;
string txt;
string errmessage;
string warnmessage;
ThreadStart oper;
if (uninstallIds == null) {
installMonitor = new InstallMonitor (globalProgressLabel, mainProgressBar, Catalog.GetString ("Installing Extension Packages"));
oper = new ThreadStart (RunInstall);
errmessage = Catalog.GetString ("The installation failed!");
warnmessage = Catalog.GetString ("The installation has completed with warnings.");
} else {
installMonitor = new InstallMonitor (globalProgressLabel, mainProgressBar, Catalog.GetString ("Uninstalling Extension Packages"));
oper = new ThreadStart (RunUninstall);
errmessage = Catalog.GetString ("The uninstallation failed!");
warnmessage = Catalog.GetString ("The uninstallation has completed with warnings.");
}
installing = true;
oper ();
installing = false;
buttonCancel.Visible = false;
buttonOk.Label = Gtk.Stock.Close;
buttonOk.UseStock = true;
if (installMonitor.Success && installMonitor.Warnings.Count == 0) {
Respond (Gtk.ResponseType.Ok);
return;
} else if (installMonitor.Success) {
txt = "<b>" + warnmessage + "</b>\n\n";
foreach (string s in installMonitor.Warnings)
txt += GLib.Markup.EscapeText (s) + "\n";
response = Gtk.ResponseType.Ok;
buttonOk.Sensitive = true;
} else {
buttonCancel.Label = Gtk.Stock.Close;
buttonCancel.UseStock = true;
txt = "<span foreground=\"red\"><b>" + errmessage + "</b></span>\n\n";
foreach (string s in installMonitor.Errors)
txt += GLib.Markup.EscapeText (s) + "\n";
response = Gtk.ResponseType.Cancel;
buttonOk.Sensitive = true;
}
ShowMessage (txt);
}
void RunInstall ()
{
try {
if (filesToInstall != null)
service.Install (installMonitor, filesToInstall);
else
service.Install (installMonitor, packagesToInstall);
} catch (Exception ex) {
installMonitor.Errors.Add (ex.Message);
} finally {
installMonitor.Dispose ();
}
}
void RunUninstall ()
{
try {
service.Uninstall (installMonitor, uninstallIds);
} catch (Exception ex) {
installMonitor.Errors.Add (ex.Message);
} finally {
installMonitor.Dispose ();
}
}
}
}
@@ -0,0 +1,133 @@
//
// AddinInstallDialog.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2011 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
using System.Text;
using System.Threading;
using System.Collections;
using System.Collections.Specialized;
using System.Diagnostics;
using Mono.Unix;
using Gtk;
using Mono.Addins.Setup;
using Mono.Addins.Description;
namespace Mono.Addins.Gui
{
class InstallMonitor: IProgressStatus, IDisposable
{
Label progressLabel;
ProgressBar progressBar;
StringCollection errors = new StringCollection ();
StringCollection warnings = new StringCollection ();
bool canceled;
bool done;
string mainOperation;
public InstallMonitor (Label progressLabel, ProgressBar progressBar, string mainOperation)
{
this.progressLabel = progressLabel;
this.progressBar = progressBar;
this.mainOperation = mainOperation;
}
public InstallMonitor ()
{
}
public void SetMessage (string msg)
{
if (progressLabel != null)
progressLabel.Markup = "<b>" + GLib.Markup.EscapeText (mainOperation) + "</b>\n" + GLib.Markup.EscapeText (msg);
RunPendingEvents ();
}
public void SetProgress (double progress)
{
if (progressBar != null)
progressBar.Fraction = progress;
RunPendingEvents ();
}
public void Log (string msg)
{
Console.WriteLine (msg);
}
public void ReportWarning (string message)
{
warnings.Add (message);
}
public void ReportError (string message, Exception exception)
{
errors.Add (message);
}
public bool IsCanceled {
get { return canceled; }
}
public StringCollection Errors {
get { return errors; }
}
public StringCollection Warnings {
get { return warnings; }
}
public void Cancel ()
{
canceled = true;
}
public int LogLevel {
get { return 1; }
}
public void Dispose ()
{
done = true;
}
public void WaitForCompleted ()
{
while (!done) {
RunPendingEvents ();
Thread.Sleep (50);
}
}
public bool Success {
get { return errors.Count == 0; }
}
void RunPendingEvents ()
{
while (Gtk.Application.EventsPending ())
Gtk.Application.RunIteration ();
}
}
}
@@ -0,0 +1,173 @@
//
// ManageSitesDialog.cs
//
// Author:
// Lluis Sanchez Gual
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Gtk;
using Mono.Unix;
using System.Threading;
using Mono.Addins.Setup;
namespace Mono.Addins.Gui
{
partial class ManageSitesDialog : Dialog
{
ListStore treeStore;
SetupService service;
public ManageSitesDialog (Gtk.Window parent, SetupService service)
{
Build ();
TransientFor = parent;
Services.PlaceDialog (this, parent);
this.service = service;
treeStore = new Gtk.ListStore (typeof (string), typeof (string), typeof(bool));
repoTree.Model = treeStore;
repoTree.HeadersVisible = false;
var crt = new Gtk.CellRendererToggle ();
crt.Toggled += HandleRepoToggled;
repoTree.AppendColumn ("", crt, "active", 2);
repoTree.AppendColumn ("", new Gtk.CellRendererText (), "markup", 1);
repoTree.Selection.Changed += new EventHandler(OnSelect);
AddinRepository[] reps = service.Repositories.GetRepositories ();
foreach (AddinRepository rep in reps)
AppendRepository (rep);
btnRemove.Sensitive = false;
}
public override void Dispose ()
{
base.Dispose ();
Destroy ();
}
void AppendRepository (AddinRepository rep)
{
string txt = GLib.Markup.EscapeText (rep.Title) + "\n<span color='darkgray'>" + GLib.Markup.EscapeText (rep.Url) + "</span>";
treeStore.AppendValues (rep.Url, txt, rep.Enabled);
}
protected void OnAdd (object sender, EventArgs e)
{
NewSiteDialog dlg = new NewSiteDialog (this);
try {
if (dlg.Run ()) {
string url = dlg.Url;
if (!url.StartsWith ("http://") && !url.StartsWith ("https://") && !url.StartsWith ("file://")) {
url = "http://" + url;
}
try {
new Uri (url);
} catch {
Services.ShowError (null, "Invalid url: " + url, null, true);
}
if (!service.Repositories.ContainsRepository (url)) {
ProgressDialog pdlg = new ProgressDialog (this);
pdlg.Show ();
pdlg.SetMessage (AddinManager.CurrentLocalizer.GetString ("Registering repository"));
bool done = false;
AddinRepository rr = null;
Exception error = null;
ThreadPool.QueueUserWorkItem (delegate {
try {
rr = service.Repositories.RegisterRepository (pdlg, url, true);
} catch (System.Exception ex) {
error = ex;
} finally {
done = true;
}
});
while (!done) {
if (Gtk.Application.EventsPending ())
Gtk.Application.RunIteration ();
else
Thread.Sleep (100);
}
pdlg.Destroy ();
if (pdlg.HadError) {
if (rr != null)
service.Repositories.RemoveRepository (rr.Url);
return;
}
if (error != null) {
Services.ShowError (error, "The repository could not be registered", null, true);
return;
}
AppendRepository (rr);
}
}
} finally {
dlg.Destroy ();
}
}
protected void OnRemove (object sender, EventArgs e)
{
Gtk.TreeModel foo;
Gtk.TreeIter iter;
if (!repoTree.Selection.GetSelected (out foo, out iter))
return;
string rep = (string) treeStore.GetValue (iter, 0);
service.Repositories.RemoveRepository (rep);
treeStore.Remove (ref iter);
}
void HandleRepoToggled (object o, ToggledArgs args)
{
Gtk.TreeIter iter;
if (!treeStore.GetIterFromString (out iter, args.Path))
return;
bool newVal = !(bool) treeStore.GetValue (iter, 2);
string rep = (string) treeStore.GetValue (iter, 0);
service.Repositories.SetRepositoryEnabled (rep, newVal);
treeStore.SetValue (iter, 2, newVal);
}
protected void OnSelect(object sender, EventArgs e)
{
btnRemove.Sensitive = repoTree.Selection.CountSelectedRows() > 0;
}
}
}
@@ -0,0 +1,117 @@
//
// NewSiteDialog.cs
//
// Author:
// Lluis Sanchez Gual
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Gtk;
namespace Mono.Addins.Gui
{
partial class NewSiteDialog : Dialog
{
public NewSiteDialog (Gtk.Window parent)
{
Build ();
TransientFor = parent;
Services.PlaceDialog (this, parent);
pathEntry.Sensitive = false;
CheckValues ();
}
public override void Dispose ()
{
base.Dispose ();
Destroy ();
}
public string Url {
get {
if (btnOnlineRep.Active)
return urlText.Text;
else if (pathEntry.Text.Length > 0)
return "file://" + pathEntry.Text;
else
return string.Empty;
}
}
void CheckValues ()
{
btnOk.Sensitive = (Url != "");
}
public new bool Run ()
{
ShowAll ();
return ((ResponseType) base.Run ()) == ResponseType.Ok;
}
protected void OnClose (object sender, EventArgs args)
{
Destroy ();
}
protected void OnOptionClicked (object sender, EventArgs e)
{
if (btnOnlineRep.Active) {
urlText.Sensitive = true;
pathEntry.Sensitive = false;
} else {
urlText.Sensitive = false;
pathEntry.Sensitive = true;
}
CheckValues ();
}
protected virtual void OnButtonBrowseClicked(object sender, System.EventArgs e)
{
FileChooserDialog dlg = new FileChooserDialog ("Select Folder", this, FileChooserAction.SelectFolder);
try {
dlg.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel);
dlg.AddButton (Gtk.Stock.Open, Gtk.ResponseType.Ok);
dlg.SetFilename (Environment.GetFolderPath (Environment.SpecialFolder.Personal));
if (dlg.Run () == (int) ResponseType.Ok) {
pathEntry.Text = dlg.Filename;
}
} finally {
dlg.Destroy ();
}
}
protected virtual void OnPathEntryChanged(object sender, System.EventArgs e)
{
CheckValues ();
}
protected virtual void OnUrlTextChanged (object sender, System.EventArgs e)
{
CheckValues ();
}
}
}
@@ -0,0 +1,112 @@
// ProgressDialog.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
//
// Copyright (c) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//
using System;
namespace Mono.Addins.Gui
{
internal partial class ProgressDialog : Gtk.Dialog, IProgressStatus
{
bool cancelled;
bool hadError;
public ProgressDialog (Gtk.Window parent)
{
this.Build();
Services.PlaceDialog (this, parent);
}
public bool IsCanceled {
get {
return cancelled;
}
}
public int LogLevel {
get {
return 1;
}
}
public bool HadError {
get {
return hadError;
}
}
public void SetMessage (string msg)
{
Gtk.Application.Invoke ((o, args) => {
labelMessage.Text = msg;
});
}
public void SetProgress (double progress)
{
Gtk.Application.Invoke ((o, args) => {
progressbar.Fraction = progress;
});
}
public void Log (string msg)
{
Gtk.Application.Invoke ((o, args) => {
Gtk.TextIter it = textview.Buffer.EndIter;
textview.Buffer.Insert (ref it, msg + "\n");
});
}
public void ReportWarning (string message)
{
Log ("WARNING: " + message);
}
public void ReportError (string message, Exception exception)
{
Log ("Error: " + message);
if (exception != null)
Log (exception.ToString ());
Gtk.Application.Invoke ((o, args) => {
Services.ShowError (exception, message, null, true);
});
hadError = true;
}
public void Cancel ()
{
Gtk.Application.Invoke ((o, args) => {
cancelled = true;
buttonCancel.Sensitive = false;
});
}
protected virtual void OnButtonCancelClicked (object sender, System.EventArgs e)
{
Cancel ();
}
}
}
@@ -0,0 +1,147 @@
//
// SearchEntry.cs
//
// Author:
// Aaron Bockover <abockover@novell.com>
// Gabriel Burt <gburt@novell.com>
//
// Copyright 2007-2010 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Gtk;
namespace Mono.Addins.Gui
{
[System.ComponentModel.ToolboxItem(true)]
class SearchEntry : EventBox
{
HBox box = new HBox ();
Gtk.Entry entry = new Gtk.Entry ();
HoverImageButton iconFind;
HoverImageButton iconClean;
const int notifyDelay = 50;
bool notifying;
public SearchEntry ()
{
entry.HasFrame = false;
box.PackStart (entry, true, true, 0);
iconFind = new HoverImageButton (IconSize.Menu, Gtk.Stock.Find);
box.PackStart (iconFind, false, false, 0);
iconClean = new HoverImageButton (IconSize.Menu, Gtk.Stock.Clear);
box.PackStart (iconClean, false, false, 0);
box.BorderWidth = 1;
HeaderBox hbox = new HeaderBox (1,1,1,1);
hbox.Show ();
hbox.Add (box);
Add (hbox);
UpdateStyle ();
entry.StyleSet += UpdateStyle;
iconClean.BorderWidth = 1;
iconFind.BorderWidth = 1;
iconClean.Clicked += delegate {
entry.Text = string.Empty;
};
iconFind.Clicked += delegate {
FireSearch ();
};
entry.Activated += delegate {
FireSearch ();
};
ShowAll ();
UpdateIcon ();
entry.Changed += delegate {
UpdateIcon ();
FireSearch ();
};
}
public event EventHandler TextChanged;
public Gtk.Entry Entry {
get {
return this.entry;
}
set {
if (entry != null)
entry.StyleSet -= UpdateStyle;
entry = value;
entry.StyleSet += UpdateStyle;
}
}
public string Text {
get { return entry.Text; }
}
void UpdateIcon ()
{
if (entry.Text.Length > 0) {
iconFind.Hide ();
iconClean.Show ();
}
else {
iconFind.Show ();
iconClean.Hide ();
}
}
void FireSearch ()
{
if (!notifying) {
notifying = true;
GLib.Timeout.Add (notifyDelay, delegate {
notifying = false;
if (TextChanged != null)
TextChanged (this, EventArgs.Empty);
return false;
});
}
}
void UpdateStyle (object o = null, StyleSetArgs args = null)
{
if (entry != null) {
ModifyBg (StateType.Normal, entry.Style.Base (StateType.Normal));
iconClean.ModifyBg (StateType.Normal, entry.Style.Base (StateType.Normal));
iconFind.ModifyBg (StateType.Normal, entry.Style.Base (StateType.Normal));
}
}
protected override void OnRealized ()
{
base.OnRealized ();
UpdateStyle ();
}
}
}
@@ -0,0 +1,155 @@
//
// Services.cs
//
// Author:
// Lluis Sanchez Gual
//
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Gtk;
using Mono.Unix;
using Mono.Addins.Setup;
using Mono.Addins.Description;
using System.Linq;
using System.Collections.Generic;
namespace Mono.Addins.Gui
{
internal class Services
{
public static bool InApplicationNamespace (SetupService service, string id)
{
return service.ApplicationNamespace == null || id.StartsWith (service.ApplicationNamespace + ".");
}
public static bool AskQuestion (string question)
{
MessageDialog md = new MessageDialog (null, DialogFlags.Modal | DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.YesNo, question);
try {
int response = md.Run ();
return ((ResponseType) response == ResponseType.Yes);
} finally {
md.Destroy ();
}
}
public static void ShowError (Exception ex, string message, Window parent, bool modal)
{
ErrorDialog dlg = new ErrorDialog (parent);
if (message == null) {
if (ex != null)
dlg.Message = string.Format (Catalog.GetString ("Exception occurred: {0}"), ex.Message);
else {
dlg.Message = "An unknown error occurred";
dlg.AddDetails (Environment.StackTrace, false);
}
} else
dlg.Message = message;
if (ex != null) {
dlg.AddDetails (string.Format (Catalog.GetString ("Exception occurred: {0}"), ex.Message) + "\n\n", true);
dlg.AddDetails (ex.ToString (), false);
}
if (modal) {
dlg.Run ();
dlg.Destroy ();
} else
dlg.Show ();
}
public struct MissingDepInfo
{
public string Addin;
public string Required;
public string Found;
}
public static IEnumerable<MissingDepInfo> GetMissingDependencies (Addin addin)
{
IEnumerable<Addin> allAddins = AddinManager.Registry.GetAddins ().Union (AddinManager.Registry.GetAddinRoots ());
foreach (var dep in addin.Description.MainModule.Dependencies) {
AddinDependency adep = dep as AddinDependency;
if (adep != null) {
if (!allAddins.Any (a => Addin.GetIdName (a.Id) == Addin.GetIdName (adep.FullAddinId) && a.SupportsVersion (adep.Version))) {
Addin found = allAddins.FirstOrDefault (a => Addin.GetIdName (a.Id) == Addin.GetIdName (adep.FullAddinId));
yield return new MissingDepInfo () { Addin = Addin.GetIdName (adep.FullAddinId), Required = adep.Version, Found = found != null ? found.Version : null };
}
}
}
}
public static Gdk.Pixbuf AddIconOverlay (Gdk.Pixbuf target, Gdk.Pixbuf overlay)
{
Gdk.Pixbuf res = new Gdk.Pixbuf (target.Colorspace, target.HasAlpha, target.BitsPerSample, target.Width, target.Height);
res.Fill (0);
target.CopyArea (0, 0, target.Width, target.Height, res, 0, 0);
overlay.Composite (res, 0, 0, overlay.Width, overlay.Height, 0, 0, 1, 1, Gdk.InterpType.Bilinear, 255);
return res;
}
public static Gdk.Pixbuf DesaturateIcon (Gdk.Pixbuf source)
{
Gdk.Pixbuf dest = new Gdk.Pixbuf (source.Colorspace, source.HasAlpha, source.BitsPerSample, source.Width, source.Height);
dest.Fill (0);
source.SaturateAndPixelate (dest, 0, false);
return dest;
}
public static Gdk.Pixbuf FadeIcon (Gdk.Pixbuf source)
{
Gdk.Pixbuf result = source.Copy ();
result.Fill (0);
result = result.AddAlpha (true, 0, 0, 0);
source.Composite (result, 0, 0, source.Width, source.Height, 0, 0, 1, 1, Gdk.InterpType.Bilinear, 128);
return result;
}
/// <summary>
/// Positions a dialog relative to its parent on platforms where default placement is known to be poor.
/// </summary>
public static void PlaceDialog (Window child, Window parent)
{
CenterWindow (child, parent);
}
/// <summary>Centers a window relative to its parent.</summary>
static void CenterWindow (Window child, Window parent)
{
if (child == null || parent == null)
return;
child.Child.Show ();
int w, h, winw, winh, x, y, winx, winy;
child.GetSize (out w, out h);
parent.GetSize (out winw, out winh);
parent.GetPosition (out winx, out winy);
x = System.Math.Max (0, (winw - w) /2) + winx;
y = System.Math.Max (0, (winh - h) /2) + winy;
child.Move (x, y);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 534 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 321 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1010 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 978 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 784 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 784 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Some files were not shown because too many files have changed in this diff Show More