diff --git a/SparkleLib/SparklePaths.cs b/SparkleLib/SparklePaths.cs
index 9d15ccea..03b2e91d 100644
--- a/SparkleLib/SparklePaths.cs
+++ b/SparkleLib/SparklePaths.cs
@@ -32,6 +32,8 @@ namespace SparkleLib {
public static string SparkleTmpPath = Path.Combine (SparklePath, ".tmp");
public static string SparkleConfigPath = SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare");
+
+ public static string SparkleKeysPath = SparkleHelpers.CombineMore (HomePath, ".config", "sparkleshare");
public static string SparkleInstallPath = SparkleHelpers.CombineMore (Defines.PREFIX, "sparkleshare");
diff --git a/SparkleLib/SparkleRepo.cs b/SparkleLib/SparkleRepo.cs
index 01b0dec9..14e23803 100644
--- a/SparkleLib/SparkleRepo.cs
+++ b/SparkleLib/SparkleRepo.cs
@@ -658,6 +658,7 @@ namespace SparkleLib {
}
+ // TODO: this is ugly. refactor.
// Creates a pretty commit message based on what has changed
private string FormatCommitMessage ()
{
@@ -673,9 +674,9 @@ namespace SparkleLib {
Process.StartInfo.Arguments = "status";
Process.Start ();
- string Output = Process.StandardOutput.ReadToEnd ();
+ string output = Process.StandardOutput.ReadToEnd ();
- foreach (string line in Regex.Split (Output, "\n")) {
+ foreach (string line in Regex.Split (output, "\n")) {
if (line.IndexOf ("new file:") > -1)
FilesAdded++;
if (line.IndexOf ("modified:") > -1)
@@ -686,7 +687,7 @@ namespace SparkleLib {
FilesDeleted++;
}
- foreach (string line in Regex.Split (Output, "\n")) {
+ foreach (string line in Regex.Split (output, "\n")) {
// Format message for when files are added,
// example: "added 'file' and 3 more."
diff --git a/SparkleShare/Makefile.am b/SparkleShare/Makefile.am
index 72c35657..0d4e89c6 100644
--- a/SparkleShare/Makefile.am
+++ b/SparkleShare/Makefile.am
@@ -12,6 +12,7 @@ SOURCES = \
SparkleEntry.cs \
SparkleIntro.cs \
SparkleInvitation.cs \
+ SparkleLink.cs \
SparkleLog.cs \
SparkleShare.cs \
SparkleSpinner.cs \
diff --git a/SparkleShare/SparkleBubble.cs b/SparkleShare/SparkleBubble.cs
index db577b54..4eb0909b 100644
--- a/SparkleShare/SparkleBubble.cs
+++ b/SparkleShare/SparkleBubble.cs
@@ -12,7 +12,7 @@
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
-// along with this program. If not, see .
+// along with this program. If not, see .
using Gtk;
using Notifications;
diff --git a/SparkleShare/SparkleIntro.cs b/SparkleShare/SparkleIntro.cs
index b16ed246..a76697ab 100644
--- a/SparkleShare/SparkleIntro.cs
+++ b/SparkleShare/SparkleIntro.cs
@@ -91,7 +91,7 @@ namespace SparkleShare {
};
- EmailEntry = new Entry (GetUserEmail ());
+ EmailEntry = new Entry (SparkleShare.UserEmail);
EmailEntry.Changed += delegate {
CheckAccountForm ();
};
@@ -734,42 +734,12 @@ namespace SparkleShare {
}
- // Gets the email address if the user alreasy has a SparkleShare key installed
- private string GetUserEmail ()
- {
-
- string user_email = "";
- string keys_path = System.IO.Path.Combine (SparklePaths.HomePath, ".ssh");
-
- if (!Directory.Exists (keys_path))
- return "";
-
- foreach (string file_path in Directory.GetFiles (keys_path)) {
-
- string file_name = System.IO.Path.GetFileName (file_path);
-
- if (file_name.StartsWith ("sparkleshare.") && file_name.EndsWith (".key")) {
-
- user_email = file_name.Substring (file_name.IndexOf (".") + 1);
- user_email = user_email.Substring (0, user_email.LastIndexOf ("."));
-
- return user_email;
-
- }
-
- }
-
- return "";
-
- }
-
-
// Generates and installs an RSA keypair to identify this system
private void GenerateKeyPair ()
{
string user_email = EmailEntry.Text;
- string keys_path = System.IO.Path.Combine (SparklePaths.HomePath, ".ssh");
+ string keys_path = SparklePaths.SparkleKeysPath;
string key_file_name = "sparkleshare." + user_email + ".key";
Process process = new Process () {
diff --git a/SparkleShare/SparkleLink.cs b/SparkleShare/SparkleLink.cs
new file mode 100644
index 00000000..ec622f9b
--- /dev/null
+++ b/SparkleShare/SparkleLink.cs
@@ -0,0 +1,72 @@
+// SparkleShare, an instant update workflow to Git.
+// Copyright (C) 2010 Hylke Bons
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+using Gtk;
+using System.IO;
+using System.Diagnostics;
+
+namespace SparkleShare {
+
+ public class SparkleLink : EventBox {
+
+ private Label Label;
+
+ public SparkleLink (string title, string url) : base ()
+ {
+
+ Label = new Label (title) {
+ Ellipsize = Pango.EllipsizeMode.Middle,
+ UseMarkup = true,
+ Xalign = 0
+ };
+
+ Add (Label);
+
+ if (!File.Exists (url))
+ return;
+
+ Gdk.Color color = new Gdk.Color ();
+ Gdk.Color.Parse ("#3465a4", ref color);
+ Label.ModifyFg (StateType.Normal, color);
+
+ ButtonPressEvent += delegate {
+
+ Process process = new Process ();
+ process.StartInfo.FileName = "xdg-open";
+ process.StartInfo.Arguments = url.Replace (" ", "\\ "); // Escape space-characters
+ process.Start ();
+
+ };
+
+ EnterNotifyEvent += delegate {
+
+ Label.Markup = "" + title + "";
+ ShowAll ();
+
+ };
+
+ LeaveNotifyEvent += delegate {
+
+ Label.Markup = title;
+ ShowAll ();
+
+ };
+
+ }
+
+ }
+
+}
diff --git a/SparkleShare/SparkleLog.cs b/SparkleShare/SparkleLog.cs
index eebc0e75..9feddf72 100644
--- a/SparkleShare/SparkleLog.cs
+++ b/SparkleShare/SparkleLog.cs
@@ -45,6 +45,7 @@ namespace SparkleShare {
string name = System.IO.Path.GetFileName (LocalPath);
SetSizeRequest (540, 640);
+
SetPosition (WindowPosition.Center);
BorderWidth = 12;
@@ -61,7 +62,9 @@ namespace SparkleShare {
BorderWidth = 0
};
- Button open_folder_button = new Button (_("Open Folder"));
+ Button open_folder_button = new Button (_("_Open Folder")) {
+ UseUnderline = true
+ };
open_folder_button.Clicked += delegate (object o, EventArgs args) {
@@ -206,72 +209,22 @@ namespace SparkleShare {
}
+
+
VBox layout_vertical = new VBox (false, 0);
+
+
+
+
+ TreeView tree_view = new TreeView ();
foreach (ActivityDay activity_day in activity_days) {
- TreeIter iter = new TreeIter ();
- ListStore list_store = new ListStore (typeof (Gdk.Pixbuf),
- typeof (string),
- typeof (string));
-
- Gdk.Color color = Style.Foreground (StateType.Insensitive);
- string secondary_text_color = GdkColorToHex (color);
-
- foreach (ChangeSet change_set in activity_day) {
-
- iter = list_store.Append ();
- string edited_files = "";
- foreach (string file_path in change_set.Edited)
- edited_files += "\n" + file_path;
-
- string added_files = "";
- foreach (string file_path in change_set.Added)
- added_files += "\n" + file_path;
-
- string deleted_files = "";
- foreach (string file_path in change_set.Deleted)
- deleted_files += "\n" + file_path;
-
-
- string log_entry = "" + change_set.UserName + "\n" +
- "" +
- "at " + change_set.DateTime.ToString ("HH:mm") +
- "";
-
- if (!edited_files.Equals ("")) {
-
- log_entry += "\n\nEdited" +
- edited_files;
-
- }
-
- if (!added_files.Equals ("")) {
-
- log_entry += "\n\nAdded" +
- added_files;
-
- }
-
- if (!deleted_files.Equals ("")) {
-
- log_entry += "\n\nDeleted" +
- deleted_files;
-
- }
-
-
- list_store.SetValue (iter, 0, SparkleHelpers.GetAvatar (change_set.UserEmail , 32));
- list_store.SetValue (iter, 1, log_entry);
- list_store.SetValue (iter, 2, change_set.UserEmail);
-
- }
Label date_label = new Label ("") {
UseMarkup = true,
- Xalign = 0,
Xpad = 9,
Ypad = 9
};
@@ -297,28 +250,94 @@ namespace SparkleShare {
}
- layout_vertical.PackStart (date_label, false, false, 0);
+ layout_vertical.PackStart (date_label, true, true, 0);
- IconView icon_view = new IconView (list_store) {
- ItemWidth = 470,
- MarkupColumn = 1,
- Orientation = Orientation.Horizontal,
- PixbufColumn = 0,
- Spacing = 9,
- Columns = 1
- };
- icon_view.SelectionChanged += delegate {
- icon_view.UnselectAll ();
- };
- layout_vertical.PackStart (icon_view, false, false, 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));
+ 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});
+
+ if (edited_files.Children.Length > 0) {
+
+ log_entry.PackStart (new Label ("\nEdited") { UseMarkup=true, Xalign = 0}, 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);
+ 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);
+ }
+
+
+ HBox hbox = new HBox (false, 0);
+
+ Image i = new Image (SparkleHelpers.GetAvatar (change_set.UserEmail, 32)) {
+ Yalign = 0
+ };
+
+ hbox.PackStart (i, false, false, 18);
+ VBox vbox = new VBox (false, 0);
+
+ vbox.PackStart (log_entry, true, true, 0);
+ hbox.PackStart (vbox, true, true, 0);
+ hbox.PackStart (new Label (""), false, false, 12);
+
+ layout_vertical.PackStart (hbox, true, true, 24);
+
+ }
+
+
+
+
+// layout_vertical.PackStart (icon_view, false, false, 0);
+
}
ScrolledWindow = new ScrolledWindow ();
ScrolledWindow.ShadowType = ShadowType.None;
- ScrolledWindow.AddWithViewport (layout_vertical);
+ EventBox wrapper = new EventBox ();
+ wrapper.ModifyBg (StateType.Normal, tree_view.Style.Base (StateType.Normal));
+wrapper.Add (layout_vertical);
+ ScrolledWindow.AddWithViewport (wrapper);
return ScrolledWindow;
diff --git a/SparkleShare/SparkleShare.cs b/SparkleShare/SparkleShare.cs
index cb924ef2..866348e6 100644
--- a/SparkleShare/SparkleShare.cs
+++ b/SparkleShare/SparkleShare.cs
@@ -160,20 +160,51 @@ namespace SparkleShare {
public static string GetUserEmail ()
{
+ string email = "";
string global_config_file_path = SparkleHelpers.CombineMore (SparklePaths.SparkleConfigPath, "config");
- StreamReader reader = new StreamReader (global_config_file_path);
+ // Look in the global config file first
+ if (File.Exists (global_config_file_path)) {
- // Discard the first two lines
- reader.ReadLine ();
- reader.ReadLine ();
+ StreamReader reader = new StreamReader (global_config_file_path);
- string line = reader.ReadLine ();
- reader.Close ();
+ // Discard the first two lines
+ reader.ReadLine ();
+ reader.ReadLine ();
- string email = line.Substring (line.IndexOf ("=") + 2);
+ string line = reader.ReadLine ();
+ reader.Close ();
- return email;
+ email = line.Substring (line.IndexOf ("=") + 2);
+
+ return email;
+
+ // Secondly, look at the user's private key file name
+ } else {
+
+ string keys_path = SparklePaths.SparkleKeysPath;
+
+ if (!Directory.Exists (keys_path))
+ return "";
+
+ foreach (string file_path in Directory.GetFiles (keys_path)) {
+
+ string file_name = System.IO.Path.GetFileName (file_path);
+
+ if (file_name.StartsWith ("sparkleshare.") && file_name.EndsWith (".key")) {
+
+ email = file_name.Substring (file_name.IndexOf (".") + 1);
+ email = email.Substring (0, email.LastIndexOf ("."));
+
+ return email;
+
+ }
+
+ }
+
+ return "";
+
+ }
}
@@ -183,7 +214,7 @@ namespace SparkleShare {
public static void AddKey ()
{
- string keys_path = Path.Combine (SparklePaths.HomePath, ".ssh");
+ string keys_path = SparklePaths.SparkleKeysPath;
string key_file_name = "sparkleshare." + UserEmail + ".key";
Process process = new Process ();
diff --git a/SparkleShare/SparkleStatusIcon.cs b/SparkleShare/SparkleStatusIcon.cs
index 885ad55b..9e69714d 100644
--- a/SparkleShare/SparkleStatusIcon.cs
+++ b/SparkleShare/SparkleStatusIcon.cs
@@ -120,6 +120,7 @@ namespace SparkleShare {
SparkleLog log = new SparkleLog (path);
log.ShowAll ();
+ log.Present ();
};
@@ -228,9 +229,6 @@ namespace SparkleShare {
if (repo.Description != null)
menu_item.TooltipText = repo.Description;
- else
-
- menu_item.TooltipText = _("No description");
Menu.Add (menu_item);
diff --git a/SparkleShare/SparkleWindow.cs b/SparkleShare/SparkleWindow.cs
index 2aefd828..6ea97620 100644
--- a/SparkleShare/SparkleWindow.cs
+++ b/SparkleShare/SparkleWindow.cs
@@ -110,6 +110,14 @@ namespace SparkleShare {
ShowAll ();
}
+
+ new public void ShowAll ()
+ {
+
+ Present ();
+ base.ShowAll ();
+
+ }
}