allow filtering of event log by clicking authors

This commit is contained in:
Hylke Bons 2010-05-18 20:44:15 +01:00
parent 45f9610ba3
commit 1c59f5ea4d
3 changed files with 90 additions and 59 deletions

View file

@ -81,7 +81,7 @@ namespace SparkleShare {
// Makes it possible to combine more than
// two paths at once.
public static string CombineMore (params string [] Parts) {
string NewPath = "";
string NewPath = " ";
foreach (string Part in Parts)
NewPath = Path.Combine (NewPath, Part);
return NewPath;

View file

@ -33,6 +33,8 @@ namespace SparkleShare {
}
private SparkleRepo SparkleRepo;
private HBox LayoutHorizontal;
private ScrolledWindow LogScrolledWindow;
public SparkleWindow (SparkleRepo Repo) : base ("") {
@ -51,11 +53,11 @@ namespace SparkleShare {
VBox LayoutVertical = new VBox (false, 0);
HBox HBox = new HBox (true, 6);
HBox.PackStart (CreatePeopleList ());
HBox.PackStart (CreateEventLog ());
LayoutHorizontal = new HBox (true, 6);
LayoutHorizontal.PackStart (CreatePeopleList ());
LayoutHorizontal.PackStart (CreateEventLog (""));
LayoutVertical.PackStart (HBox, true, true, 6);
LayoutVertical.PackStart (LayoutHorizontal, true, true, 6);
HButtonBox DialogButtons = new HButtonBox ();
DialogButtons.Layout = ButtonBoxStyle.Edge;
@ -104,7 +106,14 @@ namespace SparkleShare {
}
public ScrolledWindow CreateEventLog() {
public void UpdateEventLog (string UserEmail) {
LayoutHorizontal.Remove (LogScrolledWindow);
LogScrolledWindow = CreateEventLog (UserEmail);
LayoutHorizontal.Add (LogScrolledWindow);
ShowAll ();
}
public ScrolledWindow CreateEventLog(string UserEmail) {
ListStore LogStore = new ListStore (typeof (Gdk.Pixbuf),
typeof (string),
@ -117,16 +126,14 @@ namespace SparkleShare {
Process.StartInfo.FileName = "git";
string Output = "";
foreach (SparkleRepo SparkleRepo in SparkleShare.Repositories) {
// We're using the snowman here to separate messages :)
Process.StartInfo.Arguments =
"log --format=\"%at☃%an %s☃%cr\" -25";
Process.StartInfo.WorkingDirectory = SparkleRepo.LocalPath;
// We're using the snowman here to separate messages :)
Process.StartInfo.Arguments =
"log --format=\"%at☃%an %s☃%cr☃%ae\" -25";
Process.Start();
Process.StartInfo.WorkingDirectory = SparkleRepo.LocalPath;
Process.Start();
Output += "\n" + Process.StandardOutput.ReadToEnd().Trim ();
}
Output += "\n" + Process.StandardOutput.ReadToEnd().Trim ();
Output = Output.TrimStart ("\n".ToCharArray ());
string [] Lines = Regex.Split (Output, "\n");
@ -140,28 +147,32 @@ namespace SparkleShare {
TreeIter Iter;
foreach (string Line in LastTwentyFive) {
// Look for the snowman!
string [] Parts = Regex.Split (Line, "☃");
string Message = Parts [1];
string TimeAgo = Parts [2];
if (Line.Contains (UserEmail)) {
Console.WriteLine ("!!!");
// Look for the snowman!
string [] Parts = Regex.Split (Line, "☃");
string Message = Parts [1];
string TimeAgo = Parts [2];
string IconFile = "document-edited";
string IconFile = "document-edited";
if (Message.IndexOf (" added ") > -1)
IconFile = "document-added";
if (Message.IndexOf (" added ") > -1)
IconFile = "document-added";
if (Message.IndexOf (" deleted ") > -1)
IconFile = "document-removed";
if (Message.IndexOf (" deleted ") > -1)
IconFile = "document-removed";
if (Message.IndexOf (" moved ") > -1 ||
Message.IndexOf (" renamed ") > -1)
IconFile = "document-moved";
if (Message.IndexOf (" moved ") > -1 ||
Message.IndexOf (" renamed ") > -1)
IconFile = "document-moved";
Gdk.Pixbuf ChangeIcon = SparkleHelpers.GetIcon (IconFile, 16);
Iter = LogStore.Append ();
LogStore.SetValue (Iter, 0, ChangeIcon);
LogStore.SetValue (Iter, 1, Message);
LogStore.SetValue (Iter, 2, " " + TimeAgo);
Gdk.Pixbuf ChangeIcon = SparkleHelpers.GetIcon (IconFile, 16);
Iter = LogStore.Append ();
LogStore.SetValue (Iter, 0, ChangeIcon);
LogStore.SetValue (Iter, 1, Message);
LogStore.SetValue (Iter, 2, " " + TimeAgo);
}
}
@ -184,10 +195,10 @@ namespace SparkleShare {
Columns [1].Expand = true;
Columns [1].MaxWidth = 150;
ScrolledWindow ScrolledWindow = new ScrolledWindow ();
ScrolledWindow.AddWithViewport (LogView);
LogScrolledWindow = new ScrolledWindow ();
LogScrolledWindow.AddWithViewport (LogView);
return ScrolledWindow;
return LogScrolledWindow;
}
@ -210,7 +221,8 @@ namespace SparkleShare {
string [] Lines = Regex.Split (Output, "\n");
ListStore PeopleStore = new ListStore (typeof (Gdk.Pixbuf),
typeof (string));
typeof (string),
typeof (string));
int i = 0;
TreeIter PeopleIter;
@ -237,6 +249,7 @@ namespace SparkleShare {
"<b>" + UserName + "</b>\n" +
"<span font_size=\"smaller\">" +
UserEmail + "</span>");
PeopleStore.SetValue (PeopleIter, 2, UserEmail);
}
@ -251,6 +264,16 @@ namespace SparkleShare {
PeopleView.Spacing = 6;
PeopleView.ItemWidth = 200;
PeopleView.Orientation = Orientation.Horizontal;
PeopleView.SelectionMode = SelectionMode.Single;
PeopleView.SelectionChanged += delegate (object o, EventArgs args) {
if (PeopleView.SelectedItems.Length > 0) {
TreeIter Iter;
PeopleStore.GetIter (out Iter, PeopleView.SelectedItems [0]);
UpdateEventLog ((string) PeopleStore.GetValue (Iter, 2));
} else UpdateEventLog ("");
};
ScrolledWindow ScrolledWindow = new ScrolledWindow ();
ScrolledWindow.AddWithViewport (PeopleView);

View file

@ -4,7 +4,6 @@
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#: SparkleShare/SparkleDialog.cs:39 SparkleShare/SparkleHelpers.cs:78
#: SparkleShare/SparkleHelpers.cs:84
#: SparkleShare/SparklePreferencesDialog.cs:36 SparkleShare/SparkleRepo.cs:202
#: SparkleShare/SparkleRepo.cs:332 SparkleShare/SparkleRepo.cs:336
#: SparkleShare/SparkleRepo.cs:345 SparkleShare/SparkleRepo.cs:349
@ -20,7 +19,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-05-18 19:36+0100\n"
"POT-Creation-Date: 2010-05-18 19:46+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -42,8 +41,12 @@ msgstr ""
msgid "Folder Name: "
msgstr ""
#: SparkleShare/SparkleDialog.cs:52
msgid "<span size='small'><i>Example: Project.</i></span>"
#: SparkleShare/SparkleDialog.cs:52 SparkleShare/SparkleDialog.cs:67
msgid "<span size='small'><i>Example: "
msgstr ""
#: SparkleShare/SparkleDialog.cs:53
msgid "Project.</i></span>"
msgstr ""
#: SparkleShare/SparkleDialog.cs:58
@ -66,14 +69,16 @@ msgstr ""
msgid "ssh://git@gitorious.org"
msgstr ""
#: SparkleShare/SparkleDialog.cs:67
msgid "<span size='small'><i>Example: ssh://git@github.com.</i></span>"
#: SparkleShare/SparkleDialog.cs:68
msgid "ssh://git@github.com.</i></span>"
msgstr ""
#: SparkleShare/SparkleDialog.cs:118
msgid ""
"Downloading files,\n"
"this may take a while..."
msgid "Downloading files,\n"
msgstr ""
#: SparkleShare/SparkleDialog.cs:119
msgid "this may take a while..."
msgstr ""
#: SparkleShare/SparkleDialog.cs:132 SparkleShare/SparkleRepo.cs:70
@ -141,6 +146,13 @@ msgstr ""
msgid "-"
msgstr ""
#: SparkleShare/SparkleHelpers.cs:84 SparkleShare/SparkleRepo.cs:262
#: SparkleShare/SparkleShare.cs:86 SparkleShare/SparkleShare.cs:90
#: SparkleShare/SparkleShare.cs:92 SparkleShare/SparkleShare.cs:95
#: SparkleShare/SparkleShare.cs:99 SparkleShare/SparkleWindow.cs:164
msgid " "
msgstr ""
#: SparkleShare/SparkleHelpers.cs:100
msgid "[a-z]+://(.)+"
msgstr ""
@ -199,19 +211,26 @@ msgid "Preferences"
msgstr ""
#: SparkleShare/SparklePreferencesDialog.cs:48
msgid "The folder <b>"
msgid "The folder "
msgstr ""
#: SparkleShare/SparklePreferencesDialog.cs:49
msgid ""
"</b>\n"
"is linked to <b>"
#: SparkleShare/SparklePreferencesDialog.cs:51
#: SparkleShare/SparkleWindow.cs:237
msgid "<b>"
msgstr ""
#: SparkleShare/SparklePreferencesDialog.cs:49
#: SparkleShare/SparklePreferencesDialog.cs:51
msgid "</b>"
msgstr ""
#: SparkleShare/SparklePreferencesDialog.cs:50
msgid ""
"\n"
"is linked to "
msgstr ""
#: SparkleShare/SparklePreferencesDialog.cs:57
msgid "Notify me when something changes"
msgstr ""
@ -382,13 +401,6 @@ msgstr ""
msgid "log --format=\"%an\" -1"
msgstr ""
#: SparkleShare/SparkleRepo.cs:262 SparkleShare/SparkleShare.cs:86
#: SparkleShare/SparkleShare.cs:90 SparkleShare/SparkleShare.cs:92
#: SparkleShare/SparkleShare.cs:95 SparkleShare/SparkleShare.cs:99
#: SparkleShare/SparkleWindow.cs:164
msgid " "
msgstr ""
#: SparkleShare/SparkleRepo.cs:269
msgid "] Nothing going on... "
msgstr ""
@ -747,10 +759,6 @@ msgstr ""
msgid " (thats you!)"
msgstr ""
#: SparkleShare/SparkleWindow.cs:237
msgid "<b>"
msgstr ""
#: SparkleShare/SparkleWindow.cs:237
msgid ""
"</b>\n"