[log] pass avatars to the new webkit view
This commit is contained in:
parent
4c2b832e45
commit
81854f610a
|
@ -37,7 +37,7 @@ namespace SparkleLib {
|
||||||
|
|
||||||
public static string SparkleInstallPath = SparkleHelpers.CombineMore (Defines.PREFIX, "sparkleshare");
|
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",
|
public static string SparkleIconPath = SparkleHelpers.CombineMore (Defines.PREFIX, "share", "sparkleshare",
|
||||||
"icons");
|
"icons");
|
||||||
|
|
|
@ -222,6 +222,8 @@ namespace SparkleShare {
|
||||||
|
|
||||||
foreach (SparkleCommit commit in commits) {
|
foreach (SparkleCommit commit in commits) {
|
||||||
|
|
||||||
|
SparkleUIHelpers.GetAvatar (commit.UserEmail, 32);
|
||||||
|
|
||||||
bool commit_inserted = false;
|
bool commit_inserted = false;
|
||||||
foreach (ActivityDay stored_activity_day in activity_days) {
|
foreach (ActivityDay stored_activity_day in activity_days) {
|
||||||
|
|
||||||
|
@ -365,10 +367,11 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Console.WriteLine(SparkleUIHelpers.GetAvatar (change_set.UserEmail, 32));
|
||||||
event_entry += "</dl>";
|
event_entry += "</dl>";
|
||||||
event_entries += event_entry_html.Replace ("<!-- $event-entry-content -->", event_entry)
|
event_entries += event_entry_html.Replace ("<!-- $event-entry-content -->", event_entry)
|
||||||
.Replace ("<!-- $event-user-name -->", change_set.UserName)
|
.Replace ("<!-- $event-user-name -->", change_set.UserName)
|
||||||
|
.Replace ("<!-- $event-avatar-url -->", "file://" + SparkleUIHelpers.GetAvatar (change_set.UserEmail, 32))
|
||||||
.Replace ("<!-- $event-time -->", change_set.DateTime.ToString ("H:mm"));
|
.Replace ("<!-- $event-time -->", change_set.DateTime.ToString ("H:mm"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -445,7 +448,7 @@ Console.WriteLine ("CLICKED!:" + Status);
|
||||||
|
|
||||||
// wrapper.ModifyBg (StateType.Normal, background_color);
|
// wrapper.ModifyBg (StateType.Normal, background_color);
|
||||||
|
|
||||||
WebView.LoadHtmlString (html, "");
|
WebView.LoadHtmlString (html, "file://");
|
||||||
WebView.HoveringOverLink += delegate {};
|
WebView.HoveringOverLink += delegate {};
|
||||||
|
|
||||||
ScrolledWindow.AddWithViewport (WebView);
|
ScrolledWindow.AddWithViewport (WebView);
|
||||||
|
|
|
@ -120,9 +120,14 @@ namespace SparkleShare {
|
||||||
|
|
||||||
Application.Invoke (delegate {
|
Application.Invoke (delegate {
|
||||||
|
|
||||||
SparkleBubble bubble = new SparkleBubble (commit.UserName, message) {
|
SparkleBubble bubble = new SparkleBubble (commit.UserName, message);
|
||||||
Icon = SparkleUIHelpers.GetAvatar (commit.UserEmail, 32)
|
|
||||||
};
|
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 {
|
bubble.AddAction ("", "Show Events", delegate {
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
|
|
||||||
// Gets the avatar for a specific email address and size
|
// 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,
|
string avatar_path = SparkleHelpers.CombineMore (SparklePaths.SparkleLocalIconPath,
|
||||||
|
@ -54,12 +54,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
if (File.Exists (avatar_file_path)) {
|
if (File.Exists (avatar_file_path)) {
|
||||||
|
|
||||||
return new Gdk.Pixbuf (avatar_file_path);
|
return avatar_file_path;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Let's try to get the person's gravatar for next time
|
// 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) +
|
Uri uri = new Uri ("http://www.gravatar.com/avatar/" + GetMD5 (email) +
|
||||||
".jpg?s=" + size + "&d=404");
|
".jpg?s=" + size + "&d=404");
|
||||||
|
|
||||||
|
@ -67,11 +67,13 @@ namespace SparkleShare {
|
||||||
|
|
||||||
if (!File.Exists (tmp_file_path)) {
|
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);
|
FileInfo tmp_file_info = new FileInfo (tmp_file_path);
|
||||||
|
|
||||||
if (tmp_file_info.Length > 255)
|
if (tmp_file_info.Length > 255)
|
||||||
|
@ -83,9 +85,9 @@ namespace SparkleShare {
|
||||||
|
|
||||||
// Fall back to a generic icon if there is no gravatar
|
// Fall back to a generic icon if there is no gravatar
|
||||||
if (File.Exists (avatar_file_path))
|
if (File.Exists (avatar_file_path))
|
||||||
return new Gdk.Pixbuf (avatar_file_path);
|
return avatar_file_path;
|
||||||
else
|
else
|
||||||
return GetIcon ("avatar-default", size);
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td><img src='http://www.gravatar.com/avatar/3e8eee17a5d6c6a20b073af0d2b2b48b.png' width='32'></td>
|
<td><img src='<!-- $event-avatar-url -->'></td>
|
||||||
<td width='100%'>
|
<td width='100%'>
|
||||||
<b><!-- $event-user-name --></b><br>
|
<b><!-- $event-user-name --></b><br>
|
||||||
<!-- $event-entry-content -->
|
<!-- $event-entry-content -->
|
||||||
|
|
Loading…
Reference in a new issue