[log] Add a default buddy icon and prettify the event log

This commit is contained in:
Hylke Bons 2011-02-11 01:31:10 +00:00
parent 7ed60cc0a7
commit b51681c662
9 changed files with 90 additions and 40 deletions

View file

@ -130,7 +130,8 @@ namespace SparkleLib {
private void InstallExcludeRules () private void InstallExcludeRules ()
{ {
string exlude_rules_file_path = SparkleHelpers.CombineMore (TargetFolder, ".git", "info", "exclude"); string exlude_rules_file_path = SparkleHelpers.CombineMore
(TargetFolder, ".git", "info", "exclude");
TextWriter writer = new StreamWriter (exlude_rules_file_path); TextWriter writer = new StreamWriter (exlude_rules_file_path);
@ -158,7 +159,7 @@ namespace SparkleLib {
writer.WriteLine ("Desktop.ini"); writer.WriteLine ("Desktop.ini");
// CVS // CVS
writer.WriteLine ("*/CVS/*") writer.WriteLine ("*/CVS/*");
writer.WriteLine (".cvsignore"); writer.WriteLine (".cvsignore");
writer.WriteLine ("*/.cvsignore"); writer.WriteLine ("*/.cvsignore");

View file

@ -652,7 +652,7 @@ namespace SparkleLib {
Commited (this, args); Commited (this, args);
// Collect garbage pseudo-randomly // Collect garbage pseudo-randomly
if (DateTime.Now.Second == 0) if (DateTime.Now.Second % 10 == 0)
CollectGarbage (); CollectGarbage ();
} }

View file

@ -394,7 +394,9 @@ namespace SparkleShare {
}; };
CancelButton.Activated += delegate { CancelButton.Activated += delegate {
Close (); InvokeOnMainThread (delegate {
Close ();
});
}; };
Buttons.Add (CancelButton); Buttons.Add (CancelButton);
@ -406,7 +408,9 @@ namespace SparkleShare {
}; };
SkipButton.Activated += delegate { SkipButton.Activated += delegate {
ShowCompletedPage (); InvokeOnMainThread (delegate {
ShowCompletedPage ();
});
}; };
Buttons.Add (SkipButton); Buttons.Add (SkipButton);
@ -432,7 +436,9 @@ namespace SparkleShare {
}; };
TryAgainButton.Activated += delegate { TryAgainButton.Activated += delegate {
ShowServerForm (); InvokeOnMainThread (delegate {
ShowServerForm ();
});
}; };
@ -490,8 +496,10 @@ namespace SparkleShare {
}; };
FinishButton.Activated += delegate { FinishButton.Activated += delegate {
SparkleUI.StatusIcon.CreateMenu (); InvokeOnMainThread (delegate {
Close (); SparkleUI.StatusIcon.CreateMenu ();
Close ();
});
}; };
@ -531,8 +539,11 @@ namespace SparkleShare {
}; };
FinishButton.Activated += delegate { FinishButton.Activated += delegate {
SparkleUI.StatusIcon.CreateMenu (); InvokeOnMainThread (delegate {
Close (); SparkleUI.StatusIcon.CreateMenu ();
Close ();
});
}; };
Buttons.Add (FinishButton); Buttons.Add (FinishButton);

View file

@ -121,11 +121,15 @@ namespace SparkleShare {
string html = SparkleShare.Controller.GetHTMLLog (folder_name); string html = SparkleShare.Controller.GetHTMLLog (folder_name);
html = html.Replace ("<!-- $body-font-family -->", "Lucida Grande"); html = html.Replace ("<!-- $body-font-family -->", "Lucida Grande");
html = html.Replace ("<!-- $body-font-size -->", "10.1pt"); html = html.Replace ("<!-- $body-font-size -->", "13.4px");
html = html.Replace ("<!-- $secondary-font-color -->", "#bbb"); html = html.Replace ("<!-- $secondary-font-color -->", "#bbb");
html = html.Replace ("<!-- $small-color -->", "#ddd");
html = html.Replace ("<!-- $day-entry-header-background-color -->", "#f5f5f5"); html = html.Replace ("<!-- $day-entry-header-background-color -->", "#f5f5f5");
html = html.Replace ("<!-- $a-color -->", "#0085cf"); html = html.Replace ("<!-- $a-color -->", "#0085cf");
html = html.Replace ("<!-- $no-buddy-icon-background-image -->",
"file://" + Path.Combine (NSBundle.MainBundle.ResourcePath, "Pixmaps", "avatar-default.png"));
Console.WriteLine (html);
WebView.MainFrame.LoadHtmlString (html, new NSUrl ("")); WebView.MainFrame.LoadHtmlString (html, new NSUrl (""));
Update (); Update ();

View file

@ -919,10 +919,10 @@ namespace SparkleShare {
} else { } else {
TextWriter writer = new StreamWriter (ssh_config_file_path); TextWriter writer = new StreamWriter (ssh_config_file_path);
writer.WriteLine (ssh_config); writer.WriteLine (ssh_config);
writer.Close (); writer.Close ();
} }
} }
@ -962,9 +962,12 @@ namespace SparkleShare {
private void DisableHostKeyCheckingForHost (string host) private void DisableHostKeyCheckingForHost (string host)
{ {
string ssh_config_file_path = Path.Combine (SparklePaths.HomePath, ".ssh", "config"); string ssh_config_file_path = Path.Combine
string ssh_config = "Host " + host + "\n\tStrictHostKeyChecking no"; (SparklePaths.HomePath, ".ssh", "config");
string ssh_config = "Host " + host + "\n" +
"\tStrictHostKeyChecking no";
if (File.Exists (ssh_config_file_path)) { if (File.Exists (ssh_config_file_path)) {
@ -986,28 +989,31 @@ namespace SparkleShare {
private void EnableHostKeyCheckingForHost (string host) private void EnableHostKeyCheckingForHost (string host)
{ {
string ssh_config_file_path = Path.Combine (SparklePaths.HomePath, ".ssh", "config"); string ssh_config_file_path = Path.Combine
string ssh_config = "Host " + host + "\n\tStrictHostKeyChecking no"; (SparklePaths.HomePath, ".ssh", "config");
string ssh_config = "Host " + host + "\n" +
"\tStrictHostKeyChecking no";
if (File.Exists (ssh_config_file_path)) { if (File.Exists (ssh_config_file_path)) {
StreamReader reader = new StreamReader (ssh_config_file_path); StreamReader reader = new StreamReader (ssh_config_file_path);
string current_ssh_config = reader.ReadToEnd (); string current_ssh_config = reader.ReadToEnd ();
reader.Close (); reader.Close ();
if (current_ssh_config.Equals (ssh_config)) { current_ssh_config = current_ssh_config.Remove (current_ssh_config.IndexOf (ssh_config),
ssh_config.Length);
File.Delete (ssh_config_file_path);
if (current_ssh_config.Trim ().Equals ("")) {
File.Delete (ssh_config_file_path);
} else { } else {
current_ssh_config = current_ssh_config.Remove (current_ssh_config.IndexOf (ssh_config),
ssh_config.Length);
TextWriter writer = new StreamWriter (ssh_config_file_path); TextWriter writer = new StreamWriter (ssh_config_file_path);
writer.WriteLine (current_ssh_config); writer.WriteLine (current_ssh_config);
writer.Close (); writer.Close ();
} }
} }
@ -1075,7 +1081,7 @@ namespace SparkleShare {
} catch (Exception e) { } catch (Exception e) {
SparkleHelpers.DebugInfo ("Controller", "Error moving folder: " + e.Message); SparkleHelpers.DebugInfo ("Controller", "Error moving folder: " + e.Message);
} }
@ -1097,11 +1103,12 @@ namespace SparkleShare {
SparkleHelpers.ClearAttributes (tmp_folder); SparkleHelpers.ClearAttributes (tmp_folder);
Directory.Delete (tmp_folder, true); Directory.Delete (tmp_folder, true);
SparkleHelpers.DebugInfo ("Config", "Deleted temporary directory: " + tmp_folder); SparkleHelpers.DebugInfo ("Config",
"Deleted temporary directory: " + tmp_folder);
} }
if (FolderFetchError != null) if (FolderFetchError != null)
FolderFetchError (); FolderFetchError ();

BIN
data/avatar-default.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -4,7 +4,11 @@
<table> <table>
<tr> <tr>
<td><img src='<!-- $event-avatar-url -->'></td> <td>
<div class='no-buddy-icon'>
<div class='buddy-icon' style='background-image: url("<!-- $event-avatar-url -->")'></div>
</div>
</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 -->

View file

@ -8,12 +8,13 @@
<style> <style>
body { body {
background-color: <!-- $body-background-color -->; background-color: #f1f1f1;
color: <!-- $body-color -->; color: <!-- $body-color -->;
font-size: <!-- $body-font-size -->; font-size: <!-- $body-font-size -->;
font-family: <!-- $body-font-family -->; font-family: <!-- $body-font-family -->;
margin: 0; margin: 0;
padding: 0; padding: 0;
margin-top: 20px;
} }
small { small {
@ -22,8 +23,15 @@
} }
.day-entry-header { .day-entry-header {
background-color: <!-- $day-entry-header-background-color -->; background-color: #ccc;
padding: 9px; color: #f7f7f7;
padding: 3px;
text-align: center;
margin-left: auto;
margin-right: auto;
-webkit-border-radius: 20px;
width: 128px;
font-weight: lighter;
} }
.day-entry-content { .day-entry-content {
@ -43,7 +51,7 @@
dd { dd {
padding-left: 0; padding-left: 0;
margin-left: 9px; margin-left: 12px;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
@ -64,13 +72,28 @@
font-size: 80%; font-size: 80%;
color: <!-- $secondary-font-color -->; color: <!-- $secondary-font-color -->;
} }
img { .no-buddy-icon {
margin-right: 12px; margin-right: 12px;
width: 36px;
height: 36px;
background-image: url('<!-- $no-buddy-icon-background-image -->');
background-repeat: no-repeat;
background-position: center;
}
.buddy-icon {
width: 36px; width: 36px;
height: 36px; height: 36px;
background-color: <!-- $small-color -->; }
}
.event-entry-content {
background-color: #fff;
margin: 12px;
padding: 12px;
-webkit-border-radius: 6px;
border: <!-- $small-color --> 1px solid;
}
</style> </style>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 79 KiB