Merge branch 'master' into gettext-cs

This commit is contained in:
serras 2012-01-14 11:21:53 +01:00
commit 81a7c81750
15 changed files with 261 additions and 83 deletions

9
NEWS
View file

@ -1,3 +1,12 @@
0.8.0 for Linux and Mac (Sat Jan 14):
Hylke:
- Show syncing progress in the status icon
- Hide dock icon on Mac until you open a window
- Update dates in the event log after midnight
- Don't let git compress already compressed files (.jpg .ogg .zip, etc.)
0.6.0 for Linux and Mac (Sun Dec 25 2011):
Hylke:

View file

@ -31,53 +31,54 @@ namespace SparkleLib {
public SparkleFetcherGit (string server, string remote_folder, string target_folder) :
base (server, remote_folder, target_folder)
{
remote_folder = remote_folder.Trim ("/".ToCharArray ());
if (server.EndsWith ("/"))
server = server.Substring (0, server.Length - 1);
if (server.StartsWith ("http")) {
base.target_folder = target_folder;
base.remote_url = server;
return;
if (!remote_folder.StartsWith ("/"))
remote_folder = "/" + remote_folder;
Uri uri;
try {
uri = new Uri (server + remote_folder);
} catch (UriFormatException) {
uri = new Uri ("ssh://" + server + remote_folder);
}
// Gitorious formatting
if (server.Contains ("gitorious.org")) {
server = "ssh://git@gitorious.org";
if (!remote_folder.EndsWith (".git")) {
if (!uri.Scheme.Equals ("ssh") &&
!uri.Scheme.Equals ("git")) {
if (!remote_folder.Contains ("/"))
remote_folder = remote_folder + "/" + remote_folder;
uri = new Uri ("ssh://" + server);
}
remote_folder += ".git";
if (uri.Host.Equals ("gitorious.org")) {
if (!uri.AbsolutePath.Equals ("/") &&
!uri.AbsolutePath.EndsWith (".git")) {
uri = new Uri ("ssh://git@gitorious.org" + uri.AbsolutePath + ".git");
} else {
uri = new Uri ("ssh://git@gitorious.org" + uri.AbsolutePath);
}
} else if (server.Contains ("github.com")) {
server = "ssh://git@github.com";
} else if (uri.Host.Equals ("github.com")) {
uri = new Uri ("ssh://git@github.com" + uri.AbsolutePath);
} else if (server.Contains ("gnome.org")) {
server = "ssh://git@gnome.org/git";
} else if (uri.Host.Equals ("gnome.org")) {
uri = new Uri ("ssh://git@gnome.org/git" + uri.AbsolutePath);
} else {
server = server.TrimEnd ("/".ToCharArray ());
string protocol = "ssh://";
if (server.StartsWith ("ssh://"))
server = server.Substring (6);
if (server.StartsWith ("git://")) {
server = server.Substring (6);
protocol = "git://";
}
if (!server.Contains ("@"))
server = "git@" + server;
server = protocol + server;
if (string.IsNullOrEmpty (uri.UserInfo))
uri = new Uri (uri.Scheme + "://git@" + uri.Host + uri.AbsolutePath);
}
base.target_folder = target_folder;
base.remote_url = server + "/" + remote_folder;
base.remote_url = uri.ToString ();
}
@ -208,9 +209,10 @@ namespace SparkleLib {
// Add a .gitignore file to the repo
private void InstallExcludeRules ()
{
DirectoryInfo info = Directory.CreateDirectory (SparkleHelpers.CombineMore (
this.target_folder, ".git", "info"));
DirectoryInfo info = Directory.CreateDirectory (
SparkleHelpers.CombineMore (this.target_folder, ".git", "info"));
// File that lists the files we want git to ignore
string exlude_rules_file_path = Path.Combine (info.FullName, "exclude");
TextWriter writer = new StreamWriter (exlude_rules_file_path);
@ -230,14 +232,14 @@ namespace SparkleLib {
// KDE
writer.WriteLine (".directory");
// Mac OSX
// Mac OS X
writer.WriteLine (".DS_Store");
writer.WriteLine ("Icon?");
writer.WriteLine ("._*");
writer.WriteLine (".Spotlight-V100");
writer.WriteLine (".Trashes");
// Mac OSX
// Omnigraffle
writer.WriteLine ("*(Autosaved).graffle");
// Windows
@ -250,16 +252,16 @@ namespace SparkleLib {
writer.WriteLine ("*~*.tmp");
writer.WriteLine ("*~*.TMP");
writer.WriteLine ("~*.ppt");
writer.WriteLine ("~*.pptx");
writer.WriteLine ("~*.PPT");
writer.WriteLine ("~*.pptx");
writer.WriteLine ("~*.PPTX");
writer.WriteLine ("~*.xls");
writer.WriteLine ("~*.xlsx");
writer.WriteLine ("~*.XLS");
writer.WriteLine ("~*.xlsx");
writer.WriteLine ("~*.XLSX");
writer.WriteLine ("~*.doc");
writer.WriteLine ("~*.docx");
writer.WriteLine ("~*.DOC");
writer.WriteLine ("~*.docx");
writer.WriteLine ("~*.DOCX");
// CVS
@ -272,6 +274,101 @@ namespace SparkleLib {
writer.WriteLine ("*/.svn/*");
writer.Close ();
// File that lists the files we want don't want git to compress.
// Not compressing the already compressed files saves us memory
// usage and increases speed
string no_compression_rules_file_path = Path.Combine (info.FullName, "attributes");
writer = new StreamWriter (no_compression_rules_file_path);
// Images
writer.WriteLine ("*.jpg -delta");
writer.WriteLine ("*.jpeg -delta");
writer.WriteLine ("*.JPG -delta");
writer.WriteLine ("*.JPEG -delta");
writer.WriteLine ("*.png -delta");
writer.WriteLine ("*.PNG -delta");
writer.WriteLine ("*.tiff -delta");
writer.WriteLine ("*.TIFF -delta");
// Audio
writer.WriteLine ("*.flac -delta");
writer.WriteLine ("*.FLAC -delta");
writer.WriteLine ("*.mp3 -delta");
writer.WriteLine ("*.MP3 -delta");
writer.WriteLine ("*.ogg -delta");
writer.WriteLine ("*.OGG -delta");
writer.WriteLine ("*.oga -delta");
writer.WriteLine ("*.OGA -delta");
// Video
writer.WriteLine ("*.avi -delta");
writer.WriteLine ("*.AVI -delta");
writer.WriteLine ("*.mov -delta");
writer.WriteLine ("*.MOV -delta");
writer.WriteLine ("*.mpg -delta");
writer.WriteLine ("*.MPG -delta");
writer.WriteLine ("*.mpeg -delta");
writer.WriteLine ("*.MPEG -delta");
writer.WriteLine ("*.mkv -delta");
writer.WriteLine ("*.MKV -delta");
writer.WriteLine ("*.ogv -delta");
writer.WriteLine ("*.OGV -delta");
writer.WriteLine ("*.ogx -delta");
writer.WriteLine ("*.OGX -delta");
writer.WriteLine ("*.webm -delta");
writer.WriteLine ("*.WEBM -delta");
// Archives
writer.WriteLine ("*.zip -delta");
writer.WriteLine ("*.ZIP -delta");
writer.WriteLine ("*.gz -delta");
writer.WriteLine ("*.GZ -delta");
writer.WriteLine ("*.bz -delta");
writer.WriteLine ("*.BZ -delta");
writer.WriteLine ("*.bz2 -delta");
writer.WriteLine ("*.BZ2 -delta");
writer.WriteLine ("*.rpm -delta");
writer.WriteLine ("*.RPM -delta");
writer.WriteLine ("*.deb -delta");
writer.WriteLine ("*.DEB -delta");
writer.WriteLine ("*.tgz -delta");
writer.WriteLine ("*.TGZ -delta");
writer.WriteLine ("*.rar -delta");
writer.WriteLine ("*.RAR -delta");
writer.WriteLine ("*.ace -delta");
writer.WriteLine ("*.ACE -delta");
writer.WriteLine ("*.7z -delta");
writer.WriteLine ("*.7Z -delta");
writer.WriteLine ("*.pak -delta");
writer.WriteLine ("*.PAK -delta");
writer.WriteLine ("*.tar -delta");
writer.WriteLine ("*.TAR -delta");
writer.Close ();
}
}

View file

@ -441,6 +441,7 @@ namespace SparkleLib {
// DU unmerged, deleted by us -> Use theirs
// AA unmerged, both added -> Use theirs, save ours as a timestamped copy
// UU unmerged, both modified -> Use theirs, save ours as a timestamped copy
// ?? unmerged, new files -> Stage the new files
//
// Note that a rebase merge works by replaying each commit from the working branch on
// top of the upstream branch. Because of this, when a merge conflict happens the
@ -525,6 +526,16 @@ namespace SparkleLib {
git_rebase_skip.Start ();
git_rebase_skip.WaitForExit ();
}
// New local files
if (line.StartsWith ("??")) {
Add ();
SparkleGit git_rebase_continue = new SparkleGit (LocalPath, "rebase --continue");
git_rebase_continue.Start ();
git_rebase_continue.WaitForExit ();
}
}
}

View file

@ -29,16 +29,23 @@ namespace SparkleLib {
Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
"sparkleshare");
public bool DebugMode = true;
public static SparkleConfig DefaultConfig = new SparkleConfig (ConfigPath, "config.xml");
public string FullPath;
public string LogFilePath;
public string TmpPath;
public string HomePath {
get {
return Environment.GetFolderPath (Environment.SpecialFolder.Personal);
}
if (GetConfigOption ("home_path") != null)
return GetConfigOption ("home_path");
else
return Environment.GetFolderPath (Environment.SpecialFolder.Personal);
}
}
public string FoldersPath {
get {
if (GetConfigOption ("folders_path") != null)
@ -48,16 +55,19 @@ namespace SparkleLib {
}
}
public string TmpPath {
get {
return Path.Combine (FoldersPath, ".tmp");
}
}
public SparkleConfig (string config_path, string config_file_name)
{
FullPath = System.IO.Path.Combine (config_path, config_file_name);
FullPath = Path.Combine (config_path, config_file_name);
LogFilePath = Path.Combine (config_path, "debug.log");
if (File.Exists (LogFilePath)) {
try {
File.Delete (LogFilePath);
} catch (Exception) {
// Don't delete the debug.log if 'tail' is reading it
}
}
if (!Directory.Exists (config_path)) {
Directory.CreateDirectory (config_path);
@ -93,6 +103,7 @@ namespace SparkleLib {
} finally {
Load (FullPath);
TmpPath = Path.Combine (FoldersPath, ".tmp");
}
}
@ -153,11 +164,11 @@ namespace SparkleLib {
this.Save ();
ConfigureSSH ();
// ConfigureSSH ();
}
}
/*
private void ConfigureSSH ()
{
if (User.Email.Equals ("Unknown"))
@ -209,7 +220,7 @@ namespace SparkleLib {
SparkleHelpers.DebugInfo ("Config", "Added key to " + ssh_config_file_path);
}
*/
public List<string> Folders {
get {

View file

@ -23,7 +23,7 @@ namespace SparkleLib {
public static class SparkleHelpers {
public static bool ShowDebugInfo = true;
private static object debug_lock = new object ();
// Show debug info if needed
public static void DebugInfo (string type, string message)
@ -34,8 +34,17 @@ namespace SparkleLib {
if (!message.StartsWith ("["))
message = " " + message;
// TODO: Write to a log
Console.WriteLine (timestamp + " " + "[" + type + "]" + message);
string line = timestamp + " " + "[" + type + "]" + message;
if (SparkleConfig.DefaultConfig.DebugMode)
Console.WriteLine (line);
lock (debug_lock) {
File.AppendAllText (
SparkleConfig.DefaultConfig.LogFilePath,
line + Environment.NewLine
);
}
}
}

View file

@ -578,7 +578,20 @@ namespace SparkleLib {
{
string file_path = Path.Combine (LocalPath, "SparkleShare.txt");
TextWriter writer = new StreamWriter (file_path);
writer.WriteLine (":)");
writer.WriteLine ("Congratulations, you've successfully created a SparkleShare repository!");
writer.WriteLine ("");
writer.WriteLine ("Any files you add or change in this folder will be automatically synced to ");
writer.WriteLine (SparkleConfig.DefaultConfig.GetUrlForFolder (Name) + " and everyone connected to it.");
// TODO: Url property? ^
writer.WriteLine ("");
writer.WriteLine ("SparkleShare is a Free and Open Source software program that helps people ");
writer.WriteLine ("collaborate and share files. If you like what we do, please consider a small ");
writer.WriteLine ("donation to support the project: http://sparkleshare.org/support-us/");
writer.WriteLine ("");
writer.WriteLine ("Have fun! :)");
writer.WriteLine ("");
writer.Close ();
}

View file

@ -161,13 +161,13 @@ namespace SparkleShare {
get {
string resource_path = NSBundle.MainBundle.ResourcePath;
string html_path = Path.Combine (resource_path, "HTML", "event-log.html");
StreamReader reader = new StreamReader (html_path);
string html = reader.ReadToEnd ();
reader.Close ();
string html = File.ReadAllText (html_path);
html = html.Replace ("<!-- $jquery-url -->", "file://" +
Path.Combine (NSBundle.MainBundle.ResourcePath, "HTML", "jquery.js"));
string jquery_file_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
"HTML", "jquery.js");
string jquery = File.ReadAllText (jquery_file_path);
html = html.Replace ("<!-- $jquery -->", jquery);
return html;
}

View file

@ -11,7 +11,7 @@
<RootNamespace>SparkleShare</RootNamespace>
<AssemblyName>SparkleShare</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<ReleaseVersion>0.6.0</ReleaseVersion>
<ReleaseVersion>0.8.0</ReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>

View file

@ -16,6 +16,6 @@ Global
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = SparkleShare.csproj
version = 0.6.0
version = 0.8.0
EndGlobalSection
EndGlobal

View file

@ -94,13 +94,13 @@ namespace SparkleShare {
public void UpdateDockIconVisibility ()
{
if (true) { // TODO: check for open windows
// if (true) { // TODO: check for open windows
ShowDockIcon ();
} else {
HideDockIcon ();
}
// } else {
// HideDockIcon ();
// }
}

View file

@ -175,13 +175,16 @@ namespace SparkleShare {
public override string EventLogHTML {
get {
string path = new string [] {Defines.PREFIX,
"share", "sparkleshare", "html", "event-log.html"}.Combine ();
string html_path = new string [] {Defines.PREFIX, "share",
"sparkleshare", "html", "event-log.html"}.Combine ();
string html = String.Join (Environment.NewLine, File.ReadAllLines (path));
string html = File.ReadAllText (html_path);
html = html.Replace ("<!-- $jquery-url -->", "file://" +
new string [] {Defines.PREFIX, "share", "sparkleshare", "html", "jquery.js"}.Combine ());
string jquery_file_path = new string [] {Defines.PREFIX, "share",
"sparkleshare", "html", "jquery.js"}.Combine ()
string jquery = File.ReadAllText (jquery_file_path);
html = html.Replace ("<!-- $jquery -->", jquery);
return html;
}

View file

@ -469,13 +469,17 @@ namespace SparkleShare {
today.Month == activity_day.DateTime.Month &&
today.Year == activity_day.DateTime.Year) {
day_entry = day_entry_html.Replace ("<!-- $day-entry-header -->", "Today");
day_entry = day_entry_html.Replace ("<!-- $day-entry-header -->",
"<span id='today' name='" + activity_day.DateTime.ToString (_("dddd, MMMM d")) + "'>"
+ _("Today") + "</span>");
} else if (yesterday.Day == activity_day.DateTime.Day &&
yesterday.Month == activity_day.DateTime.Month &&
yesterday.Year == activity_day.DateTime.Year) {
day_entry = day_entry_html.Replace ("<!-- $day-entry-header -->", "Yesterday");
day_entry = day_entry_html.Replace ("<!-- $day-entry-header -->",
"<span id='yesterday' name='" + activity_day.DateTime.ToString (_("dddd, MMMM d")) + "'>"
+ _("Yesterday") + "</span>");
} else {
if (activity_day.DateTime.Year != DateTime.Now.Year) {
@ -495,9 +499,13 @@ namespace SparkleShare {
event_log += day_entry.Replace ("<!-- $day-entry-content -->", event_entries);
}
string html = event_log_html.Replace ("<!-- $event-log-content -->", event_log)
int midnight = (int) (DateTime.Today.AddDays (1) - new DateTime (1970, 1, 1)).TotalSeconds;
string html = event_log_html.Replace ("<!-- $event-log-content -->", event_log)
.Replace ("<!-- $username -->", UserName)
.Replace ("<!-- $user-avatar-url -->", "file://" + GetAvatar (UserEmail, 48));
.Replace ("<!-- $user-avatar-url -->", "file://" + GetAvatar (UserEmail, 48))
.Replace ("<!-- $midnight -->", midnight.ToString ());
return html;
}

View file

@ -225,7 +225,7 @@ namespace SparkleShare {
Application.Invoke (delegate {
this.spinner.Stop ();
this.web_view.LoadString (html, null, null, "file://");
this.web_view.LoadString (html, null, null, "file:///");
this.content_wrapper.Remove (this.content_wrapper.Child);
this.content_wrapper.Add (this.scrolled_window);
this.content_wrapper.ShowAll ();

View file

@ -1,9 +1,9 @@
dnl Process this file with autoconf to produce a configure script.
m4_define([sparkleshare_version],
[0.6.0])
[0.8.0])
m4_define([sparkleshare_asm_version],
[0.6.0])
[0.8.0])
AC_PREREQ([2.54])
AC_INIT([SparkleShare], sparkleshare_version)

View file

@ -2,9 +2,26 @@
<html>
<head>
<title>SparkleShare Event Log</title>
<script type="text/javascript" src="<!-- $jquery-url -->"></script>
<script type="text/javascript">
<!-- $jquery -->
</script>
<script type="text/javascript">
$(document).ready(function () {
// Update the Today and Yesterday labels after midnight
var midnight_interval = setInterval (function(){
var date = new Date();
if ((date.getTime() / 1000) >= <!-- $midnight -->) {
$("#today").html($("#today").attr("name"));
$("#yesterday").html($("#yesterday").attr("name"));
clearInterval(midnight_interval);
}
}, 60 * 1000);
$('.comments-section').each (function () {
if ($(this).find ('.comments').children ().size () < 1) {
$(this).hide ();