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 // Makes it possible to combine more than
// two paths at once. // two paths at once.
public static string CombineMore (params string [] Parts) { public static string CombineMore (params string [] Parts) {
string NewPath = ""; string NewPath = " ";
foreach (string Part in Parts) foreach (string Part in Parts)
NewPath = Path.Combine (NewPath, Part); NewPath = Path.Combine (NewPath, Part);
return NewPath; return NewPath;

View file

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

View file

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