[log] Add timestamps
This commit is contained in:
parent
06d41a13a7
commit
f25c0c1e8e
|
@ -20,23 +20,23 @@ using SparkleLib;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Timers;
|
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleLog : Window {
|
public class SparkleLog : Window {
|
||||||
|
|
||||||
|
private SparkleRepo SparkleRepo;
|
||||||
|
private VBox LayoutVertical;
|
||||||
|
private ScrolledWindow ScrolledWindow;
|
||||||
|
|
||||||
|
|
||||||
// Short alias for the translations
|
// Short alias for the translations
|
||||||
public static string _ (string s)
|
public static string _ (string s)
|
||||||
{
|
{
|
||||||
return Catalog.GetString (s);
|
return Catalog.GetString (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SparkleRepo SparkleRepo;
|
|
||||||
private VBox LayoutVertical;
|
|
||||||
private ScrolledWindow ScrolledWindow;
|
|
||||||
|
|
||||||
public SparkleLog (SparkleRepo sparkle_repo) : base ("")
|
public SparkleLog (SparkleRepo sparkle_repo) : base ("")
|
||||||
{
|
{
|
||||||
|
@ -60,17 +60,22 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
Button open_folder_button = new Button (_("Open Folder"));
|
Button open_folder_button = new Button (_("Open Folder"));
|
||||||
|
|
||||||
open_folder_button.Clicked += delegate (object o, EventArgs args) {
|
open_folder_button.Clicked += delegate (object o, EventArgs args) {
|
||||||
|
|
||||||
|
string path = SparkleHelpers.CombineMore (SparklePaths.SparklePath, SparkleRepo.Name);
|
||||||
|
|
||||||
Process process = new Process ();
|
Process process = new Process ();
|
||||||
process.StartInfo.FileName = "xdg-open";
|
process.StartInfo.FileName = "xdg-open";
|
||||||
string path = SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
process.StartInfo.Arguments = path.Replace(" ", "\\ "); // Escape space-characters
|
||||||
SparkleRepo.Name);
|
|
||||||
process.StartInfo.Arguments = path.Replace(" ", "\\ ");
|
|
||||||
process.Start ();
|
process.Start ();
|
||||||
|
|
||||||
Destroy ();
|
Destroy ();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Button close_button = new Button (Stock.Close);
|
Button close_button = new Button (Stock.Close);
|
||||||
|
|
||||||
close_button.Clicked += delegate (object o, EventArgs args) {
|
close_button.Clicked += delegate (object o, EventArgs args) {
|
||||||
Destroy ();
|
Destroy ();
|
||||||
};
|
};
|
||||||
|
@ -102,8 +107,10 @@ namespace SparkleShare {
|
||||||
|
|
||||||
int number_of_events = 50;
|
int number_of_events = 50;
|
||||||
|
|
||||||
Process process = new Process ();
|
Process process = new Process () {
|
||||||
process.EnableRaisingEvents = true;
|
EnableRaisingEvents = true
|
||||||
|
};
|
||||||
|
|
||||||
process.StartInfo.RedirectStandardOutput = true;
|
process.StartInfo.RedirectStandardOutput = true;
|
||||||
process.StartInfo.UseShellExecute = false;
|
process.StartInfo.UseShellExecute = false;
|
||||||
process.StartInfo.WorkingDirectory = SparkleRepo.LocalPath;
|
process.StartInfo.WorkingDirectory = SparkleRepo.LocalPath;
|
||||||
|
@ -140,7 +147,6 @@ namespace SparkleShare {
|
||||||
|
|
||||||
DateTime date_time = UnixTimestampToDateTime (unix_timestamp);
|
DateTime date_time = UnixTimestampToDateTime (unix_timestamp);
|
||||||
|
|
||||||
message = message.Replace ("/", " ‣ ");
|
|
||||||
message = message.Replace ("\n", " ");
|
message = message.Replace ("\n", " ");
|
||||||
|
|
||||||
ChangeSet change_set = new ChangeSet (user_name, user_email, message, date_time);
|
ChangeSet change_set = new ChangeSet (user_name, user_email, message, date_time);
|
||||||
|
@ -180,12 +186,21 @@ namespace SparkleShare {
|
||||||
typeof (string),
|
typeof (string),
|
||||||
typeof (string));
|
typeof (string));
|
||||||
|
|
||||||
|
Gdk.Color color = Style.Foreground (StateType.Insensitive);
|
||||||
|
string secondary_text_color = GdkColorToHex (color);
|
||||||
|
|
||||||
foreach (ChangeSet change_set in activity_day) {
|
foreach (ChangeSet change_set in activity_day) {
|
||||||
|
|
||||||
iter = list_store.Append ();
|
iter = list_store.Append ();
|
||||||
|
|
||||||
list_store.SetValue (iter, 0, SparkleHelpers.GetAvatar (change_set.UserEmail , 32));
|
list_store.SetValue (iter, 0, SparkleHelpers.GetAvatar (change_set.UserEmail , 32));
|
||||||
|
|
||||||
list_store.SetValue (iter, 1, "<b>" + change_set.UserName + "</b>\n" +
|
list_store.SetValue (iter, 1, "<b>" + change_set.UserName + "</b>\n" +
|
||||||
"<span fgcolor='#777'>" + change_set.Message + "</span>");
|
"<span fgcolor='" + secondary_text_color +"'>" +
|
||||||
|
change_set.Message + "\n" +
|
||||||
|
"<small>" + change_set.DateTime.ToString ("HH:mm") + "</small>" +
|
||||||
|
"</span>");
|
||||||
|
|
||||||
list_store.SetValue (iter, 2, change_set.UserEmail);
|
list_store.SetValue (iter, 2, change_set.UserEmail);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -253,6 +268,18 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Converts a Gdk RGB color to a hex value.
|
||||||
|
// Example: from "rgb:0,0,0" to "#000000"
|
||||||
|
public string GdkColorToHex (Gdk.Color color)
|
||||||
|
{
|
||||||
|
|
||||||
|
return String.Format ("#{0:X2}{1:X2}{2:X2}",
|
||||||
|
(int) Math.Truncate (color.Red / 256.00),
|
||||||
|
(int) Math.Truncate (color.Green / 256.00),
|
||||||
|
(int) Math.Truncate (color.Blue / 256.00));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,6 @@ namespace SparkleShare {
|
||||||
|
|
||||||
SparkleIntro intro = new SparkleIntro ();
|
SparkleIntro intro = new SparkleIntro ();
|
||||||
intro.ShowServerForm (true);
|
intro.ShowServerForm (true);
|
||||||
intro.ShowAll ();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue