Merge branch 'master' of ssh://gitorious.org/sparkleshare/sparkleshare into integration

This commit is contained in:
Hylke Bons 2010-06-12 14:34:16 +01:00
commit 84ce9bc793
4 changed files with 50 additions and 28 deletions

16
README
View file

@ -3,9 +3,6 @@ SparkleShare Version 0.2 Beta 1
SparkleShare is a file sharing and collaboration tool inspired by Dropbox.
SparkleShare currently only works on Linux/GNOME.
Windows and OSX ports are planned for the future.
SparkleShare isn't just a piece of software, it's part of your workflow. It's
designed to make sharing documents and collaboration easier, and to make peers
aware of what you are doing. It allows you to instantly sync with any Git
@ -16,6 +13,9 @@ like backing up small files or monitoring your favourite project. In contrast
to the projects name, we will very likely refuse to implement your personal
ponies.
SparkleShare currently only works on Linux/GNOME.
Windows and OSX ports are planned for the future.
License
=======
@ -77,10 +77,14 @@ A: Because I hate freedom.
Info
====
The official website is:
Official website:
http://www.sparkleshare.org/
Community resources can be found at
http://www.github.com/hbons/SparkleShare
Project page:
http://gitorious.org/sparkleshare
Wiki:
http://gitorious.org/sparkleshare/pages/Home
Now have fun and create cool things together! :)

View file

@ -23,10 +23,25 @@ namespace SparkleShare {
public class SparkleBubble : Notification {
public SparkleBubble (string Title, string Subtext) : base (Title, Subtext) {
Timeout = 4500;
Urgency = Urgency.Low;
IconName = "folder-sparkleshare";
AttachToStatusIcon (SparkleUI.NotificationIcon);
Timeout = 4500;
Urgency = Urgency.Low;
IconName = "folder-sparkleshare";
AttachToStatusIcon (SparkleUI.NotificationIcon);
}
// Checks whether the system allows adding buttons to a notification,
// prevents error messages in Ubuntu.
new public void AddAction (string Action, string Label,
ActionHandler Handler) {
bool CanHaveButtons =
(System.Array.IndexOf (Notifications.Global.Capabilities,
"actions") > -1);
if (CanHaveButtons)
base.AddAction(Action, Label, Handler);
}
}

View file

@ -28,9 +28,10 @@ namespace SparkleShare {
public static bool ShowDebugInfo = true;
// Get's the avatar for a specific email address and size
public static Gdk.Pixbuf GetAvatar (string Email, int Size) {
string AvatarPath = Path.Combine (SparklePaths.SparkleAvatarPath,
string AvatarPath = CombineMore (SparklePaths.SparkleAvatarPath,
Size + "x" + Size);
if (!Directory.Exists (AvatarPath)) {
@ -39,7 +40,7 @@ namespace SparkleShare {
"Created '" + AvatarPath + "'");
}
string AvatarFilePath = AvatarPath + Email;
string AvatarFilePath = CombineMore (AvatarPath, Email);
if (File.Exists (AvatarFilePath))
return new Gdk.Pixbuf (AvatarFilePath);
@ -49,23 +50,25 @@ namespace SparkleShare {
WebClient WebClient = new WebClient ();
Uri GravatarUri = new Uri ("http://www.gravatar.com/avatar/" +
GetMD5 (Email) + ".jpg?s=" + Size + "&d=404");
// TODO: Clean paths
string TmpFile = SparklePaths.SparkleTmpPath + Email + Size;
string TmpFile =
CombineMore (SparklePaths.SparkleTmpPath, Email + Size);
if (!File.Exists (TmpFile)) {
WebClient.DownloadFileAsync (GravatarUri, TmpFile);
WebClient.DownloadFileCompleted += delegate {
File.Delete (AvatarPath + Email);
File.Delete (AvatarFilePath);
FileInfo TmpFileInfo = new FileInfo (TmpFile);
if (TmpFileInfo.Length > 255)
File.Move (TmpFile, AvatarPath + Email);
File.Move (TmpFile, AvatarFilePath);
};
}
if (File.Exists (AvatarPath + Email))
return new Gdk.Pixbuf (AvatarPath + Email);
// Fall back to a generic icon if there is no gravatar
if (File.Exists (AvatarFilePath))
return new Gdk.Pixbuf (AvatarFilePath);
else
return GetIcon ("avatar-default", Size);
@ -75,10 +78,11 @@ namespace SparkleShare {
// Creates an MD5 hash
public static string GetMD5 (string s) {
MD5 md5 = new MD5CryptoServiceProvider ();
Byte[] Bytes = ASCIIEncoding.Default.GetBytes (s);
Byte[] EncodedBytes = md5.ComputeHash (Bytes);
return BitConverter.ToString (EncodedBytes).ToLower ().Replace ("-", "");
MD5 md5 = new MD5CryptoServiceProvider ();
Byte[] Bytes = ASCIIEncoding.Default.GetBytes (s);
Byte[] EncodedBytes = md5.ComputeHash (Bytes);
return BitConverter.ToString
(EncodedBytes).ToLower ().Replace ("-", "");
}
// Makes it possible to combine more than
@ -110,8 +114,8 @@ namespace SparkleShare {
if (ShowDebugInfo) {
DateTime DateTime = new DateTime ();
string TimeStamp = DateTime.Now.ToString ("HH:mm:ss");
Console.WriteLine ("[" + TimeStamp + "] " +
"[" + Type + "] " + Message);
Console.WriteLine ("[" + TimeStamp + "]" +
"[" + Type + "]" + Message);
}
}

View file

@ -198,9 +198,8 @@ namespace SparkleShare {
StateText = _("Error syncing");
}
// TODO: menu should not dissappear on mouse up
public void SetPosition
(Menu menu, out int x, out int y, out bool push_in) {
public void SetPosition (Menu menu, out int x, out int y,
out bool push_in) {
PositionMenu (menu, out x, out y, out push_in, Handle);
@ -210,7 +209,7 @@ namespace SparkleShare {
public void Quit (object o, EventArgs args) {
System.IO.File.Delete
(SparkleHelpers.CombineMore (SparklePaths.SparkleTmpPath +
"sparkleshare.pid"));
"sparkleshare.pid"));
Application.Quit ();
}