update coding style
This commit is contained in:
parent
973d0346e1
commit
3d009eba98
|
@ -25,10 +25,12 @@ using System.Timers;
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
public class SparkleWindow : Window {
|
public class SparkleWindow : Window
|
||||||
|
{
|
||||||
|
|
||||||
// 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,16 +39,16 @@ namespace SparkleShare {
|
||||||
private ScrolledWindow LogScrolledWindow;
|
private ScrolledWindow LogScrolledWindow;
|
||||||
private string SelectedEmail;
|
private string SelectedEmail;
|
||||||
|
|
||||||
public SparkleWindow (SparkleRepo Repo) : base ("") {
|
public SparkleWindow (SparkleRepo Repo) : base ("")
|
||||||
|
{
|
||||||
|
|
||||||
SparkleRepo = Repo;
|
SparkleRepo = Repo;
|
||||||
SelectedEmail = "";
|
SelectedEmail = "";
|
||||||
|
|
||||||
SetSizeRequest (640, 480);
|
SetSizeRequest (640, 480);
|
||||||
SetPosition (WindowPosition.Center);
|
SetPosition (WindowPosition.Center);
|
||||||
BorderWidth = 12;
|
BorderWidth = 12;
|
||||||
Title = String.Format(_("‘{0}’ on {1}"), SparkleRepo.Name, SparkleRepo.RemoteOriginUrl
|
Title = String.Format(_("‘{0}’ on {1}"), SparkleRepo.Name,
|
||||||
.TrimEnd (("/" + SparkleRepo.Name + ".git").ToCharArray ()));
|
SparkleRepo.RemoteOriginUrl.TrimEnd (("/" + SparkleRepo.Name + ".git").ToCharArray ()));
|
||||||
IconName = "folder";
|
IconName = "folder";
|
||||||
|
|
||||||
LayoutVertical = new VBox (false, 12);
|
LayoutVertical = new VBox (false, 12);
|
||||||
|
@ -62,8 +64,7 @@ namespace SparkleShare {
|
||||||
Process Process = new Process ();
|
Process Process = new Process ();
|
||||||
Process.StartInfo.FileName = "xdg-open";
|
Process.StartInfo.FileName = "xdg-open";
|
||||||
Process.StartInfo.Arguments =
|
Process.StartInfo.Arguments =
|
||||||
SparkleHelpers.CombineMore (SparklePaths.SparklePath,
|
SparkleHelpers.CombineMore (SparklePaths.SparklePath, SparkleRepo.Name);
|
||||||
SparkleRepo.Name);
|
|
||||||
Process.Start ();
|
Process.Start ();
|
||||||
Destroy ();
|
Destroy ();
|
||||||
};
|
};
|
||||||
|
@ -83,7 +84,8 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void UpdateEventLog () {
|
public void UpdateEventLog ()
|
||||||
|
{
|
||||||
|
|
||||||
LayoutVertical.Remove (LogScrolledWindow);
|
LayoutVertical.Remove (LogScrolledWindow);
|
||||||
LogScrolledWindow = CreateEventLog ();
|
LogScrolledWindow = CreateEventLog ();
|
||||||
|
@ -93,12 +95,13 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ScrolledWindow CreateEventLog () {
|
public ScrolledWindow CreateEventLog ()
|
||||||
|
{
|
||||||
|
|
||||||
ListStore LogStore = new ListStore (typeof (Gdk.Pixbuf),
|
ListStore LogStore = new ListStore (typeof (Gdk.Pixbuf),
|
||||||
typeof (string),
|
typeof (string),
|
||||||
typeof (string),
|
typeof (string),
|
||||||
typeof (string));
|
typeof (string));
|
||||||
|
|
||||||
Process Process = new Process ();
|
Process Process = new Process ();
|
||||||
Process.EnableRaisingEvents = true;
|
Process.EnableRaisingEvents = true;
|
||||||
|
@ -110,8 +113,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
Process.StartInfo.WorkingDirectory = SparkleRepo.LocalPath;
|
Process.StartInfo.WorkingDirectory = SparkleRepo.LocalPath;
|
||||||
// We're using the snowman here to separate messages :)
|
// We're using the snowman here to separate messages :)
|
||||||
Process.StartInfo.Arguments =
|
Process.StartInfo.Arguments = "log --format=\"%at☃%s☃%an☃%cr☃%ae\" -25";
|
||||||
"log --format=\"%at☃%s☃%an☃%cr☃%ae\" -25";
|
|
||||||
Process.Start ();
|
Process.Start ();
|
||||||
|
|
||||||
Output += "\n" + Process.StandardOutput.ReadToEnd ().Trim ();
|
Output += "\n" + Process.StandardOutput.ReadToEnd ().Trim ();
|
||||||
|
@ -138,20 +140,15 @@ namespace SparkleShare {
|
||||||
|
|
||||||
Iter = LogStore.Append ();
|
Iter = LogStore.Append ();
|
||||||
|
|
||||||
LogStore.SetValue (Iter, 0,
|
LogStore.SetValue (Iter, 0, SparkleHelpers.GetAvatar (UserEmail, 32));
|
||||||
SparkleHelpers.GetAvatar (UserEmail, 32));
|
|
||||||
|
|
||||||
if (SparkleRepo.UserEmail.Equals (UserEmail)) {
|
if (SparkleRepo.UserEmail.Equals (UserEmail)) {
|
||||||
|
|
||||||
LogStore.SetValue (Iter, 1,
|
LogStore.SetValue (Iter, 1, "<b>You</b>\n" + Message.Replace ("/", " → "));
|
||||||
"<b>You</b>\n" +
|
|
||||||
Message.Replace ("/", " → "));
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
LogStore.SetValue (Iter, 1,
|
LogStore.SetValue (Iter, 1, "<b>" + UserName + "</b>\n" + Message.Replace ("/", " → "));
|
||||||
"<b>" + UserName + "</b>\n" +
|
|
||||||
Message.Replace ("/", " → "));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LogStore.SetValue (Iter, 2, TimeAgo + " ");
|
LogStore.SetValue (Iter, 2, TimeAgo + " ");
|
||||||
|
@ -177,8 +174,7 @@ namespace SparkleShare {
|
||||||
ColumnMarkup.PackStart (CellRendererMarkup, true);
|
ColumnMarkup.PackStart (CellRendererMarkup, true);
|
||||||
LogView.AppendColumn (ColumnMarkup);
|
LogView.AppendColumn (ColumnMarkup);
|
||||||
|
|
||||||
ColumnMarkup.SetCellDataFunc (CellRendererMarkup,
|
ColumnMarkup.SetCellDataFunc (CellRendererMarkup, new Gtk.TreeCellDataFunc (RenderRow));
|
||||||
new Gtk.TreeCellDataFunc (RenderRow));
|
|
||||||
|
|
||||||
LogView.AppendColumn (ColumnMarkup);
|
LogView.AppendColumn (ColumnMarkup);
|
||||||
LogView.AppendColumn ("", TextCellRight, "text", 2);
|
LogView.AppendColumn ("", TextCellRight, "text", 2);
|
||||||
|
@ -221,15 +217,14 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Renders a row with custom markup
|
// Renders a row with custom markup
|
||||||
private void RenderRow (TreeViewColumn Column, CellRenderer Cell,
|
private void RenderRow (TreeViewColumn Column, CellRenderer Cell, TreeModel Model, TreeIter Iter)
|
||||||
TreeModel Model, TreeIter Iter) {
|
{
|
||||||
|
|
||||||
string Item = (string) Model.GetValue (Iter, 1);
|
string Item = (string) Model.GetValue (Iter, 1);
|
||||||
(Cell as CellRendererText).Markup = Item;
|
(Cell as CellRendererText).Markup = Item;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue