Merge pull request #1838 from IvanMalison/removeSomeTrailingWhitespace

Remove (some) trailing whitespace
This commit is contained in:
Hylke Bons 2018-04-09 10:30:49 +01:00 committed by GitHub
commit e448362352
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 225 additions and 227 deletions

View file

@ -39,10 +39,10 @@ namespace SparkleShare
#endif
email = email.ToLower ();
if (skipped_avatars.Contains (email))
return null;
string avatars_path = Path.Combine (Path.GetDirectoryName (target_path), "avatars", size + "x" + size);
// Search avatars by file name, ignore extension
@ -66,10 +66,10 @@ namespace SparkleShare
Logger.LogInfo ("Avatars", "Error fetching avatar for " + email, e);
return null;
}
var client = new WebClient ();
string url = "https://gravatar.com/avatar/" + email.MD5 () + ".png?s=" + size + "&d=404";
try {
byte [] buffer = client.DownloadData (url);
@ -78,30 +78,30 @@ namespace SparkleShare
} else if (client.ResponseHeaders ["content-type"].Equals (MediaTypeNames.Image.Gif, StringComparison.InvariantCultureIgnoreCase)) {
avatar_file_path += ".gif";
} else {
avatar_file_path += ".png";
}
if (buffer.Length > 255) {
if (!Directory.Exists (avatars_path)) {
Directory.CreateDirectory (avatars_path);
Logger.LogInfo ("Avatars", "Created '" + avatars_path + "'");
}
File.WriteAllBytes (avatar_file_path, buffer);
Logger.LogInfo ("Avatars", "Fetched " + size + "x" + size + " avatar for " + email);
return avatar_file_path;
} else {
return null;
}
} catch (Exception e) {
Logger.LogInfo ("Avatars", "Error fetching avatar for " + email, e);
skipped_avatars.Add (email);
return null;
}
}
@ -111,11 +111,11 @@ namespace SparkleShare
X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
{
X509Certificate2 certificate2 = new X509Certificate2 (certificate.GetRawCertData ());
// On some systems (mostly Linux) we can't assume the needed certificates are
// available, so we have to check the certificate's SHA-1 fingerprint manually.
//
// SHA1 fingerprinter obtained from https://www.gravatar.com/ on Oct 16 2015
// SHA1 fingerprinter obtained from https://www.gravatar.com/ on Oct 16 2015
// Set to expire on Oct 14 2018
string gravatar_cert_fingerprint = "1264B3F00814C6077D3853238771EE67FB6321C9";
@ -123,7 +123,7 @@ namespace SparkleShare
Logger.LogInfo ("Avatars", "Invalid certificate for https://www.gravatar.com/");
return false;
}
return true;
}
}

View file

@ -24,17 +24,17 @@ using System.Threading;
using Sparkles;
namespace SparkleShare {
public abstract class BaseController {
public BaseRepository [] Repositories {
get {
lock (this.repo_lock)
return this.repositories.GetRange (0, this.repositories.Count).ToArray ();
}
}
void AddRepository (BaseRepository repo)
{
lock (this.repo_lock) {
@ -42,15 +42,15 @@ namespace SparkleShare {
this.repositories.Sort ((x, y) => string.Compare (x.Name, y.Name));
}
}
void RemoveRepository (BaseRepository repo)
{
lock (this.repo_lock)
this.repositories.Remove (repo);
}
public BaseRepository GetRepoByName (string name)
{
lock (this.repo_lock) {
@ -58,15 +58,15 @@ namespace SparkleShare {
if (repo.Name.Equals (name))
return repo;
}
return null;
}
public Configuration Config { get; private set; }
public bool RepositoriesLoaded { get; private set; }
public string FoldersPath { get; private set; }
public double ProgressPercentage = 0.0;
public double ProgressSpeedUp = 0.0;
public double ProgressSpeedDown = 0.0;
@ -81,37 +81,37 @@ namespace SparkleShare {
public event Action ShowAboutWindowEvent = delegate { };
public event Action ShowEventLogWindowEvent = delegate { };
public event FolderFetchedEventHandler FolderFetched = delegate { };
public delegate void FolderFetchedEventHandler (string remote_url, string [] warnings);
public event FolderFetchErrorHandler FolderFetchError = delegate { };
public delegate void FolderFetchErrorHandler (string remote_url, string [] errors);
public event FolderFetchingHandler FolderFetching = delegate { };
public delegate void FolderFetchingHandler (double percentage, double speed, string information);
public event Action FolderListChanged = delegate { };
public event Action OnIdle = delegate { };
public event Action OnSyncing = delegate { };
public event Action OnError = delegate { };
public event InviteReceivedHandler InviteReceived = delegate { };
public delegate void InviteReceivedHandler (SparkleInvite invite);
public event NotificationRaisedEventHandler NotificationRaised = delegate { };
public delegate void NotificationRaisedEventHandler (ChangeSet change_set);
public event AlertNotificationRaisedEventHandler AlertNotificationRaised = delegate { };
public delegate void AlertNotificationRaisedEventHandler (string title, string message);
public bool FirstRun {
get { return Config.User.Email.Equals ("Unknown"); }
}
public List<string> Folders {
get {
List<string> folders = Config.Folders;
@ -131,32 +131,32 @@ namespace SparkleShare {
public bool NotificationsEnabled {
get {
string notifications_enabled = Config.GetConfigOption ("notifications");
if (string.IsNullOrEmpty (notifications_enabled)) {
Config.SetConfigOption ("notifications", bool.TrueString);
return true;
} else {
return notifications_enabled.Equals (bool.TrueString);
}
}
}
public bool AvatarsEnabled {
get {
string fetch_avatars_option = Config.GetConfigOption ("fetch_avatars");
if (fetch_avatars_option == null || fetch_avatars_option.Equals (bool.FalseString))
return false;
return true;
}
}
// Path where the plugins are kept
public abstract string PresetsPath { get; }
// Enables SparkleShare to start automatically at login
public abstract void CreateStartupItem ();
@ -168,16 +168,16 @@ namespace SparkleShare {
// Creates the SparkleShare folder in the user's home folder
public abstract void CreateSparkleShareFolder ();
// Opens the SparkleShare folder or an (optional) subfolder
public abstract void OpenFolder (string path);
// Opens a file with the appropriate application
public abstract void OpenFile (string path);
// Opens a file with the appropriate application
public virtual void OpenWebsite (string url) { }
// Copies text to the clipboard
public abstract void CopyToClipboard (string text);
@ -187,23 +187,23 @@ namespace SparkleShare {
public abstract string EventLogHTML { get; }
public abstract string DayEntryHTML { get; }
public abstract string EventEntryHTML { get; }
BaseFetcher fetcher;
FileSystemWatcher watcher;
object repo_lock = new object ();
object check_repos_lock = new object ();
List<BaseRepository> repositories = new List<BaseRepository> ();
bool lost_folders_path = false;
public BaseController (Configuration config)
{
Config = config;
FoldersPath = Config.FoldersPath;
}
public virtual void Initialize ()
{
string version = InstallationInfo.Version;
@ -221,7 +221,7 @@ namespace SparkleShare {
Preset.PresetsPath = PresetsPath;
InstallProtocolHandler ();
try {
CreateSparkleShareFolder ();
@ -237,19 +237,19 @@ namespace SparkleShare {
IncludeSubdirectories = false,
Path = FoldersPath
};
watcher.Created += OnFolderActivity;
watcher.EnableRaisingEvents = true;
}
int reopen_attempt_counts = 0;
public void HandleReopen ()
{
if (Repositories.Length > 0) {
ShowEventLogWindow ();
} else if (reopen_attempt_counts > 1) {
AlertNotificationRaised ("Hello!", "SparkleShare sits right here, as a status icon.");
reopen_attempt_counts = 0;
@ -265,31 +265,31 @@ namespace SparkleShare {
if (this.lost_folders_path) {
SparkleShare.UI.Bubbles.Controller.ShowBubble ("Where's your SparkleShare folder?",
"Did you put it on a detached drive?", null);
Environment.Exit (-1);
}
if (FirstRun) {
ShowSetupWindow (PageType.Setup);
} else {
new Thread (() => {
StartupInviteScan ();
CheckRepositories ();
RepositoriesLoaded = true;
UpdateState ();
}).Start ();
}
}
public void ShowSetupWindow (PageType page_type)
{
ShowSetupWindowEvent (page_type);
}
public void ShowAboutWindow ()
{
ShowAboutWindowEvent ();
@ -300,33 +300,33 @@ namespace SparkleShare {
{
ShowNoteWindowEvent (project);
}
public void ShowEventLogWindow ()
{
ShowEventLogWindowEvent ();
}
public void OpenSparkleShareFolder ()
{
OpenFolder (Config.FoldersPath);
}
public void OpenSparkleShareFolder (string name)
{
OpenFolder (new SparkleFolder (name).FullPath);
}
public void ToggleNotifications ()
{
bool notifications_enabled = Config.GetConfigOption ("notifications").Equals (bool.TrueString);
Config.SetConfigOption ("notifications", (!notifications_enabled).ToString ());
}
void CheckRepositories ()
{
lock (this.check_repos_lock) {
@ -393,21 +393,21 @@ namespace SparkleShare {
BaseRepository repo = null;
string folder_name = Path.GetFileName (folder_path);
string backend = Config.BackendByName (folder_name);
try {
repo = (BaseRepository) Activator.CreateInstance (
Type.GetType ("Sparkles." + backend + "." + backend + "Repository, Sparkles." + backend),
new object [] { folder_path, Config, SSHAuthenticationInfo.DefaultAuthenticationInfo });
} catch (Exception e) {
Logger.LogInfo ("Controller", "Failed to load backend '" + backend + "' for '" + folder_name + "': ", e);
return;
}
repo.ChangesDetected += delegate {
UpdateState ();
};
repo.SyncStatusChanged += delegate (SyncStatus status) {
if (status == SyncStatus.Idle) {
ProgressPercentage = 0.0;
@ -415,54 +415,54 @@ namespace SparkleShare {
ProgressSpeedDown = 0.0;
ProgressInformation = "";
}
UpdateState ();
};
repo.ProgressChanged += delegate {
ProgressPercentage = 0.0;
ProgressSpeedUp = 0.0;
ProgressSpeedDown = 0.0;
ProgressInformation = "";
double percentage = 0.0;
int repo_count = 0;
foreach (BaseRepository rep in Repositories) {
if (rep.ProgressPercentage > 0) {
percentage += rep.ProgressPercentage;
repo_count++;
}
if (rep.Status == SyncStatus.SyncUp)
ProgressSpeedUp += rep.ProgressSpeed;
if (rep.Status == SyncStatus.SyncDown)
ProgressSpeedDown += rep.ProgressSpeed;
}
if (repo_count == 1)
ProgressInformation = repo.ProgressInformation;
if (repo_count > 0)
ProgressPercentage = percentage / repo_count;
UpdateState ();
};
repo.NewChangeSet += delegate (ChangeSet change_set) {
if (AvatarsEnabled)
change_set.User.AvatarFilePath = Avatars.GetAvatar (change_set.User.Email, 48, Config.DirectoryPath);
NotificationRaised (change_set);
};
repo.ConflictResolved += delegate {
AlertNotificationRaised ("Resolved a file collision", "Local and server versions were kept.");
};
AddRepository (repo);
repo.Initialize ();
repo.Initialize ();
}
@ -475,31 +475,31 @@ namespace SparkleShare {
return;
}
}
void StartupInviteScan ()
{
foreach (string invite in Directory.GetFiles (FoldersPath, "*.xml"))
HandleInvite (invite);
}
void HandleInvite (FileSystemEventArgs args)
{
HandleInvite (args.FullPath);
}
void HandleInvite (string path)
{
if (this.fetcher != null &&
this.fetcher.IsActive) {
AlertNotificationRaised ("SparkleShare Setup seems busy", "Please wait for it to finish");
} else {
SparkleInvite invite = new SparkleInvite (path);
// It may be that the invite we received a path to isn't
// fully downloaded yet, so we try to read it several times
int tries = 0;
@ -507,37 +507,37 @@ namespace SparkleShare {
Thread.Sleep (100);
invite = new SparkleInvite (path);
tries++;
if (tries > 10) {
AlertNotificationRaised ("Oh noes!", "This invite seems screwed up...");
break;
}
}
if (invite.IsValid)
InviteReceived (invite);
File.Delete (path);
}
}
// Fires events for the current syncing state
void UpdateState ()
{
bool has_unsynced_repos = false;
bool has_syncing_repos = false;
foreach (BaseRepository repo in Repositories) {
if (repo.Status == SyncStatus.SyncDown || repo.Status == SyncStatus.SyncUp || repo.IsBuffering) {
has_syncing_repos = true;
break;
} else if (repo.Status == SyncStatus.Idle && repo.HasUnsyncedChanges) {
has_unsynced_repos = true;
}
}
if (has_syncing_repos)
OnSyncing ();
else if (has_unsynced_repos)
@ -545,7 +545,7 @@ namespace SparkleShare {
else
OnIdle ();
}
public List<StorageTypeInfo> FetcherAvailableStorageTypes {
get {
@ -557,31 +557,31 @@ namespace SparkleShare {
public void StartFetcher (SparkleFetcherInfo info)
{
string canonical_name = Path.GetFileName (info.RemotePath);
string backend = info.Backend;
string backend = info.Backend;
if (string.IsNullOrEmpty (backend))
backend = BaseFetcher.GetBackend (info.Address);
info.TargetDirectory = Path.Combine (Config.TmpPath, canonical_name);
if (Directory.Exists (info.TargetDirectory))
Directory.Delete (info.TargetDirectory, true);
try {
this.fetcher = (BaseFetcher) Activator.CreateInstance (
Type.GetType ("Sparkles." + backend + "." + backend + "Fetcher, Sparkles." + backend),
new object [] { info, UserAuthenticationInfo});
} catch (Exception e) {
Logger.LogInfo ("Controller",
"Failed to load '" + backend + "' backend for '" + canonical_name + "' " + e.Message);
FolderFetchError (Path.Combine (info.Address, info.RemotePath).Replace (@"\", "/"),
new string [] {"Failed to load \"" + backend + "\" backend for \"" + canonical_name + "\""});
return;
}
this.fetcher.Finished += FetcherFinishedDelegate;
this.fetcher.Failed += FetcherFailedDelegate;
this.fetcher.ProgressChanged += FetcherProgressChangedDelgate;
@ -623,12 +623,12 @@ namespace SparkleShare {
{
this.fetcher.Stop ();
this.fetcher.Dispose ();
this.fetcher = null;
this.watcher.EnableRaisingEvents = true;
}
public bool CheckPassword (string password)
{
return this.fetcher.IsFetchedRepoPasswordCorrect (password);
@ -689,10 +689,10 @@ namespace SparkleShare {
FolderListChanged ();
FolderFetched (this.fetcher.RemoteUrl.ToString (), this.fetcher.Warnings.ToArray ());
this.fetcher.Dispose ();
this.fetcher = null;
this.watcher.EnableRaisingEvents = true;
}

View file

@ -36,16 +36,16 @@ namespace SparkleShare {
public event UpdateContentEventEventHandler UpdateContentEvent = delegate { };
public delegate void UpdateContentEventEventHandler (string html);
public event UpdateChooserEventHandler UpdateChooserEvent = delegate { };
public delegate void UpdateChooserEventHandler (string [] folders);
public event UpdateChooserEnablementEventHandler UpdateChooserEnablementEvent = delegate { };
public delegate void UpdateChooserEnablementEventHandler (bool enabled);
public event UpdateSizeInfoEventHandler UpdateSizeInfoEvent = delegate { };
public delegate void UpdateSizeInfoEventHandler (string size, string history_size);
public event ShowSaveDialogEventHandler ShowSaveDialogEvent = delegate { };
public delegate void ShowSaveDialogEventHandler (string file_name, string target_folder_path);
@ -162,7 +162,7 @@ namespace SparkleShare {
if (!string.IsNullOrEmpty (html))
UpdateContentEvent (html);
UpdateSizeInfoEvent (Size, HistorySize);
}).Start ();
@ -172,7 +172,7 @@ namespace SparkleShare {
WindowIsOpen = true;
ShowWindowEvent ();
};
SparkleShare.Controller.OnIdle += delegate {
if (this.history_view_active)
return;
@ -189,7 +189,7 @@ namespace SparkleShare {
UpdateSizeInfoEvent (Size, HistorySize);
};
SparkleShare.Controller.FolderListChanged += delegate {
if (this.selected_folder != null && !SparkleShare.Controller.Folders.Contains (this.selected_folder))
this.selected_folder = null;
@ -212,16 +212,16 @@ namespace SparkleShare {
{
if (string.IsNullOrEmpty (href) || href.StartsWith ("about:"))
return;
href = href.Replace ("%20", " ");
if (href.StartsWith ("http")) {
SparkleShare.Controller.OpenWebsite (href);
} else if (href.StartsWith ("restore://") && this.restore_revision_info == null) {
Regex regex = new Regex ("restore://(.+)/([a-f0-9]+)/(.+)/(.{3} [0-9]+ [0-9]+h[0-9]+)/(.+)");
Match match = regex.Match (href);
if (match.Success) {
string author_name = match.Groups [3].Value;
string timestamp = match.Groups [4].Value;
@ -240,7 +240,7 @@ namespace SparkleShare {
ShowSaveDialogEvent (file_name, target_folder_path);
}
} else if (href.StartsWith ("back://")) {
this.history_view_active = false;
SelectedFolder = this.selected_folder; // TODO: Return to the same position on the page
@ -283,9 +283,9 @@ namespace SparkleShare {
} else {
if (href.StartsWith ("file:///"))
href = href.Substring (7);
SparkleShare.Controller.OpenFile (href);
}
}
}
@ -374,13 +374,13 @@ namespace SparkleShare {
html += "<tr>" +
"<td class='avatar'><img src='" + GetAvatarFilePath (change_set.User) + "'></td>" +
"<td class='name'>" + change_set.User.Name + "</td>" +
"<td class='date'>" +
change_set.Timestamp.ToString ("d MMM yyyy", CultureInfo.InvariantCulture) +
"<td class='date'>" +
change_set.Timestamp.ToString ("d MMM yyyy", CultureInfo.InvariantCulture) +
"</td>" +
"<td class='time'>" + change_set.Timestamp.ToString ("HH:mm") + "</td>" +
"<td class='restore'>" +
"<a href='restore://" + change_set.Folder.Name + "/" +
change_set.Revision + "/" + change_set.User.Name + "/" +
"<a href='restore://" + change_set.Folder.Name + "/" +
change_set.Revision + "/" + change_set.User.Name + "/" +
change_set.Timestamp.ToString ("MMM d H\\hmm", CultureInfo.InvariantCulture) + "/" +
file_path + "'>Restore&hellip;</a>" +
"</td>" +
@ -407,7 +407,7 @@ namespace SparkleShare {
foreach (ChangeSet change_set in change_sets) {
bool change_set_inserted = false;
foreach (ActivityDay stored_activity_day in activity_days) {
if (stored_activity_day.Date.Year == change_set.Timestamp.Year &&
stored_activity_day.Date.Month == change_set.Timestamp.Month &&
@ -443,7 +443,7 @@ namespace SparkleShare {
event_entry += "<dd class='" + change.Type.ToString ().ToLower () + "'>";
if (!change.IsFolder) {
event_entry += "<small><a href=\"history://" + change_set.Folder.Name + "/" +
event_entry += "<small><a href=\"history://" + change_set.Folder.Name + "/" +
change.Path + "\" title=\"View revisions\">" + change.Timestamp.ToString ("HH:mm") +
" &#x25BE;</a></small> &nbsp;";
@ -582,7 +582,7 @@ namespace SparkleShare {
private string SafeCombine (string path1, string path2)
{
string result = path1;
if (!result.EndsWith (Path.DirectorySeparatorChar.ToString ()))
result += Path.DirectorySeparatorChar;
@ -597,9 +597,9 @@ namespace SparkleShare {
{
if (!SparkleShare.Controller.AvatarsEnabled)
return "<!-- $pixmaps-path -->/user-icon-default.png";
string fetched_avatar = Avatars.GetAvatar (user.Email, 48, SparkleShare.Controller.Config.DirectoryPath);
if (!string.IsNullOrEmpty (fetched_avatar))
return "file://" + fetched_avatar.Replace ("\\", "/");
else

View file

@ -45,11 +45,11 @@ namespace SparkleShare {
Controller.WindowClosed ();
args.RetVal = true;
};
KeyPressEvent += delegate (object o, KeyPressEventArgs args) {
if (args.Event.Key == Gdk.Key.Escape ||
(args.Event.State == Gdk.ModifierType.ControlMask && args.Event.Key == Gdk.Key.w)) {
Controller.WindowClosed ();
}
};
@ -151,13 +151,13 @@ namespace SparkleShare {
Add (layout_horizontal);
}
}
class Link : Label {
public Link (string label, string url)
{
Markup = string.Format ("<a href=\"{0}\">{1}</a>", url, label);
Markup = string.Format ("<a href=\"{0}\">{1}</a>", url, label);
CanFocus = false;
CssProvider css_provider = new CssProvider ();

View file

@ -41,11 +41,11 @@ namespace SparkleShare {
Controller.WindowClosed ();
args.RetVal = true;
};
KeyPressEvent += delegate (object o, KeyPressEventArgs args) {
if (args.Event.Key == Gdk.Key.Escape ||
(args.Event.State == Gdk.ModifierType.ControlMask && args.Event.Key == Gdk.Key.w)) {
Controller.WindowClosed ();
}
};
@ -144,4 +144,3 @@ namespace SparkleShare {
}
}
}

View file

@ -4,7 +4,7 @@
### Common build requirements
You will need the packages listed below for the most used Linux distributions (some are run requirements):
You will need the packages listed below for the most used Linux distributions (some are run requirements):
```shell
# On Ubuntu 16.04:
@ -40,8 +40,8 @@ sudo dnf install \
### Additional source build requirements
Install the `soup-sharp` and `webkit2gtk-sharp` bindings from:
https://github.com/hbons/soup-sharp
Install the `soup-sharp` and `webkit2gtk-sharp` bindings from:
https://github.com/hbons/soup-sharp
https://github.com/hbons/webkit2gtk-sharp
Both with:

View file

@ -82,7 +82,7 @@ namespace SparkleShare {
public void AddOption (Widget widget)
{
{
this.option_area.Add (widget);
}
@ -99,7 +99,7 @@ namespace SparkleShare {
LineWrap = true,
LineWrapMode = Pango.WrapMode.WordChar
};
layout_vertical.PackStart (description, false, false, 0);
}
@ -109,7 +109,7 @@ namespace SparkleShare {
this.content_area.Add (layout_vertical);
}
public void Reset ()
{
Header = "";
@ -124,13 +124,13 @@ namespace SparkleShare {
foreach (Button button in this.buttons)
this.buttons.Remove (button);
}
new public void ShowAll ()
{
if (this.buttons.Children.Length > 0) {
Button default_button = (Button) this.buttons.Children [this.buttons.Children.Length - 1];
default_button.CanDefault = true;
Default = default_button;
default_button.StyleContext.AddClass ("suggested-action");
@ -141,4 +141,3 @@ namespace SparkleShare {
}
}
}

View file

@ -16,7 +16,7 @@
using System;
using System.ComponentModel;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;
using System.Windows.Controls;
@ -38,7 +38,7 @@ namespace SparkleShare {
Height = 288;
Width = 720;
Icon = UserInterfaceHelpers.GetImageSource("sparkleshare-app", "ico");
WindowStartupLocation = WindowStartupLocation.CenterScreen;
Closing += Close;
@ -73,10 +73,10 @@ namespace SparkleShare {
Width = 720,
Height = 260
};
image.Source = UserInterfaceHelpers.GetImageSource ("about");
Label version = new Label () {
Content = "version " + Controller.RunningVersion,
FontSize = 11,
@ -88,7 +88,7 @@ namespace SparkleShare {
FontSize = 11,
Foreground = new SolidColorBrush (Color.FromArgb (128, 255, 255, 255))
};
TextBlock credits = new TextBlock () {
FontSize = 11,
Foreground = new SolidColorBrush (Colors.White),
@ -99,14 +99,14 @@ namespace SparkleShare {
TextWrapping = TextWrapping.Wrap,
Width = 318
};
SparkleLink website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
SparkleLink credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress);
SparkleLink report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress);
SparkleLink debug_log_link = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress);
Canvas canvas = new Canvas ();
canvas.Children.Add (image);
Canvas.SetLeft (image, 0);
Canvas.SetTop (image, 0);
@ -114,18 +114,18 @@ namespace SparkleShare {
canvas.Children.Add (version);
Canvas.SetLeft (version, 289);
Canvas.SetTop (version, 92);
canvas.Children.Add (this.updates);
Canvas.SetLeft (this.updates, 289);
Canvas.SetTop (this.updates, 109);
canvas.Children.Add (credits);
Canvas.SetLeft (credits, 294);
Canvas.SetTop (credits, 142);
Canvas.SetTop (credits, 142);
canvas.Children.Add (website_link);
Canvas.SetLeft (website_link, 289);
Canvas.SetTop (website_link, 222);
Canvas.SetTop (website_link, 222);
canvas.Children.Add (credits_link);
Canvas.SetLeft (credits_link, 289 + website_link.ActualWidth + 60);
@ -133,21 +133,21 @@ namespace SparkleShare {
canvas.Children.Add (report_problem_link);
Canvas.SetLeft (report_problem_link, 289 + website_link.ActualWidth + credits_link.ActualWidth + 115);
Canvas.SetTop (report_problem_link, 222);
Canvas.SetTop (report_problem_link, 222);
canvas.Children.Add (debug_log_link);
Canvas.SetLeft (debug_log_link, 289 + website_link.ActualWidth + credits_link.ActualWidth +
report_problem_link.ActualWidth + 220);
Canvas.SetTop (debug_log_link, 222);
Canvas.SetTop (debug_log_link, 222);
Content = canvas;
}
private void Close (object sender, CancelEventArgs args)
{
Controller.WindowClosed ();
args.Cancel = true;
args.Cancel = true;
}
}
@ -177,7 +177,7 @@ namespace SparkleShare {
MouseUp += delegate {
SparkleShare.Controller.OpenWebsite (url);
};
};
}
}
}

View file

@ -2,8 +2,8 @@
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,

View file

@ -2,8 +2,8 @@
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
@ -33,7 +33,7 @@ namespace Sparkles {
public abstract class BaseListener {
public event Action Connected = delegate { };
public event DisconnectedEventHandler Disconnected = delegate { };
public delegate void DisconnectedEventHandler (DisconnectReason reason);

View file

@ -2,8 +2,8 @@
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,

View file

@ -436,7 +436,7 @@ namespace Sparkles.Git {
var git_config_clean = new GitCommand (TargetFolder,
string.Format ("config filter.lfs.clean '{0}'", clean_command));
git_config_required.StartAndWaitForExit ();
git_config_clean.StartAndWaitForExit ();
git_config_smudge.StartAndWaitForExit ();

View file

@ -2,8 +2,8 @@
// Copyright (C) 2010 Hylke Bons <hi@planetpeanut.uk>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
@ -34,7 +34,7 @@ namespace Sparkles.Git {
string branch {
get {
if (!string.IsNullOrEmpty (this.cached_branch))
if (!string.IsNullOrEmpty (this.cached_branch))
return this.cached_branch;
var git = new GitCommand (LocalPath, "config core.ignorecase true");
@ -44,7 +44,7 @@ namespace Sparkles.Git {
while (this.in_merge && HasLocalChanges) {
try {
ResolveConflict ();
} catch (IOException e) {
Logger.LogInfo ("Git", Name + " | Failed to resolve conflict, trying again...", e);
}
@ -177,7 +177,7 @@ namespace Sparkles.Git {
Error = ErrorStatus.None;
return true;
} else {
Logger.LogInfo ("Git", Name + " | Remote " + remote_revision + " is already in our history");
return false;
@ -406,7 +406,7 @@ namespace Sparkles.Git {
bool Merge ()
{
string message = FormatCommitMessage ();
if (message != null) {
Add ();
Commit (message);
@ -418,7 +418,7 @@ namespace Sparkles.Git {
if (this.in_merge) {
git = new GitCommand (LocalPath, "merge --abort");
git.StartAndWaitForExit ();
return false;
}
@ -446,11 +446,11 @@ namespace Sparkles.Git {
git.StartAndWaitForExit ();
return false;
} else {
Logger.LogInfo ("Git", error_output);
Logger.LogInfo ("Git", Name + " | Conflict detected, trying to get out...");
while (this.in_merge && HasLocalChanges) {
try {
ResolveConflict ();
@ -546,7 +546,7 @@ namespace Sparkles.Git {
string file_name_B = Path.GetFileNameWithoutExtension (conflicting_file_path) + clue_B + Path.GetExtension (conflicting_file_path);
string abs_conflicting_file_path = Path.Combine (LocalPath, conflicting_file_path);
string abs_file_path_A = Path.Combine (Path.GetDirectoryName (abs_conflicting_file_path), file_name_A);
string abs_file_path_B = Path.Combine (Path.GetDirectoryName (abs_conflicting_file_path), file_name_B);
@ -583,15 +583,15 @@ namespace Sparkles.Git {
var git_add = new GitCommand (LocalPath, "add \"" + conflicting_file_path + "\"");
git_add.StartAndWaitForExit ();
// The local version has been modified, but the server version was removed
} else if (line.StartsWith ("UD")) {
// Recover our version
var git_theirs = new GitCommand (LocalPath, "checkout --ours \"" + conflicting_file_path + "\"");
git_theirs.StartAndWaitForExit ();
// Server and local versions were removed
} else if (line.StartsWith ("DD")) {
Logger.LogInfo ("Git", Name + " | No need to resolve: " + line);
@ -599,7 +599,7 @@ namespace Sparkles.Git {
// New local files
} else if (line.StartsWith ("??")) {
Logger.LogInfo ("Git", Name + " | Found new file, no need to resolve: " + line);
} else {
Logger.LogInfo ("Git", Name + " | Don't know what to do with: " + line);
}
@ -639,7 +639,7 @@ namespace Sparkles.Git {
// ...move it...
try {
File.Move (local_file_path, target_file_path);
} catch (Exception e) {
string message = string.Format ("Failed to move \"{0}\" to \"{1}\"", local_file_path, target_file_path);
Logger.LogInfo ("Git", Name + " | " + message, e);
@ -669,7 +669,7 @@ namespace Sparkles.Git {
public override List<ChangeSet> GetChangeSets (string path)
{
return GetChangeSetsInternal (path);
}
}
List<ChangeSet> GetChangeSetsInternal (string path)
{
@ -946,18 +946,18 @@ namespace Sparkles.Git {
continue;
string HEAD_file_path = Path.Combine (child_path, "HEAD");
if (File.Exists (HEAD_file_path)) {
File.Move (HEAD_file_path, HEAD_file_path + ".backup");
Logger.LogInfo ("Git", Name + " | Renamed " + HEAD_file_path);
}
continue;
}
PrepareDirectories (child_path);
}
if (Directory.GetFiles (path).Length == 0 &&
Directory.GetDirectories (path).Length == 0 &&
!path.Equals (LocalPath)) {
@ -986,26 +986,26 @@ namespace Sparkles.Git {
var git_status = new GitCommand (LocalPath, "status --porcelain");
git_status.Start ();
while (!git_status.StandardOutput.EndOfStream) {
string line = git_status.StandardOutput.ReadLine ();
line = line.Trim ();
if (line.EndsWith (".empty") || line.EndsWith (".empty\""))
line = line.Replace (".empty", "");
Change change;
if (line.StartsWith ("R")) {
string path = line.Substring (3, line.IndexOf (" -> ") - 3).Trim ("\" ".ToCharArray ());
string moved_to_path = line.Substring (line.IndexOf (" -> ") + 4).Trim ("\" ".ToCharArray ());
change = new Change () {
Type = ChangeType.Moved,
Path = EnsureSpecialChars (path),
MovedToPath = EnsureSpecialChars (moved_to_path)
};
} else {
string path = line.Substring (2).Trim ("\" ".ToCharArray ());
change = new Change () { Path = EnsureSpecialChars (path) };
@ -1013,7 +1013,7 @@ namespace Sparkles.Git {
if (line.StartsWith ("M")) {
change.Type = ChangeType.Edited;
} else if (line.StartsWith ("D")) {
change.Type = ChangeType.Deleted;
}
@ -1021,7 +1021,7 @@ namespace Sparkles.Git {
changes.Add (change);
}
git_status.StandardOutput.ReadToEnd ();
git_status.WaitForExit ();
@ -1071,7 +1071,7 @@ namespace Sparkles.Git {
try {
foreach (DirectoryInfo directory in parent.GetDirectories ()) {
if (directory.FullName.IsSymlink () ||
directory.Name.Equals (".git") ||
directory.Name.Equals (".git") ||
directory.Name.Equals ("rebase-apply")) {
continue;
@ -1088,13 +1088,13 @@ namespace Sparkles.Git {
foreach (FileInfo file in parent.GetFiles ()) {
if (file.FullName.IsSymlink ())
continue;
if (file.Name.Equals (".empty"))
File.SetAttributes (file.FullName, FileAttributes.Hidden);
else
size += file.Length;
}
} catch (Exception e) {
Logger.LogInfo ("Local", "Error calculating file size", e);
}
@ -1102,7 +1102,7 @@ namespace Sparkles.Git {
return size;
}
bool IsSymlink (string file)
{
FileAttributes attributes = File.GetAttributes (file);