eventlog: take user to gravatar.com when clicking on avatars

This commit is contained in:
Hylke Bons 2012-10-06 13:17:39 +02:00
parent a406a0964d
commit 2d04277a77
11 changed files with 44 additions and 30 deletions

View file

@ -134,7 +134,7 @@ namespace SparkleLib {
bool warn = true; bool warn = true;
if (RequiredFingerprint != null) { if (RequiredFingerprint != null) {
string host_fingerprint = GetFingerprint (host_key); string host_fingerprint = DeriveFingerprint (host_key);
if (host_fingerprint == null || !RequiredFingerprint.Equals (host_fingerprint)) { if (host_fingerprint == null || !RequiredFingerprint.Equals (host_fingerprint)) {
SparkleLogger.LogInfo ("Auth", "Fingerprint doesn't match"); SparkleLogger.LogInfo ("Auth", "Fingerprint doesn't match");
@ -292,7 +292,7 @@ namespace SparkleLib {
} }
private string GetFingerprint (string public_key) private string DeriveFingerprint (string public_key)
{ {
try { try {
MD5 md5 = new MD5CryptoServiceProvider (); MD5 md5 = new MD5CryptoServiceProvider ();
@ -339,7 +339,7 @@ namespace SparkleLib {
SparkleLogger.LogInfo ("Auth", "Accepted host key for " + host); SparkleLogger.LogInfo ("Auth", "Accepted host key for " + host);
if (warn) if (warn)
this.warnings.Add ("The following host key has been accepted:\n" + GetFingerprint (host_key)); this.warnings.Add ("The following host key has been accepted:\n" + DeriveFingerprint (host_key));
} }

View file

@ -1,5 +1,5 @@
<div class='event-entry'> <div class='event-entry'>
<div class='event-avatar' style='background-image: url("<!-- $event-avatar-url -->");'></div> <a href="http://gravatar.com/"><div class='event-avatar' style='background-image: url("<!-- $event-avatar-url -->");'></div></a>
<div class='event-user-name'><!-- $event-user-name --><span class='event-folder'><!-- $event-folder --></span></div> <div class='event-user-name'><!-- $event-user-name --><span class='event-folder'><!-- $event-folder --></span></div>
<!-- $event-entry-content --> <!-- $event-entry-content -->
<a class="show">Show all</a> <a class="show">Show all</a>

View file

@ -116,13 +116,6 @@
min-height: 100px; min-height: 100px;
} }
.no-buddy-icon {
width: 48px;
background-image: url('<!-- $no-buddy-icon-background-image -->');
background-repeat: no-repeat;
background-position: top center;
}
.event-user-name { .event-user-name {
font-weight: bold; font-weight: bold;
} }

View file

@ -167,7 +167,7 @@ namespace SparkleShare {
public class SparkleLink : EventBox { public class SparkleLink : EventBox {
public SparkleLink (string text, string address) public SparkleLink (string text, string url)
{ {
VisibleWindow = false; VisibleWindow = false;
@ -184,10 +184,7 @@ namespace SparkleShare {
}; };
ButtonPressEvent += delegate { ButtonPressEvent += delegate {
Process process = new Process (); Program.Controller.OpenWebsite (url);
process.StartInfo.FileName = "xdg-open";
process.StartInfo.Arguments = address;
process.Start ();
}; };
Add (label); Add (label);

View file

@ -194,5 +194,11 @@ namespace SparkleShare {
process.StartInfo.Arguments = "\"" + path + "\""; process.StartInfo.Arguments = "\"" + path + "\"";
process.Start (); process.Start ();
} }
public override void OpenWebsite (string url)
{
OpenFile (url);
}
} }
} }

View file

@ -261,7 +261,7 @@ namespace SparkleShare {
Editable = false; Editable = false;
Selectable = false; Selectable = false;
NSData name_data = NSData.FromString ("<a href='" + url + NSData name_data = NSData.FromString ("<a href='" + this.url +
"' style='font-size: 8pt; font-family: \"Lucida Grande\"; color: #739ECF'>" + text + "</a></font>"); "' style='font-size: 8pt; font-family: \"Lucida Grande\"; color: #739ECF'>" + text + "</a></font>");
NSDictionary name_dictionary = new NSDictionary(); NSDictionary name_dictionary = new NSDictionary();
@ -278,7 +278,7 @@ namespace SparkleShare {
public override void MouseUp (NSEvent e) public override void MouseUp (NSEvent e)
{ {
NSWorkspace.SharedWorkspace.OpenUrl (url); Program.Controller.OpenWebsite (this.url.ToString ());
} }

View file

@ -194,13 +194,19 @@ namespace SparkleShare {
NSWorkspace.SharedWorkspace.OpenFile (path); NSWorkspace.SharedWorkspace.OpenFile (path);
} }
public override void OpenFile (string path) public override void OpenFile (string path)
{ {
path = Uri.UnescapeDataString (path); path = Uri.UnescapeDataString (path);
NSWorkspace.SharedWorkspace.OpenFile (path); NSWorkspace.SharedWorkspace.OpenFile (path);
} }
public override void OpenWebsite (string url)
{
NSWorkspace.SharedWorkspace.OpenUrl (new NSUrl (url));
}
private string event_log_html; private string event_log_html;
public override string EventLogHTML public override string EventLogHTML

View file

@ -147,9 +147,12 @@ namespace SparkleShare {
// Opens the SparkleShare folder or an (optional) subfolder // Opens the SparkleShare folder or an (optional) subfolder
public abstract void OpenFolder (string path); public abstract void OpenFolder (string path);
// Opens a file with the appropriate application // Opens a file with the appropriate application
public abstract void OpenFile (string path); public abstract void OpenFile (string path);
// Opens a file with the appropriate application
public abstract void OpenWebsite (string url);
private SparkleConfig config; private SparkleConfig config;

View file

@ -217,6 +217,9 @@ namespace SparkleShare {
url.Substring (1, 1).Equals (":")) { url.Substring (1, 1).Equals (":")) {
Program.Controller.OpenFile (url); Program.Controller.OpenFile (url);
} else if (url.StartsWith ("http")) {
Program.Controller.OpenWebsite (url);
} }
} }

View file

@ -171,7 +171,7 @@ namespace SparkleShare {
public class SparkleLink : Label { public class SparkleLink : Label {
public SparkleLink (string title, string address) public SparkleLink (string title, string url)
{ {
FontSize = 11; FontSize = 11;
Cursor = Cursors.Hand; Cursor = Cursors.Hand;
@ -193,7 +193,7 @@ namespace SparkleShare {
Content = text_block; Content = text_block;
MouseUp += delegate { MouseUp += delegate {
Process.Start (new ProcessStartInfo (address)); Program.Controller.OpenWebsite (url);
}; };
} }
} }

View file

@ -172,14 +172,20 @@ namespace SparkleShare {
} }
public override void OpenFolder (string path) public override void OpenFolder (string path)
{ {
Process process = new Process (); Process process = new Process ();
process.StartInfo.FileName = "explorer"; process.StartInfo.FileName = "explorer";
process.StartInfo.Arguments = path; process.StartInfo.Arguments = path;
process.Start (); process.Start ();
} }
public override void OpenWebsite (string url)
{
Process.Start (new ProcessStartInfo (url));
}
public override void Quit () public override void Quit ()