Fix gravatars and build on Windows

This commit is contained in:
Hylke Bons 2012-08-11 19:05:45 +01:00
parent a3b5cf2f4d
commit 49b0dd94f7
8 changed files with 20 additions and 46 deletions

View file

@ -37,7 +37,8 @@ namespace SparkleShare {
public static void Main (string [] args) public static void Main (string [] args)
{ {
if (args.Length != 0 && !args [0].Equals ("start") && if (args.Length != 0 && !args [0].Equals ("start") &&
SparkleBackend.Platform != PlatformID.MacOSX) { SparkleBackend.Platform != PlatformID.MacOSX &&
SparkleBackend.Platform != PlatformID.Win32NT) {
string n = Environment.NewLine; string n = Environment.NewLine;
@ -53,10 +54,10 @@ namespace SparkleShare {
"under certain conditions. Please read the GNU GPLv3 for details." + n + "under certain conditions. Please read the GNU GPLv3 for details." + n +
n + n +
"Usage: sparkleshare [start|stop|restart]"); "Usage: sparkleshare [start|stop|restart]");
Console.WriteLine ("SparkleShare is already running.");
Environment.Exit (-1); Environment.Exit (-1);
} }
// Only allow one instance of SparkleShare (on Windows) // Only allow one instance of SparkleShare (on Windows)
if (!program_mutex.WaitOne (0, false)) { if (!program_mutex.WaitOne (0, false)) {
Console.WriteLine ("SparkleShare is already running."); Console.WriteLine ("SparkleShare is already running.");

View file

@ -666,7 +666,7 @@ namespace SparkleShare {
string avatars_path = new string [] { Path.GetDirectoryName (this.config.FullPath), string avatars_path = new string [] { Path.GetDirectoryName (this.config.FullPath),
"avatars", size + "x" + size }.Combine (); "avatars", size + "x" + size }.Combine ();
string avatar_file_path = Path.Combine (avatars_path, email.MD5 () + ".jpg"); string avatar_file_path = Path.Combine (avatars_path, email.MD5 () + ".png");
if (File.Exists (avatar_file_path)) { if (File.Exists (avatar_file_path)) {
if (new FileInfo (avatar_file_path).CreationTime < DateTime.Now.AddDays (-1)) if (new FileInfo (avatar_file_path).CreationTime < DateTime.Now.AddDays (-1))
@ -676,7 +676,7 @@ namespace SparkleShare {
} }
WebClient client = new WebClient (); WebClient client = new WebClient ();
string url = "https://gravatar.com/avatar/" + email.MD5 () + ".jpg?s=" + size + "&d=404"; string url = "https://gravatar.com/avatar/" + email.MD5 () + ".png?s=" + size + "&d=404";
try { try {
byte [] buffer = client.DownloadData (url); byte [] buffer = client.DownloadData (url);
@ -696,7 +696,8 @@ namespace SparkleShare {
return null; return null;
} }
} catch (WebException) { } catch (WebException e) {
SparkleLogger.LogInfo ("Controller", "Error fetching avatar: " + e.Message);
return null; return null;
} }
} }

View file

@ -295,11 +295,11 @@ namespace SparkleShare {
string change_set_avatar = Program.Controller.GetAvatar (change_set.User.Email, 48); string change_set_avatar = Program.Controller.GetAvatar (change_set.User.Email, 48);
if (change_set_avatar != null) { if (change_set_avatar != null) {
change_set_avatar = "file://" + change_set_avatar.Replace ("\\", "/"); change_set_avatar = "file://" + change_set_avatar.Replace ("\\", "/");
} else { } else {
change_set_avatar = "file://<!-- $pixmaps-path -->/" + change_set_avatar = "file://<!-- $pixmaps-path -->/" +
Program.Controller.AssignAvatar (change_set.User.Email); Program.Controller.AssignAvatar (change_set.User.Email);
} }
event_entry += "</dl>"; event_entry += "</dl>";

View file

@ -279,8 +279,7 @@ namespace SparkleShare {
html = html.Replace ("<!-- $document-moved-background-image -->", html = html.Replace ("<!-- $document-moved-background-image -->",
pixmaps_path + "/document-moved-12.png"); pixmaps_path + "/document-moved-12.png");
Dispatcher.BeginInvoke ((Action) delegate { Dispatcher.BeginInvoke ((Action) delegate {
this.spinner.Stop (); this.spinner.Stop ();

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<ProjectGuid>{728483AA-E34B-4441-BF2C-C8BC2901E4E0}</ProjectGuid> <ProjectGuid>{728483AA-E34B-4441-BF2C-C8BC2901E4E0}</ProjectGuid>
@ -32,17 +32,6 @@
<ApplicationIcon>Pixmaps\sparkleshare-app.ico</ApplicationIcon> <ApplicationIcon>Pixmaps\sparkleshare-app.ico</ApplicationIcon>
<ReleaseVersion /> <ReleaseVersion />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\bin</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType> <DebugType>none</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
@ -64,9 +53,6 @@
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
<Reference Include="Gettext.Cs">
<HintPath>..\..\bin\Gettext.Cs.dll</HintPath>
</Reference>
<Reference Include="WindowsFormsIntegration" /> <Reference Include="WindowsFormsIntegration" />
<Reference Include="System.Xaml" /> <Reference Include="System.Xaml" />
</ItemGroup> </ItemGroup>
@ -242,6 +228,12 @@
<Link>Plugins\bitbucket.png</Link> <Link>Plugins\bitbucket.png</Link>
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Include="..\Common\Plugins\ssnet.png">
<Link>Plugins\ssnet.png</Link>
</None>
<None Include="..\Common\Plugins\ssnet.xml">
<Link>Plugins\ssnet.xml</Link>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\Common\Plugins\bitbucket.xml"> <None Include="..\Common\Plugins\bitbucket.xml">

View file

@ -15,24 +15,15 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SparkleLib.Git", "..\..\Spa
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Release|Any CPU.ActiveCfg = Release|Any CPU {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Release|Any CPU.Build.0 = Release|Any CPU {009FDCD7-1D57-4202-BB6D-8477D8C6B8EE}.Release|Any CPU.Build.0 = Release|Any CPU
{1DB5492D-B897-4A5E-8DD7-175EC65F52F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1DB5492D-B897-4A5E-8DD7-175EC65F52F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1DB5492D-B897-4A5E-8DD7-175EC65F52F2}.Release|Any CPU.ActiveCfg = Release|Any CPU {1DB5492D-B897-4A5E-8DD7-175EC65F52F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1DB5492D-B897-4A5E-8DD7-175EC65F52F2}.Release|Any CPU.Build.0 = Release|Any CPU {1DB5492D-B897-4A5E-8DD7-175EC65F52F2}.Release|Any CPU.Build.0 = Release|Any CPU
{2C914413-B31C-4362-93C7-1AE34F09112A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C914413-B31C-4362-93C7-1AE34F09112A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C914413-B31C-4362-93C7-1AE34F09112A}.Release|Any CPU.ActiveCfg = Release|Any CPU {2C914413-B31C-4362-93C7-1AE34F09112A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C914413-B31C-4362-93C7-1AE34F09112A}.Release|Any CPU.Build.0 = Release|Any CPU {2C914413-B31C-4362-93C7-1AE34F09112A}.Release|Any CPU.Build.0 = Release|Any CPU
{728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Release|Any CPU.ActiveCfg = Release|Any CPU {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Release|Any CPU.Build.0 = Release|Any CPU {728483AA-E34B-4441-BF2C-C8BC2901E4E0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection

View file

@ -21,7 +21,6 @@
</Component> </Component>
<Component Id='Libraries' Guid='0DA692D5-4DBE-4251-9F62-E7C1A76F10E1'> <Component Id='Libraries' Guid='0DA692D5-4DBE-4251-9F62-E7C1A76F10E1'>
<File Id='SparkleLib.Git.dll' Name='SparkleLib.Git.dll' Source='!(wix.root)\bin\SparkleLib.Git.dll' DiskId='1' /> <File Id='SparkleLib.Git.dll' Name='SparkleLib.Git.dll' Source='!(wix.root)\bin\SparkleLib.Git.dll' DiskId='1' />
<File Id='Gettext.Cs.dll' Name='Gettext.Cs.dll' Source='!(wix.root)\bin\Gettext.Cs.dll' DiskId='1' />
<File Id='SparkleLib.dll' Name='SparkleLib.dll' Source='!(wix.root)\bin\SparkleLib.dll' DiskId='1' /> <File Id='SparkleLib.dll' Name='SparkleLib.dll' Source='!(wix.root)\bin\SparkleLib.dll' DiskId='1' />
<File Id='sparkleshare_app.ico' Name='sparkleshare.ico' Source='!(wix.root)\SparkleShare\Windows\Pixmaps\sparkleshare-app.ico' DiskId='1' /> <File Id='sparkleshare_app.ico' Name='sparkleshare.ico' Source='!(wix.root)\SparkleShare\Windows\Pixmaps\sparkleshare-app.ico' DiskId='1' />
</Component> </Component>

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion> <ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
@ -14,15 +14,6 @@
<ApplicationIcon>..\Pixmaps\sparkleshare-app.ico</ApplicationIcon> <ApplicationIcon>..\Pixmaps\sparkleshare-app.ico</ApplicationIcon>
<ReleaseVersion /> <ReleaseVersion />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>