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 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 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 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 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 to the projects name, we will very likely refuse to implement your personal
ponies. ponies.
SparkleShare currently only works on Linux/GNOME.
Windows and OSX ports are planned for the future.
License License
======= =======
@ -77,10 +77,14 @@ A: Because I hate freedom.
Info Info
==== ====
The official website is: Official website:
http://www.sparkleshare.org/ http://www.sparkleshare.org/
Community resources can be found at Project page:
http://www.github.com/hbons/SparkleShare http://gitorious.org/sparkleshare
Wiki:
http://gitorious.org/sparkleshare/pages/Home
Now have fun and create cool things together! :) Now have fun and create cool things together! :)

View file

@ -23,10 +23,25 @@ namespace SparkleShare {
public class SparkleBubble : Notification { public class SparkleBubble : Notification {
public SparkleBubble (string Title, string Subtext) : base (Title, Subtext) { public SparkleBubble (string Title, string Subtext) : base (Title, Subtext) {
Timeout = 4500;
Urgency = Urgency.Low; Timeout = 4500;
IconName = "folder-sparkleshare"; Urgency = Urgency.Low;
AttachToStatusIcon (SparkleUI.NotificationIcon); 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; 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) { public static Gdk.Pixbuf GetAvatar (string Email, int Size) {
string AvatarPath = Path.Combine (SparklePaths.SparkleAvatarPath, string AvatarPath = CombineMore (SparklePaths.SparkleAvatarPath,
Size + "x" + Size); Size + "x" + Size);
if (!Directory.Exists (AvatarPath)) { if (!Directory.Exists (AvatarPath)) {
@ -39,7 +40,7 @@ namespace SparkleShare {
"Created '" + AvatarPath + "'"); "Created '" + AvatarPath + "'");
} }
string AvatarFilePath = AvatarPath + Email; string AvatarFilePath = CombineMore (AvatarPath, Email);
if (File.Exists (AvatarFilePath)) if (File.Exists (AvatarFilePath))
return new Gdk.Pixbuf (AvatarFilePath); return new Gdk.Pixbuf (AvatarFilePath);
@ -49,23 +50,25 @@ namespace SparkleShare {
WebClient WebClient = new WebClient (); WebClient WebClient = new WebClient ();
Uri GravatarUri = new Uri ("http://www.gravatar.com/avatar/" + Uri GravatarUri = new Uri ("http://www.gravatar.com/avatar/" +
GetMD5 (Email) + ".jpg?s=" + Size + "&d=404"); 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)) { if (!File.Exists (TmpFile)) {
WebClient.DownloadFileAsync (GravatarUri, TmpFile); WebClient.DownloadFileAsync (GravatarUri, TmpFile);
WebClient.DownloadFileCompleted += delegate { WebClient.DownloadFileCompleted += delegate {
File.Delete (AvatarPath + Email); File.Delete (AvatarFilePath);
FileInfo TmpFileInfo = new FileInfo (TmpFile); FileInfo TmpFileInfo = new FileInfo (TmpFile);
if (TmpFileInfo.Length > 255) if (TmpFileInfo.Length > 255)
File.Move (TmpFile, AvatarPath + Email); File.Move (TmpFile, AvatarFilePath);
}; };
} }
if (File.Exists (AvatarPath + Email)) // Fall back to a generic icon if there is no gravatar
return new Gdk.Pixbuf (AvatarPath + Email); if (File.Exists (AvatarFilePath))
return new Gdk.Pixbuf (AvatarFilePath);
else else
return GetIcon ("avatar-default", Size); return GetIcon ("avatar-default", Size);
@ -75,10 +78,11 @@ namespace SparkleShare {
// Creates an MD5 hash // Creates an MD5 hash
public static string GetMD5 (string s) { public static string GetMD5 (string s) {
MD5 md5 = new MD5CryptoServiceProvider (); MD5 md5 = new MD5CryptoServiceProvider ();
Byte[] Bytes = ASCIIEncoding.Default.GetBytes (s); Byte[] Bytes = ASCIIEncoding.Default.GetBytes (s);
Byte[] EncodedBytes = md5.ComputeHash (Bytes); Byte[] EncodedBytes = md5.ComputeHash (Bytes);
return BitConverter.ToString (EncodedBytes).ToLower ().Replace ("-", ""); return BitConverter.ToString
(EncodedBytes).ToLower ().Replace ("-", "");
} }
// Makes it possible to combine more than // Makes it possible to combine more than
@ -110,8 +114,8 @@ namespace SparkleShare {
if (ShowDebugInfo) { if (ShowDebugInfo) {
DateTime DateTime = new DateTime (); DateTime DateTime = new DateTime ();
string TimeStamp = DateTime.Now.ToString ("HH:mm:ss"); string TimeStamp = DateTime.Now.ToString ("HH:mm:ss");
Console.WriteLine ("[" + TimeStamp + "] " + Console.WriteLine ("[" + TimeStamp + "]" +
"[" + Type + "] " + Message); "[" + Type + "]" + Message);
} }
} }

View file

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