Merge branch 'master' into gettext-cs
This commit is contained in:
commit
8eedf5b148
11
README.md
11
README.md
|
@ -71,6 +71,12 @@ $ sudo apt-get install gtk-sharp2 mono-runtime mono-devel monodevelop \
|
||||||
libwebkit-cil-dev intltool libtool python-nautilus libndesk-dbus-glib1.0-cil-dev
|
libwebkit-cil-dev intltool libtool python-nautilus libndesk-dbus-glib1.0-cil-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
For Ubuntu `libappindicator` support, install the following package:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ sudo apt-get install libappindicator0.1-cil-dev
|
||||||
|
```
|
||||||
|
|
||||||
#### Fedora (yum):
|
#### Fedora (yum):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -80,11 +86,6 @@ $ sudo yum install gtk-sharp2-devel mono-core mono-devel monodevelop \
|
||||||
gnome-doc-utils
|
gnome-doc-utils
|
||||||
```
|
```
|
||||||
|
|
||||||
For Ubuntu `libappindicator` support, install the following package:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ sudo apt-get install libappindicator0.1-cil-dev
|
|
||||||
```
|
|
||||||
|
|
||||||
You can then build and install SparkleShare like this:
|
You can then build and install SparkleShare like this:
|
||||||
|
|
||||||
|
|
|
@ -187,9 +187,17 @@ namespace SparkleLib {
|
||||||
|
|
||||||
string n = Environment.NewLine;
|
string n = Environment.NewLine;
|
||||||
|
|
||||||
// Show special characters in the logs
|
|
||||||
config = config.Replace ("[core]" + n,
|
config = config.Replace ("[core]" + n,
|
||||||
"[core]" + n + "quotepath = false" + n);
|
"[core]" + n + "\tquotepath = false" + n + // Show special characters in the logs
|
||||||
|
"\tpackedGitLimit = 128m" + n +
|
||||||
|
"\tpackedGitWindowSize = 128m" + n);
|
||||||
|
|
||||||
|
config = config.Replace ("[remote \"origin\"]" + n,
|
||||||
|
"[pack]" + n +
|
||||||
|
"\tdeltaCacheSize = 128m" + n +
|
||||||
|
"\tpackSizeLimit = 128m" + n +
|
||||||
|
"\twindowMemory = 128m" + n +
|
||||||
|
"[remote \"origin\"]" + n);
|
||||||
|
|
||||||
// Be case sensitive explicitly to work on Mac
|
// Be case sensitive explicitly to work on Mac
|
||||||
config = config.Replace ("ignorecase = true", "ignorecase = false");
|
config = config.Replace ("ignorecase = true", "ignorecase = false");
|
||||||
|
@ -273,6 +281,16 @@ namespace SparkleLib {
|
||||||
writer.WriteLine ("/.svn/*");
|
writer.WriteLine ("/.svn/*");
|
||||||
writer.WriteLine ("*/.svn/*");
|
writer.WriteLine ("*/.svn/*");
|
||||||
|
|
||||||
|
// Mercurial
|
||||||
|
writer.WriteLine ("/.hg/*");
|
||||||
|
writer.WriteLine ("*/.hg/*");
|
||||||
|
writer.WriteLine ("*/.hgignore");
|
||||||
|
|
||||||
|
// Bazaar
|
||||||
|
writer.WriteLine ("/.bzr/*");
|
||||||
|
writer.WriteLine ("*/.bzr/*");
|
||||||
|
writer.WriteLine ("*/.bzrignore");
|
||||||
|
|
||||||
writer.Close ();
|
writer.Close ();
|
||||||
|
|
||||||
|
|
||||||
|
@ -371,25 +389,4 @@ namespace SparkleLib {
|
||||||
writer.Close ();
|
writer.Close ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class SparkleGit : Process {
|
|
||||||
|
|
||||||
public SparkleGit (string path, string args) : base ()
|
|
||||||
{
|
|
||||||
EnableRaisingEvents = true;
|
|
||||||
StartInfo.FileName = SparkleBackend.DefaultBackend.Path;
|
|
||||||
StartInfo.Arguments = args;
|
|
||||||
StartInfo.RedirectStandardOutput = true;
|
|
||||||
StartInfo.UseShellExecute = false;
|
|
||||||
StartInfo.WorkingDirectory = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
new public void Start ()
|
|
||||||
{
|
|
||||||
SparkleHelpers.DebugInfo ("Cmd", StartInfo.FileName + " " + StartInfo.Arguments);
|
|
||||||
base.Start ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
42
SparkleLib/Git/SparkleGit.cs
Normal file
42
SparkleLib/Git/SparkleGit.cs
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
// SparkleShare, a collaboration and sharing tool.
|
||||||
|
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
|
||||||
|
namespace SparkleLib {
|
||||||
|
|
||||||
|
public class SparkleGit : Process {
|
||||||
|
|
||||||
|
public SparkleGit (string path, string args) : base ()
|
||||||
|
{
|
||||||
|
EnableRaisingEvents = true;
|
||||||
|
StartInfo.FileName = SparkleBackend.DefaultBackend.Path;
|
||||||
|
StartInfo.Arguments = args;
|
||||||
|
StartInfo.RedirectStandardOutput = true;
|
||||||
|
StartInfo.UseShellExecute = false;
|
||||||
|
StartInfo.WorkingDirectory = path;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
new public void Start ()
|
||||||
|
{
|
||||||
|
SparkleHelpers.DebugInfo ("Cmd", StartInfo.FileName + " " + StartInfo.Arguments);
|
||||||
|
base.Start ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -71,20 +71,46 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public override double Size {
|
public override double Size {
|
||||||
get {
|
get {
|
||||||
return CalculateSize (
|
string file_path = Path.Combine (LocalPath, ".git", "repo_size");
|
||||||
new DirectoryInfo (LocalPath)
|
|
||||||
);
|
try {
|
||||||
|
return double.Parse (File.ReadAllText (file_path));
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override double HistorySize {
|
public override double HistorySize {
|
||||||
get {
|
get {
|
||||||
return CalculateSize (
|
string file_path = Path.Combine (LocalPath, ".git", "repo_history_size");
|
||||||
new DirectoryInfo (Path.Combine (LocalPath, ".git"))
|
|
||||||
);
|
try {
|
||||||
|
return double.Parse (File.ReadAllText (file_path));
|
||||||
|
|
||||||
|
} catch {
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void CalculateSizes ()
|
||||||
|
{
|
||||||
|
double size = CalculateSize (
|
||||||
|
new DirectoryInfo (LocalPath));
|
||||||
|
|
||||||
|
double history_size = CalculateSize (
|
||||||
|
new DirectoryInfo (Path.Combine (LocalPath, ".git")));
|
||||||
|
|
||||||
|
string size_file_path = Path.Combine (LocalPath, ".git", "repo_size");
|
||||||
|
string history_size_file_path = Path.Combine (LocalPath, ".git", "repo_history_size");
|
||||||
|
|
||||||
|
File.WriteAllText (size_file_path, size.ToString ());
|
||||||
|
File.WriteAllText (history_size_file_path, history_size.ToString ());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public override string [] UnsyncedFilePaths {
|
public override string [] UnsyncedFilePaths {
|
||||||
|
@ -183,9 +209,6 @@ namespace SparkleLib {
|
||||||
double percentage = 1.0;
|
double percentage = 1.0;
|
||||||
Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
||||||
|
|
||||||
DateTime last_change = DateTime.Now;
|
|
||||||
TimeSpan change_interval = new TimeSpan (0, 0, 0, 1);
|
|
||||||
|
|
||||||
while (!git.StandardError.EndOfStream) {
|
while (!git.StandardError.EndOfStream) {
|
||||||
string line = git.StandardError.ReadLine ();
|
string line = git.StandardError.ReadLine ();
|
||||||
Match match = progress_regex.Match (line);
|
Match match = progress_regex.Match (line);
|
||||||
|
@ -218,19 +241,13 @@ namespace SparkleLib {
|
||||||
|
|
||||||
if (number >= percentage) {
|
if (number >= percentage) {
|
||||||
percentage = number;
|
percentage = number;
|
||||||
|
|
||||||
if (percentage == 100.0)
|
|
||||||
percentage = 99.0;
|
|
||||||
|
|
||||||
if (DateTime.Compare (last_change, DateTime.Now.Subtract (change_interval)) < 0) {
|
|
||||||
base.OnSyncProgressChanged (percentage, speed);
|
base.OnSyncProgressChanged (percentage, speed);
|
||||||
last_change = DateTime.Now;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
git.WaitForExit ();
|
git.WaitForExit ();
|
||||||
|
|
||||||
|
CalculateSizes ();
|
||||||
|
|
||||||
if (git.ExitCode == 0)
|
if (git.ExitCode == 0)
|
||||||
return true;
|
return true;
|
||||||
|
@ -249,9 +266,6 @@ namespace SparkleLib {
|
||||||
double percentage = 1.0;
|
double percentage = 1.0;
|
||||||
Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
Regex progress_regex = new Regex (@"([0-9]+)%", RegexOptions.Compiled);
|
||||||
|
|
||||||
DateTime last_change = DateTime.Now;
|
|
||||||
TimeSpan change_interval = new TimeSpan (0, 0, 0, 1);
|
|
||||||
|
|
||||||
while (!git.StandardError.EndOfStream) {
|
while (!git.StandardError.EndOfStream) {
|
||||||
string line = git.StandardError.ReadLine ();
|
string line = git.StandardError.ReadLine ();
|
||||||
Match match = progress_regex.Match (line);
|
Match match = progress_regex.Match (line);
|
||||||
|
@ -284,19 +298,13 @@ namespace SparkleLib {
|
||||||
|
|
||||||
if (number >= percentage) {
|
if (number >= percentage) {
|
||||||
percentage = number;
|
percentage = number;
|
||||||
|
|
||||||
if (percentage == 100.0)
|
|
||||||
percentage = 99.0;
|
|
||||||
|
|
||||||
if (DateTime.Compare (last_change, DateTime.Now.Subtract (change_interval)) < 0) {
|
|
||||||
base.OnSyncProgressChanged (percentage, speed);
|
base.OnSyncProgressChanged (percentage, speed);
|
||||||
last_change = DateTime.Now;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
git.WaitForExit ();
|
git.WaitForExit ();
|
||||||
|
|
||||||
|
CalculateSizes ();
|
||||||
|
|
||||||
if (git.ExitCode == 0) {
|
if (git.ExitCode == 0) {
|
||||||
Rebase ();
|
Rebase ();
|
||||||
|
@ -310,7 +318,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public override bool AnyDifferences {
|
public override bool AnyDifferences {
|
||||||
get {
|
get {
|
||||||
FillEmptyDirectories (LocalPath);
|
PrepareDirectories (LocalPath);
|
||||||
|
|
||||||
SparkleGit git = new SparkleGit (LocalPath, "status --porcelain");
|
SparkleGit git = new SparkleGit (LocalPath, "status --porcelain");
|
||||||
git.Start ();
|
git.Start ();
|
||||||
|
@ -562,16 +570,24 @@ namespace SparkleLib {
|
||||||
string [] lines = output.Split ("\n".ToCharArray ());
|
string [] lines = output.Split ("\n".ToCharArray ());
|
||||||
List <string> entries = new List <string> ();
|
List <string> entries = new List <string> ();
|
||||||
|
|
||||||
int j = 0;
|
int line_number = 0;
|
||||||
|
bool first_pass = true;
|
||||||
string entry = "", last_entry = "";
|
string entry = "", last_entry = "";
|
||||||
foreach (string line in lines) {
|
foreach (string line in lines) {
|
||||||
if (line.StartsWith ("commit") && j > 0) {
|
if (line.StartsWith ("commit") && !first_pass) {
|
||||||
entries.Add (entry);
|
entries.Add (entry);
|
||||||
entry = "";
|
entry = "";
|
||||||
|
line_number = 0;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
first_pass = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only parse 250 files to prevent memory issues
|
||||||
|
if (line_number < 254) {
|
||||||
entry += line + "\n";
|
entry += line + "\n";
|
||||||
j++;
|
line_number++;
|
||||||
|
}
|
||||||
|
|
||||||
last_entry = entry;
|
last_entry = entry;
|
||||||
}
|
}
|
||||||
|
@ -657,6 +673,7 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((change_set.Added.Count +
|
if ((change_set.Added.Count +
|
||||||
change_set.Edited.Count +
|
change_set.Edited.Count +
|
||||||
change_set.Deleted.Count +
|
change_set.Deleted.Count +
|
||||||
|
@ -673,14 +690,30 @@ namespace SparkleLib {
|
||||||
|
|
||||||
|
|
||||||
// Git doesn't track empty directories, so this method
|
// Git doesn't track empty directories, so this method
|
||||||
// fills them all with a hidden empty file
|
// fills them all with a hidden empty file.
|
||||||
private void FillEmptyDirectories (string path)
|
//
|
||||||
|
// It also prevents git repositories from becoming
|
||||||
|
// git submodules by renaming the .git/HEAD file
|
||||||
|
private void PrepareDirectories (string path)
|
||||||
{
|
{
|
||||||
foreach (string child_path in Directory.GetDirectories (path)) {
|
foreach (string child_path in Directory.GetDirectories (path)) {
|
||||||
if (child_path.EndsWith (".git") || child_path.EndsWith (".notes"))
|
if (child_path.EndsWith (".git") &&
|
||||||
|
!child_path.Equals (Path.Combine (LocalPath, ".git"))) {
|
||||||
|
|
||||||
|
string HEAD_file_path = Path.Combine (child_path, "HEAD");
|
||||||
|
|
||||||
|
if (File.Exists (HEAD_file_path)) {
|
||||||
|
File.Move (HEAD_file_path, HEAD_file_path + ".backup");
|
||||||
|
SparkleHelpers.DebugInfo ("Git", "[" + Name + "] Renamed " + HEAD_file_path);
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
FillEmptyDirectories (child_path);
|
} else if (child_path.EndsWith (".notes")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
PrepareDirectories (child_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Directory.GetFiles (path).Length == 0 &&
|
if (Directory.GetFiles (path).Length == 0 &&
|
||||||
|
|
|
@ -4,6 +4,7 @@ TARGET = library
|
||||||
SOURCES = \
|
SOURCES = \
|
||||||
Defines.cs \
|
Defines.cs \
|
||||||
Git/SparkleFetcherGit.cs \
|
Git/SparkleFetcherGit.cs \
|
||||||
|
Git/SparkleGit.cs \
|
||||||
Git/SparkleRepoGit.cs \
|
Git/SparkleRepoGit.cs \
|
||||||
SparkleBackend.cs \
|
SparkleBackend.cs \
|
||||||
SparkleChangeSet.cs \
|
SparkleChangeSet.cs \
|
||||||
|
|
|
@ -25,17 +25,17 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public class SparkleConfig : XmlDocument {
|
public class SparkleConfig : XmlDocument {
|
||||||
|
|
||||||
public static string ConfigPath = Path.Combine (
|
private static string default_config_path = Path.Combine (
|
||||||
Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
|
Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
|
||||||
"sparkleshare");
|
"sparkleshare");
|
||||||
|
|
||||||
public bool DebugMode = true;
|
public static SparkleConfig DefaultConfig = new SparkleConfig (default_config_path, "config.xml");
|
||||||
|
public static bool DebugMode = true;
|
||||||
|
|
||||||
|
|
||||||
public static SparkleConfig DefaultConfig = new SparkleConfig (ConfigPath, "config.xml");
|
|
||||||
public string FullPath;
|
public string FullPath;
|
||||||
public string LogFilePath;
|
|
||||||
public string TmpPath;
|
public string TmpPath;
|
||||||
|
public string LogFilePath;
|
||||||
|
|
||||||
public string HomePath {
|
public string HomePath {
|
||||||
get {
|
get {
|
||||||
|
@ -69,16 +69,12 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Directory.Exists (config_path)) {
|
if (!Directory.Exists (config_path))
|
||||||
Directory.CreateDirectory (config_path);
|
Directory.CreateDirectory (config_path);
|
||||||
SparkleHelpers.DebugInfo ("Config", "Created \"" + config_path + "\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
string icons_path = System.IO.Path.Combine (config_path, "icons");
|
string icons_path = Path.Combine (config_path, "icons");
|
||||||
if (!Directory.Exists (icons_path)) {
|
if (!Directory.Exists (icons_path))
|
||||||
Directory.CreateDirectory (icons_path);
|
Directory.CreateDirectory (icons_path);
|
||||||
SparkleHelpers.DebugInfo ("Config", "Created \"" + icons_path + "\"");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Load (FullPath);
|
Load (FullPath);
|
||||||
|
@ -137,8 +133,6 @@ namespace SparkleLib {
|
||||||
" <email>Unknown</email>" + n +
|
" <email>Unknown</email>" + n +
|
||||||
" </user>" + n +
|
" </user>" + n +
|
||||||
"</sparkleshare>");
|
"</sparkleshare>");
|
||||||
|
|
||||||
SparkleHelpers.DebugInfo ("Config", "Created \"" + FullPath + "\"");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,21 +22,18 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public static class SparkleHelpers {
|
public static class SparkleHelpers {
|
||||||
|
|
||||||
public static bool ShowDebugInfo = true;
|
|
||||||
private static object debug_lock = new object ();
|
private static object debug_lock = new object ();
|
||||||
|
|
||||||
// Show debug info if needed
|
// Show debug info if needed
|
||||||
public static void DebugInfo (string type, string message)
|
public static void DebugInfo (string type, string message)
|
||||||
{
|
{
|
||||||
if (ShowDebugInfo) {
|
|
||||||
string timestamp = DateTime.Now.ToString ("HH:mm:ss");
|
|
||||||
|
|
||||||
if (!message.StartsWith ("["))
|
if (!message.StartsWith ("["))
|
||||||
message = " " + message;
|
message = " " + message;
|
||||||
|
|
||||||
|
string timestamp = DateTime.Now.ToString ("HH:mm:ss");
|
||||||
string line = timestamp + " " + "[" + type + "]" + message;
|
string line = timestamp + " " + "[" + type + "]" + message;
|
||||||
|
|
||||||
if (SparkleConfig.DefaultConfig.DebugMode)
|
if (SparkleConfig.DebugMode)
|
||||||
Console.WriteLine (line);
|
Console.WriteLine (line);
|
||||||
|
|
||||||
lock (debug_lock) {
|
lock (debug_lock) {
|
||||||
|
@ -46,7 +43,6 @@ namespace SparkleLib {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Makes it possible to combine more than
|
// Makes it possible to combine more than
|
||||||
|
|
|
@ -130,6 +130,12 @@ namespace SparkleLib {
|
||||||
SyncUpBase ();
|
SyncUpBase ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Initialize ()
|
||||||
|
{
|
||||||
// Sync up everything that changed
|
// Sync up everything that changed
|
||||||
// since we've been offline
|
// since we've been offline
|
||||||
if (AnyDifferences) {
|
if (AnyDifferences) {
|
||||||
|
@ -634,16 +640,26 @@ namespace SparkleLib {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private DateTime progress_last_change = DateTime.Now;
|
||||||
|
private TimeSpan progress_change_interval = new TimeSpan (0, 0, 0, 1);
|
||||||
|
|
||||||
protected void OnSyncProgressChanged (double progress_percentage, string progress_speed)
|
protected void OnSyncProgressChanged (double progress_percentage, string progress_speed)
|
||||||
{
|
{
|
||||||
// Console.WriteLine ("OnProgressChanged: " + progress_percentage + " " + progress_speed);
|
if (DateTime.Compare (this.progress_last_change,
|
||||||
|
DateTime.Now.Subtract (this.progress_change_interval)) < 0) {
|
||||||
|
|
||||||
|
if (SyncProgressChanged != null) {
|
||||||
|
if (progress_percentage == 100.0)
|
||||||
|
progress_percentage = 99.0;
|
||||||
|
|
||||||
this.progress_percentage = progress_percentage;
|
this.progress_percentage = progress_percentage;
|
||||||
this.progress_speed = progress_speed;
|
this.progress_speed = progress_speed;
|
||||||
|
this.progress_last_change = DateTime.Now;
|
||||||
|
|
||||||
if (SyncProgressChanged != null)
|
|
||||||
SyncProgressChanged (progress_percentage, progress_speed);
|
SyncProgressChanged (progress_percentage, progress_speed);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Creates a SHA-1 hash of input
|
// Creates a SHA-1 hash of input
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace SparkleShare {
|
||||||
Bordered = false,
|
Bordered = false,
|
||||||
Editable = false,
|
Editable = false,
|
||||||
Frame = new RectangleF (60, 588, 75, 20),
|
Frame = new RectangleF (60, 588, 75, 20),
|
||||||
StringValue = Controller.Size,
|
StringValue = "…",
|
||||||
Font = SparkleUI.Font
|
Font = SparkleUI.Font
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ namespace SparkleShare {
|
||||||
Bordered = false,
|
Bordered = false,
|
||||||
Editable = false,
|
Editable = false,
|
||||||
Frame = new RectangleF (190, 588, 75, 20),
|
Frame = new RectangleF (190, 588, 75, 20),
|
||||||
StringValue = Controller.HistorySize,
|
StringValue = "…",
|
||||||
Font = SparkleUI.Font
|
Font = SparkleUI.Font
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace SparkleShare {
|
||||||
if (Controller.Folders.Length == 0)
|
if (Controller.Folders.Length == 0)
|
||||||
StateText = _("Welcome to SparkleShare!");
|
StateText = _("Welcome to SparkleShare!");
|
||||||
else
|
else
|
||||||
StateText = _("Up to date") + " — " + Controller.FolderSize;
|
StateText = _("Up to date") + Controller.FolderSize;
|
||||||
|
|
||||||
CreateMenu ();
|
CreateMenu ();
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ namespace SparkleShare {
|
||||||
if (Controller.Folders.Length == 0)
|
if (Controller.Folders.Length == 0)
|
||||||
StateText = _("Welcome to SparkleShare!");
|
StateText = _("Welcome to SparkleShare!");
|
||||||
else
|
else
|
||||||
StateText = _("Up to date") + " — " + Controller.FolderSize;
|
StateText = _("Up to date") + Controller.FolderSize;
|
||||||
|
|
||||||
StateMenuItem.Title = StateText;
|
StateMenuItem.Title = StateText;
|
||||||
CreateMenu ();
|
CreateMenu ();
|
||||||
|
|
|
@ -181,7 +181,7 @@ namespace SparkleShare {
|
||||||
string html = File.ReadAllText (html_path);
|
string html = File.ReadAllText (html_path);
|
||||||
|
|
||||||
string jquery_file_path = new string [] {Defines.PREFIX, "share",
|
string jquery_file_path = new string [] {Defines.PREFIX, "share",
|
||||||
"sparkleshare", "html", "jquery.js"}.Combine ()
|
"sparkleshare", "html", "jquery.js"}.Combine ();
|
||||||
|
|
||||||
string jquery = File.ReadAllText (jquery_file_path);
|
string jquery = File.ReadAllText (jquery_file_path);
|
||||||
html = html.Replace ("<!-- $jquery -->", jquery);
|
html = html.Replace ("<!-- $jquery -->", jquery);
|
||||||
|
|
|
@ -224,7 +224,7 @@ namespace SparkleShare {
|
||||||
List<SparkleChangeSet> list = new List<SparkleChangeSet> ();
|
List<SparkleChangeSet> list = new List<SparkleChangeSet> ();
|
||||||
|
|
||||||
foreach (SparkleRepoBase repo in Repositories) {
|
foreach (SparkleRepoBase repo in Repositories) {
|
||||||
List<SparkleChangeSet> change_sets = repo.GetChangeSets (50);
|
List<SparkleChangeSet> change_sets = repo.GetChangeSets (30);
|
||||||
|
|
||||||
if (change_sets != null)
|
if (change_sets != null)
|
||||||
list.AddRange (change_sets);
|
list.AddRange (change_sets);
|
||||||
|
@ -625,6 +625,7 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
Repositories.Add (repo);
|
Repositories.Add (repo);
|
||||||
|
repo.Initialize ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -752,12 +753,23 @@ namespace SparkleShare {
|
||||||
{
|
{
|
||||||
string keys_path = Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath);
|
string keys_path = Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath);
|
||||||
string key_file_name = "sparkleshare." + UserEmail + ".key";
|
string key_file_name = "sparkleshare." + UserEmail + ".key";
|
||||||
|
string key_file_path = Path.Combine (keys_path, key_file_name);
|
||||||
|
|
||||||
|
if (!File.Exists (key_file_path)) {
|
||||||
|
foreach (string file_name in Directory.GetFiles (keys_path)) {
|
||||||
|
if (file_name.StartsWith ("sparkleshare") &&
|
||||||
|
file_name.EndsWith (".key")) {
|
||||||
|
|
||||||
|
key_file_path = Path.Combine (keys_path, file_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Process process = new Process ();
|
Process process = new Process ();
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
process.StartInfo.RedirectStandardOutput = true;
|
||||||
process.StartInfo.UseShellExecute = false;
|
process.StartInfo.UseShellExecute = false;
|
||||||
process.StartInfo.FileName = "ssh-add";
|
process.StartInfo.FileName = "ssh-add";
|
||||||
process.StartInfo.Arguments = "\"" + Path.Combine (keys_path, key_file_name) + "\"";
|
process.StartInfo.Arguments = "\"" + key_file_path + "\"";
|
||||||
|
|
||||||
process.Start ();
|
process.Start ();
|
||||||
process.WaitForExit ();
|
process.WaitForExit ();
|
||||||
|
@ -963,8 +975,10 @@ namespace SparkleShare {
|
||||||
remote_folder = remote_folder.Trim ();
|
remote_folder = remote_folder.Trim ();
|
||||||
|
|
||||||
string tmp_path = SparkleConfig.DefaultConfig.TmpPath;
|
string tmp_path = SparkleConfig.DefaultConfig.TmpPath;
|
||||||
if (!Directory.Exists (tmp_path))
|
if (!Directory.Exists (tmp_path)) {
|
||||||
Directory.CreateDirectory (tmp_path);
|
Directory.CreateDirectory (tmp_path);
|
||||||
|
File.SetAttributes (tmp_path, File.GetAttributes (tmp_path) | FileAttributes.Hidden);
|
||||||
|
}
|
||||||
|
|
||||||
// Strip the '.git' from the name
|
// Strip the '.git' from the name
|
||||||
string canonical_name = Path.GetFileNameWithoutExtension (remote_folder);
|
string canonical_name = Path.GetFileNameWithoutExtension (remote_folder);
|
||||||
|
|
|
@ -60,8 +60,7 @@ namespace SparkleShare {
|
||||||
DeleteEvent += Close;
|
DeleteEvent += Close;
|
||||||
|
|
||||||
this.size_label = new Label () {
|
this.size_label = new Label () {
|
||||||
Markup = "<b>Size:</b> " + Controller.Size + " " +
|
Markup = "<b>Size:</b> … <b>History:</b> …"
|
||||||
"<b>History:</b> " + Controller.HistorySize
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VBox layout_vertical = new VBox (false, 0);
|
VBox layout_vertical = new VBox (false, 0);
|
||||||
|
|
|
@ -54,6 +54,9 @@ namespace SparkleShare {
|
||||||
if (ContentLoadingEvent != null)
|
if (ContentLoadingEvent != null)
|
||||||
ContentLoadingEvent ();
|
ContentLoadingEvent ();
|
||||||
|
|
||||||
|
if (UpdateSizeInfoEvent != null)
|
||||||
|
UpdateSizeInfoEvent ("…", "…");
|
||||||
|
|
||||||
Stopwatch watch = new Stopwatch ();
|
Stopwatch watch = new Stopwatch ();
|
||||||
watch.Start ();
|
watch.Start ();
|
||||||
|
|
||||||
|
@ -80,6 +83,10 @@ namespace SparkleShare {
|
||||||
public string HTML {
|
public string HTML {
|
||||||
get {
|
get {
|
||||||
List<SparkleChangeSet> change_sets = Program.Controller.GetLog (this.selected_folder);
|
List<SparkleChangeSet> change_sets = Program.Controller.GetLog (this.selected_folder);
|
||||||
|
|
||||||
|
if (UpdateSizeInfoEvent != null)
|
||||||
|
UpdateSizeInfoEvent (Size, HistorySize);
|
||||||
|
|
||||||
return Program.Controller.GetHTMLLog (change_sets);
|
return Program.Controller.GetHTMLLog (change_sets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,10 +104,17 @@ namespace SparkleShare {
|
||||||
foreach (SparkleRepoBase repo in Program.Controller.Repositories) {
|
foreach (SparkleRepoBase repo in Program.Controller.Repositories) {
|
||||||
if (this.selected_folder == null)
|
if (this.selected_folder == null)
|
||||||
size += repo.Size;
|
size += repo.Size;
|
||||||
else if (this.selected_folder.Equals (repo.Name))
|
else if (this.selected_folder.Equals (repo.Name)) {
|
||||||
|
if (repo.Size == 0)
|
||||||
|
return "???";
|
||||||
|
else
|
||||||
return Program.Controller.FormatSize (repo.Size);
|
return Program.Controller.FormatSize (repo.Size);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
return "???";
|
||||||
|
else
|
||||||
return Program.Controller.FormatSize (size);
|
return Program.Controller.FormatSize (size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,10 +126,17 @@ namespace SparkleShare {
|
||||||
foreach (SparkleRepoBase repo in Program.Controller.Repositories) {
|
foreach (SparkleRepoBase repo in Program.Controller.Repositories) {
|
||||||
if (this.selected_folder == null)
|
if (this.selected_folder == null)
|
||||||
size += repo.HistorySize;
|
size += repo.HistorySize;
|
||||||
else if (this.selected_folder.Equals (repo.Name))
|
else if (this.selected_folder.Equals (repo.Name)) {
|
||||||
|
if (repo.HistorySize == 0)
|
||||||
|
return "???";
|
||||||
|
else
|
||||||
return Program.Controller.FormatSize (repo.HistorySize);
|
return Program.Controller.FormatSize (repo.HistorySize);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
return "???";
|
||||||
|
else
|
||||||
return Program.Controller.FormatSize (size);
|
return Program.Controller.FormatSize (size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace SparkleShare {
|
||||||
if (Controller.Folders.Length == 0)
|
if (Controller.Folders.Length == 0)
|
||||||
StateText = _("Welcome to SparkleShare!");
|
StateText = _("Welcome to SparkleShare!");
|
||||||
else
|
else
|
||||||
StateText = _("Up to date") + " — " + Controller.FolderSize;
|
StateText = _("Up to date") + Controller.FolderSize;
|
||||||
|
|
||||||
CreateMenu ();
|
CreateMenu ();
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ namespace SparkleShare {
|
||||||
if (Controller.Folders.Length == 0)
|
if (Controller.Folders.Length == 0)
|
||||||
StateText = _("Welcome to SparkleShare!");
|
StateText = _("Welcome to SparkleShare!");
|
||||||
else
|
else
|
||||||
StateText = _("Up to date") + " — " + Controller.FolderSize;
|
StateText = _("Up to date") + Controller.FolderSize;
|
||||||
|
|
||||||
#if HAVE_APP_INDICATOR
|
#if HAVE_APP_INDICATOR
|
||||||
this.indicator.IconName = "process-syncing-sparkleshare-i";
|
this.indicator.IconName = "process-syncing-sparkleshare-i";
|
||||||
|
@ -161,7 +161,7 @@ namespace SparkleShare {
|
||||||
else
|
else
|
||||||
FrameNumber = 0;
|
FrameNumber = 0;
|
||||||
|
|
||||||
string icon_name = "process-syncing-sparkleshare";
|
string icon_name = "process-syncing-sparkleshare-";
|
||||||
for (int i = 0; i <= FrameNumber; i++)
|
for (int i = 0; i <= FrameNumber; i++)
|
||||||
icon_name += "i";
|
icon_name += "i";
|
||||||
|
|
||||||
|
|
|
@ -50,13 +50,19 @@ namespace SparkleShare {
|
||||||
get {
|
get {
|
||||||
double size = 0;
|
double size = 0;
|
||||||
|
|
||||||
foreach (SparkleRepoBase repo in Program.Controller.Repositories)
|
foreach (SparkleRepoBase repo in
|
||||||
|
Program.Controller.Repositories.GetRange (
|
||||||
|
0, Program.Controller.Repositories.Count)) {
|
||||||
|
|
||||||
size += repo.Size + repo.HistorySize;
|
size += repo.Size + repo.HistorySize;
|
||||||
|
|
||||||
return Program.Controller.FormatSize (size);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
return "";
|
||||||
|
else
|
||||||
|
return " — " + Program.Controller.FormatSize (size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int ProgressPercentage {
|
public int ProgressPercentage {
|
||||||
get {
|
get {
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace SparkleShare {
|
||||||
);
|
);
|
||||||
|
|
||||||
icon_theme.AppendSearchPath (
|
icon_theme.AppendSearchPath (
|
||||||
Path.Combine (SparkleConfig.ConfigPath, "icons")
|
Path.Combine (Path.GetDirectoryName (SparkleConfig.DefaultConfig.FullPath), "icons")
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue