diff --git a/SparkleShare/SparkleLink.cs b/SparkleShare/SparkleLink.cs
index ec622f9b..60f873d1 100644
--- a/SparkleShare/SparkleLink.cs
+++ b/SparkleShare/SparkleLink.cs
@@ -19,29 +19,31 @@ using System.IO;
using System.Diagnostics;
namespace SparkleShare {
-
- public class SparkleLink : EventBox {
- private Label Label;
+ // A clickable link that corresponds to a local file
+ public class SparkleLink : EventBox {
public SparkleLink (string title, string url) : base ()
{
- Label = new Label (title) {
+ Label label = new Label (title) {
Ellipsize = Pango.EllipsizeMode.Middle,
UseMarkup = true,
Xalign = 0
};
- Add (Label);
+ Add (label);
+ // Only make links for files that exist
if (!File.Exists (url))
return;
+ // Use Tango blue for the links
Gdk.Color color = new Gdk.Color ();
Gdk.Color.Parse ("#3465a4", ref color);
- Label.ModifyFg (StateType.Normal, color);
+ label.ModifyFg (StateType.Normal, color);
+ // Open the URL when it is clicked
ButtonPressEvent += delegate {
Process process = new Process ();
@@ -51,16 +53,18 @@ namespace SparkleShare {
};
+ // Add underline when hovering the link with the cursor
EnterNotifyEvent += delegate {
- Label.Markup = "" + title + "";
+ label.Markup = "" + title + "";
ShowAll ();
};
+ // Remove underline when leaving the link with the cursor
LeaveNotifyEvent += delegate {
- Label.Markup = title;
+ label.Markup = title;
ShowAll ();
};
diff --git a/SparkleShare/SparkleLog.cs b/SparkleShare/SparkleLog.cs
index 9feddf72..bcdb94f1 100644
--- a/SparkleShare/SparkleLog.cs
+++ b/SparkleShare/SparkleLog.cs
@@ -208,21 +208,13 @@ namespace SparkleShare {
}
-
-
-
VBox layout_vertical = new VBox (false, 0);
+ TreeView tree_view = new TreeView ();
+ Gdk.Color background_color = tree_view.Style.Base (StateType.Normal);
-
-
-
- TreeView tree_view = new TreeView ();
foreach (ActivityDay activity_day in activity_days) {
-
-
-
Label date_label = new Label ("") {
UseMarkup = true,
Xpad = 9,
@@ -252,71 +244,122 @@ namespace SparkleShare {
layout_vertical.PackStart (date_label, true, true, 0);
-
-
Gdk.Color color = Style.Foreground (StateType.Insensitive);
string secondary_text_color = GdkColorToHex (color);
foreach (ChangeSet change_set in activity_day) {
-
-
VBox log_entry = new VBox (false, 0);
VBox deleted_files = new VBox (false, 0);
VBox edited_files = new VBox (false, 0);
VBox added_files = new VBox (false, 0);
+ foreach (string file_path in change_set.Edited) {
+
+ SparkleLink link = new SparkleLink (file_path,
+ SparkleHelpers.CombineMore (LocalPath, file_path));
+
+ link.ModifyBg (StateType.Normal, background_color);
+
+ link.ButtonPressEvent += delegate {
+ Destroy ();
+ };
- foreach (string file_path in change_set.Edited){
- SparkleLink link = new SparkleLink (file_path, SparkleHelpers.CombineMore (LocalPath, file_path));
edited_files.PackStart (link, false, false, 0);
-
- link.ModifyBg (StateType.Normal, tree_view.Style.Base (StateType.Normal));
-
- }
-// TODO: add close delegate
- foreach (string file_path in change_set.Added)
- added_files.PackStart (new SparkleLink (file_path, SparkleHelpers.CombineMore (LocalPath, file_path)), false, false, 0);
- foreach (string file_path in change_set.Deleted)
- deleted_files.PackStart (new SparkleLink (file_path, SparkleHelpers.CombineMore (LocalPath, file_path)), false, false, 0);
+ }
- log_entry.PackStart(new Label ("" + change_set.UserName + "\n" +
- "" +
- "at " + change_set.DateTime.ToString ("HH:mm") +
- "") { UseMarkup = true, Xalign = 0});
+ foreach (string file_path in change_set.Added) {
+
+ SparkleLink link = new SparkleLink (file_path,
+ SparkleHelpers.CombineMore (LocalPath, file_path));
+
+ link.ModifyBg (StateType.Normal, background_color);
+
+ link.ButtonPressEvent += delegate {
+ Destroy ();
+ };
+
+ added_files.PackStart (link, false, false, 0);
+
+ }
+
+
+ foreach (string file_path in change_set.Deleted) {
+
+ SparkleLink link = new SparkleLink (file_path,
+ SparkleHelpers.CombineMore (LocalPath, file_path));
+
+ link.ModifyBg (StateType.Normal, background_color);
+
+ link.ButtonPressEvent += delegate {
+ Destroy ();
+ };
+
+ deleted_files.PackStart (link, false, false, 0);
+
+ }
+
+
+ log_entry.PackStart (new Label ("" + change_set.UserName + "\n" +
+ "" +
+ "at " + change_set.DateTime.ToString ("HH:mm") +
+ "") { UseMarkup = true, Xalign = 0 });
if (edited_files.Children.Length > 0) {
- log_entry.PackStart (new Label ("\nEdited") { UseMarkup=true, Xalign = 0}, false, false, 0);
+ Label edited_label = new Label ("\n" +
+ "Edited" +
+ "") {
+ UseMarkup=true,
+ Xalign = 0
+ };
+
+ log_entry.PackStart (edited_label, false, false, 0);
log_entry.PackStart (edited_files, false, false, 0);
}
if (added_files.Children.Length > 0) {
- log_entry.PackStart (new Label ("\nAdded") { UseMarkup=true, Xalign = 0}, false, false, 0);
+ Label added_label = new Label ("\n" +
+ "Added" +
+ "") {
+ UseMarkup=true,
+ Xalign = 0
+ };
+
+ log_entry.PackStart (added_label, false, false, 0);
log_entry.PackStart (added_files, false, false, 0);
+
}
if (deleted_files.Children.Length > 0) {
- log_entry.PackStart (new Label ("\nDeleted") { UseMarkup=true, Xalign = 0}, false, false, 0);
- log_entry.PackStart (deleted_files, false, false, 0);
- }
+ Label deleted_label = new Label ("\n" +
+ "Edited" +
+ "") {
+ UseMarkup=true,
+ Xalign = 0
+ };
+ log_entry.PackStart (deleted_label, false, false, 0);
+ log_entry.PackStart (deleted_files, false, false, 0);
+
+ }
HBox hbox = new HBox (false, 0);
- Image i = new Image (SparkleHelpers.GetAvatar (change_set.UserEmail, 32)) {
+ Image avatar = new Image (SparkleHelpers.GetAvatar (change_set.UserEmail, 32)) {
Yalign = 0
};
- hbox.PackStart (i, false, false, 18);
- VBox vbox = new VBox (false, 0);
+ hbox.PackStart (avatar, false, false, 18);
+
+ VBox vbox = new VBox (false, 0);
+ vbox.PackStart (log_entry, true, true, 0);
- vbox.PackStart (log_entry, true, true, 0);
hbox.PackStart (vbox, true, true, 0);
hbox.PackStart (new Label (""), false, false, 12);
@@ -324,19 +367,15 @@ namespace SparkleShare {
}
-
-
-
-// layout_vertical.PackStart (icon_view, false, false, 0);
-
-
}
ScrolledWindow = new ScrolledWindow ();
ScrolledWindow.ShadowType = ShadowType.None;
- EventBox wrapper = new EventBox ();
- wrapper.ModifyBg (StateType.Normal, tree_view.Style.Base (StateType.Normal));
-wrapper.Add (layout_vertical);
+
+ EventBox wrapper = new EventBox ();
+ wrapper.ModifyBg (StateType.Normal, background_color);
+ wrapper.Add (layout_vertical);
+
ScrolledWindow.AddWithViewport (wrapper);
return ScrolledWindow;