From 9f4af94f47a7728e025c30bb34a9ef1d95344a16 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 30 Apr 2010 00:34:54 +0100 Subject: [PATCH] event log icons and messages --- src/SparklePony.cs | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/SparklePony.cs b/src/SparklePony.cs index 71dd36e2..9689da67 100644 --- a/src/SparklePony.cs +++ b/src/SparklePony.cs @@ -569,7 +569,11 @@ public class SparklePonyWindow : Window { ReposView.AppendColumn ("", new Gtk.CellRendererText (), "text", 1); TreeViewColumn [] ReposViewColumns = ReposView.Columns; ReposViewColumns [0].MinWidth = 34; - ReposViewColumns [1].Spacing = 34; + + ReposStore.IterNthChild (out ReposIter, 1); + + ReposView.ActivateRow (ReposStore.GetPath (ReposIter), ReposViewColumns [1]); + HBox AddRemoveButtons = new HBox (); Button AddButton = new Button ("Add..."); @@ -639,19 +643,28 @@ public class SparklePonyWindow : Window { Process.StartInfo.FileName = "git"; Process.StartInfo.Arguments = "log --pretty=oneline -20"; + Process.StartInfo.WorkingDirectory = Repositories [0].RepoPath; Process.Start(); string Output = Process.StandardOutput.ReadToEnd().Trim (); - Gdk.Pixbuf Icon = new Gdk.Pixbuf ("/usr/share/icons/hicolor/16x16/status/document-edited.png"); - Gdk.Pixbuf Icon2 = new Gdk.Pixbuf ("/usr/share/icons/hicolor/16x16/status/document-added.png"); - Gdk.Pixbuf Icon3 = new Gdk.Pixbuf ("/usr/share/icons/hicolor/16x16/status/document-removed.png"); - Gdk.Pixbuf Icon4 = new Gdk.Pixbuf ("/usr/share/icons/hicolor/16x16/status/document-moved.png"); TreeIter Iter; - foreach (string Message in Regex.Split (Output, "\n")) { - Iter = LogStore.Prepend (); - LogStore.SetValue (Iter, 0, Icon); - LogStore.SetValue (Iter, 1, "In 'GNOME3', Hylke Bons edited 'mockup.svg'"); + string Message, IconFile; + foreach (string Line in Regex.Split (Output, "\n")) { + Iter = LogStore.Append (); + + Message = Line.Substring (41); + IconFile = "/usr/share/icons/hicolor/16x16/status/document-edited.png"; + if (Message.IndexOf (" added ") > -1) + IconFile = "/usr/share/icons/hicolor/16x16/status/document-added.png"; + if (Message.IndexOf (" deleted ") > -1) + IconFile = "/usr/share/icons/hicolor/16x16/status/document-removed.png"; + if (Message.IndexOf (" moved ") > -1 || Message.IndexOf (" renamed ") > -1) + IconFile = "/usr/share/icons/hicolor/16x16/status/document-moved.png"; + + + LogStore.SetValue (Iter, 0, new Gdk.Pixbuf (IconFile)); + LogStore.SetValue (Iter, 1, Message); LogStore.SetValue (Iter, 2, "32 minutes ago "); }