diff --git a/SparkleLib/SparklePaths.cs b/SparkleLib/SparklePaths.cs index 03b2e91d..4eafc899 100644 --- a/SparkleLib/SparklePaths.cs +++ b/SparkleLib/SparklePaths.cs @@ -37,7 +37,7 @@ namespace SparkleLib { public static string SparkleInstallPath = SparkleHelpers.CombineMore (Defines.PREFIX, "sparkleshare"); - public static string SparkleLocalIconPath = SparkleHelpers.CombineMore (HomePath, ".icons", "sparkleshare"); + public static string SparkleLocalIconPath = SparkleHelpers.CombineMore (SparkleConfigPath, "icons", "hicolor"); public static string SparkleIconPath = SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare", "icons"); diff --git a/SparkleShare/SparkleLog.cs b/SparkleShare/SparkleLog.cs index e7e5621f..eb2e4165 100644 --- a/SparkleShare/SparkleLog.cs +++ b/SparkleShare/SparkleLog.cs @@ -222,6 +222,8 @@ namespace SparkleShare { foreach (SparkleCommit commit in commits) { + SparkleUIHelpers.GetAvatar (commit.UserEmail, 32); + bool commit_inserted = false; foreach (ActivityDay stored_activity_day in activity_days) { @@ -365,10 +367,11 @@ namespace SparkleShare { } } - +Console.WriteLine(SparkleUIHelpers.GetAvatar (change_set.UserEmail, 32)); event_entry += ""; event_entries += event_entry_html.Replace ("", event_entry) .Replace ("", change_set.UserName) + .Replace ("", "file://" + SparkleUIHelpers.GetAvatar (change_set.UserEmail, 32)) .Replace ("", change_set.DateTime.ToString ("H:mm")); } @@ -445,7 +448,7 @@ Console.WriteLine ("CLICKED!:" + Status); // wrapper.ModifyBg (StateType.Normal, background_color); - WebView.LoadHtmlString (html, ""); + WebView.LoadHtmlString (html, "file://"); WebView.HoveringOverLink += delegate {}; ScrolledWindow.AddWithViewport (WebView); diff --git a/SparkleShare/SparkleUI.cs b/SparkleShare/SparkleUI.cs index 1ef06ea4..6ed72417 100644 --- a/SparkleShare/SparkleUI.cs +++ b/SparkleShare/SparkleUI.cs @@ -120,9 +120,14 @@ namespace SparkleShare { Application.Invoke (delegate { - SparkleBubble bubble = new SparkleBubble (commit.UserName, message) { - Icon = SparkleUIHelpers.GetAvatar (commit.UserEmail, 32) - }; + SparkleBubble bubble = new SparkleBubble (commit.UserName, message); + + string avatar_file_path = SparkleUIHelpers.GetAvatar (commit.UserEmail, 32); + + if (avatar_file_path != null) + bubble.Icon = new Gdk.Pixbuf (avatar_file_path); + else + bubble.Icon = SparkleUIHelpers.GetIcon ("avatar-default", 32); bubble.AddAction ("", "Show Events", delegate { diff --git a/SparkleShare/SparkleUIHelpers.cs b/SparkleShare/SparkleUIHelpers.cs index f3ff8a5d..3166d07b 100644 --- a/SparkleShare/SparkleUIHelpers.cs +++ b/SparkleShare/SparkleUIHelpers.cs @@ -37,7 +37,7 @@ namespace SparkleShare { // Gets the avatar for a specific email address and size - public static Gdk.Pixbuf GetAvatar (string email, int size) + public static string GetAvatar (string email, int size) { string avatar_path = SparkleHelpers.CombineMore (SparklePaths.SparkleLocalIconPath, @@ -54,12 +54,12 @@ namespace SparkleShare { if (File.Exists (avatar_file_path)) { - return new Gdk.Pixbuf (avatar_file_path); + return avatar_file_path; } else { // Let's try to get the person's gravatar for next time - WebClient WebClient = new WebClient (); + WebClient web_client = new WebClient (); Uri uri = new Uri ("http://www.gravatar.com/avatar/" + GetMD5 (email) + ".jpg?s=" + size + "&d=404"); @@ -67,11 +67,13 @@ namespace SparkleShare { if (!File.Exists (tmp_file_path)) { - WebClient.DownloadFileAsync (uri, tmp_file_path); + web_client.DownloadFileAsync (uri, tmp_file_path); - WebClient.DownloadFileCompleted += delegate { + web_client.DownloadFileCompleted += delegate { + + if (File.Exists (avatar_file_path)) + File.Delete (avatar_file_path); - File.Delete (avatar_file_path); FileInfo tmp_file_info = new FileInfo (tmp_file_path); if (tmp_file_info.Length > 255) @@ -83,9 +85,9 @@ namespace SparkleShare { // Fall back to a generic icon if there is no gravatar if (File.Exists (avatar_file_path)) - return new Gdk.Pixbuf (avatar_file_path); + return avatar_file_path; else - return GetIcon ("avatar-default", size); + return null; } diff --git a/data/html/event-entry.html b/data/html/event-entry.html index a1d1feb1..73e0afd7 100644 --- a/data/html/event-entry.html +++ b/data/html/event-entry.html @@ -4,7 +4,7 @@ - +